polen 0.10.0-next.12 → 0.10.0-next.14
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.
- package/build/api/vite/plugins/build.d.ts.map +1 -1
- package/build/api/vite/plugins/build.js +11 -3
- package/build/api/vite/plugins/build.js.map +1 -1
- package/build/api/vite/plugins/core.d.ts.map +1 -1
- package/build/api/vite/plugins/core.js +12 -10
- package/build/api/vite/plugins/core.js.map +1 -1
- package/build/api/vite/plugins/pages.d.ts.map +1 -1
- package/build/api/vite/plugins/pages.js +6 -7
- package/build/api/vite/plugins/pages.js.map +1 -1
- package/build/api/vite/plugins/serve.d.ts.map +1 -1
- package/build/api/vite/plugins/serve.js +47 -7
- package/build/api/vite/plugins/serve.js.map +1 -1
- package/build/lib/file-router/diagnostic-reporter.js +2 -2
- package/build/lib/file-router/diagnostic-reporter.js.map +1 -1
- package/build/lib/graphql-document/components/CopyButton.d.ts +19 -0
- package/build/lib/graphql-document/components/CopyButton.d.ts.map +1 -0
- package/build/lib/graphql-document/components/CopyButton.js +43 -0
- package/build/lib/graphql-document/components/CopyButton.js.map +1 -0
- package/build/lib/graphql-document/components/GraphQLDocument.d.ts +0 -4
- package/build/lib/graphql-document/components/GraphQLDocument.d.ts.map +1 -1
- package/build/lib/graphql-document/components/GraphQLDocument.js +52 -83
- package/build/lib/graphql-document/components/GraphQLDocument.js.map +1 -1
- package/build/lib/graphql-document/components/GraphQLIdentifierPopover.d.ts +33 -0
- package/build/lib/graphql-document/components/GraphQLIdentifierPopover.d.ts.map +1 -0
- package/build/lib/graphql-document/components/GraphQLIdentifierPopover.js +48 -0
- package/build/lib/graphql-document/components/GraphQLIdentifierPopover.js.map +1 -0
- package/build/lib/graphql-document/components/IdentifierLink.d.ts +15 -13
- package/build/lib/graphql-document/components/IdentifierLink.d.ts.map +1 -1
- package/build/lib/graphql-document/components/IdentifierLink.js +51 -117
- package/build/lib/graphql-document/components/IdentifierLink.js.map +1 -1
- package/build/lib/graphql-document/components/graphql-document-styles.d.ts +5 -0
- package/build/lib/graphql-document/components/graphql-document-styles.d.ts.map +1 -0
- package/build/lib/graphql-document/components/graphql-document-styles.js +167 -0
- package/build/lib/graphql-document/components/graphql-document-styles.js.map +1 -0
- package/build/lib/graphql-document/components/index.d.ts +2 -1
- package/build/lib/graphql-document/components/index.d.ts.map +1 -1
- package/build/lib/graphql-document/components/index.js +2 -1
- package/build/lib/graphql-document/components/index.js.map +1 -1
- package/build/lib/graphql-document/hooks/use-tooltip-state.d.ts +43 -0
- package/build/lib/graphql-document/hooks/use-tooltip-state.d.ts.map +1 -0
- package/build/lib/graphql-document/hooks/use-tooltip-state.js +132 -0
- package/build/lib/graphql-document/hooks/use-tooltip-state.js.map +1 -0
- package/build/lib/graphql-document/positioning-simple.d.ts +0 -5
- package/build/lib/graphql-document/positioning-simple.d.ts.map +1 -1
- package/build/lib/graphql-document/positioning-simple.js +78 -90
- package/build/lib/graphql-document/positioning-simple.js.map +1 -1
- package/build/lib/kit-temp.d.ts +103 -0
- package/build/lib/kit-temp.d.ts.map +1 -1
- package/build/lib/kit-temp.js +236 -2
- package/build/lib/kit-temp.js.map +1 -1
- package/build/lib/vite-plugin-reactive-data/vite-plugin-reactive-data.d.ts +1 -8
- package/build/lib/vite-plugin-reactive-data/vite-plugin-reactive-data.d.ts.map +1 -1
- package/build/lib/vite-plugin-reactive-data/vite-plugin-reactive-data.js +48 -53
- package/build/lib/vite-plugin-reactive-data/vite-plugin-reactive-data.js.map +1 -1
- package/build/package-paths.js +3 -3
- package/build/package-paths.js.map +1 -1
- package/build/template/components/Link.d.ts +1 -1
- package/build/template/components/Link.d.ts.map +1 -1
- package/build/template/components/Link.js +14 -5
- package/build/template/components/Link.js.map +1 -1
- package/build/template/components/content/GraphQLDocumentWithSchema.d.ts.map +1 -1
- package/build/template/components/content/GraphQLDocumentWithSchema.js +0 -3
- package/build/template/components/content/GraphQLDocumentWithSchema.js.map +1 -1
- package/build/template/components/content/GraphQLDocumentWrapper.d.ts.map +1 -1
- package/build/template/components/content/GraphQLDocumentWrapper.js +8 -7
- package/build/template/components/content/GraphQLDocumentWrapper.js.map +1 -1
- package/build/template/components/sidebar/SidebarItem.js +2 -2
- package/build/template/entry.client.d.ts.map +1 -1
- package/build/template/entry.client.js +0 -3
- package/build/template/entry.client.js.map +1 -1
- package/build/template/hooks/useClientOnly.d.ts +9 -0
- package/build/template/hooks/useClientOnly.d.ts.map +1 -0
- package/build/template/hooks/useClientOnly.js +16 -0
- package/build/template/hooks/useClientOnly.js.map +1 -0
- package/build/template/routes/root.d.ts.map +1 -1
- package/build/template/routes/root.js +2 -150
- package/build/template/routes/root.js.map +1 -1
- package/build/template/server/app.d.ts +8 -1
- package/build/template/server/app.d.ts.map +1 -1
- package/build/template/server/app.js +21 -21
- package/build/template/server/app.js.map +1 -1
- package/build/template/server/create-page-html-response.d.ts +7 -0
- package/build/template/server/create-page-html-response.d.ts.map +1 -0
- package/build/template/server/{render-page.js → create-page-html-response.js} +11 -16
- package/build/template/server/create-page-html-response.js.map +1 -0
- package/build/template/server/main.js +2 -1
- package/build/template/server/main.js.map +1 -1
- package/build/template/server/middleware/page.d.ts +4 -0
- package/build/template/server/middleware/page.d.ts.map +1 -0
- package/build/template/server/middleware/page.js +15 -0
- package/build/template/server/middleware/page.js.map +1 -0
- package/build/template/server/middleware/unsupported-assets.d.ts +10 -0
- package/build/template/server/middleware/unsupported-assets.d.ts.map +1 -0
- package/build/template/server/middleware/unsupported-assets.js +21 -0
- package/build/template/server/middleware/unsupported-assets.js.map +1 -0
- package/build/template/server/ssg/generate.d.ts.map +1 -1
- package/build/template/server/ssg/generate.js +33 -34
- package/build/template/server/ssg/generate.js.map +1 -1
- package/build/template/styles/code-block.css +218 -0
- package/package.json +4 -2
- package/src/api/singletons/markdown/markdown.test.ts +1 -1
- package/src/api/vite/plugins/build.ts +97 -89
- package/src/api/vite/plugins/core.ts +15 -10
- package/src/api/vite/plugins/pages.ts +9 -7
- package/src/api/vite/plugins/serve.ts +62 -9
- package/src/lib/file-router/diagnostic-reporter.ts +2 -2
- package/src/lib/graphql-document/components/CopyButton.tsx +76 -0
- package/src/lib/graphql-document/components/GraphQLDocument.tsx +73 -95
- package/src/lib/graphql-document/components/GraphQLIdentifierPopover.tsx +197 -0
- package/src/lib/graphql-document/components/IdentifierLink.tsx +105 -166
- package/src/lib/graphql-document/components/graphql-document-styles.ts +167 -0
- package/src/lib/graphql-document/components/index.ts +2 -1
- package/src/lib/graphql-document/hooks/use-tooltip-state.test.ts +76 -0
- package/src/lib/graphql-document/hooks/use-tooltip-state.ts +191 -0
- package/src/lib/graphql-document/positioning-simple.test.ts +18 -22
- package/src/lib/graphql-document/positioning-simple.ts +97 -108
- package/src/lib/kit-temp.test.ts +15 -3
- package/src/lib/kit-temp.ts +304 -4
- package/src/lib/vite-plugin-reactive-data/vite-plugin-reactive-data.ts +52 -58
- package/src/package-paths.ts +3 -3
- package/src/template/components/Link.tsx +20 -12
- package/src/template/components/content/GraphQLDocumentWithSchema.tsx +0 -5
- package/src/template/components/content/GraphQLDocumentWrapper.tsx +14 -7
- package/src/template/components/sidebar/SidebarItem.tsx +2 -2
- package/src/template/entry.client.tsx +0 -3
- package/src/template/hooks/useClientOnly.ts +21 -0
- package/src/template/routes/root.tsx +0 -159
- package/src/template/server/app.ts +33 -23
- package/src/template/server/{render-page.tsx → create-page-html-response.ts} +19 -16
- package/src/template/server/main.ts +2 -1
- package/src/template/server/middleware/page.ts +19 -0
- package/src/template/server/middleware/unsupported-assets.ts +25 -0
- package/src/template/server/ssg/generate.ts +68 -72
- package/build/lib/graphql-document/components/HoverTooltip.d.ts +0 -35
- package/build/lib/graphql-document/components/HoverTooltip.d.ts.map +0 -1
- package/build/lib/graphql-document/components/HoverTooltip.js +0 -132
- package/build/lib/graphql-document/components/HoverTooltip.js.map +0 -1
- package/build/template/server/render-page.d.ts +0 -3
- package/build/template/server/render-page.d.ts.map +0 -1
- package/build/template/server/render-page.js.map +0 -1
- package/src/lib/graphql-document/components/HoverTooltip.tsx +0 -282
@@ -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 './
|
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,
|
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 "./
|
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,
|
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-too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AAQ;KACT,CAAA;AACH,CAAC,CAAA"}
|
@@ -47,11 +47,6 @@ export declare class SimplePositionCalculator {
|
|
47
47
|
* Get positions of all wrapped identifiers
|
48
48
|
*/
|
49
49
|
getIdentifierPositions(containerElement: Element, relativeToElement?: Element): Map<string, PositionResult>;
|
50
|
-
/**
|
51
|
-
* Wrap an identifier in a span for positioning
|
52
|
-
* Returns true if the identifier was successfully wrapped
|
53
|
-
*/
|
54
|
-
private wrapIdentifier;
|
55
50
|
}
|
56
51
|
/**
|
57
52
|
* Create invisible overlay for a position
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"positioning-simple.d.ts","sourceRoot":"","sources":["../../../src/lib/graphql-document/positioning-simple.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAE5C;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,+CAA+C;IAC/C,GAAG,EAAE,MAAM,CAAA;IACX,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAA;IACZ,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAA;IACb,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,kCAAkC;IAClC,QAAQ,EAAE,WAAW,CAAA;IACrB,0CAA0C;IAC1C,UAAU,EAAE,UAAU,CAAA;CACvB;AAED;;;;;;;;;;GAUG;AACH,qBAAa,wBAAwB;IACnC;;OAEG;IACH,gBAAgB,CACd,gBAAgB,EAAE,OAAO,EACzB,WAAW,EAAE,UAAU,EAAE,GACxB,IAAI;
|
1
|
+
{"version":3,"file":"positioning-simple.d.ts","sourceRoot":"","sources":["../../../src/lib/graphql-document/positioning-simple.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAE5C;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,+CAA+C;IAC/C,GAAG,EAAE,MAAM,CAAA;IACX,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAA;IACZ,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAA;IACb,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,kCAAkC;IAClC,QAAQ,EAAE,WAAW,CAAA;IACrB,0CAA0C;IAC1C,UAAU,EAAE,UAAU,CAAA;CACvB;AAED;;;;;;;;;;GAUG;AACH,qBAAa,wBAAwB;IACnC;;OAEG;IACH,gBAAgB,CACd,gBAAgB,EAAE,OAAO,EACzB,WAAW,EAAE,UAAU,EAAE,GACxB,IAAI;IAsGP;;OAEG;IACH,sBAAsB,CACpB,gBAAgB,EAAE,OAAO,EACzB,iBAAiB,CAAC,EAAE,OAAO,GAC1B,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC;CA2C/B;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAC9B,UAAU,WAAW,EACrB,YAAY,UAAU,EACtB,UAAU;IACR,OAAO,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAA;IAC1C,OAAO,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,KAAK,IAAI,CAAA;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,KACA,WAqCF,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,8BAA8B,QAAO,wBAEjD,CAAA"}
|
@@ -20,21 +20,85 @@ export class SimplePositionCalculator {
|
|
20
20
|
* Prepare a code block for positioning by wrapping identifiers in spans
|
21
21
|
*/
|
22
22
|
prepareCodeBlock(containerElement, identifiers) {
|
23
|
-
//
|
24
|
-
const
|
25
|
-
|
26
|
-
|
27
|
-
|
23
|
+
// Get the full text content of the container
|
24
|
+
const fullText = containerElement.textContent || '';
|
25
|
+
const lines = fullText.split('\n');
|
26
|
+
// Build a map of line start positions in the full text
|
27
|
+
const lineStartPositions = [0];
|
28
|
+
for (let i = 0; i < lines.length - 1; i++) {
|
29
|
+
const lineLength = lines[i]?.length ?? 0;
|
30
|
+
lineStartPositions.push(lineStartPositions[i] + lineLength + 1); // +1 for newline
|
31
|
+
}
|
32
|
+
// Process identifiers by line
|
33
|
+
for (const identifier of identifiers) {
|
34
|
+
const lineIndex = identifier.position.line - 1;
|
35
|
+
if (lineIndex >= lines.length || lineIndex < 0)
|
36
|
+
continue;
|
37
|
+
const lineText = lines[lineIndex];
|
38
|
+
if (!lineText)
|
39
|
+
continue;
|
40
|
+
const columnIndex = identifier.position.column - 1;
|
41
|
+
// Check if the identifier exists at the expected position
|
42
|
+
if (lineText.substring(columnIndex).startsWith(identifier.name)) {
|
43
|
+
// Calculate the absolute position in the full text
|
44
|
+
const lineStartPosition = lineStartPositions[lineIndex] ?? 0;
|
45
|
+
const absolutePosition = lineStartPosition + columnIndex;
|
46
|
+
// Check if already wrapped at this specific position
|
47
|
+
const existingWrapped = containerElement.querySelectorAll(`[data-graphql-id]`);
|
48
|
+
let alreadyWrapped = false;
|
49
|
+
for (const wrapped of existingWrapped) {
|
50
|
+
if (wrapped.textContent === identifier.name) {
|
51
|
+
const startPos = parseInt(wrapped.getAttribute('data-graphql-start') || '0');
|
52
|
+
if (startPos === identifier.position.start) {
|
53
|
+
alreadyWrapped = true;
|
54
|
+
break;
|
55
|
+
}
|
56
|
+
}
|
57
|
+
}
|
58
|
+
if (alreadyWrapped)
|
59
|
+
continue;
|
60
|
+
// Create wrapper span
|
61
|
+
const wrapper = document.createElement('span');
|
62
|
+
const id = `${identifier.position.start}-${identifier.name}-${identifier.kind}`;
|
63
|
+
wrapper.setAttribute('data-graphql-id', id);
|
64
|
+
wrapper.setAttribute('data-graphql-name', identifier.name);
|
65
|
+
wrapper.setAttribute('data-graphql-kind', identifier.kind);
|
66
|
+
wrapper.setAttribute('data-graphql-start', String(identifier.position.start));
|
67
|
+
wrapper.setAttribute('data-graphql-end', String(identifier.position.end));
|
68
|
+
wrapper.setAttribute('data-graphql-line', String(identifier.position.line));
|
69
|
+
wrapper.setAttribute('data-graphql-column', String(identifier.position.column));
|
70
|
+
wrapper.setAttribute('data-graphql-path', identifier.schemaPath.join(','));
|
71
|
+
// Find the position in the container and wrap the text
|
72
|
+
const walker = document.createTreeWalker(containerElement, NodeFilter.SHOW_TEXT, null);
|
73
|
+
let currentPos = 0;
|
74
|
+
let node;
|
75
|
+
while (node = walker.nextNode()) {
|
76
|
+
const textNode = node;
|
77
|
+
const text = textNode.textContent || '';
|
78
|
+
// Check if this text node contains our identifier
|
79
|
+
if (currentPos <= absolutePosition && absolutePosition < currentPos + text.length) {
|
80
|
+
const relativePos = absolutePosition - currentPos;
|
81
|
+
if (text.substring(relativePos).startsWith(identifier.name)) {
|
82
|
+
// Split the text node
|
83
|
+
const before = text.substring(0, relativePos);
|
84
|
+
const identifierText = identifier.name;
|
85
|
+
const after = text.substring(relativePos + identifierText.length);
|
86
|
+
const parent = textNode.parentNode;
|
87
|
+
if (before) {
|
88
|
+
parent.insertBefore(document.createTextNode(before), textNode);
|
89
|
+
}
|
90
|
+
wrapper.textContent = identifierText;
|
91
|
+
parent.insertBefore(wrapper, textNode);
|
92
|
+
if (after) {
|
93
|
+
parent.insertBefore(document.createTextNode(after), textNode);
|
94
|
+
}
|
95
|
+
parent.removeChild(textNode);
|
96
|
+
break;
|
97
|
+
}
|
98
|
+
}
|
99
|
+
currentPos += text.length;
|
100
|
+
}
|
28
101
|
}
|
29
|
-
// Then by column (right to left)
|
30
|
-
return b.position.column - a.position.column;
|
31
|
-
});
|
32
|
-
// Process all identifiers
|
33
|
-
let wrappedCount = 0;
|
34
|
-
for (const identifier of sortedIdentifiers) {
|
35
|
-
const wrapped = this.wrapIdentifier(containerElement, identifier);
|
36
|
-
if (wrapped)
|
37
|
-
wrappedCount++;
|
38
102
|
}
|
39
103
|
}
|
40
104
|
/**
|
@@ -76,82 +140,6 @@ export class SimplePositionCalculator {
|
|
76
140
|
}
|
77
141
|
return results;
|
78
142
|
}
|
79
|
-
/**
|
80
|
-
* Wrap an identifier in a span for positioning
|
81
|
-
* Returns true if the identifier was successfully wrapped
|
82
|
-
*/
|
83
|
-
wrapIdentifier(containerElement, identifier) {
|
84
|
-
const walker = document.createTreeWalker(containerElement, NodeFilter.SHOW_TEXT, null);
|
85
|
-
let currentLine = 1;
|
86
|
-
let currentColumn = 1;
|
87
|
-
let node;
|
88
|
-
while (node = walker.nextNode()) {
|
89
|
-
const textNode = node;
|
90
|
-
const text = textNode.textContent || '';
|
91
|
-
// Check if already wrapped
|
92
|
-
if (textNode.parentElement?.hasAttribute('data-graphql-id')) {
|
93
|
-
// Update position tracking and continue
|
94
|
-
for (const char of text) {
|
95
|
-
if (char === '\n') {
|
96
|
-
currentLine++;
|
97
|
-
currentColumn = 1;
|
98
|
-
}
|
99
|
-
else {
|
100
|
-
currentColumn++;
|
101
|
-
}
|
102
|
-
}
|
103
|
-
continue;
|
104
|
-
}
|
105
|
-
// Track position in the text
|
106
|
-
let textIndex = 0;
|
107
|
-
while (textIndex < text.length) {
|
108
|
-
// Check if we're at the identifier's position
|
109
|
-
if (currentLine === identifier.position.line
|
110
|
-
&& currentColumn === identifier.position.column) {
|
111
|
-
// Verify it's actually our identifier
|
112
|
-
const remainingText = text.substring(textIndex);
|
113
|
-
if (remainingText.startsWith(identifier.name)) {
|
114
|
-
// Create a unique ID for this identifier
|
115
|
-
const id = `${identifier.position.start}-${identifier.name}-${identifier.kind}`;
|
116
|
-
// Split the text node and wrap the identifier
|
117
|
-
const before = text.substring(0, textIndex);
|
118
|
-
const after = text.substring(textIndex + identifier.name.length);
|
119
|
-
const span = document.createElement('span');
|
120
|
-
span.setAttribute('data-graphql-id', id);
|
121
|
-
span.setAttribute('data-graphql-name', identifier.name);
|
122
|
-
span.setAttribute('data-graphql-kind', identifier.kind);
|
123
|
-
span.setAttribute('data-graphql-start', String(identifier.position.start));
|
124
|
-
span.setAttribute('data-graphql-end', String(identifier.position.end));
|
125
|
-
span.setAttribute('data-graphql-line', String(identifier.position.line));
|
126
|
-
span.setAttribute('data-graphql-column', String(identifier.position.column));
|
127
|
-
span.setAttribute('data-graphql-path', identifier.schemaPath.join(','));
|
128
|
-
span.textContent = identifier.name;
|
129
|
-
const parent = textNode.parentNode;
|
130
|
-
if (before) {
|
131
|
-
parent.insertBefore(document.createTextNode(before), textNode);
|
132
|
-
}
|
133
|
-
parent.insertBefore(span, textNode);
|
134
|
-
if (after) {
|
135
|
-
parent.insertBefore(document.createTextNode(after), textNode);
|
136
|
-
}
|
137
|
-
parent.removeChild(textNode);
|
138
|
-
return true;
|
139
|
-
}
|
140
|
-
}
|
141
|
-
// Update position tracking
|
142
|
-
const char = text[textIndex];
|
143
|
-
if (char === '\n') {
|
144
|
-
currentLine++;
|
145
|
-
currentColumn = 1;
|
146
|
-
}
|
147
|
-
else {
|
148
|
-
currentColumn++;
|
149
|
-
}
|
150
|
-
textIndex++;
|
151
|
-
}
|
152
|
-
}
|
153
|
-
return false; // Identifier not found
|
154
|
-
}
|
155
143
|
}
|
156
144
|
/**
|
157
145
|
* Create invisible overlay for a position
|