All files / lib lite.js

100% Statements 67/67
100% Branches 3/3
100% Functions 0/0
100% Lines 67/67

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 683x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 1x 1x 1x 1x 1x 1x 3x 3x 3x 3x 3x 1x 1x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x  
import createTree from './tree/create';
import internals from './util/internals';
import { $$diffHTML } from './util/symbols';
import globalThis from './util/global';
import innerHTML from './inner-html';
import outerHTML from './outer-html';
import release from './release';
import use from './use';
import { addTransitionState, removeTransitionState } from './transition';
import { __VERSION__ } from './version';
 
const { assign } = Object;
const VERSION = `${__VERSION__}-lite`;
 
// Exposes the Internal APIs which may change. Once this project reaches a
// stable version, this will only be able to break between major versions.
assign(internals, {
  VERSION,
});
 
const api = {};
 
api.VERSION = VERSION;
api.addTransitionState = addTransitionState;
api.removeTransitionState = removeTransitionState;
api.release = release;
api.createTree = createTree;
api.use = use;
api.outerHTML = outerHTML;
api.innerHTML = innerHTML;
api.html = createTree;
api.Internals = internals;
 
/** @type {any} */
const global = globalThis;
 
// Bind the API into the global scope. Allows middleware and other code to
// reference the core API.
if ($$diffHTML in globalThis) {
  const existingApi = global[$$diffHTML];
 
  if (VERSION !== existingApi.VERSION) {
    console.log(`Loaded ${VERSION} after ${existingApi.VERSION}`);
  }
}
 
global[$$diffHTML] = api;
 
// Automatically hook up to DevTools if they are present.
if (global.devTools) {
  global.unsubscribeDevTools = use(global.devTools(internals));
}
 
export {
  VERSION,
  addTransitionState,
  removeTransitionState,
  release,
  createTree,
  use,
  outerHTML,
  innerHTML,
  createTree as html,
  internals as Internals,
};
 
export default api;