polen 0.10.0-next.21 → 0.10.0-next.23
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/builder/builder.d.ts +4 -11
- package/build/api/builder/builder.d.ts.map +1 -1
- package/build/api/builder/builder.js +4 -3
- package/build/api/builder/builder.js.map +1 -1
- package/build/api/config/configurator.d.ts +62 -11
- package/build/api/config/configurator.d.ts.map +1 -1
- package/build/api/config/configurator.js +9 -0
- package/build/api/config/configurator.js.map +1 -1
- package/build/api/config/merge.d.ts.map +1 -1
- package/build/api/config/merge.js +8 -0
- package/build/api/config/merge.js.map +1 -1
- package/build/api/vite/plugins/core.d.ts.map +1 -1
- package/build/api/vite/plugins/core.js +1 -0
- package/build/api/vite/plugins/core.js.map +1 -1
- package/build/cli/commands/build.js +11 -7
- package/build/cli/commands/build.js.map +1 -1
- package/build/project-data.d.ts +1 -0
- package/build/project-data.d.ts.map +1 -1
- package/build/sandbox.js +40 -17
- package/build/sandbox.js.map +1 -1
- package/build/template/components/CodeBlock.d.ts.map +1 -1
- package/build/template/components/CodeBlock.js +3 -5
- package/build/template/components/CodeBlock.js.map +1 -1
- package/build/template/components/Field.js +1 -1
- package/build/template/components/Field.js.map +1 -1
- package/build/template/components/GraphQLInteractive/GraphQLInteractive.d.ts +31 -0
- package/build/template/components/GraphQLInteractive/GraphQLInteractive.d.ts.map +1 -0
- package/build/template/components/GraphQLInteractive/GraphQLInteractive.js +275 -0
- package/build/template/components/GraphQLInteractive/GraphQLInteractive.js.map +1 -0
- package/build/template/components/GraphQLInteractive/components/GraphQLErrorBoundary.d.ts +39 -0
- package/build/template/components/GraphQLInteractive/components/GraphQLErrorBoundary.d.ts.map +1 -0
- package/build/template/components/GraphQLInteractive/components/GraphQLErrorBoundary.js +51 -0
- package/build/template/components/GraphQLInteractive/components/GraphQLErrorBoundary.js.map +1 -0
- package/build/template/components/GraphQLInteractive/components/GraphQLTokenPopover.d.ts +33 -0
- package/build/template/components/GraphQLInteractive/components/GraphQLTokenPopover.d.ts.map +1 -0
- package/build/template/components/GraphQLInteractive/components/GraphQLTokenPopover.js +242 -0
- package/build/template/components/GraphQLInteractive/components/GraphQLTokenPopover.js.map +1 -0
- package/build/template/components/GraphQLInteractive/hooks/use-popover-state.d.ts +45 -0
- package/build/template/components/GraphQLInteractive/hooks/use-popover-state.d.ts.map +1 -0
- package/build/template/components/GraphQLInteractive/hooks/use-popover-state.js +176 -0
- package/build/template/components/GraphQLInteractive/hooks/use-popover-state.js.map +1 -0
- package/build/template/components/GraphQLInteractive/index.d.ts +2 -0
- package/build/template/components/GraphQLInteractive/index.d.ts.map +1 -0
- package/build/template/components/GraphQLInteractive/index.js +2 -0
- package/build/template/components/GraphQLInteractive/index.js.map +1 -0
- package/build/template/components/GraphQLInteractive/lib/graphql-node-types.d.ts +52 -0
- package/build/template/components/GraphQLInteractive/lib/graphql-node-types.d.ts.map +1 -0
- package/build/template/components/GraphQLInteractive/lib/graphql-node-types.js +34 -0
- package/build/template/components/GraphQLInteractive/lib/graphql-node-types.js.map +1 -0
- package/build/template/components/GraphQLInteractive/lib/parser.d.ts +71 -0
- package/build/template/components/GraphQLInteractive/lib/parser.d.ts.map +1 -0
- package/build/template/components/GraphQLInteractive/lib/parser.js +836 -0
- package/build/template/components/GraphQLInteractive/lib/parser.js.map +1 -0
- package/build/template/components/GraphQLInteractive/lib/semantic-nodes.d.ts +98 -0
- package/build/template/components/GraphQLInteractive/lib/semantic-nodes.d.ts.map +1 -0
- package/build/template/components/GraphQLInteractive/lib/semantic-nodes.js +31 -0
- package/build/template/components/GraphQLInteractive/lib/semantic-nodes.js.map +1 -0
- package/build/template/components/content/$$.d.ts +0 -1
- package/build/template/components/content/$$.d.ts.map +1 -1
- package/build/template/components/content/$$.js +0 -1
- package/build/template/components/content/$$.js.map +1 -1
- package/package.json +5 -21
- package/src/api/builder/builder.ts +8 -13
- package/src/api/config/configurator.ts +72 -11
- package/src/api/config/merge.ts +13 -0
- package/src/api/vite/plugins/core.ts +1 -0
- package/src/cli/commands/build.ts +11 -7
- package/src/lib/kit-temp.test.ts +9 -9
- package/src/project-data.ts +1 -0
- package/src/sandbox.ts +40 -17
- package/src/template/components/CodeBlock.tsx +6 -9
- package/src/template/components/Field.tsx +1 -1
- package/src/template/components/GraphQLInteractive/GraphQLInteractive.tsx +464 -0
- package/src/template/components/GraphQLInteractive/components/GraphQLErrorBoundary.tsx +96 -0
- package/src/template/components/GraphQLInteractive/components/GraphQLTokenPopover.tsx +492 -0
- package/src/template/components/GraphQLInteractive/hooks/use-popover-state.ts +244 -0
- package/src/template/components/GraphQLInteractive/index.ts +1 -0
- package/src/template/components/GraphQLInteractive/lib/graphql-node-types.ts +217 -0
- package/src/template/components/GraphQLInteractive/lib/parser.ts +1075 -0
- package/src/template/components/GraphQLInteractive/lib/semantic-nodes.ts +154 -0
- package/src/template/components/GraphQLInteractive/tests/parser-comment.test.ts +33 -0
- package/src/template/components/GraphQLInteractive/tests/parser-error-hint.test.ts +102 -0
- package/src/template/components/GraphQLInteractive/tests/parser.test.ts +131 -0
- package/src/template/components/content/$$.ts +0 -1
- package/build/template/components/content/GraphQLDocumentWithSchema.d.ts +0 -8
- package/build/template/components/content/GraphQLDocumentWithSchema.d.ts.map +0 -1
- package/build/template/components/content/GraphQLDocumentWithSchema.js +0 -13
- package/build/template/components/content/GraphQLDocumentWithSchema.js.map +0 -1
- package/build/template/components/content/GraphQLDocumentWrapper.d.ts +0 -7
- package/build/template/components/content/GraphQLDocumentWrapper.d.ts.map +0 -1
- package/build/template/components/content/GraphQLDocumentWrapper.js +0 -48
- package/build/template/components/content/GraphQLDocumentWrapper.js.map +0 -1
- package/src/template/components/content/GraphQLDocumentWithSchema.tsx +0 -13
- package/src/template/components/content/GraphQLDocumentWrapper.tsx +0 -72
@@ -0,0 +1,242 @@
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { Cross1Icon } from '@radix-ui/react-icons';
|
3
|
+
import { Button, Popover } from '@radix-ui/themes';
|
4
|
+
import { isArgument, isFragment, isInputField, isInvalidField, isOperation, isOutputField, } from '../lib/semantic-nodes.js';
|
5
|
+
/**
|
6
|
+
* Get rich content for a token popover
|
7
|
+
*/
|
8
|
+
function getPopoverContent(token) {
|
9
|
+
const semantic = token.semantic;
|
10
|
+
if (!semantic)
|
11
|
+
return null;
|
12
|
+
if (isInvalidField(semantic)) {
|
13
|
+
// Get available fields from the parent type
|
14
|
+
const availableFields = Object.keys(semantic.parentType.getFields()).sort();
|
15
|
+
// TODO: In the future, check other schema versions to see if the field existed previously
|
16
|
+
// This would help identify renamed or removed fields across schema evolution
|
17
|
+
return {
|
18
|
+
title: `Field "${semantic.fieldName}" does not exist`,
|
19
|
+
description: `Type ${semantic.parentType.name} does not have a field named "${semantic.fieldName}".`,
|
20
|
+
typeName: semantic.parentType.name,
|
21
|
+
typeUrl: `/reference/${semantic.parentType.name}`,
|
22
|
+
fieldName: semantic.fieldName,
|
23
|
+
invalid: true,
|
24
|
+
availableFields,
|
25
|
+
};
|
26
|
+
}
|
27
|
+
if (isOutputField(semantic)) {
|
28
|
+
const fieldType = semantic.fieldDef.type.toString();
|
29
|
+
return {
|
30
|
+
title: semantic.fieldDef.name,
|
31
|
+
path: [
|
32
|
+
{ name: semantic.parentType.name, url: `/reference/${semantic.parentType.name}` },
|
33
|
+
{ name: semantic.fieldDef.name, url: `/reference/${semantic.parentType.name}#${semantic.fieldDef.name}` },
|
34
|
+
],
|
35
|
+
description: semantic.fieldDef.description || undefined,
|
36
|
+
type: `${fieldType}`,
|
37
|
+
};
|
38
|
+
}
|
39
|
+
if (isInputField(semantic)) {
|
40
|
+
const fieldType = semantic.fieldDef.type.toString();
|
41
|
+
return {
|
42
|
+
title: semantic.fieldDef.name,
|
43
|
+
path: [
|
44
|
+
{ name: semantic.parentType.name, url: `/reference/${semantic.parentType.name}` },
|
45
|
+
{ name: semantic.fieldDef.name, url: `/reference/${semantic.parentType.name}#${semantic.fieldDef.name}` },
|
46
|
+
],
|
47
|
+
description: semantic.fieldDef.description || undefined,
|
48
|
+
type: `${fieldType}`,
|
49
|
+
};
|
50
|
+
}
|
51
|
+
if (isArgument(semantic)) {
|
52
|
+
const argType = semantic.argumentDef.type.toString();
|
53
|
+
return {
|
54
|
+
title: semantic.argumentDef.name,
|
55
|
+
path: [
|
56
|
+
{ name: semantic.parentType.name, url: `/reference/${semantic.parentType.name}` },
|
57
|
+
{ name: semantic.parentField.name, url: `/reference/${semantic.parentType.name}#${semantic.parentField.name}` },
|
58
|
+
{
|
59
|
+
name: semantic.argumentDef.name,
|
60
|
+
url: `/reference/${semantic.parentType.name}#${semantic.parentField.name}__${semantic.argumentDef.name}`,
|
61
|
+
},
|
62
|
+
],
|
63
|
+
description: semantic.argumentDef.description || undefined,
|
64
|
+
type: `${argType}`,
|
65
|
+
};
|
66
|
+
}
|
67
|
+
if (isOperation(semantic)) {
|
68
|
+
return {
|
69
|
+
title: semantic.name || `${semantic.type} operation`,
|
70
|
+
path: [
|
71
|
+
{ name: semantic.name || semantic.type, url: null },
|
72
|
+
],
|
73
|
+
description: 'GraphQL Operation',
|
74
|
+
type: semantic.type.charAt(0).toUpperCase() + semantic.type.slice(1),
|
75
|
+
};
|
76
|
+
}
|
77
|
+
if (isFragment(semantic)) {
|
78
|
+
return {
|
79
|
+
title: semantic.name,
|
80
|
+
path: [
|
81
|
+
{ name: 'fragment', url: null },
|
82
|
+
{ name: semantic.name, url: null },
|
83
|
+
],
|
84
|
+
description: 'GraphQL Fragment',
|
85
|
+
type: `Fragment on ${semantic.onType?.name || 'Unknown'}`,
|
86
|
+
};
|
87
|
+
}
|
88
|
+
if ('name' in semantic && semantic.name) {
|
89
|
+
// Type reference
|
90
|
+
return {
|
91
|
+
title: semantic.name,
|
92
|
+
path: [
|
93
|
+
{ name: semantic.name, url: `/reference/${semantic.name}` },
|
94
|
+
],
|
95
|
+
description: ('description' in semantic && typeof semantic.description === 'string')
|
96
|
+
? semantic.description
|
97
|
+
: undefined,
|
98
|
+
type: 'GraphQL Type',
|
99
|
+
};
|
100
|
+
}
|
101
|
+
return null;
|
102
|
+
}
|
103
|
+
export const GraphQLTokenPopover = ({ token, children, open, pinned, onTriggerHover, onTriggerLeave, onTriggerClick, onContentHover, onContentLeave, onClose, }) => {
|
104
|
+
const content = getPopoverContent(token);
|
105
|
+
// If no content, just render children without popover
|
106
|
+
if (!content) {
|
107
|
+
return _jsx(_Fragment, { children: children });
|
108
|
+
}
|
109
|
+
const popoverContent = (_jsxs("div", { style: {
|
110
|
+
padding: 'var(--space-1)',
|
111
|
+
minWidth: '200px',
|
112
|
+
maxWidth: '400px',
|
113
|
+
position: 'relative',
|
114
|
+
}, onMouseEnter: onContentHover, onMouseLeave: onContentLeave, children: [_jsxs("div", { style: {
|
115
|
+
display: 'flex',
|
116
|
+
justifyContent: 'space-between',
|
117
|
+
alignItems: 'flex-start',
|
118
|
+
marginBottom: '6px',
|
119
|
+
}, children: [_jsxs("div", { style: { flex: 1 }, children: [content.path && !content.invalid && (_jsx("div", { style: {
|
120
|
+
fontSize: 'var(--font-size-2)',
|
121
|
+
color: 'var(--gray-12)',
|
122
|
+
marginBottom: 'var(--space-1)',
|
123
|
+
}, children: content.path.map((segment, index) => (_jsxs("span", { children: [index > 0 && _jsx("span", { style: { color: 'var(--gray-11)', margin: '0 var(--space-1)' }, children: "." }), segment.url
|
124
|
+
? (_jsx("a", { href: segment.url, style: {
|
125
|
+
color: '#0969da',
|
126
|
+
textDecoration: 'none',
|
127
|
+
cursor: 'pointer',
|
128
|
+
}, onMouseEnter: (e) => {
|
129
|
+
e.currentTarget.style.textDecoration = 'underline';
|
130
|
+
}, onMouseLeave: (e) => {
|
131
|
+
e.currentTarget.style.textDecoration = 'none';
|
132
|
+
}, onClick: (e) => {
|
133
|
+
e.preventDefault();
|
134
|
+
if (segment.url) {
|
135
|
+
window.location.href = segment.url;
|
136
|
+
}
|
137
|
+
}, children: segment.name }))
|
138
|
+
: (_jsx("span", { style: { color: '#24292e' }, children: segment.name }))] }, index))) })), content.type && !content.invalid && (_jsx("div", { style: {
|
139
|
+
fontSize: '12px',
|
140
|
+
color: '#6a737d',
|
141
|
+
fontFamily: 'monospace',
|
142
|
+
opacity: 0.8,
|
143
|
+
}, children: content.type })), content.invalid && (_jsxs("div", { style: {
|
144
|
+
fontSize: '14px',
|
145
|
+
color: '#d73a49',
|
146
|
+
marginBottom: '4px',
|
147
|
+
}, children: [_jsx("span", { style: { fontWeight: 'bold' }, children: "Error:" }), " Type", ' ', _jsx("a", { href: content.typeUrl, style: {
|
148
|
+
color: '#0969da',
|
149
|
+
textDecoration: 'none',
|
150
|
+
cursor: 'pointer',
|
151
|
+
}, onMouseEnter: (e) => {
|
152
|
+
e.currentTarget.style.textDecoration = 'underline';
|
153
|
+
}, onMouseLeave: (e) => {
|
154
|
+
e.currentTarget.style.textDecoration = 'none';
|
155
|
+
}, onClick: (e) => {
|
156
|
+
e.preventDefault();
|
157
|
+
if (content.typeUrl) {
|
158
|
+
window.location.href = content.typeUrl;
|
159
|
+
}
|
160
|
+
}, children: content.typeName }), ' ', "does not have a field named \"", content.fieldName, "\"."] }))] }), pinned && !content.invalid && (_jsx(Button, { variant: 'ghost', size: '1', onClick: onClose, style: {
|
161
|
+
marginLeft: '8px',
|
162
|
+
padding: '2px',
|
163
|
+
minWidth: 'auto',
|
164
|
+
height: 'auto',
|
165
|
+
}, children: _jsx(Cross1Icon, { width: '12', height: '12' }) }))] }), content.description && !content.invalid && (_jsx("div", { style: {
|
166
|
+
fontSize: '13px',
|
167
|
+
color: '#24292e',
|
168
|
+
lineHeight: '1.4',
|
169
|
+
opacity: 0.9,
|
170
|
+
}, children: content.description })), content.invalid && content.availableFields && (_jsxs("div", { style: {
|
171
|
+
marginTop: '8px',
|
172
|
+
backgroundColor: '#f6f8fa',
|
173
|
+
border: '1px solid #e1e4e8',
|
174
|
+
borderRadius: '4px',
|
175
|
+
fontSize: '12px',
|
176
|
+
fontFamily: 'monospace',
|
177
|
+
lineHeight: '1.5',
|
178
|
+
overflow: 'hidden',
|
179
|
+
}, children: [_jsxs("div", { style: { padding: '10px 10px 0 10px' }, children: [_jsx("span", { style: { color: '#d73a49' }, children: "type" }), ' ', _jsx("a", { href: content.typeUrl, style: {
|
180
|
+
color: '#005cc5',
|
181
|
+
fontWeight: 500,
|
182
|
+
textDecoration: 'none',
|
183
|
+
}, onMouseEnter: (e) => {
|
184
|
+
e.currentTarget.style.textDecoration = 'underline';
|
185
|
+
}, onMouseLeave: (e) => {
|
186
|
+
e.currentTarget.style.textDecoration = 'none';
|
187
|
+
}, children: content.typeName }), ' ', _jsx("span", { style: { color: '#24292e' }, children: '{' })] }), _jsx("div", { style: {
|
188
|
+
maxHeight: '200px',
|
189
|
+
overflowY: 'auto',
|
190
|
+
padding: '0 10px',
|
191
|
+
marginRight: '2px', // Account for scrollbar
|
192
|
+
}, children: (() => {
|
193
|
+
// Insert the invalid field in alphabetical position
|
194
|
+
const invalidFieldName = content.fieldName || '';
|
195
|
+
const allFields = [...content.availableFields];
|
196
|
+
const insertIndex = allFields.findIndex(f => f.localeCompare(invalidFieldName) > 0);
|
197
|
+
// Create the full list with invalid field inserted
|
198
|
+
const fieldsWithInvalid = insertIndex === -1
|
199
|
+
? [...allFields, invalidFieldName]
|
200
|
+
: [...allFields.slice(0, insertIndex), invalidFieldName, ...allFields.slice(insertIndex)];
|
201
|
+
return fieldsWithInvalid.map((field) => {
|
202
|
+
const isInvalidField = field === invalidFieldName;
|
203
|
+
return (_jsxs("div", { style: {
|
204
|
+
paddingLeft: isInvalidField ? '26px' : '16px',
|
205
|
+
color: isInvalidField ? '#d73a49' : '#6f42c1',
|
206
|
+
display: 'flex',
|
207
|
+
alignItems: 'center',
|
208
|
+
backgroundColor: isInvalidField ? 'var(--red-a2)' : 'transparent',
|
209
|
+
marginLeft: isInvalidField ? '-10px' : '0',
|
210
|
+
marginRight: isInvalidField ? '-10px' : '0',
|
211
|
+
paddingTop: isInvalidField ? '2px' : '0',
|
212
|
+
paddingBottom: isInvalidField ? '2px' : '0',
|
213
|
+
}, children: [isInvalidField
|
214
|
+
? (_jsx("span", { style: { textDecoration: 'line-through' }, children: field }))
|
215
|
+
: (_jsx("a", { href: `/reference/${content.typeName}#${field}`, style: {
|
216
|
+
color: '#6f42c1',
|
217
|
+
textDecoration: 'none',
|
218
|
+
}, onMouseEnter: (e) => {
|
219
|
+
e.currentTarget.style.textDecoration = 'underline';
|
220
|
+
}, onMouseLeave: (e) => {
|
221
|
+
e.currentTarget.style.textDecoration = 'none';
|
222
|
+
}, children: field })), isInvalidField && (_jsx("span", { style: {
|
223
|
+
marginLeft: '12px',
|
224
|
+
color: '#d73a49',
|
225
|
+
fontSize: '11px',
|
226
|
+
display: 'flex',
|
227
|
+
alignItems: 'center',
|
228
|
+
gap: '4px',
|
229
|
+
}, children: "\u2190 No such field" }))] }, field));
|
230
|
+
});
|
231
|
+
})() }), _jsx("div", { style: { padding: '0 10px 10px 10px', color: '#24292e' }, children: '}' })] }))] }));
|
232
|
+
return (_jsxs(Popover.Root, { open: open, children: [_jsx(Popover.Trigger, { children: _jsx("span", { style: { cursor: token.polen.isInteractive() ? 'pointer' : 'default' }, onMouseEnter: onTriggerHover, onMouseLeave: onTriggerLeave, onClick: onTriggerClick, children: children }) }), _jsx(Popover.Content, { side: 'top', align: 'start', sideOffset: 4, style: {
|
233
|
+
padding: 'var(--space-2)',
|
234
|
+
background: content.invalid ? 'var(--red-1)' : 'var(--color-background)',
|
235
|
+
border: content.invalid ? '2px solid var(--red-7)' : '1px solid var(--gray-6)',
|
236
|
+
borderRadius: 'var(--radius-1)',
|
237
|
+
boxShadow: 'none',
|
238
|
+
zIndex: 1000,
|
239
|
+
maxWidth: '450px',
|
240
|
+
}, children: popoverContent })] }));
|
241
|
+
};
|
242
|
+
//# sourceMappingURL=GraphQLTokenPopover.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Gra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EAAE,MAAM;gDACf,UAAU,EAAE,QAAQ;gDACpB,GAAG,EAAE,KAAK;6CACX,qCAGI,CACR,KAjDI,KAAK,CAkDN,CACP,CAAA;4BACH,CAAC,CAAC,CAAA;wBACJ,CAAC,CAAC,EAAE,GACA,EACN,cAAK,KAAK,EAAE,EAAE,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,SAAS,EAAE,YAAG,GAAG,GAAO,IACtE,CACP,IACG,CACP,CAAA;IAED,OAAO,CACL,MAAC,OAAO,CAAC,IAAI,IAAC,IAAI,EAAE,IAAI,aACtB,KAAC,OAAO,CAAC,OAAO,cACd,eACE,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EAAE,EACtE,YAAY,EAAE,cAAc,EAC5B,YAAY,EAAE,cAAc,EAC5B,OAAO,EAAE,cAAc,YAEtB,QAAQ,GACJ,GACS,EAElB,KAAC,OAAO,CAAC,OAAO,IACd,IAAI,EAAC,KAAK,EACV,KAAK,EAAC,OAAO,EACb,UAAU,EAAE,CAAC,EACb,KAAK,EAAE;oBACL,OAAO,EAAE,gBAAgB;oBACzB,UAAU,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,yBAAyB;oBACxE,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,yBAAyB;oBAC9E,YAAY,EAAE,iBAAiB;oBAC/B,SAAS,EAAE,MAAM;oBACjB,MAAM,EAAE,IAAI;oBACZ,QAAQ,EAAE,OAAO;iBAClB,YAEA,cAAc,GACC,IACL,CAChB,CAAA;AACH,CAAC,CAAA"}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
/**
|
2
|
+
* State management for GraphQL token popovers
|
3
|
+
*
|
4
|
+
* Handles hover delays, pinning, and multiple popover coordination
|
5
|
+
*/
|
6
|
+
export interface PopoverState {
|
7
|
+
/** Currently visible popover (via hover) */
|
8
|
+
hoveredId: string | null;
|
9
|
+
/** Set of pinned popover 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 UsePopoverStateOptions {
|
17
|
+
/** Delay before showing popover on hover (ms) */
|
18
|
+
showDelay?: number;
|
19
|
+
/** Delay before hiding popover on mouse leave (ms) */
|
20
|
+
hideDelay?: number;
|
21
|
+
/** Whether to allow multiple pinned popovers */
|
22
|
+
allowMultiplePins?: boolean;
|
23
|
+
}
|
24
|
+
export interface UsePopoverStateReturn {
|
25
|
+
/** Check if a popover should be visible */
|
26
|
+
isOpen: (id: string) => boolean;
|
27
|
+
/** Check if a popover 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 popover content hover (cancels hide) */
|
36
|
+
onPopoverHover: (id: string) => void;
|
37
|
+
/** Handle popover content leave (starts hide timer) */
|
38
|
+
onPopoverLeave: (id: string) => void;
|
39
|
+
/** Unpin a specific popover */
|
40
|
+
unpin: (id: string) => void;
|
41
|
+
/** Unpin all popovers */
|
42
|
+
unpinAll: () => void;
|
43
|
+
}
|
44
|
+
export declare const usePopoverState: (options?: UsePopoverStateOptions) => UsePopoverStateReturn;
|
45
|
+
//# sourceMappingURL=use-popover-state.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"use-popover-state.d.ts","sourceRoot":"","sources":["../../../../../src/template/components/GraphQLInteractive/hooks/use-popover-state.ts"],"names":[],"mappings":"AAAA;;;;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@@
|
|
1
|
+
/**
|
2
|
+
* State management for GraphQL token popovers
|
3
|
+
*
|
4
|
+
* Handles hover delays, pinning, and multiple popover coordination
|
5
|
+
*/
|
6
|
+
import { React as ReactHooks } from '#dep/react/index';
|
7
|
+
export const usePopoverState = (options = {}) => {
|
8
|
+
const { showDelay = 300, hideDelay = 200, allowMultiplePins = true, } = options;
|
9
|
+
const [hoveredId, setHoveredId] = ReactHooks.useState(null);
|
10
|
+
const [pinnedIds, setPinnedIds] = ReactHooks.useState(new Set());
|
11
|
+
const [pendingShowId, setPendingShowId] = ReactHooks.useState(null);
|
12
|
+
const [pendingHideId, setPendingHideId] = ReactHooks.useState(null);
|
13
|
+
// Timer refs
|
14
|
+
const showTimerRef = ReactHooks.useRef(null);
|
15
|
+
const hideTimerRef = ReactHooks.useRef(null);
|
16
|
+
// Clear any pending timers
|
17
|
+
const clearTimers = ReactHooks.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 popover should be visible
|
30
|
+
const isOpen = ReactHooks.useCallback((id) => {
|
31
|
+
return hoveredId === id || pinnedIds.has(id);
|
32
|
+
}, [hoveredId, pinnedIds]);
|
33
|
+
// Check if popover is pinned
|
34
|
+
const isPinned = ReactHooks.useCallback((id) => {
|
35
|
+
return pinnedIds.has(id);
|
36
|
+
}, [pinnedIds]);
|
37
|
+
// Handle hover start
|
38
|
+
const onHoverStart = ReactHooks.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 existing timers
|
50
|
+
clearTimers();
|
51
|
+
// Set pending show
|
52
|
+
setPendingShowId(id);
|
53
|
+
// Start show timer
|
54
|
+
showTimerRef.current = setTimeout(() => {
|
55
|
+
setHoveredId(id);
|
56
|
+
setPendingShowId(null);
|
57
|
+
showTimerRef.current = null;
|
58
|
+
}, showDelay);
|
59
|
+
}, [pinnedIds, pendingHideId, clearTimers, showDelay]);
|
60
|
+
// Handle hover end
|
61
|
+
const onHoverEnd = ReactHooks.useCallback((id) => {
|
62
|
+
// Don't hide if pinned
|
63
|
+
if (pinnedIds.has(id))
|
64
|
+
return;
|
65
|
+
// Cancel any pending show
|
66
|
+
if (pendingShowId === id) {
|
67
|
+
clearTimeout(showTimerRef.current);
|
68
|
+
showTimerRef.current = null;
|
69
|
+
setPendingShowId(null);
|
70
|
+
return;
|
71
|
+
}
|
72
|
+
// Only hide if currently hovered
|
73
|
+
if (hoveredId === id) {
|
74
|
+
setPendingHideId(id);
|
75
|
+
hideTimerRef.current = setTimeout(() => {
|
76
|
+
setHoveredId(null);
|
77
|
+
setPendingHideId(null);
|
78
|
+
hideTimerRef.current = null;
|
79
|
+
}, hideDelay);
|
80
|
+
}
|
81
|
+
}, [pinnedIds, pendingShowId, hoveredId, hideDelay]);
|
82
|
+
// Handle popover content hover (cancels hide)
|
83
|
+
const onPopoverHover = ReactHooks.useCallback((id) => {
|
84
|
+
if (pendingHideId === id) {
|
85
|
+
clearTimeout(hideTimerRef.current);
|
86
|
+
hideTimerRef.current = null;
|
87
|
+
setPendingHideId(null);
|
88
|
+
}
|
89
|
+
}, [pendingHideId]);
|
90
|
+
// Handle popover content leave (starts hide timer)
|
91
|
+
const onPopoverLeave = ReactHooks.useCallback((id) => {
|
92
|
+
// Don't hide if pinned
|
93
|
+
if (pinnedIds.has(id))
|
94
|
+
return;
|
95
|
+
// Only hide if currently hovered
|
96
|
+
if (hoveredId === id) {
|
97
|
+
setPendingHideId(id);
|
98
|
+
hideTimerRef.current = setTimeout(() => {
|
99
|
+
setHoveredId(null);
|
100
|
+
setPendingHideId(null);
|
101
|
+
hideTimerRef.current = null;
|
102
|
+
}, hideDelay);
|
103
|
+
}
|
104
|
+
}, [pinnedIds, hoveredId, hideDelay]);
|
105
|
+
// Toggle pin state
|
106
|
+
const onTogglePin = ReactHooks.useCallback((id) => {
|
107
|
+
setPinnedIds(prev => {
|
108
|
+
const next = new Set(prev);
|
109
|
+
if (next.has(id)) {
|
110
|
+
// Unpin
|
111
|
+
next.delete(id);
|
112
|
+
}
|
113
|
+
else {
|
114
|
+
// Pin
|
115
|
+
if (!allowMultiplePins) {
|
116
|
+
// Clear other pins if multiple not allowed
|
117
|
+
next.clear();
|
118
|
+
}
|
119
|
+
next.add(id);
|
120
|
+
// Clear any hover state for this ID
|
121
|
+
if (hoveredId === id) {
|
122
|
+
setHoveredId(null);
|
123
|
+
}
|
124
|
+
// Clear any pending operations
|
125
|
+
if (pendingShowId === id) {
|
126
|
+
clearTimeout(showTimerRef.current);
|
127
|
+
showTimerRef.current = null;
|
128
|
+
setPendingShowId(null);
|
129
|
+
}
|
130
|
+
if (pendingHideId === id) {
|
131
|
+
clearTimeout(hideTimerRef.current);
|
132
|
+
hideTimerRef.current = null;
|
133
|
+
setPendingHideId(null);
|
134
|
+
}
|
135
|
+
}
|
136
|
+
return next;
|
137
|
+
});
|
138
|
+
}, [allowMultiplePins, hoveredId, pendingShowId, pendingHideId]);
|
139
|
+
// Unpin specific popover
|
140
|
+
const unpin = ReactHooks.useCallback((id) => {
|
141
|
+
setPinnedIds(prev => {
|
142
|
+
const next = new Set(prev);
|
143
|
+
next.delete(id);
|
144
|
+
return next;
|
145
|
+
});
|
146
|
+
}, []);
|
147
|
+
// Unpin all popovers
|
148
|
+
const unpinAll = ReactHooks.useCallback(() => {
|
149
|
+
setPinnedIds(new Set());
|
150
|
+
}, []);
|
151
|
+
// Cleanup timers on unmount and when dependencies change
|
152
|
+
ReactHooks.useEffect(() => {
|
153
|
+
return () => {
|
154
|
+
if (showTimerRef.current)
|
155
|
+
clearTimeout(showTimerRef.current);
|
156
|
+
if (hideTimerRef.current)
|
157
|
+
clearTimeout(hideTimerRef.current);
|
158
|
+
};
|
159
|
+
}, []);
|
160
|
+
// Clear timers when delay options change to prevent stale timers
|
161
|
+
ReactHooks.useEffect(() => {
|
162
|
+
clearTimers();
|
163
|
+
}, [showDelay, hideDelay, clearTimers]);
|
164
|
+
return {
|
165
|
+
isOpen,
|
166
|
+
isPinned,
|
167
|
+
onHoverStart,
|
168
|
+
onHoverEnd,
|
169
|
+
onTogglePin,
|
170
|
+
onPopoverHover,
|
171
|
+
onPopoverLeave,
|
172
|
+
unpin,
|
173
|
+
unpinAll,
|
174
|
+
};
|
175
|
+
};
|
176
|
+
//# sourceMappingURL=use-popover-state.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"use-popover-state.js","sourceRoot":"","sources":["../../../../../src/template/components/GraphQLInteractive/hooks/use-popover-state.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAA;AA2CtD,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,UAAU,CAAC,QAAQ,CAAgB,IAAI,CAAC,CAAA;IAC1E,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAc,IAAI,GAAG,EAAE,CAAC,CAAA;IAC7E,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,UAAU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CAAC,CAAA;YAC1B,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;YACf,OAAO,IAAI,CAAA;QACb,CAAC,CAAC,CAAA;IACJ,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,qBAAqB;IACrB,MAAM,QAAQ,GAAG,UAAU,CAAC,WAAW,CAAC,GAAG,EAAE;QAC3C,YAAY,CAAC,IAAI,GAAG,EAAE,CAAC,CAAA;IACzB,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,yDAAyD;IACzD,UAAU,CAAC,SAAS,CAAC,GAAG,EAAE;QACxB,OAAO,GAAG,EAAE;YACV,IAAI,YAAY,CAAC,OAAO;gBAAE,YAAY,CAAC,YAAY,CAAC,OAAO,CAAC,CAAA;YAC5D,IAAI,YAAY,CAAC,OAAO;gBAAE,YAAY,CAAC,YAAY,CAAC,OAAO,CAAC,CAAA;QAC9D,CAAC,CAAA;IACH,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,iEAAiE;IACjE,UAAU,CAAC,SAAS,CAAC,GAAG,EAAE;QACxB,WAAW,EAAE,CAAA;IACf,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,CAAA;IAEvC,OAAO;QACL,MAAM;QACN,QAAQ;QACR,YAAY;QACZ,UAAU;QACV,WAAW;QACX,cAAc;QACd,cAAc;QACd,KAAK;QACL,QAAQ;KACT,CAAA;AACH,CAAC,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/template/components/GraphQLInteractive/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/template/components/GraphQLInteractive/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA"}
|
@@ -0,0 +1,52 @@
|
|
1
|
+
/**
|
2
|
+
* Tree-sitter GraphQL Grammar Node Types
|
3
|
+
*
|
4
|
+
* This file defines all possible node types from the tree-sitter-graphql grammar.
|
5
|
+
* These types are used by the tree-sitter parser when parsing GraphQL documents.
|
6
|
+
*
|
7
|
+
* Source: https://github.com/bkegley/tree-sitter-graphql
|
8
|
+
*
|
9
|
+
* Having these as a TypeScript union type enables:
|
10
|
+
* - Type-safe node.type checking
|
11
|
+
* - IntelliSense/autocomplete in IDEs
|
12
|
+
* - Compile-time verification of node type strings
|
13
|
+
* - Better code maintainability and refactoring
|
14
|
+
*/
|
15
|
+
/**
|
16
|
+
* All possible node types that can be returned by tree-sitter-graphql
|
17
|
+
* when parsing GraphQL documents.
|
18
|
+
*/
|
19
|
+
export type TreeSitterGraphQLNodeType = 'document' | 'definition' | 'executable_definition' | 'type_system_definition' | 'type_system_extension' | 'source_file' | 'operation_definition' | 'selection_set' | 'selection' | 'field' | 'alias' | 'fragment_definition' | 'fragment_spread' | 'inline_fragment' | 'fragment_name' | 'type_condition' | 'arguments' | 'argument' | 'variable' | 'variable_definition' | 'variable_definitions' | 'default_value' | 'type' | 'named_type' | 'list_type' | 'non_null_type' | 'type_definition' | 'scalar_type_definition' | 'object_type_definition' | 'interface_type_definition' | 'union_type_definition' | 'enum_type_definition' | 'input_object_type_definition' | 'type_extension' | 'scalar_type_extension' | 'object_type_extension' | 'interface_type_extension' | 'union_type_extension' | 'enum_type_extension' | 'input_object_type_extension' | 'schema_definition' | 'schema_extension' | 'root_operation_type_definition' | 'fields_definition' | 'field_definition' | 'arguments_definition' | 'input_value_definition' | 'input_fields_definition' | 'directives' | 'directive' | 'directive_definition' | 'directive_locations' | 'directive_location' | 'enum_values_definition' | 'enum_value_definition' | 'enum_value' | 'implements_interfaces' | 'union_member_types' | 'description' | 'value' | 'string_value' | 'int_value' | 'float_value' | 'boolean_value' | 'null_value' | 'list_value' | 'object_value' | 'object_field' | 'name' | 'comment' | 'comma' | '{' | '}' | '(' | ')' | '[' | ']' | ':' | '=' | ',' | '!' | '|' | '&' | '@' | '...' | '$' | 'query' | 'mutation' | 'subscription' | 'fragment' | 'on' | 'type' | 'interface' | 'enum' | 'scalar' | 'union' | 'input' | 'schema' | 'directive' | 'implements' | 'extend' | 'true' | 'false' | 'null' | 'error_hint' | 'whitespace';
|
20
|
+
/**
|
21
|
+
* Subset of node types that are interactive in Polen's GraphQL viewer
|
22
|
+
*/
|
23
|
+
export type InteractiveNodeParentType = 'named_type' | 'field';
|
24
|
+
/**
|
25
|
+
* Subset of node types that are non-interactive user-defined names
|
26
|
+
*/
|
27
|
+
export type NonInteractiveNodeParentType = 'operation_definition' | 'fragment_definition' | 'variable_definition' | 'argument';
|
28
|
+
/**
|
29
|
+
* Node types that represent keywords in GraphQL
|
30
|
+
*/
|
31
|
+
export type KeywordNodeType = 'query' | 'mutation' | 'subscription' | 'fragment' | 'on';
|
32
|
+
/**
|
33
|
+
* Node types that represent literal values
|
34
|
+
*/
|
35
|
+
export type LiteralNodeType = 'string_value' | 'int_value' | 'float_value' | 'boolean_value' | 'null_value' | 'enum_value';
|
36
|
+
/**
|
37
|
+
* Node types that represent punctuation
|
38
|
+
*/
|
39
|
+
export type PunctuationNodeType = '{' | '}' | '(' | ')' | '[' | ']' | ':' | '=' | ',' | '!' | '|' | '&' | '@' | '...' | '$';
|
40
|
+
/**
|
41
|
+
* Helper function to check if a node type is a keyword
|
42
|
+
*/
|
43
|
+
export declare function isKeywordNodeType(type: string): type is KeywordNodeType;
|
44
|
+
/**
|
45
|
+
* Helper function to check if a node type is a literal
|
46
|
+
*/
|
47
|
+
export declare function isLiteralNodeType(type: string): type is LiteralNodeType;
|
48
|
+
/**
|
49
|
+
* Helper function to check if a node type is punctuation
|
50
|
+
*/
|
51
|
+
export declare function isPunctuationNodeType(type: string): type is PunctuationNodeType;
|
52
|
+
//# sourceMappingURL=graphql-node-types.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"graphql-node-types.d.ts","sourceRoot":"","sources":["../../../../../src/template/components/GraphQLInteractive/lib/graphql-node-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;GAGG;AACH,MAAM,MAAM,yBAAyB,GAEjC,UAAU,GACV,YAAY,GACZ,uBAAuB,GACvB,wBAAwB,GACxB,uBAAuB,GACvB,aAAa,GAEb,sBAAsB,GACtB,eAAe,GACf,WAAW,GACX,OAAO,GACP,OAAO,GAEP,qBAAqB,GACrB,iBAAiB,GACjB,iBAAiB,GACjB,eAAe,GACf,gBAAgB,GAEhB,WAAW,GACX,UAAU,GACV,UAAU,GACV,qBAAqB,GACrB,sBAAsB,GACtB,eAAe,GAEf,MAAM,GACN,YAAY,GACZ,WAAW,GACX,eAAe,GAEf,iBAAiB,GACjB,wBAAwB,GACxB,wBAAwB,GACxB,2BAA2B,GAC3B,uBAAuB,GACvB,sBAAsB,GACtB,8BAA8B,GAE9B,gBAAgB,GAChB,uBAAuB,GACvB,uBAAuB,GACvB,0BAA0B,GAC1B,sBAAsB,GACtB,qBAAqB,GACrB,6BAA6B,GAE7B,mBAAmB,GACnB,kBAAkB,GAClB,gCAAgC,GAEhC,mBAAmB,GACnB,kBAAkB,GAClB,sBAAsB,GACtB,wBAAwB,GACxB,yBAAyB,GAEzB,YAAY,GACZ,WAAW,GACX,sBAAsB,GACtB,qBAAqB,GACrB,oBAAoB,GAEpB,wBAAwB,GACxB,uBAAuB,GACvB,YAAY,GAEZ,uBAAuB,GACvB,oBAAoB,GACpB,aAAa,GAEb,OAAO,GACP,cAAc,GACd,WAAW,GACX,aAAa,GACb,eAAe,GACf,YAAY,GACZ,YAAY,GACZ,cAAc,GACd,cAAc,GAEd,MAAM,GACN,SAAS,GACT,OAAO,GAEP,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,G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from the tree-sitter-graphql grammar.
|
5
|
+
* These types are used by the tree-sitter parser when parsing GraphQL documents.
|
6
|
+
*
|
7
|
+
* Source: https://github.com/bkegley/tree-sitter-graphql
|
8
|
+
*
|
9
|
+
* Having these as a TypeScript union type enables:
|
10
|
+
* - Type-safe node.type checking
|
11
|
+
* - IntelliSense/autocomplete in IDEs
|
12
|
+
* - Compile-time verification of node type strings
|
13
|
+
* - Better code maintainability and refactoring
|
14
|
+
*/
|
15
|
+
/**
|
16
|
+
* Helper function to check if a node type is a keyword
|
17
|
+
*/
|
18
|
+
export function isKeywordNodeType(type) {
|
19
|
+
return type === 'query' || type === 'mutation' || type === 'subscription' || type === 'fragment' || type === 'on';
|
20
|
+
}
|
21
|
+
/**
|
22
|
+
* Helper function to check if a node type is a literal
|
23
|
+
*/
|
24
|
+
export function isLiteralNodeType(type) {
|
25
|
+
return type === 'string_value' || type === 'int_value' || type === 'float_value'
|
26
|
+
|| type === 'boolean_value' || type === 'null_value' || type === 'enum_value';
|
27
|
+
}
|
28
|
+
/**
|
29
|
+
* Helper function to check if a node type is punctuation
|
30
|
+
*/
|
31
|
+
export function isPunctuationNodeType(type) {
|
32
|
+
return ['{', '}', '(', ')', '[', ']', ':', '=', ',', '!', '|', '&', '@', '...', '$'].includes(type);
|
33
|
+
}
|
34
|
+
//# sourceMappingURL=graphql-node-types.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"graphql-node-types.js","sourceRoot":"","sources":["../../../../../src/template/components/GraphQLInteractive/lib/graphql-node-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAuLH;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,OAAO,IAAI,KAAK,OAAO,IAAI,IAAI,KAAK,UAAU,IAAI,IAAI,KAAK,cAAc,IAAI,IAAI,KAAK,UAAU,IAAI,IAAI,KAAK,IAAI,CAAA;AACnH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,OAAO,IAAI,KAAK,cAAc,IAAI,IAAI,KAAK,WAAW,IAAI,IAAI,KAAK,aAAa;WAC3E,IAAI,KAAK,eAAe,IAAI,IAAI,KAAK,YAAY,IAAI,IAAI,KAAK,YAAY,CAAA;AACjF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAAY;IAChD,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;AACrG,CAAC"}
|