@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
package/dist/render.js ADDED
@@ -0,0 +1,285 @@
1
+ import { parseFragment } from "./html.js";
2
+ import { createEntryId, createSubentryId } from "./id.js";
3
+ import { fillSlot } from "./template.js";
4
+ import { h } from "hastscript";
5
+ function errorProperties(error) {
6
+ return error === undefined ? {} : { dataIndexError: error };
7
+ }
8
+ const defaultHeading = ({ properties, contents }) => [
9
+ h("span", properties, contents),
10
+ ];
11
+ const defaultGroupHeading = ({ properties, contents }) => [
12
+ h("h2", properties, contents),
13
+ ];
14
+ const defaultLocationCompose = ({ properties, contents, }) => [h("a", properties, contents)];
15
+ const defaultPageNumber = ({ properties }) => [
16
+ h("span", properties),
17
+ ];
18
+ const defaultRangeSeparator = ({ properties }) => [
19
+ h("span", properties),
20
+ ];
21
+ const defaultLocatorCompose = ({ properties, contents, }) => [h("li", properties, contents)];
22
+ const defaultXrefTargetCompose = ({ properties, contents, }) => [h("a", properties, contents)];
23
+ const defaultXrefEntry = ({ properties, contents, }) => [h("span", properties, contents)];
24
+ const defaultXrefSubentrySeparator = ({ properties }) => [h("span", properties)];
25
+ const defaultXrefSubentry = ({ properties, contents, }) => [h("span", properties, contents)];
26
+ const defaultXrefCompose = ({ properties, contents, }) => [h("li", properties, contents)];
27
+ const defaultLocatorListCompose = ({ properties, locators, }) => [h("ul", properties, locators.flat())];
28
+ const defaultXrefPreferredListCompose = ({ properties, xrefPreferreds, }) => [h("ul", properties, xrefPreferreds.flat())];
29
+ const defaultXrefRelatedListCompose = ({ properties, xrefRelateds, }) => [h("ul", properties, xrefRelateds.flat())];
30
+ const defaultSubentryCompose = ({ properties, heading, locatorList, xrefPreferredList, xrefRelatedList, }) => [h("li", properties, [...heading, ...locatorList, ...xrefPreferredList, ...xrefRelatedList])];
31
+ const defaultSubentryListCompose = ({ properties, subentries, }) => [h("ul", properties, subentries.flat())];
32
+ const defaultEntryCompose = ({ properties, heading, locatorList, xrefPreferredList, xrefRelatedList, subentryList, }) => [
33
+ h("li", properties, [
34
+ ...heading,
35
+ ...locatorList,
36
+ ...xrefPreferredList,
37
+ ...xrefRelatedList,
38
+ ...subentryList,
39
+ ]),
40
+ ];
41
+ const defaultEntryListCompose = ({ properties, entries, }) => [h("ul", properties, entries.flat())];
42
+ const defaultGroupCompose = ({ properties, heading, entryList, }) => [h("section", properties, [...heading, ...entryList])];
43
+ const defaultGroupListCompose = ({ properties, groups, }) => [h("div", properties, groups.flat())];
44
+ const defaultIndexCompose = ({ groupList }) => groupList;
45
+ const bindRendererMethod = (renderer, method, defaultMethod) => method === undefined ? defaultMethod : method.bind(renderer);
46
+ const resolveLocationRenderer = (renderer) => ({
47
+ compose: bindRendererMethod(renderer, renderer.compose, defaultLocationCompose),
48
+ pageNumber: bindRendererMethod(renderer, renderer.pageNumber, defaultPageNumber),
49
+ rangeSeparator: bindRendererMethod(renderer, renderer.rangeSeparator, defaultRangeSeparator),
50
+ });
51
+ const resolveLocatorRenderer = (renderer) => ({
52
+ compose: bindRendererMethod(renderer, renderer.compose, defaultLocatorCompose),
53
+ location: resolveLocationRenderer(renderer.location ?? {}),
54
+ });
55
+ const resolveXrefTargetRenderer = (renderer) => ({
56
+ compose: bindRendererMethod(renderer, renderer.compose, defaultXrefTargetCompose),
57
+ entry: bindRendererMethod(renderer, renderer.entry, defaultXrefEntry),
58
+ subentrySeparator: bindRendererMethod(renderer, renderer.subentrySeparator, defaultXrefSubentrySeparator),
59
+ subentry: bindRendererMethod(renderer, renderer.subentry, defaultXrefSubentry),
60
+ });
61
+ const resolveXrefRenderer = (renderer) => ({
62
+ compose: bindRendererMethod(renderer, renderer.compose, defaultXrefCompose),
63
+ target: resolveXrefTargetRenderer(renderer.target ?? {}),
64
+ });
65
+ const resolveLocatorListRenderer = (renderer) => ({
66
+ compose: bindRendererMethod(renderer, renderer.compose, defaultLocatorListCompose),
67
+ locator: (context) => resolveLocatorRenderer(renderer.locator?.call(renderer, context) ?? {}),
68
+ });
69
+ const resolveXrefPreferredListRenderer = (renderer) => ({
70
+ compose: bindRendererMethod(renderer, renderer.compose, defaultXrefPreferredListCompose),
71
+ xrefPreferred: (context) => resolveXrefRenderer(renderer.xrefPreferred?.call(renderer, context) ?? {}),
72
+ });
73
+ const resolveXrefRelatedListRenderer = (renderer) => ({
74
+ compose: bindRendererMethod(renderer, renderer.compose, defaultXrefRelatedListCompose),
75
+ xrefRelated: (context) => resolveXrefRenderer(renderer.xrefRelated?.call(renderer, context) ?? {}),
76
+ });
77
+ const resolveSubentryRenderer = (renderer) => ({
78
+ compose: bindRendererMethod(renderer, renderer.compose, defaultSubentryCompose),
79
+ heading: bindRendererMethod(renderer, renderer.heading, defaultHeading),
80
+ locatorList: resolveLocatorListRenderer(renderer.locatorList ?? {}),
81
+ xrefPreferredList: resolveXrefPreferredListRenderer(renderer.xrefPreferredList ?? {}),
82
+ xrefRelatedList: resolveXrefRelatedListRenderer(renderer.xrefRelatedList ?? {}),
83
+ });
84
+ const resolveSubentryListRenderer = (renderer) => ({
85
+ compose: bindRendererMethod(renderer, renderer.compose, defaultSubentryListCompose),
86
+ subentry: (context) => resolveSubentryRenderer(renderer.subentry?.call(renderer, context) ?? {}),
87
+ });
88
+ const resolveEntryRenderer = (renderer) => ({
89
+ compose: bindRendererMethod(renderer, renderer.compose, defaultEntryCompose),
90
+ heading: bindRendererMethod(renderer, renderer.heading, defaultHeading),
91
+ locatorList: resolveLocatorListRenderer(renderer.locatorList ?? {}),
92
+ xrefPreferredList: resolveXrefPreferredListRenderer(renderer.xrefPreferredList ?? {}),
93
+ xrefRelatedList: resolveXrefRelatedListRenderer(renderer.xrefRelatedList ?? {}),
94
+ subentryList: resolveSubentryListRenderer(renderer.subentryList ?? {}),
95
+ });
96
+ const resolveEntryListRenderer = (renderer) => ({
97
+ compose: bindRendererMethod(renderer, renderer.compose, defaultEntryListCompose),
98
+ entry: (context) => resolveEntryRenderer(renderer.entry?.call(renderer, context) ?? {}),
99
+ });
100
+ const resolveGroupRenderer = (renderer) => ({
101
+ compose: bindRendererMethod(renderer, renderer.compose, defaultGroupCompose),
102
+ heading: bindRendererMethod(renderer, renderer.heading, defaultGroupHeading),
103
+ entryList: resolveEntryListRenderer(renderer.entryList ?? {}),
104
+ });
105
+ const resolveGroupListRenderer = (renderer) => ({
106
+ compose: bindRendererMethod(renderer, renderer.compose, defaultGroupListCompose),
107
+ group: (context) => resolveGroupRenderer(renderer.group?.call(renderer, context) ?? {}),
108
+ });
109
+ const resolveIndexRenderer = (renderer) => ({
110
+ compose: bindRendererMethod(renderer, renderer.compose, defaultIndexCompose),
111
+ groupList: resolveGroupListRenderer(renderer.groupList ?? {}),
112
+ });
113
+ export const defaultRenderer = () => resolveIndexRenderer({});
114
+ export function renderIndex(index, target, indexId, renderer) {
115
+ const resolvedRenderer = resolveIndexRenderer(renderer);
116
+ const groupListProperties = { dataIndexRole: "group-list" };
117
+ const groupListRenderer = resolvedRenderer.groupList;
118
+ const groups = index.groups.map((group) => renderGroup(group, { dataIndexRole: "group" }, indexId, groupListRenderer.group({ group: group.key })));
119
+ const groupListParts = { properties: groupListProperties, groups };
120
+ const groupList = groupListRenderer.compose(groupListParts);
121
+ target.data = { ...target.data, indexResult: index };
122
+ const indexParts = { groupList };
123
+ target.children = resolvedRenderer.compose(indexParts);
124
+ }
125
+ const renderHeading = (key, renderer) => {
126
+ const properties = {};
127
+ const contents = parseFragment(key.html);
128
+ const headingParts = { properties, contents };
129
+ return renderer.heading(headingParts);
130
+ };
131
+ const renderGroup = (group, properties, indexId, renderer) => {
132
+ const heading = renderHeading(group.key, renderer);
133
+ const entryListProperties = { dataIndexRole: "entry-list" };
134
+ const entryListRenderer = renderer.entryList;
135
+ const entries = group.entries.map((entry) => renderEntry(entry, { id: createEntryId(indexId, group.key, entry.key) }, indexId, group.key, entryListRenderer.entry({ entry: entry.key })));
136
+ const entryListParts = { properties: entryListProperties, entries };
137
+ const entryList = entryListRenderer.compose(entryListParts);
138
+ const groupParts = { properties, heading, entryList };
139
+ return renderer.compose(groupParts);
140
+ };
141
+ const renderEntry = (entry, properties, indexId, groupKey, renderer) => {
142
+ const heading = renderHeading(entry.key, renderer);
143
+ const locatorList = renderLocatorList(entry.locators, renderer);
144
+ const xrefPreferredList = renderPreferredXrefList(entry.xrefPreferred, indexId, renderer);
145
+ const xrefRelatedList = renderRelatedXrefList(entry.xrefRelated, indexId, renderer);
146
+ const subentryListProperties = { dataIndexRole: "subentry-list" };
147
+ const subentryListRenderer = renderer.subentryList;
148
+ const subentries = entry.subentries.map((subentry) => renderSubentry(subentry, { id: createSubentryId(indexId, groupKey, entry.key, subentry.key) }, indexId, subentryListRenderer.subentry({ subentry: subentry.key })));
149
+ const subentryListParts = {
150
+ properties: subentryListProperties,
151
+ subentries,
152
+ };
153
+ const subentryList = subentryListRenderer.compose(subentryListParts);
154
+ const entryParts = {
155
+ properties,
156
+ heading,
157
+ locatorList,
158
+ xrefPreferredList,
159
+ xrefRelatedList,
160
+ subentryList,
161
+ };
162
+ return renderer.compose(entryParts);
163
+ };
164
+ const renderSubentry = (subentry, properties, indexId, renderer) => {
165
+ const heading = renderHeading(subentry.key, renderer);
166
+ const locatorList = renderLocatorList(subentry.locators, renderer);
167
+ const xrefPreferredList = renderPreferredXrefList(subentry.xrefPreferred, indexId, renderer);
168
+ const xrefRelatedList = renderRelatedXrefList(subentry.xrefRelated, indexId, renderer);
169
+ const subentryParts = {
170
+ properties,
171
+ heading,
172
+ locatorList,
173
+ xrefPreferredList,
174
+ xrefRelatedList,
175
+ };
176
+ return renderer.compose(subentryParts);
177
+ };
178
+ const renderLocatorList = (locators, renderer) => {
179
+ const properties = { dataIndexRole: "locator-list" };
180
+ const listRenderer = renderer.locatorList;
181
+ const renderedLocators = locators.map((locator) => renderLocator(locator, listRenderer));
182
+ const locatorListParts = { properties, locators: renderedLocators };
183
+ return listRenderer.compose(locatorListParts);
184
+ };
185
+ const renderPageNumber = (target, renderer) => {
186
+ const properties = { dataIndexRole: "page-number", dataIndexPageTarget: target };
187
+ const pageNumberParts = { properties };
188
+ return renderer.pageNumber(pageNumberParts);
189
+ };
190
+ const renderLocatorContents = ({ location }, renderer) => {
191
+ if (location.type === "page") {
192
+ return renderPageNumber(location.href, renderer);
193
+ }
194
+ const separatorProperties = { dataIndexRole: "range-separator" };
195
+ const rangeSeparatorParts = { properties: separatorProperties };
196
+ return [
197
+ ...renderPageNumber(location.start, renderer),
198
+ ...renderer.rangeSeparator(rangeSeparatorParts),
199
+ ...renderPageNumber(location.end, renderer),
200
+ ];
201
+ };
202
+ const renderLocator = (locator, listRenderer) => {
203
+ const { location } = locator;
204
+ const locationProperties = {
205
+ dataIndexRole: location.type,
206
+ href: location.type === "page" ? location.href : location.start,
207
+ ...errorProperties(locator.error),
208
+ };
209
+ const renderer = listRenderer.locator({ locator });
210
+ const locationRenderer = renderer.location;
211
+ const locationParts = {
212
+ properties: locationProperties,
213
+ contents: renderLocatorContents(locator, locationRenderer),
214
+ };
215
+ const content = locationRenderer.compose(locationParts);
216
+ const contents = fillSlot(locator.template, content);
217
+ if (contents.length === 0) {
218
+ return [];
219
+ }
220
+ const locatorParts = { properties: {}, contents };
221
+ return renderer.compose(locatorParts);
222
+ };
223
+ const xrefId = (indexId, { group, entry, subentry }) => subentry === undefined
224
+ ? createEntryId(indexId, group, entry)
225
+ : createSubentryId(indexId, group, entry, subentry);
226
+ const renderPreferredXrefList = (xrefPreferreds, indexId, renderer) => {
227
+ const properties = { dataIndexRole: "xref-preferred" };
228
+ const listRenderer = renderer.xrefPreferredList;
229
+ const renderedXrefPreferreds = xrefPreferreds.map((xrefPreferred) => renderXref("preferred", xrefPreferred, indexId, listRenderer.xrefPreferred({ xrefPreferred })));
230
+ const xrefPreferredListParts = {
231
+ properties,
232
+ xrefPreferreds: renderedXrefPreferreds,
233
+ };
234
+ return listRenderer.compose(xrefPreferredListParts);
235
+ };
236
+ const renderRelatedXrefList = (xrefRelateds, indexId, renderer) => {
237
+ const properties = { dataIndexRole: "xref-related" };
238
+ const listRenderer = renderer.xrefRelatedList;
239
+ const renderedXrefRelateds = xrefRelateds.map((xrefRelated) => renderXref("related", xrefRelated, indexId, listRenderer.xrefRelated({ xrefRelated })));
240
+ const xrefRelatedListParts = {
241
+ properties,
242
+ xrefRelateds: renderedXrefRelateds,
243
+ };
244
+ return listRenderer.compose(xrefRelatedListParts);
245
+ };
246
+ const xrefProperties = ({ target, error }, indexId) => ({
247
+ href: `#${xrefId(indexId, target)}`,
248
+ ...errorProperties(error),
249
+ });
250
+ const renderXrefContents = (type, { target }, renderer) => {
251
+ const entryProperties = { dataIndexRole: `xref-${type}-entry` };
252
+ const entryContents = parseFragment(target.entry.html);
253
+ const entryParts = { properties: entryProperties, contents: entryContents };
254
+ const entry = renderer.entry(entryParts);
255
+ if (target.subentry === undefined) {
256
+ return entry;
257
+ }
258
+ const separatorProperties = {
259
+ dataIndexRole: `xref-${type}-subentry-separator`,
260
+ };
261
+ const subentryProperties = { dataIndexRole: `xref-${type}-subentry` };
262
+ const subentryContents = parseFragment(target.subentry.html);
263
+ const subentrySeparatorParts = { properties: separatorProperties };
264
+ const subentryParts = { properties: subentryProperties, contents: subentryContents };
265
+ return [
266
+ ...entry,
267
+ ...renderer.subentrySeparator(subentrySeparatorParts),
268
+ ...renderer.subentry(subentryParts),
269
+ ];
270
+ };
271
+ const renderXref = (type, xref, indexId, renderer) => {
272
+ const targetRenderer = renderer.target;
273
+ const targetParts = {
274
+ properties: xrefProperties(xref, indexId),
275
+ contents: renderXrefContents(type, xref, targetRenderer),
276
+ };
277
+ const content = targetRenderer.compose(targetParts);
278
+ const contents = fillSlot(xref.template, content);
279
+ if (contents.length === 0) {
280
+ return [];
281
+ }
282
+ const xrefParts = { properties: {}, contents };
283
+ return renderer.compose(xrefParts);
284
+ };
285
+ //# sourceMappingURL=render.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAe1D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,EAAE,CAAC,EAAE,MAAM,YAAY,CAAC;AAM/B,SAAS,eAAe,CACtB,KAAwB;IAExB,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC;AAC9D,CAAC;AAOD,MAAM,cAAc,GAAoB,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IACpE,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC;CAChC,CAAC;AAEF,MAAM,mBAAmB,GAAoB,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IACzE,CAAC,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,CAAC;CAC9B,CAAC;AAoBF,MAAM,sBAAsB,GAA6C,CAAC,EACxE,UAAU,EACV,QAAQ,GACT,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;AAErC,MAAM,iBAAiB,GAAgD,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;IACzF,CAAC,CAAC,MAAM,EAAE,UAAU,CAAC;CACtB,CAAC;AAEF,MAAM,qBAAqB,GAAoD,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;IACjG,CAAC,CAAC,MAAM,EAAE,UAAU,CAAC;CACtB,CAAC;AA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type Index, type IndexId, type MainEntry, type ResolvedKey, type Subentry } from "./model.js";
2
- type Locator = MainEntry<ResolvedKey>["locators"][0];
3
- type Reference = MainEntry<ResolvedKey>["see"][0];
1
+ import type { Entry, Group, HasKey, Index, Key, Subentry, Xref } from "./model.ts";
4
2
  type Comparator<T> = NonNullable<Parameters<Array<T>["sort"]>[0]>;
5
- export type Comparators = Record<IndexId, {
6
- group: Comparator<Group<ResolvedKey>>;
7
- mainEntry: Comparator<MainEntry<ResolvedKey>>;
8
- mainEntryLocator: Comparator<Locator>;
9
- mainEntrySee: Comparator<Reference>;
10
- mainEntrySeeAlso: Comparator<Reference>;
11
- subentry: Comparator<Subentry<ResolvedKey>>;
12
- subentryLocator: Comparator<Locator>;
13
- subentrySee: Comparator<Reference>;
14
- subentrySeeAlso: Comparator<Reference>;
3
+ export type IndexComparator = {
4
+ group: Comparator<Group>;
5
+ entry: Comparator<Entry>;
6
+ entryXrefPreferred: Comparator<Xref>;
7
+ entryXrefRelated: Comparator<Xref>;
8
+ subentry: Comparator<Subentry>;
9
+ subentryXrefPreferred: Comparator<Xref>;
10
+ subentryXrefRelated: Comparator<Xref>;
11
+ };
12
+ export type KeyComparator = Comparator<Key>;
13
+ export type CreateKeyComparator = (locales: Intl.LocalesArgument) => KeyComparator;
14
+ export type EntryComparator = Comparator<HasKey> & Comparator<Xref>;
15
+ export type CreateIndexComparator = (locales: Intl.LocalesArgument) => IndexComparator;
16
+ export declare function byKeys(compareKeys: KeyComparator): EntryComparator;
17
+ export type ListedKey = string | Readonly<{
18
+ html: string;
19
+ reading: string;
15
20
  }>;
16
- export declare const byListedOrder: Comparator<Locator> & Comparator<Reference>;
17
- export declare function byLocales(locales: Intl.LocalesArgument): Comparator<HasKey<ResolvedKey>> & Comparator<Reference>;
18
- export declare function sort(indexes: Index<ResolvedKey>[], comparators: Comparators): Index<ResolvedKey>[];
21
+ export declare function byLocales(locales: Intl.LocalesArgument): KeyComparator;
22
+ export declare function byListedOrder(order: readonly ListedKey[], fallback?: CreateKeyComparator): CreateKeyComparator;
23
+ export declare function sort(index: Index, comparator: IndexComparator): Index;
24
+ export declare function defaultComparator(locales: Intl.LocalesArgument): IndexComparator;
19
25
  export {};
20
26
  //# sourceMappingURL=sort.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../src/sort.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,KAAK,EACV,KAAK,MAAM,EACX,KAAK,KAAK,EACV,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,QAAQ,EACd,MAAM,YAAY,CAAC;AAEpB,KAAK,OAAO,GAAG,SAAS,CAAC,WAAW,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AACrD,KAAK,SAAS,GAAG,SAAS,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAElD,KAAK,UAAU,CAAC,CAAC,IAAI,WAAW,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClE,MAAM,MAAM,WAAW,GAAG,MAAM,CAC9B,OAAO,EACP;IACE,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC;IACtC,SAAS,EAAE,UAAU,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC;IAC9C,gBAAgB,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;IACtC,YAAY,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;IACpC,gBAAgB,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;IACxC,QAAQ,EAAE,UAAU,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;IAC5C,eAAe,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;IACrC,WAAW,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;IACnC,eAAe,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IAAI,CAAC,eAAe,KAAK,aAAa,CAAC;AACnF,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,MAAM,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;AACpE,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,eAAe,KAAK,eAAe,CAAC;AAUvF,wBAAgB,MAAM,CAAC,WAAW,EAAE,aAAa,GAAG,eAAe,CAYlE;AAED,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAO7E,wBAAgB,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,eAAe,GAAG,aAAa,CAkBtE;AAaD,wBAAgB,aAAa,CAC3B,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,QAAQ,GAAE,mBAA+B,GACxC,mBAAmB,CAarB;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,eAAe,GAAG,KAAK,CAkBrE;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,IAAI,CAAC,eAAe,GAAG,eAAe,CAWhF"}
package/dist/sort.js CHANGED
@@ -1,62 +1,100 @@
1
- import { hastChildrenToText, } from "./model.js";
2
- export const byListedOrder = (a, b) => a[0].localeCompare(b[0]);
3
- export function byLocales(locales) {
4
- const collator = new Intl.Collator(locales);
5
- return function self(a, b) {
6
- if (Array.isArray(a) && Array.isArray(b)) {
7
- const groupKeyCompare = self({ key: a[1] }, { key: b[1] });
8
- if (groupKeyCompare !== 0) {
9
- return groupKeyCompare;
10
- }
11
- const mainKeyCompare = self({ key: a[2] }, { key: b[2] });
12
- if (mainKeyCompare !== 0) {
13
- return mainKeyCompare;
14
- }
15
- if (a[3] && b[3]) {
16
- return self({ key: a[3] }, { key: b[3] });
17
- }
18
- if (a[3] && !b[3]) {
19
- return 1;
20
- }
21
- else if (!a[3] && b[3]) {
22
- return -1;
23
- }
24
- else {
25
- return 0;
1
+ import { fragmentToText } from "./html.js";
2
+ function keysOf(value) {
3
+ if (!("target" in value)) {
4
+ return [value.key];
5
+ }
6
+ const { group, entry, subentry } = value.target;
7
+ return subentry === undefined ? [group, entry] : [group, entry, subentry];
8
+ }
9
+ export function byKeys(compareKeys) {
10
+ return (a, b) => {
11
+ const aKeys = keysOf(a);
12
+ const bKeys = keysOf(b);
13
+ for (let depth = 0; depth < Math.min(aKeys.length, bKeys.length); depth++) {
14
+ const keyCompare = compareKeys(aKeys[depth], bKeys[depth]);
15
+ if (keyCompare !== 0) {
16
+ return keyCompare;
26
17
  }
27
18
  }
28
- else if (!Array.isArray(a) && !Array.isArray(b)) {
29
- const key1Compare = collator.compare(a.key[1], b.key[1]);
30
- return key1Compare !== 0
31
- ? key1Compare
32
- : collator.compare(hastChildrenToText(a.key[0]), hastChildrenToText(b.key[0]));
19
+ return aKeys.length - bKeys.length;
20
+ };
21
+ }
22
+ const listedKeyIdentity = (key) => {
23
+ const { html, reading } = typeof key === "string" ? { html: key, reading: key } : key;
24
+ return JSON.stringify([html.normalize("NFC"), reading.normalize("NFC")]);
25
+ };
26
+ export function byLocales(locales) {
27
+ const collator = new Intl.Collator(locales);
28
+ const htmlTexts = new Map();
29
+ const htmlText = (html) => {
30
+ const cached = htmlTexts.get(html);
31
+ if (cached !== undefined) {
32
+ return cached;
33
33
  }
34
- return 0;
34
+ const text = fragmentToText(html);
35
+ htmlTexts.set(html, text);
36
+ return text;
37
+ };
38
+ return (a, b) => {
39
+ const readingCompare = collator.compare(a.reading, b.reading);
40
+ return readingCompare !== 0
41
+ ? readingCompare
42
+ : collator.compare(htmlText(a.html), htmlText(b.html));
35
43
  };
36
44
  }
37
- export function sort(indexes, comparators) {
38
- const newIndexes = structuredClone(indexes);
39
- for (const index of newIndexes) {
40
- const comparator = comparators[index.id];
41
- if (!comparator) {
42
- continue;
45
+ function listedKeyPositions(order) {
46
+ const positions = new Map();
47
+ order.forEach((key, position) => {
48
+ const identity = listedKeyIdentity(key);
49
+ if (!positions.has(identity)) {
50
+ positions.set(identity, position);
43
51
  }
44
- index.children.sort(comparator.group);
45
- for (const group of index.children) {
46
- group.children.sort(comparator.mainEntry);
47
- for (const mainEntry of group.children) {
48
- mainEntry.locators.sort(comparator.mainEntryLocator);
49
- mainEntry.see.sort(comparator.mainEntrySee);
50
- mainEntry.seeAlso.sort(comparator.mainEntrySeeAlso);
51
- mainEntry.children.sort(comparator.subentry);
52
- for (const subentry of mainEntry.children) {
53
- subentry.locators.sort(comparator.subentryLocator);
54
- subentry.see.sort(comparator.subentrySee);
55
- subentry.seeAlso.sort(comparator.subentrySeeAlso);
56
- }
52
+ });
53
+ return positions;
54
+ }
55
+ export function byListedOrder(order, fallback = byLocales) {
56
+ const positions = listedKeyPositions(order);
57
+ return (locales) => {
58
+ const compareUnlisted = fallback(locales);
59
+ return (a, b) => {
60
+ const aPosition = positions.get(listedKeyIdentity(a));
61
+ const bPosition = positions.get(listedKeyIdentity(b));
62
+ if (aPosition === undefined || bPosition === undefined) {
63
+ return aPosition === bPosition ? compareUnlisted(a, b) : aPosition === undefined ? 1 : -1;
57
64
  }
58
- }
59
- }
60
- return newIndexes;
65
+ return aPosition - bPosition;
66
+ };
67
+ };
68
+ }
69
+ export function sort(index, comparator) {
70
+ return {
71
+ groups: index.groups.toSorted(comparator.group).map((group) => ({
72
+ key: group.key,
73
+ entries: group.entries.toSorted(comparator.entry).map((entry) => ({
74
+ key: entry.key,
75
+ locators: entry.locators,
76
+ xrefPreferred: entry.xrefPreferred.toSorted(comparator.entryXrefPreferred),
77
+ xrefRelated: entry.xrefRelated.toSorted(comparator.entryXrefRelated),
78
+ subentries: entry.subentries.toSorted(comparator.subentry).map((subentry) => ({
79
+ key: subentry.key,
80
+ locators: subentry.locators,
81
+ xrefPreferred: subentry.xrefPreferred.toSorted(comparator.subentryXrefPreferred),
82
+ xrefRelated: subentry.xrefRelated.toSorted(comparator.subentryXrefRelated),
83
+ })),
84
+ })),
85
+ })),
86
+ };
87
+ }
88
+ export function defaultComparator(locales) {
89
+ const compare = byKeys(byLocales(locales));
90
+ return {
91
+ group: compare,
92
+ entry: compare,
93
+ entryXrefPreferred: compare,
94
+ entryXrefRelated: compare,
95
+ subentry: compare,
96
+ subentryXrefPreferred: compare,
97
+ subentryXrefRelated: compare,
98
+ };
61
99
  }
62
100
  //# sourceMappingURL=sort.js.map
package/dist/sort.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"sort.js","sourceRoot":"","sources":["../src/sort.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,GAQnB,MAAM,YAAY,CAAC;AAqBpB,MAAM,CAAC,MAAM,aAAa,GAAgD,CACxE,CAAC,EACD,CAAC,EACD,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9B,MAAM,UAAU,SAAS,CACvB,OAA6B;IAE7B,MAAM,QAAQ,GAAG,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC5C,OAAO,SAAS,IAAI,CAClB,CAAC,EACD,CAAC;QAED,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;YACzC,MAAM,eAAe,GAAG,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YAC3D,IAAI,eAAe,KAAK,CAAC,EAAE,CAAC;gBAC1B,OAAO,eAAe,CAAC;YACzB,CAAC;YACD,MAAM,cAAc,GAAG,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;Y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ACJ,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type * as hast from "hast";
2
+ import { type ParsedInstruction } from "./instruction.ts";
3
+ import { type MessageArguments } from "./messages.ts";
4
+ import { type Target, type TargetKey } from "./target.ts";
5
+ type AttachmentBase = Readonly<{
6
+ sourcePath: string;
7
+ sourceId: string;
8
+ target: Target;
9
+ targetKey: TargetKey;
10
+ locationHref: string;
11
+ }>;
12
+ export type Attachment = AttachmentBase & Readonly<{
13
+ instruction: ParsedInstruction;
14
+ }>;
15
+ export type SourceSnapshot = Readonly<{
16
+ attachments: readonly Attachment[];
17
+ messages: readonly MessageArguments[];
18
+ }>;
19
+ export declare function collectSourceSnapshot(root: hast.Root, sourcePath: string): SourceSnapshot;
20
+ export {};
21
+ //# sourceMappingURL=source-snapshot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-snapshot.d.ts","sourceRoot":"","sources":["../src/source-snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,IAAI,MAAM,MAAM,CAAC;AAKlC,OAAO,EAAoB,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAG5E,OAAO,EAAY,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEhE,OAAO,EAAiC,KAAK,MAAM,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAEzF,KAAK,cAAc,GAAG,QAAQ,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,SAAS,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,QAAQ,CAAC;IAAE,WAAW,EAAE,iBAAiB,CAAA;CAAE,CAAC,CAAC;AAEvF,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IACpC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;IACnC,QAAQ,EAAE,SAAS,gBAAgB,EAAE,CAAC;CACvC,CAAC,CAAC;AAsBH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,GAAG,cAAc,CAmDzF"}