Skip to content

Commit

Permalink
Merge branch 'production' of github.com:isakhauge/nanosplash into pro…
Browse files Browse the repository at this point in the history
…duction
  • Loading branch information
isakhauge committed Aug 22, 2023
2 parents 6556494 + 2be3588 commit 4981426
Show file tree
Hide file tree
Showing 15 changed files with 956 additions and 1,522 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
<html lang="en">

<head>
<title>Code coverage report for core/Nanosplash/DOMUtilities.ts</title>
<title>Code coverage report for DOMUtilities.ts</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<link rel="shortcut icon" type="image/x-icon" href="../../favicon.png" />
<link rel="stylesheet" href="prettify.css" />
<link rel="stylesheet" href="base.css" />
<link rel="shortcut icon" type="image/x-icon" href="favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
background-image: url(sort-arrow-sprite.png);
}
</style>
</head>

<body>
<div class='wrapper'>
<div class='pad1'>
<h1><a href="../../index.html">All files</a> / <a href="index.html">core/Nanosplash</a> DOMUtilities.ts</h1>
<h1><a href="index.html">All files</a> DOMUtilities.ts</h1>
<div class='clearfix'>

<div class='fl pad1y space-right2'>
Expand Down Expand Up @@ -385,7 +385,7 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">core/Nanospl
<span class="cline-any cline-yes">11x</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">// @ts-strict
&nbsp;
import { Reference, GUIDString } from '../../../types/vite-env'
import { Reference, GUIDString } from '../types/Types'
import { Service } from './Service'
import { Splash } from './Splash'
&nbsp;
Expand Down Expand Up @@ -538,7 +538,7 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">core/Nanospl
if (targetAlreadyHasNS) {
const id: GUIDString = firstChild.id
const nss = Service.getInstance()
return nss.nsStack.items.find((ns: Splash) =&gt; ns.getId() === id<span class="branch-0 cbranch-no" title="branch not covered" >) ?? null</span>
return nss.nsStack.find((ns: Splash) =&gt; ns.getId() === id<span class="branch-0 cbranch-no" title="branch not covered" >) ?? null</span>
}
&nbsp;
return null
Expand All @@ -550,16 +550,16 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">core/Nanospl
<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 2023-06-08T10:45:24.711Z
at 2023-08-21T15:58:04.262Z
</div>
<script src="../../prettify.js"></script>
<script src="prettify.js"></script>
<script>
window.onload = function () {
prettyPrint();
};
</script>
<script src="../../sorter.js"></script>
<script src="../../block-navigation.js"></script>
<script src="sorter.js"></script>
<script src="block-navigation.js"></script>
</body>
</html>

130 changes: 35 additions & 95 deletions coverage/core/Nanosplash/Service.ts.html → coverage/Service.ts.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@
<html lang="en">

<head>
<title>Code coverage report for core/Nanosplash/Service.ts</title>
<title>Code coverage report for Service.ts</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<link rel="shortcut icon" type="image/x-icon" href="../../favicon.png" />
<link rel="stylesheet" href="prettify.css" />
<link rel="stylesheet" href="base.css" />
<link rel="shortcut icon" type="image/x-icon" href="favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
background-image: url(sort-arrow-sprite.png);
}
</style>
</head>

<body>
<div class='wrapper'>
<div class='pad1'>
<h1><a href="../../index.html">All files</a> / <a href="index.html">core/Nanosplash</a> Service.ts</h1>
<h1><a href="index.html">All files</a> Service.ts</h1>
<div class='clearfix'>

<div class='fl pad1y space-right2'>
<span class="strong">99.59% </span>
<span class="strong">99.55% </span>
<span class="quiet">Statements</span>
<span class='fraction'>244/245</span>
<span class='fraction'>224/225</span>
</div>


Expand All @@ -44,9 +44,9 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">core/Nanospl


<div class='fl pad1y space-right2'>
<span class="strong">99.59% </span>
<span class="strong">99.55% </span>
<span class="quiet">Lines</span>
<span class='fraction'>244/245</span>
<span class='fraction'>224/225</span>
</div>


Expand Down Expand Up @@ -288,27 +288,7 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">core/Nanospl
<a name='L223'></a><a href='#L223'>223</a>
<a name='L224'></a><a href='#L224'>224</a>
<a name='L225'></a><a href='#L225'>225</a>
<a name='L226'></a><a href='#L226'>226</a>
<a name='L227'></a><a href='#L227'>227</a>
<a name='L228'></a><a href='#L228'>228</a>
<a name='L229'></a><a href='#L229'>229</a>
<a name='L230'></a><a href='#L230'>230</a>
<a name='L231'></a><a href='#L231'>231</a>
<a name='L232'></a><a href='#L232'>232</a>
<a name='L233'></a><a href='#L233'>233</a>
<a name='L234'></a><a href='#L234'>234</a>
<a name='L235'></a><a href='#L235'>235</a>
<a name='L236'></a><a href='#L236'>236</a>
<a name='L237'></a><a href='#L237'>237</a>
<a name='L238'></a><a href='#L238'>238</a>
<a name='L239'></a><a href='#L239'>239</a>
<a name='L240'></a><a href='#L240'>240</a>
<a name='L241'></a><a href='#L241'>241</a>
<a name='L242'></a><a href='#L242'>242</a>
<a name='L243'></a><a href='#L243'>243</a>
<a name='L244'></a><a href='#L244'>244</a>
<a name='L245'></a><a href='#L245'>245</a>
<a name='L246'></a><a href='#L246'>246</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
<a name='L226'></a><a href='#L226'>226</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
Expand Down Expand Up @@ -383,10 +363,6 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">core/Nanospl
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">8x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
Expand Down Expand Up @@ -478,9 +454,6 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">core/Nanospl
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">3x</span>
Expand All @@ -493,10 +466,6 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">core/Nanospl
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">8x</span>
<span class="cline-any cline-yes">8x</span>
<span class="cline-any cline-yes">7x</span>
Expand All @@ -514,8 +483,6 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">core/Nanospl
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
Expand All @@ -525,7 +492,6 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">core/Nanospl
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
Expand All @@ -535,9 +501,6 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">core/Nanospl
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">2x</span>
Expand All @@ -550,23 +513,20 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">core/Nanospl
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">// @ts-strict
&nbsp;
import { NSFinder, GUIDString, Reference } from '../../../types/vite-env'
import Stack from '../../util/Stack'
import '../../sass/ns.sass'
&nbsp;
import { NSFinder, GUIDString, Reference } from '../types/Types'
import {
cleanNSParentOf,
getRecycledNS,
move,
elementFrom,
} from './DOMUtilities'
import { ServiceInterface } from './ServiceInterface'
import { Splash } from './Splash'
&nbsp;
import '../../../sass/ns.sass'
&nbsp;
/**
* # Service
* A service class that handles Nanosplash instances.
Expand All @@ -575,7 +535,7 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">core/Nanospl
* @see Splash
* @author Isak K. Hauge &lt;isakhauge@icloud.com&gt;
*/
export class Service {
export class Service implements ServiceInterface {
/**
* # Window Accessor Key
* Key to access NanosplashService instance in the Window object.
Expand All @@ -589,21 +549,17 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">core/Nanospl
private static instance: Service
&nbsp;
/**
* # Nanosplash Stack
* For each Nanosplash instance created, it's pushed to the stack.
* When a Nanosplash instance is removed, it's removed from the stack.
* @see Stack
* @see Splash
* @inheritdoc
*/
public readonly nsStack: Stack&lt;Splash&gt;
public nsStack: Splash[]
&nbsp;
/**
* # Constructor
* Private constructor to prevent multiple instances.
* @private
*/
private constructor() {
this.nsStack = new Stack&lt;Splash&gt;()
this.nsStack = []
}
&nbsp;
/**
Expand All @@ -613,7 +569,7 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">core/Nanospl
* @returns {number} Index of Nanosplash instance in the stack or -1.
*/
private findIndex(callback: NSFinder): number | -1 {
return this.nsStack.items.findIndex(callback)
return this.nsStack.findIndex(callback)
}
&nbsp;
/**
Expand All @@ -623,7 +579,7 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">core/Nanospl
* @returns {Splash | undefined} Nanosplash instance or undefined
*/
private find(callback: NSFinder): Splash | undefined {
return this.nsStack.items.find(callback)
return this.nsStack.find(callback)
}
&nbsp;
/**
Expand Down Expand Up @@ -700,13 +656,13 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">core/Nanospl
private stackDelete(ns: Splash): GUIDString | null {
let index = this.findIndex((o: Splash) =&gt; o.getId() === ns.getId())
if (index &lt; 0) <span class="branch-0 cbranch-no" title="branch not covered" >return null</span>
this.nsStack.items.splice(index, 1)
this.nsStack.splice(index, 1)
return ns.getId()
}
&nbsp;
/**
* # Delete NS
* Remove Nanosplash instance from both the stack and the DOM.
* Remove Nanosplash instance from both the stack and the
* @param callback Callback function.
* @returns {GUIDString | null} Nanosplash ID or null if it doesn't exist.
*/
Expand All @@ -720,10 +676,7 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">core/Nanospl
}
&nbsp;
/**
* # Show
* Present a Nanosplash in the browser window displaying the given text.
* @param text Text to display.
* @returns {GUIDString} Nanosplash ID.
* @inheritdoc
*/
public show(text?: string): GUIDString {
let ns = getRecycledNS(document.body)
Expand All @@ -735,11 +688,7 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">core/Nanospl
}
&nbsp;
/**
* # Show Inside
* Present a Nanosplash over the given element displaying the given text.
* @param ref Reference an element.
* @param text Text to display.
* @returns {GUIDString | null} Nanosplash ID or null if it doesn't exist.
* @inheritdoc
*/
public showInside(ref: Reference, text?: string): GUIDString | null {
const destinationNode: Element | null = elementFrom(ref)
Expand All @@ -756,41 +705,32 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">core/Nanospl
}
&nbsp;
/**
* # Hide
* Hide the last created Nanosplash.
* @returns {GUIDString | null} Nanosplash ID or null if it doesn't exist.
* @inheritdoc
*/
public hide(): GUIDString | null {
const ns = this.nsStack.pop()
return ns ? this.cleanAndRemove(ns<span class="branch-0 cbranch-no" title="branch not covered" >) : null</span>
}
&nbsp;
/**
* # Hide All
* Hide all Nanosplashes.
* @inheritdoc
*/
public hideAll(): void {
this.nsStack.items.forEach((ns: Splash) =&gt; {
this.nsStack.forEach((ns: Splash) =&gt; {
this.cleanAndRemove(ns)
})
this.nsStack.clear()
this.nsStack = []
}
&nbsp;
/**
* # Hide ID
* Hide Nanosplash by its ID.
* @param id Nanosplash ID.
* @returns {GUIDString | null} Nanosplash ID or null if it doesn't exist.
* @inheritdoc
*/
public hideId(id: GUIDString): GUIDString | null {
return this.deleteNS((ns: Splash) =&gt; ns.getId() === id)
}
&nbsp;
/**
* # Hide Inside
* Hide Nanosplash inside the given element if it exists.
* @param ref Reference an element.
* @returns {GUIDString | null} Nanosplash ID or null if it doesn't exist.
* @inheritdoc
*/
public hideInside(ref: Reference): GUIDString | null {
const node = elementFrom(ref)
Expand All @@ -805,16 +745,16 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">core/Nanospl
<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 2023-06-08T10:45:24.711Z
at 2023-08-21T15:58:04.262Z
</div>
<script src="../../prettify.js"></script>
<script src="prettify.js"></script>
<script>
window.onload = function () {
prettyPrint();
};
</script>
<script src="../../sorter.js"></script>
<script src="../../block-navigation.js"></script>
<script src="sorter.js"></script>
<script src="block-navigation.js"></script>
</body>
</html>

Loading

0 comments on commit 4981426

Please sign in to comment.