Skip to content

Commit

Permalink
upgrade deps && docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mayank1513 committed Jul 3, 2024
1 parent a9b096f commit bbada81
Show file tree
Hide file tree
Showing 24 changed files with 71 additions and 71 deletions.
2 changes: 1 addition & 1 deletion docs/functions/client_core_core.Core.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ <h4 class="tsd-anchor-link"><a id="Source" class="tsd-anchor"></a>Source<a href=
<pre><code class="typescript"><span class="hl-6">const</span><span class="hl-1"> </span><span class="hl-0">Core</span><span class="hl-1"> = ({ </span><span class="hl-5">t</span><span class="hl-1">, </span><span class="hl-5">nonce</span><span class="hl-1">, </span><span class="hl-5">k</span><span class="hl-1"> = </span><span class="hl-2">&quot;o&quot;</span><span class="hl-1"> }: </span><span class="hl-8">CoreProps</span><span class="hl-1">) </span><span class="hl-6">=&gt;</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">// handle client side exceptions when script is not run. &lt;- for client side apps like vite or CRA</span><br/><span class="hl-1"> </span><span class="hl-4">if</span><span class="hl-1"> (</span><span class="hl-6">typeof</span><span class="hl-1"> </span><span class="hl-5">window</span><span class="hl-1"> !== </span><span class="hl-2">&quot;undefined&quot;</span><span class="hl-1"> &amp;&amp; !</span><span class="hl-5">window</span><span class="hl-1">.</span><span class="hl-5">m</span><span class="hl-1">) </span><span class="hl-0">noFOUCScript</span><span class="hl-1">(</span><span class="hl-5">k</span><span class="hl-1">);</span><br/><br/><span class="hl-1"> </span><span class="hl-6">const</span><span class="hl-1"> [{ </span><span class="hl-5">m</span><span class="hl-1">: </span><span class="hl-13">mode</span><span class="hl-1">, </span><span class="hl-5">s</span><span class="hl-1">: </span><span class="hl-13">systemMode</span><span class="hl-1"> }, </span><span class="hl-13">setThemeState</span><span class="hl-1">] = </span><span class="hl-0">useStore</span><span class="hl-1">();</span><br/><br/><span class="hl-1"> </span><span class="hl-0">useEffect</span><span class="hl-1">(() </span><span class="hl-6">=&gt;</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-3">// store global functions to local variables to avoid any interference</span><br/><span class="hl-1"> [</span><span class="hl-5">media</span><span class="hl-1">, </span><span class="hl-5">updateDOM</span><span class="hl-1">] = [</span><span class="hl-5">m</span><span class="hl-1">, </span><span class="hl-5">u</span><span class="hl-1">];</span><br/><span class="hl-1"> </span><br/><span class="hl-1"> </span><span class="hl-5">media</span><span class="hl-1">.</span><span class="hl-0">addEventListener</span><span class="hl-1">(</span><span class="hl-2">&quot;change&quot;</span><span class="hl-1">, () </span><span class="hl-6">=&gt;</span><br/><span class="hl-1"> </span><span class="hl-0">setThemeState</span><span class="hl-1">(</span><span class="hl-5">state</span><span class="hl-1"> </span><span class="hl-6">=&gt;</span><span class="hl-1"> ({ ...</span><span class="hl-5">state</span><span class="hl-1">, </span><span class="hl-5">s:</span><span class="hl-1"> </span><span class="hl-5">media</span><span class="hl-1">.</span><span class="hl-5">matches</span><span class="hl-1"> ? </span><span class="hl-13">DARK</span><span class="hl-1"> : </span><span class="hl-13">LIGHT</span><span class="hl-1"> })),</span><br/><span class="hl-1"> );</span><br/><span class="hl-1"> </span><span class="hl-3">/** Sync the tabs */</span><br/><span class="hl-1"> </span><span class="hl-0">addEventListener</span><span class="hl-1">(</span><span class="hl-2">&quot;storage&quot;</span><span class="hl-1">, (</span><span class="hl-5">e</span><span class="hl-1">: </span><span class="hl-8">StorageEvent</span><span class="hl-1">): </span><span class="hl-8">void</span><span class="hl-1"> </span><span class="hl-6">=&gt;</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-5">e</span><span class="hl-1">.</span><span class="hl-5">key</span><span class="hl-1"> === </span><span class="hl-5">k</span><span class="hl-1"> &amp;&amp; </span><span class="hl-0">setThemeState</span><span class="hl-1">(</span><span class="hl-5">state</span><span class="hl-1"> </span><span class="hl-6">=&gt;</span><span class="hl-1"> ({ ...</span><span class="hl-5">state</span><span class="hl-1">, </span><span class="hl-5">m:</span><span class="hl-1"> </span><span class="hl-5">e</span><span class="hl-1">.</span><span class="hl-5">newValue</span><span class="hl-1"> </span><span class="hl-4">as</span><span class="hl-1"> </span><span class="hl-8">ColorSchemePreference</span><span class="hl-1"> }));</span><br/><span class="hl-1"> });</span><br/><span class="hl-1"> }, []);</span><br/><br/><span class="hl-1"> </span><span class="hl-0">useEffect</span><span class="hl-1">(() </span><span class="hl-6">=&gt;</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-6">const</span><span class="hl-1"> </span><span class="hl-13">restoreTransitions</span><span class="hl-1"> = </span><span class="hl-0">modifyTransition</span><span class="hl-1">(</span><span class="hl-5">t</span><span class="hl-1">, </span><span class="hl-5">nonce</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-0">updateDOM</span><span class="hl-1">(</span><span class="hl-5">mode</span><span class="hl-1">, </span><span class="hl-5">systemMode</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-0">restoreTransitions</span><span class="hl-1">();</span><br/><span class="hl-1"> }, [</span><span class="hl-5">systemMode</span><span class="hl-1">, </span><span class="hl-5">mode</span><span class="hl-1">, </span><span class="hl-5">t</span><span class="hl-1">, </span><span class="hl-5">nonce</span><span class="hl-1">]);</span><br/><br/><span class="hl-1"> </span><span class="hl-4">return</span><span class="hl-1"> &lt;</span><span class="hl-8">Script</span><span class="hl-1"> {...{ </span><span class="hl-5">n</span><span class="hl-1">: </span><span class="hl-8">nonce</span><span class="hl-1">, </span><span class="hl-5">k</span><span class="hl-1"> }} /&gt;;</span><br/><span class="hl-1">}</span>
</code><button type="button">Copy</button></pre>

</div></section><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="Core" class="tsd-anchor"></a><span class="tsd-kind-call-signature">Core</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">__namedParameters</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Element</span><a href="#Core" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">__namedParameters</span>: <a href="../interfaces/client_core_core.CoreProps.html" class="tsd-signature-type tsd-kind-interface">CoreProps</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Element</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/react18-tools/nextjs-darkmode/blob/8acc7ccdc29d36018f837cf6f63a2483886b18bc/lib/src/client/core/core.tsx#L67">client/core/core.tsx:67</a></li></ul></aside></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>React18 Loaders</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
</div></section><section class="tsd-panel"><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="Core" class="tsd-anchor"></a><span class="tsd-kind-call-signature">Core</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">__namedParameters</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Element</span><a href="#Core" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">__namedParameters</span>: <a href="../interfaces/client_core_core.CoreProps.html" class="tsd-signature-type tsd-kind-interface">CoreProps</a></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Element</span></h4><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/react18-tools/nextjs-darkmode/blob/a9b096f081d10493624402566fd201f5ebf94623/lib/src/client/core/core.tsx#L67">client/core/core.tsx:67</a></li></ul></aside></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>React18 Loaders</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
Loading

0 comments on commit bbada81

Please sign in to comment.