@u1f992/vivliostyle-index 0.2.4 → 0.3.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.
Files changed (102) hide show
  1. package/README.md +230 -24
  2. package/dist/document-renderer.d.ts +7 -0
  3. package/dist/document-renderer.d.ts.map +1 -0
  4. package/dist/document-renderer.js +86 -0
  5. package/dist/document-renderer.js.map +1 -0
  6. package/dist/file-system.d.ts +11 -0
  7. package/dist/file-system.d.ts.map +1 -0
  8. package/dist/file-system.js +93 -0
  9. package/dist/file-system.js.map +1 -0
  10. package/dist/html.d.ts +4 -0
  11. package/dist/html.d.ts.map +1 -0
  12. package/dist/html.js +9 -0
  13. package/dist/html.js.map +1 -0
  14. package/dist/id.d.ts +5 -0
  15. package/dist/id.d.ts.map +1 -0
  16. package/dist/id.js +30 -0
  17. package/dist/id.js.map +1 -0
  18. package/dist/index-builder.d.ts +15 -0
  19. package/dist/index-builder.d.ts.map +1 -0
  20. package/dist/index-builder.js +138 -0
  21. package/dist/index-builder.js.map +1 -0
  22. package/dist/index-state.d.ts +29 -0
  23. package/dist/index-state.d.ts.map +1 -0
  24. package/dist/index-state.js +95 -0
  25. package/dist/index-state.js.map +1 -0
  26. package/dist/index.d.ts +45 -15
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +53 -122
  29. package/dist/index.js.map +1 -1
  30. package/dist/instruction.d.ts +37 -0
  31. package/dist/instruction.d.ts.map +1 -0
  32. package/dist/instruction.js +267 -0
  33. package/dist/instruction.js.map +1 -0
  34. package/dist/location.d.ts +2 -0
  35. package/dist/location.d.ts.map +1 -0
  36. package/dist/location.js +17 -0
  37. package/dist/location.js.map +1 -0
  38. package/dist/messages.d.ts +24 -0
  39. package/dist/messages.d.ts.map +1 -0
  40. package/dist/messages.js +114 -0
  41. package/dist/messages.js.map +1 -0
  42. package/dist/model.d.ts +77 -36
  43. package/dist/model.d.ts.map +1 -1
  44. package/dist/model.js +112 -148
  45. package/dist/model.js.map +1 -1
  46. package/dist/platform.d.ts +4 -0
  47. package/dist/platform.d.ts.map +1 -0
  48. package/dist/platform.js +13 -0
  49. package/dist/platform.js.map +1 -0
  50. package/dist/profile.d.ts +11 -0
  51. package/dist/profile.d.ts.map +1 -0
  52. package/dist/profile.js +17 -0
  53. package/dist/profile.js.map +1 -0
  54. package/dist/render.d.ts +175 -0
  55. package/dist/render.d.ts.map +1 -0
  56. package/dist/render.js +285 -0
  57. package/dist/render.js.map +1 -0
  58. package/dist/sort.d.ts +22 -16
  59. package/dist/sort.d.ts.map +1 -1
  60. package/dist/sort.js +91 -53
  61. package/dist/sort.js.map +1 -1
  62. package/dist/source-snapshot.d.ts +21 -0
  63. package/dist/source-snapshot.d.ts.map +1 -0
  64. package/dist/source-snapshot.js +76 -0
  65. package/dist/source-snapshot.js.map +1 -0
  66. package/dist/target.d.ts +9 -0
  67. package/dist/target.d.ts.map +1 -0
  68. package/dist/target.js +17 -0
  69. package/dist/target.js.map +1 -0
  70. package/dist/template.d.ts +4 -0
  71. package/dist/template.d.ts.map +1 -0
  72. package/dist/template.js +15 -0
  73. package/dist/template.js.map +1 -0
  74. package/package.json +25 -17
  75. package/dist/command/expand.d.ts +0 -5
  76. package/dist/command/expand.d.ts.map +0 -1
  77. package/dist/command/expand.js +0 -193
  78. package/dist/command/expand.js.map +0 -1
  79. package/dist/command/insert-page.d.ts +0 -5
  80. package/dist/command/insert-page.d.ts.map +0 -1
  81. package/dist/command/insert-page.js +0 -32
  82. package/dist/command/insert-page.js.map +0 -1
  83. package/dist/command/insert-range.d.ts +0 -21
  84. package/dist/command/insert-range.d.ts.map +0 -1
  85. package/dist/command/insert-range.js +0 -61
  86. package/dist/command/insert-range.js.map +0 -1
  87. package/dist/command/insert-reference.d.ts +0 -4
  88. package/dist/command/insert-reference.d.ts.map +0 -1
  89. package/dist/command/insert-reference.js +0 -58
  90. package/dist/command/insert-reference.js.map +0 -1
  91. package/dist/command.d.ts +0 -25
  92. package/dist/command.d.ts.map +0 -1
  93. package/dist/command.js +0 -159
  94. package/dist/command.js.map +0 -1
  95. package/dist/resolve.d.ts +0 -3
  96. package/dist/resolve.d.ts.map +0 -1
  97. package/dist/resolve.js +0 -95
  98. package/dist/resolve.js.map +0 -1
  99. package/dist/util.d.ts +0 -10
  100. package/dist/util.d.ts.map +0 -1
  101. package/dist/util.js +0 -27
  102. package/dist/util.js.map +0 -1
@@ -0,0 +1,76 @@
1
+ import { getAttribute } from "hast-util-get-attribute";
2
+ import { getXPath } from "hast-util-get-xpath";
3
+ import { selectAll } from "hast-util-select";
4
+ import { parseInstruction } from "./instruction.js";
5
+ import { createSourceId } from "./id.js";
6
+ import { createLocationHref } from "./location.js";
7
+ import { messages } from "./messages.js";
8
+ import { documentUrl } from "./platform.js";
9
+ import { createTarget, createTargetKey } from "./target.js";
10
+ function ensureId(tree, element) {
11
+ const existingId = getAttribute(element, "id");
12
+ if (existingId !== null) {
13
+ return existingId;
14
+ }
15
+ const xpath = getXPath(tree, element);
16
+ if (xpath === null) {
17
+ throw new Error("getXPath() returned null for an element in the source tree");
18
+ }
19
+ const id = createSourceId(xpath);
20
+ if (element.properties) {
21
+ element.properties["id"] = id;
22
+ }
23
+ else {
24
+ element.properties = { id };
25
+ }
26
+ return id;
27
+ }
28
+ export function collectSourceSnapshot(root, sourcePath) {
29
+ const baseUrl = documentUrl(sourcePath);
30
+ const attachments = [];
31
+ const documentMessages = [];
32
+ for (const element of selectAll("[data-index]", root)) {
33
+ const reference = getAttribute(element, "data-index");
34
+ if (reference === null) {
35
+ continue;
36
+ }
37
+ let url;
38
+ let target;
39
+ try {
40
+ url = new URL(reference, baseUrl);
41
+ target = createTarget(url);
42
+ }
43
+ catch {
44
+ documentMessages.push(messages.invalidIndexReference(reference));
45
+ continue;
46
+ }
47
+ if (target.fragment === "") {
48
+ documentMessages.push(messages.missingTargetFragment(reference));
49
+ continue;
50
+ }
51
+ const instructionSource = url.searchParams.get("q");
52
+ if (instructionSource === null) {
53
+ documentMessages.push(messages.missingInstruction(reference));
54
+ continue;
55
+ }
56
+ let instruction;
57
+ try {
58
+ instruction = parseInstruction(instructionSource);
59
+ }
60
+ catch (error) {
61
+ documentMessages.push(messages.invalidInstruction(error, instructionSource));
62
+ continue;
63
+ }
64
+ const sourceId = ensureId(root, element);
65
+ const base = {
66
+ sourcePath,
67
+ sourceId,
68
+ target,
69
+ targetKey: createTargetKey(target),
70
+ locationHref: createLocationHref(sourcePath, target.path, sourceId),
71
+ };
72
+ attachments.push({ ...base, instruction });
73
+ }
74
+ return { attachments, messages: documentMessages };
75
+ }
76
+ //# sourceMappingURL=source-snapshot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-snapshot.js","sourceRoot":"","sources":["../src/source-snapshot.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,gBAAgB,EAA0B,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAyB,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,eAAe,EAA+B,MAAM,aAAa,CAAC;AAiBzF,SAAS,QAAQ,CAAC,IAAyB,EAAE,OAAqB;IAChE,MAAM,UAAU,GAAG,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC/C,IAAI,UAAU,KAAK,IAAI,EAAE,CAAC;QACxB,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACtC,IAAI,KAAK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,CAAC;QAED,MAAM,iBAAiB,GAAG,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACpD,IAAI,iBAAiB,KAAK,IAAI,EAAE,CAAC;YAC/B,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC,CAAC;YAC9D,SAAS;QACX,CAAC;QACD,IAAI,WAA8B,CAAC;QACnC,IAAI,CAAC;YACH,WAAW,GAAG,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;QACpD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC;YAC7E,SAAS;QACX,CAAC;QAED,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACzC,MAAM,IAAI,GAAG;YACX,UAAU;YACV,QAAQ;YACR,MAAM;YACN,SAAS,EAAE,eAAe,CAAC,MAAM,CAAC;YAClC,YAAY,EAAE,kBAAkB,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC;SACpE,CAAC;QACF,WAAW,CAAC,IAAI,CAAC,EAAE,GAAG,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAC;AACrD,CAAC"}
@@ -0,0 +1,9 @@
1
+ export type Target = Readonly<{
2
+ path: string;
3
+ fragment: string;
4
+ }>;
5
+ export type TargetKey = string;
6
+ export declare function createTarget(url: URL): Target;
7
+ export declare function resolveTarget(reference: string, baseUrl: URL): Target;
8
+ export declare function createTargetKey(target: Target): TargetKey;
9
+ //# sourceMappingURL=target.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"target.d.ts","sourceRoot":"","sources":["../src/target.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,MAAM,GAAG,QAAQ,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAE/B,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CAQ7C;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG,MAAM,CAErE;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAEzD"}
package/dist/target.js ADDED
@@ -0,0 +1,17 @@
1
+ import { documentPath } from "./platform.js";
2
+ export function createTarget(url) {
3
+ const strippedUrl = new URL(url);
4
+ strippedUrl.search = "";
5
+ strippedUrl.hash = "";
6
+ return {
7
+ path: documentPath(strippedUrl),
8
+ fragment: decodeURIComponent(url.hash.slice(1)),
9
+ };
10
+ }
11
+ export function resolveTarget(reference, baseUrl) {
12
+ return createTarget(new URL(reference, baseUrl));
13
+ }
14
+ export function createTargetKey(target) {
15
+ return JSON.stringify([target.path, target.fragment]);
16
+ }
17
+ //# sourceMappingURL=target.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"target.js","sourceRoot":"","sources":["../src/target.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAS7C,MAAM,UAAU,YAAY,CAAC,GAAQ;IACnC,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IACjC,WAAW,CAAC,MAAM,GAAG,EAAE,CAAC;IACxB,WAAW,CAAC,IAAI,GAAG,EAAE,CAAC;IACtB,OAAO;QACL,IAAI,EAAE,YAAY,CAAC,WAAW,CAAC;QAC/B,QAAQ,EAAE,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KAChD,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,SAAiB,EAAE,OAAY;IAC3D,OAAO,YAAY,CAAC,IAAI,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;AACxD,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type * as hast from "hast";
2
+ export declare const identityTemplate = "<slot></slot>";
3
+ export declare function fillSlot(template: string, content: readonly hast.ElementContent[]): hast.ElementContent[];
4
+ //# sourceMappingURL=template.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../src/template.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,IAAI,MAAM,MAAM,CAAC;AAIlC,eAAO,MAAM,gBAAgB,kBAAkB,CAAC;AAEhD,wBAAgB,QAAQ,CACtB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,SAAS,IAAI,CAAC,cAAc,EAAE,GACtC,IAAI,CAAC,cAAc,EAAE,CAEvB"}
@@ -0,0 +1,15 @@
1
+ import { parseFragment } from "./html.js";
2
+ export const identityTemplate = "<slot></slot>";
3
+ export function fillSlot(template, content) {
4
+ return replaceSlots(parseFragment(template), content);
5
+ }
6
+ const replaceSlots = (nodes, content) => nodes.flatMap((node) => {
7
+ if (node.type !== "element") {
8
+ return [node];
9
+ }
10
+ if (node.tagName === "slot") {
11
+ return [...content];
12
+ }
13
+ return [{ ...node, children: replaceSlots(node.children, content) }];
14
+ });
15
+ //# sourceMappingURL=template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.js","sourceRoot":"","sources":["../src/template.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,CAAC,MAAM,gBAAgB,GAAG,eAAe,CAAC;AAEhD,MAAM,UAAU,QAAQ,CACtB,QAAgB,EAChB,OAAuC;IAEvC,OAAO,YAAY,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC;AACxD,CAAC;AAED,MAAM,YAAY,GAAG,CACnB,KAAqC,EACrC,OAAuC,EAChB,EAAE,CACzB,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;IACrB,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC5B,OAAO,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IACD,IAAI,IAAI,CAAC,OAAO,KAAK,MAAM,EAAE,CAAC;QAC5B,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC;IACtB,CAAC;IACD,OAAO,CAAC,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;AACvE,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@u1f992/vivliostyle-index",
3
- "version": "0.2.4",
4
- "description": "unified plugin that integrates automatic index generation into Vivliostyle CLI workflows.",
3
+ "version": "0.3.0",
4
+ "description": "A unified plugin for generating indexes in Vivliostyle CLI builds.",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
7
- "lint": "eslint --fix \"src/**/*.ts\"",
8
- "format": "prettier --write \"src/**/*.ts\"",
7
+ "lint": "tsc --noEmit --ignoreConfig oxlint.config.ts && oxlint --fix src tests && npm run lint --workspaces --if-present",
8
+ "format": "tsc --noEmit --ignoreConfig oxfmt.config.ts && oxfmt src tests && npm run format --workspaces --if-present",
9
9
  "build": "tsc",
10
- "test": "node --test \"dist/**/*.test.js\"",
11
- "example": "cd example && npx vivliostyle preview"
10
+ "test": "tsc --project tests && node --test \"tests/**/*.test.ts\"",
11
+ "test:vivliostyle": "npm run build && npm test --workspace vivliostyle-e2e"
12
12
  },
13
13
  "keywords": [],
14
14
  "author": "Koutaro Mukai",
@@ -18,24 +18,32 @@
18
18
  "url": "https://github.com/u1f992/vivliostyle-index"
19
19
  },
20
20
  "type": "module",
21
+ "workspaces": [
22
+ "examples/*",
23
+ "tests/vivliostyle"
24
+ ],
21
25
  "devDependencies": {
22
- "@eslint/js": "^9.34.0",
23
- "@types/hast": "^2.3.10",
24
- "@types/node": "^24.3.0",
25
- "eslint": "^9.35.0",
26
- "prettier": "^3.6.2",
27
- "typescript": "^5.9.2",
28
- "typescript-eslint": "^8.42.0",
29
- "unified": "^9.0.0"
26
+ "@types/deep-equal": "^1.0.4",
27
+ "@types/hast": "^2.0.0",
28
+ "@types/node": "^24.13.3",
29
+ "@vivliostyle/cli": "11.1.0",
30
+ "memfs": "^4.68.1",
31
+ "oxfmt": "^0.63.0",
32
+ "oxlint": "^1.78.0",
33
+ "oxlint-tsgolint": "^7.0.2001",
34
+ "typescript": "^7.0.2",
35
+ "unified": "^9.0.0",
36
+ "vfile": "^4.0.0"
30
37
  },
31
38
  "dependencies": {
32
- "ajv": "^8.17.1",
39
+ "deep-equal": "^2.2.3",
33
40
  "hast-util-from-html": "^1.0.2",
34
41
  "hast-util-get-attribute": "^1.0.0",
35
42
  "hast-util-get-xpath": "^1.0.0",
36
43
  "hast-util-select": "^5.0.5",
37
44
  "hast-util-to-text": "^3.1.2",
38
- "upath": "^2.0.1",
39
- "yaml": "^2.8.1"
45
+ "hastscript": "^7.2.0",
46
+ "unist-util-visit-parents": "^5.1.3",
47
+ "upath": "^2.0.1"
40
48
  }
41
49
  }
@@ -1,5 +0,0 @@
1
- import type { IndexId } from "../model.js";
2
- type ExpandCommand = ["expand", IndexId];
3
- declare const _default: import("../command.js").Command<ExpandCommand>;
4
- export default _default;
5
- //# sourceMappingURL=expand.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"expand.d.ts","sourceRoot":"","sources":["../../src/command/expand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EAOR,MAAM,aAAa,CAAC;AAKrB,KAAK,aAAa,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;;AACzC,wBAiDE"}
@@ -1,193 +0,0 @@
1
- import { defineCommand } from "../command.js";
2
- export default defineCommand({
3
- type: "array",
4
- minItems: 2,
5
- maxItems: 2,
6
- prefixItems: [{ const: "expand" }, { $ref: "#/$defs/IndexId" }],
7
- },
8
- // @ts-expect-error resolved
9
- (cmd, indexes, elem) => {
10
- const indexId = cmd[1];
11
- const target = indexes.find((idx) => idx.id === indexId);
12
- if (!target) {
13
- elem.children = [];
14
- return;
15
- }
16
- // Create index groups container
17
- const indexGroups = {
18
- type: "element",
19
- tagName: "ol",
20
- properties: { className: "index-groups" },
21
- children: [],
22
- };
23
- // Generate groups
24
- for (const group of target.children) {
25
- const groupElement = {
26
- type: "element",
27
- tagName: "li",
28
- properties: { className: "index-group" },
29
- children: [
30
- ...JSON.parse(group.key[0]),
31
- {
32
- type: "element",
33
- tagName: "ol",
34
- properties: { className: "index-main-entries" },
35
- children: generateMainEntries(group.children, indexId, `${indexId}--${JSON.stringify(group.key)}`),
36
- },
37
- ],
38
- };
39
- indexGroups.children.push(groupElement);
40
- }
41
- elem.children = [indexGroups];
42
- });
43
- function generateMainEntries(mainEntries, indexId, slag) {
44
- return mainEntries.map((mainEntry) => {
45
- const currentSlag = `${slag}--${JSON.stringify(mainEntry.key)}`;
46
- const mainElement = {
47
- type: "element",
48
- tagName: "li",
49
- properties: {
50
- className: "index-main-entry",
51
- id: currentSlag,
52
- },
53
- children: [
54
- ...JSON.parse(mainEntry.key[0]),
55
- ...(mainEntry.locators.length !== 0
56
- ? [generateLocators(mainEntry.locators, "index-main-entry-locators")]
57
- : []),
58
- ...(mainEntry.see.length !== 0
59
- ? [generateReferences(mainEntry.see, "index-main-entry-see", indexId)]
60
- : []),
61
- ...(mainEntry.seeAlso.length !== 0
62
- ? [
63
- generateReferences(mainEntry.seeAlso, "index-main-entry-see-also", indexId),
64
- ]
65
- : []),
66
- ...(mainEntry.children.length !== 0
67
- ? [generateSubentries(mainEntry.children, indexId, currentSlag)]
68
- : []),
69
- ],
70
- };
71
- return mainElement;
72
- });
73
- }
74
- function generateSubentries(subentries, indexId, slag) {
75
- return {
76
- type: "element",
77
- tagName: "ol",
78
- properties: { className: "index-subentries" },
79
- children: subentries.map((subentry) => ({
80
- type: "element",
81
- tagName: "li",
82
- properties: {
83
- className: "index-subentry",
84
- id: `${slag}--${JSON.stringify(subentry.key)}`,
85
- },
86
- children: [
87
- ...JSON.parse(subentry.key[0]),
88
- ...(subentry.locators.length !== 0
89
- ? [generateLocators(subentry.locators, "index-subentry-locators")]
90
- : []),
91
- ...(subentry.see.length !== 0
92
- ? [generateReferences(subentry.see, "index-subentry-see", indexId)]
93
- : []),
94
- ...(subentry.seeAlso.length !== 0
95
- ? [
96
- generateReferences(subentry.seeAlso, "index-subentry-see-also", indexId),
97
- ]
98
- : []),
99
- ],
100
- })),
101
- };
102
- }
103
- function generateLocators(locators, className) {
104
- return {
105
- type: "element",
106
- tagName: "ol",
107
- properties: { className },
108
- children: locators.map(([, locator, important]) => ({
109
- type: "element",
110
- tagName: "li",
111
- properties: { ...(important ? { className: "important" } : {}) },
112
- children: Array.isArray(locator)
113
- ? [
114
- {
115
- type: "element",
116
- tagName: "a",
117
- properties: { href: locator[0] },
118
- children: [],
119
- },
120
- {
121
- type: "element",
122
- tagName: "span",
123
- properties: { className: className + "-separator" },
124
- children: [],
125
- },
126
- {
127
- type: "element",
128
- tagName: "a",
129
- properties: { href: locator[1] },
130
- children: [],
131
- },
132
- ]
133
- : [
134
- {
135
- type: "element",
136
- tagName: "a",
137
- properties: { href: locator },
138
- children: [],
139
- },
140
- ],
141
- })),
142
- };
143
- }
144
- function generateReferences(references, className, indexId) {
145
- return {
146
- type: "element",
147
- tagName: "ol",
148
- properties: { className },
149
- children: references.map(([, ...reference]) => ({
150
- type: "element",
151
- tagName: "li",
152
- children: reference.length === 2
153
- ? [
154
- {
155
- type: "element",
156
- tagName: "a",
157
- properties: {
158
- href: `#${indexId}--${JSON.stringify(reference[0])}--${JSON.stringify(reference[1])}`,
159
- },
160
- children: JSON.parse(reference[1][0]),
161
- },
162
- ]
163
- : [
164
- {
165
- type: "element",
166
- tagName: "a",
167
- properties: {
168
- href: `#${indexId}--${JSON.stringify(reference[0])}--${JSON.stringify(reference[1])}--${JSON.stringify(reference[2])}`,
169
- },
170
- children: [
171
- {
172
- type: "element",
173
- tagName: "span",
174
- children: JSON.parse(reference[1][0]),
175
- },
176
- {
177
- type: "element",
178
- tagName: "span",
179
- properties: { className: className + "-separator" },
180
- children: [],
181
- },
182
- {
183
- type: "element",
184
- tagName: "span",
185
- children: JSON.parse(reference[2][0]),
186
- },
187
- ],
188
- },
189
- ],
190
- })),
191
- };
192
- }
193
- //# sourceMappingURL=expand.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"expand.js","sourceRoot":"","sources":["../../src/command/expand.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAK9C,eAAe,aAAa,CAC1B;IACE,IAAI,EAAE,OAAO;IACb,QAAQ,EAAE,CAAC;IACX,QAAQ,EAAE,CAAC;IACX,WAAW,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC;CAChE;AACD,4BAA4B;AAC5B,CAAC,GAAG,EAAE,OAA6B,EAAE,IAAI,EAAE,EAAE;IAC3C,MAAM,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IACvB,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,OAAO,CAAC,CAAC;IACzD,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QACnB,OAAO;IACT,CAAC;IAED,gCAAgC;IAChC,M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AAI,OAAO,KAAK,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE;yBACtF;wBACD,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;qBACtC;iBACF;gBACH,CAAC,CAAC;oBACE;wBACE,IAAI,EAAE,SAAS;wBACf,OAAO,EAAE,GAAG;wBACZ,UAAU,EAAE;4BACV,IAAI,EAAE,IAAI,OAAO,KAAK,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE;yBACvH;wBACD,QAAQ,EAAE;4BACR;gCACE,IAAI,EAAE,SAAS;gCACf,OAAO,EAAE,MAAM;gCACf,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;6BACtC;4BACD;gCACE,IAAI,EAAE,SAAS;gCACf,OAAO,EAAE,MAAM;gCACf,UAAU,EAAE,EAAE,SAAS,EAAE,SAAS,GAAG,YAAY,EAAE;gCACnD,QAAQ,EAAE,EAAE;6BACb;4BACD;gCACE,IAAI,EAAE,SAAS;gCACf,OAAO,EAAE,MAAM;gCACf,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;6BACtC;yBACF;qBACF;iBACF;SACR,CAAC,CAAC;KACJ,CAAC;AACJ,CAAC"}
@@ -1,5 +0,0 @@
1
- import { type Base } from "../command.js";
2
- type InsertPageCommand = [...Base] | ["page!", ...Base];
3
- declare const _default: import("../command.js").Command<InsertPageCommand>;
4
- export default _default;
5
- //# sourceMappingURL=insert-page.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"insert-page.d.ts","sourceRoot":"","sources":["../../src/command/insert-page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAA8B,MAAM,eAAe,CAAC;AAGtE,KAAK,iBAAiB,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;;AACxD,wBAgCE"}
@@ -1,32 +0,0 @@
1
- import { defineCommand, ensureEntry } from "../command.js";
2
- import { insertLocator } from "../model.js";
3
- export default defineCommand({
4
- oneOf: [
5
- {
6
- type: "array",
7
- minItems: 2,
8
- maxItems: 2,
9
- prefixItems: [
10
- { $ref: "#/$defs/IndexId" },
11
- { $ref: "#/$defs/PartialEntryKey" },
12
- ],
13
- },
14
- {
15
- type: "array",
16
- minItems: 3,
17
- maxItems: 3,
18
- prefixItems: [
19
- { const: "page!" },
20
- { $ref: "#/$defs/IndexId" },
21
- { $ref: "#/$defs/PartialEntryKey" },
22
- ],
23
- },
24
- ],
25
- }, (cmd, indexes, elem, ensureId) => {
26
- const [indexId, partialEntryKey] = cmd.length === 2 ? cmd : [cmd[1], cmd[2]];
27
- insertLocator(ensureEntry(indexes, indexId, partialEntryKey, elem), [
28
- ensureId(elem),
29
- cmd.length === 3,
30
- ]);
31
- });
32
- //# sourceMappingURL=insert-page.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"insert-page.js","sourceRoot":"","sources":["../../src/command/insert-page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,aAAa,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5C,eAAe,aAAa,CAC1B;IACE,KAAK,EAAE;QACL;YACE,IAAI,EAAE,OAAO;YACb,QAAQ,EAAE,CAAC;YACX,QAAQ,EAAE,CAAC;YACX,WAAW,EAAE;gBACX,EAAE,IAAI,EAAE,iBAAiB,EAAE;gBAC3B,EAAE,IAAI,EAAE,yBAAyB,EAAE;aACpC;SACF;QACD;YACE,IAAI,EAAE,OAAO;YACb,QAAQ,EAAE,CAAC;YACX,QAAQ,EAAE,CAAC;YACX,WAAW,EAAE;gBACX,EAAE,KAAK,EAAE,OAAO,EAAE;gBAClB,EAAE,IAAI,EAAE,iBAAiB,EAAE;gBAC3B,EAAE,IAAI,EAAE,yBAAyB,EAAE;aACpC;SACF;KACF;CACF,EACD,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;IAC/B,MAAM,CAAC,OAAO,EAAE,eAAe,CAAC,GAC9B,GAAG,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5C,aAAa,CAAC,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,IAAI,CAAC,EAAE;QAClE,QAAQ,CAAC,IAAI,CAAC;QACd,GAAG,CAAC,MAAM,KAAK,CAAC;KACjB,CAAC,CAAC;AACL,CAAC,CACF,CAAC"}
@@ -1,21 +0,0 @@
1
- import { type PartialEntryKey } from "../command.js";
2
- import { type Index, type Key } from "../model.js";
3
- declare const __rangeStore: unique symbol;
4
- type RangeId = string;
5
- type IndexesWithRangeStore = Index<Key>[] & {
6
- [__rangeStore]?: {
7
- [key: RangeId]: {
8
- indexId: string;
9
- partialEntryKey: PartialEntryKey;
10
- important: boolean;
11
- elemId: string;
12
- elemStr: string;
13
- };
14
- };
15
- };
16
- export declare function deleteRangeStore(indexes: IndexesWithRangeStore): void;
17
- export declare const insertRangeStart: import("../command.js").Command<["range" | "range!", string, PartialEntryKey, string]>;
18
- type InsertRangeEndCommand = ["/range", RangeId];
19
- export declare const insertRangeEnd: import("../command.js").Command<InsertRangeEndCommand>;
20
- export {};
21
- //# sourceMappingURL=insert-range.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"insert-range.d.ts","sourceRoot":"","sources":["../../src/command/insert-range.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,eAAe,EACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAiB,KAAK,KAAK,EAAE,KAAK,GAAG,EAAE,MAAM,aAAa,CAAC;AAElE,QAAA,MAAM,YAAY,eAAW,CAAC;AAC9B,KAAK,OAAO,GAAG,MAAM,CAAC;AACtB,KAAK,qBAAqB,GAAG,KAAK,CAAC,GAAG,CAAC,EAAE,GAAG;IAC1C,CAAC,YAAY,CAAC,CAAC,EAAE;QACf,CAAC,GAAG,EAAE,OAAO,GAAG;YACd,OAAO,EAAE,MAAM,CAAC;YAChB,eAAe,EAAE,eAAe,CAAC;YACjC,SAAS,EAAE,OAAO,CAAC;YACnB,MAAM,EAAE,MAAM,CAAC;YACf,OAAO,EAAE,MAAM,CAAC;SACjB,CAAC;KACH,CAAC;CACH,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,qBAAqB,QAU9D;AAGD,eAAO,MAAM,gBAAgB,wFAyB5B,CAAC;AAEF,KAAK,qBAAqB,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AACjD,eAAO,MAAM,cAAc,wDA+B1B,CAAC"}
@@ -1,61 +0,0 @@
1
- import { defineCommand, ensureEntry, } from "../command.js";
2
- import { insertLocator } from "../model.js";
3
- const __rangeStore = Symbol();
4
- export function deleteRangeStore(indexes) {
5
- const rangeStore = indexes[__rangeStore];
6
- if (rangeStore) {
7
- for (const rangeId of Object.keys(rangeStore)) {
8
- console.warn(`range start found for id=${rangeId} but no matching end marker exists`);
9
- }
10
- }
11
- delete indexes[__rangeStore];
12
- }
13
- export const insertRangeStart = defineCommand({
14
- type: "array",
15
- minItems: 4,
16
- maxItems: 4,
17
- prefixItems: [
18
- {
19
- oneOf: [{ const: "range" }, { const: "range!" }],
20
- },
21
- { $ref: "#/$defs/IndexId" },
22
- { $ref: "#/$defs/PartialEntryKey" },
23
- { type: "string" },
24
- ],
25
- }, (cmd, indexes, elem, ensureId) => {
26
- const [type, indexId, partialEntryKey, rangeId] = cmd;
27
- const rangeStore = (indexes[__rangeStore] ??= {});
28
- rangeStore[rangeId] = {
29
- indexId,
30
- partialEntryKey,
31
- important: type === "range!",
32
- elemId: ensureId(elem),
33
- elemStr: JSON.stringify(elem),
34
- };
35
- });
36
- export const insertRangeEnd = defineCommand({
37
- type: "array",
38
- minItems: 2,
39
- maxItems: 2,
40
- prefixItems: [{ const: "/range" }, { type: "string" }],
41
- }, (cmd, indexes, elem, ensureId) => {
42
- const rangeId = cmd[1];
43
- const err = `range end found for id=${rangeId} but no matching start marker exists`;
44
- const rangeStore = indexes[__rangeStore];
45
- if (!rangeStore) {
46
- console.warn(err);
47
- return;
48
- }
49
- const start = rangeStore[rangeId];
50
- if (!start) {
51
- console.warn(err);
52
- return;
53
- }
54
- const { indexId, partialEntryKey, important, elemId, elemStr } = start;
55
- insertLocator(ensureEntry(indexes, indexId, partialEntryKey, JSON.parse(elemStr)), [[elemId, ensureId(elem)], important]);
56
- delete rangeStore[rangeId];
57
- if (Object.keys(rangeStore).length === 0) {
58
- delete indexes[__rangeStore];
59
- }
60
- });
61
- //# sourceMappingURL=insert-range.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"insert-range.js","sourceRoot":"","sources":["../../src/command/insert-range.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EACb,WAAW,GAEZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAwB,MAAM,aAAa,CAAC;AAElE,MAAM,YAAY,GAAG,MAAM,EAAE,CAAC;AAc9B,MAAM,UAAU,gBAAgB,CAAC,OAA8B;IAC7D,MAAM,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IACzC,IAAI,UAAU,EAAE,CAAC;QACf,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU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EAAE,OAA8B,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;IACtD,MAAM,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IACvB,MAAM,GAAG,GAAG,0BAA0B,OAAO,sCAAsC,CAAC;IACpF,MAAM,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IACzC,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAClB,OAAO;IACT,CAAC;IACD,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IAClC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAClB,OAAO;IACT,CAAC;IACD,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IACvE,aAAa,CACX,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,EACnE,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,SAAS,CAAC,CACtC,CAAC;IAEF,OAAO,UAAU,CAAC,OAAO,CAAC,CAAC;IAC3B,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzC,OAAO,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/B,CAAC;AACH,CAAC,CACF,CAAC"}
@@ -1,4 +0,0 @@
1
- import { type PartialEntryKey } from "../command.js";
2
- declare const _default: import("../command.js").Command<["see" | "seeAlso", string, PartialEntryKey, PartialEntryKey]>;
3
- export default _default;
4
- //# sourceMappingURL=insert-reference.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"insert-reference.d.ts","sourceRoot":"","sources":["../../src/command/insert-reference.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,eAAe,EAIrB,MAAM,eAAe,CAAC;;AAIvB,wBAkEE"}
@@ -1,58 +0,0 @@
1
- import { defineCommand, ensureEntry, padNull, } from "../command.js";
2
- import { ensureIndex, getChild, insertReference } from "../model.js";
3
- export default defineCommand({
4
- type: "array",
5
- minItems: 4,
6
- maxItems: 4,
7
- prefixItems: [
8
- { oneOf: [{ const: "see" }, { const: "seeAlso" }] },
9
- { $ref: "#/$defs/IndexId" },
10
- { $ref: "#/$defs/PartialEntryKey" },
11
- { $ref: "#/$defs/PartialEntryKey" },
12
- ],
13
- }, (cmd, indexes, elem) => {
14
- const [type, indexId, partialEntryKey, [groupPartialKey, mainEntryPartialKey, subentryPartialKey],] = cmd;
15
- const index = ensureIndex(indexes, indexId);
16
- const entry = ensureEntry(indexes, indexId, partialEntryKey, elem);
17
- const groupKey = padNull(groupPartialKey, elem);
18
- const mainKey = padNull(mainEntryPartialKey, elem);
19
- const subentryKey = typeof subentryPartialKey === "undefined"
20
- ? undefined
21
- : padNull(subentryPartialKey, elem);
22
- const group = getChild(index, groupKey);
23
- if (!group) {
24
- insertReference(entry, type,
25
- // @ts-expect-error spread
26
- [
27
- groupKey,
28
- mainKey,
29
- ...(typeof subentryKey === "undefined" ? [] : [subentryKey]),
30
- ]);
31
- }
32
- else {
33
- const mainEntry = getChild(group, mainKey);
34
- if (!mainEntry) {
35
- insertReference(entry, type,
36
- // @ts-expect-error spread
37
- [
38
- group.key,
39
- mainKey,
40
- ...(typeof subentryKey === "undefined" ? [] : [subentryKey]),
41
- ]);
42
- }
43
- else {
44
- if (typeof subentryKey === "undefined") {
45
- insertReference(entry, type, [group.key, mainEntry.key]);
46
- }
47
- else {
48
- const subentry = getChild(mainEntry, subentryKey);
49
- insertReference(entry, type, [
50
- group.key,
51
- mainEntry.key,
52
- subentry ? subentry.key : subentryKey,
53
- ]);
54
- }
55
- }
56
- }
57
- });
58
- //# sourceMappingURL=insert-reference.js.map