@m3e/toc 1.0.0-rc.1

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.
@@ -0,0 +1,565 @@
1
+ {
2
+ "schemaVersion": "1.0.0",
3
+ "readme": "",
4
+ "modules": [
5
+ {
6
+ "kind": "javascript-module",
7
+ "path": "src/index.ts",
8
+ "declarations": [],
9
+ "exports": [
10
+ {
11
+ "kind": "js",
12
+ "name": "*",
13
+ "declaration": {
14
+ "name": "*",
15
+ "package": "\"./TocElement\""
16
+ }
17
+ },
18
+ {
19
+ "kind": "js",
20
+ "name": "*",
21
+ "declaration": {
22
+ "name": "*",
23
+ "package": "\"./TocGenerator\""
24
+ }
25
+ },
26
+ {
27
+ "kind": "js",
28
+ "name": "*",
29
+ "declaration": {
30
+ "name": "*",
31
+ "package": "\"./TocItemElement\""
32
+ }
33
+ }
34
+ ]
35
+ },
36
+ {
37
+ "kind": "javascript-module",
38
+ "path": "src/TocElement.ts",
39
+ "declarations": [
40
+ {
41
+ "kind": "class",
42
+ "description": "",
43
+ "name": "M3eTocElement",
44
+ "cssProperties": [
45
+ {
46
+ "description": "Width of the table of contents.",
47
+ "name": "--m3e-toc-width"
48
+ },
49
+ {
50
+ "description": "Border radius of TOC items and active indicator.",
51
+ "name": "--m3e-toc-item-shape"
52
+ },
53
+ {
54
+ "description": "Border color of the active indicator.",
55
+ "name": "--m3e-toc-active-indicator-color"
56
+ },
57
+ {
58
+ "description": "Animation duration for the active indicator.",
59
+ "name": "--m3e-toc-active-indicator-animation-duration"
60
+ },
61
+ {
62
+ "description": "Inline padding for TOC items and header.",
63
+ "name": "--m3e-toc-item-padding"
64
+ },
65
+ {
66
+ "description": "Block space below and between header elements.",
67
+ "name": "--m3e-toc-header-space"
68
+ },
69
+ {
70
+ "description": "Font size for the overline slot.",
71
+ "name": "--m3e-toc-overline-font-size"
72
+ },
73
+ {
74
+ "description": "Font weight for the overline slot.",
75
+ "name": "--m3e-toc-overline-font-weight"
76
+ },
77
+ {
78
+ "description": "Line height for the overline slot.",
79
+ "name": "--m3e-toc-overline-line-height"
80
+ },
81
+ {
82
+ "description": "Letter spacing for the overline slot.",
83
+ "name": "--m3e-toc-overline-tracking"
84
+ },
85
+ {
86
+ "description": "Text color for the overline slot.",
87
+ "name": "--m3e-toc-overline-color"
88
+ },
89
+ {
90
+ "description": "Font size for the title slot.",
91
+ "name": "--m3e-toc-title-font-size"
92
+ },
93
+ {
94
+ "description": "Font weight for the title slot.",
95
+ "name": "--m3e-toc-title-font-weight"
96
+ },
97
+ {
98
+ "description": "Line height for the title slot.",
99
+ "name": "--m3e-toc-title-line-height"
100
+ },
101
+ {
102
+ "description": "Letter spacing for the title slot.",
103
+ "name": "--m3e-toc-title-tracking"
104
+ },
105
+ {
106
+ "description": "Text color for the title slot.",
107
+ "name": "--m3e-toc-title-color"
108
+ }
109
+ ],
110
+ "slots": [
111
+ {
112
+ "description": "Renders content between the header and items.",
113
+ "name": ""
114
+ },
115
+ {
116
+ "description": "Renders the overline of the table of contents.",
117
+ "name": "overline"
118
+ },
119
+ {
120
+ "description": "Renders the title of the table of contents.",
121
+ "name": "title"
122
+ }
123
+ ],
124
+ "members": [
125
+ {
126
+ "kind": "field",
127
+ "name": "_toc",
128
+ "type": {
129
+ "text": "Array<TocNode>"
130
+ },
131
+ "privacy": "private",
132
+ "default": "[]"
133
+ },
134
+ {
135
+ "kind": "field",
136
+ "name": "_activeIndicator",
137
+ "type": {
138
+ "text": "HTMLElement"
139
+ },
140
+ "privacy": "private",
141
+ "readonly": true
142
+ },
143
+ {
144
+ "kind": "field",
145
+ "name": "#ignoreScroll",
146
+ "privacy": "private",
147
+ "type": {
148
+ "text": "boolean"
149
+ },
150
+ "default": "false"
151
+ },
152
+ {
153
+ "kind": "field",
154
+ "name": "#selectionManager",
155
+ "privacy": "private",
156
+ "readonly": true
157
+ },
158
+ {
159
+ "kind": "field",
160
+ "name": "#intersectionController",
161
+ "privacy": "private",
162
+ "readonly": true,
163
+ "default": "new IntersectionController(this, { target: null, callback: (entries) => { if (!this.control || this.#ignoreScroll) return; const targetOffset = this.control.scrollTop; let closestElement: HTMLElement | null = null; let closestDistance = Number.POSITIVE_INFINITY; entries .filter((x) => x.isIntersecting) .map((x) => <HTMLElement>x.target) .forEach((item) => { const offsetTop = item.offsetTop; const distance = Math.abs(offsetTop - targetOffset); if (distance < closestDistance) { closestDistance = distance; closestElement = item; } }); if (closestElement) { const item = this.#selectionManager.items.find((x) => x.node?.element === closestElement); if (item) { this.#selectionManager.select(item); } } }, })"
164
+ },
165
+ {
166
+ "kind": "field",
167
+ "name": "#scrollController",
168
+ "privacy": "private",
169
+ "readonly": true,
170
+ "default": "new ScrollController(this, { target: null, callback: () => (this.#ignoreScroll = false), debounce: true, })"
171
+ },
172
+ {
173
+ "kind": "field",
174
+ "name": "#mutationController",
175
+ "privacy": "private",
176
+ "readonly": true,
177
+ "default": "new MutationController(this, { target: null, config: { childList: true, subtree: true, }, callback: () => this._updateToc(), })"
178
+ },
179
+ {
180
+ "kind": "field",
181
+ "name": "maxDepth",
182
+ "type": {
183
+ "text": "number"
184
+ },
185
+ "default": "2",
186
+ "description": "The maximum depth of the table of contents.",
187
+ "attribute": "max-depth"
188
+ },
189
+ {
190
+ "kind": "method",
191
+ "name": "attach",
192
+ "return": {
193
+ "type": {
194
+ "text": "void"
195
+ }
196
+ },
197
+ "parameters": [
198
+ {
199
+ "name": "control",
200
+ "type": {
201
+ "text": "HTMLElement"
202
+ }
203
+ }
204
+ ]
205
+ },
206
+ {
207
+ "kind": "method",
208
+ "name": "detach",
209
+ "return": {
210
+ "type": {
211
+ "text": "void"
212
+ }
213
+ }
214
+ },
215
+ {
216
+ "kind": "method",
217
+ "name": "#renderNode",
218
+ "privacy": "private",
219
+ "return": {
220
+ "type": {
221
+ "text": "unknown"
222
+ }
223
+ },
224
+ "parameters": [
225
+ {
226
+ "name": "node",
227
+ "type": {
228
+ "text": "TocNode"
229
+ }
230
+ }
231
+ ]
232
+ },
233
+ {
234
+ "kind": "method",
235
+ "name": "#handleOverlineSlotChange",
236
+ "privacy": "private",
237
+ "return": {
238
+ "type": {
239
+ "text": "void"
240
+ }
241
+ },
242
+ "parameters": [
243
+ {
244
+ "name": "e",
245
+ "type": {
246
+ "text": "Event"
247
+ }
248
+ }
249
+ ]
250
+ },
251
+ {
252
+ "kind": "method",
253
+ "name": "#handleTitleSlotChange",
254
+ "privacy": "private",
255
+ "return": {
256
+ "type": {
257
+ "text": "void"
258
+ }
259
+ },
260
+ "parameters": [
261
+ {
262
+ "name": "e",
263
+ "type": {
264
+ "text": "Event"
265
+ }
266
+ }
267
+ ]
268
+ },
269
+ {
270
+ "kind": "method",
271
+ "name": "#handleClick",
272
+ "privacy": "private",
273
+ "return": {
274
+ "type": {
275
+ "text": "void"
276
+ }
277
+ },
278
+ "parameters": [
279
+ {
280
+ "name": "e",
281
+ "type": {
282
+ "text": "Event"
283
+ }
284
+ }
285
+ ]
286
+ },
287
+ {
288
+ "kind": "method",
289
+ "name": "#generateToc",
290
+ "privacy": "private",
291
+ "return": {
292
+ "type": {
293
+ "text": "void"
294
+ }
295
+ }
296
+ },
297
+ {
298
+ "kind": "method",
299
+ "name": "_updateToc",
300
+ "privacy": "private",
301
+ "return": {
302
+ "type": {
303
+ "text": "void"
304
+ }
305
+ }
306
+ }
307
+ ],
308
+ "attributes": [
309
+ {
310
+ "description": "The query selector used to specify the element related to this element.",
311
+ "name": "for"
312
+ },
313
+ {
314
+ "description": "The maximum depth of the table of contents.",
315
+ "name": "max-depth",
316
+ "type": {
317
+ "text": "number"
318
+ },
319
+ "default": "2",
320
+ "fieldName": "maxDepth"
321
+ }
322
+ ],
323
+ "mixins": [
324
+ {
325
+ "name": "HtmlFor",
326
+ "package": "@m3e/core"
327
+ },
328
+ {
329
+ "name": "AttachInternals",
330
+ "package": "@m3e/core"
331
+ },
332
+ {
333
+ "name": "Role",
334
+ "package": "@m3e/core"
335
+ }
336
+ ],
337
+ "superclass": {
338
+ "name": "LitElement",
339
+ "package": "lit"
340
+ },
341
+ "tagName": "m3e-toc",
342
+ "customElement": true,
343
+ "summary": "A table of contents that provides in-page scroll navigation."
344
+ }
345
+ ],
346
+ "exports": [
347
+ {
348
+ "kind": "js",
349
+ "name": "M3eTocElement",
350
+ "declaration": {
351
+ "name": "M3eTocElement",
352
+ "module": "src/TocElement.ts"
353
+ }
354
+ },
355
+ {
356
+ "kind": "custom-element-definition",
357
+ "name": "m3e-toc",
358
+ "declaration": {
359
+ "name": "M3eTocElement",
360
+ "module": "src/TocElement.ts"
361
+ }
362
+ }
363
+ ]
364
+ },
365
+ {
366
+ "kind": "javascript-module",
367
+ "path": "src/TocGenerator.ts",
368
+ "declarations": [
369
+ {
370
+ "kind": "class",
371
+ "description": "Provides functionality used to generate a table of contents used for in-page navigation.",
372
+ "name": "TocGenerator",
373
+ "members": [
374
+ {
375
+ "kind": "method",
376
+ "name": "generate",
377
+ "static": true,
378
+ "return": {
379
+ "type": {
380
+ "text": "Array<TocNode>"
381
+ }
382
+ },
383
+ "parameters": [
384
+ {
385
+ "name": "element",
386
+ "type": {
387
+ "text": "HTMLElement"
388
+ },
389
+ "description": "The element for which to generate a table of contents."
390
+ },
391
+ {
392
+ "name": "maxDepth",
393
+ "default": "6",
394
+ "type": {
395
+ "text": "number"
396
+ },
397
+ "description": "The maximum depth of the table of contents.",
398
+ "optional": true
399
+ }
400
+ ],
401
+ "description": "Generates nodes from which to construct a table of contents for in-page navigation."
402
+ }
403
+ ]
404
+ }
405
+ ],
406
+ "exports": [
407
+ {
408
+ "kind": "js",
409
+ "name": "TocGenerator",
410
+ "declaration": {
411
+ "name": "TocGenerator",
412
+ "module": "src/TocGenerator.ts"
413
+ }
414
+ }
415
+ ]
416
+ },
417
+ {
418
+ "kind": "javascript-module",
419
+ "path": "src/TocItemElement.ts",
420
+ "declarations": [
421
+ {
422
+ "kind": "class",
423
+ "description": "An item in a table of contents.",
424
+ "name": "M3eTocItemElement",
425
+ "cssProperties": [
426
+ {
427
+ "description": "Border radius of the TOC item.",
428
+ "name": "--m3e-toc-item-shape"
429
+ },
430
+ {
431
+ "description": "Block padding for the TOC item.",
432
+ "name": "--m3e-toc-item-padding-block"
433
+ },
434
+ {
435
+ "description": "Inline padding for the TOC item.",
436
+ "name": "--m3e-toc-item-padding"
437
+ },
438
+ {
439
+ "description": "Indentation per level for the TOC item.",
440
+ "name": "--m3e-toc-item-inset"
441
+ },
442
+ {
443
+ "description": "Animation duration for the active indicator.",
444
+ "name": "--m3e-toc-active-indicator-animation-duration"
445
+ },
446
+ {
447
+ "description": "Font size for unselected items.",
448
+ "name": "--m3e-toc-item-font-size"
449
+ },
450
+ {
451
+ "description": "Font weight for unselected items.",
452
+ "name": "--m3e-toc-item-font-weight"
453
+ },
454
+ {
455
+ "description": "Line height for unselected items.",
456
+ "name": "--m3e-toc-item-line-height"
457
+ },
458
+ {
459
+ "description": "Letter spacing for unselected items.",
460
+ "name": "--m3e-toc-item-tracking"
461
+ },
462
+ {
463
+ "description": "Text color for unselected items.",
464
+ "name": "--m3e-toc-item-color"
465
+ },
466
+ {
467
+ "description": "Font size for selected items.",
468
+ "name": "--m3e-toc-item-selected-font-size"
469
+ },
470
+ {
471
+ "description": "Font weight for selected items.",
472
+ "name": "--m3e-toc-item-selected-font-weight"
473
+ },
474
+ {
475
+ "description": "Line height for selected items.",
476
+ "name": "--m3e-toc-item-selected-line-height"
477
+ },
478
+ {
479
+ "description": "Letter spacing for selected items.",
480
+ "name": "--m3e-toc-item-selected-tracking"
481
+ },
482
+ {
483
+ "description": "Text color for selected items.",
484
+ "name": "--m3e-toc-item-selected-color"
485
+ }
486
+ ],
487
+ "slots": [
488
+ {
489
+ "description": "Renders the label of the item.",
490
+ "name": ""
491
+ }
492
+ ],
493
+ "members": [
494
+ {
495
+ "kind": "field",
496
+ "name": "_base",
497
+ "type": {
498
+ "text": "HTMLElement | undefined"
499
+ },
500
+ "privacy": "private",
501
+ "readonly": true
502
+ },
503
+ {
504
+ "kind": "field",
505
+ "name": "_stateLayer",
506
+ "type": {
507
+ "text": "M3eStateLayerElement | undefined"
508
+ },
509
+ "privacy": "private",
510
+ "readonly": true
511
+ }
512
+ ],
513
+ "attributes": [
514
+ {
515
+ "description": "A value indicating whether the element is disabled.",
516
+ "name": "disabled"
517
+ }
518
+ ],
519
+ "mixins": [
520
+ {
521
+ "name": "Selected",
522
+ "package": "@m3e/core"
523
+ },
524
+ {
525
+ "name": "Disabled",
526
+ "package": "@m3e/core"
527
+ },
528
+ {
529
+ "name": "AttachInternals",
530
+ "package": "@m3e/core"
531
+ },
532
+ {
533
+ "name": "Role",
534
+ "package": "@m3e/core"
535
+ }
536
+ ],
537
+ "superclass": {
538
+ "name": "LitElement",
539
+ "package": "lit"
540
+ },
541
+ "tagName": "m3e-toc-item",
542
+ "customElement": true
543
+ }
544
+ ],
545
+ "exports": [
546
+ {
547
+ "kind": "js",
548
+ "name": "M3eTocItemElement",
549
+ "declaration": {
550
+ "name": "M3eTocItemElement",
551
+ "module": "src/TocItemElement.ts"
552
+ }
553
+ },
554
+ {
555
+ "kind": "custom-element-definition",
556
+ "name": "m3e-toc-item",
557
+ "declaration": {
558
+ "name": "M3eTocItemElement",
559
+ "module": "src/TocItemElement.ts"
560
+ }
561
+ }
562
+ ]
563
+ }
564
+ ]
565
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/microsoft/vscode-html-languageservice/main/docs/customData.schema.json",
3
+ "version": 1.1,
4
+ "tags": [
5
+ {
6
+ "name": "m3e-toc",
7
+ "description": "A table of contents that provides in-page scroll navigation.\n---\n\n\n### **Slots:**\n - _default_ - Renders content between the header and items.\n- **overline** - Renders the overline of the table of contents.\n- **title** - Renders the title of the table of contents.\n\n### **CSS Properties:**\n - **--m3e-toc-width** - Width of the table of contents. _(default: undefined)_\n- **--m3e-toc-item-shape** - Border radius of TOC items and active indicator. _(default: undefined)_\n- **--m3e-toc-active-indicator-color** - Border color of the active indicator. _(default: undefined)_\n- **--m3e-toc-active-indicator-animation-duration** - Animation duration for the active indicator. _(default: undefined)_\n- **--m3e-toc-item-padding** - Inline padding for TOC items and header. _(default: undefined)_\n- **--m3e-toc-header-space** - Block space below and between header elements. _(default: undefined)_\n- **--m3e-toc-overline-font-size** - Font size for the overline slot. _(default: undefined)_\n- **--m3e-toc-overline-font-weight** - Font weight for the overline slot. _(default: undefined)_\n- **--m3e-toc-overline-line-height** - Line height for the overline slot. _(default: undefined)_\n- **--m3e-toc-overline-tracking** - Letter spacing for the overline slot. _(default: undefined)_\n- **--m3e-toc-overline-color** - Text color for the overline slot. _(default: undefined)_\n- **--m3e-toc-title-font-size** - Font size for the title slot. _(default: undefined)_\n- **--m3e-toc-title-font-weight** - Font weight for the title slot. _(default: undefined)_\n- **--m3e-toc-title-line-height** - Line height for the title slot. _(default: undefined)_\n- **--m3e-toc-title-tracking** - Letter spacing for the title slot. _(default: undefined)_\n- **--m3e-toc-title-color** - Text color for the title slot. _(default: undefined)_",
8
+ "attributes": [
9
+ {
10
+ "name": "for",
11
+ "description": "The query selector used to specify the element related to this element.",
12
+ "values": []
13
+ },
14
+ {
15
+ "name": "max-depth",
16
+ "description": "The maximum depth of the table of contents.",
17
+ "values": []
18
+ }
19
+ ],
20
+ "references": []
21
+ },
22
+ {
23
+ "name": "m3e-toc-item",
24
+ "description": "An item in a table of contents.\n---\n\n\n### **Slots:**\n - _default_ - Renders the label of the item.\n\n### **CSS Properties:**\n - **--m3e-toc-item-shape** - Border radius of the TOC item. _(default: undefined)_\n- **--m3e-toc-item-padding-block** - Block padding for the TOC item. _(default: undefined)_\n- **--m3e-toc-item-padding** - Inline padding for the TOC item. _(default: undefined)_\n- **--m3e-toc-item-inset** - Indentation per level for the TOC item. _(default: undefined)_\n- **--m3e-toc-active-indicator-animation-duration** - Animation duration for the active indicator. _(default: undefined)_\n- **--m3e-toc-item-font-size** - Font size for unselected items. _(default: undefined)_\n- **--m3e-toc-item-font-weight** - Font weight for unselected items. _(default: undefined)_\n- **--m3e-toc-item-line-height** - Line height for unselected items. _(default: undefined)_\n- **--m3e-toc-item-tracking** - Letter spacing for unselected items. _(default: undefined)_\n- **--m3e-toc-item-color** - Text color for unselected items. _(default: undefined)_\n- **--m3e-toc-item-selected-font-size** - Font size for selected items. _(default: undefined)_\n- **--m3e-toc-item-selected-font-weight** - Font weight for selected items. _(default: undefined)_\n- **--m3e-toc-item-selected-line-height** - Line height for selected items. _(default: undefined)_\n- **--m3e-toc-item-selected-tracking** - Letter spacing for selected items. _(default: undefined)_\n- **--m3e-toc-item-selected-color** - Text color for selected items. _(default: undefined)_",
25
+ "attributes": [
26
+ {
27
+ "name": "disabled",
28
+ "description": "A value indicating whether the element is disabled.",
29
+ "values": []
30
+ }
31
+ ],
32
+ "references": []
33
+ }
34
+ ]
35
+ }