polen 0.10.0-next.12 → 0.10.0-next.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/build/lib/graphql-document/components/CopyButton.d.ts +19 -0
  2. package/build/lib/graphql-document/components/CopyButton.d.ts.map +1 -0
  3. package/build/lib/graphql-document/components/CopyButton.js +43 -0
  4. package/build/lib/graphql-document/components/CopyButton.js.map +1 -0
  5. package/build/lib/graphql-document/components/GraphQLDocument.d.ts +0 -4
  6. package/build/lib/graphql-document/components/GraphQLDocument.d.ts.map +1 -1
  7. package/build/lib/graphql-document/components/GraphQLDocument.js +31 -74
  8. package/build/lib/graphql-document/components/GraphQLDocument.js.map +1 -1
  9. package/build/lib/graphql-document/components/GraphQLIdentifierPopover.d.ts +33 -0
  10. package/build/lib/graphql-document/components/GraphQLIdentifierPopover.d.ts.map +1 -0
  11. package/build/lib/graphql-document/components/GraphQLIdentifierPopover.js +48 -0
  12. package/build/lib/graphql-document/components/GraphQLIdentifierPopover.js.map +1 -0
  13. package/build/lib/graphql-document/components/IdentifierLink.d.ts +15 -13
  14. package/build/lib/graphql-document/components/IdentifierLink.d.ts.map +1 -1
  15. package/build/lib/graphql-document/components/IdentifierLink.js +51 -117
  16. package/build/lib/graphql-document/components/IdentifierLink.js.map +1 -1
  17. package/build/lib/graphql-document/components/graphql-document-styles.d.ts +5 -0
  18. package/build/lib/graphql-document/components/graphql-document-styles.d.ts.map +1 -0
  19. package/build/lib/graphql-document/components/graphql-document-styles.js +167 -0
  20. package/build/lib/graphql-document/components/graphql-document-styles.js.map +1 -0
  21. package/build/lib/graphql-document/components/index.d.ts +2 -1
  22. package/build/lib/graphql-document/components/index.d.ts.map +1 -1
  23. package/build/lib/graphql-document/components/index.js +2 -1
  24. package/build/lib/graphql-document/components/index.js.map +1 -1
  25. package/build/lib/graphql-document/hooks/use-tooltip-state.d.ts +43 -0
  26. package/build/lib/graphql-document/hooks/use-tooltip-state.d.ts.map +1 -0
  27. package/build/lib/graphql-document/hooks/use-tooltip-state.js +132 -0
  28. package/build/lib/graphql-document/hooks/use-tooltip-state.js.map +1 -0
  29. package/package.json +2 -1
  30. package/src/lib/graphql-document/components/CopyButton.tsx +76 -0
  31. package/src/lib/graphql-document/components/GraphQLDocument.tsx +52 -86
  32. package/src/lib/graphql-document/components/GraphQLIdentifierPopover.tsx +197 -0
  33. package/src/lib/graphql-document/components/IdentifierLink.tsx +105 -166
  34. package/src/lib/graphql-document/components/graphql-document-styles.ts +167 -0
  35. package/src/lib/graphql-document/components/index.ts +2 -1
  36. package/src/lib/graphql-document/hooks/use-tooltip-state.test.ts +76 -0
  37. package/src/lib/graphql-document/hooks/use-tooltip-state.ts +191 -0
  38. package/build/lib/graphql-document/components/HoverTooltip.d.ts +0 -35
  39. package/build/lib/graphql-document/components/HoverTooltip.d.ts.map +0 -1
  40. package/build/lib/graphql-document/components/HoverTooltip.js +0 -132
  41. package/build/lib/graphql-document/components/HoverTooltip.js.map +0 -1
  42. package/src/lib/graphql-document/components/HoverTooltip.tsx +0 -282
@@ -1,19 +1,12 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState } from 'react';
3
- import { HoverTooltip } from "./HoverTooltip.js";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { GraphQLIdentifierPopover } from "./GraphQLIdentifierPopover.js";
4
3
  /**
5
4
  * Interactive overlay for a GraphQL identifier
6
5
  *
7
6
  * Renders an invisible clickable area over the identifier text
8
- * with hover tooltips and navigation to schema reference pages.
7
+ * with hover popovers and navigation to schema reference pages.
9
8
  */
10
- export const IdentifierLink = ({ identifier, resolution, position, onNavigate, debug = false, isOpen = false, onToggle, }) => {
11
- const [isHovered, setIsHovered] = useState(false);
12
- // Use external state if provided, otherwise manage locally
13
- const showTooltip = isOpen;
14
- const setShowTooltip = (show) => {
15
- onToggle?.(show);
16
- };
9
+ export const IdentifierLink = ({ identifier, resolution, position, onNavigate, debug = false, isOpen, isPinned, onHoverStart, onHoverEnd, onTogglePin, onTooltipHover, }) => {
17
10
  // Determine visual state
18
11
  const isClickable = resolution.exists;
19
12
  const hasError = !resolution.exists && (identifier.kind === 'Type' || identifier.kind === 'Field');
@@ -25,117 +18,58 @@ export const IdentifierLink = ({ identifier, resolution, position, onNavigate, d
25
18
  isClickable && 'graphql-clickable',
26
19
  hasError && 'graphql-error',
27
20
  isDeprecated && 'graphql-deprecated',
28
- isHovered && 'graphql-hovered',
29
- showTooltip && 'graphql-tooltip-open',
21
+ isOpen && 'graphql-hovered',
22
+ isOpen && 'graphql-tooltip-open',
30
23
  debug && 'graphql-debug',
31
24
  ].filter(Boolean).join(' ');
32
25
  const handleClick = (e) => {
33
26
  e.preventDefault();
34
27
  e.stopPropagation();
35
- // Toggle tooltip on click
36
- setShowTooltip(!showTooltip);
37
- };
38
- const handleNavigate = (e) => {
39
- e.preventDefault();
40
- e.stopPropagation();
41
- if (isClickable) {
42
- onNavigate(resolution.referenceUrl);
43
- }
28
+ onTogglePin();
44
29
  };
45
- return (_jsxs(_Fragment, { children: [isClickable
46
- ? (_jsx("a", { href: resolution.referenceUrl, className: classNames + ' graphql-identifier-link', style: {
47
- position: 'absolute',
48
- top: position.top,
49
- left: position.left,
50
- width: position.width,
51
- height: position.height,
52
- cursor: 'pointer',
53
- zIndex: 10,
54
- pointerEvents: 'auto',
55
- display: 'block',
56
- textDecoration: 'none',
57
- // Debug mode visual
58
- ...(debug && {
59
- backgroundColor: hasError ? 'rgba(239, 68, 68, 0.1)' : 'rgba(59, 130, 246, 0.1)',
60
- border: `1px solid ${hasError ? 'rgba(239, 68, 68, 0.3)' : 'rgba(59, 130, 246, 0.3)'}`,
61
- }),
62
- }, onClick: handleClick, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), "aria-label": `${identifier.kind} ${identifier.name} - Click to view documentation`, "data-graphql-identifier": identifier.name, "data-graphql-kind": identifier.kind }))
63
- : (_jsx("div", { className: classNames, style: {
64
- position: 'absolute',
65
- top: position.top,
66
- left: position.left,
67
- width: position.width,
68
- height: position.height,
69
- cursor: 'pointer', // Make it clickable even for errors
70
- zIndex: 10,
71
- pointerEvents: 'auto',
72
- // Debug mode visual
73
- ...(debug && {
74
- backgroundColor: 'rgba(239, 68, 68, 0.1)',
75
- border: `1px solid rgba(239, 68, 68, 0.3)`,
76
- }),
77
- }, onClick: handleClick, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), role: 'button', "aria-label": `${identifier.kind} ${identifier.name} - Click to view information`, "data-graphql-identifier": identifier.name, "data-graphql-kind": identifier.kind })), showTooltip && (_jsx(HoverTooltip, { identifier: identifier, documentation: resolution.documentation || {
78
- description: hasError
79
- ? `${identifier.kind} "${identifier.name}" not found in schema. This ${identifier.kind.toLowerCase()} does not exist in the current GraphQL schema.`
80
- : `${identifier.kind}: ${identifier.name}`,
81
- typeInfo: identifier.kind,
82
- }, position: position, hasError: hasError, referenceUrl: resolution.referenceUrl, onClose: () => setShowTooltip(false), onNavigate: isClickable ? () => onNavigate(resolution.referenceUrl) : undefined }))] }));
30
+ // Create trigger element
31
+ const triggerElement = isClickable
32
+ ? (_jsx("a", { href: resolution.referenceUrl, className: classNames + ' graphql-identifier-link', style: {
33
+ position: 'absolute',
34
+ top: position.top,
35
+ left: position.left,
36
+ width: position.width,
37
+ height: position.height,
38
+ cursor: 'pointer',
39
+ zIndex: 10,
40
+ pointerEvents: 'auto',
41
+ display: 'block',
42
+ textDecoration: 'none',
43
+ // Debug mode visual
44
+ ...(debug && {
45
+ backgroundColor: hasError ? 'rgba(239, 68, 68, 0.1)' : 'rgba(59, 130, 246, 0.1)',
46
+ border: `1px solid ${hasError ? 'rgba(239, 68, 68, 0.3)' : 'rgba(59, 130, 246, 0.3)'}`,
47
+ }),
48
+ }, onClick: handleClick, onMouseEnter: onHoverStart, onMouseLeave: onHoverEnd, "aria-label": `${identifier.kind} ${identifier.name} - Click to view documentation`, "data-graphql-identifier": identifier.name, "data-graphql-kind": identifier.kind }))
49
+ : (_jsx("div", { className: classNames, style: {
50
+ position: 'absolute',
51
+ top: position.top,
52
+ left: position.left,
53
+ width: position.width,
54
+ height: position.height,
55
+ cursor: 'pointer', // Make it clickable even for errors
56
+ zIndex: 10,
57
+ pointerEvents: 'auto',
58
+ // Debug mode visual
59
+ ...(debug && {
60
+ backgroundColor: 'rgba(239, 68, 68, 0.1)',
61
+ border: `1px solid rgba(239, 68, 68, 0.3)`,
62
+ }),
63
+ }, onClick: handleClick, onMouseEnter: onHoverStart, onMouseLeave: onHoverEnd, role: 'button', "aria-label": `${identifier.kind} ${identifier.name} - Click to view information`, "data-graphql-identifier": identifier.name, "data-graphql-kind": identifier.kind }));
64
+ return (_jsx(GraphQLIdentifierPopover, { identifier: identifier, documentation: resolution.documentation || {
65
+ description: hasError
66
+ ? `${identifier.kind} "${identifier.name}" not found in schema. This ${identifier.kind.toLowerCase()} does not exist in the current GraphQL schema.`
67
+ : `${identifier.kind}: ${identifier.name}`,
68
+ typeInfo: identifier.kind,
69
+ }, hasError: hasError, referenceUrl: resolution.referenceUrl, open: isOpen, isPinned: isPinned, onOpenChange: (open) => {
70
+ if (!open && isPinned) {
71
+ onTogglePin(); // Unpin when closing
72
+ }
73
+ }, onNavigate: isClickable ? onNavigate : undefined, children: triggerElement }));
83
74
  };
84
- /**
85
- * Default styles for identifier overlays
86
- *
87
- * These can be included in the document or overridden by custom styles.
88
- */
89
- export const identifierLinkStyles = `
90
- .graphql-identifier-overlay {
91
- /* Base styles for all overlays */
92
- transition: background-color 0.2s ease;
93
- }
94
-
95
- .graphql-identifier-overlay.graphql-clickable:hover {
96
- /* Subtle highlight on hover for clickable identifiers */
97
- background-color: rgba(59, 130, 246, 0.05);
98
- }
99
-
100
- .graphql-identifier-overlay.graphql-error {
101
- /* Error indicator */
102
- border-bottom: 2px wavy red;
103
- }
104
-
105
- .graphql-identifier-overlay.graphql-deprecated {
106
- /* Deprecated indicator */
107
- text-decoration: line-through;
108
- opacity: 0.7;
109
- }
110
-
111
- .graphql-identifier-overlay.graphql-debug {
112
- /* Debug mode makes overlays visible */
113
- background-color: rgba(59, 130, 246, 0.1) !important;
114
- border: 1px solid rgba(59, 130, 246, 0.3) !important;
115
- }
116
-
117
- /* Kind-specific styles */
118
- .graphql-identifier-overlay.graphql-type {
119
- /* Type identifiers */
120
- }
121
-
122
- .graphql-identifier-overlay.graphql-field {
123
- /* Field identifiers */
124
- }
125
-
126
- .graphql-identifier-overlay.graphql-argument {
127
- /* Argument identifiers */
128
- font-style: italic;
129
- }
130
-
131
- .graphql-identifier-overlay.graphql-variable {
132
- /* Variable identifiers */
133
- color: var(--purple-11);
134
- }
135
-
136
- .graphql-identifier-overlay.graphql-directive {
137
- /* Directive identifiers */
138
- color: var(--amber-11);
139
- }
140
- `;
141
75
  //# sourceMappingURL=IdentifierLink.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"IdentifierLink.js","sourceRoot":"","sources":["../../../../src/lib/graphql-document/components/IdentifierLink.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAIhC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAoB,CAAA;AAsBjD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAkC,CAAC,EAC5D,UAAU,EACV,UAAU,EACV,QAAQ,EACR,UAAU,EACV,KAAK,GAAG,KAAK,EACb,MAAM,GAAG,KAAK,EACd,QAAQ,GACT,EAAE,EAAE;IACH,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAEjD,2DAA2D;IAC3D,MAAM,WAAW,GAAG,MAAM,CAAA;IAC1B,MAAM,cAAc,GAAG,CAAC,IAAa,EAAE,EAAE;QACvC,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAA;IAClB,CAAC,CAAA;IAED,yBAAyB;IACzB,MAAM,WAAW,GAAG,UA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CAAC,IAAI,CAAC,EACtC,YAAY,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,EACvC,IAAI,EAAC,QAAQ,gBACD,GAAG,UAAU,CAAC,IAAI,IAAI,UAAU,CAAC,IAAI,8BAA8B,6BACtD,UAAU,CAAC,IAAI,uBACrB,UAAU,CAAC,IAAI,GAClC,CACH,EAGF,WAAW,IAAI,CACd,KAAC,YAAY,IACX,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,UAAU,CAAC,aAAa,IAAI;oBACzC,WAAW,EAAE,QAAQ;wBACnB,CAAC,CAAC,GAAG,UAAU,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI,+BAA+B,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,gDAAgD;wBACpJ,CAAC,CAAC,GAAG,UAAU,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI,EAAE;oBAC5C,QAAQ,EAAE,UAAU,CAAC,IAAI;iBAC1B,EACD,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,UAAU,CAAC,YAAY,EACrC,OAAO,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,EACpC,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS,GAC/E,CACH,IACA,CACJ,CAAA;AACH,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmDnC,CAAA"}
1
+ {"version":3,"file":"IdentifierLink.js","sourceRoot":"","sources":["../../../../src/lib/graphql-document/components/IdentifierLink.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAAgC,CAAA;AA2BzE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAA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AI,uBACrB,UAAU,CAAC,IAAI,GAClC,CACH,CAAA;IAEH,OAAO,CACL,KAAC,wBAAwB,IACvB,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,UAAU,CAAC,aAAa,IAAI;YACzC,WAAW,EAAE,QAAQ;gBACnB,CAAC,CAAC,GAAG,UAAU,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI,+BAA+B,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,gDAAgD;gBACpJ,CAAC,CAAC,GAAG,UAAU,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI,EAAE;YAC5C,QAAQ,EAAE,UAAU,CAAC,IAAI;SAC1B,EACD,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,UAAU,CAAC,YAAY,EACrC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,CAAC,IAAI,EAAE,EAAE;YACrB,IAAI,CAAC,IAAI,IAAI,QAAQ,EAAE,CAAC;gBACtB,WAAW,EAAE,CAAA,CAAC,qBAAqB;YACrC,CAAC;QACH,CAAC,EACD,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,YAE/C,cAAc,GACU,CAC5B,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Minimal styles for GraphQL Document interactive code blocks
3
+ */
4
+ export declare const graphqlDocumentStyles = "\n/* Container styles */\n.graphql-document {\n position: relative;\n}\n\n.graphql-interaction-layer {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n pointer-events: none;\n}\n\n.graphql-interaction-layer > * {\n pointer-events: auto;\n}\n\n/* Identifier overlay styles */\n.graphql-identifier-overlay {\n transition: background-color 0.2s ease;\n}\n\n/* Clickable identifiers get visual feedback */\n.graphql-identifier-overlay.graphql-clickable {\n /* Subtle underline effect using box-shadow to not affect layout */\n box-shadow: 0 1px 0 0 rgba(var(--accent-9), 0.3);\n transition: box-shadow 0.2s ease, background-color 0.2s ease;\n}\n\n.graphql-identifier-overlay.graphql-clickable:hover {\n background-color: rgba(var(--accent-3), 0.5);\n box-shadow: 0 1px 0 0 rgba(var(--accent-9), 0.6);\n}\n\n/* Active/open state */\n.graphql-identifier-overlay.graphql-tooltip-open {\n background-color: rgba(var(--accent-3), 0.5);\n box-shadow: 0 1px 0 0 var(--accent-9);\n}\n\n/* Error state */\n.graphql-identifier-overlay.graphql-error {\n box-shadow: 0 1.5px 0 0 var(--red-9);\n}\n\n.graphql-identifier-overlay.graphql-error:hover {\n background-color: rgba(var(--red-3), 0.5);\n}\n\n/* Deprecated state */\n.graphql-identifier-overlay.graphql-deprecated {\n text-decoration: line-through;\n opacity: 0.7;\n}\n\n/* Debug mode */\n.graphql-identifier-overlay.graphql-debug {\n background-color: rgba(59, 130, 246, 0.1) !important;\n border: 1px solid rgba(59, 130, 246, 0.3) !important;\n}\n\n/* Kind-specific colors */\n.graphql-identifier-overlay.graphql-type.graphql-clickable {\n box-shadow: 0 1px 0 0 rgba(var(--blue-9), 0.3);\n}\n\n.graphql-identifier-overlay.graphql-field.graphql-clickable {\n box-shadow: 0 1px 0 0 rgba(var(--green-9), 0.3);\n}\n\n.graphql-identifier-overlay.graphql-argument.graphql-clickable {\n box-shadow: 0 1px 0 0 rgba(var(--orange-9), 0.3);\n}\n\n.graphql-identifier-overlay.graphql-variable {\n box-shadow: 0 1px 0 0 rgba(var(--purple-9), 0.3);\n}\n\n.graphql-identifier-overlay.graphql-directive.graphql-clickable {\n box-shadow: 0 1px 0 0 rgba(var(--amber-9), 0.3);\n}\n\n/* Popover animation */\n.graphql-identifier-popover {\n animation: graphql-popover-show 150ms ease-out;\n}\n\n@keyframes graphql-popover-show {\n from {\n opacity: 0;\n transform: translateY(2px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n/* Validation errors */\n.graphql-validation-errors {\n margin-top: 1rem;\n padding: 0.5rem;\n background-color: var(--red-2);\n border: 1px solid var(--red-6);\n border-radius: 4px;\n}\n\n.graphql-error {\n color: var(--red-11);\n font-size: 0.875rem;\n margin: 0.25rem 0;\n}\n\n/* Loading state */\n.graphql-document.graphql-loading {\n opacity: 0.6;\n pointer-events: none;\n}\n\n.graphql-document.graphql-loading::after {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n width: 20px;\n height: 20px;\n margin: -10px 0 0 -10px;\n border: 2px solid var(--gray-6);\n border-top-color: var(--accent-9);\n border-radius: 50%;\n animation: graphql-spinner 0.8s linear infinite;\n}\n\n@keyframes graphql-spinner {\n to {\n transform: rotate(360deg);\n }\n}\n\n/* Copy button */\n.graphql-document-copy {\n position: absolute;\n top: 1rem;\n right: 1rem;\n opacity: 0;\n transition: opacity 0.2s ease;\n z-index: 10;\n}\n\n.graphql-document:hover .graphql-document-copy {\n opacity: 0.8;\n}\n\n.graphql-document-copy:hover {\n opacity: 1 !important;\n}\n\n.graphql-document-copy[data-copied=\"true\"] {\n opacity: 1 !important;\n color: var(--green-9);\n}";
5
+ //# sourceMappingURL=graphql-document-styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphql-document-styles.d.ts","sourceRoot":"","sources":["../../../../src/lib/graphql-document/components/graphql-document-styles.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,qBAAqB,wjHAkKhC,CAAA"}
@@ -0,0 +1,167 @@
1
+ /**
2
+ * Minimal styles for GraphQL Document interactive code blocks
3
+ */
4
+ export const graphqlDocumentStyles = `
5
+ /* Container styles */
6
+ .graphql-document {
7
+ position: relative;
8
+ }
9
+
10
+ .graphql-interaction-layer {
11
+ position: absolute;
12
+ top: 0;
13
+ left: 0;
14
+ right: 0;
15
+ bottom: 0;
16
+ pointer-events: none;
17
+ }
18
+
19
+ .graphql-interaction-layer > * {
20
+ pointer-events: auto;
21
+ }
22
+
23
+ /* Identifier overlay styles */
24
+ .graphql-identifier-overlay {
25
+ transition: background-color 0.2s ease;
26
+ }
27
+
28
+ /* Clickable identifiers get visual feedback */
29
+ .graphql-identifier-overlay.graphql-clickable {
30
+ /* Subtle underline effect using box-shadow to not affect layout */
31
+ box-shadow: 0 1px 0 0 rgba(var(--accent-9), 0.3);
32
+ transition: box-shadow 0.2s ease, background-color 0.2s ease;
33
+ }
34
+
35
+ .graphql-identifier-overlay.graphql-clickable:hover {
36
+ background-color: rgba(var(--accent-3), 0.5);
37
+ box-shadow: 0 1px 0 0 rgba(var(--accent-9), 0.6);
38
+ }
39
+
40
+ /* Active/open state */
41
+ .graphql-identifier-overlay.graphql-tooltip-open {
42
+ background-color: rgba(var(--accent-3), 0.5);
43
+ box-shadow: 0 1px 0 0 var(--accent-9);
44
+ }
45
+
46
+ /* Error state */
47
+ .graphql-identifier-overlay.graphql-error {
48
+ box-shadow: 0 1.5px 0 0 var(--red-9);
49
+ }
50
+
51
+ .graphql-identifier-overlay.graphql-error:hover {
52
+ background-color: rgba(var(--red-3), 0.5);
53
+ }
54
+
55
+ /* Deprecated state */
56
+ .graphql-identifier-overlay.graphql-deprecated {
57
+ text-decoration: line-through;
58
+ opacity: 0.7;
59
+ }
60
+
61
+ /* Debug mode */
62
+ .graphql-identifier-overlay.graphql-debug {
63
+ background-color: rgba(59, 130, 246, 0.1) !important;
64
+ border: 1px solid rgba(59, 130, 246, 0.3) !important;
65
+ }
66
+
67
+ /* Kind-specific colors */
68
+ .graphql-identifier-overlay.graphql-type.graphql-clickable {
69
+ box-shadow: 0 1px 0 0 rgba(var(--blue-9), 0.3);
70
+ }
71
+
72
+ .graphql-identifier-overlay.graphql-field.graphql-clickable {
73
+ box-shadow: 0 1px 0 0 rgba(var(--green-9), 0.3);
74
+ }
75
+
76
+ .graphql-identifier-overlay.graphql-argument.graphql-clickable {
77
+ box-shadow: 0 1px 0 0 rgba(var(--orange-9), 0.3);
78
+ }
79
+
80
+ .graphql-identifier-overlay.graphql-variable {
81
+ box-shadow: 0 1px 0 0 rgba(var(--purple-9), 0.3);
82
+ }
83
+
84
+ .graphql-identifier-overlay.graphql-directive.graphql-clickable {
85
+ box-shadow: 0 1px 0 0 rgba(var(--amber-9), 0.3);
86
+ }
87
+
88
+ /* Popover animation */
89
+ .graphql-identifier-popover {
90
+ animation: graphql-popover-show 150ms ease-out;
91
+ }
92
+
93
+ @keyframes graphql-popover-show {
94
+ from {
95
+ opacity: 0;
96
+ transform: translateY(2px);
97
+ }
98
+ to {
99
+ opacity: 1;
100
+ transform: translateY(0);
101
+ }
102
+ }
103
+
104
+ /* Validation errors */
105
+ .graphql-validation-errors {
106
+ margin-top: 1rem;
107
+ padding: 0.5rem;
108
+ background-color: var(--red-2);
109
+ border: 1px solid var(--red-6);
110
+ border-radius: 4px;
111
+ }
112
+
113
+ .graphql-error {
114
+ color: var(--red-11);
115
+ font-size: 0.875rem;
116
+ margin: 0.25rem 0;
117
+ }
118
+
119
+ /* Loading state */
120
+ .graphql-document.graphql-loading {
121
+ opacity: 0.6;
122
+ pointer-events: none;
123
+ }
124
+
125
+ .graphql-document.graphql-loading::after {
126
+ content: '';
127
+ position: absolute;
128
+ top: 50%;
129
+ left: 50%;
130
+ width: 20px;
131
+ height: 20px;
132
+ margin: -10px 0 0 -10px;
133
+ border: 2px solid var(--gray-6);
134
+ border-top-color: var(--accent-9);
135
+ border-radius: 50%;
136
+ animation: graphql-spinner 0.8s linear infinite;
137
+ }
138
+
139
+ @keyframes graphql-spinner {
140
+ to {
141
+ transform: rotate(360deg);
142
+ }
143
+ }
144
+
145
+ /* Copy button */
146
+ .graphql-document-copy {
147
+ position: absolute;
148
+ top: 1rem;
149
+ right: 1rem;
150
+ opacity: 0;
151
+ transition: opacity 0.2s ease;
152
+ z-index: 10;
153
+ }
154
+
155
+ .graphql-document:hover .graphql-document-copy {
156
+ opacity: 0.8;
157
+ }
158
+
159
+ .graphql-document-copy:hover {
160
+ opacity: 1 !important;
161
+ }
162
+
163
+ .graphql-document-copy[data-copied="true"] {
164
+ opacity: 1 !important;
165
+ color: var(--green-9);
166
+ }`;
167
+ //# sourceMappingURL=graphql-document-styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphql-document-styles.js","sourceRoot":"","sources":["../../../../src/lib/graphql-document/components/graphql-document-styles.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkKnC,CAAA"}
@@ -1,5 +1,6 @@
1
+ export * from './CopyButton.tsx';
1
2
  export * from './GraphQLDocument.tsx';
2
3
  export * from './GraphQLDocumentWithSchema.tsx';
3
- export * from './HoverTooltip.tsx';
4
+ export * from './GraphQLIdentifierPopover.tsx';
4
5
  export * from './IdentifierLink.tsx';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/graphql-document/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/graphql-document/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,uBAAuB,CAAA;AACrC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,sBAAsB,CAAA"}
@@ -1,5 +1,6 @@
1
+ export * from "./CopyButton.js";
1
2
  export * from "./GraphQLDocument.js";
2
3
  export * from "./GraphQLDocumentWithSchema.js";
3
- export * from "./HoverTooltip.js";
4
+ export * from "./GraphQLIdentifierPopover.js";
4
5
  export * from "./IdentifierLink.js";
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/graphql-document/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAuB,CAAA;AACrC,cAAc,gCAAiC,CAAA;AAC/C,cAAc,mBAAoB,CAAA;AAClC,cAAc,qBAAsB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/graphql-document/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAkB,CAAA;AAChC,cAAc,sBAAuB,CAAA;AACrC,cAAc,gCAAiC,CAAA;AAC/C,cAAc,+BAAgC,CAAA;AAC9C,cAAc,qBAAsB,CAAA"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * State management for GraphQL document tooltips
3
+ *
4
+ * Handles hover delays, pinning, and multiple tooltip coordination
5
+ */
6
+ export interface TooltipState {
7
+ /** Currently visible tooltip (via hover) */
8
+ hoveredId: string | null;
9
+ /** Set of pinned tooltip IDs */
10
+ pinnedIds: Set<string>;
11
+ /** ID pending show (waiting for delay) */
12
+ pendingShowId: string | null;
13
+ /** ID pending hide (waiting for grace period) */
14
+ pendingHideId: string | null;
15
+ }
16
+ export interface UseTooltipStateOptions {
17
+ /** Delay before showing tooltip on hover (ms) */
18
+ showDelay?: number;
19
+ /** Delay before hiding tooltip on mouse leave (ms) */
20
+ hideDelay?: number;
21
+ /** Whether to allow multiple pinned tooltips */
22
+ allowMultiplePins?: boolean;
23
+ }
24
+ export interface UseTooltipStateReturn {
25
+ /** Check if a tooltip should be visible */
26
+ isOpen: (id: string) => boolean;
27
+ /** Check if a tooltip is pinned */
28
+ isPinned: (id: string) => boolean;
29
+ /** Handle hover start */
30
+ onHoverStart: (id: string) => void;
31
+ /** Handle hover end */
32
+ onHoverEnd: (id: string) => void;
33
+ /** Handle click (toggle pin) */
34
+ onTogglePin: (id: string) => void;
35
+ /** Handle tooltip content hover (cancels hide) */
36
+ onTooltipHover: (id: string) => void;
37
+ /** Unpin a specific tooltip */
38
+ unpin: (id: string) => void;
39
+ /** Unpin all tooltips */
40
+ unpinAll: () => void;
41
+ }
42
+ export declare const useTooltipState: (options?: UseTooltipStateOptions) => UseTooltipStateReturn;
43
+ //# sourceMappingURL=use-tooltip-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-tooltip-state.d.ts","sourceRoot":"","sources":["../../../../src/lib/graphql-document/hooks/use-tooltip-state.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,MAAM,WAAW,YAAY;IAC3B,4CAA4C;IAC5C,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,gCAAgC;IAChC,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACtB,0CAA0C;IAC1C,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,iDAAiD;IACjD,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;CAC7B;AAED,MAAM,WAAW,sBAAsB;IACrC,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,gDAAgD;IAChD,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAC5B;AAED,MAAM,WAAW,qBAAqB;IACpC,2CAA2C;IAC3C,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAA;IAC/B,mCAAmC;IACnC,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAA;IACjC,yBAAyB;IACzB,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,uBAAuB;IACvB,UAAU,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,gCAAgC;IAChC,WAAW,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,kDAAkD;IAClD,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;IACpC,+BAA+B;IAC/B,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3B,yBAAyB;IACzB,QAAQ,EAAE,MAAM,IAAI,CAAA;CACrB;AAED,eAAO,MAAM,eAAe,GAAI,UAAS,sBAA2B,KAAG,qBA+ItE,CAAA"}
@@ -0,0 +1,132 @@
1
+ /**
2
+ * State management for GraphQL document tooltips
3
+ *
4
+ * Handles hover delays, pinning, and multiple tooltip coordination
5
+ */
6
+ import { React } from '#dep/react/index';
7
+ export const useTooltipState = (options = {}) => {
8
+ const { showDelay = 300, hideDelay = 200, allowMultiplePins = true, } = options;
9
+ const [hoveredId, setHoveredId] = React.useState(null);
10
+ const [pinnedIds, setPinnedIds] = React.useState(new Set());
11
+ const [pendingShowId, setPendingShowId] = React.useState(null);
12
+ const [pendingHideId, setPendingHideId] = React.useState(null);
13
+ // Timer refs
14
+ const showTimerRef = React.useRef(null);
15
+ const hideTimerRef = React.useRef(null);
16
+ // Clear any pending timers
17
+ const clearTimers = React.useCallback(() => {
18
+ if (showTimerRef.current) {
19
+ clearTimeout(showTimerRef.current);
20
+ showTimerRef.current = null;
21
+ }
22
+ if (hideTimerRef.current) {
23
+ clearTimeout(hideTimerRef.current);
24
+ hideTimerRef.current = null;
25
+ }
26
+ setPendingShowId(null);
27
+ setPendingHideId(null);
28
+ }, []);
29
+ // Check if tooltip should be visible
30
+ const isOpen = React.useCallback((id) => {
31
+ return hoveredId === id || pinnedIds.has(id);
32
+ }, [hoveredId, pinnedIds]);
33
+ // Check if tooltip is pinned
34
+ const isPinned = React.useCallback((id) => {
35
+ return pinnedIds.has(id);
36
+ }, [pinnedIds]);
37
+ // Handle hover start
38
+ const onHoverStart = React.useCallback((id) => {
39
+ // Don't show if already pinned
40
+ if (pinnedIds.has(id))
41
+ return;
42
+ // Cancel any pending hide for this ID
43
+ if (pendingHideId === id) {
44
+ clearTimeout(hideTimerRef.current);
45
+ hideTimerRef.current = null;
46
+ setPendingHideId(null);
47
+ return;
48
+ }
49
+ // Clear any other pending operations
50
+ clearTimers();
51
+ // Schedule show
52
+ setPendingShowId(id);
53
+ showTimerRef.current = setTimeout(() => {
54
+ setHoveredId(id);
55
+ setPendingShowId(null);
56
+ }, showDelay);
57
+ }, [pinnedIds, pendingHideId, clearTimers, showDelay]);
58
+ // Handle hover end
59
+ const onHoverEnd = React.useCallback((id) => {
60
+ // Don't hide if pinned
61
+ if (pinnedIds.has(id))
62
+ return;
63
+ // Cancel pending show if still waiting
64
+ if (pendingShowId === id) {
65
+ clearTimeout(showTimerRef.current);
66
+ showTimerRef.current = null;
67
+ setPendingShowId(null);
68
+ return;
69
+ }
70
+ // Only hide if currently showing this tooltip
71
+ if (hoveredId === id) {
72
+ setPendingHideId(id);
73
+ hideTimerRef.current = setTimeout(() => {
74
+ // First set hovered to null to trigger close animation
75
+ setHoveredId(null);
76
+ setPendingHideId(null);
77
+ }, hideDelay);
78
+ }
79
+ }, [pinnedIds, pendingShowId, hoveredId, hideDelay]);
80
+ // Handle tooltip content hover (cancels hide)
81
+ const onTooltipHover = React.useCallback((id) => {
82
+ if (pendingHideId === id) {
83
+ clearTimeout(hideTimerRef.current);
84
+ hideTimerRef.current = null;
85
+ setPendingHideId(null);
86
+ }
87
+ }, [pendingHideId]);
88
+ // Toggle pin state
89
+ const onTogglePin = React.useCallback((id) => {
90
+ clearTimers();
91
+ setPinnedIds((prev) => {
92
+ const next = new Set(prev);
93
+ if (next.has(id)) {
94
+ // Unpin
95
+ next.delete(id);
96
+ setHoveredId(null); // Also clear hover state
97
+ }
98
+ else {
99
+ // Pin
100
+ if (!allowMultiplePins) {
101
+ next.clear(); // Clear other pins
102
+ }
103
+ next.add(id);
104
+ setHoveredId(null); // Clear hover state since it's now pinned
105
+ }
106
+ return next;
107
+ });
108
+ }, [clearTimers, allowMultiplePins]);
109
+ // Unpin specific tooltip
110
+ const unpin = React.useCallback((id) => {
111
+ setPinnedIds((prev) => {
112
+ const next = new Set(prev);
113
+ next.delete(id);
114
+ return next;
115
+ });
116
+ }, []);
117
+ // Unpin all tooltips
118
+ const unpinAll = React.useCallback(() => {
119
+ setPinnedIds(new Set());
120
+ }, []);
121
+ return {
122
+ isOpen,
123
+ isPinned,
124
+ onHoverStart,
125
+ onHoverEnd,
126
+ onTogglePin,
127
+ onTooltipHover,
128
+ unpin,
129
+ unpinAll,
130
+ };
131
+ };
132
+ //# sourceMappingURL=use-tooltip-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-tooltip-state.js","sourceRoot":"","sources":["../../../../src/lib/graphql-document/hooks/use-tooltip-state.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAyCxC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,UAAkC,EAAE,EAAyB,EAAE;IAC7F,MAAM,EACJ,SAAS,GAAG,GAAG,EACf,SAAS,GAAG,GAAG,EACf,iBAAiB,GAAG,IAAI,GACzB,GAAG,OAAO,CAAA;IAEX,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAgB,IAAI,CAAC,CAAA;IACrE,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAc,IAAI,GAAG,EAAE,CAAC,CAAA;IACxE,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAgB,IAAI,CAAC,CAAA;IAC7E,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAgB,IAAI,CAAC,CAAA;IAE7E,aAAa;IACb,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAwB,IAAI,CAAC,CAAA;IAC9D,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAwB,IAAI,CAAC,CAAA;IAE9D,2BAA2B;IAC3B,MAAM,WAAW,GAAG,KAAK,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CAAC,CAAA;IAEN,qBAAqB;IACrB,MAAM,QAAQ,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACtC,YAAY,CAAC,IAAI,GAAG,EAAE,CAAC,CAAA;IACzB,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO;QACL,MAAM;QACN,QAAQ;QACR,YAAY;QACZ,UAAU;QACV,WAAW;QACX,cAAc;QACd,KAAK;QACL,QAAQ;KACT,CAAA;AACH,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polen",
3
- "version": "0.10.0-next.12",
3
+ "version": "0.10.0-next.13",
4
4
  "type": "module",
5
5
  "description": "A framework for delightful GraphQL developer portals",
6
6
  "author": {
@@ -199,6 +199,7 @@
199
199
  "@octokit/types": "^14.1.0",
200
200
  "@playwright/browser-chromium": "^1.53.0",
201
201
  "@stylistic/eslint-plugin": "^4.4.1",
202
+ "@testing-library/react": "^16.3.0",
202
203
  "@tsconfig/node-lts": "^22.0.1",
203
204
  "@tsconfig/node22": "^22.0.2",
204
205
  "@tsconfig/strictest": "^2.0.5",