Skip to content

Commit

Permalink
fix: add support for react < 18 with custom useId hook. #53 dddd7f0
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Sep 3, 2024
1 parent 6b79bfc commit 8d3cb6d
Show file tree
Hide file tree
Showing 77 changed files with 286 additions and 153 deletions.
6 changes: 3 additions & 3 deletions asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"files": {
"main.css": "/static/css/main.0da2652e.css",
"main.js": "/static/js/main.c64b9934.js",
"main.js": "/static/js/main.10a5a4be.js",
"refractor-prismjs-vendor.0abbb2f3.js": "/static/js/refractor-prismjs-vendor.0abbb2f3.4ed442e7.js",
"react-vendor.js": "/static/js/react-vendor.03814a95.js",
"refractor-prismjs-vendor.3665b250.js": "/static/js/refractor-prismjs-vendor.3665b250.eec550b5.js",
"refractor-prismjs-vendor.a81a7d65.js": "/static/js/refractor-prismjs-vendor.a81a7d65.e53936ae.js",
"index.html": "/index.html",
"main.0da2652e.css.map": "/static/css/main.0da2652e.css.map",
"main.c64b9934.js.map": "/static/js/main.c64b9934.js.map",
"main.10a5a4be.js.map": "/static/js/main.10a5a4be.js.map",
"refractor-prismjs-vendor.0abbb2f3.4ed442e7.js.map": "/static/js/refractor-prismjs-vendor.0abbb2f3.4ed442e7.js.map",
"react-vendor.03814a95.js.map": "/static/js/react-vendor.03814a95.js.map",
"refractor-prismjs-vendor.3665b250.eec550b5.js.map": "/static/js/refractor-prismjs-vendor.3665b250.eec550b5.js.map",
Expand All @@ -20,6 +20,6 @@
"static/js/refractor-prismjs-vendor.0abbb2f3.4ed442e7.js",
"static/js/react-vendor.03814a95.js",
"static/css/main.0da2652e.css",
"static/js/main.c64b9934.js"
"static/js/main.10a5a4be.js"
]
}
16 changes: 8 additions & 8 deletions badges.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><meta name="keywords" content="react,react-component,array-viewer,base-16,component,interactive,interactive-json,json,json-component,json-display,json-tree,json-view,json-viewer,json-inspector,json-tree,react,react-component,react-json,theme,tree,tree-view,treeview,jaywcjlove"><meta name="description" content="A React component for displaying and editing javascript arrays and JSON objects."><link rel="shortcut icon" href="/favicon.ico"><title>react-json-view</title><script defer="defer" src="./static/js/refractor-prismjs-vendor.3665b250.eec550b5.js"></script><script defer="defer" src="./static/js/refractor-prismjs-vendor.a81a7d65.e53936ae.js"></script><script defer="defer" src="./static/js/refractor-prismjs-vendor.0abbb2f3.4ed442e7.js"></script><script defer="defer" src="./static/js/react-vendor.03814a95.js"></script><script defer="defer" src="./static/js/main.c64b9934.js"></script><link href="./static/css/main.0da2652e.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><meta name="keywords" content="react,react-component,array-viewer,base-16,component,interactive,interactive-json,json,json-component,json-display,json-tree,json-view,json-viewer,json-inspector,json-tree,react,react-component,react-json,theme,tree,tree-view,treeview,jaywcjlove"><meta name="description" content="A React component for displaying and editing javascript arrays and JSON objects."><link rel="shortcut icon" href="/favicon.ico"><title>react-json-view</title><script defer="defer" src="./static/js/refractor-prismjs-vendor.3665b250.eec550b5.js"></script><script defer="defer" src="./static/js/refractor-prismjs-vendor.a81a7d65.e53936ae.js"></script><script defer="defer" src="./static/js/refractor-prismjs-vendor.0abbb2f3.4ed442e7.js"></script><script defer="defer" src="./static/js/react-vendor.03814a95.js"></script><script defer="defer" src="./static/js/main.10a5a4be.js"></script><link href="./static/css/main.0da2652e.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
32 changes: 16 additions & 16 deletions lcov-report/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,30 @@ <h1>All files</h1>
<div class='clearfix'>

<div class='fl pad1y space-right2'>
<span class="strong">92.56% </span>
<span class="strong">92.59% </span>
<span class="quiet">Statements</span>
<span class='fraction'>759/820</span>
<span class='fraction'>763/824</span>
</div>


<div class='fl pad1y space-right2'>
<span class="strong">76.37% </span>
<span class="strong">76.46% </span>
<span class="quiet">Branches</span>
<span class='fraction'>443/580</span>
<span class='fraction'>445/582</span>
</div>


<div class='fl pad1y space-right2'>
<span class="strong">83.57% </span>
<span class="strong">83.68% </span>
<span class="quiet">Functions</span>
<span class='fraction'>117/140</span>
<span class='fraction'>118/141</span>
</div>


<div class='fl pad1y space-right2'>
<span class="strong">92.57% </span>
<span class="strong">92.61% </span>
<span class="quiet">Lines</span>
<span class='fraction'>723/781</span>
<span class='fraction'>727/785</span>
</div>


Expand Down Expand Up @@ -110,17 +110,17 @@ <h1>All files</h1>

<tr>
<td class="file high" data-value="src/comps"><a href="src/comps/index.html">src/comps</a></td>
<td data-value="90.06" class="pic high">
<td data-value="90.3" class="pic high">
<div class="chart"><div class="cover-fill" style="width: 90%"></div><div class="cover-empty" style="width: 10%"></div></div>
</td>
<td data-value="90.3" class="pct high">90.3%</td>
<td data-value="165" class="abs high">149/165</td>
<td data-value="86.48" class="pct high">86.48%</td>
<td data-value="148" class="abs high">128/148</td>
<td data-value="82.6" class="pct high">82.6%</td>
<td data-value="23" class="abs high">19/23</td>
<td data-value="90.06" class="pct high">90.06%</td>
<td data-value="161" class="abs high">145/161</td>
<td data-value="86.3" class="pct high">86.3%</td>
<td data-value="146" class="abs high">126/146</td>
<td data-value="81.81" class="pct high">81.81%</td>
<td data-value="22" class="abs high">18/22</td>
<td data-value="89.8" class="pct high">89.8%</td>
<td data-value="157" class="abs high">141/157</td>
</tr>

<tr>
Expand Down Expand Up @@ -236,7 +236,7 @@ <h1>All files</h1>
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2024-08-06T02:10:57.523Z
at 2024-09-03T03:50:35.383Z
</div>
<script src="prettify.js"></script>
<script>
Expand Down
11 changes: 7 additions & 4 deletions lcov-report/src/Container.tsx.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ <h1><a href="../index.html">All files</a> / <a href="index.html">src</a> Contain
<a name='L59'></a><a href='#L59'>59</a>
<a name='L60'></a><a href='#L60'>60</a>
<a name='L61'></a><a href='#L61'>61</a>
<a name='L62'></a><a href='#L62'>62</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<a name='L62'></a><a href='#L62'>62</a>
<a name='L63'></a><a href='#L63'>63</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
Expand Down Expand Up @@ -185,10 +187,11 @@ <h1><a href="../index.html">All files</a> / <a href="index.html">src</a> Contain
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">22x</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import React, { forwardRef, useId } from 'react';
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import React, { forwardRef } from 'react';
import { NestedClose } from './comps/NestedClose';
import { NestedOpen } from './comps/NestedOpen';
import { KeyValues } from './comps/KeyValues';
import { useIdCompat } from './comps/useIdCompat';
import { useShowToolsDispatch } from './store/ShowTools';
&nbsp;
export interface ContainerProps&lt;T extends object&gt; extends React.HTMLAttributes&lt;HTMLDivElement&gt; {
Expand All @@ -215,7 +218,7 @@ <h1><a href="../index.html">All files</a> / <a href="index.html">src</a> Contain
...elmProps
} = props;
const dispatch = useShowToolsDispatch();
const subkeyid = useId();
const subkeyid = useIdCompat();
const defaultClassNames = [className, 'w-rjv-inner'].filter(Boolean).join(' ');
const reset: React.HTMLAttributes&lt;HTMLDivElement&gt; = {
onMouseEnter: () =&gt; dispatch({ [subkeyid]: true }),
Expand Down Expand Up @@ -253,7 +256,7 @@ <h1><a href="../index.html">All files</a> / <a href="index.html">src</a> Contain
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2024-08-06T02:10:57.523Z
at 2024-09-03T03:50:35.383Z
</div>
<script src="../prettify.js"></script>
<script>
Expand Down
2 changes: 1 addition & 1 deletion lcov-report/src/arrow/TriangleArrow.tsx.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">src/arrow</a
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2024-08-06T02:10:57.523Z
at 2024-09-03T03:50:35.383Z
</div>
<script src="../../prettify.js"></script>
<script>
Expand Down
2 changes: 1 addition & 1 deletion lcov-report/src/arrow/TriangleSolidArrow.tsx.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">src/arrow</a
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2024-08-06T02:10:57.523Z
at 2024-09-03T03:50:35.383Z
</div>
<script src="../../prettify.js"></script>
<script>
Expand Down
2 changes: 1 addition & 1 deletion lcov-report/src/arrow/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ <h1><a href="../../index.html">All files</a> src/arrow</h1>
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2024-08-06T02:10:57.523Z
at 2024-09-03T03:50:35.383Z
</div>
<script src="../../prettify.js"></script>
<script>
Expand Down
2 changes: 1 addition & 1 deletion lcov-report/src/comps/Copied.tsx.html
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">src/comps</a
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2024-08-06T02:10:57.523Z
at 2024-09-03T03:50:35.383Z
</div>
<script src="../../prettify.js"></script>
<script>
Expand Down
11 changes: 7 additions & 4 deletions lcov-report/src/comps/KeyValues.tsx.html
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,9 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">src/comps</a
<a name='L119'></a><a href='#L119'>119</a>
<a name='L120'></a><a href='#L120'>120</a>
<a name='L121'></a><a href='#L121'>121</a>
<a name='L122'></a><a href='#L122'>122</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<a name='L122'></a><a href='#L122'>122</a>
<a name='L123'></a><a href='#L123'>123</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
Expand Down Expand Up @@ -305,7 +307,7 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">src/comps</a
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">22x</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import { Fragment, useId, useRef } from 'react';
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import { Fragment, useRef } from 'react';
import { useStore } from '../store';
import { useExpandsStore } from '../store/Expands';
import { useShowToolsDispatch } from '../store/ShowTools';
Expand All @@ -317,6 +319,7 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">src/comps</a
import { useHighlight } from '../utils/useHighlight';
import { type SectionElementResult } from '../store/Section';
import { Copied } from '../comps/Copied';
import { useIdCompat } from '../comps/useIdCompat';
&nbsp;
interface KeyValuesProps&lt;T extends object&gt; extends SectionElementResult&lt;T&gt; {
expandKey?: string;
Expand Down Expand Up @@ -391,7 +394,7 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">src/comps</a
export const KeyValuesItem = &lt;T extends object&gt;(props: KeyValuesProps&lt;T&gt;) =&gt; {
const { keyName, value, parentValue, level = <span class="branch-0 cbranch-no" title="branch not covered" >0,</span> keys = <span class="branch-0 cbranch-no" title="branch not covered" >[] </span>} = props;
const dispatch = useShowToolsDispatch();
const subkeyid = useId();
const subkeyid = useIdCompat();
const isMyArray = Array.isArray(value);
const isMySet = value instanceof Set;
const isMyMap = value instanceof Map;
Expand Down Expand Up @@ -433,7 +436,7 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">src/comps</a
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2024-08-06T02:10:57.523Z
at 2024-09-03T03:50:35.383Z
</div>
<script src="../../prettify.js"></script>
<script>
Expand Down
2 changes: 1 addition & 1 deletion lcov-report/src/comps/NestedClose.tsx.html
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">src/comps</a
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2024-08-06T02:10:57.523Z
at 2024-09-03T03:50:35.383Z
</div>
<script src="../../prettify.js"></script>
<script>
Expand Down
2 changes: 1 addition & 1 deletion lcov-report/src/comps/NestedOpen.tsx.html
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">src/comps</a
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2024-08-06T02:10:57.523Z
at 2024-09-03T03:50:35.383Z
</div>
<script src="../../prettify.js"></script>
<script>
Expand Down
2 changes: 1 addition & 1 deletion lcov-report/src/comps/Value.tsx.html
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">src/comps</a
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2024-08-06T02:10:57.523Z
at 2024-09-03T03:50:35.383Z
</div>
<script src="../../prettify.js"></script>
<script>
Expand Down
Loading

0 comments on commit 8d3cb6d

Please sign in to comment.