docusaurus-plugin-glossary 3.0.2 → 3.2.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 (50) hide show
  1. package/dist/chunk-4CUFUKUA.js +109 -0
  2. package/dist/chunk-4CUFUKUA.js.map +1 -0
  3. package/dist/chunk-PEB4Y6RI.js +311 -0
  4. package/dist/chunk-PEB4Y6RI.js.map +1 -0
  5. package/dist/chunk-SNP37IVL.js +212 -0
  6. package/dist/chunk-SNP37IVL.js.map +1 -0
  7. package/dist/client/index.cjs +55 -0
  8. package/dist/client/index.cjs.map +1 -0
  9. package/dist/client/index.js +10 -21
  10. package/dist/client/index.js.map +1 -0
  11. package/dist/components/GlossaryPage.cjs +130 -0
  12. package/dist/components/GlossaryPage.cjs.map +1 -0
  13. package/dist/components/GlossaryPage.js +74 -113
  14. package/dist/components/GlossaryPage.js.map +1 -0
  15. package/dist/index.cjs +659 -0
  16. package/dist/index.cjs.map +1 -0
  17. package/dist/index.d.cts +173 -0
  18. package/dist/index.d.ts +83 -11
  19. package/dist/index.js +23 -173
  20. package/dist/index.js.map +1 -0
  21. package/dist/preset.cjs +710 -0
  22. package/dist/preset.cjs.map +1 -0
  23. package/dist/preset.d.cts +98 -0
  24. package/dist/preset.d.ts +8 -7
  25. package/dist/preset.js +79 -143
  26. package/dist/preset.js.map +1 -0
  27. package/dist/remark/glossary-terms.cjs +345 -0
  28. package/dist/remark/glossary-terms.cjs.map +1 -0
  29. package/dist/remark/glossary-terms.js +9 -440
  30. package/dist/remark/glossary-terms.js.map +1 -0
  31. package/dist/theme/GlossaryTerm/index.cjs +138 -0
  32. package/dist/theme/GlossaryTerm/index.cjs.map +1 -0
  33. package/dist/theme/GlossaryTerm/index.js +56 -90
  34. package/dist/theme/GlossaryTerm/index.js.map +1 -0
  35. package/dist/validation.cjs +238 -0
  36. package/dist/validation.cjs.map +1 -0
  37. package/dist/validation.d.cts +2 -0
  38. package/dist/validation.d.ts +2 -44
  39. package/dist/validation.js +11 -246
  40. package/dist/validation.js.map +1 -0
  41. package/package.json +25 -30
  42. package/dist/components/GlossaryPage.test.js +0 -205
  43. package/dist/index.d.ts.map +0 -1
  44. package/dist/preset.d.ts.map +0 -1
  45. package/dist/remark/glossary-terms.d.ts +0 -28
  46. package/dist/remark/glossary-terms.d.ts.map +0 -1
  47. package/dist/theme/GlossaryTerm/index.test.js +0 -143
  48. package/dist/validation.d.ts.map +0 -1
  49. /package/dist/{components/GlossaryPage.module.css → GlossaryPage.module-M4DEUP4X.module.css} +0 -0
  50. /package/dist/{theme/GlossaryTerm/styles.module.css → styles.module-N7ME3MWS.module.css} +0 -0
@@ -1,143 +0,0 @@
1
- import React from 'react';
2
- import { render, screen, act } from '@testing-library/react';
3
- import userEvent from '@testing-library/user-event';
4
- import GlossaryTerm from './index';
5
-
6
- describe('GlossaryTerm', () => {
7
- it('should render term text', () => {
8
- render(<GlossaryTerm term="API" definition="Application Programming Interface" />);
9
-
10
- const link = screen.getByRole('link', { name: 'API' });
11
- expect(link).toBeInTheDocument();
12
- expect(link).toHaveAttribute('href', '/glossary#api');
13
- });
14
-
15
- it('should render custom children text', () => {
16
- render(
17
- <GlossaryTerm term="API" definition="Application Programming Interface">
18
- Application Programming Interface
19
- </GlossaryTerm>
20
- );
21
-
22
- const link = screen.getByRole('link', { name: 'Application Programming Interface' });
23
- expect(link).toBeInTheDocument();
24
- expect(link).toHaveAttribute('href', '/glossary#api');
25
- });
26
-
27
- it('should show tooltip on hover', async () => {
28
- const user = userEvent.setup();
29
- render(<GlossaryTerm term="API" definition="Application Programming Interface" />);
30
-
31
- const link = screen.getByRole('link');
32
- await user.hover(link);
33
-
34
- const tooltip = screen.getByRole('tooltip');
35
- expect(tooltip).toBeInTheDocument();
36
- expect(tooltip).toHaveClass('tooltipVisible');
37
- expect(tooltip).toHaveTextContent('API Application Programming Interface');
38
- });
39
-
40
- it('should hide tooltip on mouse leave', async () => {
41
- const user = userEvent.setup();
42
- render(<GlossaryTerm term="API" definition="Application Programming Interface" />);
43
-
44
- const link = screen.getByRole('link');
45
- await user.hover(link);
46
-
47
- let tooltip = screen.getByRole('tooltip');
48
- expect(tooltip).toBeInTheDocument();
49
- expect(tooltip).toHaveClass('tooltipVisible');
50
-
51
- await user.unhover(link);
52
- // Tooltip is still in DOM but hidden via CSS
53
- tooltip = screen.getByRole('tooltip');
54
- expect(tooltip).not.toHaveClass('tooltipVisible');
55
- });
56
-
57
- it('should show tooltip on focus', async () => {
58
- const user = userEvent.setup();
59
- render(<GlossaryTerm term="API" definition="Application Programming Interface" />);
60
-
61
- const link = screen.getByRole('link');
62
- await user.tab();
63
- expect(link).toHaveFocus();
64
-
65
- const tooltip = screen.getByRole('tooltip');
66
- expect(tooltip).toBeInTheDocument();
67
- expect(tooltip).toHaveClass('tooltipVisible');
68
- });
69
-
70
- it('should hide tooltip on blur', async () => {
71
- const user = userEvent.setup();
72
- render(<GlossaryTerm term="API" definition="Application Programming Interface" />);
73
-
74
- const link = screen.getByRole('link');
75
- await user.tab();
76
- expect(link).toHaveFocus();
77
-
78
- let tooltip = screen.getByRole('tooltip');
79
- expect(tooltip).toBeInTheDocument();
80
- expect(tooltip).toHaveClass('tooltipVisible');
81
-
82
- await user.tab();
83
- // Tooltip is still in DOM but hidden via CSS
84
- tooltip = screen.getByRole('tooltip');
85
- expect(tooltip).not.toHaveClass('tooltipVisible');
86
- });
87
-
88
- it('should generate correct ID from term with spaces', () => {
89
- render(<GlossaryTerm term="Machine Learning" definition="A type of AI" />);
90
-
91
- const link = screen.getByRole('link');
92
- expect(link).toHaveAttribute('href', '/glossary#machine-learning');
93
- });
94
-
95
- it('should work without definition prop', () => {
96
- render(<GlossaryTerm term="TestTerm" />);
97
-
98
- const link = screen.getByRole('link', { name: 'TestTerm' });
99
- expect(link).toBeInTheDocument();
100
- expect(link).toHaveAttribute('href', '/glossary#testterm');
101
-
102
- // No tooltip should be rendered when no definition
103
- const tooltip = screen.queryByRole('tooltip');
104
- expect(tooltip).not.toBeInTheDocument();
105
- });
106
-
107
- it('should have proper ARIA attributes', () => {
108
- render(<GlossaryTerm term="API" definition="Application Programming Interface" />);
109
-
110
- const link = screen.getByRole('link');
111
- expect(link).toHaveAttribute('aria-describedby', 'tooltip-api');
112
-
113
- const tooltip = screen.getByRole('tooltip');
114
- expect(tooltip).toHaveAttribute('id', 'tooltip-api');
115
- });
116
-
117
- it('positions tooltip within viewport and adds placement classes', async () => {
118
- const user = userEvent.setup();
119
- render(<GlossaryTerm term="Edge" definition="Near the boundary of the viewport" />);
120
-
121
- const link = screen.getByRole('link');
122
- await user.hover(link);
123
-
124
- const tooltip = screen.getByRole('tooltip');
125
- expect(tooltip).toHaveClass('tooltipVisible');
126
- expect(tooltip).toHaveClass('tooltipFloating');
127
- // One of the placement classes should be present
128
- const hasPlacement =
129
- tooltip.classList.contains('tooltipTop') || tooltip.classList.contains('tooltipBottom');
130
- expect(hasPlacement).toBe(true);
131
- // Wait for the double requestAnimationFrame position update to complete
132
- await act(async () => {
133
- await new Promise(resolve => {
134
- requestAnimationFrame(() => {
135
- requestAnimationFrame(resolve);
136
- });
137
- });
138
- });
139
- // Inline style should include computed top/left
140
- expect(tooltip.style.top).toMatch(/px$/);
141
- expect(tooltip.style.left).toMatch(/px$/);
142
- });
143
- });
@@ -1 +0,0 @@
1
- {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAgB,MAAM,YAAY,CAAC;AAE7D,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,IAAI,EAAE,YAAY,CAAC;CACpB;AAiHD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,OAAO,EACb,OAAO,GAAE;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAO,GACvC,gBAAgB,CAoGlB;AAED;;;GAGG;AACH,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,SAAgB,MAAM,EAAE,eAAe,EAAE,CAAC;gBAE9B,MAAM,EAAE,eAAe,EAAE;CAWtC;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,CAqBxE"}