Skip to content

Commit

Permalink
upgrade deps && docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mayank1513 committed Dec 22, 2024
1 parent 4bbf4ad commit fd53baf
Show file tree
Hide file tree
Showing 17 changed files with 49 additions and 49 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 @@
<pre><code class="ts"><span class="hl-4">export</span><span class="hl-1"> </span><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-2">&quot;none&quot;</span><span class="hl-1">, </span><span class="hl-5">nonce</span><span class="hl-1"> = </span><span class="hl-2">&quot;&quot;</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-6">const</span><span class="hl-1"> </span><span class="hl-13">isWindowDefined</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">;</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-5">isWindowDefined</span><span class="hl-1"> &amp;&amp; !</span><span class="hl-5">window</span><span class="hl-1">.</span><span class="hl-5">q</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><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-6">const</span><span class="hl-1"> [{ </span><span class="hl-13">m</span><span class="hl-1">, </span><span class="hl-13">s</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-4">if</span><span class="hl-1"> (!</span><span class="hl-5">updateDOM</span><span class="hl-1"> &amp;&amp; </span><span class="hl-5">isWindowDefined</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">q</span><span class="hl-1">, </span><span class="hl-5">u</span><span class="hl-1">];</span><br/><span class="hl-1"> </span><span class="hl-3">/** Updating media: prefers-color-scheme*/</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/><span class="hl-1"> </span><span class="hl-0">updateDOM</span><span class="hl-1">?.(</span><span class="hl-5">m</span><span class="hl-1">, </span><span class="hl-5">s</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">, </span><span class="hl-5">t</span><span class="hl-1"> }} /&gt;;</span><br/><span class="hl-1">};</span>
</code><button type="button">Copy</button></pre>

</div></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> <a href="../interfaces/client_core_core.CoreProps.html" class="tsd-signature-type tsd-kind-interface">CoreProps</a><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/16d4a9b44e6492201ed244248b69e420eff686a9/lib/src/client/core/core.tsx#L51">client/core/core.tsx:51</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="../modules.html">React18 Loaders</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><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></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> <a href="../interfaces/client_core_core.CoreProps.html" class="tsd-signature-type tsd-kind-interface">CoreProps</a><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/4bbf4ad074aba3b4e6f7490aa683e7b026eb927f/lib/src/client/core/core.tsx#L51">client/core/core.tsx:51</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="../modules.html">React18 Loaders</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><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 fd53baf

Please sign in to comment.