@dxos/react-ui-syntax-highlighter 0.8.4-main.ef1bc66f44 → 0.8.4-main.f466a3d56e

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 (44) hide show
  1. package/LICENSE +102 -5
  2. package/dist/lib/browser/index.mjs +169 -66
  3. package/dist/lib/browser/index.mjs.map +4 -4
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/lib/node-esm/index.mjs +169 -66
  6. package/dist/lib/node-esm/index.mjs.map +4 -4
  7. package/dist/lib/node-esm/meta.json +1 -1
  8. package/dist/types/src/JsonHighlighter/JsonHighlighter.d.ts +23 -0
  9. package/dist/types/src/JsonHighlighter/JsonHighlighter.d.ts.map +1 -0
  10. package/dist/types/src/JsonHighlighter/JsonHighlighter.stories.d.ts +14 -0
  11. package/dist/types/src/JsonHighlighter/JsonHighlighter.stories.d.ts.map +1 -0
  12. package/dist/types/src/JsonHighlighter/index.d.ts +2 -0
  13. package/dist/types/src/JsonHighlighter/index.d.ts.map +1 -0
  14. package/dist/types/src/Syntax/Syntax.d.ts +49 -0
  15. package/dist/types/src/Syntax/Syntax.d.ts.map +1 -0
  16. package/dist/types/src/Syntax/Syntax.stories.d.ts +23 -0
  17. package/dist/types/src/Syntax/Syntax.stories.d.ts.map +1 -0
  18. package/dist/types/src/Syntax/index.d.ts +2 -0
  19. package/dist/types/src/Syntax/index.d.ts.map +1 -0
  20. package/dist/types/src/SyntaxHighlighter/SyntaxHighlighter.d.ts +12 -4
  21. package/dist/types/src/SyntaxHighlighter/SyntaxHighlighter.d.ts.map +1 -1
  22. package/dist/types/src/SyntaxHighlighter/SyntaxHighlighter.stories.d.ts +6 -1
  23. package/dist/types/src/SyntaxHighlighter/SyntaxHighlighter.stories.d.ts.map +1 -1
  24. package/dist/types/src/index.d.ts +2 -1
  25. package/dist/types/src/index.d.ts.map +1 -1
  26. package/dist/types/tsconfig.tsbuildinfo +1 -1
  27. package/package.json +14 -16
  28. package/src/JsonHighlighter/JsonHighlighter.stories.tsx +65 -0
  29. package/src/JsonHighlighter/JsonHighlighter.tsx +47 -0
  30. package/src/JsonHighlighter/index.ts +5 -0
  31. package/src/Syntax/Syntax.stories.tsx +99 -0
  32. package/src/Syntax/Syntax.tsx +229 -0
  33. package/src/{Json → Syntax}/index.ts +1 -1
  34. package/src/SyntaxHighlighter/SyntaxHighlighter.stories.tsx +11 -10
  35. package/src/SyntaxHighlighter/SyntaxHighlighter.tsx +93 -42
  36. package/src/index.ts +2 -1
  37. package/dist/types/src/Json/Json.d.ts +0 -26
  38. package/dist/types/src/Json/Json.d.ts.map +0 -1
  39. package/dist/types/src/Json/Json.stories.d.ts +0 -22
  40. package/dist/types/src/Json/Json.stories.d.ts.map +0 -1
  41. package/dist/types/src/Json/index.d.ts +0 -2
  42. package/dist/types/src/Json/index.d.ts.map +0 -1
  43. package/src/Json/Json.stories.tsx +0 -106
  44. package/src/Json/Json.tsx +0 -80
package/LICENSE CHANGED
@@ -1,8 +1,105 @@
1
- MIT License
2
- Copyright (c) 2022 DXOS
1
+ # Functional Source License, Version 1.1, ALv2 Future License
3
2
 
4
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
3
+ ## Abbreviation
5
4
 
6
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
5
+ FSL-1.1-Apache-2.0
7
6
 
8
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
7
+ ## Notice
8
+
9
+ Copyright 2026 DXOS
10
+
11
+ ## Terms and Conditions
12
+
13
+ ### Licensor ("We")
14
+
15
+ The party offering the Software under these Terms and Conditions.
16
+
17
+ ### The Software
18
+
19
+ The "Software" is each version of the software that we make available under
20
+ these Terms and Conditions, as indicated by our inclusion of these Terms and
21
+ Conditions with the Software.
22
+
23
+ ### License Grant
24
+
25
+ Subject to your compliance with this License Grant and the Patents,
26
+ Redistribution and Trademark clauses below, we hereby grant you the right to
27
+ use, copy, modify, create derivative works, publicly perform, publicly display
28
+ and redistribute the Software for any Permitted Purpose identified below.
29
+
30
+ ### Permitted Purpose
31
+
32
+ A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
33
+ means making the Software available to others in a commercial product or
34
+ service that:
35
+
36
+ 1. substitutes for the Software;
37
+
38
+ 2. substitutes for any other product or service we offer using the Software
39
+ that exists as of the date we make the Software available; or
40
+
41
+ 3. offers the same or substantially similar functionality as the Software.
42
+
43
+ Permitted Purposes specifically include using the Software:
44
+
45
+ 1. for your internal use and access;
46
+
47
+ 2. for non-commercial education;
48
+
49
+ 3. for non-commercial research; and
50
+
51
+ 4. in connection with professional services that you provide to a licensee
52
+ using the Software in accordance with these Terms and Conditions.
53
+
54
+ ### Patents
55
+
56
+ To the extent your use for a Permitted Purpose would necessarily infringe our
57
+ patents, the license grant above includes a license under our patents. If you
58
+ make a claim against any party that the Software infringes or contributes to
59
+ the infringement of any patent, then your patent license to the Software ends
60
+ immediately.
61
+
62
+ ### Redistribution
63
+
64
+ The Terms and Conditions apply to all copies, modifications and derivatives of
65
+ the Software.
66
+
67
+ If you redistribute any copies, modifications or derivatives of the Software,
68
+ you must include a copy of or a link to these Terms and Conditions and not
69
+ remove any copyright notices provided in or with the Software.
70
+
71
+ ### Disclaimer
72
+
73
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
74
+ IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
75
+ PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
76
+
77
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
78
+ SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
79
+ EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
80
+
81
+ ### Trademarks
82
+
83
+ Except for displaying the License Details and identifying us as the origin of
84
+ the Software, you have no right under these Terms and Conditions to use our
85
+ trademarks, trade names, service marks or product names.
86
+
87
+ ## Grant of Future License
88
+
89
+ We hereby irrevocably grant you an additional license to use the Software under
90
+ the Apache License, Version 2.0 that is effective on the second anniversary of
91
+ the date we make the Software available. On or after that date, you may use the
92
+ Software under the Apache License, Version 2.0, in which case the following
93
+ will apply:
94
+
95
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
96
+ this file except in compliance with the License.
97
+
98
+ You may obtain a copy of the License at
99
+
100
+ http://www.apache.org/licenses/LICENSE-2.0
101
+
102
+ Unless required by applicable law or agreed to in writing, software distributed
103
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
104
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
105
+ specific language governing permissions and limitations under the License.
@@ -1,27 +1,41 @@
1
- // src/Json/Json.tsx
2
- import jp from "jsonpath";
3
- import React2, { forwardRef, useEffect, useState } from "react";
4
- import { Input } from "@dxos/react-ui";
1
+ // src/JsonHighlighter/JsonHighlighter.tsx
2
+ import React2 from "react";
3
+ import { composable as composable2 } from "@dxos/ui-theme";
5
4
  import { createReplacer, safeStringify } from "@dxos/util";
6
5
 
7
6
  // src/SyntaxHighlighter/index.ts
8
7
  import createElement from "react-syntax-highlighter/dist/esm/create-element";
9
8
 
10
9
  // src/SyntaxHighlighter/SyntaxHighlighter.tsx
11
- import React from "react";
10
+ import React, { Children } from "react";
12
11
  import NativeSyntaxHighlighter from "react-syntax-highlighter/dist/esm/prism-async-light";
13
12
  import { coldarkDark as dark, coldarkCold as light } from "react-syntax-highlighter/dist/esm/styles/prism";
14
- import { useThemeContext } from "@dxos/react-ui";
15
- import { mx } from "@dxos/ui-theme";
13
+ import { Clipboard, useThemeContext } from "@dxos/react-ui";
14
+ import { composable, composableProps } from "@dxos/ui-theme";
16
15
  var zeroWidthSpace = "\u200B";
17
- var SyntaxHighlighter = ({ classNames, children, language = "text", fallback = zeroWidthSpace, ...props }) => {
16
+ var languages = {
17
+ js: "javascript",
18
+ ts: "typescript"
19
+ };
20
+ var SyntaxHighlighter = composable(({ classNames, className, children, role, style, themeStyle, language = "text", fallback = zeroWidthSpace, copyButton, ...nativeProps }, forwardedRef) => {
18
21
  const { themeMode } = useThemeContext();
22
+ const source = Children.toArray(children).join("") || fallback;
23
+ const hasCustomTheme = themeStyle && typeof themeStyle === "object" && Object.keys(themeStyle).length > 0;
24
+ const prismTheme = hasCustomTheme ? themeStyle : themeMode === "dark" ? dark : light;
19
25
  return /* @__PURE__ */ React.createElement("div", {
20
- className: mx("flex is-full p-1 overflow-hidden", classNames)
26
+ ...composableProps({
27
+ classNames,
28
+ className,
29
+ role,
30
+ style
31
+ }, {
32
+ role: "none",
33
+ classNames: copyButton && "relative group"
34
+ }),
35
+ ref: forwardedRef
21
36
  }, /* @__PURE__ */ React.createElement(NativeSyntaxHighlighter, {
22
- className: "!m-0 is-full overflow-auto scrollbar-thin",
23
37
  language: languages[language] || language,
24
- style: themeMode === "dark" ? dark : light,
38
+ style: prismTheme,
25
39
  customStyle: {
26
40
  background: "unset",
27
41
  border: "none",
@@ -29,77 +43,166 @@ var SyntaxHighlighter = ({ classNames, children, language = "text", fallback = z
29
43
  padding: 0,
30
44
  margin: 0
31
45
  },
32
- ...props
33
- }, children || fallback));
34
- };
35
- var languages = {
36
- js: "javascript",
37
- ts: "typescript"
38
- };
46
+ ...nativeProps
47
+ }, source), copyButton && /* @__PURE__ */ React.createElement("div", {
48
+ className: "pointer-events-none absolute top-1 right-1 z-10 opacity-0 group-hover:opacity-100 focus-within:opacity-100"
49
+ }, /* @__PURE__ */ React.createElement(Clipboard.Provider, null, /* @__PURE__ */ React.createElement(Clipboard.IconButton, {
50
+ value: source,
51
+ variant: "ghost",
52
+ size: 4,
53
+ classNames: "pointer-events-auto aspect-square rounded-sm"
54
+ }))));
55
+ });
56
+ SyntaxHighlighter.displayName = "SyntaxHighlighter";
39
57
 
40
- // src/Json/Json.tsx
41
- var Json = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
42
- if (props.filter) {
43
- return /* @__PURE__ */ React2.createElement(JsonFilter, props);
58
+ // src/JsonHighlighter/JsonHighlighter.tsx
59
+ var resolveReplacer = (replacer) => {
60
+ if (!replacer) {
61
+ return void 0;
44
62
  }
45
- const { classNames, data, replacer, testId } = props;
63
+ return typeof replacer === "function" ? replacer : createReplacer(replacer);
64
+ };
65
+ var JsonHighlighter = composable2(({ data, replacer, indent = 2, testId, ...props }, forwardedRef) => {
46
66
  return /* @__PURE__ */ React2.createElement(SyntaxHighlighter, {
67
+ ...props,
47
68
  language: "json",
48
- classNames: [
49
- "is-full overflow-y-auto text-sm",
50
- classNames
51
- ],
52
69
  "data-testid": testId,
53
70
  ref: forwardedRef
54
- }, safeStringify(data, replacer && createReplacer(replacer), 2));
71
+ }, safeStringify(data, resolveReplacer(replacer), indent));
55
72
  });
56
- var JsonFilter = /* @__PURE__ */ forwardRef(({ classNames, data: initialData, replacer, testId }, forwardedRef) => {
57
- const [data, setData] = useState(initialData);
58
- const [text, setText] = useState("");
59
- const [error, setError] = useState(null);
60
- useEffect(() => {
61
- if (!initialData || !text.trim().length) {
62
- setData(initialData);
63
- } else {
64
- try {
65
- setData(jp.query(initialData, text));
66
- setError(null);
67
- } catch (err) {
68
- setData(initialData);
69
- setError(err);
70
- }
73
+ JsonHighlighter.displayName = "JsonHighlighter";
74
+
75
+ // src/Syntax/Syntax.tsx
76
+ import { createContextScope } from "@radix-ui/react-context";
77
+ import { JSONPath } from "jsonpath-plus";
78
+ import React3, { forwardRef, useMemo, useState } from "react";
79
+ import { Input, ScrollArea } from "@dxos/react-ui";
80
+ import { composable as composable3, composableProps as composableProps2 } from "@dxos/ui-theme";
81
+ var SYNTAX_NAME = "Syntax";
82
+ var [createSyntaxContext, createSyntaxScope] = createContextScope(SYNTAX_NAME);
83
+ var [SyntaxProvider, useSyntaxContext] = createSyntaxContext(SYNTAX_NAME);
84
+ var SYNTAX_ROOT_NAME = "Syntax.Root";
85
+ var SyntaxRoot = (props) => {
86
+ const { __scopeSyntax, children, language, source, replacer } = props;
87
+ const isJson = "data" in props;
88
+ const data = props.data;
89
+ const [filterText, setFilterText] = useState("");
90
+ const { filteredData, filterError } = useMemo(() => {
91
+ if (!isJson || !filterText.trim().length) {
92
+ return {
93
+ filteredData: data,
94
+ filterError: null
95
+ };
96
+ }
97
+ try {
98
+ return {
99
+ filteredData: JSONPath({
100
+ path: filterText,
101
+ json: data
102
+ }),
103
+ filterError: null
104
+ };
105
+ } catch (err) {
106
+ return {
107
+ filteredData: data,
108
+ filterError: err
109
+ };
71
110
  }
72
111
  }, [
73
- initialData,
74
- text
112
+ isJson,
113
+ data,
114
+ filterText
75
115
  ]);
76
- return /* @__PURE__ */ React2.createElement("div", {
77
- className: "flex flex-col bs-full overflow-hidden",
116
+ return /* @__PURE__ */ React3.createElement(SyntaxProvider, {
117
+ scope: __scopeSyntax,
118
+ mode: isJson ? "json" : "text",
119
+ source,
120
+ language,
121
+ data,
122
+ filteredData,
123
+ filterText,
124
+ setFilterText,
125
+ filterError,
126
+ replacer
127
+ }, children);
128
+ };
129
+ SyntaxRoot.displayName = SYNTAX_ROOT_NAME;
130
+ var SYNTAX_CONTENT_NAME = "Syntax.Content";
131
+ var SyntaxContent = composable3(({ children, ...props }, forwardedRef) => {
132
+ return /* @__PURE__ */ React3.createElement("div", {
133
+ ...composableProps2(props, {
134
+ classNames: "flex flex-col h-full min-h-0 overflow-hidden"
135
+ }),
78
136
  ref: forwardedRef
79
- }, /* @__PURE__ */ React2.createElement(Input.Root, {
80
- validationValence: error ? "error" : "success"
81
- }, /* @__PURE__ */ React2.createElement(Input.TextInput, {
82
- classNames: [
83
- "p-1 pli-2 font-mono",
84
- error && "border-rose-500"
85
- ],
86
- variant: "subdued",
87
- value: text,
88
- placeholder: "JSONPath (e.g., $.graph.nodes)",
89
- onChange: (event) => setText(event.target.value)
90
- })), /* @__PURE__ */ React2.createElement(SyntaxHighlighter, {
91
- language: "json",
137
+ }, children);
138
+ });
139
+ SyntaxContent.displayName = SYNTAX_CONTENT_NAME;
140
+ var SYNTAX_FILTER_NAME = "Syntax.Filter";
141
+ var SyntaxFilter = /* @__PURE__ */ forwardRef(({ __scopeSyntax, classNames, placeholder = "JSONPath (e.g., $.graph.nodes)" }, forwardedRef) => {
142
+ const { mode, filterText, setFilterText, filterError } = useSyntaxContext(SYNTAX_FILTER_NAME, __scopeSyntax);
143
+ if (mode !== "json") {
144
+ throw new Error(`\`${SYNTAX_FILTER_NAME}\` requires \`Syntax.Root\` to be in JSON mode (pass \`data\`).`);
145
+ }
146
+ return /* @__PURE__ */ React3.createElement(Input.Root, {
147
+ validationValence: filterError ? "error" : "success"
148
+ }, /* @__PURE__ */ React3.createElement(Input.TextInput, {
92
149
  classNames: [
93
- "is-full overflow-y-auto text-sm",
150
+ "p-1 px-2 font-mono",
151
+ filterError && "border-rose-500",
94
152
  classNames
95
153
  ],
96
- "data-testid": testId
97
- }, safeStringify(data, replacer && createReplacer(replacer), 2)));
154
+ variant: "subdued",
155
+ value: filterText,
156
+ placeholder,
157
+ onChange: (event) => setFilterText(event.target.value),
158
+ ref: forwardedRef
159
+ }));
160
+ });
161
+ SyntaxFilter.displayName = SYNTAX_FILTER_NAME;
162
+ var SYNTAX_VIEWPORT_NAME = "Syntax.Viewport";
163
+ var SyntaxViewport = composable3(({ children, ...props }, forwardedRef) => {
164
+ return /* @__PURE__ */ React3.createElement(ScrollArea.Root, {
165
+ ...composableProps2(props),
166
+ thin: true,
167
+ ref: forwardedRef
168
+ }, /* @__PURE__ */ React3.createElement(ScrollArea.Viewport, null, children));
169
+ });
170
+ SyntaxViewport.displayName = SYNTAX_VIEWPORT_NAME;
171
+ var SYNTAX_CODE_NAME = "Syntax.Code";
172
+ var SyntaxCode = composable3(({ __scopeSyntax, testId, ...props }, forwardedRef) => {
173
+ const context = useSyntaxContext(SYNTAX_CODE_NAME, __scopeSyntax);
174
+ const merged = composableProps2(props, {
175
+ classNames: "py-1 px-2 text-sm"
176
+ });
177
+ if (context.mode === "json") {
178
+ return /* @__PURE__ */ React3.createElement(JsonHighlighter, {
179
+ ...merged,
180
+ data: context.filteredData,
181
+ replacer: context.replacer,
182
+ testId,
183
+ ref: forwardedRef
184
+ });
185
+ }
186
+ return /* @__PURE__ */ React3.createElement(SyntaxHighlighter, {
187
+ ...merged,
188
+ language: context.language,
189
+ "data-testid": testId,
190
+ ref: forwardedRef
191
+ }, context.source ?? "");
98
192
  });
193
+ SyntaxCode.displayName = SYNTAX_CODE_NAME;
194
+ var Syntax = {
195
+ Root: SyntaxRoot,
196
+ Content: SyntaxContent,
197
+ Filter: SyntaxFilter,
198
+ Viewport: SyntaxViewport,
199
+ Code: SyntaxCode
200
+ };
99
201
  export {
100
- Json,
101
- JsonFilter,
202
+ JsonHighlighter,
203
+ Syntax,
102
204
  SyntaxHighlighter,
103
- createElement
205
+ createElement,
206
+ createSyntaxScope
104
207
  };
105
208
  //# sourceMappingURL=index.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/Json/Json.tsx", "../../../src/SyntaxHighlighter/index.ts", "../../../src/SyntaxHighlighter/SyntaxHighlighter.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\n// TODO(burdon): Use to jsonpath-plus.\nimport jp from 'jsonpath';\nimport React, { forwardRef, useEffect, useState } from 'react';\n\nimport { Input, type ThemedClassName } from '@dxos/react-ui';\nimport { type CreateReplacerProps, createReplacer, safeStringify } from '@dxos/util';\n\nimport { SyntaxHighlighter } from '../SyntaxHighlighter';\n\nexport type JsonProps = ThemedClassName<{\n data?: any;\n filter?: boolean;\n replacer?: CreateReplacerProps;\n testId?: string;\n}>;\n\nexport const Json = forwardRef<HTMLDivElement, JsonProps>((props, forwardedRef) => {\n if (props.filter) {\n return <JsonFilter {...props} />;\n }\n\n const { classNames, data, replacer, testId } = props;\n return (\n <SyntaxHighlighter\n language='json'\n classNames={['is-full overflow-y-auto text-sm', classNames]}\n data-testid={testId}\n ref={forwardedRef}\n >\n {safeStringify(data, replacer && createReplacer(replacer), 2)}\n </SyntaxHighlighter>\n );\n});\n\nexport const JsonFilter = forwardRef<HTMLDivElement, JsonProps>(\n ({ classNames, data: initialData, replacer, testId }, forwardedRef) => {\n const [data, setData] = useState(initialData);\n const [text, setText] = useState('');\n const [error, setError] = useState<Error | null>(null);\n\n useEffect(() => {\n if (!initialData || !text.trim().length) {\n setData(initialData);\n } else {\n try {\n setData(jp.query(initialData, text));\n setError(null);\n } catch (err) {\n setData(initialData);\n setError(err as Error);\n }\n }\n }, [initialData, text]); // TODO(burdon): Need structural diff.\n\n return (\n <div className='flex flex-col bs-full overflow-hidden' ref={forwardedRef}>\n <Input.Root validationValence={error ? 'error' : 'success'}>\n <Input.TextInput\n classNames={['p-1 pli-2 font-mono', error && 'border-rose-500']}\n variant='subdued'\n value={text}\n placeholder='JSONPath (e.g., $.graph.nodes)'\n onChange={(event) => setText(event.target.value)}\n />\n </Input.Root>\n <SyntaxHighlighter\n language='json'\n classNames={['is-full overflow-y-auto text-sm', classNames]}\n data-testid={testId}\n >\n {safeStringify(data, replacer && createReplacer(replacer), 2)}\n </SyntaxHighlighter>\n </div>\n );\n },\n);\n", "//\n// Copyright 2024 DXOS.org\n//\n\n// eslint-disable-next-line no-restricted-imports\nimport createElement from 'react-syntax-highlighter/dist/esm/create-element';\n\nexport { createElement };\n\nexport * from './SyntaxHighlighter';\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React from 'react';\nimport { type SyntaxHighlighterProps as NaturalSyntaxHighlighterProps } from 'react-syntax-highlighter';\nimport NativeSyntaxHighlighter from 'react-syntax-highlighter/dist/esm/prism-async-light';\nimport { coldarkDark as dark, coldarkCold as light } from 'react-syntax-highlighter/dist/esm/styles/prism';\n\nimport { type ThemedClassName, useThemeContext } from '@dxos/react-ui';\nimport { mx } from '@dxos/ui-theme';\n\nconst zeroWidthSpace = '\\u200b';\n\nexport type SyntaxHighlighterProps = ThemedClassName<\n NaturalSyntaxHighlighterProps & {\n fallback?: string;\n }\n>;\n\n/**\n * NOTE: Using `light-async` version directly from dist to avoid any chance of the heavy one being loaded.\n * The lightweight version will load specific language parsers asynchronously.\n *\n * https://github.com/react-syntax-highlighter/react-syntax-highlighter\n * https://react-syntax-highlighter.github.io/react-syntax-highlighter/demo/prism.html\n */\n// TODO(burdon): Replace with react-ui-editor (and reuse styles).\nexport const SyntaxHighlighter = ({\n classNames,\n children,\n language = 'text',\n fallback = zeroWidthSpace,\n ...props\n}: SyntaxHighlighterProps) => {\n const { themeMode } = useThemeContext();\n\n return (\n <div className={mx('flex is-full p-1 overflow-hidden', classNames)}>\n <NativeSyntaxHighlighter\n className='!m-0 is-full overflow-auto scrollbar-thin'\n language={languages[language as keyof typeof languages] || language}\n style={themeMode === 'dark' ? dark : light}\n customStyle={{\n background: 'unset',\n border: 'none',\n boxShadow: 'none',\n padding: 0,\n margin: 0,\n }}\n {...props}\n >\n {/* Non-empty fallback prevents collapse. */}\n {children || fallback}\n </NativeSyntaxHighlighter>\n </div>\n );\n};\n\nconst languages = {\n js: 'javascript',\n ts: 'typescript',\n};\n"],
5
- "mappings": ";AAKA,OAAOA,QAAQ;AACf,OAAOC,UAASC,YAAYC,WAAWC,gBAAgB;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F,WAAAA;AACjC,QAAM,CAACG,MAAMC,OAAAA,IAAWF,SAAS,EAAA;AACjC,QAAM,CAACG,OAAOC,QAAAA,IAAYJ,SAAuB,IAAA;AAEjDK,YAAU,MAAA;AACR,QAAI,CAACP,eAAe,CAACG,KAAKK,KAAI,EAAGC,QAAQ;AACvCR,cAAQD,WAAAA;IACV,OAAO;AACL,UAAI;AACFC,gBAAQS,GAAGC,MAAMX,aAAaG,IAAAA,CAAAA;AAC9BG,iBAAS,IAAA;MACX,SAASM,KAAK;AACZX,gBAAQD,WAAAA;AACRM,iBAASM,GAAAA;MACX;IACF;EACF,GAAG;IAACZ;IAAaG;GAAK;AAEtB,SACE,gBAAAf,OAAA,cAACyB,OAAAA;IAAIC,WAAU;IAAwCjB,KAAKX;KAC1D,gBAAAE,OAAA,cAAC2B,MAAMC,MAAI;IAACC,mBAAmBZ,QAAQ,UAAU;KAC/C,gBAAAjB,OAAA,cAAC2B,MAAMG,WAAS;IACd5B,YAAY;MAAC;MAAuBe,SAAS;;IAC7Cc,SAAQ;IACRC,OAAOjB;IACPkB,aAAY;IACZC,UAAU,CAACC,UAAUnB,QAAQmB,MAAMC,OAAOJ,KAAK;OAGnD,gBAAAhC,OAAA,cAACM,mBAAAA;IACCC,UAAS;IACTL,YAAY;MAAC;MAAmCA;;IAChDM,eAAaH;KAEZK,cAAcP,MAAMC,YAAYO,eAAeP,QAAAA,GAAW,CAAA,CAAA,CAAA;AAInE,CAAA;",
6
- "names": ["jp", "React", "forwardRef", "useEffect", "useState", "Input", "createReplacer", "safeStringify", "createElement", "React", "NativeSyntaxHighlighter", "coldarkDark", "dark", "coldarkCold", "light", "useThemeContext", "mx", "zeroWidthSpace", "SyntaxHighlighter", "classNames", "children", "language", "fallback", "props", "themeMode", "useThemeContext", "div", "className", "mx", "NativeSyntaxHighlighter", "languages", "style", "dark", "light", "customStyle", "background", "border", "boxShadow", "padding", "margin", "js", "ts", "Json", "forwardRef", "props", "forwardedRef", "filter", "React", "JsonFilter", "classNames", "data", "replacer", "testId", "SyntaxHighlighter", "language", "data-testid", "ref", "safeStringify", "createReplacer", "initialData", "setData", "useState", "text", "setText", "error", "setError", "useEffect", "trim", "length", "jp", "query", "err", "div", "className", "Input", "Root", "validationValence", "TextInput", "variant", "value", "placeholder", "onChange", "event", "target"]
3
+ "sources": ["../../../src/JsonHighlighter/JsonHighlighter.tsx", "../../../src/SyntaxHighlighter/index.ts", "../../../src/SyntaxHighlighter/SyntaxHighlighter.tsx", "../../../src/Syntax/Syntax.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { composable } from '@dxos/ui-theme';\nimport { type CreateReplacerProps, createReplacer, safeStringify } from '@dxos/util';\n\nimport { SyntaxHighlighter, type SyntaxHighlighterProps } from '../SyntaxHighlighter';\n\nexport type JsonReplacer = CreateReplacerProps | ((key: string, value: any) => any);\n\nexport type JsonHighlighterProps = Omit<SyntaxHighlighterProps, 'children' | 'language'> & {\n data?: any;\n replacer?: JsonReplacer;\n /** Indentation passed to `JSON.stringify`. Default: `2` (pretty-printed). Pass `0` for single-line output. */\n indent?: number;\n testId?: string;\n};\n\nconst resolveReplacer = (replacer?: JsonReplacer) => {\n if (!replacer) {\n return undefined;\n }\n return typeof replacer === 'function' ? replacer : createReplacer(replacer);\n};\n\n/**\n * Inline, non-scrolling JSON renderer.\n *\n * Thin wrapper around `SyntaxHighlighter` that stringifies `data` with an optional replacer.\n * `replacer` accepts either `CreateReplacerProps` (declarative truncation) or a raw\n * `JSON.stringify`-compatible function (for bespoke serialization).\n * For filtering and scroll behaviour, compose with the `Syntax.*` namespace.\n */\nexport const JsonHighlighter = composable<HTMLDivElement, JsonHighlighterProps>(\n ({ data, replacer, indent = 2, testId, ...props }, forwardedRef) => {\n return (\n <SyntaxHighlighter {...props} language='json' data-testid={testId} ref={forwardedRef}>\n {safeStringify(data, resolveReplacer(replacer), indent)}\n </SyntaxHighlighter>\n );\n },\n);\n\nJsonHighlighter.displayName = 'JsonHighlighter';\n", "//\n// Copyright 2024 DXOS.org\n//\n\n// eslint-disable-next-line no-restricted-imports\nimport createElement from 'react-syntax-highlighter/dist/esm/create-element';\n\nexport { createElement };\n\nexport * from './SyntaxHighlighter';\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { Children } from 'react';\nimport { type SyntaxHighlighterProps as NaturalSyntaxHighlighterProps } from 'react-syntax-highlighter';\nimport NativeSyntaxHighlighter from 'react-syntax-highlighter/dist/esm/prism-async-light';\nimport { coldarkDark as dark, coldarkCold as light } from 'react-syntax-highlighter/dist/esm/styles/prism';\n\nimport { Clipboard, useThemeContext } from '@dxos/react-ui';\nimport { composable, composableProps } from '@dxos/ui-theme';\n\nconst zeroWidthSpace = '\\u200b';\n\nconst languages = {\n js: 'javascript',\n ts: 'typescript',\n};\n\nexport type SyntaxHighlighterProps = Pick<\n NaturalSyntaxHighlighterProps,\n | 'language'\n | 'renderer'\n | 'showLineNumbers'\n | 'showInlineLineNumbers'\n | 'startingLineNumber'\n | 'wrapLines'\n | 'wrapLongLines'\n | 'PreTag'\n> & {\n themeStyle?: NaturalSyntaxHighlighterProps['style'];\n fallback?: string;\n copyButton?: boolean;\n};\n\n/**\n * Inline, non-scrolling wrapper around `react-syntax-highlighter`.\n *\n * Use directly for small snippets (e.g. inside markdown code blocks).\n * For scrollable panels, compose with `Syntax.Viewport`.\n *\n * NOTE: Using `light-async` version directly from dist to avoid any chance of the heavy one being loaded.\n * The lightweight version will load specific language parsers asynchronously.\n *\n * https://github.com/react-syntax-highlighter/react-syntax-highlighter\n * https://react-syntax-highlighter.github.io/react-syntax-highlighter/demo/prism.html\n */\nexport const SyntaxHighlighter = composable<HTMLDivElement, SyntaxHighlighterProps>(\n (\n {\n classNames,\n className,\n children,\n role,\n style,\n themeStyle,\n language = 'text',\n fallback = zeroWidthSpace,\n copyButton,\n ...nativeProps\n },\n forwardedRef,\n ) => {\n const { themeMode } = useThemeContext();\n const source = Children.toArray(children).join('') || fallback;\n\n const hasCustomTheme = themeStyle && typeof themeStyle === 'object' && Object.keys(themeStyle).length > 0;\n const prismTheme = hasCustomTheme ? themeStyle : themeMode === 'dark' ? dark : light;\n\n return (\n <div\n {...composableProps(\n { classNames, className, role, style },\n {\n role: 'none',\n classNames: copyButton && 'relative group',\n },\n )}\n ref={forwardedRef}\n >\n <NativeSyntaxHighlighter\n language={languages[language as keyof typeof languages] || language}\n style={prismTheme}\n customStyle={{\n background: 'unset',\n border: 'none',\n boxShadow: 'none',\n padding: 0,\n margin: 0,\n }}\n {...nativeProps}\n >\n {/* Non-empty fallback prevents collapse. */}\n {source}\n </NativeSyntaxHighlighter>\n\n {copyButton && (\n <div className='pointer-events-none absolute top-1 right-1 z-10 opacity-0 group-hover:opacity-100 focus-within:opacity-100'>\n <Clipboard.Provider>\n <Clipboard.IconButton\n value={source}\n variant='ghost'\n size={4}\n classNames='pointer-events-auto aspect-square rounded-sm'\n />\n </Clipboard.Provider>\n </div>\n )}\n </div>\n );\n },\n);\n\nSyntaxHighlighter.displayName = 'SyntaxHighlighter';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { createContextScope, type Scope } from '@radix-ui/react-context';\nimport { JSONPath } from 'jsonpath-plus';\nimport React, { type FC, type PropsWithChildren, forwardRef, useMemo, useState } from 'react';\n\nimport { Input, ScrollArea } from '@dxos/react-ui';\nimport { composable, composableProps } from '@dxos/ui-theme';\nimport { type ComposableProps } from '@dxos/ui-types';\n\nimport { JsonHighlighter, type JsonReplacer } from '../JsonHighlighter';\nimport { SyntaxHighlighter } from '../SyntaxHighlighter';\n\n//\n// Context\n//\n\nconst SYNTAX_NAME = 'Syntax';\n\ntype SyntaxContextValue = {\n mode: 'text' | 'json';\n // Text mode.\n source?: string;\n language?: string;\n // JSON mode.\n data?: any;\n filteredData?: any;\n filterText: string;\n setFilterText: (text: string) => void;\n filterError: Error | null;\n replacer?: JsonReplacer;\n};\n\ntype ScopedProps<P> = P & { __scopeSyntax?: Scope };\n\nconst [createSyntaxContext, createSyntaxScope] = createContextScope(SYNTAX_NAME);\nconst [SyntaxProvider, useSyntaxContext] = createSyntaxContext<SyntaxContextValue>(SYNTAX_NAME);\n\n//\n// Root\n//\n\nconst SYNTAX_ROOT_NAME = 'Syntax.Root';\n\ntype SyntaxRootProps = PropsWithChildren<{\n // Text mode.\n language?: string;\n source?: string;\n // JSON mode (presence of the `data` prop selects JSON mode; `undefined` is still JSON).\n data?: any;\n /**\n * `JSON.stringify` replacer applied to `data`. Use the function form to follow domain\n * references (e.g. ECHO refs) by returning a transformed value at the root call. Keeps\n * this package free of any domain-specific knowledge.\n */\n replacer?: JsonReplacer;\n}>;\n\n/**\n * Headless context provider. Selects JSON mode when the `data` prop is passed at all — even\n * `data={undefined}` — so loading states render an empty JSON view rather than flipping to\n * text mode (which would trip `Syntax.Filter`'s JSON-only guard). Mode is chosen by prop\n * presence, not value.\n */\nconst SyntaxRoot: FC<ScopedProps<SyntaxRootProps>> = (props) => {\n const { __scopeSyntax, children, language, source, replacer } = props;\n const isJson = 'data' in props;\n const data = props.data;\n const [filterText, setFilterText] = useState('');\n\n const { filteredData, filterError } = useMemo<{ filteredData: any; filterError: Error | null }>(() => {\n if (!isJson || !filterText.trim().length) {\n return { filteredData: data, filterError: null };\n }\n try {\n return { filteredData: JSONPath({ path: filterText, json: data }), filterError: null };\n } catch (err) {\n return { filteredData: data, filterError: err as Error };\n }\n }, [isJson, data, filterText]);\n\n return (\n <SyntaxProvider\n scope={__scopeSyntax}\n mode={isJson ? 'json' : 'text'}\n source={source}\n language={language}\n data={data}\n filteredData={filteredData}\n filterText={filterText}\n setFilterText={setFilterText}\n filterError={filterError}\n replacer={replacer}\n >\n {children}\n </SyntaxProvider>\n );\n};\n\nSyntaxRoot.displayName = SYNTAX_ROOT_NAME;\n\n//\n// Content\n//\n\nconst SYNTAX_CONTENT_NAME = 'Syntax.Content';\n\ntype SyntaxContentProps = ComposableProps;\n\n/** Flex-column layout container for composite parts. */\nconst SyntaxContent = composable<HTMLDivElement, SyntaxContentProps>(({ children, ...props }, forwardedRef) => {\n return (\n <div {...composableProps(props, { classNames: 'flex flex-col h-full min-h-0 overflow-hidden' })} ref={forwardedRef}>\n {children}\n </div>\n );\n});\n\nSyntaxContent.displayName = SYNTAX_CONTENT_NAME;\n\n//\n// Filter\n//\n\nconst SYNTAX_FILTER_NAME = 'Syntax.Filter';\n\ntype SyntaxFilterProps = ComposableProps<{\n placeholder?: string;\n}>;\n\n/** JSONPath filter input. Only meaningful when `Syntax.Root` is in JSON mode. */\nconst SyntaxFilter = forwardRef<HTMLInputElement, ScopedProps<SyntaxFilterProps>>(\n ({ __scopeSyntax, classNames, placeholder = 'JSONPath (e.g., $.graph.nodes)' }, forwardedRef) => {\n const { mode, filterText, setFilterText, filterError } = useSyntaxContext(SYNTAX_FILTER_NAME, __scopeSyntax);\n if (mode !== 'json') {\n throw new Error(`\\`${SYNTAX_FILTER_NAME}\\` requires \\`Syntax.Root\\` to be in JSON mode (pass \\`data\\`).`);\n }\n\n return (\n <Input.Root validationValence={filterError ? 'error' : 'success'}>\n <Input.TextInput\n classNames={['p-1 px-2 font-mono', filterError && 'border-rose-500', classNames]}\n variant='subdued'\n value={filterText}\n placeholder={placeholder}\n onChange={(event) => setFilterText(event.target.value)}\n ref={forwardedRef}\n />\n </Input.Root>\n );\n },\n);\n\nSyntaxFilter.displayName = SYNTAX_FILTER_NAME;\n\n//\n// Viewport\n//\n\nconst SYNTAX_VIEWPORT_NAME = 'Syntax.Viewport';\n\ntype SyntaxViewportProps = ComposableProps;\n\n/** Optional scroll wrapper. Compose around `Syntax.Code` to make it scrollable. */\nconst SyntaxViewport = composable<HTMLDivElement, SyntaxViewportProps>(({ children, ...props }, forwardedRef) => {\n return (\n <ScrollArea.Root {...composableProps(props)} thin ref={forwardedRef}>\n <ScrollArea.Viewport>{children}</ScrollArea.Viewport>\n </ScrollArea.Root>\n );\n});\n\nSyntaxViewport.displayName = SYNTAX_VIEWPORT_NAME;\n\n//\n// Code\n//\n\nconst SYNTAX_CODE_NAME = 'Syntax.Code';\n\ntype SyntaxCodeProps = ComposableProps<{\n testId?: string;\n}>;\n\n/** Highlighted code leaf. Reads source/data from `Syntax.Root` context. */\nconst SyntaxCode = composable<HTMLDivElement, ScopedProps<SyntaxCodeProps>>(\n ({ __scopeSyntax, testId, ...props }, forwardedRef) => {\n const context = useSyntaxContext(SYNTAX_CODE_NAME, __scopeSyntax);\n const merged = composableProps(props, { classNames: 'py-1 px-2 text-sm' });\n\n if (context.mode === 'json') {\n return (\n <JsonHighlighter\n {...merged}\n data={context.filteredData}\n replacer={context.replacer}\n testId={testId}\n ref={forwardedRef}\n />\n );\n }\n\n return (\n <SyntaxHighlighter {...merged} language={context.language} data-testid={testId} ref={forwardedRef}>\n {context.source ?? ''}\n </SyntaxHighlighter>\n );\n },\n);\n\nSyntaxCode.displayName = SYNTAX_CODE_NAME;\n\n//\n// Syntax\n//\n\nexport const Syntax = {\n Root: SyntaxRoot,\n Content: SyntaxContent,\n Filter: SyntaxFilter,\n Viewport: SyntaxViewport,\n Code: SyntaxCode,\n};\n\nexport { createSyntaxScope };\n\nexport type { SyntaxRootProps, SyntaxContentProps, SyntaxFilterProps, SyntaxViewportProps, SyntaxCodeProps };\n"],
5
+ "mappings": ";AAIA,OAAOA,YAAW;AAElB,SAASC,cAAAA,mBAAkB;AAC3B,SAAmCC,gBAAgBC,qBAAqB;;;ACFxE,OAAOC,mBAAmB;;;ACD1B,OAAOC,SAASC,gBAAgB;AAEhC,OAAOC,6BAA6B;AACpC,SAASC,eAAeC,MAAMC,eAAeC,aAAa;AAE1D,SAASC,WAAWC,uBAAuB;AAC3C,SAASC,YAAYC,uBAAuB;AAE5C,IAAMC,iBAAiB;AAEvB,IAAMC,YAAY;EAChBC,IAAI;EACJC,IAAI;AACN;AA8BO,IAAMC,oBAAoBN,WAC/B,CACE,EACEO,YACAC,WACAC,UACAC,MACAC,OACAC,YACAC,WAAW,QACXC,WAAWZ,gBACXa,Y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AAiBsD,kBAAkBlD,aAAAA;AACnD,QAAMsD,SAAS1B,iBAAgB7B,OAAO;IAAE8B,YAAY;EAAoB,CAAA;AAExE,MAAIwB,QAAQhC,SAAS,QAAQ;AAC3B,WACE,gBAAAF,OAAA,cAACoC,iBAAAA;MACE,GAAGD;MACJhD,MAAM+C,QAAQ3C;MACdN,UAAUiD,QAAQjD;MAClBgD;MACAtB,KAAKJ;;EAGX;AAEA,SACE,gBAAAP,OAAA,cAACqC,mBAAAA;IAAmB,GAAGF;IAAQpD,UAAUmD,QAAQnD;IAAUuD,eAAaL;IAAQtB,KAAKJ;KAClF2B,QAAQlD,UAAU,EAAA;AAGzB,CAAA;AAGFgD,WAAW7B,cAAc4B;AAMlB,IAAMQ,SAAS;EACpBrB,MAAMvC;EACN6D,SAASnC;EACToC,QAAQ5B;EACRiB,UAAUH;EACVe,MAAMV;AACR;",
6
+ "names": ["React", "composable", "createReplacer", "safeStringify", "createElement", "React", "Children", "NativeSyntaxHighlighter", "coldarkDark", "dark", "coldarkCold", "light", "Clipboard", "useThemeContext", "composable", "composableProps", "zeroWidthSpace", "languages", "js", "ts", "SyntaxHighlighter", "classNames", "className", "children", "role", "style", "themeStyle", "language", "fallback", "copyButton", "nativeProps", "forwardedRef", "themeMode", "source", "toArray", "join", "hasCustomTheme", "Object", "keys", "length", "prismTheme", "div", "ref", "customStyle", "background", "border", "boxShadow", "padding", "margin", "Provider", "IconButton", "value", "variant", "size", "displayName", "resolveReplacer", "replacer", "undefined", "createReplacer", "JsonHighlighter", "composable", "data", "indent", "testId", "props", "forwardedRef", "React", "SyntaxHighlighter", "language", "data-testid", "ref", "safeStringify", "displayName", "createContextScope", "JSONPath", "React", "forwardRef", "useMemo", "useState", "Input", "ScrollArea", "composable", "composableProps", "SYNTAX_NAME", "createSyntaxContext", "createSyntaxScope", "createContextScope", "SyntaxProvider", "useSyntaxContext", "SYNTAX_ROOT_NAME", "SyntaxRoot", "props", "__scopeSyntax", "children", "language", "source", "replacer", "isJson", "data", "filterText", "setFilterText", "useState", "filteredData", "filterError", "useMemo", "trim", "length", "JSONPath", "path", "json", "err", "React", "scope", "mode", "displayName", "SYNTAX_CONTENT_NAME", "SyntaxContent", "composable", "forwardedRef", "div", "composableProps", "classNames", "ref", "SYNTAX_FILTER_NAME", "SyntaxFilter", "forwardRef", "placeholder", "Error", "Input", "Root", "validationValence", "TextInput", "variant", "value", "onChange", "event", "target", "SYNTAX_VIEWPORT_NAME", "SyntaxViewport", "ScrollArea", "thin", "Viewport", "SYNTAX_CODE_NAME", "SyntaxCode", "testId", "context", "merged", "JsonHighlighter", "SyntaxHighlighter", "data-testid", "Syntax", "Content", "Filter", "Code"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"src/SyntaxHighlighter/SyntaxHighlighter.tsx":{"bytes":5909,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"react-syntax-highlighter/dist/esm/prism-async-light","kind":"import-statement","external":true},{"path":"react-syntax-highlighter/dist/esm/styles/prism","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"format":"esm"},"src/SyntaxHighlighter/index.ts":{"bytes":979,"imports":[{"path":"react-syntax-highlighter/dist/esm/create-element","kind":"import-statement","external":true},{"path":"src/SyntaxHighlighter/SyntaxHighlighter.tsx","kind":"import-statement","original":"./SyntaxHighlighter"}],"format":"esm"},"src/Json/Json.tsx":{"bytes":8440,"imports":[{"path":"jsonpath","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/SyntaxHighlighter/index.ts","kind":"import-statement","original":"../SyntaxHighlighter"}],"format":"esm"},"src/Json/index.ts":{"bytes":463,"imports":[{"path":"src/Json/Json.tsx","kind":"import-statement","original":"./Json"}],"format":"esm"},"src/index.ts":{"bytes":571,"imports":[{"path":"src/Json/index.ts","kind":"import-statement","original":"./Json"},{"path":"src/SyntaxHighlighter/index.ts","kind":"import-statement","original":"./SyntaxHighlighter"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":7909},"dist/lib/browser/index.mjs":{"imports":[{"path":"jsonpath","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"react-syntax-highlighter/dist/esm/create-element","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-syntax-highlighter/dist/esm/prism-async-light","kind":"import-statement","external":true},{"path":"react-syntax-highlighter/dist/esm/styles/prism","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"exports":["Json","JsonFilter","SyntaxHighlighter","createElement"],"entryPoint":"src/index.ts","inputs":{"src/Json/Json.tsx":{"bytesInOutput":2070},"src/SyntaxHighlighter/index.ts":{"bytesInOutput":78},"src/SyntaxHighlighter/SyntaxHighlighter.tsx":{"bytesInOutput":1081},"src/index.ts":{"bytesInOutput":0}},"bytes":3461}}}
1
+ {"inputs":{"src/SyntaxHighlighter/SyntaxHighlighter.tsx":{"bytes":9899,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"react-syntax-highlighter/dist/esm/prism-async-light","kind":"import-statement","external":true},{"path":"react-syntax-highlighter/dist/esm/styles/prism","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"format":"esm"},"src/SyntaxHighlighter/index.ts":{"bytes":871,"imports":[{"path":"react-syntax-highlighter/dist/esm/create-element","kind":"import-statement","external":true},{"path":"src/SyntaxHighlighter/SyntaxHighlighter.tsx","kind":"import-statement","original":"./SyntaxHighlighter"}],"format":"esm"},"src/JsonHighlighter/JsonHighlighter.tsx":{"bytes":4584,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/SyntaxHighlighter/index.ts","kind":"import-statement","original":"../SyntaxHighlighter"}],"format":"esm"},"src/JsonHighlighter/index.ts":{"bytes":395,"imports":[{"path":"src/JsonHighlighter/JsonHighlighter.tsx","kind":"import-statement","original":"./JsonHighlighter"}],"format":"esm"},"src/Syntax/Syntax.tsx":{"bytes":19872,"imports":[{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"jsonpath-plus","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"src/JsonHighlighter/index.ts","kind":"import-statement","original":"../JsonHighlighter"},{"path":"src/SyntaxHighlighter/index.ts","kind":"import-statement","original":"../SyntaxHighlighter"}],"format":"esm"},"src/Syntax/index.ts":{"bytes":370,"imports":[{"path":"src/Syntax/Syntax.tsx","kind":"import-statement","original":"./Syntax"}],"format":"esm"},"src/index.ts":{"bytes":590,"imports":[{"path":"src/JsonHighlighter/index.ts","kind":"import-statement","original":"./JsonHighlighter"},{"path":"src/Syntax/index.ts","kind":"import-statement","original":"./Syntax"},{"path":"src/SyntaxHighlighter/index.ts","kind":"import-statement","original":"./SyntaxHighlighter"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":18553},"dist/lib/browser/index.mjs":{"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"react-syntax-highlighter/dist/esm/create-element","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-syntax-highlighter/dist/esm/prism-async-light","kind":"import-statement","external":true},{"path":"react-syntax-highlighter/dist/esm/styles/prism","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"jsonpath-plus","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"exports":["JsonHighlighter","Syntax","SyntaxHighlighter","createElement","createSyntaxScope"],"entryPoint":"src/index.ts","inputs":{"src/JsonHighlighter/JsonHighlighter.tsx":{"bytesInOutput":681},"src/SyntaxHighlighter/index.ts":{"bytesInOutput":78},"src/SyntaxHighlighter/SyntaxHighlighter.tsx":{"bytesInOutput":1995},"src/index.ts":{"bytesInOutput":0},"src/Syntax/Syntax.tsx":{"bytesInOutput":4138}},"bytes":7222}}}