stepzen-graphiql 1.0.4

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 (101) hide show
  1. package/README.md +85 -0
  2. package/dist/GraphiQLExplorer.d.ts +10 -0
  3. package/dist/Range-CPFFy5pj.mjs +26 -0
  4. package/dist/Range-CUfOrqgY.js +1 -0
  5. package/dist/SchemaReference-94TE3IPs.mjs +146 -0
  6. package/dist/SchemaReference-DKgkDdcV.js +1 -0
  7. package/dist/brace-fold-9JQ5QTIN.mjs +122 -0
  8. package/dist/brace-fold-CUTcWTRf.js +1 -0
  9. package/dist/closebrackets-BL_z-rKi.mjs +165 -0
  10. package/dist/closebrackets-DHbhKDzk.js +2 -0
  11. package/dist/codemirror-CxfyhJc1.mjs +27 -0
  12. package/dist/codemirror-DMBo1i5w.js +24 -0
  13. package/dist/codemirror-DgPcZxSc.mjs +6121 -0
  14. package/dist/codemirror-Kv5dN_jU.js +1 -0
  15. package/dist/comment-CAsllqoy.js +2 -0
  16. package/dist/comment-DscvXuhU.mjs +150 -0
  17. package/dist/components/ExplorerPage/ExplorerHeader.d.ts +3 -0
  18. package/dist/components/ExplorerPage/ExplorerPage.d.ts +8 -0
  19. package/dist/components/ExplorerPage/GraphiQLInterface.d.ts +60 -0
  20. package/dist/components/ExplorerPage/Snippets.d.ts +17 -0
  21. package/dist/components/ExplorerPage/clearTooltip.d.ts +1 -0
  22. package/dist/components/exporterPlugin/CodeExporter.d.ts +93 -0
  23. package/dist/components/exporterPlugin/index.d.ts +7 -0
  24. package/dist/components/exporterPlugin/snippets/__helpers__/getOptionCombinations.d.ts +2 -0
  25. package/dist/components/exporterPlugin/snippets/index.d.ts +2 -0
  26. package/dist/components/exporterPlugin/snippets/javascript/fetch.d.ts +3 -0
  27. package/dist/components/exporterPlugin/snippets/javascript/reactApollo.d.ts +3 -0
  28. package/dist/components/exporterPlugin/toposort.d.ts +2 -0
  29. package/dist/components/exporterPlugin/useExporterPlugin.d.ts +19 -0
  30. package/dist/components/exporterPlugin/utils/capitalizeFirstLetter.d.ts +1 -0
  31. package/dist/components/exporterPlugin/utils/index.d.ts +7 -0
  32. package/dist/components/exporterPlugin/utils/jsCommentsFactory.d.ts +1 -0
  33. package/dist/contexts/EnvironmentContext.d.ts +37 -0
  34. package/dist/contexts/endpoint.d.ts +39 -0
  35. package/dist/dialog-BF69fCJO.js +1 -0
  36. package/dist/dialog-Ci1bnuc2.mjs +74 -0
  37. package/dist/dialog-Dh2DOTOu.js +1 -0
  38. package/dist/dialog-nXZjpybF.mjs +26 -0
  39. package/dist/foldgutter-DiGsqcNo.mjs +238 -0
  40. package/dist/foldgutter-Do6XNu8o.js +1 -0
  41. package/dist/forEachState-DA54msa8.mjs +11 -0
  42. package/dist/forEachState-DY_pA9Bd.js +1 -0
  43. package/dist/hint-BNpE1H1l.js +1 -0
  44. package/dist/hint-BQ9WwQj_.mjs +123 -0
  45. package/dist/hint-dA98kXsJ.js +1 -0
  46. package/dist/hint-ptEpgPx0.mjs +24 -0
  47. package/dist/index-BeOZF5ut.js +650 -0
  48. package/dist/index-GG9J9CZE.js +1 -0
  49. package/dist/index-Iqk59VQ1.mjs +89463 -0
  50. package/dist/index-_X52-Rov.mjs +11 -0
  51. package/dist/index.cjs.js +1 -0
  52. package/dist/index.d.ts +3 -0
  53. package/dist/index.es.js +4 -0
  54. package/dist/info-BhA0aX7P.js +1 -0
  55. package/dist/info-DavOVk27.mjs +99 -0
  56. package/dist/info-addon-BppfpWGs.js +1 -0
  57. package/dist/info-addon-jclzOzZb.mjs +66 -0
  58. package/dist/javascript-Bk78gZXV.js +1 -0
  59. package/dist/javascript-HLYdFIhF.mjs +26 -0
  60. package/dist/javascript-RO_jaPiE.mjs +707 -0
  61. package/dist/javascript-poxRzxcy.js +1 -0
  62. package/dist/jsx-C8WdRUVV.mjs +414 -0
  63. package/dist/jsx-LzpFIybc.js +1 -0
  64. package/dist/jump-BR4c9I5u.mjs +85 -0
  65. package/dist/jump-C3iGjDkY.js +1 -0
  66. package/dist/jump-to-line-BZOuAkwy.js +1 -0
  67. package/dist/jump-to-line-pXiAP2DT.mjs +61 -0
  68. package/dist/lib/constants.d.ts +6 -0
  69. package/dist/lib/graphiql-helpers.d.ts +86 -0
  70. package/dist/lib/helpers.d.ts +53 -0
  71. package/dist/lint-Aw1wLmnw.mjs +112 -0
  72. package/dist/lint-Bf0wS1Ab.js +1 -0
  73. package/dist/lint-DL7I1P7I.mjs +272 -0
  74. package/dist/lint-GZ9x3Nii.js +6 -0
  75. package/dist/lint-L3DNAS-R.mjs +216 -0
  76. package/dist/lint-azLq6zoS.js +1 -0
  77. package/dist/matchbrackets-BB4g2Y6d.mjs +87 -0
  78. package/dist/matchbrackets-DJZ2jVlm.js +1 -0
  79. package/dist/matchbrackets-DNVziiaa.mjs +26 -0
  80. package/dist/matchbrackets-DPv_MB7c.js +1 -0
  81. package/dist/mode-Bad_JbYc.js +1 -0
  82. package/dist/mode-BuM4vqHx.js +1 -0
  83. package/dist/mode-C9FNlffS.js +1 -0
  84. package/dist/mode-CtmJdiWw.mjs +73 -0
  85. package/dist/mode-CxFmwOoU.mjs +25 -0
  86. package/dist/mode-DQHzanY6.mjs +64 -0
  87. package/dist/mode-indent-9VnFlqY-.mjs +8 -0
  88. package/dist/mode-indent-m3TP74Ia.js +1 -0
  89. package/dist/search-BUZtJ7Zg.mjs +268 -0
  90. package/dist/search-DxgAMk6j.js +2 -0
  91. package/dist/searchcursor-BrHSjZde.mjs +26 -0
  92. package/dist/searchcursor-Cf1_qqgl.js +1 -0
  93. package/dist/searchcursor-DHtNMOPb.mjs +239 -0
  94. package/dist/searchcursor-eGwb3e2h.js +7 -0
  95. package/dist/show-hint-CYURLLrO.js +1 -0
  96. package/dist/show-hint-CmHZP7k_.mjs +357 -0
  97. package/dist/style.css +9 -0
  98. package/dist/sublime-BKhMEkpg.js +6 -0
  99. package/dist/sublime-Dmy11GSm.mjs +563 -0
  100. package/dist/types/config.d.ts +7 -0
  101. package/package.json +111 -0
package/README.md ADDED
@@ -0,0 +1,85 @@
1
+ # stepzen-graphiql
2
+
3
+ [![NPM](https://img.shields.io/npm/v/stepzen-graphiql.svg)](https://www.npmjs.com/package/stepzen-graphiql) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install --save stepzen-graphiql
9
+ ```
10
+
11
+ ## Basic Usage
12
+
13
+ ```tsx
14
+ import { GraphiQLExplorer } from "stepzen-graphiql";
15
+ import "stepzen-graphiql/style.css";
16
+
17
+ function App() {
18
+ const config: GraphiQLConfig = {
19
+ endpoint: "https://your-graphql-endpoint.com/graphql",
20
+ };
21
+
22
+ return <GraphiQLExplorer config={config} />;
23
+ }
24
+ ```
25
+
26
+ ## Advanced Usage
27
+
28
+ You can use the GraphiQLExplorer component directly to customize behavior and layout, including:
29
+
30
+ Providing a custom GraphQL endpoint via config
31
+
32
+ Injecting custom header/footer components
33
+
34
+ Showing/hiding the explorer's URL tab
35
+
36
+ ```tsx
37
+ import { GraphiQLExplorer, GraphiQLConfig } from "stepzen-graphiql";
38
+ import "stepzen-graphiql/style.css";
39
+
40
+ function App() {
41
+ const MyCustomHeader = () => <div>My Custom header</div>;
42
+
43
+ const MyCustomFooter = () => <div>My Custom footer</div>;
44
+
45
+ const config: GraphiQLConfig = {
46
+ endpoint: "https://your-graphql-endpoint.com/graphql",
47
+ showExplorerHeader: true, // Enables the explorer's URL input tab with toggle
48
+ };
49
+
50
+ function fetchCostData(query: string) {
51
+ console.log("Fetching cost data: " + query);
52
+ }
53
+
54
+ function queryCompleted(result: string) {
55
+ console.log("Fetched data: " + result);
56
+ }
57
+
58
+ return (
59
+ <GraphiQLExplorer
60
+ config={config}
61
+ onEditQuery={fetchCostData}
62
+ onFetchResult={queryCompleted}
63
+ >
64
+ {/* Optional: You can add a custom header or footer if needed */}
65
+ <GraphiQLExplorer.Header>
66
+ <MyCustomHeader />
67
+ </GraphiQLExplorer.Header>
68
+ <GraphiQLExplorer.Footer>
69
+ <MyCustomFooter />
70
+ </GraphiQLExplorer.Footer>
71
+ </GraphiQLExplorer>
72
+ );
73
+ }
74
+
75
+ export default App;
76
+ ```
77
+
78
+ ## Configuration
79
+
80
+ | Prop | Type | Description |
81
+ | -------------------- | ---------- | -------------------------------------------------------------- |
82
+ | `endpoint` | `string` | GraphQL endpoint to be used in the explorer |
83
+ | `showExplorerHeader` | `boolean` | Toggles visibility of the URL tab with hide/show functionality |
84
+ | `onEditQuery` | `function` | Callback triggered when the query is edited |
85
+ | `onFetchResult` | `function` | Callback triggered when the query result is fetched |
@@ -0,0 +1,10 @@
1
+ import { default as React } from 'react';
2
+ import { GraphiQLConfig } from './types/config';
3
+ interface GraphiQLExplorerProps {
4
+ config: GraphiQLConfig;
5
+ onEditQuery?: (query: string) => void;
6
+ onFetchResult?: (result: string) => void;
7
+ children?: React.ReactNode;
8
+ }
9
+ export declare const GraphiQLExplorer: React.FC<GraphiQLExplorerProps>;
10
+ export default GraphiQLExplorer;
@@ -0,0 +1,26 @@
1
+ class h {
2
+ constructor(t, r) {
3
+ this.containsPosition = (e) => this.start.line === e.line ? this.start.character <= e.character : this.end.line === e.line ? this.end.character >= e.character : this.start.line <= e.line && this.end.line >= e.line, this.start = t, this.end = r;
4
+ }
5
+ setStart(t, r) {
6
+ this.start = new s(t, r);
7
+ }
8
+ setEnd(t, r) {
9
+ this.end = new s(t, r);
10
+ }
11
+ }
12
+ class s {
13
+ constructor(t, r) {
14
+ this.lessThanOrEqualTo = (e) => this.line < e.line || this.line === e.line && this.character <= e.character, this.line = t, this.character = r;
15
+ }
16
+ setLine(t) {
17
+ this.line = t;
18
+ }
19
+ setCharacter(t) {
20
+ this.character = t;
21
+ }
22
+ }
23
+ export {
24
+ s as P,
25
+ h as R
26
+ };
@@ -0,0 +1 @@
1
+ "use strict";class i{constructor(t,r){this.containsPosition=e=>this.start.line===e.line?this.start.character<=e.character:this.end.line===e.line?this.end.character>=e.character:this.start.line<=e.line&&this.end.line>=e.line,this.start=t,this.end=r}setStart(t,r){this.start=new s(t,r)}setEnd(t,r){this.end=new s(t,r)}}class s{constructor(t,r){this.lessThanOrEqualTo=e=>this.line<e.line||this.line===e.line&&this.character<=e.character,this.line=t,this.character=r}setLine(t){this.line=t}setCharacter(t){this.character=t}}exports.Position=s;exports.Range=i;
@@ -0,0 +1,146 @@
1
+ import { f as o } from "./forEachState-DA54msa8.mjs";
2
+ import { h as t, i as b, j as v, d as k, k as F, S as g, m as y, n as D, q as S } from "./index-Iqk59VQ1.mjs";
3
+ function V(n, l) {
4
+ const e = {
5
+ schema: n,
6
+ type: null,
7
+ parentType: null,
8
+ inputType: null,
9
+ directiveDef: null,
10
+ fieldDef: null,
11
+ argDef: null,
12
+ argDefs: null,
13
+ objectFieldDefs: null
14
+ };
15
+ return o(l, (i) => {
16
+ var u, p;
17
+ switch (i.kind) {
18
+ case "Query":
19
+ case "ShortQuery":
20
+ e.type = n.getQueryType();
21
+ break;
22
+ case "Mutation":
23
+ e.type = n.getMutationType();
24
+ break;
25
+ case "Subscription":
26
+ e.type = n.getSubscriptionType();
27
+ break;
28
+ case "InlineFragment":
29
+ case "FragmentDefinition":
30
+ i.type && (e.type = n.getType(i.type));
31
+ break;
32
+ case "Field":
33
+ case "AliasedField":
34
+ e.fieldDef = e.type && i.name ? m(n, e.parentType, i.name) : null, e.type = (u = e.fieldDef) === null || u === void 0 ? void 0 : u.type;
35
+ break;
36
+ case "SelectionSet":
37
+ e.parentType = e.type ? t(e.type) : null;
38
+ break;
39
+ case "Directive":
40
+ e.directiveDef = i.name ? n.getDirective(i.name) : null;
41
+ break;
42
+ case "Arguments":
43
+ const c = i.prevState ? i.prevState.kind === "Field" ? e.fieldDef : i.prevState.kind === "Directive" ? e.directiveDef : i.prevState.kind === "AliasedField" ? i.prevState.name && m(n, e.parentType, i.prevState.name) : null : null;
44
+ e.argDefs = c ? c.args : null;
45
+ break;
46
+ case "Argument":
47
+ if (e.argDef = null, e.argDefs) {
48
+ for (let r = 0; r < e.argDefs.length; r++)
49
+ if (e.argDefs[r].name === i.name) {
50
+ e.argDef = e.argDefs[r];
51
+ break;
52
+ }
53
+ }
54
+ e.inputType = (p = e.argDef) === null || p === void 0 ? void 0 : p.type;
55
+ break;
56
+ case "EnumValue":
57
+ const f = e.inputType ? t(e.inputType) : null;
58
+ e.enumValue = f instanceof F ? h(f.getValues(), (r) => r.value === i.name) : null;
59
+ break;
60
+ case "ListValue":
61
+ const d = e.inputType ? v(e.inputType) : null;
62
+ e.inputType = d instanceof k ? d.ofType : null;
63
+ break;
64
+ case "ObjectValue":
65
+ const s = e.inputType ? t(e.inputType) : null;
66
+ e.objectFieldDefs = s instanceof b ? s.getFields() : null;
67
+ break;
68
+ case "ObjectField":
69
+ const a = i.name && e.objectFieldDefs ? e.objectFieldDefs[i.name] : null;
70
+ e.inputType = a == null ? void 0 : a.type, e.fieldDef = a;
71
+ break;
72
+ case "NamedType":
73
+ e.type = i.name ? n.getType(i.name) : null;
74
+ break;
75
+ }
76
+ }), e;
77
+ }
78
+ function m(n, l, e) {
79
+ if (e === g.name && n.getQueryType() === l)
80
+ return g;
81
+ if (e === y.name && n.getQueryType() === l)
82
+ return y;
83
+ if (e === D.name && S(l))
84
+ return D;
85
+ if (l && l.getFields)
86
+ return l.getFields()[e];
87
+ }
88
+ function h(n, l) {
89
+ for (let e = 0; e < n.length; e++)
90
+ if (l(n[e]))
91
+ return n[e];
92
+ }
93
+ function A(n) {
94
+ return {
95
+ kind: "Field",
96
+ schema: n.schema,
97
+ field: n.fieldDef,
98
+ type: T(n.fieldDef) ? null : n.parentType
99
+ };
100
+ }
101
+ function M(n) {
102
+ return {
103
+ kind: "Directive",
104
+ schema: n.schema,
105
+ directive: n.directiveDef
106
+ };
107
+ }
108
+ function E(n) {
109
+ return n.directiveDef ? {
110
+ kind: "Argument",
111
+ schema: n.schema,
112
+ argument: n.argDef,
113
+ directive: n.directiveDef
114
+ } : {
115
+ kind: "Argument",
116
+ schema: n.schema,
117
+ argument: n.argDef,
118
+ field: n.fieldDef,
119
+ type: T(n.fieldDef) ? null : n.parentType
120
+ };
121
+ }
122
+ function L(n) {
123
+ return {
124
+ kind: "EnumValue",
125
+ value: n.enumValue || void 0,
126
+ type: n.inputType ? t(n.inputType) : void 0
127
+ };
128
+ }
129
+ function R(n, l) {
130
+ return {
131
+ kind: "Type",
132
+ schema: n.schema,
133
+ type: l || n.type
134
+ };
135
+ }
136
+ function T(n) {
137
+ return n.name.slice(0, 2) === "__";
138
+ }
139
+ export {
140
+ A as a,
141
+ E as b,
142
+ L as c,
143
+ R as d,
144
+ M as e,
145
+ V as g
146
+ };
@@ -0,0 +1 @@
1
+ "use strict";const D=require("./forEachState-DY_pA9Bd.js"),t=require("./index-BeOZF5ut.js");function m(n,r){const e={schema:n,type:null,parentType:null,inputType:null,directiveDef:null,fieldDef:null,argDef:null,argDefs:null,objectFieldDefs:null};return D.forEachState(r,i=>{var a,c;switch(i.kind){case"Query":case"ShortQuery":e.type=n.getQueryType();break;case"Mutation":e.type=n.getMutationType();break;case"Subscription":e.type=n.getSubscriptionType();break;case"InlineFragment":case"FragmentDefinition":i.type&&(e.type=n.getType(i.type));break;case"Field":case"AliasedField":e.fieldDef=e.type&&i.name?y(n,e.parentType,i.name):null,e.type=(a=e.fieldDef)===null||a===void 0?void 0:a.type;break;case"SelectionSet":e.parentType=e.type?t.getNamedType(e.type):null;break;case"Directive":e.directiveDef=i.name?n.getDirective(i.name):null;break;case"Arguments":const p=i.prevState?i.prevState.kind==="Field"?e.fieldDef:i.prevState.kind==="Directive"?e.directiveDef:i.prevState.kind==="AliasedField"?i.prevState.name&&y(n,e.parentType,i.prevState.name):null:null;e.argDefs=p?p.args:null;break;case"Argument":if(e.argDef=null,e.argDefs){for(let l=0;l<e.argDefs.length;l++)if(e.argDefs[l].name===i.name){e.argDef=e.argDefs[l];break}}e.inputType=(c=e.argDef)===null||c===void 0?void 0:c.type;break;case"EnumValue":const f=e.inputType?t.getNamedType(e.inputType):null;e.enumValue=f instanceof t.GraphQLEnumType?s(f.getValues(),l=>l.value===i.name):null;break;case"ListValue":const d=e.inputType?t.getNullableType(e.inputType):null;e.inputType=d instanceof t.GraphQLList?d.ofType:null;break;case"ObjectValue":const g=e.inputType?t.getNamedType(e.inputType):null;e.objectFieldDefs=g instanceof t.GraphQLInputObjectType?g.getFields():null;break;case"ObjectField":const u=i.name&&e.objectFieldDefs?e.objectFieldDefs[i.name]:null;e.inputType=u==null?void 0:u.type,e.fieldDef=u;break;case"NamedType":e.type=i.name?n.getType(i.name):null;break}}),e}function y(n,r,e){if(e===t.SchemaMetaFieldDef.name&&n.getQueryType()===r)return t.SchemaMetaFieldDef;if(e===t.TypeMetaFieldDef.name&&n.getQueryType()===r)return t.TypeMetaFieldDef;if(e===t.TypeNameMetaFieldDef.name&&t.isCompositeType(r))return t.TypeNameMetaFieldDef;if(r&&r.getFields)return r.getFields()[e]}function s(n,r){for(let e=0;e<n.length;e++)if(r(n[e]))return n[e]}function o(n){return{kind:"Field",schema:n.schema,field:n.fieldDef,type:T(n.fieldDef)?null:n.parentType}}function b(n){return{kind:"Directive",schema:n.schema,directive:n.directiveDef}}function v(n){return n.directiveDef?{kind:"Argument",schema:n.schema,argument:n.argDef,directive:n.directiveDef}:{kind:"Argument",schema:n.schema,argument:n.argDef,field:n.fieldDef,type:T(n.fieldDef)?null:n.parentType}}function F(n){return{kind:"EnumValue",value:n.enumValue||void 0,type:n.inputType?t.getNamedType(n.inputType):void 0}}function k(n,r){return{kind:"Type",schema:n.schema,type:r||n.type}}function T(n){return n.name.slice(0,2)==="__"}exports.getArgumentReference=v;exports.getDirectiveReference=b;exports.getEnumValueReference=F;exports.getFieldReference=o;exports.getTypeInfo=m;exports.getTypeReference=k;
@@ -0,0 +1,122 @@
1
+ import { g as H } from "./index-Iqk59VQ1.mjs";
2
+ import { r as S } from "./codemirror-DgPcZxSc.mjs";
3
+ function q(T, A) {
4
+ for (var e = 0; e < A.length; e++) {
5
+ const c = A[e];
6
+ if (typeof c != "string" && !Array.isArray(c)) {
7
+ for (const t in c)
8
+ if (t !== "default" && !(t in T)) {
9
+ const a = Object.getOwnPropertyDescriptor(c, t);
10
+ a && Object.defineProperty(T, t, a.get ? a : {
11
+ enumerable: !0,
12
+ get: () => c[t]
13
+ });
14
+ }
15
+ }
16
+ }
17
+ return Object.freeze(Object.defineProperty(T, Symbol.toStringTag, { value: "Module" }));
18
+ }
19
+ var m = { exports: {} }, j;
20
+ function I() {
21
+ return j || (j = 1, function(T, A) {
22
+ (function(e) {
23
+ e(S());
24
+ })(function(e) {
25
+ function c(t) {
26
+ return function(a, f) {
27
+ var n = f.line, o = a.getLine(n);
28
+ function v(l) {
29
+ for (var u, g = f.ch, h = 0; ; ) {
30
+ var p = g <= 0 ? -1 : o.lastIndexOf(l[0], g - 1);
31
+ if (p == -1) {
32
+ if (h == 1) break;
33
+ h = 1, g = o.length;
34
+ continue;
35
+ }
36
+ if (h == 1 && p < f.ch) break;
37
+ if (u = a.getTokenTypeAt(e.Pos(n, p + 1)), !/^(comment|string)/.test(u)) return { ch: p + 1, tokenType: u, pair: l };
38
+ g = p - 1;
39
+ }
40
+ }
41
+ function k(l) {
42
+ var u = 1, g = a.lastLine(), h, p = l.ch, O;
43
+ e: for (var y = n; y <= g; ++y)
44
+ for (var d = a.getLine(y), b = y == n ? p : 0; ; ) {
45
+ var L = d.indexOf(l.pair[0], b), F = d.indexOf(l.pair[1], b);
46
+ if (L < 0 && (L = d.length), F < 0 && (F = d.length), b = Math.min(L, F), b == d.length) break;
47
+ if (a.getTokenTypeAt(e.Pos(y, b + 1)) == l.tokenType) {
48
+ if (b == L) ++u;
49
+ else if (!--u) {
50
+ h = y, O = b;
51
+ break e;
52
+ }
53
+ }
54
+ ++b;
55
+ }
56
+ return h == null || n == h ? null : {
57
+ from: e.Pos(n, p),
58
+ to: e.Pos(h, O)
59
+ };
60
+ }
61
+ for (var i = [], r = 0; r < t.length; r++) {
62
+ var s = v(t[r]);
63
+ s && i.push(s);
64
+ }
65
+ i.sort(function(l, u) {
66
+ return l.ch - u.ch;
67
+ });
68
+ for (var r = 0; r < i.length; r++) {
69
+ var P = k(i[r]);
70
+ if (P) return P;
71
+ }
72
+ return null;
73
+ };
74
+ }
75
+ e.registerHelper("fold", "brace", c([["{", "}"], ["[", "]"]])), e.registerHelper("fold", "brace-paren", c([["{", "}"], ["[", "]"], ["(", ")"]])), e.registerHelper("fold", "import", function(t, a) {
76
+ function f(r) {
77
+ if (r < t.firstLine() || r > t.lastLine()) return null;
78
+ var s = t.getTokenAt(e.Pos(r, 1));
79
+ if (/\S/.test(s.string) || (s = t.getTokenAt(e.Pos(r, s.end + 1))), s.type != "keyword" || s.string != "import") return null;
80
+ for (var P = r, l = Math.min(t.lastLine(), r + 10); P <= l; ++P) {
81
+ var u = t.getLine(P), g = u.indexOf(";");
82
+ if (g != -1) return { startCh: s.end, end: e.Pos(P, g) };
83
+ }
84
+ }
85
+ var n = a.line, o = f(n), v;
86
+ if (!o || f(n - 1) || (v = f(n - 2)) && v.end.line == n - 1)
87
+ return null;
88
+ for (var k = o.end; ; ) {
89
+ var i = f(k.line + 1);
90
+ if (i == null) break;
91
+ k = i.end;
92
+ }
93
+ return { from: t.clipPos(e.Pos(n, o.startCh + 1)), to: k };
94
+ }), e.registerHelper("fold", "include", function(t, a) {
95
+ function f(i) {
96
+ if (i < t.firstLine() || i > t.lastLine()) return null;
97
+ var r = t.getTokenAt(e.Pos(i, 1));
98
+ if (/\S/.test(r.string) || (r = t.getTokenAt(e.Pos(i, r.end + 1))), r.type == "meta" && r.string.slice(0, 8) == "#include") return r.start + 8;
99
+ }
100
+ var n = a.line, o = f(n);
101
+ if (o == null || f(n - 1) != null) return null;
102
+ for (var v = n; ; ) {
103
+ var k = f(v + 1);
104
+ if (k == null) break;
105
+ ++v;
106
+ }
107
+ return {
108
+ from: e.Pos(n, o + 1),
109
+ to: t.clipPos(e.Pos(v))
110
+ };
111
+ });
112
+ });
113
+ }()), m.exports;
114
+ }
115
+ var _ = I();
116
+ const w = /* @__PURE__ */ H(_), D = /* @__PURE__ */ q({
117
+ __proto__: null,
118
+ default: w
119
+ }, [_]);
120
+ export {
121
+ D as b
122
+ };
@@ -0,0 +1 @@
1
+ "use strict";const H=require("./index-BeOZF5ut.js"),S=require("./codemirror-DMBo1i5w.js");function m(T,F){for(var e=0;e<F.length;e++){const g=F[e];if(typeof g!="string"&&!Array.isArray(g)){for(const t in g)if(t!=="default"&&!(t in T)){const i=Object.getOwnPropertyDescriptor(g,t);i&&Object.defineProperty(T,t,i.get?i:{enumerable:!0,get:()=>g[t]})}}}return Object.freeze(Object.defineProperty(T,Symbol.toStringTag,{value:"Module"}))}var j={exports:{}},q;function I(){return q||(q=1,function(T,F){(function(e){e(S.requireCodemirror())})(function(e){function g(t){return function(i,a){var n=a.line,o=i.getLine(n);function v(l){for(var u,c=a.ch,h=0;;){var p=c<=0?-1:o.lastIndexOf(l[0],c-1);if(p==-1){if(h==1)break;h=1,c=o.length;continue}if(h==1&&p<a.ch)break;if(u=i.getTokenTypeAt(e.Pos(n,p+1)),!/^(comment|string)/.test(u))return{ch:p+1,tokenType:u,pair:l};c=p-1}}function k(l){var u=1,c=i.lastLine(),h,p=l.ch,O;e:for(var P=n;P<=c;++P)for(var y=i.getLine(P),b=P==n?p:0;;){var L=y.indexOf(l.pair[0],b),A=y.indexOf(l.pair[1],b);if(L<0&&(L=y.length),A<0&&(A=y.length),b=Math.min(L,A),b==y.length)break;if(i.getTokenTypeAt(e.Pos(P,b+1))==l.tokenType){if(b==L)++u;else if(!--u){h=P,O=b;break e}}++b}return h==null||n==h?null:{from:e.Pos(n,p),to:e.Pos(h,O)}}for(var f=[],r=0;r<t.length;r++){var s=v(t[r]);s&&f.push(s)}f.sort(function(l,u){return l.ch-u.ch});for(var r=0;r<f.length;r++){var d=k(f[r]);if(d)return d}return null}}e.registerHelper("fold","brace",g([["{","}"],["[","]"]])),e.registerHelper("fold","brace-paren",g([["{","}"],["[","]"],["(",")"]])),e.registerHelper("fold","import",function(t,i){function a(r){if(r<t.firstLine()||r>t.lastLine())return null;var s=t.getTokenAt(e.Pos(r,1));if(/\S/.test(s.string)||(s=t.getTokenAt(e.Pos(r,s.end+1))),s.type!="keyword"||s.string!="import")return null;for(var d=r,l=Math.min(t.lastLine(),r+10);d<=l;++d){var u=t.getLine(d),c=u.indexOf(";");if(c!=-1)return{startCh:s.end,end:e.Pos(d,c)}}}var n=i.line,o=a(n),v;if(!o||a(n-1)||(v=a(n-2))&&v.end.line==n-1)return null;for(var k=o.end;;){var f=a(k.line+1);if(f==null)break;k=f.end}return{from:t.clipPos(e.Pos(n,o.startCh+1)),to:k}}),e.registerHelper("fold","include",function(t,i){function a(f){if(f<t.firstLine()||f>t.lastLine())return null;var r=t.getTokenAt(e.Pos(f,1));if(/\S/.test(r.string)||(r=t.getTokenAt(e.Pos(f,r.end+1))),r.type=="meta"&&r.string.slice(0,8)=="#include")return r.start+8}var n=i.line,o=a(n);if(o==null||a(n-1)!=null)return null;for(var v=n;;){var k=a(v+1);if(k==null)break;++v}return{from:e.Pos(n,o+1),to:t.clipPos(e.Pos(v))}})})}()),j.exports}var _=I();const w=H.getDefaultExportFromCjs(_),x=m({__proto__:null,default:w},[_]);exports.braceFold=x;
@@ -0,0 +1,165 @@
1
+ import { g as G } from "./index-Iqk59VQ1.mjs";
2
+ import { r as H } from "./codemirror-DgPcZxSc.mjs";
3
+ function J(O, A) {
4
+ for (var a = 0; a < A.length; a++) {
5
+ const d = A[a];
6
+ if (typeof d != "string" && !Array.isArray(d)) {
7
+ for (const i in d)
8
+ if (i !== "default" && !(i in O)) {
9
+ const g = Object.getOwnPropertyDescriptor(d, i);
10
+ g && Object.defineProperty(O, i, g.get ? g : {
11
+ enumerable: !0,
12
+ get: () => d[i]
13
+ });
14
+ }
15
+ }
16
+ }
17
+ return Object.freeze(Object.defineProperty(O, Symbol.toStringTag, { value: "Module" }));
18
+ }
19
+ var q = { exports: {} }, F;
20
+ function Q() {
21
+ return F || (F = 1, function(O, A) {
22
+ (function(a) {
23
+ a(H());
24
+ })(function(a) {
25
+ var d = {
26
+ pairs: `()[]{}''""`,
27
+ closeBefore: `)]}'":;>`,
28
+ triples: "",
29
+ explode: "[]{}"
30
+ }, i = a.Pos;
31
+ a.defineOption("autoCloseBrackets", !1, function(e, t, n) {
32
+ n && n != a.Init && (e.removeKeyMap(x), e.state.closeBrackets = null), t && (E(g(t, "pairs")), e.state.closeBrackets = t, e.addKeyMap(x));
33
+ });
34
+ function g(e, t) {
35
+ return t == "pairs" && typeof e == "string" ? e : typeof e == "object" && e[t] != null ? e[t] : d[t];
36
+ }
37
+ var x = { Backspace: L, Enter: W };
38
+ function E(e) {
39
+ for (var t = 0; t < e.length; t++) {
40
+ var n = e.charAt(t), s = "'" + n + "'";
41
+ x[s] || (x[s] = K(n));
42
+ }
43
+ }
44
+ E(d.pairs + "`");
45
+ function K(e) {
46
+ return function(t) {
47
+ return z(t, e);
48
+ };
49
+ }
50
+ function y(e) {
51
+ var t = e.state.closeBrackets;
52
+ if (!t || t.override) return t;
53
+ var n = e.getModeAt(e.getCursor());
54
+ return n.closeBrackets || t;
55
+ }
56
+ function L(e) {
57
+ var t = y(e);
58
+ if (!t || e.getOption("disableInput")) return a.Pass;
59
+ for (var n = g(t, "pairs"), s = e.listSelections(), r = 0; r < s.length; r++) {
60
+ if (!s[r].empty()) return a.Pass;
61
+ var f = _(e, s[r].head);
62
+ if (!f || n.indexOf(f) % 2 != 0) return a.Pass;
63
+ }
64
+ for (var r = s.length - 1; r >= 0; r--) {
65
+ var o = s[r].head;
66
+ e.replaceRange("", i(o.line, o.ch - 1), i(o.line, o.ch + 1), "+delete");
67
+ }
68
+ }
69
+ function W(e) {
70
+ var t = y(e), n = t && g(t, "explode");
71
+ if (!n || e.getOption("disableInput")) return a.Pass;
72
+ for (var s = e.listSelections(), r = 0; r < s.length; r++) {
73
+ if (!s[r].empty()) return a.Pass;
74
+ var f = _(e, s[r].head);
75
+ if (!f || n.indexOf(f) % 2 != 0) return a.Pass;
76
+ }
77
+ e.operation(function() {
78
+ var o = e.lineSeparator() || `
79
+ `;
80
+ e.replaceSelection(o + o, null), k(e, -1), s = e.listSelections();
81
+ for (var h = 0; h < s.length; h++) {
82
+ var S = s[h].head.line;
83
+ e.indentLine(S, null, !0), e.indentLine(S + 1, null, !0);
84
+ }
85
+ });
86
+ }
87
+ function k(e, t) {
88
+ for (var n = [], s = e.listSelections(), r = 0, f = 0; f < s.length; f++) {
89
+ var o = s[f];
90
+ o.head == e.getCursor() && (r = f);
91
+ var h = o.head.ch || t > 0 ? { line: o.head.line, ch: o.head.ch + t } : { line: o.head.line - 1 };
92
+ n.push({ anchor: h, head: h });
93
+ }
94
+ e.setSelections(n, r);
95
+ }
96
+ function $(e) {
97
+ var t = a.cmpPos(e.anchor, e.head) > 0;
98
+ return {
99
+ anchor: new i(e.anchor.line, e.anchor.ch + (t ? -1 : 1)),
100
+ head: new i(e.head.line, e.head.ch + (t ? 1 : -1))
101
+ };
102
+ }
103
+ function z(e, t) {
104
+ var n = y(e);
105
+ if (!n || e.getOption("disableInput")) return a.Pass;
106
+ var s = g(n, "pairs"), r = s.indexOf(t);
107
+ if (r == -1) return a.Pass;
108
+ for (var f = g(n, "closeBefore"), o = g(n, "triples"), h = s.charAt(r + 1) == t, S = e.listSelections(), B = r % 2 == 0, c, R = 0; R < S.length; R++) {
109
+ var w = S[R], l = w.head, u, P = e.getRange(l, i(l.line, l.ch + 1));
110
+ if (B && !w.empty())
111
+ u = "surround";
112
+ else if ((h || !B) && P == t)
113
+ h && N(e, l) ? u = "both" : o.indexOf(t) >= 0 && e.getRange(l, i(l.line, l.ch + 3)) == t + t + t ? u = "skipThree" : u = "skip";
114
+ else if (h && l.ch > 1 && o.indexOf(t) >= 0 && e.getRange(i(l.line, l.ch - 2), l) == t + t) {
115
+ if (l.ch > 2 && /\bstring/.test(e.getTokenTypeAt(i(l.line, l.ch - 2)))) return a.Pass;
116
+ u = "addFour";
117
+ } else if (h) {
118
+ var I = l.ch == 0 ? " " : e.getRange(i(l.line, l.ch - 1), l);
119
+ if (!a.isWordChar(P) && I != t && !a.isWordChar(I)) u = "both";
120
+ else return a.Pass;
121
+ } else if (B && (P.length === 0 || /\s/.test(P) || f.indexOf(P) > -1))
122
+ u = "both";
123
+ else
124
+ return a.Pass;
125
+ if (!c) c = u;
126
+ else if (c != u) return a.Pass;
127
+ }
128
+ var b = r % 2 ? s.charAt(r - 1) : t, j = r % 2 ? t : s.charAt(r + 1);
129
+ e.operation(function() {
130
+ if (c == "skip")
131
+ k(e, 1);
132
+ else if (c == "skipThree")
133
+ k(e, 3);
134
+ else if (c == "surround") {
135
+ for (var p = e.getSelections(), v = 0; v < p.length; v++)
136
+ p[v] = b + p[v] + j;
137
+ e.replaceSelections(p, "around"), p = e.listSelections().slice();
138
+ for (var v = 0; v < p.length; v++)
139
+ p[v] = $(p[v]);
140
+ e.setSelections(p);
141
+ } else c == "both" ? (e.replaceSelection(b + j, null), e.triggerElectric(b + j), k(e, -1)) : c == "addFour" && (e.replaceSelection(b + b + b + b, "before"), k(e, 1));
142
+ });
143
+ }
144
+ function _(e, t) {
145
+ var n = e.getRange(
146
+ i(t.line, t.ch - 1),
147
+ i(t.line, t.ch + 1)
148
+ );
149
+ return n.length == 2 ? n : null;
150
+ }
151
+ function N(e, t) {
152
+ var n = e.getTokenAt(i(t.line, t.ch + 1));
153
+ return /\bstring/.test(n.type) && n.start == t.ch && (t.ch == 0 || !/\bstring/.test(e.getTokenTypeAt(t)));
154
+ }
155
+ });
156
+ }()), q.exports;
157
+ }
158
+ var D = Q();
159
+ const T = /* @__PURE__ */ G(D), X = /* @__PURE__ */ J({
160
+ __proto__: null,
161
+ default: T
162
+ }, [D]);
163
+ export {
164
+ X as c
165
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";const G=require("./index-BeOZF5ut.js"),H=require("./codemirror-DMBo1i5w.js");function J(O,A){for(var r=0;r<A.length;r++){const d=A[r];if(typeof d!="string"&&!Array.isArray(d)){for(const i in d)if(i!=="default"&&!(i in O)){const u=Object.getOwnPropertyDescriptor(d,i);u&&Object.defineProperty(O,i,u.get?u:{enumerable:!0,get:()=>d[i]})}}}return Object.freeze(Object.defineProperty(O,Symbol.toStringTag,{value:"Module"}))}var I={exports:{}},F;function Q(){return F||(F=1,function(O,A){(function(r){r(H.requireCodemirror())})(function(r){var d={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},i=r.Pos;r.defineOption("autoCloseBrackets",!1,function(e,t,n){n&&n!=r.Init&&(e.removeKeyMap(x),e.state.closeBrackets=null),t&&(q(u(t,"pairs")),e.state.closeBrackets=t,e.addKeyMap(x))});function u(e,t){return t=="pairs"&&typeof e=="string"?e:typeof e=="object"&&e[t]!=null?e[t]:d[t]}var x={Backspace:L,Enter:W};function q(e){for(var t=0;t<e.length;t++){var n=e.charAt(t),s="'"+n+"'";x[s]||(x[s]=K(n))}}q(d.pairs+"`");function K(e){return function(t){return z(t,e)}}function y(e){var t=e.state.closeBrackets;if(!t||t.override)return t;var n=e.getModeAt(e.getCursor());return n.closeBrackets||t}function L(e){var t=y(e);if(!t||e.getOption("disableInput"))return r.Pass;for(var n=u(t,"pairs"),s=e.listSelections(),a=0;a<s.length;a++){if(!s[a].empty())return r.Pass;var f=E(e,s[a].head);if(!f||n.indexOf(f)%2!=0)return r.Pass}for(var a=s.length-1;a>=0;a--){var o=s[a].head;e.replaceRange("",i(o.line,o.ch-1),i(o.line,o.ch+1),"+delete")}}function W(e){var t=y(e),n=t&&u(t,"explode");if(!n||e.getOption("disableInput"))return r.Pass;for(var s=e.listSelections(),a=0;a<s.length;a++){if(!s[a].empty())return r.Pass;var f=E(e,s[a].head);if(!f||n.indexOf(f)%2!=0)return r.Pass}e.operation(function(){var o=e.lineSeparator()||`
2
+ `;e.replaceSelection(o+o,null),k(e,-1),s=e.listSelections();for(var h=0;h<s.length;h++){var S=s[h].head.line;e.indentLine(S,null,!0),e.indentLine(S+1,null,!0)}})}function k(e,t){for(var n=[],s=e.listSelections(),a=0,f=0;f<s.length;f++){var o=s[f];o.head==e.getCursor()&&(a=f);var h=o.head.ch||t>0?{line:o.head.line,ch:o.head.ch+t}:{line:o.head.line-1};n.push({anchor:h,head:h})}e.setSelections(n,a)}function $(e){var t=r.cmpPos(e.anchor,e.head)>0;return{anchor:new i(e.anchor.line,e.anchor.ch+(t?-1:1)),head:new i(e.head.line,e.head.ch+(t?1:-1))}}function z(e,t){var n=y(e);if(!n||e.getOption("disableInput"))return r.Pass;var s=u(n,"pairs"),a=s.indexOf(t);if(a==-1)return r.Pass;for(var f=u(n,"closeBefore"),o=u(n,"triples"),h=s.charAt(a+1)==t,S=e.listSelections(),B=a%2==0,c,R=0;R<S.length;R++){var _=S[R],l=_.head,g,P=e.getRange(l,i(l.line,l.ch+1));if(B&&!_.empty())g="surround";else if((h||!B)&&P==t)h&&N(e,l)?g="both":o.indexOf(t)>=0&&e.getRange(l,i(l.line,l.ch+3))==t+t+t?g="skipThree":g="skip";else if(h&&l.ch>1&&o.indexOf(t)>=0&&e.getRange(i(l.line,l.ch-2),l)==t+t){if(l.ch>2&&/\bstring/.test(e.getTokenTypeAt(i(l.line,l.ch-2))))return r.Pass;g="addFour"}else if(h){var w=l.ch==0?" ":e.getRange(i(l.line,l.ch-1),l);if(!r.isWordChar(P)&&w!=t&&!r.isWordChar(w))g="both";else return r.Pass}else if(B&&(P.length===0||/\s/.test(P)||f.indexOf(P)>-1))g="both";else return r.Pass;if(!c)c=g;else if(c!=g)return r.Pass}var b=a%2?s.charAt(a-1):t,j=a%2?t:s.charAt(a+1);e.operation(function(){if(c=="skip")k(e,1);else if(c=="skipThree")k(e,3);else if(c=="surround"){for(var v=e.getSelections(),p=0;p<v.length;p++)v[p]=b+v[p]+j;e.replaceSelections(v,"around"),v=e.listSelections().slice();for(var p=0;p<v.length;p++)v[p]=$(v[p]);e.setSelections(v)}else c=="both"?(e.replaceSelection(b+j,null),e.triggerElectric(b+j),k(e,-1)):c=="addFour"&&(e.replaceSelection(b+b+b+b,"before"),k(e,1))})}function E(e,t){var n=e.getRange(i(t.line,t.ch-1),i(t.line,t.ch+1));return n.length==2?n:null}function N(e,t){var n=e.getTokenAt(i(t.line,t.ch+1));return/\bstring/.test(n.type)&&n.start==t.ch&&(t.ch==0||!/\bstring/.test(e.getTokenTypeAt(t)))}})}()),I.exports}var D=Q();const T=G.getDefaultExportFromCjs(D),U=J({__proto__:null,default:T},[D]);exports.closebrackets=U;
@@ -0,0 +1,27 @@
1
+ import { g as s } from "./index-Iqk59VQ1.mjs";
2
+ import { r as c } from "./codemirror-DgPcZxSc.mjs";
3
+ function f(o, a) {
4
+ for (var t = 0; t < a.length; t++) {
5
+ const r = a[t];
6
+ if (typeof r != "string" && !Array.isArray(r)) {
7
+ for (const e in r)
8
+ if (e !== "default" && !(e in o)) {
9
+ const i = Object.getOwnPropertyDescriptor(r, e);
10
+ i && Object.defineProperty(o, e, i.get ? i : {
11
+ enumerable: !0,
12
+ get: () => r[e]
13
+ });
14
+ }
15
+ }
16
+ }
17
+ return Object.freeze(Object.defineProperty(o, Symbol.toStringTag, { value: "Module" }));
18
+ }
19
+ var n = c();
20
+ const p = /* @__PURE__ */ s(n), d = /* @__PURE__ */ f({
21
+ __proto__: null,
22
+ default: p
23
+ }, [n]);
24
+ export {
25
+ p as C,
26
+ d as c
27
+ };