From d430c4b4dd83d1345aebb53fbab817949ce44ed0 Mon Sep 17 00:00:00 2001 From: Okiki Date: Sat, 24 Apr 2021 08:59:52 +0000 Subject: [PATCH 1/5] chore: build library files --- demo/js/animate.js.map | 4 ++-- demo/js/main.js | 4 ++-- demo/js/main.js.map | 6 +++--- demo/js/toArr.js | 2 ++ demo/js/toArr.js.map | 7 +++++++ packages/animate/lib/api.cjs.js | 2 +- packages/animate/lib/api.cjs.js.map | 4 ++-- packages/animate/lib/api.es.js | 2 +- packages/animate/lib/api.es.js.map | 4 ++-- packages/animate/lib/api.js | 2 +- packages/animate/lib/api.js.map | 4 ++-- packages/native/lib/api.cjs.js | 4 ++-- packages/native/lib/api.cjs.js.map | 4 ++-- packages/native/lib/api.es.js | 4 ++-- packages/native/lib/api.es.js.map | 4 ++-- packages/native/lib/api.js | 4 ++-- packages/native/lib/api.js.map | 4 ++-- 17 files changed, 37 insertions(+), 28 deletions(-) create mode 100644 demo/js/toArr.js create mode 100644 demo/js/toArr.js.map diff --git a/demo/js/animate.js.map b/demo/js/animate.js.map index a3812b0..642600c 100644 --- a/demo/js/animate.js.map +++ b/demo/js/animate.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["packages/manager/src/api.ts", "packages/native/src/page.ts", "packages/emitter/src/api.ts", "packages/animate/src/api.ts", "build/ts/animate.ts"], - "sourcesContent": ["/** Manages complex lists of named data, eg. A page can be stored in a list by of other pages with the url being how the page is stored in the list. Managers use Maps to store data */\nexport class Manager {\n\t/** The complex list of named data, to which the Manager controls */\n\tpublic map: Map;\n\tconstructor(value?: Array<[K, V]>) {\n\t\tthis.map = new Map(value);\n\t}\n\n\t/** Returns the Manager classes base Map */\n\tpublic getMap(): Map {\n\t\treturn this.map;\n\t}\n\n\t/** Get a value stored in the Manager */\n\tpublic get(key: K): V {\n\t\treturn this.map.get(key);\n\t}\n\n\t/** Returns the keys of all items stored in the Manager as an Array */\n\tpublic keys(): Array {\n\t\treturn Array.from(this.map.keys());\n\t}\n\n\t/** Returns the values of all items stored in the Manager as an Array */\n\tpublic values(): Array {\n\t\treturn Array.from(this.map.values());\n\t}\n\n\t/** Set a value to the Manager using a key */\n\tpublic set(key: K, value: V): Manager {\n\t\tthis.map.set(key, value);\n\t\treturn this;\n\t}\n\n\t/** Adds a value to Manager, and uses the current size of the Manager as it's key, it works best when all the key in the Manager are numbers */\n\tpublic add(value: V): Manager {\n\t\tlet size = this.size;\n\t\t// @ts-ignore\n\t\tlet num: K = size as K;\n\t\tthis.set(num, value);\n\t\treturn this;\n\t}\n\n\t/** Returns the total number of items stored in the Manager */\n\tpublic get size(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** An alias for size */\n\tpublic get length(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** Returns the last item in the Manager who's index is a certain distance from the last item in the Manager */\n\tpublic last(distance: number = 1): V | undefined {\n\t\tlet key = this.keys()[this.size - distance];\n\t\treturn this.get(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns true if an element in the Map object existed and has been removed, or false if the element does not exist */\n\tpublic delete(key: K): boolean {\n\t\treturn this.map.delete(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns the Manager class, allowing for chains */\n\tpublic remove(key: K): Manager {\n\t\tthis.map.delete(key);\n\t\treturn this;\n\t}\n\n\t/** Clear the Manager of all its contents */\n\tpublic clear(): Manager {\n\t\tthis.map.clear();\n\t\treturn this;\n\t}\n\n\t/** Checks if the Manager contains a certain key */\n\tpublic has(key: K): boolean {\n\t\treturn this.map.has(key);\n\t}\n\n\t/** Returns a new Iterator object that contains an array of [key, value] for each element in the Map object in insertion order. */\n\tpublic entries(): IterableIterator<[K, V]> {\n\t\treturn this.map.entries();\n\t}\n\n\t/** Iterates through the Managers contents, calling a callback function every iteration */\n\tpublic forEach(\n\t\tcallback: (value?: V, key?: K, map?: Map) => void,\n\t\tcontext?: object\n\t): Manager {\n\t\tthis.map.forEach(callback, context);\n\t\treturn this;\n\t}\n\n\t/** Allows for iteration via for..of, learn more: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators] */\n\tpublic [Symbol.iterator](): IterableIterator<[K, V]> {\n\t\treturn this.entries();\n\t}\n}\n\n/**\n * Calls the method of a certain name for all items that are currently installed\n */\nexport const methodCall = (manager: Manager, method: string, ...args: any): void => {\n\tmanager.forEach((item) => {\n\t\t// @ts-ignore\n\t\titem[method](...args);\n\t});\n};\n\n/**\n * Asynchronously calls the method of a certain name for all items that are currently installed, similar to methodCall\n */\nexport const asyncMethodCall = async (manager: Manager, method: string, ...args: any): Promise => {\n\tfor (let [, item] of manager) {\n\t\t// @ts-ignore\n\t\tawait item[method](...args);\n\t}\n};\n\nexport default Manager;\n", "import { Manager, ManagerItem, AdvancedManager } from \"./manager\";\nimport { equal, newURL } from \"./url\";\nimport { getConfig } from \"./config\";\nimport { Service } from \"./service\";\n\nexport interface IPage extends ManagerItem {\n dom: Document,\n wrapper: HTMLElement,\n title: string,\n head: Element,\n body: Element,\n url: URL,\n data: string,\n wrapperAttr: string,\n\n build(): any,\n install(): void,\n uninstall(): any,\n}\n\n/**\n * Parses strings to DOM\n */\nexport const PARSER: DOMParser = new DOMParser();\n\n/** A page represents the DOM elements that create each page */\nexport class Page extends ManagerItem implements IPage {\n /** Holds the DOM of the current page */\n public dom: Document;\n\n /** Holds the wrapper element to be swapped out of each Page */\n public wrapper: HTMLElement;\n\n /** Holds the title of each page */\n public title: string;\n\n /** Holds the head element of each page */\n public head: Element;\n\n /** Holds the body element of each page */\n public body: Element;\n\n /** The URL of the current page */\n public url: URL;\n\n /** The payload of a page request */\n public data: string;\n\n /** Attr that identifies the wrapper */\n public wrapperAttr: string;\n\n constructor(url: URL = newURL(), dom: string | Document = document) {\n super();\n this.url = url;\n\n if (typeof dom === \"string\") {\n this.data = dom;\n } else this.dom = dom || document;\n }\n\n /** Builds the page's dom, and sets the title, head, body, and wrapper properties of the Page class */\n public build() {\n if (!(this.dom instanceof Node)) {\n this.dom = PARSER.parseFromString(this.data, \"text/html\");\n }\n\n if (!(this.body instanceof Node)) {\n let { title, head, body } = this.dom;\n this.title = title;\n this.head = head;\n this.body = body;\n this.wrapper = this.body.querySelector(this.wrapperAttr);\n }\n }\n\n public install() {\n this.wrapperAttr = getConfig(this.config, \"wrapperAttr\");\n }\n\n public uninstall() {\n this.url = undefined;\n this.title = undefined;\n this.head = undefined;\n this.body = undefined;\n this.dom = undefined;\n this.wrapper = undefined;\n this.data = undefined;\n this.wrapperAttr = undefined;\n }\n}\n\nexport interface IPageManager extends Service {\n loading: Manager>,\n pages: AdvancedManager;\n\n install(): any,\n\n get(key): Page,\n add(value): PageManager,\n set(key, value): PageManager,\n remove(key): PageManager,\n has(key): boolean,\n clear(): PageManager,\n size: number,\n keys(): any[],\n\n load(_url: URL | string): Promise,\n request(url: string): Promise,\n}\n\n/** Controls which page to load */\nexport class PageManager extends Service implements IPageManager {\n /** Stores all fetch requests that are currently loading */\n public loading: Manager> = new Manager();\n\n pages: AdvancedManager;\n\n /** Instantiate pages, and add the current page to pages */\n install() {\n this.pages = new AdvancedManager(this.app);\n\n let URLString = newURL().pathname;\n this.set(URLString, new Page());\n URLString = undefined;\n }\n\n get(key) { return this.pages.get(key); }\n add(value) { this.pages.add(value); return this; }\n set(key, value) { this.pages.set(key, value); return this; }\n remove(key) { this.pages.remove(key); return this; }\n has(key) { return this.pages.has(key); }\n clear() { this.pages.clear(); return this; }\n get size() { return this.pages.size; }\n keys() { return this.pages.keys(); }\n\n /** Load from cache or by requesting URL via a fetch request, avoid requesting for the same thing twice by storing the fetch request in \"this.loading\" */\n public async load(_url: URL | string = newURL()): Promise {\n let url: URL = newURL(_url);\n let urlString: string = url.pathname;\n let page: Page, request: Promise;\n\n if (this.has(urlString)) {\n page = this.get(urlString);\n return Promise.resolve(page);\n }\n\n if (!this.loading.has(urlString)) {\n request = this.request(urlString);\n this.loading.set(urlString, request);\n } else request = this.loading.get(urlString);\n\n let response = await request;\n this.loading.remove(urlString);\n\n page = new Page(url, response);\n this.set(urlString, page);\n\n if (this.size > getConfig(this.config, \"maxPages\")) {\n let currentUrl = newURL();\n let keys = this.keys();\n let first = equal(currentUrl, keys[0]) ? keys[1] : keys[0];\n let page = this.get(first);\n page.unregister();\n page = undefined;\n keys = undefined;\n currentUrl = undefined;\n first = undefined;\n }\n\n return page;\n }\n\n /** Starts a fetch request */\n public async request(url: string): Promise {\n const headers = new Headers(getConfig(this.config, \"headers\"));\n const timeout = window.setTimeout(() => {\n window.clearTimeout(timeout);\n throw \"Request Timed Out!\";\n }, getConfig(this.config, \"timeout\"));\n\n try {\n let response = await fetch(url, {\n mode: 'same-origin',\n method: \"GET\",\n headers,\n cache: \"default\",\n credentials: \"same-origin\",\n });\n\n window.clearTimeout(timeout);\n if (response.status >= 200 && response.status < 300) {\n return await response.text();\n }\n\n const err = new Error(response.statusText || \"\" + response.status);\n throw err;\n } catch (err) {\n window.clearTimeout(timeout);\n throw err;\n }\n }\n}\n", "import { Manager, methodCall } from \"@okikio/manager\";\n\nexport type ListenerCallback = ((...args: any) => void);\nexport interface IListener {\n readonly callback: ListenerCallback;\n readonly scope: object;\n readonly name: string;\n}\n\n/** Represents a new event listener consisting of properties like: callback, scope, name */\nexport const newListener = ({\n callback = () => { },\n scope = null,\n name = \"event\",\n}: IListener): IListener => ({ callback, scope, name });\n\n/** Represents a new event */\nexport class Event extends Manager {\n /** The name of the event */\n public name: string;\n constructor(name: string = \"event\") {\n super();\n this.name = name;\n }\n}\n\nexport type EventInput = string | object | Array;\n\n/**\n * An Event Emitter\n * */\nexport class EventEmitter extends Manager {\n constructor() {\n super();\n }\n\n /** Gets event, if event doesn't exist create a new one */\n public getEvent(name: string): Event {\n let event = this.get(name);\n if (!(event instanceof Event)) {\n this.set(name, new Event(name));\n return this.get(name);\n }\n\n return event;\n }\n\n /** Creates a listener and adds it to an event */\n public newListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event = this.getEvent(name);\n event.add(newListener({ name, callback, scope }));\n return event;\n }\n\n /** Adds a listener to a given event */\n public on(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n this.newListener(_name, _callback, _scope);\n }, this);\n return this;\n }\n\n /** Removes a listener from an event */\n public removeListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event: Event = this.get(name);\n if (event instanceof Event && callback) {\n let listener = newListener({ name, callback, scope });\n\n event.forEach((value: IListener, i: number) => {\n if (\n value.callback === listener.callback &&\n value.scope === listener.scope\n ) {\n return event.remove(i);\n }\n });\n }\n\n return event;\n }\n\n /** Remove a listener from a given event, or just completely remove an event */\n public off(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n if (typeof _callback === \"function\") {\n this.removeListener(_name, _callback, _scope);\n } else this.remove(_name);\n }, this);\n return this;\n }\n\n /** Call all listeners within an event */\n public emit(\n events: string | Array,\n ...args: any\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n // Loop through the list of events\n events.forEach((event: string) => {\n let _event: Event = this.get(event);\n\n if (_event instanceof Event) {\n _event.forEach((listener: IListener) => {\n let { callback, scope } = listener;\n callback.apply(scope, args);\n });\n }\n }, this);\n return this;\n }\n\n /** Clears events and event listeners */\n public clear() {\n methodCall(this, \"clear\");\n super.clear();\n return this;\n }\n}\n\nexport default EventEmitter;\n", "import { EventEmitter, EventInput, ListenerCallback } from \"@okikio/emitter\";\nimport { Manager } from \"@okikio/manager\";\n\n// DOM\nexport type AnimationTarget = string | Node | NodeList | HTMLCollection | HTMLElement[] | AnimationTarget[];\nexport const getElements = (selector: string | Node): Node[] => {\n return typeof selector === \"string\" ? Array.from(document.querySelectorAll(selector as string)) : [selector];\n};\n\nconst flatten = (arr: AnimationTarget[]) => [].concat(...arr);\nexport const getTargets = (targets: AnimationTarget): Node[] => {\n if (Array.isArray(targets)) {\n return flatten((targets as AnimationTarget[]).map(getTargets));\n }\n if (typeof targets == \"string\" || targets instanceof Node)\n return getElements(targets);\n if (targets instanceof NodeList || targets instanceof HTMLCollection)\n return Array.from(targets);\n return [];\n};\n\n// VALUES\nexport type closureArgs = [number, number, HTMLElement];\nexport type closure = ((index?: number, total?: number, element?: HTMLElement) => (genericTypes[] | void)) | any;\nexport const computeValue = (value: closure, args: closureArgs, context: Animate) => {\n if (typeof value === \"function\") {\n return value.apply(context, args);\n } else { return value; }\n};\n\nexport const mapObject = (obj: object, args: closureArgs, options: Animate): any => {\n let key: string, value: any, result = {};\n let keys = Object.keys(obj);\n for (let i = 0, len = keys.length; i < len; i++) {\n key = keys[i];\n value = obj[key];\n result[key] = computeValue(value, args, options);\n }\n\n return result;\n};\n\n/** From: [https://easings.net] */\nexport const easings = {\n \"in\": \"ease-in\",\n \"out\": \"ease-out\",\n \"in-out\": \"ease-in-out\",\n\n // Sine\n \"in-sine\": \"cubic-bezier(0.47, 0, 0.745, 0.715)\",\n \"out-sine\": \"cubic-bezier(0.39, 0.575, 0.565, 1)\",\n \"in-out-sine\": \"cubic-bezier(0.445, 0.05, 0.55, 0.95)\",\n\n // Quad\n \"in-quad\": \"cubic-bezier(0.55, 0.085, 0.68, 0.53)\",\n \"out-quad\": \"cubic-bezier(0.25, 0.46, 0.45, 0.94)\",\n \"in-out-quad\": \"cubic-bezier(0.455, 0.03, 0.515, 0.955)\",\n\n // Cubic\n \"in-cubic\": \"cubic-bezier(0.55, 0.055, 0.675, 0.19)\",\n \"out-cubic\": \"cubic-bezier(0.215, 0.61, 0.355, 1)\",\n \"in-out-cubic\": \"cubic-bezier(0.645, 0.045, 0.355, 1)\",\n\n // Quart\n \"in-quart\": \"cubic-bezier(0.895, 0.03, 0.685, 0.22)\",\n \"out-quart\": \"cubic-bezier(0.165, 0.84, 0.44, 1)\",\n \"in-out-quart\": \"cubic-bezier(0.77, 0, 0.175, 1)\",\n\n // Quint\n \"in-quint\": \"cubic-bezier(0.755, 0.05, 0.855, 0.06)\",\n \"out-quint\": \"cubic-bezier(0.23, 1, 0.32, 1)\",\n \"in-out-quint\": \"cubic-bezier(0.86, 0, 0.07, 1)\",\n\n // Expo\n \"in-expo\": \"cubic-bezier(0.95, 0.05, 0.795, 0.035)\",\n \"out-expo\": \"cubic-bezier(0.19, 1, 0.22, 1)\",\n \"in-out-expo\": \"cubic-bezier(1, 0, 0, 1)\",\n\n // Circ\n \"in-circ\": \"cubic-bezier(0.6, 0.04, 0.98, 0.335)\",\n \"out-circ\": \"cubic-bezier(0.075, 0.82, 0.165, 1)\",\n \"in-out-circ\": \"cubic-bezier(0.785, 0.135, 0.15, 0.86)\",\n\n // Back\n \"in-back\": \"cubic-bezier(0.6, -0.28, 0.735, 0.045)\",\n \"out-back\": \"cubic-bezier(0.175, 0.885, 0.32, 1.275)\",\n \"in-out-back\": \"cubic-bezier(0.68, -0.55, 0.265, 1.55)\"\n};\n\nexport const getEase = (ease: string) => {\n return /^(in|out)/.test(ease) ? easings[ease] : ease;\n};\n\nexport type genericTypes = genericTypes[] | boolean | object | string | number | closure | null | undefined;\nexport interface AnimationOptions {\n target?: AnimationTarget,\n\n speed?: number,\n autoplay?: boolean,\n options?: AnimationOptions,\n delay?: number | closure,\n easing?: string | closure,\n endDelay?: number | closure,\n duration?: number | closure,\n keyframes?: Keyframe[] | object[] | closure,\n loop?: number | boolean | closure, // iterations: number,\n onfinish?: (element?: HTMLElement, index?: number, total?: number, animation?: Animation) => any,\n fillMode?: \"none\" | \"forwards\" | \"backwards\" | \"both\" | \"auto\" | closure,\n direction?: \"normal\" | \"reverse\" | \"alternate\" | \"alternate-reverse\" | closure,\n extend?: EffectTiming,\n [property: string]: genericTypes;\n};\n\nexport const DefaultAnimationOptions: AnimationOptions = {\n keyframes: [],\n\n loop: 1, // iterations: number,\n delay: 0,\n speed: 1,\n endDelay: 0,\n easing: \"ease\",\n autoplay: true,\n duration: 1000,\n fillMode: \"auto\",\n direction: \"normal\",\n extend: {}\n};\n\nexport type AnimationEvents = \"update\" | \"play\" | \"pause\" | \"start\" | \"begin\" | \"complete\" | \"finish\" | \"error\" | \"stop\";\n\n/** You can check it out here: https://codepen.io/okikio/pen/qBbdGaW?editors=0011 */\nexport class Animate {\n /**\n * Stores the options for the current animation\n */\n public options: AnimationOptions = {};\n\n /**\n * The Array of Elements to Animate\n */\n public targets: Node[] = [];\n\n /**\n * The properties to animate\n */\n public properties: object = {};\n\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n\n /**\n * The total duration of all Animation's\n */\n public totalDuration: number = 0;\n\n /**\n * The smallest delay out of all Animation's\n */\n public minDelay: number = 0;\n\n /**\n * The options for individual animations\n */\n public computedOptions: Manager = new Manager();\n\n /**\n * The Element the main animation uses\n */\n public mainElement: HTMLElement;\n\n /**\n * Stores an animation that runs on the total duration of the all other Animations, and as such it's the main Animation\n */\n public mainAnimation: Animation;\n\n /**\n * Stores request frame calls\n */\n public animationFrame: number;\n\n /**\n * An event emitter\n */\n public emitter: EventEmitter = new EventEmitter();\n\n /**\n * Returns a promise that is fulfilled when the mainAnimation is finished\n */\n public promise: Promise;\n constructor(options: AnimationOptions = {}) {\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n\n /**\n * Returns a new Promise that is resolve when this.finish is called\n */\n public newPromise(): Promise {\n return new Promise((resolve, reject) => {\n /*\n Note that the `this` keyword is in an Array when it is resolved,\n this is due to Promises not wanting to resolve references,\n so, you can't resolve `this` directly, so, I chose to resolve `this` in an\n Array\n */\n this.on(\"complete\", () => resolve([this]));\n this.on(\"error\", err => reject(err));\n });\n }\n\n /**\n * Fulfills the this.promise Promise\n */\n public then(\n onFulfilled?: (value?: any) => any,\n onRejected?: (reason?: any) => any\n ): Animate {\n onFulfilled = onFulfilled?.bind(this);\n onRejected = onRejected?.bind(this);\n this.promise.then(onFulfilled, onRejected);\n return this;\n }\n\n /**\n * Catches error that occur in the this.promise Promise\n */\n public catch(onRejected: (reason?: any) => any): Animate {\n onRejected = onRejected?.bind(this);\n this.promise.catch(onRejected);\n return this;\n }\n\n /**\n * If you don't care if the this.promise Promise has either been rejected or resolved\n */\n public finally(onFinally: () => any): Animate {\n onFinally = onFinally?.bind(this);\n this.promise.finally(onFinally);\n return this;\n }\n\n /**\n * Represents an Animation Frame Loop\n */\n public loop(): void {\n this.stopLoop();\n this.emit(\"update\", this.getProgress(), this);\n this.animationFrame = window.requestAnimationFrame(this.loop);\n }\n\n /**\n * Cancels animation frame\n */\n public stopLoop() {\n window.cancelAnimationFrame(this.animationFrame);\n }\n\n /**\n * Calls a method that affects all animations including the mainAnimation; the method only allows the animation parameter\n */\n public all(method: (animation?: Animation, target?: HTMLElement) => void) {\n method(this.mainAnimation, this.mainElement);\n this.animations.forEach(method);\n return this;\n }\n\n /**\n * Register the begin event\n */\n protected beginEvent() {\n if (this.getProgress() == 0) {\n let timer: number | void = window.setTimeout(() => {\n this.emit(\"begin\", this);\n timer = window.clearTimeout(timer as number);\n }, this.minDelay);\n }\n }\n\n /**\n * Play Animation\n */\n public play(): Animate {\n let playstate = this.getPlayState();\n this.beginEvent();\n this.all(anim => anim.play());\n this.emit(\"play\", playstate, this);\n this.loop();\n return this;\n }\n\n /**\n * Pause Animation\n */\n public pause(): Animate {\n let playstate = this.getPlayState();\n this.all(anim => anim.pause());\n this.emit(\"pause\", playstate, this);\n this.stopLoop();\n this.animationFrame = undefined;\n return this;\n }\n\n /**\n * Reset all Animations\n */\n public reset() {\n this.setProgress(0);\n this.beginEvent();\n\n if (this.options.autoplay) this.play();\n else this.pause();\n return this;\n }\n\n /**\n * Cancels all Animations\n */\n public cancel() {\n this.all(anim => anim.cancel());\n this.stopLoop();\n return this;\n }\n\n /**\n * Force complete all Animations\n */\n public finish() {\n this.all(anim => anim.finish());\n this.stopLoop();\n return this;\n }\n\n /**\n * Cancels & Clears all Animations\n */\n public stop() {\n this.cancel();\n this.animations.clear();\n while (this.targets.length) this.targets.pop();\n this.mainElement = undefined;\n this.emit(\"stop\");\n }\n\n /**\n * Returns an Array of targets\n */\n public getTargets(): Node[] {\n return this.targets;\n }\n\n /**\n * Get a specific Animation from an Animate instance\n */\n public getAnimation(element: HTMLElement): Animation {\n return this.animations.get(element);\n }\n\n /**\n * Returns the timings of an Animation, given a target\n * E.g. { duration, endDelay, delay, iterations, iterationStart, direction, easing, fill, etc... }\n */\n public getTiming(target: HTMLElement | Animation): AnimationOptions & EffectTiming {\n let animation = target instanceof Animation ? target : this.getAnimation(target);\n let keyframeOptions = this.computedOptions.get(animation) ?? {};\n let timings = animation.effect?.getTiming() ?? {};\n let options = this.getOptions();\n\n return { ...DefaultAnimationOptions, ...options, ...timings, ...keyframeOptions };\n }\n\n /**\n * Returns the total duration of Animation\n */\n public getTotalDuration(): number {\n return this.totalDuration;\n }\n\n /**\n * Returns the current time of the Main Animation\n */\n public getCurrentTime(): number {\n return this.mainAnimation.currentTime;\n }\n\n /**\n * Returns the Animation progress as a fraction of the current time / duration * 100\n */\n public getProgress() {\n return (this.getCurrentTime() / this.totalDuration) * 100;\n }\n\n /**\n * Return the playback speed of the animation\n */\n public getSpeed(): number {\n return this.mainAnimation.playbackRate;\n }\n\n /**\n * Returns the current playing state\n */\n public getPlayState(): \"idle\" | \"running\" | \"paused\" | \"finished\" {\n return this.mainAnimation.playState;\n }\n\n /**\n * Get the options of an Animate instance\n */\n public getOptions(): AnimationOptions {\n return this.options;\n }\n\n /**\n * Set the current time of the Main Animation\n */\n public setCurrentTime(time: number): Animate {\n this.all(anim => { anim.currentTime = time; });\n this.emit(\"update\", this.getProgress());\n return this;\n }\n\n /**\n * Set the Animation progress as a value from 0 to 100\n */\n public setProgress(percent: number): Animate {\n let time = (percent / 100) * this.totalDuration;\n this.setCurrentTime(time);\n return this;\n }\n\n /**\n * Set the playback speed of an Animation\n */\n public setSpeed(speed: number = 1): Animate {\n this.all(anim => { anim.playbackRate = speed; });\n return this;\n }\n\n /**\n * Adds a listener for a given event\n */\n public on(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.on(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Removes a listener from an event\n */\n public off(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.off(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Call all listeners within an event\n */\n public emit(events: AnimationEvents | string | any[], ...args: any): Animate {\n this.emitter.emit(events, ...args);\n return this;\n }\n\n\n /** Returns the Animate options, as JSON */\n public toJSON(): AnimationOptions {\n return this.getOptions();\n }\n\n /**\n * The Symbol.toStringTag well-known symbol is a string valued property that is used\n * in the creation of the default string description of an object.\n * It is accessed internally by the Object.prototype.toString() method.\n */\n get [Symbol.toStringTag]() {\n return `Animate`;\n }\n}\n\n/** Creates a new Animate instance */\nexport const animate = (options: AnimationOptions = {}): Animate => {\n return new Animate(options);\n};\n\nexport class Timeline extends Animate {\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n constructor(options: AnimationOptions = {}) {\n super();\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n public add(options: AnimationOptions) {\n return this;\n }\n}\n\nexport default animate;", "import { animate } from \"@okikio/native\";\n\n/* Target Section */\n// CSS Selector Demo\n(() => {\n let containerSel = \".css-selector-demo\";\n let anim = animate({\n target: `${containerSel} .el`,\n transform: [\"translateX(0px)\", \"translateX(250px)\"],\n onfinish(element) {\n element.style.transform = \"translateX(250px)\";\n },\n duration: 500,\n autoplay: false\n });\n\n let container = document.querySelector(containerSel);\n container.addEventListener(\"click\", () => {\n anim.reset();\n anim.play();\n });\n})();\n\n// DOM Node / Nodelist Demo\n(() => {\n let containerSel = \".dom-node-demo\";\n let DOMNodes = document.querySelectorAll(`${containerSel} .el`);\n let anim = animate({\n target: DOMNodes,\n transform: [\"translateX(0px)\", \"translateX(250px)\"],\n onfinish(element) {\n element.style.transform = \"translateX(250px)\";\n },\n duration: 500,\n autoplay: false\n });\n\n let container = document.querySelector(containerSel);\n container.addEventListener(\"click\", () => {\n anim.reset();\n anim.play();\n });\n})();\n\n\n// Array Demo\n(() => {\n let containerSel = \".array-demo\";\n let el = (num: number) => `${containerSel} .el-0${num}`;\n let anim = animate({\n target: [`${containerSel} .el-01`, el(2), el(3),\n // These two elements don't exist, so, @okikio/animate ignores theme\n el(4), el(5)],\n transform: [\"translateX(0px)\", \"translateX(250px)\"],\n onfinish(element) {\n element.style.transform = \"translateX(250px)\";\n },\n autoplay: false\n });\n\n let container = document.querySelector(containerSel);\n container.addEventListener(\"click\", () => {\n anim.reset();\n anim.play();\n });\n})();\n\n\n\n/* Properties Section */\n// CSS Properties Demo\n(() => {\n let containerSel = \".css-properties-demo\";\n let anim = animate({\n target: `${containerSel} .el`,\n backgroundColor: [\"#616aff\", \"#fff\"],\n left: [\"0px\", \"240px\"],\n borderRadius: ['0%', '50%'],\n onfinish(element) {\n let { style } = element;\n style.backgroundColor = \"#fff\";\n style.left = \"240px\";\n style.borderRadius = '50%';\n },\n easing: \"in-out-quad\",\n autoplay: false\n });\n\n let container = document.querySelector(containerSel);\n container.addEventListener(\"click\", () => {\n anim.reset();\n anim.play();\n });\n})();\n\n// CSS Transforms Demo\n(() => {\n let containerSel = \".css-transform-demo\";\n let anim = animate({\n target: `${containerSel} .el`,\n transform: [`translateX(0) scale(1) rotate(0)`, `translateX(250px) scale(2) rotate(1turn)`],\n onfinish(element) {\n element.style.transform = `translateX(250px) scale(2) rotate(1turn)`;\n },\n easing: \"in-out-quad\",\n autoplay: false\n });\n\n let container = document.querySelector(containerSel);\n container.addEventListener(\"click\", () => {\n anim.reset();\n anim.play();\n });\n})();\n\n\n// SVG Attributes Demo\n(() => {\n let containerSel = \".svg-attributes-demo\";\n var pathEl = document.querySelector(`${containerSel} path`);\n\n let anim = animate({\n target: pathEl,\n strokeDashoffset: [4000, 0],\n loop: true,\n direction: \"alternate\",\n easing: \"in-out-expo\",\n autoplay: false\n });\n\n let container = document.querySelector(containerSel);\n container.addEventListener(\"click\", () => {\n // anim.reset(); // You can't reset an infinitely looped animation\n if (anim.getPlayState() === \"running\") anim.pause();\n else anim.play();\n });\n\n anim.on(\"update\", () => {\n console.log(\"Go\")\n });\n})();\n"], - "mappings": "2fACO,WAAoB,CAG1B,YAAY,EAAuB,CAClC,KAAK,IAAM,GAAI,KAAI,GAIb,QAAoB,CAC1B,MAAO,MAAK,IAIN,IAAI,EAAW,CACrB,MAAO,MAAK,IAAI,IAAI,GAId,MAAiB,CACvB,MAAO,OAAM,KAAK,KAAK,IAAI,QAIrB,QAAmB,CACzB,MAAO,OAAM,KAAK,KAAK,IAAI,UAIrB,IAAI,EAAQ,EAAyB,CAC3C,YAAK,IAAI,IAAI,EAAK,GACX,KAID,IAAI,EAAyB,CAGnC,GAAI,GAFO,KAAK,KAGhB,YAAK,IAAI,EAAK,GACP,QAIG,OAAe,CACzB,MAAO,MAAK,IAAI,QAIN,SAAiB,CAC3B,MAAO,MAAK,IAAI,KAIV,KAAK,EAAmB,EAAkB,CAChD,GAAI,GAAM,KAAK,OAAO,KAAK,KAAO,GAClC,MAAO,MAAK,IAAI,GAIV,OAAO,EAAiB,CAC9B,MAAO,MAAK,IAAI,OAAO,GAIjB,OAAO,EAAuB,CACpC,YAAK,IAAI,OAAO,GACT,KAID,OAAuB,CAC7B,YAAK,IAAI,QACF,KAID,IAAI,EAAiB,CAC3B,MAAO,MAAK,IAAI,IAAI,GAId,SAAoC,CAC1C,MAAO,MAAK,IAAI,UAIV,QACN,EACA,EACgB,CAChB,YAAK,IAAI,QAAQ,EAAU,GACpB,MAIA,OAAO,WAAsC,CACpD,MAAO,MAAK,YAOD,EAAa,CAAC,EAA4B,KAAmB,IAAoB,CAC7F,EAAQ,QAAQ,AAAC,GAAS,CAEzB,EAAK,GAAQ,GAAG,MCpFX,GAAM,IAAoB,GAA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G,QACX,UAAW,CAAC,mCAAoC,4CAChD,SAAS,EAAS,CACd,EAAQ,MAAM,UAAY,4CAE9B,OAAQ,cACR,SAAU,KAId,AADgB,SAAS,cAAc,GAC7B,iBAAiB,QAAS,IAAM,CACtC,EAAK,QACL,EAAK,aAMb,AAAC,KAAM,CACH,GAAI,GAAe,uBACnB,GAAI,GAAS,SAAS,cAAc,GAAG,UAEvC,GAAI,GAAO,EAAQ,CACf,OAAQ,EACR,iBAAkB,CAAC,IAAM,GACzB,KAAM,GACN,UAAW,YACX,OAAQ,cACR,SAAU,KAId,AADgB,SAAS,cAAc,GAC7B,iBAAiB,QAAS,IAAM,CAEtC,AAAI,EAAK,iBAAmB,UAAW,EAAK,QACvC,EAAK,SAGd,EAAK,GAAG,SAAU,IAAM,CACpB,QAAQ,IAAI", + "sourcesContent": ["/** Manages complex lists of named data, eg. A page can be stored in a list by of other pages with the url being how the page is stored in the list. Managers use Maps to store data */\nexport class Manager {\n\t/** The complex list of named data, to which the Manager controls */\n\tpublic map: Map;\n\tconstructor(value?: Array<[K, V]>) {\n\t\tthis.map = new Map(value);\n\t}\n\n\t/** Returns the Manager classes base Map */\n\tpublic getMap(): Map {\n\t\treturn this.map;\n\t}\n\n\t/** Get a value stored in the Manager */\n\tpublic get(key: K): V {\n\t\treturn this.map.get(key);\n\t}\n\n\t/** Returns the keys of all items stored in the Manager as an Array */\n\tpublic keys(): Array {\n\t\treturn Array.from(this.map.keys());\n\t}\n\n\t/** Returns the values of all items stored in the Manager as an Array */\n\tpublic values(): Array {\n\t\treturn Array.from(this.map.values());\n\t}\n\n\t/** Set a value to the Manager using a key */\n\tpublic set(key: K, value: V): Manager {\n\t\tthis.map.set(key, value);\n\t\treturn this;\n\t}\n\n\t/** Adds a value to Manager, and uses the current size of the Manager as it's key, it works best when all the key in the Manager are numbers */\n\tpublic add(value: V): Manager {\n\t\tlet size = this.size;\n\t\t// @ts-ignore\n\t\tlet num: K = size as K;\n\t\tthis.set(num, value);\n\t\treturn this;\n\t}\n\n\t/** Returns the total number of items stored in the Manager */\n\tpublic get size(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** An alias for size */\n\tpublic get length(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** Returns the last item in the Manager who's index is a certain distance from the last item in the Manager */\n\tpublic last(distance: number = 1): V | undefined {\n\t\tlet key = this.keys()[this.size - distance];\n\t\treturn this.get(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns true if an element in the Map object existed and has been removed, or false if the element does not exist */\n\tpublic delete(key: K): boolean {\n\t\treturn this.map.delete(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns the Manager class, allowing for chains */\n\tpublic remove(key: K): Manager {\n\t\tthis.map.delete(key);\n\t\treturn this;\n\t}\n\n\t/** Clear the Manager of all its contents */\n\tpublic clear(): Manager {\n\t\tthis.map.clear();\n\t\treturn this;\n\t}\n\n\t/** Checks if the Manager contains a certain key */\n\tpublic has(key: K): boolean {\n\t\treturn this.map.has(key);\n\t}\n\n\t/** Returns a new Iterator object that contains an array of [key, value] for each element in the Map object in insertion order. */\n\tpublic entries(): IterableIterator<[K, V]> {\n\t\treturn this.map.entries();\n\t}\n\n\t/** Iterates through the Managers contents, calling a callback function every iteration */\n\tpublic forEach(\n\t\tcallback: (value?: V, key?: K, map?: Map) => void,\n\t\tcontext?: object\n\t): Manager {\n\t\tthis.map.forEach(callback, context);\n\t\treturn this;\n\t}\n\n\t/** Allows for iteration via for..of, learn more: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators] */\n\tpublic [Symbol.iterator](): IterableIterator<[K, V]> {\n\t\treturn this.entries();\n\t}\n}\n\n/**\n * Calls the method of a certain name for all items that are currently installed\n */\nexport const methodCall = (manager: Manager, method: string, ...args: any): void => {\n\tmanager.forEach((item) => {\n\t\t// @ts-ignore\n\t\titem[method](...args);\n\t});\n};\n\n/**\n * Asynchronously calls the method of a certain name for all items that are currently installed, similar to methodCall\n */\nexport const asyncMethodCall = async (manager: Manager, method: string, ...args: any): Promise => {\n\tfor (let [, item] of manager) {\n\t\t// @ts-ignore\n\t\tawait item[method](...args);\n\t}\n};\n\nexport default Manager;\n", "import { Manager, ManagerItem, AdvancedManager } from \"./manager\";\nimport { equal, newURL } from \"./url\";\nimport { getConfig } from \"./config\";\nimport { Service } from \"./service\";\n\nexport interface IPage extends ManagerItem {\n dom: Document,\n wrapper: HTMLElement,\n title: string,\n head: Element,\n body: Element,\n url: URL,\n data: string,\n wrapperAttr: string,\n\n build(): any,\n install(): void,\n uninstall(): any,\n}\n\n/**\n * Parses strings to DOM\n */\nexport const PARSER: DOMParser = new DOMParser();\n\n/** A page represents the DOM elements that create each page */\nexport class Page extends ManagerItem implements IPage {\n /** Holds the DOM of the current page */\n public dom: Document;\n\n /** Holds the wrapper element to be swapped out of each Page */\n public wrapper: HTMLElement;\n\n /** Holds the title of each page */\n public title: string;\n\n /** Holds the head element of each page */\n public head: Element;\n\n /** Holds the body element of each page */\n public body: Element;\n\n /** The URL of the current page */\n public url: URL;\n\n /** The payload of a page request */\n public data: string;\n\n /** Attr that identifies the wrapper */\n public wrapperAttr: string;\n\n constructor(url: URL = newURL(), dom: string | Document = document) {\n super();\n this.url = url;\n\n if (typeof dom === \"string\") {\n this.data = dom;\n } else this.dom = dom || document;\n }\n\n /** Builds the page's dom, and sets the title, head, body, and wrapper properties of the Page class */\n public build() {\n if (!(this.dom instanceof Node)) {\n this.dom = PARSER.parseFromString(this.data, \"text/html\");\n }\n\n if (!(this.body instanceof Node)) {\n let { title, head, body } = this.dom;\n this.title = title;\n this.head = head;\n this.body = body;\n this.wrapper = this.body.querySelector(this.wrapperAttr);\n }\n }\n\n public install() {\n this.wrapperAttr = getConfig(this.config, \"wrapperAttr\");\n }\n\n public uninstall() {\n this.url = undefined;\n this.title = undefined;\n this.head = undefined;\n this.body = undefined;\n this.dom = undefined;\n this.wrapper = undefined;\n this.data = undefined;\n this.wrapperAttr = undefined;\n }\n}\n\nexport interface IPageManager extends Service {\n loading: Manager>,\n pages: AdvancedManager;\n\n install(): any,\n\n get(key): Page,\n add(value): PageManager,\n set(key, value): PageManager,\n remove(key): PageManager,\n has(key): boolean,\n clear(): PageManager,\n size: number,\n keys(): any[],\n\n load(_url: URL | string): Promise,\n request(url: string): Promise,\n}\n\n/** Controls which page to load */\nexport class PageManager extends Service implements IPageManager {\n /** Stores all fetch requests that are currently loading */\n public loading: Manager> = new Manager();\n\n pages: AdvancedManager;\n\n /** Instantiate pages, and add the current page to pages */\n install() {\n this.pages = new AdvancedManager(this.app);\n\n let URLString = newURL().pathname;\n this.set(URLString, new Page());\n URLString = undefined;\n }\n\n get(key) { return this.pages.get(key); }\n add(value) { this.pages.add(value); return this; }\n set(key, value) { this.pages.set(key, value); return this; }\n remove(key) { this.pages.remove(key); return this; }\n has(key) { return this.pages.has(key); }\n clear() { this.pages.clear(); return this; }\n get size() { return this.pages.size; }\n keys() { return this.pages.keys(); }\n\n /** Load from cache or by requesting URL via a fetch request, avoid requesting for the same thing twice by storing the fetch request in \"this.loading\" */\n public async load(_url: URL | string = newURL()): Promise {\n let url: URL = newURL(_url);\n let urlString: string = url.pathname;\n let page: Page, request: Promise;\n\n if (this.has(urlString)) {\n page = this.get(urlString);\n return Promise.resolve(page);\n }\n\n if (!this.loading.has(urlString)) {\n request = this.request(urlString);\n this.loading.set(urlString, request);\n } else request = this.loading.get(urlString);\n\n let response = await request;\n this.loading.remove(urlString);\n\n page = new Page(url, response);\n this.set(urlString, page);\n\n if (this.size > getConfig(this.config, \"maxPages\")) {\n let currentUrl = newURL();\n let keys = this.keys();\n let first = equal(currentUrl, keys[0]) ? keys[1] : keys[0];\n let page = this.get(first);\n page.unregister();\n page = undefined;\n keys = undefined;\n currentUrl = undefined;\n first = undefined;\n }\n\n return page;\n }\n\n /** Starts a fetch request */\n public async request(url: string): Promise {\n const headers = new Headers(getConfig(this.config, \"headers\"));\n const timeout = window.setTimeout(() => {\n window.clearTimeout(timeout);\n throw \"Request Timed Out!\";\n }, getConfig(this.config, \"timeout\"));\n\n try {\n let response = await fetch(url, {\n mode: 'same-origin',\n method: \"GET\",\n headers,\n cache: \"default\",\n credentials: \"same-origin\",\n });\n\n window.clearTimeout(timeout);\n if (response.status >= 200 && response.status < 300) {\n return await response.text();\n }\n\n const err = new Error(response.statusText || \"\" + response.status);\n throw err;\n } catch (err) {\n window.clearTimeout(timeout);\n throw err;\n }\n }\n}\n", "import { Manager, methodCall } from \"@okikio/manager\";\n\nexport type ListenerCallback = ((...args: any) => void);\nexport interface IListener {\n readonly callback: ListenerCallback;\n readonly scope: object;\n readonly name: string;\n}\n\n/** Represents a new event listener consisting of properties like: callback, scope, name */\nexport const newListener = ({\n callback = () => { },\n scope = null,\n name = \"event\",\n}: IListener): IListener => ({ callback, scope, name });\n\n/** Represents a new event */\nexport class Event extends Manager {\n /** The name of the event */\n public name: string;\n constructor(name: string = \"event\") {\n super();\n this.name = name;\n }\n}\n\nexport type EventInput = string | object | Array;\n\n/**\n * An Event Emitter\n * */\nexport class EventEmitter extends Manager {\n constructor() {\n super();\n }\n\n /** Gets event, if event doesn't exist create a new one */\n public getEvent(name: string): Event {\n let event = this.get(name);\n if (!(event instanceof Event)) {\n this.set(name, new Event(name));\n return this.get(name);\n }\n\n return event;\n }\n\n /** Creates a listener and adds it to an event */\n public newListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event = this.getEvent(name);\n event.add(newListener({ name, callback, scope }));\n return event;\n }\n\n /** Adds a listener to a given event */\n public on(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n this.newListener(_name, _callback, _scope);\n }, this);\n return this;\n }\n\n /** Removes a listener from an event */\n public removeListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event: Event = this.get(name);\n if (event instanceof Event && callback) {\n let listener = newListener({ name, callback, scope });\n\n event.forEach((value: IListener, i: number) => {\n if (\n value.callback === listener.callback &&\n value.scope === listener.scope\n ) {\n return event.remove(i);\n }\n });\n }\n\n return event;\n }\n\n /** Remove a listener from a given event, or just completely remove an event */\n public off(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n if (typeof _callback === \"function\") {\n this.removeListener(_name, _callback, _scope);\n } else this.remove(_name);\n }, this);\n return this;\n }\n\n /** Call all listeners within an event */\n public emit(\n events: string | Array,\n ...args: any\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n // Loop through the list of events\n events.forEach((event: string) => {\n let _event: Event = this.get(event);\n\n if (_event instanceof Event) {\n _event.forEach((listener: IListener) => {\n let { callback, scope } = listener;\n callback.apply(scope, args);\n });\n }\n }, this);\n return this;\n }\n\n /** Clears events and event listeners */\n public clear() {\n methodCall(this, \"clear\");\n super.clear();\n return this;\n }\n}\n\nexport default EventEmitter;\n", "import { EventEmitter, EventInput, ListenerCallback } from \"@okikio/emitter\";\nimport { Manager } from \"@okikio/manager\";\n\n// DOM\nexport type AnimationTarget = string | Node | NodeList | HTMLCollection | HTMLElement[] | AnimationTarget[];\nexport const getElements = (selector: string | Node): Node[] => {\n return typeof selector === \"string\" ? Array.from(document.querySelectorAll(selector as string)) : [selector];\n};\n\nconst flatten = (arr: AnimationTarget[]) => [].concat(...arr);\nexport const getTargets = (targets: AnimationTarget): Node[] => {\n if (Array.isArray(targets)) {\n return flatten((targets as AnimationTarget[]).map(getTargets));\n }\n if (typeof targets == \"string\" || targets instanceof Node)\n return getElements(targets);\n if (targets instanceof NodeList || targets instanceof HTMLCollection)\n return Array.from(targets);\n return [];\n};\n\n// VALUES\nexport type closureArgs = [number, number, HTMLElement];\nexport type closure = ((index?: number, total?: number, element?: HTMLElement) => (genericTypes[] | void)) | any;\nexport const computeValue = (value: closure, args: closureArgs, context: Animate) => {\n if (typeof value === \"function\") {\n return value.apply(context, args);\n } else { return value; }\n};\n\nexport const mapObject = (obj: object, args: closureArgs, options: Animate): any => {\n let key: string, value: any, result = {};\n let keys = Object.keys(obj);\n for (let i = 0, len = keys.length; i < len; i++) {\n key = keys[i];\n value = obj[key];\n result[key] = computeValue(value, args, options);\n }\n\n return result;\n};\n\n/** From: [https://easings.net] */\nexport const easings = {\n \"in\": \"ease-in\",\n \"out\": \"ease-out\",\n \"in-out\": \"ease-in-out\",\n\n // Sine\n \"in-sine\": \"cubic-bezier(0.47, 0, 0.745, 0.715)\",\n \"out-sine\": \"cubic-bezier(0.39, 0.575, 0.565, 1)\",\n \"in-out-sine\": \"cubic-bezier(0.445, 0.05, 0.55, 0.95)\",\n\n // Quad\n \"in-quad\": \"cubic-bezier(0.55, 0.085, 0.68, 0.53)\",\n \"out-quad\": \"cubic-bezier(0.25, 0.46, 0.45, 0.94)\",\n \"in-out-quad\": \"cubic-bezier(0.455, 0.03, 0.515, 0.955)\",\n\n // Cubic\n \"in-cubic\": \"cubic-bezier(0.55, 0.055, 0.675, 0.19)\",\n \"out-cubic\": \"cubic-bezier(0.215, 0.61, 0.355, 1)\",\n \"in-out-cubic\": \"cubic-bezier(0.645, 0.045, 0.355, 1)\",\n\n // Quart\n \"in-quart\": \"cubic-bezier(0.895, 0.03, 0.685, 0.22)\",\n \"out-quart\": \"cubic-bezier(0.165, 0.84, 0.44, 1)\",\n \"in-out-quart\": \"cubic-bezier(0.77, 0, 0.175, 1)\",\n\n // Quint\n \"in-quint\": \"cubic-bezier(0.755, 0.05, 0.855, 0.06)\",\n \"out-quint\": \"cubic-bezier(0.23, 1, 0.32, 1)\",\n \"in-out-quint\": \"cubic-bezier(0.86, 0, 0.07, 1)\",\n\n // Expo\n \"in-expo\": \"cubic-bezier(0.95, 0.05, 0.795, 0.035)\",\n \"out-expo\": \"cubic-bezier(0.19, 1, 0.22, 1)\",\n \"in-out-expo\": \"cubic-bezier(1, 0, 0, 1)\",\n\n // Circ\n \"in-circ\": \"cubic-bezier(0.6, 0.04, 0.98, 0.335)\",\n \"out-circ\": \"cubic-bezier(0.075, 0.82, 0.165, 1)\",\n \"in-out-circ\": \"cubic-bezier(0.785, 0.135, 0.15, 0.86)\",\n\n // Back\n \"in-back\": \"cubic-bezier(0.6, -0.28, 0.735, 0.045)\",\n \"out-back\": \"cubic-bezier(0.175, 0.885, 0.32, 1.275)\",\n \"in-out-back\": \"cubic-bezier(0.68, -0.55, 0.265, 1.55)\"\n};\n\nexport const getEase = (ease: string) => {\n return /^(in|out)/.test(ease) ? easings[ease] : ease;\n};\n\nexport type genericTypes = genericTypes[] | boolean | object | string | number | closure | null | undefined;\nexport interface AnimationOptions {\n target?: AnimationTarget,\n\n speed?: number,\n autoplay?: boolean,\n options?: AnimationOptions,\n delay?: number | closure,\n easing?: string | closure,\n endDelay?: number | closure,\n duration?: number | closure,\n keyframes?: Keyframe[] | object[] | closure,\n loop?: number | boolean | closure, // iterations: number,\n onfinish?: (element?: HTMLElement, index?: number, total?: number, animation?: Animation) => any,\n fillMode?: \"none\" | \"forwards\" | \"backwards\" | \"both\" | \"auto\" | closure,\n direction?: \"normal\" | \"reverse\" | \"alternate\" | \"alternate-reverse\" | closure,\n extend?: EffectTiming,\n [property: string]: genericTypes;\n};\n\nexport const DefaultAnimationOptions: AnimationOptions = {\n keyframes: [],\n\n loop: 1, // iterations: number,\n delay: 0,\n speed: 1,\n endDelay: 0,\n easing: \"ease\",\n autoplay: true,\n duration: 1000,\n fillMode: \"auto\",\n direction: \"normal\",\n extend: {}\n};\n\nexport type AnimationEvents = \"update\" | \"play\" | \"pause\" | \"start\" | \"begin\" | \"complete\" | \"finish\" | \"error\" | \"stop\";\n\n/** You can check it out here: https://codepen.io/okikio/pen/qBbdGaW?editors=0011 */\nexport class Animate {\n /**\n * Stores the options for the current animation\n */\n public options: AnimationOptions = {};\n\n /**\n * The Array of Elements to Animate\n */\n public targets: Node[] = [];\n\n /**\n * The properties to animate\n */\n public properties: object = {};\n\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n\n /**\n * The total duration of all Animation's\n */\n public totalDuration: number = 0;\n\n /**\n * The smallest delay out of all Animation's\n */\n public minDelay: number = 0;\n\n /**\n * The options for individual animations\n */\n public computedOptions: Manager = new Manager();\n\n /**\n * The Element the main animation uses\n */\n public mainElement: HTMLElement;\n\n /**\n * Stores an animation that runs on the total duration of the all other Animations, and as such it's the main Animation\n */\n public mainAnimation: Animation;\n\n /**\n * Stores request frame calls\n */\n public animationFrame: number;\n\n /**\n * An event emitter\n */\n public emitter: EventEmitter = new EventEmitter();\n\n /**\n * Returns a promise that is fulfilled when the mainAnimation is finished\n */\n public promise: Promise;\n constructor(options: AnimationOptions = {}) {\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n\n /**\n * Returns a new Promise that is resolve when this.finish is called\n */\n public newPromise(): Promise {\n return new Promise((resolve, reject) => {\n /*\n Note that the `this` keyword is in an Array when it is resolved,\n this is due to Promises not wanting to resolve references,\n so, you can't resolve `this` directly, so, I chose to resolve `this` in an\n Array\n */\n this.on(\"complete\", () => resolve([this]));\n this.on(\"error\", err => reject(err));\n });\n }\n\n /**\n * Fulfills the this.promise Promise\n */\n public then(\n onFulfilled?: (value?: any) => any,\n onRejected?: (reason?: any) => any\n ): Animate {\n onFulfilled = onFulfilled?.bind(this);\n onRejected = onRejected?.bind(this);\n this.promise.then(onFulfilled, onRejected);\n return this;\n }\n\n /**\n * Catches error that occur in the this.promise Promise\n */\n public catch(onRejected: (reason?: any) => any): Animate {\n onRejected = onRejected?.bind(this);\n this.promise.catch(onRejected);\n return this;\n }\n\n /**\n * If you don't care if the this.promise Promise has either been rejected or resolved\n */\n public finally(onFinally: () => any): Animate {\n onFinally = onFinally?.bind(this);\n this.promise.finally(onFinally);\n return this;\n }\n\n /**\n * Represents an Animation Frame Loop\n */\n public loop(): void {\n this.stopLoop();\n this.emit(\"update\", this.getProgress(), this);\n this.animationFrame = window.requestAnimationFrame(this.loop);\n }\n\n /**\n * Cancels animation frame\n */\n public stopLoop() {\n window.cancelAnimationFrame(this.animationFrame);\n }\n\n /**\n * Calls a method that affects all animations including the mainAnimation; the method only allows the animation parameter\n */\n public all(method: (animation?: Animation, target?: HTMLElement) => void) {\n method(this.mainAnimation, this.mainElement);\n this.animations.forEach(method);\n return this;\n }\n\n /**\n * Register the begin event\n */\n protected beginEvent() {\n if (this.getProgress() == 0) {\n let timer: number | void = window.setTimeout(() => {\n this.emit(\"begin\", this);\n timer = window.clearTimeout(timer as number);\n }, this.minDelay);\n }\n }\n\n /**\n * Play Animation\n */\n public play(): Animate {\n let playstate = this.getPlayState();\n this.beginEvent();\n this.all(anim => anim.play());\n this.emit(\"play\", playstate, this);\n this.loop();\n return this;\n }\n\n /**\n * Pause Animation\n */\n public pause(): Animate {\n let playstate = this.getPlayState();\n this.all(anim => anim.pause());\n this.emit(\"pause\", playstate, this);\n this.stopLoop();\n this.animationFrame = undefined;\n return this;\n }\n\n /**\n * Reset all Animations\n */\n public reset() {\n this.setProgress(0);\n this.beginEvent();\n\n if (this.options.autoplay) this.play();\n else this.pause();\n return this;\n }\n\n /**\n * Cancels all Animations\n */\n public cancel() {\n this.all(anim => anim.cancel());\n this.stopLoop();\n return this;\n }\n\n /**\n * Force complete all Animations\n */\n public finish() {\n this.all(anim => anim.finish());\n this.stopLoop();\n return this;\n }\n\n /**\n * Cancels & Clears all Animations\n */\n public stop() {\n this.cancel();\n this.animations.clear();\n while (this.targets.length) this.targets.pop();\n this.mainElement = undefined;\n this.emit(\"stop\");\n }\n\n /**\n * Returns an Array of targets\n */\n public getTargets(): Node[] {\n return this.targets;\n }\n\n /**\n * Get a specific Animation from an Animate instance\n */\n public getAnimation(element: HTMLElement): Animation {\n return this.animations.get(element);\n }\n\n /**\n * Returns the timings of an Animation, given a target\n * E.g. { duration, endDelay, delay, iterations, iterationStart, direction, easing, fill, etc... }\n */\n public getTiming(target: HTMLElement | Animation): AnimationOptions & EffectTiming {\n let animation = target instanceof Animation ? target : this.getAnimation(target);\n let keyframeOptions = this.computedOptions.get(animation) ?? {};\n let timings = animation.effect?.getTiming() ?? {};\n let options = this.getOptions();\n\n return { ...DefaultAnimationOptions, ...options, ...timings, ...keyframeOptions };\n }\n\n /**\n * Returns the total duration of Animation\n */\n public getTotalDuration(): number {\n return this.totalDuration;\n }\n\n /**\n * Returns the current time of the Main Animation\n */\n public getCurrentTime(): number {\n return this.mainAnimation.currentTime;\n }\n\n /**\n * Returns the Animation progress as a fraction of the current time / duration * 100\n */\n public getProgress() {\n return (this.getCurrentTime() / this.totalDuration) * 100;\n }\n\n /**\n * Return the playback speed of the animation\n */\n public getSpeed(): number {\n return this.mainAnimation.playbackRate;\n }\n\n /**\n * Returns the current playing state\n */\n public getPlayState(): \"idle\" | \"running\" | \"paused\" | \"finished\" {\n return this.mainAnimation.playState;\n }\n\n /**\n * Get the options of an Animate instance\n */\n public getOptions(): AnimationOptions {\n return this.options;\n }\n\n /**\n * Set the current time of the Main Animation\n */\n public setCurrentTime(time: number): Animate {\n this.all(anim => { anim.currentTime = time; });\n this.emit(\"update\", this.getProgress());\n return this;\n }\n\n /**\n * Set the Animation progress as a value from 0 to 100\n */\n public setProgress(percent: number): Animate {\n let time = (percent / 100) * this.totalDuration;\n this.setCurrentTime(time);\n return this;\n }\n\n /**\n * Set the playback speed of an Animation\n */\n public setSpeed(speed: number = 1): Animate {\n this.all(anim => { anim.playbackRate = speed; });\n return this;\n }\n\n /**\n * Adds a listener for a given event\n */\n public on(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.on(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Removes a listener from an event\n */\n public off(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.off(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Call all listeners within an event\n */\n public emit(events: AnimationEvents | string | any[], ...args: any): Animate {\n this.emitter.emit(events, ...args);\n return this;\n }\n\n\n /** Returns the Animate options, as JSON */\n public toJSON(): AnimationOptions {\n return this.getOptions();\n }\n\n /**\n * The Symbol.toStringTag well-known symbol is a string valued property that is used\n * in the creation of the default string description of an object.\n * It is accessed internally by the Object.prototype.toString() method.\n */\n get [Symbol.toStringTag]() {\n return `Animate`;\n }\n}\n\n/** Creates a new Animate instance */\nexport const animate = (options: AnimationOptions = {}): Animate => {\n return new Animate(options);\n};\n\nexport class Timeline extends Animate {\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n constructor(options: AnimationOptions = {}) {\n super();\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n public add(options: AnimationOptions) {\n return this;\n }\n}\n\nexport default animate;", "import { animate } from \"@okikio/native\";\n\n/*\n anim = animate({\n target: \".div\",\n keyframes(index, total) {\n return [\n { transform: \"translateX(0px)\", opacity: 0.1 },\n { transform: \"translateX(300px)\", opacity: 0.2 + ((index + 1) / total) }\n ]\n },\n // transform: [\"translateX(0px)\", \"translateX(300px)\"],\n // opacity(index, total, element) {\n // return [0, ((index + 1) / total)];\n // },\n\n // It is best to use the onfinish() method, but in this situation fillMode works best\n fillMode: \"both\",\n // onfinish(element, index, total) {\n // element.style.opacity = `${((index + 1) / total)}`;\n // element.style.transform = \"translateX(300px)\";\n // },\n\n easing: \"out-cubic\",\n duration(index: number) {\n return (index + 1) * 500;\n },\n loop: 5,\n speed: 1.5,\n direction: \"alternate\",\n delay(index: number) {\n return ((index + 1) * 500) / 2;\n },\n autoplay: false\n });\n\n let el: HTMLElement = document.querySelector(\".info\");\n let backupInfo = el.textContent;\n let info = backupInfo;\n anim.on({\n begin() {\n if (el) {\n info = backupInfo;\n el.textContent = info;\n el.style.color = \"initial\";\n }\n }\n })\n anim.on(\"complete\", () => {\n if (el) {\n info = \"Done.\";\n el.textContent = info;\n el.style.color = \"red\";\n\n console.log(info);\n }\n });\n\n let scrub = document.getElementById('scrub') as HTMLInputElement;\n scrub.addEventListener('input', e => {\n var percent = +(e.target as HTMLInputElement).value;\n anim.setProgress(percent);\n anim.pause();\n });\n\n let progressSpan = document.querySelector(\".progress\");\n anim.on(\"update\", progress => {\n scrub.value = `` + progress;\n progressSpan && (progressSpan.textContent = `${Math.round(progress)}%`);\n });\n\n scrub.addEventListener('change', () => {\n if (Math.round(anim.getProgress()) >= 100) {\n anim.finish();\n return false;\n }\n anim.play();\n });\n\n\n let playtoggle = document.querySelector(\".playtoggle\");\n if (playtoggle) {\n playtoggle.addEventListener(\"click\", () => {\n let state = anim.getPlayState();\n if (state === \"running\") anim.pause();\n else if (state === \"finished\") anim.reset();\n else anim.play();\n console.log(state);\n });\n }\n*/\n\n/* Target Section */\n// CSS Selector Demo\n(() => {\n let containerSel = \".css-selector-demo\";\n let anim = animate({\n target: `${containerSel} .el`,\n transform: [\"translateX(0px)\", \"translateX(250px)\"],\n onfinish(element) {\n element.style.transform = \"translateX(250px)\";\n },\n duration: 500,\n autoplay: false\n });\n\n let container = document.querySelector(containerSel);\n container.addEventListener(\"click\", () => {\n anim.reset();\n anim.play();\n });\n})();\n\n// DOM Node / Nodelist Demo\n(() => {\n let containerSel = \".dom-node-demo\";\n let DOMNodes = document.querySelectorAll(`${containerSel} .el`);\n let anim = animate({\n target: DOMNodes,\n transform: [\"translateX(0px)\", \"translateX(250px)\"],\n onfinish(element) {\n element.style.transform = \"translateX(250px)\";\n },\n duration: 500,\n autoplay: false\n });\n\n let container = document.querySelector(containerSel);\n container.addEventListener(\"click\", () => {\n anim.reset();\n anim.play();\n });\n})();\n\n\n// Array Demo\n(() => {\n let containerSel = \".array-demo\";\n let el = (num: number) => `${containerSel} .el-0${num}`;\n let anim = animate({\n target: [`${containerSel} .el-01`, el(2), el(3),\n // These two elements don't exist, so, @okikio/animate ignores theme\n el(4), el(5)],\n transform: [\"translateX(0px)\", \"translateX(250px)\"],\n onfinish(element) {\n element.style.transform = \"translateX(250px)\";\n },\n autoplay: false\n });\n\n let container = document.querySelector(containerSel);\n container.addEventListener(\"click\", () => {\n anim.reset();\n anim.play();\n });\n})();\n\n\n\n/* Properties Section */\n// CSS Properties Demo\n(() => {\n let containerSel = \".css-properties-demo\";\n let anim = animate({\n target: `${containerSel} .el`,\n backgroundColor: [\"#616aff\", \"#fff\"],\n left: [\"0px\", \"240px\"],\n borderRadius: ['0%', '50%'],\n onfinish(element) {\n let { style } = element;\n style.backgroundColor = \"#fff\";\n style.left = \"240px\";\n style.borderRadius = '50%';\n },\n easing: \"in-out-quad\",\n autoplay: false\n });\n\n let container = document.querySelector(containerSel);\n container.addEventListener(\"click\", () => {\n anim.reset();\n anim.play();\n });\n})();\n\n// CSS Transforms Demo\n(() => {\n let containerSel = \".css-transform-demo\";\n let anim = animate({\n target: `${containerSel} .el`,\n transform: [`translateX(0) scale(1) rotate(0)`, `translateX(250px) scale(2) rotate(1turn)`],\n onfinish(element) {\n element.style.transform = `translateX(250px) scale(2) rotate(1turn)`;\n },\n easing: \"in-out-quad\",\n autoplay: false\n });\n\n let container = document.querySelector(containerSel);\n container.addEventListener(\"click\", () => {\n anim.reset();\n anim.play();\n });\n})();\n\n\n// SVG Attributes Demo\n(() => {\n let containerSel = \".svg-attributes-demo\";\n var pathEl = document.querySelector(`${containerSel} path`);\n\n let anim = animate({\n target: pathEl,\n strokeDashoffset: [4000, 0],\n loop: true,\n direction: \"alternate\",\n easing: \"in-out-expo\",\n autoplay: false\n });\n\n let container = document.querySelector(containerSel);\n container.addEventListener(\"click\", () => {\n // anim.reset(); // You can't reset an infinitely looped animation\n if (anim.getPlayState() === \"running\") anim.pause();\n else anim.play();\n });\n\n anim.on(\"update\", () => {\n console.log(\"Go\")\n });\n})();\n"], + "mappings": "2fACO,WAAoB,CAG1B,YAAY,EAAuB,CAClC,KAAK,IAAM,GAAI,KAAI,GAIb,QAAoB,CAC1B,MAAO,MAAK,IAIN,IAAI,EAAW,CACrB,MAAO,MAAK,IAAI,IAA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AiB,QAAS,IAAM,CAEtC,AAAI,EAAK,iBAAmB,UAAW,EAAK,QACvC,EAAK,SAGd,EAAK,GAAG,SAAU,IAAM,CACpB,QAAQ,IAAI", "names": [] } diff --git a/demo/js/main.js b/demo/js/main.js index a9815e7..e91d8d8 100644 --- a/demo/js/main.js +++ b/demo/js/main.js @@ -1,3 +1,3 @@ -var vt=Object.defineProperty;var it=Object.prototype.hasOwnProperty;var H=Object.getOwnPropertySymbols,rt=Object.prototype.propertyIsEnumerable;var nt=(r,t,e)=>t in r?vt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,c=(r,t)=>{for(var e in t||(t={}))it.call(t,e)&&nt(r,e,t[e]);if(H)for(var e of H(t))rt.call(t,e)&&nt(r,e,t[e]);return r};var U=(r,t)=>{var e={};for(var i in r)it.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&H)for(var i of H(r))t.indexOf(i)<0&&rt.call(r,i)&&(e[i]=r[i]);return e};var xt={wrapperAttr:"wrapper",noAjaxLinkAttr:"no-ajax-link",noPrefetchAttr:"no-prefetch",headers:[["x-partial","true"]],preventSelfAttr:'prevent="self"',preventAllAttr:'prevent="all"',transitionAttr:"transition",blockAttr:"block",timeout:3e4,maxPages:5},st=r=>Object.assign(c({},xt),r),St=(r,t,e=!0)=>{let{prefix:i}=r,n=`data${i?"-"+i:""}-${t}`;return e?`[${n}]`:n},h=(r,t,e=!0)=>{if(typeof t!="string")return r;let i=r[t];return typeof i=="string"?St(r,i,e):i};var d=class{constructor(t){this.map=new Map(t)}getMap(){return this.map}get(t){return this.map.get(t)}keys(){return Array.from(this.map.keys())}values(){return Array.from(this.map.values())}set(t,e){return this.map.set(t,e),this}add(t){let i=this.size;return this.set(i,t),this}get size(){return this.map.size}get length(){return this.map.size}last(t=1){let e=this.keys()[this.size-t];return this.get(e)}delete(t){return this.map.delete(t)}remove(t){return this.map.delete(t),this}clear(){return this.map.clear(),this}has(t){return this.map.has(t)}entries(){return this.map.entries()}forEach(t,e){return this.map.forEach(t,e),this}[Symbol.iterator](){return this.entries()}},v=(r,t,...e)=>{r.forEach(i=>{i[t](...e)})};var L=class{constructor(){}install(){}register(t,e){return this.manager=t,this.app=t.app,this.config=t.config,this.emitter=t.emitter,this.key=e,this.install(),this}uninstall(){}unregister(){this.uninstall(),this.manager.remove(this.key),this.key=void 0,this.manager=void 0,this.app=void 0,this.config=void 0,this.emitter=void 0}},P=class extends d{constructor(t){super();this.app=t,this.config=t.config,this.emitter=t.emitter}set(t,e){return super.set(t,e),e.register(this,t),this}};var m=(r=window.location.href)=>r instanceof URL?r:new URL(r,window.location.origin),E=r=>{let t=m(r);return`${t.pathname}${t.hash}`};var at=r=>m(r).toString().replace(/(\/#.*|\/|#.*)$/,""),C=(r,t)=>at(r)===at(t);var b=class extends L{init(){}boot(){this.initEvents()}initEvents(){}stopEvents(){}stop(){this.stopEvents(),this.unregister()}},q=class extends P{constructor(t){super(t)}init(){return v(this,"init"),this}boot(){return v(this,"boot"),this}stop(){return v(this,"stop"),this}};var w=(r=window.scrollX,t=window.scrollY)=>({x:r,y:t}),N=(r={url:E(m()),index:0,transition:"default",data:{scroll:w(),trigger:"HistoryManager"}})=>r,j=class extends b{constructor(){super(...arguments);this.pointer=-1}init(){this.states=[];let t=N();this.add(t,"replace")}get(t){return this.states[t]}add(t,e="push"){let i=N(t),n=this.length;this.states.push(c({},i)),this.pointer=n;let s={index:this.pointer,states:[...this.states]};return Lt(e,i,s),this}remove(t){return t?this.states.splice(t,1):this.states.pop(),this.pointer--,this}replace(t){return this.states=t,this}set(t,e){return this.states[t]=e}get current(){return this.get(this.pointer)}get last(){return this.get(this.length-1)}get previous(){return this.pointer<1?null:this.get(this.pointer-1)}get length(){return this.states.length}},Lt=(r,t,e)=>{let i=E(t.url),n=[e,"",i];if(window.history)switch(r){case"push":window.history.pushState.apply(window.history,n);break;case"replace":window.history.replaceState.apply(window.history,n);break}};var Pt=new DOMParser,V=class extends L{constructor(t=m(),e=document){super();this.url=t,typeof e=="string"?this.data=e:this.dom=e||document}build(){if(this.dom instanceof Node||(this.dom=Pt.parseFromString(this.data,"text/html")),!(this.body instanceof Node)){let{title:t,head:e,body:i}=this.dom;this.title=t,this.head=e,this.body=i,this.wrapper=this.body.querySelector(this.wrapperAttr)}}install(){this.wrapperAttr=h(this.config,"wrapperAttr")}uninstall(){this.url=void 0,this.title=void 0,this.head=void 0,this.body=void 0,this.dom=void 0,this.wrapper=void 0,this.data=void 0,this.wrapperAttr=void 0}},G=class extends b{constructor(){super(...arguments);this.loading=new d}install(){this.pages=new P(this.app);let t=m().pathname;this.set(t,new V),t=void 0}get(t){return this.pages.get(t)}add(t){return this.pages.add(t),this}set(t,e){return this.pages.set(t,e),this}remove(t){return this.pages.remove(t),this}has(t){return this.pages.has(t)}clear(){return this.pages.clear(),this}get size(){return this.pages.size}keys(){return this.pages.keys()}async load(t=m()){let e=m(t),i=e.pathname,n,s;if(this.has(i))return n=this.get(i),Promise.resolve(n);this.loading.has(i)?s=this.loading.get(i):(s=this.request(i),this.loading.set(i,s));let o=await s;if(this.loading.remove(i),n=new V(e,o),this.set(i,n),this.size>h(this.config,"maxPages")){let l=m(),a=this.keys(),p=C(l,a[0])?a[1]:a[0],g=this.get(p);g.unregister(),g=void 0,a=void 0,l=void 0,p=void 0}return n}async request(t){let e=new Headers(h(this.config,"headers")),i=window.setTimeout(()=>{throw window.clearTimeout(i),"Request Timed Out!"},h(this.config,"timeout"));try{let n=await fetch(t,{mode:"same-origin",method:"GET",headers:e,cache:"default",credentials:"same-origin"});if(window.clearTimeout(i),n.status>=200&&n.status<300)return await n.text();throw new Error(n.statusText||""+n.status)}catch(n){throw window.clearTimeout(i),n}}};var ot=({callback:r=()=>{},scope:t=null,name:e="event"})=>({callback:r,scope:t,name:e}),M=class extends d{constructor(t="event"){super();this.name=t}},R=class extends d{constructor(){super()}getEvent(t){let e=this.get(t);return e instanceof M?e:(this.set(t,new M(t)),this.get(t))}newListener(t,e,i){let n=this.getEvent(t);return n.add(ot({name:t,callback:e,scope:i})),n}on(t,e,i){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let n,s,o=typeof t=="object"&&!Array.isArray(t),l=o?e:i;return o||(s=e),Object.keys(t).forEach(a=>{o?(n=a,s=t[a]):n=t[a],this.newListener(n,s,l)},this),this}removeListener(t,e,i){let n=this.get(t);if(n instanceof M&&e){let s=ot({name:t,callback:e,scope:i});n.forEach((o,l)=>{if(o.callback===s.callback&&o.scope===s.scope)return n.remove(l)})}return n}off(t,e,i){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let n,s,o=typeof t=="object"&&!Array.isArray(t),l=o?e:i;return o||(s=e),Object.keys(t).forEach(a=>{o?(n=a,s=t[a]):n=t[a],typeof s=="function"?this.removeListener(n,s,l):this.remove(n)},this),this}emit(t,...e){return typeof t=="undefined"?this:(typeof t=="string"&&(t=t.trim().split(/\s/g)),t.forEach(i=>{let n=this.get(i);n instanceof M&&n.forEach(s=>{let{callback:o,scope:l}=s;o.apply(l,e)})},this),this)}clear(){return v(this,"clear"),super.clear(),this}};var X=(r,t=window.location.hash)=>{try{let e=t[0]=="#"?t:m(t).hash;if(e.length>1){let i=document.getElementById(e.slice(1));if(i){let{left:n,top:s}=i.getBoundingClientRect(),o=window.pageXOffset,l=window.pageYOffset,a=n+o,p=s+l;return console.log(a,p),w(a,p)}}}catch(e){console.warn("[hashAction] error",e)}return r!=null?r:w(0,0)},Mt={name:"default",scrollable:!0,out({done:r}){r()},in({scroll:r,done:t}){window.scroll(r.x,r.y),t()}},B=class extends b{constructor(t){super();this._arg=t}install(){var e;super.install();let t=this._arg&&this._arg.length?this._arg:(e=h(this.config,"transitions"))!=null?e:[];t=[["default",Mt]].concat(t),this.transitions=new d(t)}get(t){return this.transitions.get(t)}set(t,e){return this.transitions.set(t,e),this}add(t){return this.transitions.add(t),this}has(t){return this.transitions.has(t)}async animate(t,e){let i=this.transitions.get(t),n=e.scroll,s=e.ignoreHashAction;if(!("wrapper"in e.oldPage)||!("wrapper"in e.newPage))throw`[Page] either oldPage or newPage aren't instances of the Page Class. - ${{newPage:e.newPage,oldPage:e.oldPage}}`;document.title=""+e.newPage.title;let o=e.oldPage.wrapper,l=e.newPage.wrapper;if(!(o instanceof Node)||!(l instanceof Node))throw`[Wrapper] the wrapper from the ${l instanceof Node?"current":"next"} page cannot be found. The wrapper must be an element that has the attribute ${h(this.config,"wrapperAttr")}.`;return i.init&&(i==null||i.init(e)),this.emitter.emit("BEFORE_TRANSITION_OUT"),i.out&&await new Promise(a=>{let p=i.out.call(i,c(c({},e),{from:e.oldPage,trigger:e.trigger,done:a}));p==null||p.then(a)}),this.emitter.emit("AFTER_TRANSITION_OUT"),await new Promise(a=>{o.insertAdjacentElement("beforebegin",l),this.emitter.emit("CONTENT_INSERT"),!s&&!/back|popstate|forward/.test(e.trigger)&&(n=X(n)),a()}),await new Promise(a=>{o.remove(),o=void 0,l=void 0,this.emitter.emit("CONTENT_REPLACED"),a()}),this.emitter.emit("BEFORE_TRANSITION_IN"),i.in&&await new Promise(async a=>{let p=i.in.call(i,c(c({},e),{from:e.oldPage,to:e.newPage,trigger:e.trigger,scroll:n,done:a}));p==null||p.then(a)}),this.emitter.emit("AFTER_TRANSITION_IN"),i}};var $=class{constructor(t={}){this.register(t)}register(t={}){this.config=st(t),this.emitter=new R,this.services=new q(this);let e=(()=>{document.removeEventListener("DOMContentLoaded",e),window.removeEventListener("load",e),this.emitter.emit("READY ready")}).bind(this);return document.addEventListener("DOMContentLoaded",e),window.addEventListener("load",e),this}get(t){return this.services.get(t)}set(t,e){return this.services.set(t,e),this}add(t){return this.services.add(t),this}boot(){return this.services.init(),this.services.boot(),this}stop(){return this.services.stop(),this.emitter.clear(),this}on(t,e){return this.emitter.on(t,e,this),this}off(t,e){return this.emitter.off(t,e,this),this}emit(t,...e){return this.emitter.emit(t,...e),this}};var Y=class extends b{install(){var t,e,i,n,s,o;super.install(),this.ignoreURLs=(t=h(this.config,"ignoreURLs"))!=null?t:[],this.prefetchIgnore=(e=h(this.config,"prefetchIgnore"))!=null?e:!1,this.stopOnTransitioning=(i=h(this.config,"stopOnTransitioning"))!=null?i:!1,this.stickyScroll=(n=h(this.config,"stickyScroll"))!=null?n:!1,this.forceOnError=(s=h(this.config,"forceOnError"))!=null?s:!1,this.ignoreHashAction=(o=h(this.config,"ignoreHashAction"))!=null?o:!1}transitionStart(){this.isTransitioning=!0}transitionStop(){this.isTransitioning=!1}init(){this.onHover=this.onHover.bind(this),this.onClick=this.onClick.bind(this),this.onStateChange=this.onStateChange.bind(this)}boot(){"scrollRestoration"in window.history&&(window.history.scrollRestoration="manual"),super.boot()}getTransitionName(t){if(!t||!t.getAttribute)return null;let e=t.getAttribute(h(this.config,"transitionAttr",!1));return typeof e=="string"?e:null}validLink(t,e,i){let n=!window.history.pushState,s=!t||!i,o=e.metaKey||e.ctrlKey||e.shiftKey||e.altKey,l=t.hasAttribute("target")&&t.target==="_blank",a=t.protocol!==location.protocol||t.hostname!==location.hostname,p=typeof t.getAttribute("download")=="string",g=t.matches(h(this.config,"preventSelfAttr")),A=Boolean(t.closest(h(this.config,"preventAllAttr"))),f=E(m())===E(m(i));return!(s||n||o||l||a||p||g||A||f)}getHref(t){return t&&t.tagName&&t.tagName.toLowerCase()==="a"&&typeof t.href=="string"?t.href:null}getLink(t){let e=t.target,i=this.getHref(e);for(;e&&!i;)e=e.parentNode,i=this.getHref(e);if(!(!e||!this.validLink(e,t,i)))return e}onClick(t){let e=this.getLink(t);if(!e)return;if(this.isTransitioning&&this.stopOnTransitioning){t.preventDefault(),t.stopPropagation();return}let i=this.getHref(e);this.emitter.emit("ANCHOR_CLICK CLICK",t),this.go({href:i,trigger:e,event:t})}getDirection(t){return Math.abs(t)>1?t>0?"forward":"back":t===0?"popstate":t>0?"back":"forward"}force(t){window.location.assign(t)}go({href:t,trigger:e="HistoryManager",event:i}){if(this.isTransitioning&&this.stopOnTransitioning||!(this.manager.has("TransitionManager")&&this.manager.has("HistoryManager")&&this.manager.has("PageManager"))){this.force(t);return}let n=this.manager.get("HistoryManager"),s=w(0,0),o=n.current,l=o.url;if(C(l,t))return;let a;if(i&&i.state){this.emitter.emit("POPSTATE",i);let{state:p}=i,{index:g}=p,f=o.index-g;n.replace(p.states),n.pointer=g;let k=n.get(g);a=k.transition,s=k.data.scroll,e=this.getDirection(f),console.log(e=="forward"&&n),this.emitter.emit(e==="back"?"POPSTATE_BACK":"POPSTATE_FORWARD",i)}else{a=this.getTransitionName(e),s=w();let p=N({url:t,transition:a,data:{scroll:s}});!this.stickyScroll&&(s=w(0,0)),n.add(p),this.emitter.emit("HISTORY_NEW_ITEM",i)}return i&&(i.stopPropagation(),i.preventDefault()),this.emitter.emit("GO",i),this.load({oldHref:l,href:t,trigger:e,transitionName:a,scroll:s})}async load({oldHref:t,href:e,trigger:i,transitionName:n="default",scroll:s={x:0,y:0}}){try{let o=this.manager.get("PageManager"),l,a;this.emitter.emit("NAVIGATION_START",{oldHref:t,href:e,trigger:i,transitionName:n});try{this.transitionStart(),a=await o.load(t),!(a.dom instanceof Element)&&a.build(),this.emitter.emit("PAGE_LOADING",{href:e,oldPage:a,trigger:i}),l=await o.load(e),await l.build(),this.emitter.emit("PAGE_LOAD_COMPLETE",{newPage:l,oldPage:a,trigger:i})}catch(p){console.warn(`[PJAX] Page load error: ${p}`)}try{let p=this.manager.get("TransitionManager");this.emitter.emit("TRANSITION_START",n);let g=await p.animate(p.has(n)?n:"default",{oldPage:a,newPage:l,trigger:i,scroll:s,ignoreHashAction:this.ignoreHashAction});g.scrollable||(!this.ignoreHashAction&&!/back|popstate|forward/.test(i)&&(s=X(s)),window.scroll(s.x,s.y)),this.emitter.emit("TRANSITION_END",{transition:g})}catch(p){console.warn(`[PJAX] Transition error: ${p}`)}this.emitter.emit("NAVIGATION_END",{oldPage:a,newPage:l,trigger:i,transitionName:n})}catch(o){this.forceOnError?this.force(e):console.warn(o)}finally{this.transitionStop()}}ignoredURL({pathname:t}){return this.ignoreURLs.length&&this.ignoreURLs.some(e=>typeof e=="string"?e===t:e.exec(t)!==null)}onHover(t){let e=this.getLink(t);if(!e||!this.manager.has("PageManager"))return;let i=this.manager.get("PageManager"),n=m(this.getHref(e)),s=n.pathname;if(!(this.ignoredURL(n)||i.has(s))){this.emitter.emit("ANCHOR_HOVER HOVER",t);try{i.load(n)}catch(o){console.warn("[PJAX] prefetch error,",o)}}}onStateChange(t){this.go({href:window.location.href,trigger:"popstate",event:t})}initEvents(){this.prefetchIgnore!==!0&&(document.addEventListener("mouseover",this.onHover),document.addEventListener("touchstart",this.onHover)),document.addEventListener("click",this.onClick),window.addEventListener("popstate",this.onStateChange)}stopEvents(){this.prefetchIgnore!==!0&&(document.removeEventListener("mouseover",this.onHover),document.removeEventListener("touchstart",this.onHover)),document.removeEventListener("click",this.onClick),window.removeEventListener("popstate",this.onStateChange)}};var W=class extends b{constructor(t=[]){super();this.routes=new d;for(let e of t)this.add(e)}add({path:t,method:e}){let i=this.parse(t);return this.routes.set(i,e),this}parsePath(t){if(typeof t=="string")return new RegExp(t,"i");if(t instanceof RegExp||typeof t=="boolean")return t;throw"[Router] only regular expressions, strings and booleans are accepted as paths."}isPath(t){return typeof t=="string"||t instanceof RegExp||typeof t=="boolean"}parse(t){let e=t,i={from:/(.*)/g,to:/(.*)/g};if(this.isPath(t))i={from:!0,to:t};else if(this.isPath(e.from)&&this.isPath(e.to))i=e;else throw"[Router] path is neither a string, regular expression, or a { from, to } object.";let{from:n,to:s}=i;return{from:this.parsePath(n),to:this.parsePath(s)}}route(){if(this.manager.has("HistoryManager")){let t=this.manager.get("HistoryManager"),e=E(m((t.length>1?t.previous:t.current).url)),i=E(m());this.routes.forEach((n,s)=>{let o=s.from,l=s.to;if(typeof o=="boolean"&&typeof l=="boolean")throw`[Router] path ({ from: ${o}, to: ${l} }) is not valid, remember paths can only be strings, regular expressions, or a boolean; however, both the from and to paths cannot be both booleans.`;let a=o,p=l;o instanceof RegExp&&o.test(e)&&(a=o.exec(e)),l instanceof RegExp&&l.test(i)&&(p=l.exec(i)),(Array.isArray(p)&&Array.isArray(a)||Array.isArray(p)&&typeof a=="boolean"&&a||Array.isArray(a)&&typeof p=="boolean"&&p)&&n({from:a,to:p,path:{from:e,to:i}})})}else console.warn("[Route] HistoryManager is missing.")}initEvents(){this.emitter.on("READY",this.route,this),this.emitter.on("CONTENT_REPLACED",this.route,this)}stopEvents(){this.emitter.off("READY",this.route,this),this.emitter.off("CONTENT_REPLACED",this.route,this)}};var Rt=r=>typeof r=="string"?Array.from(document.querySelectorAll(r)):[r],kt=r=>[].concat(...r),lt=r=>Array.isArray(r)?kt(r.map(lt)):typeof r=="string"||r instanceof Node?Rt(r):r instanceof NodeList||r instanceof HTMLCollection?Array.from(r):[],pt=(r,t,e)=>typeof r=="function"?r.apply(e,t):r,ct=(r,t,e)=>{let i,n,s={},o=Object.keys(r);for(let l=0,a=o.length;l/^(in|out)/.test(r)?Ot[r]:r,ut={keyframes:[],loop:1,delay:0,speed:1,endDelay:0,easing:"ease",autoplay:!0,duration:1e3,fillMode:"auto",direction:"normal",extend:{}},D=class{constructor(t={}){this.options={};this.targets=[];this.properties={};this.animations=new d;this.totalDuration=0;this.minDelay=0;this.computedOptions=new d;this.emitter=new R;var i;try{let e=t,{options:s}=e,o=U(e,["options"]),l=s instanceof D?s.getOptions():Array.isArray(s)?(i=s==null?void 0:s[0])==null?void 0:i.getOptions():s;this.options=Object.assign({},ut,l,o),this.loop=this.loop.bind(this);let n=this.options,{loop:a,delay:p,speed:g,easing:A,endDelay:f,duration:k,direction:bt,fillMode:yt,onfinish:Z,target:Et,keyframes:At,autoplay:It,extend:wt}=n,Tt=U(n,["loop","delay","speed","easing","endDelay","duration","direction","fillMode","onfinish","target","keyframes","autoplay","extend"]);this.mainElement=document.createElement("div"),this.targets=lt(Et),this.properties=Tt;let tt=[],x=this.targets.length,O;for(let I=0;I0||(O=ct(O,[I,x,T],this));let et=y.delay+y.duration*y.iterations+y.endDelay;this.totalDuration{typeof Z=="function"&&Z.call(this,T,I,x,S),this.emit("finish",T,I,x,S)},this.computedOptions.set(S,y),this.animations.set(T,S),tt.push(y.delay)}this.mainAnimation=this.mainElement.animate([{opacity:"0"},{opacity:"1"}],{duration:this.totalDuration,easing:"linear"}),this.minDelay=Math.min(...tt),this.setSpeed(g),It?this.play():this.pause(),this.promise=this.newPromise(),this.mainAnimation.onfinish=()=>{this.emit("complete",this),this.stopLoop()}}catch(s){this.emit("error",s)}}newPromise(){return new Promise((t,e)=>{this.on("complete",()=>t([this])),this.on("error",i=>e(i))})}then(t,e){return t=t==null?void 0:t.bind(this),e=e==null?void 0:e.bind(this),this.promise.then(t,e),this}catch(t){return t=t==null?void 0:t.bind(this),this.promise.catch(t),this}finally(t){return t=t==null?void 0:t.bind(this),this.promise.finally(t),this}loop(){this.stopLoop(),this.emit("update",this.getProgress(),this),this.animationFrame=window.requestAnimationFrame(this.loop)}stopLoop(){window.cancelAnimationFrame(this.animationFrame)}all(t){return t(this.mainAnimation,this.mainElement),this.animations.forEach(t),this}beginEvent(){if(this.getProgress()==0){let t=window.setTimeout(()=>{this.emit("begin",this),t=window.clearTimeout(t)},this.minDelay)}}play(){let t=this.getPlayState();return this.beginEvent(),this.all(e=>e.play()),this.emit("play",t,this),this.loop(),this}pause(){let t=this.getPlayState();return this.all(e=>e.pause()),this.emit("pause",t,this),this.stopLoop(),this.animationFrame=void 0,this}reset(){return this.setProgress(0),this.beginEvent(),this.options.autoplay?this.play():this.pause(),this}cancel(){return this.all(t=>t.cancel()),this.stopLoop(),this}finish(){return this.all(t=>t.finish()),this.stopLoop(),this}stop(){for(this.cancel(),this.animations.clear();this.targets.length;)this.targets.pop();this.mainElement=void 0,this.emit("stop")}getTargets(){return this.targets}getAnimation(t){return this.animations.get(t)}getTiming(t){var o,l,a;let e=t instanceof Animation?t:this.getAnimation(t),i=(o=this.computedOptions.get(e))!=null?o:{},n=(a=(l=e.effect)==null?void 0:l.getTiming())!=null?a:{},s=this.getOptions();return c(c(c(c({},ut),s),n),i)}getTotalDuration(){return this.totalDuration}getCurrentTime(){return this.mainAnimation.currentTime}getProgress(){return this.getCurrentTime()/this.totalDuration*100}getSpeed(){return this.mainAnimation.playbackRate}getPlayState(){return this.mainAnimation.playState}getOptions(){return this.options}setCurrentTime(t){return this.all(e=>{e.currentTime=t}),this.emit("update",this.getProgress()),this}setProgress(t){let e=t/100*this.totalDuration;return this.setCurrentTime(e),this}setSpeed(t=1){return this.all(e=>{e.playbackRate=t}),this}on(t,e,i){return this.emitter.on(t,e,i!=null?i:this),this}off(t,e,i){return this.emitter.off(t,e,i!=null?i:this),this}emit(t,...e){return this.emitter.emit(t,...e),this}toJSON(){return this.getOptions()}get[Symbol.toStringTag](){return"Animate"}},u=(r={})=>new D(r);var J=class extends b{constructor(){super(...arguments);this.minimalDuration=1e3}init(){super.init(),this.rootElement=document.getElementById("splashscreen"),this.rootElement&&(this.innerEl=this.rootElement.querySelector(".splashscreen-inner"),this.bgEl=this.rootElement.querySelector(".splashscreen-bg"),this.spinnerEl=[...this.rootElement.querySelectorAll(".spinner")]),this.rootElement.style.visibility="visible",this.rootElement.style.pointerEvents="auto"}boot(){this.rootElement&&this.hide()}async hide(){await new Promise(t=>{window.setTimeout(()=>{this.emitter.emit("BEFORE_SPLASHSCREEN_HIDE"),t()},this.minimalDuration)}),await new Promise(async t=>{u({target:this.innerEl,opacity:[1,0],autoplay:!0,duration:500,onfinish(e){e.style.opacity="0"}}).then(function(){this.stop()}),this.emitter.emit("START_SPLASHSCREEN_HIDE"),await this.show(),t()})}async show(){let[t]=await u({target:this.rootElement,transform:["translateY(0%)","translateY(100%)"],duration:1200,easing:"in-out-cubic"});this.emitter.emit("AFTER_SPLASHSCREEN_HIDE"),t.stop(),this.rootElement.style.transform="translateY(100%)",this.rootElement.style.visibility="hidden",this.rootElement.style.pointerEvents="none"}};var Q=class extends b{init(){super.init(),this.elements=[...document.querySelectorAll(".intro-animation")]}newPage(){this.init(),this.prepareToShow()}initEvents(){this.emitter.on("BEFORE_SPLASHSCREEN_HIDE",this.prepareToShow,this),this.emitter.on("CONTENT_REPLACED",this.newPage,this),this.emitter.on("START_SPLASHSCREEN_HIDE BEFORE_TRANSITION_IN",this.show,this)}stopEvents(){this.emitter.off("BEFORE_SPLASHSCREEN_HIDE",this.prepareToShow,this),this.emitter.off("CONTENT_REPLACED",this.newPage,this),this.emitter.off("START_SPLASHSCREEN_HIDE BEFORE_TRANSITION_IN",this.show,this)}stop(){requestAnimationFrame(()=>{for(let t of this.elements)t.style.transform="translateY(0px)",t.style.opacity="1"}),super.stop()}prepareToShow(){requestAnimationFrame(()=>{for(let t of this.elements)t.style.transform="translateY(200px)",t.style.opacity="0"})}async show(){let[t]=await u({target:this.elements,keyframes:[{transform:"translateY(200px)",opacity:0},{transform:"translateY(0px)",opacity:1}],delay(e){return 300*(e+1)},onfinish(e){requestAnimationFrame(()=>{e.style.transform="translateY(0px)",e.style.opacity="1"})},easing:"out-cubic",duration:650});return t.stop(),t}};var mt={name:"default",duration:500,scrollable:!0,out({from:r}){let{duration:t}=this,e=r.wrapper;return u({target:e,opacity:[1,0],duration:t}).on("finish",function(){this.stop()})},in({to:r,scroll:t}){let{duration:e}=this,i=r.wrapper;return window.scroll(t.x,t.y),u({target:i,opacity:[0,1],duration:e}).then(function(){this.stop()})}};var ht={name:"big",delay:200,durationPerAnimation:700,scrollable:!0,init(){this.mainElement=document.getElementById("big-transition"),this.spinnerElement=this.mainElement.querySelector(".spinner"),this.horizontalElements=[...this.mainElement.querySelector("#big-transition-horizontal").querySelectorAll("div")],this.maxLength=this.horizontalElements.length},out({from:r,scroll:t}){let{durationPerAnimation:e,delay:i}=this,n=r.wrapper;window.scroll(t.x,t.y);let s=Object.assign({},n.style);return new Promise(async o=>{this.mainElement.style.opacity="1",this.mainElement.style.visibility="visible",u({target:n,opacity:[1,0],duration:e,onfinish(f){f.style.opacity="0"}}).then(function(){this.stop()});let[a]=await u({target:this.horizontalElements,keyframes:[{transform:"scaleX(0)"},{transform:"scaleX(1)"}],delay(f){return i*(f+1)},onfinish(f){f.style.transform="scaleX(1)"},easing:"out-cubic",duration:500});n.style.opacity="1",Object.assign(n.style,s),this.spinnerElement.style.visibility="visible";let p=500,[g]=await u({target:this.spinnerElement,opacity:[0,1],duration:p,onfinish(f){f.style.opacity="1"}}),[A]=await u({options:g,opacity:[1,0],onfinish(f){f.style.opacity="0"},delay:1500});this.spinnerElement.style.visibility="hidden",g.stop(),A.stop(),o()})},in({to:r,scroll:t}){let{durationPerAnimation:e,delay:i}=this,n=r.wrapper;return window.scroll(t.x,t.y),new Promise(async s=>{let o=u({target:n,opacity:[0,1],duration:e}).then(()=>{o.stop()}),[l]=await u({target:this.horizontalElements,keyframes:[{transform:"scaleX(1)"},{transform:"scaleX(0)"}],delay(a){return i*(a+1)},onfinish(a){a.style.transform="scaleX(0)"},easing:"out-cubic",duration:500});this.mainElement.style.opacity="0",this.mainElement.style.visibility="hidden",l.stop(),s()})}};var _={name:"slide",duration:500,direction:"right",scrollable:!0,init(r){let t=r.trigger;t instanceof Node&&t.hasAttribute("data-direction")?this.direction=t.getAttribute("data-direction"):this.direction="right"},out({from:r}){let{duration:t,direction:e}=this,i=r.wrapper;return u({target:i,keyframes:[{transform:"translateX(0%)",opacity:1},{transform:`translateX(${e==="left"?"-":""}25%)`,opacity:0}],duration:t,easing:"in-quint"}).then(function(){this.stop()})},in({to:r,scroll:t}){let{duration:e}=this,i=r.wrapper;return window.scroll(t.x,t.y),u({target:i,keyframes:[{transform:`translateX(${this.direction==="right"?"-":""}25%)`,opacity:0},{transform:"translateX(0%)",opacity:1}],duration:e,easing:"out-quint"}).then(function(){this.stop()})}},gt=c(c({},_),{name:"slide-left",direction:"left",init(r){}}),ft=c(c({},_),{name:"slide-right",direction:"right",init(r){}});var dt,K,Ct,z=new $;z.add(new Q).add(dt=new J).set("HistoryManager",new j).set("PageManager",new G).set("TransitionManager",new B([["default",mt],["BigTransition",ht],["Slide",_],["SlideLeft",gt],["SlideRight",ft]])).set("router",K=new W).add(Ct=new Y);try{K=z.get("router");let r=document.querySelectorAll(".navbar .nav-link");for(let e of r){let i=e;K.add({path:i.getAttribute("data-path")||i.pathname,method(){i.classList.contains("active")||i.classList.add("active");for(let s of r)s!==i&&s.classList.remove("active")}})}let t;K.add({path:/(index|\/$)(\.html)?/,method(){t=u({target:".div",keyframes(a,p){return[{transform:"translateX(0px)",opacity:.1},{transform:"translateX(300px)",opacity:.2+(a+1)/p}]},fillMode:"both",easing:"out-cubic",duration(a){return(a+1)*500},loop:5,speed:1.5,direction:"alternate",delay(a){return(a+1)*500/2},autoplay:!1});let e=document.querySelector(".info"),i=e.textContent,n=i;t.on({begin(){e&&(n=i,e.textContent=n,e.style.color="initial")}}),t.on("complete",()=>{e&&(n="Done.",e.textContent=n,e.style.color="red",console.log(n))});let s=document.getElementById("scrub");s.addEventListener("input",a=>{var p=+a.target.value;t.setProgress(p),t.pause()});let o=document.querySelector(".progress");t.on("update",a=>{s.value=""+a,o&&(o.textContent=`${Math.round(a)}%`)}),s.addEventListener("change",()=>{if(Math.round(t.getProgress())>=100)return t.finish(),!1;t.play()});let l=document.querySelector(".playtoggle");l&&l.addEventListener("click",()=>{let a=t.getPlayState();a==="running"?t.pause():a==="finished"?t.reset():t.play(),console.log(a)})}}),z.on("AFTER_SPLASHSCREEN_HIDE",()=>{t==null||t.play()}),z.boot()}catch(r){dt.show(),console.warn("[App] boot failed,",r)} +var Tt=Object.defineProperty;var rt=Object.prototype.hasOwnProperty;var H=Object.getOwnPropertySymbols,nt=Object.prototype.propertyIsEnumerable;var st=(r,t,e)=>t in r?Tt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,c=(r,t)=>{for(var e in t||(t={}))rt.call(t,e)&&st(r,e,t[e]);if(H)for(var e of H(t))nt.call(t,e)&&st(r,e,t[e]);return r};var F=(r,t)=>{var e={};for(var i in r)rt.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&H)for(var i of H(r))t.indexOf(i)<0&&nt.call(r,i)&&(e[i]=r[i]);return e};var xt={wrapperAttr:"wrapper",noAjaxLinkAttr:"no-ajax-link",noPrefetchAttr:"no-prefetch",headers:[["x-partial","true"]],preventSelfAttr:'prevent="self"',preventAllAttr:'prevent="all"',transitionAttr:"transition",blockAttr:"block",timeout:3e4,maxPages:5},at=r=>Object.assign(c({},xt),r),Lt=(r,t,e=!0)=>{let{prefix:i}=r,n=`data${i?"-"+i:""}-${t}`;return e?`[${n}]`:n},u=(r,t,e=!0)=>{if(typeof t!="string")return r;let i=r[t];return typeof i=="string"?Lt(r,i,e):i};var f=class{constructor(t){this.map=new Map(t)}getMap(){return this.map}get(t){return this.map.get(t)}keys(){return Array.from(this.map.keys())}values(){return Array.from(this.map.values())}set(t,e){return this.map.set(t,e),this}add(t){let i=this.size;return this.set(i,t),this}get size(){return this.map.size}get length(){return this.map.size}last(t=1){let e=this.keys()[this.size-t];return this.get(e)}delete(t){return this.map.delete(t)}remove(t){return this.map.delete(t),this}clear(){return this.map.clear(),this}has(t){return this.map.has(t)}entries(){return this.map.entries()}forEach(t,e){return this.map.forEach(t,e),this}[Symbol.iterator](){return this.entries()}},T=(r,t,...e)=>{r.forEach(i=>{i[t](...e)})};var S=class{constructor(){}install(){}register(t,e){return this.manager=t,this.app=t.app,this.config=t.config,this.emitter=t.emitter,this.key=e,this.install(),this}uninstall(){}unregister(){this.uninstall(),this.manager.remove(this.key),this.key=void 0,this.manager=void 0,this.app=void 0,this.config=void 0,this.emitter=void 0}},M=class extends f{constructor(t){super();this.app=t,this.config=t.config,this.emitter=t.emitter}set(t,e){return super.set(t,e),e.register(this,t),this}};var h=(r=window.location.href)=>r instanceof URL?r:new URL(r,window.location.origin),A=r=>{let t=h(r);return`${t.pathname}${t.hash}`};var ot=r=>h(r).toString().replace(/(\/#.*|\/|#.*)$/,""),C=(r,t)=>ot(r)===ot(t);var d=class extends S{init(){}boot(){this.initEvents()}initEvents(){}stopEvents(){}stop(){this.stopEvents(),this.unregister()}},q=class extends M{constructor(t){super(t)}init(){return T(this,"init"),this}boot(){return T(this,"boot"),this}stop(){return T(this,"stop"),this}};var I=(r=window.scrollX,t=window.scrollY)=>({x:r,y:t}),N=(r={url:A(h()),index:0,transition:"default",data:{scroll:I(),trigger:"HistoryManager"}})=>r,j=class extends d{constructor(){super(...arguments);this.pointer=-1}init(){this.states=[];let t=N();this.add(t,"replace")}get(t){return this.states[t]}add(t,e="push"){let i=N(t),n=this.length;this.states.push(c({},i)),this.pointer=n;let s={index:this.pointer,states:[...this.states]};return St(e,i,s),this}remove(t){return t?this.states.splice(t,1):this.states.pop(),this.pointer--,this}replace(t){return this.states=t,this}set(t,e){return this.states[t]=e}get current(){return this.get(this.pointer)}get last(){return this.get(this.length-1)}get previous(){return this.pointer<1?null:this.get(this.pointer-1)}get length(){return this.states.length}},St=(r,t,e)=>{let i=A(t.url),n=[e,"",i];if(window.history)switch(r){case"push":window.history.pushState.apply(window.history,n);break;case"replace":window.history.replaceState.apply(window.history,n);break}};var Mt=new DOMParser,V=class extends S{constructor(t=h(),e=document){super();this.url=t,typeof e=="string"?this.data=e:this.dom=e||document}build(){if(this.dom instanceof Node||(this.dom=Mt.parseFromString(this.data,"text/html")),!(this.body instanceof Node)){let{title:t,head:e,body:i}=this.dom;this.title=t,this.head=e,this.body=i,this.wrapper=this.body.querySelector(this.wrapperAttr)}}install(){this.wrapperAttr=u(this.config,"wrapperAttr")}uninstall(){this.url=void 0,this.title=void 0,this.head=void 0,this.body=void 0,this.dom=void 0,this.wrapper=void 0,this.data=void 0,this.wrapperAttr=void 0}},G=class extends d{constructor(){super(...arguments);this.loading=new f}install(){this.pages=new M(this.app);let t=h().pathname;this.set(t,new V),t=void 0}get(t){return this.pages.get(t)}add(t){return this.pages.add(t),this}set(t,e){return this.pages.set(t,e),this}remove(t){return this.pages.remove(t),this}has(t){return this.pages.has(t)}clear(){return this.pages.clear(),this}get size(){return this.pages.size}keys(){return this.pages.keys()}async load(t=h()){let e=h(t),i=e.pathname,n,s;if(this.has(i))return n=this.get(i),Promise.resolve(n);this.loading.has(i)?s=this.loading.get(i):(s=this.request(i),this.loading.set(i,s));let o=await s;if(this.loading.remove(i),n=new V(e,o),this.set(i,n),this.size>u(this.config,"maxPages")){let l=h(),a=this.keys(),p=C(l,a[0])?a[1]:a[0],m=this.get(p);m.unregister(),m=void 0,a=void 0,l=void 0,p=void 0}return n}async request(t){let e=new Headers(u(this.config,"headers")),i=window.setTimeout(()=>{throw window.clearTimeout(i),"Request Timed Out!"},u(this.config,"timeout"));try{let n=await fetch(t,{mode:"same-origin",method:"GET",headers:e,cache:"default",credentials:"same-origin"});if(window.clearTimeout(i),n.status>=200&&n.status<300)return await n.text();throw new Error(n.statusText||""+n.status)}catch(n){throw window.clearTimeout(i),n}}};var lt=({callback:r=()=>{},scope:t=null,name:e="event"})=>({callback:r,scope:t,name:e}),P=class extends f{constructor(t="event"){super();this.name=t}},k=class extends f{constructor(){super()}getEvent(t){let e=this.get(t);return e instanceof P?e:(this.set(t,new P(t)),this.get(t))}newListener(t,e,i){let n=this.getEvent(t);return n.add(lt({name:t,callback:e,scope:i})),n}on(t,e,i){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let n,s,o=typeof t=="object"&&!Array.isArray(t),l=o?e:i;return o||(s=e),Object.keys(t).forEach(a=>{o?(n=a,s=t[a]):n=t[a],this.newListener(n,s,l)},this),this}removeListener(t,e,i){let n=this.get(t);if(n instanceof P&&e){let s=lt({name:t,callback:e,scope:i});n.forEach((o,l)=>{if(o.callback===s.callback&&o.scope===s.scope)return n.remove(l)})}return n}off(t,e,i){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let n,s,o=typeof t=="object"&&!Array.isArray(t),l=o?e:i;return o||(s=e),Object.keys(t).forEach(a=>{o?(n=a,s=t[a]):n=t[a],typeof s=="function"?this.removeListener(n,s,l):this.remove(n)},this),this}emit(t,...e){return typeof t=="undefined"?this:(typeof t=="string"&&(t=t.trim().split(/\s/g)),t.forEach(i=>{let n=this.get(i);n instanceof P&&n.forEach(s=>{let{callback:o,scope:l}=s;o.apply(l,e)})},this),this)}clear(){return T(this,"clear"),super.clear(),this}};var X=(r,t=window.location.hash)=>{try{let e=t[0]=="#"?t:h(t).hash;if(e.length>1){let i=document.getElementById(e.slice(1));if(i){let{left:n,top:s}=i.getBoundingClientRect(),o=window.pageXOffset,l=window.pageYOffset,a=n+o,p=s+l;return console.log(a,p),I(a,p)}}}catch(e){console.warn("[hashAction] error",e)}return r!=null?r:I(0,0)},Pt={name:"default",scrollable:!0,out({done:r}){r()},in({scroll:r,done:t}){window.scroll(r.x,r.y),t()}},$=class extends d{constructor(t){super();this._arg=t}install(){var e;super.install();let t=this._arg&&this._arg.length?this._arg:(e=u(this.config,"transitions"))!=null?e:[];t=[["default",Pt]].concat(t),this.transitions=new f(t)}get(t){return this.transitions.get(t)}set(t,e){return this.transitions.set(t,e),this}add(t){return this.transitions.add(t),this}has(t){return this.transitions.has(t)}async animate(t,e){let i=this.transitions.get(t),n=e.scroll,s=e.ignoreHashAction;if(!("wrapper"in e.oldPage)||!("wrapper"in e.newPage))throw`[Page] either oldPage or newPage aren't instances of the Page Class. + ${{newPage:e.newPage,oldPage:e.oldPage}}`;document.title=""+e.newPage.title;let o=e.oldPage.wrapper,l=e.newPage.wrapper;if(!(o instanceof Node)||!(l instanceof Node))throw`[Wrapper] the wrapper from the ${l instanceof Node?"current":"next"} page cannot be found. The wrapper must be an element that has the attribute ${u(this.config,"wrapperAttr")}.`;return i.init&&(i==null||i.init(e)),this.emitter.emit("BEFORE_TRANSITION_OUT"),i.out&&await new Promise(a=>{let p=i.out.call(i,c(c({},e),{from:e.oldPage,trigger:e.trigger,done:a}));p==null||p.then(a)}),this.emitter.emit("AFTER_TRANSITION_OUT"),await new Promise(a=>{o.insertAdjacentElement("beforebegin",l),this.emitter.emit("CONTENT_INSERT"),!s&&!/back|popstate|forward/.test(e.trigger)&&(n=X(n)),a()}),await new Promise(a=>{o.remove(),o=void 0,l=void 0,this.emitter.emit("CONTENT_REPLACED"),a()}),this.emitter.emit("BEFORE_TRANSITION_IN"),i.in&&await new Promise(async a=>{let p=i.in.call(i,c(c({},e),{from:e.oldPage,to:e.newPage,trigger:e.trigger,scroll:n,done:a}));p==null||p.then(a)}),this.emitter.emit("AFTER_TRANSITION_IN"),i}};var B=class{constructor(t={}){this.register(t)}register(t={}){this.config=at(t),this.emitter=new k,this.services=new q(this);let e=(()=>{document.removeEventListener("DOMContentLoaded",e),window.removeEventListener("load",e),this.emitter.emit("READY ready")}).bind(this);return document.addEventListener("DOMContentLoaded",e),window.addEventListener("load",e),this}get(t){return this.services.get(t)}set(t,e){return this.services.set(t,e),this}add(t){return this.services.add(t),this}boot(){return this.services.init(),this.services.boot(),this}stop(){return this.services.stop(),this.emitter.clear(),this}on(t,e){return this.emitter.on(t,e,this),this}off(t,e){return this.emitter.off(t,e,this),this}emit(t,...e){return this.emitter.emit(t,...e),this}};var Y=class extends d{install(){var t,e,i,n,s,o;super.install(),this.ignoreURLs=(t=u(this.config,"ignoreURLs"))!=null?t:[],this.prefetchIgnore=(e=u(this.config,"prefetchIgnore"))!=null?e:!1,this.stopOnTransitioning=(i=u(this.config,"stopOnTransitioning"))!=null?i:!1,this.stickyScroll=(n=u(this.config,"stickyScroll"))!=null?n:!1,this.forceOnError=(s=u(this.config,"forceOnError"))!=null?s:!1,this.ignoreHashAction=(o=u(this.config,"ignoreHashAction"))!=null?o:!1}transitionStart(){this.isTransitioning=!0}transitionStop(){this.isTransitioning=!1}init(){this.onHover=this.onHover.bind(this),this.onClick=this.onClick.bind(this),this.onStateChange=this.onStateChange.bind(this)}boot(){"scrollRestoration"in window.history&&(window.history.scrollRestoration="manual"),super.boot()}getTransitionName(t){if(!t||!t.getAttribute)return null;let e=t.getAttribute(u(this.config,"transitionAttr",!1));return typeof e=="string"?e:null}validLink(t,e,i){let n=!window.history.pushState,s=!t||!i,o=e.metaKey||e.ctrlKey||e.shiftKey||e.altKey,l=t.hasAttribute("target")&&t.target==="_blank",a=t.protocol!==location.protocol||t.hostname!==location.hostname,p=typeof t.getAttribute("download")=="string",m=t.matches(u(this.config,"preventSelfAttr")),E=Boolean(t.closest(u(this.config,"preventAllAttr"))),g=A(h())===A(h(i));return!(s||n||o||l||a||p||m||E||g)}getHref(t){return t&&t.tagName&&t.tagName.toLowerCase()==="a"&&typeof t.href=="string"?t.href:null}getLink(t){let e=t.target,i=this.getHref(e);for(;e&&!i;)e=e.parentNode,i=this.getHref(e);if(!(!e||!this.validLink(e,t,i)))return e}onClick(t){let e=this.getLink(t);if(!e)return;if(this.isTransitioning&&this.stopOnTransitioning){t.preventDefault(),t.stopPropagation();return}let i=this.getHref(e);this.emitter.emit("ANCHOR_CLICK CLICK",t),this.go({href:i,trigger:e,event:t})}getDirection(t){return Math.abs(t)>1?t>0?"forward":"back":t===0?"popstate":t>0?"back":"forward"}force(t){window.location.assign(t)}go({href:t,trigger:e="HistoryManager",event:i}){if(this.isTransitioning&&this.stopOnTransitioning||!(this.manager.has("TransitionManager")&&this.manager.has("HistoryManager")&&this.manager.has("PageManager"))){this.force(t);return}let n=this.manager.get("HistoryManager"),s=I(0,0),o=n.current,l=o.url;if(C(l,t))return;let a;if(i&&i.state){this.emitter.emit("POPSTATE",i);let{state:p}=i,{index:m}=p,g=o.index-m;n.replace(p.states),n.pointer=m;let R=n.get(m);a=R.transition,s=R.data.scroll,e=this.getDirection(g),console.log(e=="forward"&&n),this.emitter.emit(e==="back"?"POPSTATE_BACK":"POPSTATE_FORWARD",i)}else{a=this.getTransitionName(e),s=I();let p=N({url:t,transition:a,data:{scroll:s}});!this.stickyScroll&&(s=I(0,0)),n.add(p),this.emitter.emit("HISTORY_NEW_ITEM",i)}return i&&(i.stopPropagation(),i.preventDefault()),this.emitter.emit("GO",i),this.load({oldHref:l,href:t,trigger:e,transitionName:a,scroll:s})}async load({oldHref:t,href:e,trigger:i,transitionName:n="default",scroll:s={x:0,y:0}}){try{let o=this.manager.get("PageManager"),l,a;this.emitter.emit("NAVIGATION_START",{oldHref:t,href:e,trigger:i,transitionName:n});try{this.transitionStart(),a=await o.load(t),!(a.dom instanceof Element)&&a.build(),this.emitter.emit("PAGE_LOADING",{href:e,oldPage:a,trigger:i}),l=await o.load(e),await l.build(),this.emitter.emit("PAGE_LOAD_COMPLETE",{newPage:l,oldPage:a,trigger:i})}catch(p){console.warn(`[PJAX] Page load error: ${p}`)}try{let p=this.manager.get("TransitionManager");this.emitter.emit("TRANSITION_START",n);let m=await p.animate(p.has(n)?n:"default",{oldPage:a,newPage:l,trigger:i,scroll:s,ignoreHashAction:this.ignoreHashAction});m.scrollable||(!this.ignoreHashAction&&!/back|popstate|forward/.test(i)&&(s=X(s)),window.scroll(s.x,s.y)),this.emitter.emit("TRANSITION_END",{transition:m})}catch(p){console.warn(`[PJAX] Transition error: ${p}`)}this.emitter.emit("NAVIGATION_END",{oldPage:a,newPage:l,trigger:i,transitionName:n})}catch(o){this.forceOnError?this.force(e):console.warn(o)}finally{this.transitionStop()}}ignoredURL({pathname:t}){return this.ignoreURLs.length&&this.ignoreURLs.some(e=>typeof e=="string"?e===t:e.exec(t)!==null)}onHover(t){let e=this.getLink(t);if(!e||!this.manager.has("PageManager"))return;let i=this.manager.get("PageManager"),n=h(this.getHref(e)),s=n.pathname;if(!(this.ignoredURL(n)||i.has(s))){this.emitter.emit("ANCHOR_HOVER HOVER",t);try{i.load(n)}catch(o){console.warn("[PJAX] prefetch error,",o)}}}onStateChange(t){this.go({href:window.location.href,trigger:"popstate",event:t})}initEvents(){this.prefetchIgnore!==!0&&(document.addEventListener("mouseover",this.onHover),document.addEventListener("touchstart",this.onHover)),document.addEventListener("click",this.onClick),window.addEventListener("popstate",this.onStateChange)}stopEvents(){this.prefetchIgnore!==!0&&(document.removeEventListener("mouseover",this.onHover),document.removeEventListener("touchstart",this.onHover)),document.removeEventListener("click",this.onClick),window.removeEventListener("popstate",this.onStateChange)}};var W=class extends d{constructor(t=[]){super();this.routes=new f;for(let e of t)this.add(e)}add({path:t,method:e}){let i=this.parse(t);return this.routes.set(i,e),this}parsePath(t){if(typeof t=="string")return new RegExp(t,"i");if(t instanceof RegExp||typeof t=="boolean")return t;throw"[Router] only regular expressions, strings and booleans are accepted as paths."}isPath(t){return typeof t=="string"||t instanceof RegExp||typeof t=="boolean"}parse(t){let e=t,i={from:/(.*)/g,to:/(.*)/g};if(this.isPath(t))i={from:!0,to:t};else if(this.isPath(e.from)&&this.isPath(e.to))i=e;else throw"[Router] path is neither a string, regular expression, or a { from, to } object.";let{from:n,to:s}=i;return{from:this.parsePath(n),to:this.parsePath(s)}}route(){if(this.manager.has("HistoryManager")){let t=this.manager.get("HistoryManager"),e=A(h((t.length>1?t.previous:t.current).url)),i=A(h());this.routes.forEach((n,s)=>{let o=s.from,l=s.to;if(typeof o=="boolean"&&typeof l=="boolean")throw`[Router] path ({ from: ${o}, to: ${l} }) is not valid, remember paths can only be strings, regular expressions, or a boolean; however, both the from and to paths cannot be both booleans.`;let a=o,p=l;o instanceof RegExp&&o.test(e)&&(a=o.exec(e)),l instanceof RegExp&&l.test(i)&&(p=l.exec(i)),(Array.isArray(p)&&Array.isArray(a)||Array.isArray(p)&&typeof a=="boolean"&&a||Array.isArray(a)&&typeof p=="boolean"&&p)&&n({from:a,to:p,path:{from:e,to:i}})})}else console.warn("[Route] HistoryManager is missing.")}initEvents(){this.emitter.on("READY",this.route,this),this.emitter.on("CONTENT_REPLACED",this.route,this)}stopEvents(){this.emitter.off("READY",this.route,this),this.emitter.off("CONTENT_REPLACED",this.route,this)}};var kt=r=>typeof r=="string"?Array.from(document.querySelectorAll(r)):[r],Rt=r=>[].concat(...r),pt=r=>Array.isArray(r)?Rt(r.map(pt)):typeof r=="string"||r instanceof Node?kt(r):r instanceof NodeList||r instanceof HTMLCollection?Array.from(r):[],ct=(r,t,e)=>typeof r=="function"?r.apply(e,t):r,ht=(r,t,e)=>{let i,n,s={},o=Object.keys(r);for(let l=0,a=o.length;l/^(in|out)/.test(r)?Ot[r]:r,ut={keyframes:[],loop:1,delay:0,speed:1,endDelay:0,easing:"ease",autoplay:!0,duration:1e3,fillMode:"auto",direction:"normal",extend:{}},D=class{constructor(t={}){this.options={};this.targets=[];this.properties={};this.animations=new f;this.totalDuration=0;this.minDelay=0;this.computedOptions=new f;this.emitter=new k;var i;try{let e=t,{options:s}=e,o=F(e,["options"]),l=s instanceof D?s.getOptions():Array.isArray(s)?(i=s==null?void 0:s[0])==null?void 0:i.getOptions():s;this.options=Object.assign({},ut,l,o),this.loop=this.loop.bind(this);let n=this.options,{loop:a,delay:p,speed:m,easing:E,endDelay:g,duration:R,direction:bt,fillMode:yt,onfinish:tt,target:At,keyframes:Et,autoplay:vt,extend:It}=n,wt=F(n,["loop","delay","speed","easing","endDelay","duration","direction","fillMode","onfinish","target","keyframes","autoplay","extend"]);this.mainElement=document.createElement("div"),this.targets=pt(At),this.properties=wt;let et=[],x=this.targets.length,O;for(let v=0;v0||(O=ht(O,[v,x,w],this));let it=y.delay+y.duration*y.iterations+y.endDelay;this.totalDuration{typeof tt=="function"&&tt.call(this,w,v,x,L),this.emit("finish",w,v,x,L)},this.computedOptions.set(L,y),this.animations.set(w,L),et.push(y.delay)}this.mainAnimation=this.mainElement.animate([{opacity:"0"},{opacity:"1"}],{duration:this.totalDuration,easing:"linear"}),this.minDelay=Math.min(...et),this.setSpeed(m),vt?this.play():this.pause(),this.promise=this.newPromise(),this.mainAnimation.onfinish=()=>{this.emit("complete",this),this.stopLoop()}}catch(s){this.emit("error",s)}}newPromise(){return new Promise((t,e)=>{this.on("complete",()=>t([this])),this.on("error",i=>e(i))})}then(t,e){return t=t==null?void 0:t.bind(this),e=e==null?void 0:e.bind(this),this.promise.then(t,e),this}catch(t){return t=t==null?void 0:t.bind(this),this.promise.catch(t),this}finally(t){return t=t==null?void 0:t.bind(this),this.promise.finally(t),this}loop(){this.stopLoop(),this.emit("update",this.getProgress(),this),this.animationFrame=window.requestAnimationFrame(this.loop)}stopLoop(){window.cancelAnimationFrame(this.animationFrame)}all(t){return t(this.mainAnimation,this.mainElement),this.animations.forEach(t),this}beginEvent(){if(this.getProgress()==0){let t=window.setTimeout(()=>{this.emit("begin",this),t=window.clearTimeout(t)},this.minDelay)}}play(){let t=this.getPlayState();return this.beginEvent(),this.all(e=>e.play()),this.emit("play",t,this),this.loop(),this}pause(){let t=this.getPlayState();return this.all(e=>e.pause()),this.emit("pause",t,this),this.stopLoop(),this.animationFrame=void 0,this}reset(){return this.setProgress(0),this.beginEvent(),this.options.autoplay?this.play():this.pause(),this}cancel(){return this.all(t=>t.cancel()),this.stopLoop(),this}finish(){return this.all(t=>t.finish()),this.stopLoop(),this}stop(){for(this.cancel(),this.animations.clear();this.targets.length;)this.targets.pop();this.mainElement=void 0,this.emit("stop")}getTargets(){return this.targets}getAnimation(t){return this.animations.get(t)}getTiming(t){var o,l,a;let e=t instanceof Animation?t:this.getAnimation(t),i=(o=this.computedOptions.get(e))!=null?o:{},n=(a=(l=e.effect)==null?void 0:l.getTiming())!=null?a:{},s=this.getOptions();return c(c(c(c({},ut),s),n),i)}getTotalDuration(){return this.totalDuration}getCurrentTime(){return this.mainAnimation.currentTime}getProgress(){return this.getCurrentTime()/this.totalDuration*100}getSpeed(){return this.mainAnimation.playbackRate}getPlayState(){return this.mainAnimation.playState}getOptions(){return this.options}setCurrentTime(t){return this.all(e=>{e.currentTime=t}),this.emit("update",this.getProgress()),this}setProgress(t){let e=t/100*this.totalDuration;return this.setCurrentTime(e),this}setSpeed(t=1){return this.all(e=>{e.playbackRate=t}),this}on(t,e,i){return this.emitter.on(t,e,i!=null?i:this),this}off(t,e,i){return this.emitter.off(t,e,i!=null?i:this),this}emit(t,...e){return this.emitter.emit(t,...e),this}toJSON(){return this.getOptions()}get[Symbol.toStringTag](){return"Animate"}},b=(r={})=>new D(r);var J=class extends d{init(){super.init(),this.elements=[...document.querySelectorAll(".intro-animation")]}newPage(){this.init(),this.prepareToShow()}initEvents(){this.emitter.on("BEFORE_SPLASHSCREEN_HIDE",this.prepareToShow,this),this.emitter.on("CONTENT_REPLACED",this.newPage,this),this.emitter.on("START_SPLASHSCREEN_HIDE BEFORE_TRANSITION_IN",this.show,this)}stopEvents(){this.emitter.off("BEFORE_SPLASHSCREEN_HIDE",this.prepareToShow,this),this.emitter.off("CONTENT_REPLACED",this.newPage,this),this.emitter.off("START_SPLASHSCREEN_HIDE BEFORE_TRANSITION_IN",this.show,this)}stop(){requestAnimationFrame(()=>{for(let t of this.elements)t.style.transform="translateY(0px)",t.style.opacity="1"}),super.stop()}prepareToShow(){requestAnimationFrame(()=>{for(let t of this.elements)t.style.transform="translateY(200px)",t.style.opacity="0"})}async show(){let[t]=await b({target:this.elements,keyframes:[{transform:"translateY(200px)",opacity:0},{transform:"translateY(0px)",opacity:1}],delay(e){return 300*(e+1)},onfinish(e){requestAnimationFrame(()=>{e.style.transform="translateY(0px)",e.style.opacity="1"})},easing:"out-cubic",duration:650});return t.stop(),t}};var mt={name:"default",duration:500,scrollable:!0,out({from:r}){let{duration:t}=this,e=r.wrapper;return b({target:e,opacity:[1,0],duration:t}).on("finish",function(){this.stop()})},in({to:r,scroll:t}){let{duration:e}=this,i=r.wrapper;return window.scroll(t.x,t.y),b({target:i,opacity:[0,1],duration:e}).then(function(){this.stop()})}};var gt={name:"big",delay:200,durationPerAnimation:700,scrollable:!0,init(){this.mainElement=document.getElementById("big-transition"),this.spinnerElement=this.mainElement.querySelector(".spinner"),this.horizontalElements=[...this.mainElement.querySelector("#big-transition-horizontal").querySelectorAll("div")],this.maxLength=this.horizontalElements.length},out({from:r,scroll:t}){let{durationPerAnimation:e,delay:i}=this,n=r.wrapper;window.scroll(t.x,t.y);let s=Object.assign({},n.style);return new Promise(async o=>{this.mainElement.style.opacity="1",this.mainElement.style.visibility="visible",b({target:n,opacity:[1,0],duration:e,onfinish(g){g.style.opacity="0"}}).then(function(){this.stop()});let[a]=await b({target:this.horizontalElements,keyframes:[{transform:"scaleX(0)"},{transform:"scaleX(1)"}],delay(g){return i*(g+1)},onfinish(g){g.style.transform="scaleX(1)"},easing:"out-cubic",duration:500});n.style.opacity="1",Object.assign(n.style,s),this.spinnerElement.style.visibility="visible";let p=500,[m]=await b({target:this.spinnerElement,opacity:[0,1],duration:p,onfinish(g){g.style.opacity="1"}}),[E]=await b({options:m,opacity:[1,0],onfinish(g){g.style.opacity="0"},delay:1500});this.spinnerElement.style.visibility="hidden",m.stop(),E.stop(),o()})},in({to:r,scroll:t}){let{durationPerAnimation:e,delay:i}=this,n=r.wrapper;return window.scroll(t.x,t.y),new Promise(async s=>{let o=b({target:n,opacity:[0,1],duration:e}).then(()=>{o.stop()}),[l]=await b({target:this.horizontalElements,keyframes:[{transform:"scaleX(1)"},{transform:"scaleX(0)"}],delay(a){return i*(a+1)},onfinish(a){a.style.transform="scaleX(0)"},easing:"out-cubic",duration:500});this.mainElement.style.opacity="0",this.mainElement.style.visibility="hidden",l.stop(),s()})}};var _={name:"slide",duration:500,direction:"right",scrollable:!0,init(r){let t=r.trigger;t instanceof Node&&t.hasAttribute("data-direction")?this.direction=t.getAttribute("data-direction"):this.direction="right"},out({from:r}){let{duration:t,direction:e}=this,i=r.wrapper;return b({target:i,keyframes:[{transform:"translateX(0%)",opacity:1},{transform:`translateX(${e==="left"?"-":""}25%)`,opacity:0}],duration:t,easing:"in-quint"}).then(function(){this.stop()})},in({to:r,scroll:t}){let{duration:e}=this,i=r.wrapper;return window.scroll(t.x,t.y),b({target:i,keyframes:[{transform:`translateX(${this.direction==="right"?"-":""}25%)`,opacity:0},{transform:"translateX(0%)",opacity:1}],duration:e,easing:"out-quint"}).then(function(){this.stop()})}},ft=c(c({},_),{name:"slide-left",direction:"left",init(r){}}),dt=c(c({},_),{name:"slide-right",direction:"right",init(r){}});var K=r=>Array.from(r);var Q=class extends d{init(){this.navbar=document.querySelector(".navbar"),this.collapseSection=this.navbar.querySelector(".navbar-collapse"),this.navbarList=this.navbar.querySelector(".navbar-list"),this.elements=K(this.navbar.querySelectorAll(".navbar-list a")),this.menu=this.navbar.querySelector(".navbar-toggle"),this.toggleStatus=!1,this.toggleClick=this.toggleClick.bind(this)}activateLink(){let{href:t}=window.location;for(let e of this.elements){let i=e.getAttribute("data-path")||e.href;if(!i||i.length<1)return;let n=new RegExp(i).test(t),s=e.classList.contains("active");n&&s||e.classList.toggle("active",n)}}toggleClick(){var t,e;(e=(t=this.collapseSection.style)==null?void 0:t.setProperty)==null||e.call(t,"--height",`${this.navbarList.clientHeight}px`),this.toggleStatus=!this.toggleStatus,this.collapseSection.classList.toggle("collapse",!this.toggleStatus),this.collapseSection.classList.toggle("show",this.toggleStatus)}initEvents(){this.menu.addEventListener("click",this.toggleClick),this.emitter.on("READY",this.activateLink,this),this.emitter.on("GO",this.activateLink,this)}stopEvents(){this.navbar.removeEventListener("click",this.toggleClick),this.emitter.off("READY",this.activateLink,this),this.emitter.off("GO",this.activateLink,this)}uninstall(){for(;this.elements.length;)this.elements.pop();this.elements=void 0,this.menu=void 0,this.navbar=void 0}};var z,Ct,Z=new B;Z.add(new J).set("HistoryManager",new j).set("PageManager",new G).set("TransitionManager",new $([["default",mt],["BigTransition",gt],["Slide",_],["SlideLeft",ft],["SlideRight",dt]])).add(new Q).set("router",z=new W).add(Ct=new Y);try{z=Z.get("router");let r=K(document.querySelectorAll(".navbar .nav-link"));for(let t of r){let e=t;z.add({path:e.getAttribute("data-path")||e.pathname,method(){e.classList.contains("active")||e.classList.add("active");for(let n of r)n!==e&&n.classList.remove("active")}})}z.add({path:/(index|\/$)(\.html)?/,method(){}}),Z.boot()}catch(r){console.warn("[App] boot failed,",r)} //# sourceMappingURL=main.js.map diff --git a/demo/js/main.js.map b/demo/js/main.js.map index d6cddef..b994d4c 100644 --- a/demo/js/main.js.map +++ b/demo/js/main.js.map @@ -1,7 +1,7 @@ { "version": 3, - "sources": ["packages/native/src/config.ts", "packages/manager/src/api.ts", "packages/native/src/manager.ts", "packages/native/src/url.ts", "packages/native/src/service.ts", "packages/native/src/history.ts", "packages/native/src/page.ts", "packages/emitter/src/api.ts", "packages/native/src/transition.ts", "packages/native/src/app.ts", "packages/native/src/pjax.ts", "packages/native/src/router.ts", "packages/animate/src/api.ts", "build/ts/services/Splashscreen.ts", "build/ts/services/IntroAnimation.ts", "build/ts/transitions/Fade.ts", "build/ts/transitions/BigTransition.ts", "build/ts/transitions/Slide.ts", "build/ts/main.ts"], - "sourcesContent": ["export interface ICONFIG {\n prefix?: string;\n wrapperAttr?: string;\n noAjaxLinkAttr?: string;\n noPrefetchAttr?: \"no-prefetch\";\n headers?: string[][];\n preventSelfAttr?: string;\n preventAllAttr?: string;\n transitionAttr?: string;\n blockAttr?: string;\n timeout?: number;\n maxPages?: number;\n [key: string]: any;\n}\n\nexport const CONFIG_DEFAULTS = {\n wrapperAttr: \"wrapper\",\n noAjaxLinkAttr: \"no-ajax-link\",\n noPrefetchAttr: \"no-prefetch\",\n headers: [\n [\"x-partial\", \"true\"]\n ],\n preventSelfAttr: `prevent=\"self\"`,\n preventAllAttr: `prevent=\"all\"`,\n transitionAttr: \"transition\",\n blockAttr: `block`,\n timeout: 30000,\n maxPages: 5\n};\n\nexport type ConfigKeys = keyof typeof CONFIG_DEFAULTS | string;\nexport const newConfig = (config: ICONFIG): ICONFIG => {\n return Object.assign({ ...CONFIG_DEFAULTS }, config);\n};\n\n/** Converts string into properly formatted data attributes */\nexport const toAttr = (config: ICONFIG, value: string, brackets: boolean = true): string => {\n let { prefix } = config;\n let attr = `data${prefix ? \"-\" + prefix : \"\"}-${value}`;\n return brackets ? `[${attr}]` : attr;\n};\n\n/** Selects config vars, and formats them for use, or simply returns the current configurations for the framework */\nexport const getConfig = (config: ICONFIG, value?: ConfigKeys, brackets: boolean = true): any => {\n if (typeof value !== \"string\")\n return config;\n\n let prop = config[value];\n if (typeof prop === \"string\")\n return toAttr(config, prop, brackets);\n return prop;\n};\n", "/** Manages complex lists of named data, eg. A page can be stored in a list by of other pages with the url being how the page is stored in the list. Managers use Maps to store data */\nexport class Manager {\n\t/** The complex list of named data, to which the Manager controls */\n\tpublic map: Map;\n\tconstructor(value?: Array<[K, V]>) {\n\t\tthis.map = new Map(value);\n\t}\n\n\t/** Returns the Manager classes base Map */\n\tpublic getMap(): Map {\n\t\treturn this.map;\n\t}\n\n\t/** Get a value stored in the Manager */\n\tpublic get(key: K): V {\n\t\treturn this.map.get(key);\n\t}\n\n\t/** Returns the keys of all items stored in the Manager as an Array */\n\tpublic keys(): Array {\n\t\treturn Array.from(this.map.keys());\n\t}\n\n\t/** Returns the values of all items stored in the Manager as an Array */\n\tpublic values(): Array {\n\t\treturn Array.from(this.map.values());\n\t}\n\n\t/** Set a value to the Manager using a key */\n\tpublic set(key: K, value: V): Manager {\n\t\tthis.map.set(key, value);\n\t\treturn this;\n\t}\n\n\t/** Adds a value to Manager, and uses the current size of the Manager as it's key, it works best when all the key in the Manager are numbers */\n\tpublic add(value: V): Manager {\n\t\tlet size = this.size;\n\t\t// @ts-ignore\n\t\tlet num: K = size as K;\n\t\tthis.set(num, value);\n\t\treturn this;\n\t}\n\n\t/** Returns the total number of items stored in the Manager */\n\tpublic get size(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** An alias for size */\n\tpublic get length(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** Returns the last item in the Manager who's index is a certain distance from the last item in the Manager */\n\tpublic last(distance: number = 1): V | undefined {\n\t\tlet key = this.keys()[this.size - distance];\n\t\treturn this.get(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns true if an element in the Map object existed and has been removed, or false if the element does not exist */\n\tpublic delete(key: K): boolean {\n\t\treturn this.map.delete(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns the Manager class, allowing for chains */\n\tpublic remove(key: K): Manager {\n\t\tthis.map.delete(key);\n\t\treturn this;\n\t}\n\n\t/** Clear the Manager of all its contents */\n\tpublic clear(): Manager {\n\t\tthis.map.clear();\n\t\treturn this;\n\t}\n\n\t/** Checks if the Manager contains a certain key */\n\tpublic has(key: K): boolean {\n\t\treturn this.map.has(key);\n\t}\n\n\t/** Returns a new Iterator object that contains an array of [key, value] for each element in the Map object in insertion order. */\n\tpublic entries(): IterableIterator<[K, V]> {\n\t\treturn this.map.entries();\n\t}\n\n\t/** Iterates through the Managers contents, calling a callback function every iteration */\n\tpublic forEach(\n\t\tcallback: (value?: V, key?: K, map?: Map) => void,\n\t\tcontext?: object\n\t): Manager {\n\t\tthis.map.forEach(callback, context);\n\t\treturn this;\n\t}\n\n\t/** Allows for iteration via for..of, learn more: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators] */\n\tpublic [Symbol.iterator](): IterableIterator<[K, V]> {\n\t\treturn this.entries();\n\t}\n}\n\n/**\n * Calls the method of a certain name for all items that are currently installed\n */\nexport const methodCall = (manager: Manager, method: string, ...args: any): void => {\n\tmanager.forEach((item) => {\n\t\t// @ts-ignore\n\t\titem[method](...args);\n\t});\n};\n\n/**\n * Asynchronously calls the method of a certain name for all items that are currently installed, similar to methodCall\n */\nexport const asyncMethodCall = async (manager: Manager, method: string, ...args: any): Promise => {\n\tfor (let [, item] of manager) {\n\t\t// @ts-ignore\n\t\tawait item[method](...args);\n\t}\n};\n\nexport default Manager;\n", "import { Manager, methodCall, asyncMethodCall } from \"@okikio/manager\";\nimport { ICONFIG } from \"./config\";\nimport { IApp } from \"./app\";\nimport { EventEmitter } from \"./emitter\";\n\nexport type IAdvancedManager = AdvancedManager;\n\n/** The base class for AdvancedManager items */\nexport class ManagerItem {\n /** The AdvancedManager the ManagerItem is attached to */\n public manager: IAdvancedManager;\n\n /** The App the ManagerItem is attached to */\n public app: IApp;\n\n /** The Config of the App the ManagerItem is attached to */\n public config: ICONFIG;\n\n /** The EventEmitter of the App the ManagerItem is attached to */\n public emitter: EventEmitter;\n\n /** The key to where ManagerItem is stored in an AdvancedManager */\n public key: any;\n\n constructor() { }\n\n /** Run after the Manager Item has been registered */\n public install(): any { }\n\n /** Register the current Manager Item's manager */\n public register(manager: IAdvancedManager, key: any): ManagerItem {\n this.manager = manager;\n this.app = manager.app;\n this.config = manager.config;\n this.emitter = manager.emitter;\n this.key = key;\n this.install();\n return this;\n }\n\n /** Run before the ManagerItem has been unregistered */\n public uninstall(): any { }\n\n /** Basically removes a ManagerItem, in order to recover the ManagerItem, it needs to be re-added to an AdvancedManager */\n public unregister() {\n this.uninstall();\n\n this.manager.remove(this.key);\n this.key = undefined;\n this.manager = undefined;\n this.app = undefined;\n this.config = undefined;\n this.emitter = undefined;\n }\n}\n\n/** A tweak to the Manager class that makes it self aware of the App class it's instantiated in */\nexport class AdvancedManager extends Manager {\n /** The App the AdvancedManager is attached to */\n public app: IApp;\n\n /** The Config of the App the AdvancedManager is attached to */\n public config: ICONFIG;\n\n /** The EventEmitter of the App the AdvancedManager is attached to */\n public emitter: EventEmitter;\n\n /** Register App details */\n constructor(app: IApp) {\n super();\n this.app = app;\n this.config = app.config;\n this.emitter = app.emitter;\n }\n\n /** Add a ManagerItem to AdvancedManager at a specified key */\n public set(key: K, value: V) {\n super.set(key, value);\n value.register(this, key);\n return this;\n }\n}\n\nexport { Manager, methodCall, asyncMethodCall };\n", "export const newURL = (url: string | URL | Location = window.location.href): URL => {\n return url instanceof URL ? url : new URL(url as unknown as string, window.location.origin);\n};\n\n/** Returns the pathname with the hash at the end */\nexport const getHashedPath = (url: URL | string): string => {\n let _url = newURL(url);\n return `${_url.pathname}${_url.hash}`;\n};\n\n/** Returns the actual hash without the hashtag */\nexport const getHash = (url: URL | string): string => newURL(url).hash.slice(1);\n\n/** Removes the hash from the full URL for a clean URL string */\nexport const clean = (url: URL | string): string => newURL(url).toString().replace(/(\\/#.*|\\/|#.*)$/, '');\n\n/** Compares two URLs to each other */\nexport const equal = (a: URL | string, b: URL | string): boolean => (clean(a) === clean(b));\n\n", "import { AdvancedManager, ManagerItem, methodCall } from \"./manager\";\nimport { IApp } from \"./app\";\n\n/** Controls specific kinds of actions that require JS */\nexport class Service extends ManagerItem {\n\t/** Called before the start of a Service, represents a constructor of sorts */\n\tpublic init(...args: any): any;\n\tpublic init(): any { }\n\n\t/** Called on start of Service */\n\tpublic boot(...args: any): any;\n\tpublic boot(): any {\n\t\tthis.initEvents();\n\t}\n\n\t/** Initialize events */\n\tpublic initEvents(): void { }\n\n\t/** Stop events */\n\tpublic stopEvents(): void { }\n\n\t/** Stop services */\n\tpublic stop(): void {\n\t\tthis.stopEvents();\n\t\tthis.unregister();\n\t}\n}\n\n/** The Service Manager controls the lifecycle of all Services in an App */\nexport class ServiceManager extends AdvancedManager {\n\tconstructor(app: IApp) {\n\t\tsuper(app);\n\t}\n\n\t/** Call the init method for all Services */\n\tpublic init(): ServiceManager {\n\t\tmethodCall(this, \"init\");\n\t\treturn this;\n\t}\n\n\t/** Call the boot method for all Services */\n\tpublic boot(): ServiceManager {\n\t\tmethodCall(this, \"boot\");\n\t\treturn this;\n\t}\n\n\t/** Call the stop method for all Services */\n\tpublic stop(): ServiceManager {\n\t\tmethodCall(this, \"stop\");\n\t\treturn this;\n\t}\n}\n", "import { Service } from \"./service\";\nimport { getHashedPath, newURL } from \"./url\";\n\nexport type Trigger = HTMLAnchorElement | \"HistoryManager\" | \"popstate\" | \"back\" | \"forward\";\nexport interface ICoords {\n\treadonly x: number;\n\treadonly y: number;\n}\n\nexport interface IStateData {\n\tscroll: ICoords;\n\t[key: string]: any;\n}\n\nexport interface IState {\n\turl: string;\n\tindex?: number;\n\ttransition: string;\n\tdata: IStateData;\n}\n\nexport interface IHistoryItem {\n\tindex: number;\n\tstates: IState[];\n}\n\nexport interface IHistoryManager extends Service {\n\tstates: IState[],\n\tpointer: number,\n\n\tinit(): any,\n\tget(index: number): IState,\n\tadd(value?: IState, historyAction?: \"replace\" | \"push\"): HistoryManager,\n\tremove(index?: number): HistoryManager,\n\treplace(newStates: IState[]): HistoryManager,\n\tset(i: number, state: IState): IState,\n\tcurrent: IState,\n\tlast: IState,\n\tprevious: IState | null,\n\tlength: number,\n}\n\n/** A quick snapshot of page scroll coordinates */\nexport const newCoords = (x: number = window.scrollX, y: number = window.scrollY): ICoords => ({ x, y });\n\n/** Creates a state; a state represents the current status of the page consisting of properties like: url, transition, and data */\nexport const newState = (state: IState = {\n\turl: getHashedPath(newURL()),\n\tindex: 0,\n\ttransition: \"default\",\n\tdata: {\n\t\tscroll: newCoords(),\n\t\ttrigger: \"HistoryManager\"\n\t}\n}): IState => (state);\n\n/** Keeps a record of the history of the App; it stores only the states of Pages */\nexport class HistoryManager extends Service implements IHistoryManager {\n\tpublic states: IState[];\n\tpublic pointer = -1;\n\n\t/** Initializes the states array, and replace the history pushState data with the states array */\n\tinit() {\n\t\tthis.states = [];\n\n\t\tlet state = newState();\n\t\tthis.add(state, \"replace\");\n\t}\n\n\t/** Get a state based on it's index */\n\tpublic get(index: number) {\n\t\treturn this.states[index];\n\t}\n\n\t/** Add a state to HistoryManager and change the history pushState data based on the historyAction specified */\n\tpublic add(value?: IState, historyAction: \"replace\" | \"push\" = \"push\"): HistoryManager {\n\t\tlet state = newState(value);\n\t\tlet len = this.length;\n\t\tthis.states.push({ ...state });\n\t\tthis.pointer = len;\n\n\t\tlet item: IHistoryItem = {\n\t\t\tindex: this.pointer,\n\t\t\tstates: [...this.states]\n\t\t};\n\t\tchangeState(historyAction, state, item);\n\t\treturn this;\n\t}\n\n\tpublic remove(index?: number) {\n\t\tif (index) {\n\t\t\tthis.states.splice(index, 1);\n\t\t} else {\n\t\t\tthis.states.pop();\n\t\t}\n\n\t\tthis.pointer--;\n\t\treturn this;\n\t}\n\n\t/** Replaces the states array with another states array, this is later used when going back and forward in page history */\n\tpublic replace(newStates: IState[]) {\n\t\tthis.states = newStates;\n\t\treturn this;\n\t}\n\n\t/** Set state by index. */\n\tpublic set(i: number, state: IState) {\n\t\treturn (this.states[i] = state);\n\t}\n\n\t/** Get the current state */\n\tget current(): IState {\n\t\treturn this.get(this.pointer);\n\t}\n\n\t/** Get the last state (top of the history stack). */\n\tget last(): IState {\n\t\treturn this.get(this.length - 1);\n\t}\n\n\t/** Get the previous state. */\n\tget previous(): IState | null {\n\t\treturn this.pointer < 1 ? null : this.get(this.pointer - 1);\n\t}\n\n\tget length() {\n\t\treturn this.states.length;\n\t}\n}\n\n/** Either push or replace history state */\nexport const changeState = (action: \"push\" | \"replace\", state: IState, item: object) => {\n\tlet href = getHashedPath(state.url);\n\tlet args = [item, \"\", href];\n\tif (window.history) {\n\t\tswitch (action) {\n\t\t\tcase \"push\":\n\t\t\t\twindow.history.pushState.apply(window.history, args);\n\t\t\t\tbreak;\n\t\t\tcase \"replace\":\n\t\t\t\twindow.history.replaceState.apply(window.history, args);\n\t\t\t\tbreak;\n\t\t}\n\t}\n};\n", "import { Manager, ManagerItem, AdvancedManager } from \"./manager\";\nimport { equal, newURL } from \"./url\";\nimport { getConfig } from \"./config\";\nimport { Service } from \"./service\";\n\nexport interface IPage extends ManagerItem {\n dom: Document,\n wrapper: HTMLElement,\n title: string,\n head: Element,\n body: Element,\n url: URL,\n data: string,\n wrapperAttr: string,\n\n build(): any,\n install(): void,\n uninstall(): any,\n}\n\n/**\n * Parses strings to DOM\n */\nexport const PARSER: DOMParser = new DOMParser();\n\n/** A page represents the DOM elements that create each page */\nexport class Page extends ManagerItem implements IPage {\n /** Holds the DOM of the current page */\n public dom: Document;\n\n /** Holds the wrapper element to be swapped out of each Page */\n public wrapper: HTMLElement;\n\n /** Holds the title of each page */\n public title: string;\n\n /** Holds the head element of each page */\n public head: Element;\n\n /** Holds the body element of each page */\n public body: Element;\n\n /** The URL of the current page */\n public url: URL;\n\n /** The payload of a page request */\n public data: string;\n\n /** Attr that identifies the wrapper */\n public wrapperAttr: string;\n\n constructor(url: URL = newURL(), dom: string | Document = document) {\n super();\n this.url = url;\n\n if (typeof dom === \"string\") {\n this.data = dom;\n } else this.dom = dom || document;\n }\n\n /** Builds the page's dom, and sets the title, head, body, and wrapper properties of the Page class */\n public build() {\n if (!(this.dom instanceof Node)) {\n this.dom = PARSER.parseFromString(this.data, \"text/html\");\n }\n\n if (!(this.body instanceof Node)) {\n let { title, head, body } = this.dom;\n this.title = title;\n this.head = head;\n this.body = body;\n this.wrapper = this.body.querySelector(this.wrapperAttr);\n }\n }\n\n public install() {\n this.wrapperAttr = getConfig(this.config, \"wrapperAttr\");\n }\n\n public uninstall() {\n this.url = undefined;\n this.title = undefined;\n this.head = undefined;\n this.body = undefined;\n this.dom = undefined;\n this.wrapper = undefined;\n this.data = undefined;\n this.wrapperAttr = undefined;\n }\n}\n\nexport interface IPageManager extends Service {\n loading: Manager>,\n pages: AdvancedManager;\n\n install(): any,\n\n get(key): Page,\n add(value): PageManager,\n set(key, value): PageManager,\n remove(key): PageManager,\n has(key): boolean,\n clear(): PageManager,\n size: number,\n keys(): any[],\n\n load(_url: URL | string): Promise,\n request(url: string): Promise,\n}\n\n/** Controls which page to load */\nexport class PageManager extends Service implements IPageManager {\n /** Stores all fetch requests that are currently loading */\n public loading: Manager> = new Manager();\n\n pages: AdvancedManager;\n\n /** Instantiate pages, and add the current page to pages */\n install() {\n this.pages = new AdvancedManager(this.app);\n\n let URLString = newURL().pathname;\n this.set(URLString, new Page());\n URLString = undefined;\n }\n\n get(key) { return this.pages.get(key); }\n add(value) { this.pages.add(value); return this; }\n set(key, value) { this.pages.set(key, value); return this; }\n remove(key) { this.pages.remove(key); return this; }\n has(key) { return this.pages.has(key); }\n clear() { this.pages.clear(); return this; }\n get size() { return this.pages.size; }\n keys() { return this.pages.keys(); }\n\n /** Load from cache or by requesting URL via a fetch request, avoid requesting for the same thing twice by storing the fetch request in \"this.loading\" */\n public async load(_url: URL | string = newURL()): Promise {\n let url: URL = newURL(_url);\n let urlString: string = url.pathname;\n let page: Page, request: Promise;\n\n if (this.has(urlString)) {\n page = this.get(urlString);\n return Promise.resolve(page);\n }\n\n if (!this.loading.has(urlString)) {\n request = this.request(urlString);\n this.loading.set(urlString, request);\n } else request = this.loading.get(urlString);\n\n let response = await request;\n this.loading.remove(urlString);\n\n page = new Page(url, response);\n this.set(urlString, page);\n\n if (this.size > getConfig(this.config, \"maxPages\")) {\n let currentUrl = newURL();\n let keys = this.keys();\n let first = equal(currentUrl, keys[0]) ? keys[1] : keys[0];\n let page = this.get(first);\n page.unregister();\n page = undefined;\n keys = undefined;\n currentUrl = undefined;\n first = undefined;\n }\n\n return page;\n }\n\n /** Starts a fetch request */\n public async request(url: string): Promise {\n const headers = new Headers(getConfig(this.config, \"headers\"));\n const timeout = window.setTimeout(() => {\n window.clearTimeout(timeout);\n throw \"Request Timed Out!\";\n }, getConfig(this.config, \"timeout\"));\n\n try {\n let response = await fetch(url, {\n mode: 'same-origin',\n method: \"GET\",\n headers,\n cache: \"default\",\n credentials: \"same-origin\",\n });\n\n window.clearTimeout(timeout);\n if (response.status >= 200 && response.status < 300) {\n return await response.text();\n }\n\n const err = new Error(response.statusText || \"\" + response.status);\n throw err;\n } catch (err) {\n window.clearTimeout(timeout);\n throw err;\n }\n }\n}\n", "import { Manager, methodCall } from \"@okikio/manager\";\n\nexport type ListenerCallback = ((...args: any) => void);\nexport interface IListener {\n readonly callback: ListenerCallback;\n readonly scope: object;\n readonly name: string;\n}\n\n/** Represents a new event listener consisting of properties like: callback, scope, name */\nexport const newListener = ({\n callback = () => { },\n scope = null,\n name = \"event\",\n}: IListener): IListener => ({ callback, scope, name });\n\n/** Represents a new event */\nexport class Event extends Manager {\n /** The name of the event */\n public name: string;\n constructor(name: string = \"event\") {\n super();\n this.name = name;\n }\n}\n\nexport type EventInput = string | object | Array;\n\n/**\n * An Event Emitter\n * */\nexport class EventEmitter extends Manager {\n constructor() {\n super();\n }\n\n /** Gets event, if event doesn't exist create a new one */\n public getEvent(name: string): Event {\n let event = this.get(name);\n if (!(event instanceof Event)) {\n this.set(name, new Event(name));\n return this.get(name);\n }\n\n return event;\n }\n\n /** Creates a listener and adds it to an event */\n public newListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event = this.getEvent(name);\n event.add(newListener({ name, callback, scope }));\n return event;\n }\n\n /** Adds a listener to a given event */\n public on(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n this.newListener(_name, _callback, _scope);\n }, this);\n return this;\n }\n\n /** Removes a listener from an event */\n public removeListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event: Event = this.get(name);\n if (event instanceof Event && callback) {\n let listener = newListener({ name, callback, scope });\n\n event.forEach((value: IListener, i: number) => {\n if (\n value.callback === listener.callback &&\n value.scope === listener.scope\n ) {\n return event.remove(i);\n }\n });\n }\n\n return event;\n }\n\n /** Remove a listener from a given event, or just completely remove an event */\n public off(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n if (typeof _callback === \"function\") {\n this.removeListener(_name, _callback, _scope);\n } else this.remove(_name);\n }, this);\n return this;\n }\n\n /** Call all listeners within an event */\n public emit(\n events: string | Array,\n ...args: any\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n // Loop through the list of events\n events.forEach((event: string) => {\n let _event: Event = this.get(event);\n\n if (_event instanceof Event) {\n _event.forEach((listener: IListener) => {\n let { callback, scope } = listener;\n callback.apply(scope, args);\n });\n }\n }, this);\n return this;\n }\n\n /** Clears events and event listeners */\n public clear() {\n methodCall(this, \"clear\");\n super.clear();\n return this;\n }\n}\n\nexport default EventEmitter;\n", "import { Manager } from \"./manager\";\nimport { ICoords, newCoords, Trigger } from \"./history\";\nimport { IPage } from \"./page\";\nimport { getConfig } from \"./config\";\nimport { Service } from \"./service\";\nimport { newURL } from \"./url\";\n\n/**\n * The async function type, allows for smooth transition between Promises\n */\nexport type asyncFn = (err?: any, value?: any) => void;\nexport interface ITransition {\n oldPage?: IPage;\n newPage?: IPage;\n trigger?: Trigger;\n scroll?: { x: number; y: number };\n scrollable?: boolean;\n in: (data: ITransitionData) => any;\n out: (data: ITransitionData) => any;\n [key: string]: any;\n}\nexport interface ITransitionData {\n from?: IPage;\n to?: IPage;\n trigger?: Trigger;\n scroll?: ICoords;\n done: asyncFn;\n}\nexport interface ITransitionManager extends Service {\n transitions: Manager,\n\n get(key: string): ITransition,\n set(key: string, value: ITransition): TransitionManager,\n add(value: ITransition): TransitionManager,\n has(key: string): boolean,\n\n boot(): any,\n animate(name: string, data: any): Promise,\n}\n\n/** Auto scrolls to an elements position if the element has an hash */\nexport const hashAction = (coords?: ICoords, hash: string = window.location.hash) => {\n try {\n let _hash = hash[0] == \"#\" ? hash : newURL(hash).hash;\n if (_hash.length > 1) {\n let el = document.getElementById(_hash.slice(1));\n if (el) {\n let { left, top } = el.getBoundingClientRect();\n let scrollLeft = window.pageXOffset;\n let scrollTop = window.pageYOffset;\n let x = left + scrollLeft;\n let y = top + scrollTop;\n\n console.log(x, y);\n return newCoords(x, y);\n }\n }\n } catch (e) {\n console.warn(\"[hashAction] error\", e);\n }\n\n return coords ?? newCoords(0, 0);\n};\n\n// The Default Transition\nconst Default: ITransition = {\n name: \"default\",\n scrollable: true,\n\n out({ done }: ITransitionData) {\n done();\n },\n in({ scroll, done }: ITransitionData) {\n window.scroll(scroll.x, scroll.y);\n done();\n }\n};\n\n/** Controls which Transition between pages to use */\nexport class TransitionManager extends Service implements ITransitionManager {\n transitions: Manager;\n private _arg: Array<[string, ITransition]>;\n constructor(transitions?: Array<[string, ITransition]>) {\n super();\n this._arg = transitions;\n }\n\n /** On Service install set Config */\n public install() {\n super.install();\n\n let transitions = this._arg && this._arg.length ? this._arg : (getConfig(this.config, \"transitions\") ?? []);\n\n // Manager like Maps use the most recent [key, value] Array it knows, replacing the default transition\n // With any other transitions called [\"default\", ...]\n transitions = [[\"default\", Default]].concat(transitions);\n this.transitions = new Manager(transitions);\n }\n\n get(key: string) { return this.transitions.get(key); }\n set(key: string, value: ITransition) { this.transitions.set(key, value); return this; }\n add(value: ITransition) { this.transitions.add(value); return this; }\n has(key: string) { return this.transitions.has(key); }\n\n /** Starts a transition */\n public async animate(name: string, data: any): Promise {\n let transition: ITransition = this.transitions.get(name);\n let scroll = data.scroll;\n let ignoreHashAction = data.ignoreHashAction;\n if (!(\"wrapper\" in data.oldPage) || !(\"wrapper\" in data.newPage))\n throw `[Page] either oldPage or newPage aren't instances of the Page Class.\\n ${{\n newPage: data.newPage,\n oldPage: data.oldPage,\n }}`;\n\n // Replace the title\n document.title = `` + data.newPage.title;\n\n let fromWrapper = data.oldPage.wrapper;\n let toWrapper = data.newPage.wrapper;\n\n if (!(fromWrapper instanceof Node) || !(toWrapper instanceof Node))\n throw `[Wrapper] the wrapper from the ${!(toWrapper instanceof Node) ? \"next\" : \"current\"\n } page cannot be found. The wrapper must be an element that has the attribute ${getConfig(this.config,\n \"wrapperAttr\"\n )}.`;\n\n // Give the Transition all the background data it may require\n transition.init && transition?.init(data);\n\n this.emitter.emit(\"BEFORE_TRANSITION_OUT\");\n\n // Start the out point of the Transition\n if (transition.out) {\n await new Promise((done) => {\n let outMethod: Promise = transition.out.call(transition, {\n ...data,\n from: data.oldPage,\n trigger: data.trigger,\n done,\n });\n\n outMethod?.then(done);\n });\n }\n\n this.emitter.emit(\"AFTER_TRANSITION_OUT\");\n\n // Add the new wrapper before the old one\n await new Promise((done) => {\n fromWrapper.insertAdjacentElement(\"beforebegin\", toWrapper);\n this.emitter.emit(\"CONTENT_INSERT\");\n\n if (!ignoreHashAction && !/back|popstate|forward/.test(data.trigger as string)) {\n scroll = hashAction(scroll);\n }\n done();\n });\n\n // Replace the old wrapper with the new one\n await new Promise((done) => {\n fromWrapper.remove();\n fromWrapper = undefined;\n toWrapper = undefined;\n this.emitter.emit(\"CONTENT_REPLACED\");\n done();\n });\n\n this.emitter.emit(\"BEFORE_TRANSITION_IN\");\n\n // Start the in point of the Transition (only the in method has access to the hashAction's scroll position)\n if (transition.in) {\n await new Promise(async (done) => {\n let inMethod: Promise = transition.in.call(transition, {\n ...data,\n from: data.oldPage,\n to: data.newPage,\n trigger: data.trigger,\n scroll,\n done,\n });\n\n inMethod?.then(done);\n });\n }\n\n this.emitter.emit(\"AFTER_TRANSITION_IN\");\n return transition;\n }\n}\n", "import { EventEmitter, ListenerCallback, EventInput } from \"./emitter\";\nimport { ServiceManager, Service } from \"./service\";\nimport { newConfig, ICONFIG } from \"./config\";\n\nexport interface IApp {\n services: ServiceManager,\n emitter: EventEmitter,\n config: ICONFIG,\n register(config: ICONFIG): App,\n get(key: string): Service,\n set(key: string, service: Service): App,\n add(value: Service): App,\n boot(): App,\n stop(): App,\n on(events: EventInput, callback?: ListenerCallback): App,\n off(events: EventInput, callback?: ListenerCallback): App,\n emit(events: string | any[], ...args: any): App,\n}\n\n/** The App class starts the entire process, it controls all managers and all services */\nexport class App implements IApp {\n /** An instance of the ServiceManager */\n public services: ServiceManager;\n\n /** An instance of an EventEmitter */\n public emitter: EventEmitter;\n\n /** The current Configuration's for the App */\n public config: ICONFIG;\n constructor(config: object = {}) {\n this.register(config);\n }\n\n /** Create new instances of the ServiceManager, EventEmitter and the configurations */\n public register(config: ICONFIG = {}): App {\n this.config = newConfig(config);\n this.emitter = new EventEmitter();\n this.services = new ServiceManager(this);\n\n let handler = (() => {\n document.removeEventListener(\"DOMContentLoaded\", handler);\n window.removeEventListener(\"load\", handler);\n this.emitter.emit(\"READY ready\");\n }).bind(this);\n\n document.addEventListener(\"DOMContentLoaded\", handler);\n window.addEventListener(\"load\", handler);\n return this;\n }\n\n /** Shortcuts to adding, setting, and getting Services */\n public get(key: string): Service {\n return this.services.get(key);\n }\n\n public set(key: string, value: Service): App {\n this.services.set(key, value);\n return this;\n }\n\n public add(value: Service): App {\n this.services.add(value);\n return this;\n }\n\n /** Initialize and boot all Services */\n public boot(): App {\n this.services.init();\n this.services.boot();\n return this;\n }\n\n /** Stops all Services and clears the even emitter of all events and listeners */\n public stop(): App {\n this.services.stop();\n this.emitter.clear();\n return this;\n }\n\n /** Shortcuts to the App EventEmitter on, off, and emit methods */\n public on(events: EventInput, callback?: ListenerCallback): App {\n this.emitter.on(events, callback, this);\n return this;\n }\n\n public off(events: EventInput, callback?: ListenerCallback): App {\n this.emitter.off(events, callback, this);\n return this;\n }\n\n public emit(events: string | any[], ...args: any): App {\n this.emitter.emit(events, ...args);\n return this;\n }\n}\n", "import { newState, Trigger, newCoords, IHistoryItem, IHistoryManager } from \"./history\";\nimport { Service } from \"./service\";\nimport { IPage, IPageManager } from \"./page\";\nimport { newURL, getHashedPath, equal } from \"./url\";\nimport { getConfig } from \"./config\";\nimport { hashAction, ITransitionManager } from \"./transition\";\n\nexport type LinkEvent = MouseEvent | TouchEvent;\nexport type StateEvent = LinkEvent | PopStateEvent;\nexport type IgnoreURLsList = Array;\n/**\n * Creates a barbajs like PJAX Service, for the native framework\n * Based on barbajs and StartingBlocks\n */\nexport class PJAX extends Service {\n /** URLs to ignore when prefetching */\n public ignoreURLs: IgnoreURLsList;\n\n /** Whether or not to disable prefetching */\n public prefetchIgnore: boolean;\n\n /** Current state of transitions */\n public isTransitioning: boolean;\n\n /** Ignore extra clicks of an anchor element if a transition has already started */\n public stopOnTransitioning: boolean;\n\n /** On page change (excluding popstate events) keep current scroll position */\n public stickyScroll: boolean;\n\n /** Force load a page if an error occurs */\n public forceOnError: boolean;\n\n /** Ignore hash action if set to true */\n public ignoreHashAction: boolean;\n\n public install() {\n super.install();\n\n this.ignoreURLs = getConfig(this.config, \"ignoreURLs\") ?? [];\n this.prefetchIgnore = getConfig(this.config, \"prefetchIgnore\") ?? false;\n this.stopOnTransitioning = getConfig(this.config, \"stopOnTransitioning\") ?? false;\n this.stickyScroll = getConfig(this.config, \"stickyScroll\") ?? false;\n this.forceOnError = getConfig(this.config, \"forceOnError\") ?? false;\n this.ignoreHashAction = getConfig(this.config, \"ignoreHashAction\") ?? false\n }\n\n /** Sets the transition state to either true or false */\n public transitionStart() {\n this.isTransitioning = true;\n }\n\n public transitionStop() {\n this.isTransitioning = false;\n }\n\n public init() {\n /**\n * Bind the event listeners to the PJAX class\n *\n * @memberof PJAX\n */\n this.onHover = this.onHover.bind(this);\n this.onClick = this.onClick.bind(this);\n this.onStateChange = this.onStateChange.bind(this);\n }\n\n /** Starts the PJAX Service */\n public boot() {\n if (\"scrollRestoration\" in window.history) {\n // Back off, browser, I got this...\n window.history.scrollRestoration = \"manual\";\n }\n\n super.boot();\n }\n\n /** Gets the transition to use for a certain anchor */\n public getTransitionName(el: HTMLAnchorElement): string | null {\n if (!el || !el.getAttribute) return null;\n let transitionAttr = el.getAttribute(\n getConfig(this.config, \"transitionAttr\", false)\n );\n\n if (typeof transitionAttr === \"string\") return transitionAttr;\n return null;\n }\n\n /** Checks to see if the anchor is valid */\n public validLink(\n el: HTMLAnchorElement,\n event: LinkEvent | KeyboardEvent,\n href: string\n ): boolean {\n let pushStateSupport = !window.history.pushState;\n let exists = !el || !href;\n let eventMutate =\n (event as KeyboardEvent).metaKey ||\n (event as KeyboardEvent).ctrlKey ||\n (event as KeyboardEvent).shiftKey ||\n (event as KeyboardEvent).altKey;\n let newTab =\n el.hasAttribute(\"target\") &&\n (el as HTMLAnchorElement).target === \"_blank\";\n let crossOrigin =\n (el as HTMLAnchorElement).protocol !== location.protocol ||\n (el as HTMLAnchorElement).hostname !== location.hostname;\n let download = typeof el.getAttribute(\"download\") === \"string\";\n let preventSelf = el.matches(getConfig(this.config, \"preventSelfAttr\"));\n let preventAll = Boolean(\n el.closest(getConfig(this.config, \"preventAllAttr\"))\n );\n let sameURL = getHashedPath(newURL()) === getHashedPath(newURL(href));\n return !(\n exists ||\n pushStateSupport ||\n eventMutate ||\n newTab ||\n crossOrigin ||\n download ||\n preventSelf ||\n preventAll ||\n sameURL\n );\n }\n\n /** Returns the href of an Anchor element */\n public getHref(el: HTMLAnchorElement): string | null {\n if (\n el &&\n el.tagName &&\n el.tagName.toLowerCase() === \"a\" &&\n typeof el.href === \"string\"\n )\n return el.href;\n return null;\n }\n\n /** Check if event target is a valid anchor with an href, if so, return the anchor */\n public getLink(event: LinkEvent): HTMLAnchorElement {\n let el = event.target as HTMLAnchorElement;\n let href: string = this.getHref(el);\n\n while (el && !href) {\n el = (el as HTMLElement).parentNode as HTMLAnchorElement;\n href = this.getHref(el);\n }\n\n // Check for a valid link\n if (!el || !this.validLink(el, event, href)) return;\n return el;\n }\n\n /** When an element is clicked, get valid anchor element, go for a transition */\n public onClick(event: LinkEvent) {\n let el = this.getLink(event);\n if (!el) return;\n\n if (this.isTransitioning && this.stopOnTransitioning) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n let href = this.getHref(el);\n this.emitter.emit(\"ANCHOR_CLICK CLICK\", event);\n this.go({ href, trigger: el, event });\n }\n\n /** Returns the direction of the State change as a String, either the Back button or the Forward button */\n public getDirection(value: number): Trigger {\n if (Math.abs(value) > 1) {\n // Ex 6-0 > 0 -> forward, 0-6 < 0 -> back\n return value > 0 ? \"forward\" : \"back\";\n } else {\n if (value === 0) {\n return \"popstate\";\n } else {\n // Ex 6-5 > 0 -> back, 5-6 < 0 -> forward\n return value > 0 ? \"back\" : \"forward\";\n }\n }\n }\n\n /** Force a page to go to a certain URL */\n public force(href: string): void {\n window.location.assign(href);\n }\n\n /**\n * If transition is running force load page.\n * Stop if currentURL is the same as new url.\n * On state change, change the current state history, to reflect the direction of said state change\n * Load page and page transition.\n */\n public go({\n href,\n trigger = \"HistoryManager\",\n event,\n }: {\n href: string;\n trigger?: Trigger;\n event?: StateEvent;\n }): Promise {\n // If transition is already running and the go method is called again, force load page\n if (this.isTransitioning && this.stopOnTransitioning ||\n !(this.manager.has(\"TransitionManager\") &&\n this.manager.has(\"HistoryManager\") &&\n this.manager.has(\"PageManager\"))) {\n this.force(href);\n return;\n }\n\n const history = this.manager.get(\"HistoryManager\") as IHistoryManager;\n let scroll = newCoords(0, 0);\n let currentState = history.current;\n let currentURL = currentState.url;\n if (equal(currentURL, href)) {\n return;\n }\n\n let transitionName: string;\n if (event && (event as PopStateEvent).state) {\n this.emitter.emit(\"POPSTATE\", event);\n\n // If popstate, get back/forward direction.\n let { state }: { state: IHistoryItem } = event as PopStateEvent;\n let { index } = state;\n let currentIndex = currentState.index;\n let difference = currentIndex - index;\n\n history.replace(state.states);\n history.pointer = index;\n\n let _state = history.get(index);\n transitionName = _state.transition;\n scroll = _state.data.scroll;\n\n trigger = this.getDirection(difference);\n console.log(trigger == \"forward\" && history)\n\n // Based on the direction of the state change either remove or add a state\n this.emitter.emit(trigger === \"back\" ? `POPSTATE_BACK` : `POPSTATE_FORWARD`, event);\n } else {\n // Add new state\n transitionName = this.getTransitionName(trigger as HTMLAnchorElement);\n\n scroll = newCoords();\n let state = newState({\n url: href,\n transition: transitionName,\n data: { scroll },\n });\n\n !this.stickyScroll && (scroll = newCoords(0, 0));\n\n history.add(state);\n this.emitter.emit(\"HISTORY_NEW_ITEM\", event);\n }\n\n if (event) {\n event.stopPropagation();\n event.preventDefault();\n }\n\n this.emitter.emit(\"GO\", event);\n return this.load({\n oldHref: currentURL,\n href,\n trigger,\n transitionName,\n scroll,\n });\n }\n\n /** Load the new Page as well as a Transition; starts the Transition */\n public async load({\n oldHref,\n href,\n trigger,\n transitionName = \"default\",\n scroll = { x: 0, y: 0 },\n }: {\n oldHref: string;\n href: string;\n trigger: Trigger;\n transitionName?: string;\n scroll: { x: number; y: number };\n }): Promise {\n try {\n const pages = this.manager.get(\"PageManager\") as IPageManager;\n let newPage: IPage, oldPage: IPage;\n this.emitter.emit(\"NAVIGATION_START\", {\n oldHref,\n href,\n trigger,\n transitionName,\n });\n\n // Load & Build both the old and new pages\n try {\n this.transitionStart();\n oldPage = await pages.load(oldHref);\n !(oldPage.dom instanceof Element) && oldPage.build();\n\n this.emitter.emit(\"PAGE_LOADING\", { href, oldPage, trigger });\n newPage = await pages.load(href);\n await newPage.build();\n this.emitter.emit(\"PAGE_LOAD_COMPLETE\", {\n newPage,\n oldPage,\n trigger,\n });\n } catch (err) {\n console.warn(`[PJAX] Page load error: ${err}`);\n }\n\n // Transition Between Pages\n try {\n const TransitionManager = this.manager.get(\"TransitionManager\") as ITransitionManager;\n this.emitter.emit(\"TRANSITION_START\", transitionName);\n\n let transition = await TransitionManager.animate(TransitionManager.has(transitionName) ? transitionName : \"default\", {\n oldPage,\n newPage,\n trigger,\n scroll,\n ignoreHashAction: this.ignoreHashAction\n });\n\n if (!transition.scrollable) {\n if (!this.ignoreHashAction && !/back|popstate|forward/.test(trigger as string)) scroll = hashAction(scroll);\n window.scroll(scroll.x, scroll.y);\n }\n\n this.emitter.emit(\"TRANSITION_END\", { transition });\n } catch (err) {\n console.warn(`[PJAX] Transition error: ${err}`);\n }\n\n // Navigation is over\n this.emitter.emit(\"NAVIGATION_END\", {\n oldPage,\n newPage,\n trigger,\n transitionName,\n });\n } catch (err) {\n if (this.forceOnError) this.force(href);\n else console.warn(err);\n } finally {\n this.transitionStop(); // Sets isTransitioning to false\n }\n }\n\n /** Check to see if the URL is to be ignored, uses either RegExp of Strings to check */\n public ignoredURL({ pathname }: URL): boolean {\n return (\n this.ignoreURLs.length &&\n this.ignoreURLs.some((url) => {\n return typeof url === \"string\"\n ? url === pathname\n : (url as RegExp).exec(pathname) !== null;\n })\n );\n }\n\n /** When you hover over an anchor, prefetch the event target's href */\n public onHover(event: LinkEvent): Promise {\n let el = this.getLink(event);\n if (!el || !this.manager.has(\"PageManager\")) return;\n\n const pages = this.manager.get(\"PageManager\") as IPageManager;\n let url = newURL(this.getHref(el));\n let urlString: string = url.pathname;\n\n // If Url is ignored or already in cache, don't do any think\n if (this.ignoredURL(url) || pages.has(urlString)) return;\n this.emitter.emit(\"ANCHOR_HOVER HOVER\", event);\n\n try {\n pages.load(url);\n } catch (err) {\n console.warn(\"[PJAX] prefetch error,\", err);\n }\n }\n\n /** When History state changes, get url from State, go for a Transition. */\n public onStateChange(event: PopStateEvent): void {\n this.go({ href: window.location.href, trigger: \"popstate\", event });\n }\n\n /** Initialize DOM Events */\n public initEvents() {\n if (this.prefetchIgnore !== true) {\n document.addEventListener(\"mouseover\", this.onHover);\n document.addEventListener(\"touchstart\", this.onHover);\n }\n\n document.addEventListener(\"click\", this.onClick);\n window.addEventListener(\"popstate\", this.onStateChange);\n }\n\n /** Stop DOM Events */\n public stopEvents() {\n if (this.prefetchIgnore !== true) {\n document.removeEventListener(\"mouseover\", this.onHover);\n document.removeEventListener(\"touchstart\", this.onHover);\n }\n\n document.removeEventListener(\"click\", this.onClick);\n window.removeEventListener(\"popstate\", this.onStateChange);\n }\n}\n", "import { Service } from \"./service\";\nimport { Manager } from \"./manager\";\nimport { newURL, getHashedPath } from \"./url\";\nimport { IHistoryManager } from \"./history\";\n\nexport type RouteMethod = (...args: any) => any;\nexport type RouteStyle = string | RegExp | boolean;\nexport interface IRouteToFrom {\n to: RouteStyle,\n from: RouteStyle\n}\nexport type RoutePath = IRouteToFrom | RouteStyle;\nexport interface IRoute {\n path: RoutePath,\n method: RouteMethod\n}\n\n/** Controls what happens when certain url paths match a set of criteria */\nexport class Router extends Service {\n /** List of routes */\n protected routes: Manager;\n constructor(routes: IRoute[] = []) {\n super();\n this.routes = new Manager();\n for (let route of routes) {\n this.add(route);\n }\n }\n\n /** Add a new route to watch for */\n public add({ path, method }: IRoute): Router {\n let key = this.parse(path);\n this.routes.set(key, method);\n return this;\n }\n\n /** Convert strings into path match functions */\n public parsePath(path: RouteStyle): RegExp | boolean {\n if (typeof path === \"string\") return new RegExp(path, \"i\");\n else if (path instanceof RegExp || typeof path === \"boolean\")\n return path;\n throw \"[Router] only regular expressions, strings and booleans are accepted as paths.\";\n }\n\n /** Determines if a strings counts has a path */\n public isPath(input: RouteStyle): boolean {\n return (\n typeof input === \"string\" ||\n input instanceof RegExp ||\n typeof input === \"boolean\"\n );\n }\n\n /** Parse the multiple different formats for paths, into a { from, to } object */\n public parse(input: RoutePath): IRouteToFrom {\n let route = input as IRouteToFrom;\n let toFromPath: IRouteToFrom = {\n from: /(.*)/g,\n to: /(.*)/g,\n };\n\n if (this.isPath(input as RouteStyle))\n toFromPath = {\n from: true,\n to: input as RouteStyle,\n };\n else if (this.isPath(route.from) && this.isPath(route.to as RouteStyle))\n toFromPath = route;\n else\n throw \"[Router] path is neither a string, regular expression, or a { from, to } object.\";\n\n let { from, to } = toFromPath;\n return {\n from: this.parsePath(from),\n to: this.parsePath(to),\n };\n }\n\n /** Test if route paths are true, if so run their methods */\n public route() {\n if (this.manager.has(\"HistoryManager\")) {\n let history = this.manager.get(\"HistoryManager\") as IHistoryManager;\n let from: string = getHashedPath(newURL((history.length > 1 ? history.previous : history.current).url));\n let to: string = getHashedPath(newURL());\n\n this.routes.forEach((method: RouteMethod, path: IRouteToFrom) => {\n let fromRegExp = path.from as RegExp | boolean;\n let toRegExp = path.to as RegExp | boolean;\n\n if (\n typeof fromRegExp === \"boolean\" &&\n typeof toRegExp === \"boolean\"\n ) {\n throw `[Router] path ({ from: ${fromRegExp}, to: ${toRegExp} }) is not valid, remember paths can only be strings, regular expressions, or a boolean; however, both the from and to paths cannot be both booleans.`;\n }\n\n let fromParam: RegExpExecArray | RegExp | boolean = fromRegExp;\n let toParam: RegExpExecArray | RegExp | boolean = toRegExp;\n\n if (fromRegExp instanceof RegExp && fromRegExp.test(from))\n fromParam = fromRegExp.exec(from);\n if (toRegExp instanceof RegExp && toRegExp.test(to))\n toParam = toRegExp.exec(to);\n\n if (\n (Array.isArray(toParam) && Array.isArray(fromParam)) ||\n (Array.isArray(toParam) &&\n typeof fromParam == \"boolean\" &&\n fromParam) ||\n (Array.isArray(fromParam) &&\n typeof toParam == \"boolean\" &&\n toParam)\n )\n method({ from: fromParam, to: toParam, path: { from, to } });\n });\n } else {\n console.warn(\"[Route] HistoryManager is missing.\");\n }\n }\n\n /** Add listeners for PJAX Events */\n public initEvents() {\n this.emitter.on(\"READY\", this.route, this);\n this.emitter.on(\"CONTENT_REPLACED\", this.route, this);\n }\n\n /** Remove listeners for PJAX Events */\n public stopEvents() {\n this.emitter.off(\"READY\", this.route, this);\n this.emitter.off(\"CONTENT_REPLACED\", this.route, this);\n }\n}\n", "import { EventEmitter, EventInput, ListenerCallback } from \"@okikio/emitter\";\nimport { Manager } from \"@okikio/manager\";\n\n// DOM\nexport type AnimationTarget = string | Node | NodeList | HTMLCollection | HTMLElement[] | AnimationTarget[];\nexport const getElements = (selector: string | Node): Node[] => {\n return typeof selector === \"string\" ? Array.from(document.querySelectorAll(selector as string)) : [selector];\n};\n\nconst flatten = (arr: AnimationTarget[]) => [].concat(...arr);\nexport const getTargets = (targets: AnimationTarget): Node[] => {\n if (Array.isArray(targets)) {\n return flatten((targets as AnimationTarget[]).map(getTargets));\n }\n if (typeof targets == \"string\" || targets instanceof Node)\n return getElements(targets);\n if (targets instanceof NodeList || targets instanceof HTMLCollection)\n return Array.from(targets);\n return [];\n};\n\n// VALUES\nexport type closureArgs = [number, number, HTMLElement];\nexport type closure = ((index?: number, total?: number, element?: HTMLElement) => (genericTypes[] | void)) | any;\nexport const computeValue = (value: closure, args: closureArgs, context: Animate) => {\n if (typeof value === \"function\") {\n return value.apply(context, args);\n } else { return value; }\n};\n\nexport const mapObject = (obj: object, args: closureArgs, options: Animate): any => {\n let key: string, value: any, result = {};\n let keys = Object.keys(obj);\n for (let i = 0, len = keys.length; i < len; i++) {\n key = keys[i];\n value = obj[key];\n result[key] = computeValue(value, args, options);\n }\n\n return result;\n};\n\n/** From: [https://easings.net] */\nexport const easings = {\n \"in\": \"ease-in\",\n \"out\": \"ease-out\",\n \"in-out\": \"ease-in-out\",\n\n // Sine\n \"in-sine\": \"cubic-bezier(0.47, 0, 0.745, 0.715)\",\n \"out-sine\": \"cubic-bezier(0.39, 0.575, 0.565, 1)\",\n \"in-out-sine\": \"cubic-bezier(0.445, 0.05, 0.55, 0.95)\",\n\n // Quad\n \"in-quad\": \"cubic-bezier(0.55, 0.085, 0.68, 0.53)\",\n \"out-quad\": \"cubic-bezier(0.25, 0.46, 0.45, 0.94)\",\n \"in-out-quad\": \"cubic-bezier(0.455, 0.03, 0.515, 0.955)\",\n\n // Cubic\n \"in-cubic\": \"cubic-bezier(0.55, 0.055, 0.675, 0.19)\",\n \"out-cubic\": \"cubic-bezier(0.215, 0.61, 0.355, 1)\",\n \"in-out-cubic\": \"cubic-bezier(0.645, 0.045, 0.355, 1)\",\n\n // Quart\n \"in-quart\": \"cubic-bezier(0.895, 0.03, 0.685, 0.22)\",\n \"out-quart\": \"cubic-bezier(0.165, 0.84, 0.44, 1)\",\n \"in-out-quart\": \"cubic-bezier(0.77, 0, 0.175, 1)\",\n\n // Quint\n \"in-quint\": \"cubic-bezier(0.755, 0.05, 0.855, 0.06)\",\n \"out-quint\": \"cubic-bezier(0.23, 1, 0.32, 1)\",\n \"in-out-quint\": \"cubic-bezier(0.86, 0, 0.07, 1)\",\n\n // Expo\n \"in-expo\": \"cubic-bezier(0.95, 0.05, 0.795, 0.035)\",\n \"out-expo\": \"cubic-bezier(0.19, 1, 0.22, 1)\",\n \"in-out-expo\": \"cubic-bezier(1, 0, 0, 1)\",\n\n // Circ\n \"in-circ\": \"cubic-bezier(0.6, 0.04, 0.98, 0.335)\",\n \"out-circ\": \"cubic-bezier(0.075, 0.82, 0.165, 1)\",\n \"in-out-circ\": \"cubic-bezier(0.785, 0.135, 0.15, 0.86)\",\n\n // Back\n \"in-back\": \"cubic-bezier(0.6, -0.28, 0.735, 0.045)\",\n \"out-back\": \"cubic-bezier(0.175, 0.885, 0.32, 1.275)\",\n \"in-out-back\": \"cubic-bezier(0.68, -0.55, 0.265, 1.55)\"\n};\n\nexport const getEase = (ease: string) => {\n return /^(in|out)/.test(ease) ? easings[ease] : ease;\n};\n\nexport type genericTypes = genericTypes[] | boolean | object | string | number | closure | null | undefined;\nexport interface AnimationOptions {\n target?: AnimationTarget,\n\n speed?: number,\n autoplay?: boolean,\n options?: AnimationOptions,\n delay?: number | closure,\n easing?: string | closure,\n endDelay?: number | closure,\n duration?: number | closure,\n keyframes?: Keyframe[] | object[] | closure,\n loop?: number | boolean | closure, // iterations: number,\n onfinish?: (element?: HTMLElement, index?: number, total?: number, animation?: Animation) => any,\n fillMode?: \"none\" | \"forwards\" | \"backwards\" | \"both\" | \"auto\" | closure,\n direction?: \"normal\" | \"reverse\" | \"alternate\" | \"alternate-reverse\" | closure,\n extend?: EffectTiming,\n [property: string]: genericTypes;\n};\n\nexport const DefaultAnimationOptions: AnimationOptions = {\n keyframes: [],\n\n loop: 1, // iterations: number,\n delay: 0,\n speed: 1,\n endDelay: 0,\n easing: \"ease\",\n autoplay: true,\n duration: 1000,\n fillMode: \"auto\",\n direction: \"normal\",\n extend: {}\n};\n\nexport type AnimationEvents = \"update\" | \"play\" | \"pause\" | \"start\" | \"begin\" | \"complete\" | \"finish\" | \"error\" | \"stop\";\n\n/** You can check it out here: https://codepen.io/okikio/pen/qBbdGaW?editors=0011 */\nexport class Animate {\n /**\n * Stores the options for the current animation\n */\n public options: AnimationOptions = {};\n\n /**\n * The Array of Elements to Animate\n */\n public targets: Node[] = [];\n\n /**\n * The properties to animate\n */\n public properties: object = {};\n\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n\n /**\n * The total duration of all Animation's\n */\n public totalDuration: number = 0;\n\n /**\n * The smallest delay out of all Animation's\n */\n public minDelay: number = 0;\n\n /**\n * The options for individual animations\n */\n public computedOptions: Manager = new Manager();\n\n /**\n * The Element the main animation uses\n */\n public mainElement: HTMLElement;\n\n /**\n * Stores an animation that runs on the total duration of the all other Animations, and as such it's the main Animation\n */\n public mainAnimation: Animation;\n\n /**\n * Stores request frame calls\n */\n public animationFrame: number;\n\n /**\n * An event emitter\n */\n public emitter: EventEmitter = new EventEmitter();\n\n /**\n * Returns a promise that is fulfilled when the mainAnimation is finished\n */\n public promise: Promise;\n constructor(options: AnimationOptions = {}) {\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n\n /**\n * Returns a new Promise that is resolve when this.finish is called\n */\n public newPromise(): Promise {\n return new Promise((resolve, reject) => {\n /*\n Note that the `this` keyword is in an Array when it is resolved,\n this is due to Promises not wanting to resolve references,\n so, you can't resolve `this` directly, so, I chose to resolve `this` in an\n Array\n */\n this.on(\"complete\", () => resolve([this]));\n this.on(\"error\", err => reject(err));\n });\n }\n\n /**\n * Fulfills the this.promise Promise\n */\n public then(\n onFulfilled?: (value?: any) => any,\n onRejected?: (reason?: any) => any\n ): Animate {\n onFulfilled = onFulfilled?.bind(this);\n onRejected = onRejected?.bind(this);\n this.promise.then(onFulfilled, onRejected);\n return this;\n }\n\n /**\n * Catches error that occur in the this.promise Promise\n */\n public catch(onRejected: (reason?: any) => any): Animate {\n onRejected = onRejected?.bind(this);\n this.promise.catch(onRejected);\n return this;\n }\n\n /**\n * If you don't care if the this.promise Promise has either been rejected or resolved\n */\n public finally(onFinally: () => any): Animate {\n onFinally = onFinally?.bind(this);\n this.promise.finally(onFinally);\n return this;\n }\n\n /**\n * Represents an Animation Frame Loop\n */\n public loop(): void {\n this.stopLoop();\n this.emit(\"update\", this.getProgress(), this);\n this.animationFrame = window.requestAnimationFrame(this.loop);\n }\n\n /**\n * Cancels animation frame\n */\n public stopLoop() {\n window.cancelAnimationFrame(this.animationFrame);\n }\n\n /**\n * Calls a method that affects all animations including the mainAnimation; the method only allows the animation parameter\n */\n public all(method: (animation?: Animation, target?: HTMLElement) => void) {\n method(this.mainAnimation, this.mainElement);\n this.animations.forEach(method);\n return this;\n }\n\n /**\n * Register the begin event\n */\n protected beginEvent() {\n if (this.getProgress() == 0) {\n let timer: number | void = window.setTimeout(() => {\n this.emit(\"begin\", this);\n timer = window.clearTimeout(timer as number);\n }, this.minDelay);\n }\n }\n\n /**\n * Play Animation\n */\n public play(): Animate {\n let playstate = this.getPlayState();\n this.beginEvent();\n this.all(anim => anim.play());\n this.emit(\"play\", playstate, this);\n this.loop();\n return this;\n }\n\n /**\n * Pause Animation\n */\n public pause(): Animate {\n let playstate = this.getPlayState();\n this.all(anim => anim.pause());\n this.emit(\"pause\", playstate, this);\n this.stopLoop();\n this.animationFrame = undefined;\n return this;\n }\n\n /**\n * Reset all Animations\n */\n public reset() {\n this.setProgress(0);\n this.beginEvent();\n\n if (this.options.autoplay) this.play();\n else this.pause();\n return this;\n }\n\n /**\n * Cancels all Animations\n */\n public cancel() {\n this.all(anim => anim.cancel());\n this.stopLoop();\n return this;\n }\n\n /**\n * Force complete all Animations\n */\n public finish() {\n this.all(anim => anim.finish());\n this.stopLoop();\n return this;\n }\n\n /**\n * Cancels & Clears all Animations\n */\n public stop() {\n this.cancel();\n this.animations.clear();\n while (this.targets.length) this.targets.pop();\n this.mainElement = undefined;\n this.emit(\"stop\");\n }\n\n /**\n * Returns an Array of targets\n */\n public getTargets(): Node[] {\n return this.targets;\n }\n\n /**\n * Get a specific Animation from an Animate instance\n */\n public getAnimation(element: HTMLElement): Animation {\n return this.animations.get(element);\n }\n\n /**\n * Returns the timings of an Animation, given a target\n * E.g. { duration, endDelay, delay, iterations, iterationStart, direction, easing, fill, etc... }\n */\n public getTiming(target: HTMLElement | Animation): AnimationOptions & EffectTiming {\n let animation = target instanceof Animation ? target : this.getAnimation(target);\n let keyframeOptions = this.computedOptions.get(animation) ?? {};\n let timings = animation.effect?.getTiming() ?? {};\n let options = this.getOptions();\n\n return { ...DefaultAnimationOptions, ...options, ...timings, ...keyframeOptions };\n }\n\n /**\n * Returns the total duration of Animation\n */\n public getTotalDuration(): number {\n return this.totalDuration;\n }\n\n /**\n * Returns the current time of the Main Animation\n */\n public getCurrentTime(): number {\n return this.mainAnimation.currentTime;\n }\n\n /**\n * Returns the Animation progress as a fraction of the current time / duration * 100\n */\n public getProgress() {\n return (this.getCurrentTime() / this.totalDuration) * 100;\n }\n\n /**\n * Return the playback speed of the animation\n */\n public getSpeed(): number {\n return this.mainAnimation.playbackRate;\n }\n\n /**\n * Returns the current playing state\n */\n public getPlayState(): \"idle\" | \"running\" | \"paused\" | \"finished\" {\n return this.mainAnimation.playState;\n }\n\n /**\n * Get the options of an Animate instance\n */\n public getOptions(): AnimationOptions {\n return this.options;\n }\n\n /**\n * Set the current time of the Main Animation\n */\n public setCurrentTime(time: number): Animate {\n this.all(anim => { anim.currentTime = time; });\n this.emit(\"update\", this.getProgress());\n return this;\n }\n\n /**\n * Set the Animation progress as a value from 0 to 100\n */\n public setProgress(percent: number): Animate {\n let time = (percent / 100) * this.totalDuration;\n this.setCurrentTime(time);\n return this;\n }\n\n /**\n * Set the playback speed of an Animation\n */\n public setSpeed(speed: number = 1): Animate {\n this.all(anim => { anim.playbackRate = speed; });\n return this;\n }\n\n /**\n * Adds a listener for a given event\n */\n public on(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.on(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Removes a listener from an event\n */\n public off(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.off(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Call all listeners within an event\n */\n public emit(events: AnimationEvents | string | any[], ...args: any): Animate {\n this.emitter.emit(events, ...args);\n return this;\n }\n\n\n /** Returns the Animate options, as JSON */\n public toJSON(): AnimationOptions {\n return this.getOptions();\n }\n\n /**\n * The Symbol.toStringTag well-known symbol is a string valued property that is used\n * in the creation of the default string description of an object.\n * It is accessed internally by the Object.prototype.toString() method.\n */\n get [Symbol.toStringTag]() {\n return `Animate`;\n }\n}\n\n/** Creates a new Animate instance */\nexport const animate = (options: AnimationOptions = {}): Animate => {\n return new Animate(options);\n};\n\nexport class Timeline extends Animate {\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n constructor(options: AnimationOptions = {}) {\n super();\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n public add(options: AnimationOptions) {\n return this;\n }\n}\n\nexport default animate;", "import { Service, animate } from \"../../../packages/native/src/api\";\n\nexport class Splashscreen extends Service {\n public rootElement: HTMLElement;\n public innerEl: HTMLElement;\n public bgEl: HTMLElement;\n public minimalDuration: number = 1000; // ms\n spinnerEl: Element[];\n\n public init() {\n super.init();\n\n // Elements\n this.rootElement = document.getElementById('splashscreen');\n if (this.rootElement) {\n this.innerEl = this.rootElement.querySelector('.splashscreen-inner');\n this.bgEl = this.rootElement.querySelector('.splashscreen-bg');\n this.spinnerEl = [...this.rootElement.querySelectorAll('.spinner')];\n }\n\n this.rootElement.style.visibility = \"visible\";\n this.rootElement.style.pointerEvents = \"auto\";\n }\n\n public boot() {\n if (this.rootElement) {\n this.hide();\n }\n }\n\n public async hide() {\n await new Promise(resolve => {\n window.setTimeout(() => {\n this.emitter.emit(\"BEFORE_SPLASHSCREEN_HIDE\");\n resolve();\n }, this.minimalDuration);\n });\n\n await new Promise(async resolve => {\n animate({\n target: this.innerEl,\n opacity: [1, 0],\n autoplay: true,\n duration: 500,\n onfinish(el) {\n el.style.opacity = \"0\";\n }\n }).then(function () {\n this.stop();\n });\n\n this.emitter.emit(\"START_SPLASHSCREEN_HIDE\");\n await this.show();\n resolve();\n });\n }\n\n public async show() {\n let [anim] = await animate({\n target: this.rootElement,\n transform: [\"translateY(0%)\", \"translateY(100%)\"],\n duration: 1200,\n easing: \"in-out-cubic\" // in-out-cubic\n });\n this.emitter.emit(\"AFTER_SPLASHSCREEN_HIDE\");\n anim.stop();\n\n this.rootElement.style.transform = \"translateY(100%)\";\n this.rootElement.style.visibility = \"hidden\";\n this.rootElement.style.pointerEvents = \"none\";\n }\n}\n", "import { Service, animate } from \"../../../packages/native/src/api\";\n\nexport class IntroAnimation extends Service {\n public elements: Array;\n public rootElement: HTMLElement;\n\n public init() {\n super.init();\n\n // Elements\n this.elements = [...document.querySelectorAll('.intro-animation')];\n }\n\n public newPage() {\n this.init();\n this.prepareToShow();\n }\n\n public initEvents() {\n this.emitter.on(\"BEFORE_SPLASHSCREEN_HIDE\", this.prepareToShow, this);\n this.emitter.on(\"CONTENT_REPLACED\", this.newPage, this);\n this.emitter.on(\"START_SPLASHSCREEN_HIDE BEFORE_TRANSITION_IN\", this.show, this);\n }\n\n public stopEvents() {\n this.emitter.off(\"BEFORE_SPLASHSCREEN_HIDE\", this.prepareToShow, this);\n this.emitter.off(\"CONTENT_REPLACED\", this.newPage, this);\n this.emitter.off(\"START_SPLASHSCREEN_HIDE BEFORE_TRANSITION_IN\", this.show, this);\n }\n\n public stop() {\n requestAnimationFrame(() => {\n for (let el of this.elements) {\n (el as HTMLElement).style.transform = \"translateY(0px)\";\n (el as HTMLElement).style.opacity = '1';\n }\n });\n\n super.stop();\n }\n\n public prepareToShow() {\n requestAnimationFrame(() => {\n for (let el of this.elements) {\n (el as HTMLElement).style.transform = \"translateY(200px)\";\n (el as HTMLElement).style.opacity = '0';\n }\n });\n }\n\n public async show() {\n let [anim] = await animate({\n target: (this.elements as HTMLElement[]),\n keyframes: [\n { transform: \"translateY(200px)\", opacity: 0 },\n { transform: \"translateY(0px)\", opacity: 1 },\n ],\n // @ts-ignore\n delay(i: number) {\n return 300 * (i + 1);\n },\n onfinish(el: { style: { transform: string; opacity: string; }; }) {\n requestAnimationFrame(() => {\n el.style.transform = \"translateY(0px)\";\n el.style.opacity = \"1\";\n });\n },\n easing: \"out-cubic\",\n duration: 650\n });\n anim.stop();\n return anim;\n }\n}\n", "import { ITransition, ITransitionData, animate } from \"../../../packages/native/src/api\";\n\n//== Transition\nexport const Fade: ITransition = {\n name: \"default\",\n duration: 500,\n scrollable: true,\n\n out({ from }: ITransitionData) {\n let { duration } = this;\n let fromWrapper = from.wrapper;\n return animate({\n target: fromWrapper,\n opacity: [1, 0],\n duration,\n }).on(\"finish\", function () {\n this.stop();\n });\n },\n\n in({ to, scroll }: ITransitionData) {\n let { duration } = this;\n let toWrapper = to.wrapper;\n\n window.scroll(scroll.x, scroll.y);\n return animate({\n target: toWrapper,\n opacity: [0, 1],\n duration\n }).then(function () {\n this.stop();\n });\n }\n};\n", "import { ITransition, ITransitionData, animate } from \"../../../packages/native/src/api\";\n\n//== Transitions\nexport const BigTransition: ITransition = {\n name: \"big\",\n delay: 200,\n durationPerAnimation: 700,\n scrollable: true,\n\n init() {\n this.mainElement = document.getElementById('big-transition');\n this.spinnerElement = this.mainElement.querySelector('.spinner');\n this.horizontalElements = [...this.mainElement.querySelector('#big-transition-horizontal').querySelectorAll('div')];\n this.maxLength = this.horizontalElements.length;\n },\n\n out({ from, scroll }: ITransitionData) {\n let { durationPerAnimation: duration, delay } = this;\n let fromWrapper = from.wrapper;\n\n window.scroll(scroll.x, scroll.y);\n let wrapperStyle = Object.assign({}, fromWrapper.style);\n return new Promise(async resolve => {\n this.mainElement.style.opacity = \"1\";\n this.mainElement.style.visibility = \"visible\";\n let anim1 = animate({\n target: fromWrapper,\n opacity: [1, 0],\n duration,\n onfinish(el: { style: { opacity: string; }; }) {\n el.style.opacity = '0';\n }\n });\n\n anim1.then(function () { this.stop(); });\n\n let [anim2] = await animate({\n target: this.horizontalElements,\n keyframes: [\n { transform: \"scaleX(0)\" },\n { transform: \"scaleX(1)\" },\n ],\n // @ts-ignore\n delay(i: number) {\n return delay * (i + 1);\n },\n onfinish(el: { style: { transform: string; }; }) {\n el.style.transform = `scaleX(1)`;\n },\n easing: \"out-cubic\",\n duration: 500\n });\n\n fromWrapper.style.opacity = '1';\n Object.assign(fromWrapper.style, wrapperStyle);\n this.spinnerElement.style.visibility = \"visible\";\n\n let loaderDuration = 500;\n let [anim3] = await animate({\n target: this.spinnerElement,\n opacity: [0, 1],\n duration: loaderDuration,\n onfinish(el: { style: { opacity: string; }; }) {\n el.style.opacity = `1`;\n },\n });\n\n let [anim4] = await animate({\n options: anim3,\n opacity: [1, 0],\n onfinish(el: { style: { opacity: string; }; }) {\n el.style.opacity = `0`;\n },\n delay: 1500\n });\n this.spinnerElement.style.visibility = \"hidden\";\n // anim2.stop() // -> anim2.stop() Breaks the Animation\n anim3.stop();\n anim4.stop();\n resolve();\n });\n },\n\n in({ to, scroll }: ITransitionData) {\n let { durationPerAnimation: duration, delay } = this;\n let toWrapper = to.wrapper;\n\n window.scroll(scroll.x, scroll.y);\n return new Promise(async resolve => {\n let anim1 = animate({\n target: toWrapper,\n opacity: [0, 1],\n duration\n }).then(() => {\n anim1.stop();\n });\n\n let [anim2] = await animate({\n target: this.horizontalElements,\n keyframes: [\n { transform: \"scaleX(1)\" },\n { transform: \"scaleX(0)\" },\n ],\n // @ts-ignore\n delay(i: number) {\n return delay * (i + 1);\n },\n onfinish(el: { style: { transform: string; }; }) {\n el.style.transform = `scaleX(0)`;\n },\n easing: \"out-cubic\",\n duration: 500\n });\n\n this.mainElement.style.opacity = \"0\";\n this.mainElement.style.visibility = \"hidden\";\n anim2.stop();\n resolve();\n });\n }\n}\n", "import { ITransition, ITransitionData, animate } from \"../../../packages/native/src/api\";\n\n//== Transitions\nexport const Slide: ITransition = {\n name: \"slide\",\n duration: 500,\n direction: \"right\",\n scrollable: true,\n\n init(data: ITransition) {\n let trigger = (data.trigger as HTMLElement);\n if (trigger instanceof Node && trigger.hasAttribute(\"data-direction\")) {\n this.direction = trigger.getAttribute(\"data-direction\");\n } else {\n this.direction = \"right\";\n }\n },\n\n out({ from }: ITransitionData) {\n let { duration, direction } = this;\n let fromWrapper = from.wrapper;\n\n return animate({\n target: fromWrapper,\n keyframes: [\n { transform: \"translateX(0%)\", opacity: 1 },\n { transform: `translateX(${direction === \"left\" ? \"-\" : \"\"}25%)`, opacity: 0 },\n ],\n duration,\n easing: \"in-quint\"\n }).then(function () {\n this.stop();\n });\n },\n\n in({ to, scroll }: ITransitionData) {\n let { duration } = this;\n let toWrapper = to.wrapper;\n\n window.scroll(scroll.x, scroll.y);\n return animate({\n target: toWrapper,\n keyframes: [\n { transform: `translateX(${this.direction === \"right\" ? \"-\" : \"\"}25%)`, opacity: 0 },\n { transform: \"translateX(0%)\", opacity: 1 },\n ],\n duration,\n easing: \"out-quint\"\n }).then(function () {\n this.stop();\n });\n }\n};\n\nexport const SlideLeft: ITransition = {\n ...Slide,\n\n name: \"slide-left\",\n direction: \"left\",\n init(data: ITransition) { }\n};\n\nexport const SlideRight: ITransition = {\n ...Slide,\n\n name: \"slide-right\",\n direction: \"right\",\n init(data: ITransition) { }\n};\n", "import { PJAX, App, TransitionManager, Router, HistoryManager, PageManager, animate, Animate } from \"@okikio/native\";\n\nimport { Splashscreen } from \"./services/Splashscreen\";\nimport { IntroAnimation } from \"./services/IntroAnimation\";\n\nimport { Fade } from \"./transitions/Fade\";\nimport { BigTransition } from \"./transitions/BigTransition\";\nimport { Slide, SlideLeft, SlideRight } from \"./transitions/Slide\";\n\nlet splashscreen: Splashscreen;\nlet router: Router, pjax: PJAX;\nconst app: App = new App();\napp\n .add(new IntroAnimation())\n .add(splashscreen = new Splashscreen())\n .set(\"HistoryManager\", new HistoryManager())\n .set(\"PageManager\", new PageManager())\n .set(\"TransitionManager\", new TransitionManager([\n [\"default\", Fade],\n [\"BigTransition\", BigTransition],\n [\"Slide\", Slide],\n [\"SlideLeft\", SlideLeft],\n [\"SlideRight\", SlideRight]\n ]))\n .set(\"router\", router = new Router())\n .add(pjax = new PJAX());\n\ntry {\n router = app.get(\"router\") as Router;\n\n // This isn't nessceary, but it changes the nav link in focus depending on the page\n let navLink = document.querySelectorAll(\".navbar .nav-link\");\n for (let item of navLink) {\n let navItem = (item as HTMLAnchorElement);\n router.add({\n path: navItem.getAttribute(\"data-path\") || navItem.pathname,\n method() {\n let isActive = navItem.classList.contains(\"active\");\n if (!isActive) navItem.classList.add(\"active\");\n for (let nav of navLink) {\n if (nav !== navItem)\n nav.classList.remove(\"active\");\n }\n }\n });\n }\n\n let anim: Animate;\n router.add({\n path: /(index|\\/$)(\\.html)?/,\n method() {\n anim = animate({\n target: \".div\",\n keyframes(index, total) {\n return [\n { transform: \"translateX(0px)\", opacity: 0.1 },\n { transform: \"translateX(300px)\", opacity: 0.2 + ((index + 1) / total) }\n ]\n },\n\n /* You can uncomment this out, and comment the keyframes options above and still get the same animation */\n // transform: [\"translateX(0px)\", \"translateX(300px)\"],\n // opacity(index, total, element) {\n // return [0, ((index + 1) / total)];\n // },\n\n // It is best to use the onfinish() method, but in this situation fillMode works best\n fillMode: \"both\",\n // onfinish(element, index, total) {\n // element.style.opacity = `${((index + 1) / total)}`;\n // element.style.transform = \"translateX(300px)\";\n // },\n\n easing: \"out-cubic\",\n duration(index: number) {\n return (index + 1) * 500;\n },\n loop: 5,\n speed: 1.5,\n direction: \"alternate\",\n delay(index: number) {\n return ((index + 1) * 500) / 2;\n },\n autoplay: false\n });\n\n let el: HTMLElement = document.querySelector(\".info\");\n let backupInfo = el.textContent;\n let info = backupInfo;\n anim.on({\n begin() {\n if (el) {\n info = backupInfo;\n el.textContent = info;\n el.style.color = \"initial\";\n }\n }\n })\n anim.on(\"complete\", () => {\n if (el) {\n info = \"Done.\";\n el.textContent = info;\n el.style.color = \"red\";\n\n console.log(info);\n }\n });\n\n let scrub = document.getElementById('scrub') as HTMLInputElement;\n scrub.addEventListener('input', e => {\n var percent = +(e.target as HTMLInputElement).value;\n anim.setProgress(percent);\n anim.pause();\n });\n\n let progressSpan = document.querySelector(\".progress\");\n anim.on(\"update\", progress => {\n scrub.value = `` + progress;\n progressSpan && (progressSpan.textContent = `${Math.round(progress)}%`);\n });\n\n scrub.addEventListener('change', () => {\n if (Math.round(anim.getProgress()) >= 100) {\n anim.finish();\n return false;\n }\n anim.play();\n });\n\n\n let playtoggle = document.querySelector(\".playtoggle\");\n if (playtoggle) {\n playtoggle.addEventListener(\"click\", () => {\n let state = anim.getPlayState();\n if (state === \"running\") anim.pause();\n else if (state === \"finished\") anim.reset();\n else anim.play();\n console.log(state);\n });\n }\n }\n });\n\n app.on(\"AFTER_SPLASHSCREEN_HIDE\", () => {\n anim?.play();\n });\n\n app.boot();\n} catch (err) {\n splashscreen.show();\n console.warn(\"[App] boot failed,\", err);\n}\n"], - "mappings": "sgBAeO,GAAM,IAAkB,CAC3B,YAAa,UACb,eAAgB,eAChB,eAAgB,cAChB,QAAS,CACL,CAAC,YAAa,S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S,cAAc,aAC1C,EAAK,GAAG,SAAU,GAAY,CAC1B,EAAM,MAAQ,GAAK,EACnB,GAAiB,GAAa,YAAc,GAAG,KAAK,MAAM,SAG9D,EAAM,iBAAiB,SAAU,IAAM,CACnC,GAAI,KAAK,MAAM,EAAK,gBAAkB,IAClC,SAAK,SACE,GAEX,EAAK,SAIT,GAAI,GAAa,SAAS,cAAc,eACxC,AAAI,GACA,EAAW,iBAAiB,QAAS,IAAM,CACvC,GAAI,GAAQ,EAAK,eACjB,AAAI,IAAU,UAAW,EAAK,QACzB,AAAI,IAAU,WAAY,EAAK,QAC/B,EAAK,OACV,QAAQ,IAAI,QAM5B,EAAI,GAAG,0BAA2B,IAAM,CACpC,WAAM,SAGV,EAAI,aACC,EAAP,CACE,GAAa,OACb,QAAQ,KAAK,qBAAsB", + "sources": ["packages/native/src/config.ts", "packages/manager/src/api.ts", "packages/native/src/manager.ts", "packages/native/src/url.ts", "packages/native/src/service.ts", "packages/native/src/history.ts", "packages/native/src/page.ts", "packages/emitter/src/api.ts", "packages/native/src/transition.ts", "packages/native/src/app.ts", "packages/native/src/pjax.ts", "packages/native/src/router.ts", "packages/animate/src/api.ts", "build/ts/services/IntroAnimation.ts", "build/ts/transitions/Fade.ts", "build/ts/transitions/BigTransition.ts", "build/ts/transitions/Slide.ts", "build/ts/toArr.ts", "build/ts/services/Navbar.ts", "build/ts/main.ts"], + "sourcesContent": ["export interface ICONFIG {\n prefix?: string;\n wrapperAttr?: string;\n noAjaxLinkAttr?: string;\n noPrefetchAttr?: \"no-prefetch\";\n headers?: string[][];\n preventSelfAttr?: string;\n preventAllAttr?: string;\n transitionAttr?: string;\n blockAttr?: string;\n timeout?: number;\n maxPages?: number;\n [key: string]: any;\n}\n\nexport const CONFIG_DEFAULTS = {\n wrapperAttr: \"wrapper\",\n noAjaxLinkAttr: \"no-ajax-link\",\n noPrefetchAttr: \"no-prefetch\",\n headers: [\n [\"x-partial\", \"true\"]\n ],\n preventSelfAttr: `prevent=\"self\"`,\n preventAllAttr: `prevent=\"all\"`,\n transitionAttr: \"transition\",\n blockAttr: `block`,\n timeout: 30000,\n maxPages: 5\n};\n\nexport type ConfigKeys = keyof typeof CONFIG_DEFAULTS | string;\nexport const newConfig = (config: ICONFIG): ICONFIG => {\n return Object.assign({ ...CONFIG_DEFAULTS }, config);\n};\n\n/** Converts string into properly formatted data attributes */\nexport const toAttr = (config: ICONFIG, value: string, brackets: boolean = true): string => {\n let { prefix } = config;\n let attr = `data${prefix ? \"-\" + prefix : \"\"}-${value}`;\n return brackets ? `[${attr}]` : attr;\n};\n\n/** Selects config vars, and formats them for use, or simply returns the current configurations for the framework */\nexport const getConfig = (config: ICONFIG, value?: ConfigKeys, brackets: boolean = true): any => {\n if (typeof value !== \"string\")\n return config;\n\n let prop = config[value];\n if (typeof prop === \"string\")\n return toAttr(config, prop, brackets);\n return prop;\n};\n", "/** Manages complex lists of named data, eg. A page can be stored in a list by of other pages with the url being how the page is stored in the list. Managers use Maps to store data */\nexport class Manager {\n\t/** The complex list of named data, to which the Manager controls */\n\tpublic map: Map;\n\tconstructor(value?: Array<[K, V]>) {\n\t\tthis.map = new Map(value);\n\t}\n\n\t/** Returns the Manager classes base Map */\n\tpublic getMap(): Map {\n\t\treturn this.map;\n\t}\n\n\t/** Get a value stored in the Manager */\n\tpublic get(key: K): V {\n\t\treturn this.map.get(key);\n\t}\n\n\t/** Returns the keys of all items stored in the Manager as an Array */\n\tpublic keys(): Array {\n\t\treturn Array.from(this.map.keys());\n\t}\n\n\t/** Returns the values of all items stored in the Manager as an Array */\n\tpublic values(): Array {\n\t\treturn Array.from(this.map.values());\n\t}\n\n\t/** Set a value to the Manager using a key */\n\tpublic set(key: K, value: V): Manager {\n\t\tthis.map.set(key, value);\n\t\treturn this;\n\t}\n\n\t/** Adds a value to Manager, and uses the current size of the Manager as it's key, it works best when all the key in the Manager are numbers */\n\tpublic add(value: V): Manager {\n\t\tlet size = this.size;\n\t\t// @ts-ignore\n\t\tlet num: K = size as K;\n\t\tthis.set(num, value);\n\t\treturn this;\n\t}\n\n\t/** Returns the total number of items stored in the Manager */\n\tpublic get size(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** An alias for size */\n\tpublic get length(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** Returns the last item in the Manager who's index is a certain distance from the last item in the Manager */\n\tpublic last(distance: number = 1): V | undefined {\n\t\tlet key = this.keys()[this.size - distance];\n\t\treturn this.get(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns true if an element in the Map object existed and has been removed, or false if the element does not exist */\n\tpublic delete(key: K): boolean {\n\t\treturn this.map.delete(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns the Manager class, allowing for chains */\n\tpublic remove(key: K): Manager {\n\t\tthis.map.delete(key);\n\t\treturn this;\n\t}\n\n\t/** Clear the Manager of all its contents */\n\tpublic clear(): Manager {\n\t\tthis.map.clear();\n\t\treturn this;\n\t}\n\n\t/** Checks if the Manager contains a certain key */\n\tpublic has(key: K): boolean {\n\t\treturn this.map.has(key);\n\t}\n\n\t/** Returns a new Iterator object that contains an array of [key, value] for each element in the Map object in insertion order. */\n\tpublic entries(): IterableIterator<[K, V]> {\n\t\treturn this.map.entries();\n\t}\n\n\t/** Iterates through the Managers contents, calling a callback function every iteration */\n\tpublic forEach(\n\t\tcallback: (value?: V, key?: K, map?: Map) => void,\n\t\tcontext?: object\n\t): Manager {\n\t\tthis.map.forEach(callback, context);\n\t\treturn this;\n\t}\n\n\t/** Allows for iteration via for..of, learn more: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators] */\n\tpublic [Symbol.iterator](): IterableIterator<[K, V]> {\n\t\treturn this.entries();\n\t}\n}\n\n/**\n * Calls the method of a certain name for all items that are currently installed\n */\nexport const methodCall = (manager: Manager, method: string, ...args: any): void => {\n\tmanager.forEach((item) => {\n\t\t// @ts-ignore\n\t\titem[method](...args);\n\t});\n};\n\n/**\n * Asynchronously calls the method of a certain name for all items that are currently installed, similar to methodCall\n */\nexport const asyncMethodCall = async (manager: Manager, method: string, ...args: any): Promise => {\n\tfor (let [, item] of manager) {\n\t\t// @ts-ignore\n\t\tawait item[method](...args);\n\t}\n};\n\nexport default Manager;\n", "import { Manager, methodCall, asyncMethodCall } from \"@okikio/manager\";\nimport { ICONFIG } from \"./config\";\nimport { IApp } from \"./app\";\nimport { EventEmitter } from \"./emitter\";\n\nexport type IAdvancedManager = AdvancedManager;\n\n/** The base class for AdvancedManager items */\nexport class ManagerItem {\n /** The AdvancedManager the ManagerItem is attached to */\n public manager: IAdvancedManager;\n\n /** The App the ManagerItem is attached to */\n public app: IApp;\n\n /** The Config of the App the ManagerItem is attached to */\n public config: ICONFIG;\n\n /** The EventEmitter of the App the ManagerItem is attached to */\n public emitter: EventEmitter;\n\n /** The key to where ManagerItem is stored in an AdvancedManager */\n public key: any;\n\n constructor() { }\n\n /** Run after the Manager Item has been registered */\n public install(): any { }\n\n /** Register the current Manager Item's manager */\n public register(manager: IAdvancedManager, key: any): ManagerItem {\n this.manager = manager;\n this.app = manager.app;\n this.config = manager.config;\n this.emitter = manager.emitter;\n this.key = key;\n this.install();\n return this;\n }\n\n /** Run before the ManagerItem has been unregistered */\n public uninstall(): any { }\n\n /** Basically removes a ManagerItem, in order to recover the ManagerItem, it needs to be re-added to an AdvancedManager */\n public unregister() {\n this.uninstall();\n\n this.manager.remove(this.key);\n this.key = undefined;\n this.manager = undefined;\n this.app = undefined;\n this.config = undefined;\n this.emitter = undefined;\n }\n}\n\n/** A tweak to the Manager class that makes it self aware of the App class it's instantiated in */\nexport class AdvancedManager extends Manager {\n /** The App the AdvancedManager is attached to */\n public app: IApp;\n\n /** The Config of the App the AdvancedManager is attached to */\n public config: ICONFIG;\n\n /** The EventEmitter of the App the AdvancedManager is attached to */\n public emitter: EventEmitter;\n\n /** Register App details */\n constructor(app: IApp) {\n super();\n this.app = app;\n this.config = app.config;\n this.emitter = app.emitter;\n }\n\n /** Add a ManagerItem to AdvancedManager at a specified key */\n public set(key: K, value: V) {\n super.set(key, value);\n value.register(this, key);\n return this;\n }\n}\n\nexport { Manager, methodCall, asyncMethodCall };\n", "export const newURL = (url: string | URL | Location = window.location.href): URL => {\n return url instanceof URL ? url : new URL(url as unknown as string, window.location.origin);\n};\n\n/** Returns the pathname with the hash at the end */\nexport const getHashedPath = (url: URL | string): string => {\n let _url = newURL(url);\n return `${_url.pathname}${_url.hash}`;\n};\n\n/** Returns the actual hash without the hashtag */\nexport const getHash = (url: URL | string): string => newURL(url).hash.slice(1);\n\n/** Removes the hash from the full URL for a clean URL string */\nexport const clean = (url: URL | string): string => newURL(url).toString().replace(/(\\/#.*|\\/|#.*)$/, '');\n\n/** Compares two URLs to each other */\nexport const equal = (a: URL | string, b: URL | string): boolean => (clean(a) === clean(b));\n\n", "import { AdvancedManager, ManagerItem, methodCall } from \"./manager\";\nimport { IApp } from \"./app\";\n\n/** Controls specific kinds of actions that require JS */\nexport class Service extends ManagerItem {\n\t/** Called before the start of a Service, represents a constructor of sorts */\n\tpublic init(...args: any): any;\n\tpublic init(): any { }\n\n\t/** Called on start of Service */\n\tpublic boot(...args: any): any;\n\tpublic boot(): any {\n\t\tthis.initEvents();\n\t}\n\n\t/** Initialize events */\n\tpublic initEvents(): void { }\n\n\t/** Stop events */\n\tpublic stopEvents(): void { }\n\n\t/** Stop services */\n\tpublic stop(): void {\n\t\tthis.stopEvents();\n\t\tthis.unregister();\n\t}\n}\n\n/** The Service Manager controls the lifecycle of all Services in an App */\nexport class ServiceManager extends AdvancedManager {\n\tconstructor(app: IApp) {\n\t\tsuper(app);\n\t}\n\n\t/** Call the init method for all Services */\n\tpublic init(): ServiceManager {\n\t\tmethodCall(this, \"init\");\n\t\treturn this;\n\t}\n\n\t/** Call the boot method for all Services */\n\tpublic boot(): ServiceManager {\n\t\tmethodCall(this, \"boot\");\n\t\treturn this;\n\t}\n\n\t/** Call the stop method for all Services */\n\tpublic stop(): ServiceManager {\n\t\tmethodCall(this, \"stop\");\n\t\treturn this;\n\t}\n}\n", "import { Service } from \"./service\";\nimport { getHashedPath, newURL } from \"./url\";\n\nexport type Trigger = HTMLAnchorElement | \"HistoryManager\" | \"popstate\" | \"back\" | \"forward\";\nexport interface ICoords {\n\treadonly x: number;\n\treadonly y: number;\n}\n\nexport interface IStateData {\n\tscroll: ICoords;\n\t[key: string]: any;\n}\n\nexport interface IState {\n\turl: string;\n\tindex?: number;\n\ttransition: string;\n\tdata: IStateData;\n}\n\nexport interface IHistoryItem {\n\tindex: number;\n\tstates: IState[];\n}\n\nexport interface IHistoryManager extends Service {\n\tstates: IState[],\n\tpointer: number,\n\n\tinit(): any,\n\tget(index: number): IState,\n\tadd(value?: IState, historyAction?: \"replace\" | \"push\"): HistoryManager,\n\tremove(index?: number): HistoryManager,\n\treplace(newStates: IState[]): HistoryManager,\n\tset(i: number, state: IState): IState,\n\tcurrent: IState,\n\tlast: IState,\n\tprevious: IState | null,\n\tlength: number,\n}\n\n/** A quick snapshot of page scroll coordinates */\nexport const newCoords = (x: number = window.scrollX, y: number = window.scrollY): ICoords => ({ x, y });\n\n/** Creates a state; a state represents the current status of the page consisting of properties like: url, transition, and data */\nexport const newState = (state: IState = {\n\turl: getHashedPath(newURL()),\n\tindex: 0,\n\ttransition: \"default\",\n\tdata: {\n\t\tscroll: newCoords(),\n\t\ttrigger: \"HistoryManager\"\n\t}\n}): IState => (state);\n\n/** Keeps a record of the history of the App; it stores only the states of Pages */\nexport class HistoryManager extends Service implements IHistoryManager {\n\tpublic states: IState[];\n\tpublic pointer = -1;\n\n\t/** Initializes the states array, and replace the history pushState data with the states array */\n\tinit() {\n\t\tthis.states = [];\n\n\t\tlet state = newState();\n\t\tthis.add(state, \"replace\");\n\t}\n\n\t/** Get a state based on it's index */\n\tpublic get(index: number) {\n\t\treturn this.states[index];\n\t}\n\n\t/** Add a state to HistoryManager and change the history pushState data based on the historyAction specified */\n\tpublic add(value?: IState, historyAction: \"replace\" | \"push\" = \"push\"): HistoryManager {\n\t\tlet state = newState(value);\n\t\tlet len = this.length;\n\t\tthis.states.push({ ...state });\n\t\tthis.pointer = len;\n\n\t\tlet item: IHistoryItem = {\n\t\t\tindex: this.pointer,\n\t\t\tstates: [...this.states]\n\t\t};\n\t\tchangeState(historyAction, state, item);\n\t\treturn this;\n\t}\n\n\tpublic remove(index?: number) {\n\t\tif (index) {\n\t\t\tthis.states.splice(index, 1);\n\t\t} else {\n\t\t\tthis.states.pop();\n\t\t}\n\n\t\tthis.pointer--;\n\t\treturn this;\n\t}\n\n\t/** Replaces the states array with another states array, this is later used when going back and forward in page history */\n\tpublic replace(newStates: IState[]) {\n\t\tthis.states = newStates;\n\t\treturn this;\n\t}\n\n\t/** Set state by index. */\n\tpublic set(i: number, state: IState) {\n\t\treturn (this.states[i] = state);\n\t}\n\n\t/** Get the current state */\n\tget current(): IState {\n\t\treturn this.get(this.pointer);\n\t}\n\n\t/** Get the last state (top of the history stack). */\n\tget last(): IState {\n\t\treturn this.get(this.length - 1);\n\t}\n\n\t/** Get the previous state. */\n\tget previous(): IState | null {\n\t\treturn this.pointer < 1 ? null : this.get(this.pointer - 1);\n\t}\n\n\tget length() {\n\t\treturn this.states.length;\n\t}\n}\n\n/** Either push or replace history state */\nexport const changeState = (action: \"push\" | \"replace\", state: IState, item: object) => {\n\tlet href = getHashedPath(state.url);\n\tlet args = [item, \"\", href];\n\tif (window.history) {\n\t\tswitch (action) {\n\t\t\tcase \"push\":\n\t\t\t\twindow.history.pushState.apply(window.history, args);\n\t\t\t\tbreak;\n\t\t\tcase \"replace\":\n\t\t\t\twindow.history.replaceState.apply(window.history, args);\n\t\t\t\tbreak;\n\t\t}\n\t}\n};\n", "import { Manager, ManagerItem, AdvancedManager } from \"./manager\";\nimport { equal, newURL } from \"./url\";\nimport { getConfig } from \"./config\";\nimport { Service } from \"./service\";\n\nexport interface IPage extends ManagerItem {\n dom: Document,\n wrapper: HTMLElement,\n title: string,\n head: Element,\n body: Element,\n url: URL,\n data: string,\n wrapperAttr: string,\n\n build(): any,\n install(): void,\n uninstall(): any,\n}\n\n/**\n * Parses strings to DOM\n */\nexport const PARSER: DOMParser = new DOMParser();\n\n/** A page represents the DOM elements that create each page */\nexport class Page extends ManagerItem implements IPage {\n /** Holds the DOM of the current page */\n public dom: Document;\n\n /** Holds the wrapper element to be swapped out of each Page */\n public wrapper: HTMLElement;\n\n /** Holds the title of each page */\n public title: string;\n\n /** Holds the head element of each page */\n public head: Element;\n\n /** Holds the body element of each page */\n public body: Element;\n\n /** The URL of the current page */\n public url: URL;\n\n /** The payload of a page request */\n public data: string;\n\n /** Attr that identifies the wrapper */\n public wrapperAttr: string;\n\n constructor(url: URL = newURL(), dom: string | Document = document) {\n super();\n this.url = url;\n\n if (typeof dom === \"string\") {\n this.data = dom;\n } else this.dom = dom || document;\n }\n\n /** Builds the page's dom, and sets the title, head, body, and wrapper properties of the Page class */\n public build() {\n if (!(this.dom instanceof Node)) {\n this.dom = PARSER.parseFromString(this.data, \"text/html\");\n }\n\n if (!(this.body instanceof Node)) {\n let { title, head, body } = this.dom;\n this.title = title;\n this.head = head;\n this.body = body;\n this.wrapper = this.body.querySelector(this.wrapperAttr);\n }\n }\n\n public install() {\n this.wrapperAttr = getConfig(this.config, \"wrapperAttr\");\n }\n\n public uninstall() {\n this.url = undefined;\n this.title = undefined;\n this.head = undefined;\n this.body = undefined;\n this.dom = undefined;\n this.wrapper = undefined;\n this.data = undefined;\n this.wrapperAttr = undefined;\n }\n}\n\nexport interface IPageManager extends Service {\n loading: Manager>,\n pages: AdvancedManager;\n\n install(): any,\n\n get(key): Page,\n add(value): PageManager,\n set(key, value): PageManager,\n remove(key): PageManager,\n has(key): boolean,\n clear(): PageManager,\n size: number,\n keys(): any[],\n\n load(_url: URL | string): Promise,\n request(url: string): Promise,\n}\n\n/** Controls which page to load */\nexport class PageManager extends Service implements IPageManager {\n /** Stores all fetch requests that are currently loading */\n public loading: Manager> = new Manager();\n\n pages: AdvancedManager;\n\n /** Instantiate pages, and add the current page to pages */\n install() {\n this.pages = new AdvancedManager(this.app);\n\n let URLString = newURL().pathname;\n this.set(URLString, new Page());\n URLString = undefined;\n }\n\n get(key) { return this.pages.get(key); }\n add(value) { this.pages.add(value); return this; }\n set(key, value) { this.pages.set(key, value); return this; }\n remove(key) { this.pages.remove(key); return this; }\n has(key) { return this.pages.has(key); }\n clear() { this.pages.clear(); return this; }\n get size() { return this.pages.size; }\n keys() { return this.pages.keys(); }\n\n /** Load from cache or by requesting URL via a fetch request, avoid requesting for the same thing twice by storing the fetch request in \"this.loading\" */\n public async load(_url: URL | string = newURL()): Promise {\n let url: URL = newURL(_url);\n let urlString: string = url.pathname;\n let page: Page, request: Promise;\n\n if (this.has(urlString)) {\n page = this.get(urlString);\n return Promise.resolve(page);\n }\n\n if (!this.loading.has(urlString)) {\n request = this.request(urlString);\n this.loading.set(urlString, request);\n } else request = this.loading.get(urlString);\n\n let response = await request;\n this.loading.remove(urlString);\n\n page = new Page(url, response);\n this.set(urlString, page);\n\n if (this.size > getConfig(this.config, \"maxPages\")) {\n let currentUrl = newURL();\n let keys = this.keys();\n let first = equal(currentUrl, keys[0]) ? keys[1] : keys[0];\n let page = this.get(first);\n page.unregister();\n page = undefined;\n keys = undefined;\n currentUrl = undefined;\n first = undefined;\n }\n\n return page;\n }\n\n /** Starts a fetch request */\n public async request(url: string): Promise {\n const headers = new Headers(getConfig(this.config, \"headers\"));\n const timeout = window.setTimeout(() => {\n window.clearTimeout(timeout);\n throw \"Request Timed Out!\";\n }, getConfig(this.config, \"timeout\"));\n\n try {\n let response = await fetch(url, {\n mode: 'same-origin',\n method: \"GET\",\n headers,\n cache: \"default\",\n credentials: \"same-origin\",\n });\n\n window.clearTimeout(timeout);\n if (response.status >= 200 && response.status < 300) {\n return await response.text();\n }\n\n const err = new Error(response.statusText || \"\" + response.status);\n throw err;\n } catch (err) {\n window.clearTimeout(timeout);\n throw err;\n }\n }\n}\n", "import { Manager, methodCall } from \"@okikio/manager\";\n\nexport type ListenerCallback = ((...args: any) => void);\nexport interface IListener {\n readonly callback: ListenerCallback;\n readonly scope: object;\n readonly name: string;\n}\n\n/** Represents a new event listener consisting of properties like: callback, scope, name */\nexport const newListener = ({\n callback = () => { },\n scope = null,\n name = \"event\",\n}: IListener): IListener => ({ callback, scope, name });\n\n/** Represents a new event */\nexport class Event extends Manager {\n /** The name of the event */\n public name: string;\n constructor(name: string = \"event\") {\n super();\n this.name = name;\n }\n}\n\nexport type EventInput = string | object | Array;\n\n/**\n * An Event Emitter\n * */\nexport class EventEmitter extends Manager {\n constructor() {\n super();\n }\n\n /** Gets event, if event doesn't exist create a new one */\n public getEvent(name: string): Event {\n let event = this.get(name);\n if (!(event instanceof Event)) {\n this.set(name, new Event(name));\n return this.get(name);\n }\n\n return event;\n }\n\n /** Creates a listener and adds it to an event */\n public newListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event = this.getEvent(name);\n event.add(newListener({ name, callback, scope }));\n return event;\n }\n\n /** Adds a listener to a given event */\n public on(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n this.newListener(_name, _callback, _scope);\n }, this);\n return this;\n }\n\n /** Removes a listener from an event */\n public removeListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event: Event = this.get(name);\n if (event instanceof Event && callback) {\n let listener = newListener({ name, callback, scope });\n\n event.forEach((value: IListener, i: number) => {\n if (\n value.callback === listener.callback &&\n value.scope === listener.scope\n ) {\n return event.remove(i);\n }\n });\n }\n\n return event;\n }\n\n /** Remove a listener from a given event, or just completely remove an event */\n public off(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n if (typeof _callback === \"function\") {\n this.removeListener(_name, _callback, _scope);\n } else this.remove(_name);\n }, this);\n return this;\n }\n\n /** Call all listeners within an event */\n public emit(\n events: string | Array,\n ...args: any\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n // Loop through the list of events\n events.forEach((event: string) => {\n let _event: Event = this.get(event);\n\n if (_event instanceof Event) {\n _event.forEach((listener: IListener) => {\n let { callback, scope } = listener;\n callback.apply(scope, args);\n });\n }\n }, this);\n return this;\n }\n\n /** Clears events and event listeners */\n public clear() {\n methodCall(this, \"clear\");\n super.clear();\n return this;\n }\n}\n\nexport default EventEmitter;\n", "import { Manager } from \"./manager\";\nimport { ICoords, newCoords, Trigger } from \"./history\";\nimport { IPage } from \"./page\";\nimport { getConfig } from \"./config\";\nimport { Service } from \"./service\";\nimport { newURL } from \"./url\";\n\n/**\n * The async function type, allows for smooth transition between Promises\n */\nexport type asyncFn = (err?: any, value?: any) => void;\nexport interface ITransition {\n oldPage?: IPage;\n newPage?: IPage;\n trigger?: Trigger;\n scroll?: { x: number; y: number };\n scrollable?: boolean;\n in: (data: ITransitionData) => any;\n out: (data: ITransitionData) => any;\n [key: string]: any;\n}\nexport interface ITransitionData {\n from?: IPage;\n to?: IPage;\n trigger?: Trigger;\n scroll?: ICoords;\n done: asyncFn;\n}\nexport interface ITransitionManager extends Service {\n transitions: Manager,\n\n get(key: string): ITransition,\n set(key: string, value: ITransition): TransitionManager,\n add(value: ITransition): TransitionManager,\n has(key: string): boolean,\n\n boot(): any,\n animate(name: string, data: any): Promise,\n}\n\n/** Auto scrolls to an elements position if the element has an hash */\nexport const hashAction = (coords?: ICoords, hash: string = window.location.hash) => {\n try {\n let _hash = hash[0] == \"#\" ? hash : newURL(hash).hash;\n if (_hash.length > 1) {\n let el = document.getElementById(_hash.slice(1));\n if (el) {\n let { left, top } = el.getBoundingClientRect();\n let scrollLeft = window.pageXOffset;\n let scrollTop = window.pageYOffset;\n let x = left + scrollLeft;\n let y = top + scrollTop;\n\n console.log(x, y);\n return newCoords(x, y);\n }\n }\n } catch (e) {\n console.warn(\"[hashAction] error\", e);\n }\n\n return coords ?? newCoords(0, 0);\n};\n\n// The Default Transition\nconst Default: ITransition = {\n name: \"default\",\n scrollable: true,\n\n out({ done }: ITransitionData) {\n done();\n },\n in({ scroll, done }: ITransitionData) {\n window.scroll(scroll.x, scroll.y);\n done();\n }\n};\n\n/** Controls which Transition between pages to use */\nexport class TransitionManager extends Service implements ITransitionManager {\n transitions: Manager;\n private _arg: Array<[string, ITransition]>;\n constructor(transitions?: Array<[string, ITransition]>) {\n super();\n this._arg = transitions;\n }\n\n /** On Service install set Config */\n public install() {\n super.install();\n\n let transitions = this._arg && this._arg.length ? this._arg : (getConfig(this.config, \"transitions\") ?? []);\n\n // Manager like Maps use the most recent [key, value] Array it knows, replacing the default transition\n // With any other transitions called [\"default\", ...]\n transitions = [[\"default\", Default]].concat(transitions);\n this.transitions = new Manager(transitions);\n }\n\n get(key: string) { return this.transitions.get(key); }\n set(key: string, value: ITransition) { this.transitions.set(key, value); return this; }\n add(value: ITransition) { this.transitions.add(value); return this; }\n has(key: string) { return this.transitions.has(key); }\n\n /** Starts a transition */\n public async animate(name: string, data: any): Promise {\n let transition: ITransition = this.transitions.get(name);\n let scroll = data.scroll;\n let ignoreHashAction = data.ignoreHashAction;\n if (!(\"wrapper\" in data.oldPage) || !(\"wrapper\" in data.newPage))\n throw `[Page] either oldPage or newPage aren't instances of the Page Class.\\n ${{\n newPage: data.newPage,\n oldPage: data.oldPage,\n }}`;\n\n // Replace the title\n document.title = `` + data.newPage.title;\n\n let fromWrapper = data.oldPage.wrapper;\n let toWrapper = data.newPage.wrapper;\n\n if (!(fromWrapper instanceof Node) || !(toWrapper instanceof Node))\n throw `[Wrapper] the wrapper from the ${!(toWrapper instanceof Node) ? \"next\" : \"current\"\n } page cannot be found. The wrapper must be an element that has the attribute ${getConfig(this.config,\n \"wrapperAttr\"\n )}.`;\n\n // Give the Transition all the background data it may require\n transition.init && transition?.init(data);\n\n this.emitter.emit(\"BEFORE_TRANSITION_OUT\");\n\n // Start the out point of the Transition\n if (transition.out) {\n await new Promise((done) => {\n let outMethod: Promise = transition.out.call(transition, {\n ...data,\n from: data.oldPage,\n trigger: data.trigger,\n done,\n });\n\n outMethod?.then(done);\n });\n }\n\n this.emitter.emit(\"AFTER_TRANSITION_OUT\");\n\n // Add the new wrapper before the old one\n await new Promise((done) => {\n fromWrapper.insertAdjacentElement(\"beforebegin\", toWrapper);\n this.emitter.emit(\"CONTENT_INSERT\");\n\n if (!ignoreHashAction && !/back|popstate|forward/.test(data.trigger as string)) {\n scroll = hashAction(scroll);\n }\n done();\n });\n\n // Replace the old wrapper with the new one\n await new Promise((done) => {\n fromWrapper.remove();\n fromWrapper = undefined;\n toWrapper = undefined;\n this.emitter.emit(\"CONTENT_REPLACED\");\n done();\n });\n\n this.emitter.emit(\"BEFORE_TRANSITION_IN\");\n\n // Start the in point of the Transition (only the in method has access to the hashAction's scroll position)\n if (transition.in) {\n await new Promise(async (done) => {\n let inMethod: Promise = transition.in.call(transition, {\n ...data,\n from: data.oldPage,\n to: data.newPage,\n trigger: data.trigger,\n scroll,\n done,\n });\n\n inMethod?.then(done);\n });\n }\n\n this.emitter.emit(\"AFTER_TRANSITION_IN\");\n return transition;\n }\n}\n", "import { EventEmitter, ListenerCallback, EventInput } from \"./emitter\";\nimport { ServiceManager, Service } from \"./service\";\nimport { newConfig, ICONFIG } from \"./config\";\n\nexport interface IApp {\n services: ServiceManager,\n emitter: EventEmitter,\n config: ICONFIG,\n register(config: ICONFIG): App,\n get(key: string): Service,\n set(key: string, service: Service): App,\n add(value: Service): App,\n boot(): App,\n stop(): App,\n on(events: EventInput, callback?: ListenerCallback): App,\n off(events: EventInput, callback?: ListenerCallback): App,\n emit(events: string | any[], ...args: any): App,\n}\n\n/** The App class starts the entire process, it controls all managers and all services */\nexport class App implements IApp {\n /** An instance of the ServiceManager */\n public services: ServiceManager;\n\n /** An instance of an EventEmitter */\n public emitter: EventEmitter;\n\n /** The current Configuration's for the App */\n public config: ICONFIG;\n constructor(config: object = {}) {\n this.register(config);\n }\n\n /** Create new instances of the ServiceManager, EventEmitter and the configurations */\n public register(config: ICONFIG = {}): App {\n this.config = newConfig(config);\n this.emitter = new EventEmitter();\n this.services = new ServiceManager(this);\n\n let handler = (() => {\n document.removeEventListener(\"DOMContentLoaded\", handler);\n window.removeEventListener(\"load\", handler);\n this.emitter.emit(\"READY ready\");\n }).bind(this);\n\n document.addEventListener(\"DOMContentLoaded\", handler);\n window.addEventListener(\"load\", handler);\n return this;\n }\n\n /** Shortcuts to adding, setting, and getting Services */\n public get(key: string): Service {\n return this.services.get(key);\n }\n\n public set(key: string, value: Service): App {\n this.services.set(key, value);\n return this;\n }\n\n public add(value: Service): App {\n this.services.add(value);\n return this;\n }\n\n /** Initialize and boot all Services */\n public boot(): App {\n this.services.init();\n this.services.boot();\n return this;\n }\n\n /** Stops all Services and clears the even emitter of all events and listeners */\n public stop(): App {\n this.services.stop();\n this.emitter.clear();\n return this;\n }\n\n /** Shortcuts to the App EventEmitter on, off, and emit methods */\n public on(events: EventInput, callback?: ListenerCallback): App {\n this.emitter.on(events, callback, this);\n return this;\n }\n\n public off(events: EventInput, callback?: ListenerCallback): App {\n this.emitter.off(events, callback, this);\n return this;\n }\n\n public emit(events: string | any[], ...args: any): App {\n this.emitter.emit(events, ...args);\n return this;\n }\n}\n", "import { newState, Trigger, newCoords, IHistoryItem, IHistoryManager } from \"./history\";\nimport { Service } from \"./service\";\nimport { IPage, IPageManager } from \"./page\";\nimport { newURL, getHashedPath, equal } from \"./url\";\nimport { getConfig } from \"./config\";\nimport { hashAction, ITransitionManager } from \"./transition\";\n\nexport type LinkEvent = MouseEvent | TouchEvent;\nexport type StateEvent = LinkEvent | PopStateEvent;\nexport type IgnoreURLsList = Array;\n/**\n * Creates a barbajs like PJAX Service, for the native framework\n * Based on barbajs and StartingBlocks\n */\nexport class PJAX extends Service {\n /** URLs to ignore when prefetching */\n public ignoreURLs: IgnoreURLsList;\n\n /** Whether or not to disable prefetching */\n public prefetchIgnore: boolean;\n\n /** Current state of transitions */\n public isTransitioning: boolean;\n\n /** Ignore extra clicks of an anchor element if a transition has already started */\n public stopOnTransitioning: boolean;\n\n /** On page change (excluding popstate events) keep current scroll position */\n public stickyScroll: boolean;\n\n /** Force load a page if an error occurs */\n public forceOnError: boolean;\n\n /** Ignore hash action if set to true */\n public ignoreHashAction: boolean;\n\n public install() {\n super.install();\n\n this.ignoreURLs = getConfig(this.config, \"ignoreURLs\") ?? [];\n this.prefetchIgnore = getConfig(this.config, \"prefetchIgnore\") ?? false;\n this.stopOnTransitioning = getConfig(this.config, \"stopOnTransitioning\") ?? false;\n this.stickyScroll = getConfig(this.config, \"stickyScroll\") ?? false;\n this.forceOnError = getConfig(this.config, \"forceOnError\") ?? false;\n this.ignoreHashAction = getConfig(this.config, \"ignoreHashAction\") ?? false\n }\n\n /** Sets the transition state to either true or false */\n public transitionStart() {\n this.isTransitioning = true;\n }\n\n public transitionStop() {\n this.isTransitioning = false;\n }\n\n public init() {\n /**\n * Bind the event listeners to the PJAX class\n *\n * @memberof PJAX\n */\n this.onHover = this.onHover.bind(this);\n this.onClick = this.onClick.bind(this);\n this.onStateChange = this.onStateChange.bind(this);\n }\n\n /** Starts the PJAX Service */\n public boot() {\n if (\"scrollRestoration\" in window.history) {\n // Back off, browser, I got this...\n window.history.scrollRestoration = \"manual\";\n }\n\n super.boot();\n }\n\n /** Gets the transition to use for a certain anchor */\n public getTransitionName(el: HTMLAnchorElement): string | null {\n if (!el || !el.getAttribute) return null;\n let transitionAttr = el.getAttribute(\n getConfig(this.config, \"transitionAttr\", false)\n );\n\n if (typeof transitionAttr === \"string\") return transitionAttr;\n return null;\n }\n\n /** Checks to see if the anchor is valid */\n public validLink(\n el: HTMLAnchorElement,\n event: LinkEvent | KeyboardEvent,\n href: string\n ): boolean {\n let pushStateSupport = !window.history.pushState;\n let exists = !el || !href;\n let eventMutate =\n (event as KeyboardEvent).metaKey ||\n (event as KeyboardEvent).ctrlKey ||\n (event as KeyboardEvent).shiftKey ||\n (event as KeyboardEvent).altKey;\n let newTab =\n el.hasAttribute(\"target\") &&\n (el as HTMLAnchorElement).target === \"_blank\";\n let crossOrigin =\n (el as HTMLAnchorElement).protocol !== location.protocol ||\n (el as HTMLAnchorElement).hostname !== location.hostname;\n let download = typeof el.getAttribute(\"download\") === \"string\";\n let preventSelf = el.matches(getConfig(this.config, \"preventSelfAttr\"));\n let preventAll = Boolean(\n el.closest(getConfig(this.config, \"preventAllAttr\"))\n );\n let sameURL = getHashedPath(newURL()) === getHashedPath(newURL(href));\n return !(\n exists ||\n pushStateSupport ||\n eventMutate ||\n newTab ||\n crossOrigin ||\n download ||\n preventSelf ||\n preventAll ||\n sameURL\n );\n }\n\n /** Returns the href of an Anchor element */\n public getHref(el: HTMLAnchorElement): string | null {\n if (\n el &&\n el.tagName &&\n el.tagName.toLowerCase() === \"a\" &&\n typeof el.href === \"string\"\n )\n return el.href;\n return null;\n }\n\n /** Check if event target is a valid anchor with an href, if so, return the anchor */\n public getLink(event: LinkEvent): HTMLAnchorElement {\n let el = event.target as HTMLAnchorElement;\n let href: string = this.getHref(el);\n\n while (el && !href) {\n el = (el as HTMLElement).parentNode as HTMLAnchorElement;\n href = this.getHref(el);\n }\n\n // Check for a valid link\n if (!el || !this.validLink(el, event, href)) return;\n return el;\n }\n\n /** When an element is clicked, get valid anchor element, go for a transition */\n public onClick(event: LinkEvent) {\n let el = this.getLink(event);\n if (!el) return;\n\n if (this.isTransitioning && this.stopOnTransitioning) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n let href = this.getHref(el);\n this.emitter.emit(\"ANCHOR_CLICK CLICK\", event);\n this.go({ href, trigger: el, event });\n }\n\n /** Returns the direction of the State change as a String, either the Back button or the Forward button */\n public getDirection(value: number): Trigger {\n if (Math.abs(value) > 1) {\n // Ex 6-0 > 0 -> forward, 0-6 < 0 -> back\n return value > 0 ? \"forward\" : \"back\";\n } else {\n if (value === 0) {\n return \"popstate\";\n } else {\n // Ex 6-5 > 0 -> back, 5-6 < 0 -> forward\n return value > 0 ? \"back\" : \"forward\";\n }\n }\n }\n\n /** Force a page to go to a certain URL */\n public force(href: string): void {\n window.location.assign(href);\n }\n\n /**\n * If transition is running force load page.\n * Stop if currentURL is the same as new url.\n * On state change, change the current state history, to reflect the direction of said state change\n * Load page and page transition.\n */\n public go({\n href,\n trigger = \"HistoryManager\",\n event,\n }: {\n href: string;\n trigger?: Trigger;\n event?: StateEvent;\n }): Promise {\n // If transition is already running and the go method is called again, force load page\n if (this.isTransitioning && this.stopOnTransitioning ||\n !(this.manager.has(\"TransitionManager\") &&\n this.manager.has(\"HistoryManager\") &&\n this.manager.has(\"PageManager\"))) {\n this.force(href);\n return;\n }\n\n const history = this.manager.get(\"HistoryManager\") as IHistoryManager;\n let scroll = newCoords(0, 0);\n let currentState = history.current;\n let currentURL = currentState.url;\n if (equal(currentURL, href)) {\n return;\n }\n\n let transitionName: string;\n if (event && (event as PopStateEvent).state) {\n this.emitter.emit(\"POPSTATE\", event);\n\n // If popstate, get back/forward direction.\n let { state }: { state: IHistoryItem } = event as PopStateEvent;\n let { index } = state;\n let currentIndex = currentState.index;\n let difference = currentIndex - index;\n\n history.replace(state.states);\n history.pointer = index;\n\n let _state = history.get(index);\n transitionName = _state.transition;\n scroll = _state.data.scroll;\n\n trigger = this.getDirection(difference);\n console.log(trigger == \"forward\" && history)\n\n // Based on the direction of the state change either remove or add a state\n this.emitter.emit(trigger === \"back\" ? `POPSTATE_BACK` : `POPSTATE_FORWARD`, event);\n } else {\n // Add new state\n transitionName = this.getTransitionName(trigger as HTMLAnchorElement);\n\n scroll = newCoords();\n let state = newState({\n url: href,\n transition: transitionName,\n data: { scroll },\n });\n\n !this.stickyScroll && (scroll = newCoords(0, 0));\n\n history.add(state);\n this.emitter.emit(\"HISTORY_NEW_ITEM\", event);\n }\n\n if (event) {\n event.stopPropagation();\n event.preventDefault();\n }\n\n this.emitter.emit(\"GO\", event);\n return this.load({\n oldHref: currentURL,\n href,\n trigger,\n transitionName,\n scroll,\n });\n }\n\n /** Load the new Page as well as a Transition; starts the Transition */\n public async load({\n oldHref,\n href,\n trigger,\n transitionName = \"default\",\n scroll = { x: 0, y: 0 },\n }: {\n oldHref: string;\n href: string;\n trigger: Trigger;\n transitionName?: string;\n scroll: { x: number; y: number };\n }): Promise {\n try {\n const pages = this.manager.get(\"PageManager\") as IPageManager;\n let newPage: IPage, oldPage: IPage;\n this.emitter.emit(\"NAVIGATION_START\", {\n oldHref,\n href,\n trigger,\n transitionName,\n });\n\n // Load & Build both the old and new pages\n try {\n this.transitionStart();\n oldPage = await pages.load(oldHref);\n !(oldPage.dom instanceof Element) && oldPage.build();\n\n this.emitter.emit(\"PAGE_LOADING\", { href, oldPage, trigger });\n newPage = await pages.load(href);\n await newPage.build();\n this.emitter.emit(\"PAGE_LOAD_COMPLETE\", {\n newPage,\n oldPage,\n trigger,\n });\n } catch (err) {\n console.warn(`[PJAX] Page load error: ${err}`);\n }\n\n // Transition Between Pages\n try {\n const TransitionManager = this.manager.get(\"TransitionManager\") as ITransitionManager;\n this.emitter.emit(\"TRANSITION_START\", transitionName);\n\n let transition = await TransitionManager.animate(TransitionManager.has(transitionName) ? transitionName : \"default\", {\n oldPage,\n newPage,\n trigger,\n scroll,\n ignoreHashAction: this.ignoreHashAction\n });\n\n if (!transition.scrollable) {\n if (!this.ignoreHashAction && !/back|popstate|forward/.test(trigger as string)) scroll = hashAction(scroll);\n window.scroll(scroll.x, scroll.y);\n }\n\n this.emitter.emit(\"TRANSITION_END\", { transition });\n } catch (err) {\n console.warn(`[PJAX] Transition error: ${err}`);\n }\n\n // Navigation is over\n this.emitter.emit(\"NAVIGATION_END\", {\n oldPage,\n newPage,\n trigger,\n transitionName,\n });\n } catch (err) {\n if (this.forceOnError) this.force(href);\n else console.warn(err);\n } finally {\n this.transitionStop(); // Sets isTransitioning to false\n }\n }\n\n /** Check to see if the URL is to be ignored, uses either RegExp of Strings to check */\n public ignoredURL({ pathname }: URL): boolean {\n return (\n this.ignoreURLs.length &&\n this.ignoreURLs.some((url) => {\n return typeof url === \"string\"\n ? url === pathname\n : (url as RegExp).exec(pathname) !== null;\n })\n );\n }\n\n /** When you hover over an anchor, prefetch the event target's href */\n public onHover(event: LinkEvent): Promise {\n let el = this.getLink(event);\n if (!el || !this.manager.has(\"PageManager\")) return;\n\n const pages = this.manager.get(\"PageManager\") as IPageManager;\n let url = newURL(this.getHref(el));\n let urlString: string = url.pathname;\n\n // If Url is ignored or already in cache, don't do any think\n if (this.ignoredURL(url) || pages.has(urlString)) return;\n this.emitter.emit(\"ANCHOR_HOVER HOVER\", event);\n\n try {\n pages.load(url);\n } catch (err) {\n console.warn(\"[PJAX] prefetch error,\", err);\n }\n }\n\n /** When History state changes, get url from State, go for a Transition. */\n public onStateChange(event: PopStateEvent): void {\n this.go({ href: window.location.href, trigger: \"popstate\", event });\n }\n\n /** Initialize DOM Events */\n public initEvents() {\n if (this.prefetchIgnore !== true) {\n document.addEventListener(\"mouseover\", this.onHover);\n document.addEventListener(\"touchstart\", this.onHover);\n }\n\n document.addEventListener(\"click\", this.onClick);\n window.addEventListener(\"popstate\", this.onStateChange);\n }\n\n /** Stop DOM Events */\n public stopEvents() {\n if (this.prefetchIgnore !== true) {\n document.removeEventListener(\"mouseover\", this.onHover);\n document.removeEventListener(\"touchstart\", this.onHover);\n }\n\n document.removeEventListener(\"click\", this.onClick);\n window.removeEventListener(\"popstate\", this.onStateChange);\n }\n}\n", "import { Service } from \"./service\";\nimport { Manager } from \"./manager\";\nimport { newURL, getHashedPath } from \"./url\";\nimport { IHistoryManager } from \"./history\";\n\nexport type RouteMethod = (...args: any) => any;\nexport type RouteStyle = string | RegExp | boolean;\nexport interface IRouteToFrom {\n to: RouteStyle,\n from: RouteStyle\n}\nexport type RoutePath = IRouteToFrom | RouteStyle;\nexport interface IRoute {\n path: RoutePath,\n method: RouteMethod\n}\n\n/** Controls what happens when certain url paths match a set of criteria */\nexport class Router extends Service {\n /** List of routes */\n protected routes: Manager;\n constructor(routes: IRoute[] = []) {\n super();\n this.routes = new Manager();\n for (let route of routes) {\n this.add(route);\n }\n }\n\n /** Add a new route to watch for */\n public add({ path, method }: IRoute): Router {\n let key = this.parse(path);\n this.routes.set(key, method);\n return this;\n }\n\n /** Convert strings into path match functions */\n public parsePath(path: RouteStyle): RegExp | boolean {\n if (typeof path === \"string\") return new RegExp(path, \"i\");\n else if (path instanceof RegExp || typeof path === \"boolean\")\n return path;\n throw \"[Router] only regular expressions, strings and booleans are accepted as paths.\";\n }\n\n /** Determines if a strings counts has a path */\n public isPath(input: RouteStyle): boolean {\n return (\n typeof input === \"string\" ||\n input instanceof RegExp ||\n typeof input === \"boolean\"\n );\n }\n\n /** Parse the multiple different formats for paths, into a { from, to } object */\n public parse(input: RoutePath): IRouteToFrom {\n let route = input as IRouteToFrom;\n let toFromPath: IRouteToFrom = {\n from: /(.*)/g,\n to: /(.*)/g,\n };\n\n if (this.isPath(input as RouteStyle))\n toFromPath = {\n from: true,\n to: input as RouteStyle,\n };\n else if (this.isPath(route.from) && this.isPath(route.to as RouteStyle))\n toFromPath = route;\n else\n throw \"[Router] path is neither a string, regular expression, or a { from, to } object.\";\n\n let { from, to } = toFromPath;\n return {\n from: this.parsePath(from),\n to: this.parsePath(to),\n };\n }\n\n /** Test if route paths are true, if so run their methods */\n public route() {\n if (this.manager.has(\"HistoryManager\")) {\n let history = this.manager.get(\"HistoryManager\") as IHistoryManager;\n let from: string = getHashedPath(newURL((history.length > 1 ? history.previous : history.current).url));\n let to: string = getHashedPath(newURL());\n\n this.routes.forEach((method: RouteMethod, path: IRouteToFrom) => {\n let fromRegExp = path.from as RegExp | boolean;\n let toRegExp = path.to as RegExp | boolean;\n\n if (\n typeof fromRegExp === \"boolean\" &&\n typeof toRegExp === \"boolean\"\n ) {\n throw `[Router] path ({ from: ${fromRegExp}, to: ${toRegExp} }) is not valid, remember paths can only be strings, regular expressions, or a boolean; however, both the from and to paths cannot be both booleans.`;\n }\n\n let fromParam: RegExpExecArray | RegExp | boolean = fromRegExp;\n let toParam: RegExpExecArray | RegExp | boolean = toRegExp;\n\n if (fromRegExp instanceof RegExp && fromRegExp.test(from))\n fromParam = fromRegExp.exec(from);\n if (toRegExp instanceof RegExp && toRegExp.test(to))\n toParam = toRegExp.exec(to);\n\n if (\n (Array.isArray(toParam) && Array.isArray(fromParam)) ||\n (Array.isArray(toParam) &&\n typeof fromParam == \"boolean\" &&\n fromParam) ||\n (Array.isArray(fromParam) &&\n typeof toParam == \"boolean\" &&\n toParam)\n )\n method({ from: fromParam, to: toParam, path: { from, to } });\n });\n } else {\n console.warn(\"[Route] HistoryManager is missing.\");\n }\n }\n\n /** Add listeners for PJAX Events */\n public initEvents() {\n this.emitter.on(\"READY\", this.route, this);\n this.emitter.on(\"CONTENT_REPLACED\", this.route, this);\n }\n\n /** Remove listeners for PJAX Events */\n public stopEvents() {\n this.emitter.off(\"READY\", this.route, this);\n this.emitter.off(\"CONTENT_REPLACED\", this.route, this);\n }\n}\n", "import { EventEmitter, EventInput, ListenerCallback } from \"@okikio/emitter\";\nimport { Manager } from \"@okikio/manager\";\n\n// DOM\nexport type AnimationTarget = string | Node | NodeList | HTMLCollection | HTMLElement[] | AnimationTarget[];\nexport const getElements = (selector: string | Node): Node[] => {\n return typeof selector === \"string\" ? Array.from(document.querySelectorAll(selector as string)) : [selector];\n};\n\nconst flatten = (arr: AnimationTarget[]) => [].concat(...arr);\nexport const getTargets = (targets: AnimationTarget): Node[] => {\n if (Array.isArray(targets)) {\n return flatten((targets as AnimationTarget[]).map(getTargets));\n }\n if (typeof targets == \"string\" || targets instanceof Node)\n return getElements(targets);\n if (targets instanceof NodeList || targets instanceof HTMLCollection)\n return Array.from(targets);\n return [];\n};\n\n// VALUES\nexport type closureArgs = [number, number, HTMLElement];\nexport type closure = ((index?: number, total?: number, element?: HTMLElement) => (genericTypes[] | void)) | any;\nexport const computeValue = (value: closure, args: closureArgs, context: Animate) => {\n if (typeof value === \"function\") {\n return value.apply(context, args);\n } else { return value; }\n};\n\nexport const mapObject = (obj: object, args: closureArgs, options: Animate): any => {\n let key: string, value: any, result = {};\n let keys = Object.keys(obj);\n for (let i = 0, len = keys.length; i < len; i++) {\n key = keys[i];\n value = obj[key];\n result[key] = computeValue(value, args, options);\n }\n\n return result;\n};\n\n/** From: [https://easings.net] */\nexport const easings = {\n \"in\": \"ease-in\",\n \"out\": \"ease-out\",\n \"in-out\": \"ease-in-out\",\n\n // Sine\n \"in-sine\": \"cubic-bezier(0.47, 0, 0.745, 0.715)\",\n \"out-sine\": \"cubic-bezier(0.39, 0.575, 0.565, 1)\",\n \"in-out-sine\": \"cubic-bezier(0.445, 0.05, 0.55, 0.95)\",\n\n // Quad\n \"in-quad\": \"cubic-bezier(0.55, 0.085, 0.68, 0.53)\",\n \"out-quad\": \"cubic-bezier(0.25, 0.46, 0.45, 0.94)\",\n \"in-out-quad\": \"cubic-bezier(0.455, 0.03, 0.515, 0.955)\",\n\n // Cubic\n \"in-cubic\": \"cubic-bezier(0.55, 0.055, 0.675, 0.19)\",\n \"out-cubic\": \"cubic-bezier(0.215, 0.61, 0.355, 1)\",\n \"in-out-cubic\": \"cubic-bezier(0.645, 0.045, 0.355, 1)\",\n\n // Quart\n \"in-quart\": \"cubic-bezier(0.895, 0.03, 0.685, 0.22)\",\n \"out-quart\": \"cubic-bezier(0.165, 0.84, 0.44, 1)\",\n \"in-out-quart\": \"cubic-bezier(0.77, 0, 0.175, 1)\",\n\n // Quint\n \"in-quint\": \"cubic-bezier(0.755, 0.05, 0.855, 0.06)\",\n \"out-quint\": \"cubic-bezier(0.23, 1, 0.32, 1)\",\n \"in-out-quint\": \"cubic-bezier(0.86, 0, 0.07, 1)\",\n\n // Expo\n \"in-expo\": \"cubic-bezier(0.95, 0.05, 0.795, 0.035)\",\n \"out-expo\": \"cubic-bezier(0.19, 1, 0.22, 1)\",\n \"in-out-expo\": \"cubic-bezier(1, 0, 0, 1)\",\n\n // Circ\n \"in-circ\": \"cubic-bezier(0.6, 0.04, 0.98, 0.335)\",\n \"out-circ\": \"cubic-bezier(0.075, 0.82, 0.165, 1)\",\n \"in-out-circ\": \"cubic-bezier(0.785, 0.135, 0.15, 0.86)\",\n\n // Back\n \"in-back\": \"cubic-bezier(0.6, -0.28, 0.735, 0.045)\",\n \"out-back\": \"cubic-bezier(0.175, 0.885, 0.32, 1.275)\",\n \"in-out-back\": \"cubic-bezier(0.68, -0.55, 0.265, 1.55)\"\n};\n\nexport const getEase = (ease: string) => {\n return /^(in|out)/.test(ease) ? easings[ease] : ease;\n};\n\nexport type genericTypes = genericTypes[] | boolean | object | string | number | closure | null | undefined;\nexport interface AnimationOptions {\n target?: AnimationTarget,\n\n speed?: number,\n autoplay?: boolean,\n options?: AnimationOptions,\n delay?: number | closure,\n easing?: string | closure,\n endDelay?: number | closure,\n duration?: number | closure,\n keyframes?: Keyframe[] | object[] | closure,\n loop?: number | boolean | closure, // iterations: number,\n onfinish?: (element?: HTMLElement, index?: number, total?: number, animation?: Animation) => any,\n fillMode?: \"none\" | \"forwards\" | \"backwards\" | \"both\" | \"auto\" | closure,\n direction?: \"normal\" | \"reverse\" | \"alternate\" | \"alternate-reverse\" | closure,\n extend?: EffectTiming,\n [property: string]: genericTypes;\n};\n\nexport const DefaultAnimationOptions: AnimationOptions = {\n keyframes: [],\n\n loop: 1, // iterations: number,\n delay: 0,\n speed: 1,\n endDelay: 0,\n easing: \"ease\",\n autoplay: true,\n duration: 1000,\n fillMode: \"auto\",\n direction: \"normal\",\n extend: {}\n};\n\nexport type AnimationEvents = \"update\" | \"play\" | \"pause\" | \"start\" | \"begin\" | \"complete\" | \"finish\" | \"error\" | \"stop\";\n\n/** You can check it out here: https://codepen.io/okikio/pen/qBbdGaW?editors=0011 */\nexport class Animate {\n /**\n * Stores the options for the current animation\n */\n public options: AnimationOptions = {};\n\n /**\n * The Array of Elements to Animate\n */\n public targets: Node[] = [];\n\n /**\n * The properties to animate\n */\n public properties: object = {};\n\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n\n /**\n * The total duration of all Animation's\n */\n public totalDuration: number = 0;\n\n /**\n * The smallest delay out of all Animation's\n */\n public minDelay: number = 0;\n\n /**\n * The options for individual animations\n */\n public computedOptions: Manager = new Manager();\n\n /**\n * The Element the main animation uses\n */\n public mainElement: HTMLElement;\n\n /**\n * Stores an animation that runs on the total duration of the all other Animations, and as such it's the main Animation\n */\n public mainAnimation: Animation;\n\n /**\n * Stores request frame calls\n */\n public animationFrame: number;\n\n /**\n * An event emitter\n */\n public emitter: EventEmitter = new EventEmitter();\n\n /**\n * Returns a promise that is fulfilled when the mainAnimation is finished\n */\n public promise: Promise;\n constructor(options: AnimationOptions = {}) {\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n\n /**\n * Returns a new Promise that is resolve when this.finish is called\n */\n public newPromise(): Promise {\n return new Promise((resolve, reject) => {\n /*\n Note that the `this` keyword is in an Array when it is resolved,\n this is due to Promises not wanting to resolve references,\n so, you can't resolve `this` directly, so, I chose to resolve `this` in an\n Array\n */\n this.on(\"complete\", () => resolve([this]));\n this.on(\"error\", err => reject(err));\n });\n }\n\n /**\n * Fulfills the this.promise Promise\n */\n public then(\n onFulfilled?: (value?: any) => any,\n onRejected?: (reason?: any) => any\n ): Animate {\n onFulfilled = onFulfilled?.bind(this);\n onRejected = onRejected?.bind(this);\n this.promise.then(onFulfilled, onRejected);\n return this;\n }\n\n /**\n * Catches error that occur in the this.promise Promise\n */\n public catch(onRejected: (reason?: any) => any): Animate {\n onRejected = onRejected?.bind(this);\n this.promise.catch(onRejected);\n return this;\n }\n\n /**\n * If you don't care if the this.promise Promise has either been rejected or resolved\n */\n public finally(onFinally: () => any): Animate {\n onFinally = onFinally?.bind(this);\n this.promise.finally(onFinally);\n return this;\n }\n\n /**\n * Represents an Animation Frame Loop\n */\n public loop(): void {\n this.stopLoop();\n this.emit(\"update\", this.getProgress(), this);\n this.animationFrame = window.requestAnimationFrame(this.loop);\n }\n\n /**\n * Cancels animation frame\n */\n public stopLoop() {\n window.cancelAnimationFrame(this.animationFrame);\n }\n\n /**\n * Calls a method that affects all animations including the mainAnimation; the method only allows the animation parameter\n */\n public all(method: (animation?: Animation, target?: HTMLElement) => void) {\n method(this.mainAnimation, this.mainElement);\n this.animations.forEach(method);\n return this;\n }\n\n /**\n * Register the begin event\n */\n protected beginEvent() {\n if (this.getProgress() == 0) {\n let timer: number | void = window.setTimeout(() => {\n this.emit(\"begin\", this);\n timer = window.clearTimeout(timer as number);\n }, this.minDelay);\n }\n }\n\n /**\n * Play Animation\n */\n public play(): Animate {\n let playstate = this.getPlayState();\n this.beginEvent();\n this.all(anim => anim.play());\n this.emit(\"play\", playstate, this);\n this.loop();\n return this;\n }\n\n /**\n * Pause Animation\n */\n public pause(): Animate {\n let playstate = this.getPlayState();\n this.all(anim => anim.pause());\n this.emit(\"pause\", playstate, this);\n this.stopLoop();\n this.animationFrame = undefined;\n return this;\n }\n\n /**\n * Reset all Animations\n */\n public reset() {\n this.setProgress(0);\n this.beginEvent();\n\n if (this.options.autoplay) this.play();\n else this.pause();\n return this;\n }\n\n /**\n * Cancels all Animations\n */\n public cancel() {\n this.all(anim => anim.cancel());\n this.stopLoop();\n return this;\n }\n\n /**\n * Force complete all Animations\n */\n public finish() {\n this.all(anim => anim.finish());\n this.stopLoop();\n return this;\n }\n\n /**\n * Cancels & Clears all Animations\n */\n public stop() {\n this.cancel();\n this.animations.clear();\n while (this.targets.length) this.targets.pop();\n this.mainElement = undefined;\n this.emit(\"stop\");\n }\n\n /**\n * Returns an Array of targets\n */\n public getTargets(): Node[] {\n return this.targets;\n }\n\n /**\n * Get a specific Animation from an Animate instance\n */\n public getAnimation(element: HTMLElement): Animation {\n return this.animations.get(element);\n }\n\n /**\n * Returns the timings of an Animation, given a target\n * E.g. { duration, endDelay, delay, iterations, iterationStart, direction, easing, fill, etc... }\n */\n public getTiming(target: HTMLElement | Animation): AnimationOptions & EffectTiming {\n let animation = target instanceof Animation ? target : this.getAnimation(target);\n let keyframeOptions = this.computedOptions.get(animation) ?? {};\n let timings = animation.effect?.getTiming() ?? {};\n let options = this.getOptions();\n\n return { ...DefaultAnimationOptions, ...options, ...timings, ...keyframeOptions };\n }\n\n /**\n * Returns the total duration of Animation\n */\n public getTotalDuration(): number {\n return this.totalDuration;\n }\n\n /**\n * Returns the current time of the Main Animation\n */\n public getCurrentTime(): number {\n return this.mainAnimation.currentTime;\n }\n\n /**\n * Returns the Animation progress as a fraction of the current time / duration * 100\n */\n public getProgress() {\n return (this.getCurrentTime() / this.totalDuration) * 100;\n }\n\n /**\n * Return the playback speed of the animation\n */\n public getSpeed(): number {\n return this.mainAnimation.playbackRate;\n }\n\n /**\n * Returns the current playing state\n */\n public getPlayState(): \"idle\" | \"running\" | \"paused\" | \"finished\" {\n return this.mainAnimation.playState;\n }\n\n /**\n * Get the options of an Animate instance\n */\n public getOptions(): AnimationOptions {\n return this.options;\n }\n\n /**\n * Set the current time of the Main Animation\n */\n public setCurrentTime(time: number): Animate {\n this.all(anim => { anim.currentTime = time; });\n this.emit(\"update\", this.getProgress());\n return this;\n }\n\n /**\n * Set the Animation progress as a value from 0 to 100\n */\n public setProgress(percent: number): Animate {\n let time = (percent / 100) * this.totalDuration;\n this.setCurrentTime(time);\n return this;\n }\n\n /**\n * Set the playback speed of an Animation\n */\n public setSpeed(speed: number = 1): Animate {\n this.all(anim => { anim.playbackRate = speed; });\n return this;\n }\n\n /**\n * Adds a listener for a given event\n */\n public on(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.on(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Removes a listener from an event\n */\n public off(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.off(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Call all listeners within an event\n */\n public emit(events: AnimationEvents | string | any[], ...args: any): Animate {\n this.emitter.emit(events, ...args);\n return this;\n }\n\n\n /** Returns the Animate options, as JSON */\n public toJSON(): AnimationOptions {\n return this.getOptions();\n }\n\n /**\n * The Symbol.toStringTag well-known symbol is a string valued property that is used\n * in the creation of the default string description of an object.\n * It is accessed internally by the Object.prototype.toString() method.\n */\n get [Symbol.toStringTag]() {\n return `Animate`;\n }\n}\n\n/** Creates a new Animate instance */\nexport const animate = (options: AnimationOptions = {}): Animate => {\n return new Animate(options);\n};\n\nexport class Timeline extends Animate {\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n constructor(options: AnimationOptions = {}) {\n super();\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n public add(options: AnimationOptions) {\n return this;\n }\n}\n\nexport default animate;", "import { Service, animate } from \"../../../packages/native/src/api\";\n\nexport class IntroAnimation extends Service {\n public elements: Array;\n public rootElement: HTMLElement;\n\n public init() {\n super.init();\n\n // Elements\n this.elements = [...document.querySelectorAll('.intro-animation')];\n }\n\n public newPage() {\n this.init();\n this.prepareToShow();\n }\n\n public initEvents() {\n this.emitter.on(\"BEFORE_SPLASHSCREEN_HIDE\", this.prepareToShow, this);\n this.emitter.on(\"CONTENT_REPLACED\", this.newPage, this);\n this.emitter.on(\"START_SPLASHSCREEN_HIDE BEFORE_TRANSITION_IN\", this.show, this);\n }\n\n public stopEvents() {\n this.emitter.off(\"BEFORE_SPLASHSCREEN_HIDE\", this.prepareToShow, this);\n this.emitter.off(\"CONTENT_REPLACED\", this.newPage, this);\n this.emitter.off(\"START_SPLASHSCREEN_HIDE BEFORE_TRANSITION_IN\", this.show, this);\n }\n\n public stop() {\n requestAnimationFrame(() => {\n for (let el of this.elements) {\n (el as HTMLElement).style.transform = \"translateY(0px)\";\n (el as HTMLElement).style.opacity = '1';\n }\n });\n\n super.stop();\n }\n\n public prepareToShow() {\n requestAnimationFrame(() => {\n for (let el of this.elements) {\n (el as HTMLElement).style.transform = \"translateY(200px)\";\n (el as HTMLElement).style.opacity = '0';\n }\n });\n }\n\n public async show() {\n let [anim] = await animate({\n target: (this.elements as HTMLElement[]),\n keyframes: [\n { transform: \"translateY(200px)\", opacity: 0 },\n { transform: \"translateY(0px)\", opacity: 1 },\n ],\n // @ts-ignore\n delay(i: number) {\n return 300 * (i + 1);\n },\n onfinish(el: { style: { transform: string; opacity: string; }; }) {\n requestAnimationFrame(() => {\n el.style.transform = \"translateY(0px)\";\n el.style.opacity = \"1\";\n });\n },\n easing: \"out-cubic\",\n duration: 650\n });\n anim.stop();\n return anim;\n }\n}\n", "import { ITransition, ITransitionData, animate } from \"../../../packages/native/src/api\";\n\n//== Transition\nexport const Fade: ITransition = {\n name: \"default\",\n duration: 500,\n scrollable: true,\n\n out({ from }: ITransitionData) {\n let { duration } = this;\n let fromWrapper = from.wrapper;\n return animate({\n target: fromWrapper,\n opacity: [1, 0],\n duration,\n }).on(\"finish\", function () {\n this.stop();\n });\n },\n\n in({ to, scroll }: ITransitionData) {\n let { duration } = this;\n let toWrapper = to.wrapper;\n\n window.scroll(scroll.x, scroll.y);\n return animate({\n target: toWrapper,\n opacity: [0, 1],\n duration\n }).then(function () {\n this.stop();\n });\n }\n};\n", "import { ITransition, ITransitionData, animate } from \"../../../packages/native/src/api\";\n\n//== Transitions\nexport const BigTransition: ITransition = {\n name: \"big\",\n delay: 200,\n durationPerAnimation: 700,\n scrollable: true,\n\n init() {\n this.mainElement = document.getElementById('big-transition');\n this.spinnerElement = this.mainElement.querySelector('.spinner');\n this.horizontalElements = [...this.mainElement.querySelector('#big-transition-horizontal').querySelectorAll('div')];\n this.maxLength = this.horizontalElements.length;\n },\n\n out({ from, scroll }: ITransitionData) {\n let { durationPerAnimation: duration, delay } = this;\n let fromWrapper = from.wrapper;\n\n window.scroll(scroll.x, scroll.y);\n let wrapperStyle = Object.assign({}, fromWrapper.style);\n return new Promise(async resolve => {\n this.mainElement.style.opacity = \"1\";\n this.mainElement.style.visibility = \"visible\";\n let anim1 = animate({\n target: fromWrapper,\n opacity: [1, 0],\n duration,\n onfinish(el: { style: { opacity: string; }; }) {\n el.style.opacity = '0';\n }\n });\n\n anim1.then(function () { this.stop(); });\n\n let [anim2] = await animate({\n target: this.horizontalElements,\n keyframes: [\n { transform: \"scaleX(0)\" },\n { transform: \"scaleX(1)\" },\n ],\n // @ts-ignore\n delay(i: number) {\n return delay * (i + 1);\n },\n onfinish(el: { style: { transform: string; }; }) {\n el.style.transform = `scaleX(1)`;\n },\n easing: \"out-cubic\",\n duration: 500\n });\n\n fromWrapper.style.opacity = '1';\n Object.assign(fromWrapper.style, wrapperStyle);\n this.spinnerElement.style.visibility = \"visible\";\n\n let loaderDuration = 500;\n let [anim3] = await animate({\n target: this.spinnerElement,\n opacity: [0, 1],\n duration: loaderDuration,\n onfinish(el: { style: { opacity: string; }; }) {\n el.style.opacity = `1`;\n },\n });\n\n let [anim4] = await animate({\n options: anim3,\n opacity: [1, 0],\n onfinish(el: { style: { opacity: string; }; }) {\n el.style.opacity = `0`;\n },\n delay: 1500\n });\n this.spinnerElement.style.visibility = \"hidden\";\n // anim2.stop() // -> anim2.stop() Breaks the Animation\n anim3.stop();\n anim4.stop();\n resolve();\n });\n },\n\n in({ to, scroll }: ITransitionData) {\n let { durationPerAnimation: duration, delay } = this;\n let toWrapper = to.wrapper;\n\n window.scroll(scroll.x, scroll.y);\n return new Promise(async resolve => {\n let anim1 = animate({\n target: toWrapper,\n opacity: [0, 1],\n duration\n }).then(() => {\n anim1.stop();\n });\n\n let [anim2] = await animate({\n target: this.horizontalElements,\n keyframes: [\n { transform: \"scaleX(1)\" },\n { transform: \"scaleX(0)\" },\n ],\n // @ts-ignore\n delay(i: number) {\n return delay * (i + 1);\n },\n onfinish(el: { style: { transform: string; }; }) {\n el.style.transform = `scaleX(0)`;\n },\n easing: \"out-cubic\",\n duration: 500\n });\n\n this.mainElement.style.opacity = \"0\";\n this.mainElement.style.visibility = \"hidden\";\n anim2.stop();\n resolve();\n });\n }\n}\n", "import { ITransition, ITransitionData, animate } from \"../../../packages/native/src/api\";\n\n//== Transitions\nexport const Slide: ITransition = {\n name: \"slide\",\n duration: 500,\n direction: \"right\",\n scrollable: true,\n\n init(data: ITransition) {\n let trigger = (data.trigger as HTMLElement);\n if (trigger instanceof Node && trigger.hasAttribute(\"data-direction\")) {\n this.direction = trigger.getAttribute(\"data-direction\");\n } else {\n this.direction = \"right\";\n }\n },\n\n out({ from }: ITransitionData) {\n let { duration, direction } = this;\n let fromWrapper = from.wrapper;\n\n return animate({\n target: fromWrapper,\n keyframes: [\n { transform: \"translateX(0%)\", opacity: 1 },\n { transform: `translateX(${direction === \"left\" ? \"-\" : \"\"}25%)`, opacity: 0 },\n ],\n duration,\n easing: \"in-quint\"\n }).then(function () {\n this.stop();\n });\n },\n\n in({ to, scroll }: ITransitionData) {\n let { duration } = this;\n let toWrapper = to.wrapper;\n\n window.scroll(scroll.x, scroll.y);\n return animate({\n target: toWrapper,\n keyframes: [\n { transform: `translateX(${this.direction === \"right\" ? \"-\" : \"\"}25%)`, opacity: 0 },\n { transform: \"translateX(0%)\", opacity: 1 },\n ],\n duration,\n easing: \"out-quint\"\n }).then(function () {\n this.stop();\n });\n }\n};\n\nexport const SlideLeft: ITransition = {\n ...Slide,\n\n name: \"slide-left\",\n direction: \"left\",\n init(data: ITransition) { }\n};\n\nexport const SlideRight: ITransition = {\n ...Slide,\n\n name: \"slide-right\",\n direction: \"right\",\n init(data: ITransition) { }\n};\n", "export const toArr = (input: any): any[] => Array.from(input);\nexport default toArr;", "import { Service, animate } from \"../../../packages/native/src/api\";\nimport { toArr } from \"../toArr\";\n\nexport class Navbar extends Service {\n public navbar: HTMLElement;\n public elements: HTMLElement[];\n public menu: HTMLElement;\n public collapseSection: HTMLElement;\n public navbarList: HTMLElement;\n toggleStatus: boolean;\n\n public init() {\n // Elements\n this.navbar = document.querySelector(\".navbar\") as HTMLElement;\n this.collapseSection = this.navbar.querySelector(\".navbar-collapse\") as HTMLElement;\n this.navbarList = this.navbar.querySelector(\".navbar-list\") as HTMLElement;\n this.elements = toArr(this.navbar.querySelectorAll(\".navbar-list a\"));\n this.menu = this.navbar.querySelector(\".navbar-toggle\") as HTMLElement;\n\n this.toggleStatus = false;\n this.toggleClick = this.toggleClick.bind(this);\n }\n\n public activateLink() {\n let { href } = window.location;\n\n for (let el of this.elements) {\n let itemHref =\n el.getAttribute(\"data-path\") ||\n (el as HTMLAnchorElement).href;\n if (!itemHref || itemHref.length < 1) return;\n\n let URLmatch = new RegExp(itemHref).test(href);\n let isActive = el.classList.contains(\"active\");\n if (!(URLmatch && isActive)) {\n el.classList.toggle(\"active\", URLmatch);\n }\n }\n }\n\n public toggleClick() {\n this.collapseSection.style?.setProperty?.(\"--height\", `${this.navbarList.clientHeight}px`);\n this.toggleStatus = !this.toggleStatus;\n this.collapseSection.classList.toggle(\"collapse\", !this.toggleStatus);\n this.collapseSection.classList.toggle(\"show\", this.toggleStatus);\n }\n\n public initEvents() {\n this.menu.addEventListener(\"click\", this.toggleClick);\n this.emitter.on(\"READY\", this.activateLink, this);\n this.emitter.on(\"GO\", this.activateLink, this);\n }\n\n public stopEvents() {\n this.navbar.removeEventListener(\"click\", this.toggleClick);\n this.emitter.off(\"READY\", this.activateLink, this);\n this.emitter.off(\"GO\", this.activateLink, this);\n }\n\n public uninstall() {\n while (this.elements.length) this.elements.pop();\n this.elements = undefined;\n this.menu = undefined;\n this.navbar = undefined;\n }\n}", "import { PJAX, App, TransitionManager, Router, HistoryManager, PageManager, animate, Animate } from \"@okikio/native\";\nimport { IntroAnimation } from \"./services/IntroAnimation\";\n\nimport { Fade } from \"./transitions/Fade\";\nimport { BigTransition } from \"./transitions/BigTransition\";\nimport { Slide, SlideLeft, SlideRight } from \"./transitions/Slide\";\n\nimport { toArr } from \"./toArr\";\nimport { Navbar } from \"./services/Navbar\";\n\nlet router: Router, pjax: PJAX;\nconst app: App = new App();\napp\n .add(new IntroAnimation())\n .set(\"HistoryManager\", new HistoryManager())\n .set(\"PageManager\", new PageManager())\n .set(\"TransitionManager\", new TransitionManager([\n [\"default\", Fade],\n [\"BigTransition\", BigTransition],\n [\"Slide\", Slide],\n [\"SlideLeft\", SlideLeft],\n [\"SlideRight\", SlideRight]\n ]))\n .add(new Navbar())\n .set(\"router\", router = new Router())\n .add(pjax = new PJAX());\n\ntry {\n router = app.get(\"router\") as Router;\n\n // This isn't nessceary, but it changes the nav link in focus depending on the page\n let navLink: HTMLElement[] = toArr(document.querySelectorAll(\".navbar .nav-link\"));\n for (let item of navLink) {\n let navItem = (item as HTMLAnchorElement);\n router.add({\n path: navItem.getAttribute(\"data-path\") || navItem.pathname,\n method() {\n let isActive = navItem.classList.contains(\"active\");\n if (!isActive) navItem.classList.add(\"active\");\n for (let nav of navLink) {\n if (nav !== navItem)\n nav.classList.remove(\"active\");\n }\n }\n });\n }\n\n router.add({\n path: /(index|\\/$)(\\.html)?/,\n method() { }\n });\n\n // app.on(\"AFTER_SPLASHSCREEN_HIDE\", () => {\n // anim?.play();\n // });\n\n app.boot();\n} catch (err) {\n console.warn(\"[App] boot failed,\", err);\n}\n"], + "mappings": "sgBAeO,GAAM,IAAkB,CAC3B,YAAa,UACb,eAAgB,eAChB,eAAgB,cAChB,QAAS,CACL,CAAC,YAAa,SAElB,gBAAiB,iBACjB,eAAgB,gBAChB,eAAgB,aAChB,UAAW,QACX,QAAS,IACT,SAAU,GAID,GAAY,AAAC,GACf,OAAO,OAAO,KAAK,IAAmB,GAIpC,GAAS,CAAC,EAAiB,EAAe,EAAoB,KAAiB,CACxF,GAAI,CAAE,UAAW,EACb,EAAO,OAAO,EAAS,IAAM,EAAS,MAAM,IAChD,MAAO,GAAW,IAAI,KAAU,GAIvB,EAAY,CAAC,EAAiB,EAAoB,EAAoB,KAAc,CAC7F,GAAI,MAAO,IAAU,SACjB,MAAO,GAEX,GAAI,GAAO,EAAO,GAClB,MAAI,OAAO,IAAS,SACT,GAAO,EAAQ,EAAM,GACzB,GCjDJ,WAAoB,CAG1B,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,SAAS,iBAAiB,sBAC7D,OAAS,KAAQ,GAAS,CACtB,GAAI,GAAW,EACf,EAAO,IAAI,CACP,KAAM,EAAQ,aAAa,cAAgB,EAAQ,SACnD,QAAS,CAEL,AAAK,AADU,EAAQ,UAAU,SAAS,WAC3B,EAAQ,UAAU,IAAI,UACrC,OAAS,KAAO,GACZ,AAAI,IAAQ,GACR,EAAI,UAAU,OAAO,aAMzC,EAAO,IAAI,CACP,KAAM,uBACN,QAAS,KAOb,EAAI,aACC,EAAP,CACE,QAAQ,KAAK,qBAAsB", "names": [] } diff --git a/demo/js/toArr.js b/demo/js/toArr.js new file mode 100644 index 0000000..a7dda30 --- /dev/null +++ b/demo/js/toArr.js @@ -0,0 +1,2 @@ +var o=r=>Array.from(r),a=o;export{a as default,o as toArr}; +//# sourceMappingURL=toArr.js.map diff --git a/demo/js/toArr.js.map b/demo/js/toArr.js.map new file mode 100644 index 0000000..888f3b1 --- /dev/null +++ b/demo/js/toArr.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["build/ts/toArr.ts"], + "sourcesContent": ["export const toArr = (input: any): any[] => Array.from(input);\nexport default toArr;"], + "mappings": "AAAO,GAAM,GAAQ,AAAC,GAAsB,MAAM,KAAK,GAChD,EAAQ", + "names": [] +} diff --git a/packages/animate/lib/api.cjs.js b/packages/animate/lib/api.cjs.js index 759b364..786bfdd 100644 --- a/packages/animate/lib/api.cjs.js +++ b/packages/animate/lib/api.cjs.js @@ -1,2 +1,2 @@ -var z=Object.defineProperty;var J=i=>z(i,"__esModule",{value:!0});var B=(i,t)=>{for(var e in t)z(i,e,{get:t[e],enumerable:!0})};J(exports);B(exports,{Animate:()=>y,DefaultAnimationOptions:()=>k,animate:()=>I,computeValue:()=>L,default:()=>Q,easings:()=>C,getEase:()=>j,getElements:()=>w,getTargets:()=>E,mapObject:()=>x});var m=class{constructor(t){this.map=new Map(t)}getMap(){return this.map}get(t){return this.map.get(t)}keys(){return Array.from(this.map.keys())}values(){return Array.from(this.map.values())}set(t,e){return this.map.set(t,e),this}add(t){let n=this.size;return this.set(n,t),this}get size(){return this.map.size}get length(){return this.map.size}last(t=1){let e=this.keys()[this.size-t];return this.get(e)}delete(t){return this.map.delete(t)}remove(t){return this.map.delete(t),this}clear(){return this.map.clear(),this}has(t){return this.map.has(t)}entries(){return this.map.entries()}forEach(t,e){return this.map.forEach(t,e),this}[Symbol.iterator](){return this.entries()}},v=(i,t,...e)=>{i.forEach(n=>{n[t](...e)})};var K=({callback:i=()=>{},scope:t=null,name:e="event"})=>({callback:i,scope:t,name:e}),g=class extends m{constructor(t="event"){super();this.name=t}},A=class extends m{constructor(){super()}getEvent(t){let e=this.get(t);return e instanceof g?e:(this.set(t,new g(t)),this.get(t))}newListener(t,e,n){let r=this.getEvent(t);return r.add(K({name:t,callback:e,scope:n})),r}on(t,e,n){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let r,s,a=typeof t=="object"&&!Array.isArray(t),o=a?e:n;return a||(s=e),Object.keys(t).forEach(l=>{a?(r=l,s=t[l]):r=t[l],this.newListener(r,s,o)},this),this}removeListener(t,e,n){let r=this.get(t);if(r instanceof g&&e){let s=K({name:t,callback:e,scope:n});r.forEach((a,o)=>{if(a.callback===s.callback&&a.scope===s.scope)return r.remove(o)})}return r}off(t,e,n){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let r,s,a=typeof t=="object"&&!Array.isArray(t),o=a?e:n;return a||(s=e),Object.keys(t).forEach(l=>{a?(r=l,s=t[l]):r=t[l],typeof s=="function"?this.removeListener(r,s,o):this.remove(r)},this),this}emit(t,...e){return typeof t=="undefined"?this:(typeof t=="string"&&(t=t.trim().split(/\s/g)),t.forEach(n=>{let r=this.get(n);r instanceof g&&r.forEach(s=>{let{callback:a,scope:o}=s;a.apply(o,e)})},this),this)}clear(){return v(this,"clear"),super.clear(),this}};var w=i=>typeof i=="string"?Array.from(document.querySelectorAll(i)):[i],G=i=>[].concat(...i),E=i=>Array.isArray(i)?G(i.map(E)):typeof i=="string"||i instanceof Node?w(i):i instanceof NodeList||i instanceof HTMLCollection?Array.from(i):[],L=(i,t,e)=>typeof i=="function"?i.apply(e,t):i,x=(i,t,e)=>{let n,r,s={},a=Object.keys(i);for(let o=0,l=a.length;o/^(in|out)/.test(i)?C[i]:i,k={keyframes:[],loop:1,delay:0,speed:1,endDelay:0,easing:"ease",autoplay:!0,duration:1e3,fillMode:"auto",direction:"normal",extend:{}},y=class{constructor(t={}){this.options={};this.targets=[];this.properties={};this.animations=new m;this.totalDuration=0;this.minDelay=0;this.computedOptions=new m;this.emitter=new A;try{let{options:e,...n}=t,r=e instanceof y?e.getOptions():Array.isArray(e)?e?.[0]?.getOptions():e;this.options=Object.assign({},k,r,n),this.loop=this.loop.bind(this);let{loop:s,delay:a,speed:o,easing:l,endDelay:V,duration:D,direction:P,fillMode:S,onfinish:T,target:q,keyframes:H,autoplay:N,extend:_,...F}=this.options;this.mainElement=document.createElement("div"),this.targets=E(q),this.properties=F;let O=[],b=this.targets.length,f;for(let c=0;c0||(f=x(f,[c,b,p],this));let M=u.delay+u.duration*u.iterations+u.endDelay;this.totalDuration{typeof T=="function"&&T.call(this,p,c,b,h),this.emit("finish",p,c,b,h)},this.computedOptions.set(h,u),this.animations.set(p,h),O.push(u.delay)}this.mainAnimation=this.mainElement.animate([{opacity:"0"},{opacity:"1"}],{duration:this.totalDuration,easing:"linear"}),this.minDelay=Math.min(...O),this.setSpeed(o),N?this.play():this.pause(),this.promise=this.newPromise(),this.mainAnimation.onfinish=()=>{this.emit("complete",this),this.stopLoop()}}catch(e){this.emit("error",e)}}newPromise(){return new Promise((t,e)=>{this.on("complete",()=>t([this])),this.on("error",n=>e(n))})}then(t,e){return t=t?.bind(this),e=e?.bind(this),this.promise.then(t,e),this}catch(t){return t=t?.bind(this),this.promise.catch(t),this}finally(t){return t=t?.bind(this),this.promise.finally(t),this}loop(){this.stopLoop(),this.emit("update",this.getProgress(),this),this.animationFrame=window.requestAnimationFrame(this.loop)}stopLoop(){window.cancelAnimationFrame(this.animationFrame)}all(t){return t(this.mainAnimation),this.animations.forEach(e=>t(e)),this}beginEvent(){if(this.getProgress()==0){let t=window.setTimeout(()=>{this.emit("begin",this),t=window.clearTimeout(t)},this.minDelay)}}play(){let t=this.getPlayState();return this.beginEvent(),this.all(e=>e.play()),this.emit("play",t,this),this.loop(),this}pause(){let t=this.getPlayState();return this.all(e=>e.pause()),this.emit("pause",t,this),this.stopLoop(),this.animationFrame=void 0,this}reset(){return this.setProgress(0),this.beginEvent(),this.options.autoplay?this.play():this.pause(),this}cancel(){return this.all(t=>t.cancel()),this.stopLoop(),this}finish(){return this.all(t=>t.finish()),this.stopLoop(),this}stop(){for(this.cancel(),this.animations.clear();this.targets.length;)this.targets.pop();this.mainElement=void 0,this.emit("stop")}getTargets(){return this.targets}getAnimation(t){return this.animations.get(t)}getTiming(t){let e=t instanceof Animation?t:this.getAnimation(t),n=this.computedOptions.get(e)??{},r=e.effect?.getTiming()??{},s=this.getOptions();return{...k,...s,...r,...n}}getTotalDuration(){return this.totalDuration}getCurrentTime(){return this.mainAnimation.currentTime}getProgress(){return this.getCurrentTime()/this.totalDuration*100}getSpeed(){return this.mainAnimation.playbackRate}getPlayState(){return this.mainAnimation.playState}getOptions(){return this.options}setCurrentTime(t){return this.all(e=>{e.currentTime=t}),this.emit("update",this.getProgress()),this}setProgress(t){let e=t/100*this.totalDuration;return this.setCurrentTime(e),this}setSpeed(t=1){return this.all(e=>{e.playbackRate=t}),this}on(t,e,n){return this.emitter.on(t,e,n??this),this}off(t,e,n){return this.emitter.off(t,e,n??this),this}emit(t,...e){return this.emitter.emit(t,...e),this}toJSON(){return this.getOptions()}get[Symbol.toStringTag](){return"Animate"}},I=(i={})=>new y(i),Q=I;0&&(module.exports={Animate,DefaultAnimationOptions,animate,computeValue,easings,getEase,getElements,getTargets,mapObject}); +var H=Object.defineProperty;var B=i=>H(i,"__esModule",{value:!0});var G=(i,t)=>{for(var e in t)H(i,e,{get:t[e],enumerable:!0})};B(exports);G(exports,{Animate:()=>f,DefaultAnimationOptions:()=>k,Timeline:()=>J,animate:()=>F,computeValue:()=>T,default:()=>U,easings:()=>_,getEase:()=>V,getElements:()=>N,getTargets:()=>O,mapObject:()=>x});var y=class{constructor(t){this.map=new Map(t)}getMap(){return this.map}get(t){return this.map.get(t)}keys(){return Array.from(this.map.keys())}values(){return Array.from(this.map.values())}set(t,e){return this.map.set(t,e),this}add(t){let n=this.size;return this.set(n,t),this}get size(){return this.map.size}get length(){return this.map.size}last(t=1){let e=this.keys()[this.size-t];return this.get(e)}delete(t){return this.map.delete(t)}remove(t){return this.map.delete(t),this}clear(){return this.map.clear(),this}has(t){return this.map.has(t)}entries(){return this.map.entries()}forEach(t,e){return this.map.forEach(t,e),this}[Symbol.iterator](){return this.entries()}},S=(i,t,...e)=>{i.forEach(n=>{n[t](...e)})};var q=({callback:i=()=>{},scope:t=null,name:e="event"})=>({callback:i,scope:t,name:e}),L=class extends y{constructor(t="event"){super();this.name=t}},P=class extends y{constructor(){super()}getEvent(t){let e=this.get(t);return e instanceof L?e:(this.set(t,new L(t)),this.get(t))}newListener(t,e,n){let r=this.getEvent(t);return r.add(q({name:t,callback:e,scope:n})),r}on(t,e,n){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let r,s,a=typeof t=="object"&&!Array.isArray(t),p=a?e:n;return a||(s=e),Object.keys(t).forEach(l=>{a?(r=l,s=t[l]):r=t[l],this.newListener(r,s,p)},this),this}removeListener(t,e,n){let r=this.get(t);if(r instanceof L&&e){let s=q({name:t,callback:e,scope:n});r.forEach((a,p)=>{if(a.callback===s.callback&&a.scope===s.scope)return r.remove(p)})}return r}off(t,e,n){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let r,s,a=typeof t=="object"&&!Array.isArray(t),p=a?e:n;return a||(s=e),Object.keys(t).forEach(l=>{a?(r=l,s=t[l]):r=t[l],typeof s=="function"?this.removeListener(r,s,p):this.remove(r)},this),this}emit(t,...e){return typeof t=="undefined"?this:(typeof t=="string"&&(t=t.trim().split(/\s/g)),t.forEach(n=>{let r=this.get(n);r instanceof L&&r.forEach(s=>{let{callback:a,scope:p}=s;a.apply(p,e)})},this),this)}clear(){return S(this,"clear"),super.clear(),this}};var N=i=>typeof i=="string"?Array.from(document.querySelectorAll(i)):[i],Q=i=>[].concat(...i),O=i=>Array.isArray(i)?Q(i.map(O)):typeof i=="string"||i instanceof Node?N(i):i instanceof NodeList||i instanceof HTMLCollection?Array.from(i):[],T=(i,t,e)=>typeof i=="function"?i.apply(e,t):i,x=(i,t,e)=>{let n,r,s={},a=Object.keys(i);for(let p=0,l=a.length;p/^(in|out)/.test(i)?_[i]:i,k={keyframes:[],loop:1,delay:0,speed:1,endDelay:0,easing:"ease",autoplay:!0,duration:1e3,fillMode:"auto",direction:"normal",extend:{}},f=class{constructor(t={}){this.options={};this.targets=[];this.properties={};this.animations=new y;this.totalDuration=0;this.minDelay=0;this.computedOptions=new y;this.emitter=new P;try{let{options:e,...n}=t,r=e instanceof f?e.getOptions():Array.isArray(e)?e?.[0]?.getOptions():e;this.options=Object.assign({},k,r,n),this.loop=this.loop.bind(this);let{loop:s,delay:a,speed:p,easing:l,endDelay:M,duration:K,direction:v,fillMode:z,onfinish:d,target:w,keyframes:D,autoplay:j,extend:C,...I}=this.options;this.mainElement=document.createElement("div"),this.targets=O(w),this.properties=I;let A=[],m=this.targets.length,b;for(let u=0;u0||(b=x(b,[u,m,c],this));let E=o.delay+o.duration*o.iterations+o.endDelay;this.totalDuration{typeof d=="function"&&d.call(this,c,u,m,h),this.emit("finish",c,u,m,h)},this.computedOptions.set(h,o),this.animations.set(c,h),A.push(o.delay)}this.mainAnimation=this.mainElement.animate([{opacity:"0"},{opacity:"1"}],{duration:this.totalDuration,easing:"linear"}),this.minDelay=Math.min(...A),this.setSpeed(p),j?this.play():this.pause(),this.promise=this.newPromise(),this.mainAnimation.onfinish=()=>{this.emit("complete",this),this.stopLoop()}}catch(e){this.emit("error",e)}}newPromise(){return new Promise((t,e)=>{this.on("complete",()=>t([this])),this.on("error",n=>e(n))})}then(t,e){return t=t?.bind(this),e=e?.bind(this),this.promise.then(t,e),this}catch(t){return t=t?.bind(this),this.promise.catch(t),this}finally(t){return t=t?.bind(this),this.promise.finally(t),this}loop(){this.stopLoop(),this.emit("update",this.getProgress(),this),this.animationFrame=window.requestAnimationFrame(this.loop)}stopLoop(){window.cancelAnimationFrame(this.animationFrame)}all(t){return t(this.mainAnimation,this.mainElement),this.animations.forEach(t),this}beginEvent(){if(this.getProgress()==0){let t=window.setTimeout(()=>{this.emit("begin",this),t=window.clearTimeout(t)},this.minDelay)}}play(){let t=this.getPlayState();return this.beginEvent(),this.all(e=>e.play()),this.emit("play",t,this),this.loop(),this}pause(){let t=this.getPlayState();return this.all(e=>e.pause()),this.emit("pause",t,this),this.stopLoop(),this.animationFrame=void 0,this}reset(){return this.setProgress(0),this.beginEvent(),this.options.autoplay?this.play():this.pause(),this}cancel(){return this.all(t=>t.cancel()),this.stopLoop(),this}finish(){return this.all(t=>t.finish()),this.stopLoop(),this}stop(){for(this.cancel(),this.animations.clear();this.targets.length;)this.targets.pop();this.mainElement=void 0,this.emit("stop")}getTargets(){return this.targets}getAnimation(t){return this.animations.get(t)}getTiming(t){let e=t instanceof Animation?t:this.getAnimation(t),n=this.computedOptions.get(e)??{},r=e.effect?.getTiming()??{},s=this.getOptions();return{...k,...s,...r,...n}}getTotalDuration(){return this.totalDuration}getCurrentTime(){return this.mainAnimation.currentTime}getProgress(){return this.getCurrentTime()/this.totalDuration*100}getSpeed(){return this.mainAnimation.playbackRate}getPlayState(){return this.mainAnimation.playState}getOptions(){return this.options}setCurrentTime(t){return this.all(e=>{e.currentTime=t}),this.emit("update",this.getProgress()),this}setProgress(t){let e=t/100*this.totalDuration;return this.setCurrentTime(e),this}setSpeed(t=1){return this.all(e=>{e.playbackRate=t}),this}on(t,e,n){return this.emitter.on(t,e,n??this),this}off(t,e,n){return this.emitter.off(t,e,n??this),this}emit(t,...e){return this.emitter.emit(t,...e),this}toJSON(){return this.getOptions()}get[Symbol.toStringTag](){return"Animate"}},F=(i={})=>new f(i),J=class extends f{constructor(t={}){super();this.animations=new y;try{let{options:e,...n}=t,r=e instanceof f?e.getOptions():Array.isArray(e)?e?.[0]?.getOptions():e;this.options=Object.assign({},k,r,n),this.loop=this.loop.bind(this);let{loop:s,delay:a,speed:p,easing:l,endDelay:M,duration:K,direction:v,fillMode:z,onfinish:d,target:w,keyframes:D,autoplay:j,extend:C,...I}=this.options;this.mainElement=document.createElement("div"),this.targets=O(w),this.properties=I;let A=[],m=this.targets.length,b;for(let u=0;u0||(b=x(b,[u,m,c],this));let E=o.delay+o.duration*o.iterations+o.endDelay;this.totalDuration{typeof d=="function"&&d.call(this,c,u,m,h),this.emit("finish",c,u,m,h)},this.computedOptions.set(h,o),this.animations.set(c,h),A.push(o.delay)}this.mainAnimation=this.mainElement.animate([{opacity:"0"},{opacity:"1"}],{duration:this.totalDuration,easing:"linear"}),this.minDelay=Math.min(...A),this.setSpeed(p),j?this.play():this.pause(),this.promise=this.newPromise(),this.mainAnimation.onfinish=()=>{this.emit("complete",this),this.stopLoop()}}catch(e){this.emit("error",e)}}add(t){return this}},U=F;0&&(module.exports={Animate,DefaultAnimationOptions,Timeline,animate,computeValue,easings,getEase,getElements,getTargets,mapObject}); //# sourceMappingURL=api.cjs.js.map diff --git a/packages/animate/lib/api.cjs.js.map b/packages/animate/lib/api.cjs.js.map index 5c58f88..295df52 100644 --- a/packages/animate/lib/api.cjs.js.map +++ b/packages/animate/lib/api.cjs.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../src/api.ts", "../../manager/src/api.ts", "../../emitter/src/api.ts"], - "sourcesContent": ["import { EventEmitter, EventInput, ListenerCallback } from \"@okikio/emitter\";\nimport { Manager } from \"@okikio/manager\";\n\n// DOM\nexport type AnimationTarget = string | Node | NodeList | HTMLCollection | HTMLElement[] | AnimationTarget[];\nexport const getElements = (selector: string | Node): Node[] => {\n return typeof selector === \"string\" ? Array.from(document.querySelectorAll(selector as string)) : [selector];\n};\n\nconst flatten = (arr: AnimationTarget[]) => [].concat(...arr);\nexport const getTargets = (targets: AnimationTarget): Node[] => {\n if (Array.isArray(targets)) {\n return flatten((targets as AnimationTarget[]).map(getTargets));\n }\n if (typeof targets == \"string\" || targets instanceof Node)\n return getElements(targets);\n if (targets instanceof NodeList || targets instanceof HTMLCollection)\n return Array.from(targets);\n return [];\n};\n\n// VALUES\nexport type closureArgs = [number, number, HTMLElement];\nexport type closure = ((index?: number, total?: number, element?: HTMLElement) => (genericTypes[] | void)) | any;\nexport const computeValue = (value: closure, args: closureArgs, context: Animate) => {\n if (typeof value === \"function\") {\n return value.apply(context, args);\n } else { return value; }\n};\n\nexport const mapObject = (obj: object, args: closureArgs, options: Animate): any => {\n let key: string, value: any, result = {};\n let keys = Object.keys(obj);\n for (let i = 0, len = keys.length; i < len; i++) {\n key = keys[i];\n value = obj[key];\n result[key] = computeValue(value, args, options);\n }\n\n return result;\n};\n\n/** From: [https://easings.net] */\nexport const easings = {\n \"in\": \"ease-in\",\n \"out\": \"ease-out\",\n \"in-out\": \"ease-in-out\",\n\n // Sine\n \"in-sine\": \"cubic-bezier(0.47, 0, 0.745, 0.715)\",\n \"out-sine\": \"cubic-bezier(0.39, 0.575, 0.565, 1)\",\n \"in-out-sine\": \"cubic-bezier(0.445, 0.05, 0.55, 0.95)\",\n\n // Quad\n \"in-quad\": \"cubic-bezier(0.55, 0.085, 0.68, 0.53)\",\n \"out-quad\": \"cubic-bezier(0.25, 0.46, 0.45, 0.94)\",\n \"in-out-quad\": \"cubic-bezier(0.455, 0.03, 0.515, 0.955)\",\n\n // Cubic\n \"in-cubic\": \"cubic-bezier(0.55, 0.055, 0.675, 0.19)\",\n \"out-cubic\": \"cubic-bezier(0.215, 0.61, 0.355, 1)\",\n \"in-out-cubic\": \"cubic-bezier(0.645, 0.045, 0.355, 1)\",\n\n // Quart\n \"in-quart\": \"cubic-bezier(0.895, 0.03, 0.685, 0.22)\",\n \"out-quart\": \"cubic-bezier(0.165, 0.84, 0.44, 1)\",\n \"in-out-quart\": \"cubic-bezier(0.77, 0, 0.175, 1)\",\n\n // Quint\n \"in-quint\": \"cubic-bezier(0.755, 0.05, 0.855, 0.06)\",\n \"out-quint\": \"cubic-bezier(0.23, 1, 0.32, 1)\",\n \"in-out-quint\": \"cubic-bezier(0.86, 0, 0.07, 1)\",\n\n // Expo\n \"in-expo\": \"cubic-bezier(0.95, 0.05, 0.795, 0.035)\",\n \"out-expo\": \"cubic-bezier(0.19, 1, 0.22, 1)\",\n \"in-out-expo\": \"cubic-bezier(1, 0, 0, 1)\",\n\n // Circ\n \"in-circ\": \"cubic-bezier(0.6, 0.04, 0.98, 0.335)\",\n \"out-circ\": \"cubic-bezier(0.075, 0.82, 0.165, 1)\",\n \"in-out-circ\": \"cubic-bezier(0.785, 0.135, 0.15, 0.86)\",\n\n // Back\n \"in-back\": \"cubic-bezier(0.6, -0.28, 0.735, 0.045)\",\n \"out-back\": \"cubic-bezier(0.175, 0.885, 0.32, 1.275)\",\n \"in-out-back\": \"cubic-bezier(0.68, -0.55, 0.265, 1.55)\"\n};\n\nexport const getEase = (ease: string) => {\n return /^(in|out)/.test(ease) ? easings[ease] : ease;\n};\n\nexport type genericTypes = genericTypes[] | boolean | object | string | number | closure | null | undefined;\nexport interface AnimationOptions {\n target?: AnimationTarget,\n\n speed?: number,\n autoplay?: boolean,\n options?: AnimationOptions,\n delay?: number | closure,\n easing?: string | closure,\n endDelay?: number | closure,\n duration?: number | closure,\n keyframes?: Keyframe[] | object[] | closure,\n loop?: number | boolean | closure, // iterations: number,\n onfinish?: (element?: HTMLElement, index?: number, total?: number, animation?: Animation) => any,\n fillMode?: \"none\" | \"forwards\" | \"backwards\" | \"both\" | \"auto\" | closure,\n direction?: \"normal\" | \"reverse\" | \"alternate\" | \"alternate-reverse\" | closure,\n extend?: EffectTiming,\n [property: string]: genericTypes;\n};\n\nexport const DefaultAnimationOptions: AnimationOptions = {\n keyframes: [],\n\n loop: 1, // iterations: number,\n delay: 0,\n speed: 1,\n endDelay: 0,\n easing: \"ease\",\n autoplay: true,\n duration: 1000,\n fillMode: \"auto\",\n direction: \"normal\",\n extend: {}\n};\n\nexport type AnimationEvents = \"update\" | \"play\" | \"pause\" | \"start\" | \"begin\" | \"complete\" | \"finish\" | \"error\" | \"stop\";\n\n/** You can check it out here: https://codepen.io/okikio/pen/qBbdGaW?editors=0011 */\nexport class Animate {\n /**\n * Stores the options for the current animation\n */\n public options: AnimationOptions = {};\n\n /**\n * The Array of Elements to Animate\n */\n public targets: Node[] = [];\n\n /**\n * The properties to animate\n */\n public properties: object = {};\n\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n\n /**\n * The total duration of all Animation's\n */\n public totalDuration: number = 0;\n\n /**\n * The smallest delay out of all Animation's\n */\n public minDelay: number = 0;\n\n /**\n * The options for individual animations\n */\n public computedOptions: Manager = new Manager();\n\n /**\n * The Element the main animation uses\n */\n public mainElement: HTMLElement;\n\n /**\n * Stores an animation that runs on the total duration of the all other Animations, and as such it's the main Animation\n */\n public mainAnimation: Animation;\n\n /**\n * Stores request frame calls\n */\n public animationFrame: number;\n\n /**\n * An event emitter\n */\n public emitter: EventEmitter = new EventEmitter();\n\n /**\n * Returns a promise that is fulfilled when the mainAnimation is finished\n */\n public promise: Promise;\n constructor(options: AnimationOptions = {}) {\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n\n /**\n * Returns a new Promise that is resolve when this.finish is called\n */\n public newPromise(): Promise {\n return new Promise((resolve, reject) => {\n /*\n Note that the `this` keyword is in an Array when it is resolved,\n this is due to Promises not wanting to resolve references,\n so, you can't resolve `this` directly, so, I chose to resolve `this` in an\n Array\n */\n this.on(\"complete\", () => resolve([this]));\n this.on(\"error\", err => reject(err));\n });\n }\n\n /**\n * Fulfills the this.promise Promise\n */\n public then(\n onFulfilled?: (value?: any) => any,\n onRejected?: (reason?: any) => any\n ): Animate {\n onFulfilled = onFulfilled?.bind(this);\n onRejected = onRejected?.bind(this);\n this.promise.then(onFulfilled, onRejected);\n return this;\n }\n\n /**\n * Catches error that occur in the this.promise Promise\n */\n public catch(onRejected: (reason?: any) => any): Animate {\n onRejected = onRejected?.bind(this);\n this.promise.catch(onRejected);\n return this;\n }\n\n /**\n * If you don't care if the this.promise Promise has either been rejected or resolved\n */\n public finally(onFinally: () => any): Animate {\n onFinally = onFinally?.bind(this);\n this.promise.finally(onFinally);\n return this;\n }\n\n /**\n * Represents an Animation Frame Loop\n */\n public loop(): void {\n this.stopLoop();\n this.emit(\"update\", this.getProgress(), this);\n this.animationFrame = window.requestAnimationFrame(this.loop);\n }\n\n /**\n * Cancels animation frame\n */\n public stopLoop() {\n window.cancelAnimationFrame(this.animationFrame);\n }\n\n /**\n * Calls a method that affects all animations including the mainAnimation; the method only allows the animation parameter\n */\n public all(method: (animation: Animation) => void) {\n method(this.mainAnimation);\n this.animations.forEach(animation => method(animation));\n return this;\n }\n\n /**\n * Register the begin event\n */\n protected beginEvent() {\n if (this.getProgress() == 0) {\n let timer: number | void = window.setTimeout(() => {\n this.emit(\"begin\", this);\n timer = window.clearTimeout(timer as number);\n }, this.minDelay);\n }\n }\n\n /**\n * Play Animation\n */\n public play(): Animate {\n let playstate = this.getPlayState();\n this.beginEvent();\n this.all(anim => anim.play());\n this.emit(\"play\", playstate, this);\n this.loop();\n return this;\n }\n\n /**\n * Pause Animation\n */\n public pause(): Animate {\n let playstate = this.getPlayState();\n this.all(anim => anim.pause());\n this.emit(\"pause\", playstate, this);\n this.stopLoop();\n this.animationFrame = undefined;\n return this;\n }\n\n /**\n * Reset all Animations\n */\n public reset() {\n this.setProgress(0);\n this.beginEvent();\n\n if (this.options.autoplay) this.play();\n else this.pause();\n return this;\n }\n\n /**\n * Cancels all Animations\n */\n public cancel() {\n this.all(anim => anim.cancel());\n this.stopLoop();\n return this;\n }\n\n /**\n * Force complete all Animations\n */\n public finish() {\n this.all(anim => anim.finish());\n this.stopLoop();\n return this;\n }\n\n /**\n * Cancels & Clears all Animations\n */\n public stop() {\n this.cancel();\n this.animations.clear();\n while (this.targets.length) this.targets.pop();\n this.mainElement = undefined;\n this.emit(\"stop\");\n }\n\n /**\n * Returns an Array of targets\n */\n public getTargets(): Node[] {\n return this.targets;\n }\n\n /**\n * Get a specific Animation from an Animate instance\n */\n public getAnimation(element: HTMLElement): Animation {\n return this.animations.get(element);\n }\n\n /**\n * Returns the timings of an Animation, given a target\n * E.g. { duration, endDelay, delay, iterations, iterationStart, direction, easing, fill, etc... }\n */\n public getTiming(target: HTMLElement | Animation): AnimationOptions & EffectTiming {\n let animation = target instanceof Animation ? target : this.getAnimation(target);\n let keyframeOptions = this.computedOptions.get(animation) ?? {};\n let timings = animation.effect?.getTiming() ?? {};\n let options = this.getOptions();\n\n return { ...DefaultAnimationOptions, ...options, ...timings, ...keyframeOptions };\n }\n\n /**\n * Returns the total duration of Animation\n */\n public getTotalDuration(): number {\n return this.totalDuration;\n }\n\n /**\n * Returns the current time of the Main Animation\n */\n public getCurrentTime(): number {\n return this.mainAnimation.currentTime;\n }\n\n /**\n * Returns the Animation progress as a fraction of the current time / duration * 100\n */\n public getProgress() {\n return (this.getCurrentTime() / this.totalDuration) * 100;\n }\n\n /**\n * Return the playback speed of the animation\n */\n public getSpeed(): number {\n return this.mainAnimation.playbackRate;\n }\n\n /**\n * Returns the current playing state\n */\n public getPlayState(): \"idle\" | \"running\" | \"paused\" | \"finished\" {\n return this.mainAnimation.playState;\n }\n\n /**\n * Get the options of an Animate instance\n */\n public getOptions(): AnimationOptions {\n return this.options;\n }\n\n /**\n * Set the current time of the Main Animation\n */\n public setCurrentTime(time: number): Animate {\n this.all(anim => { anim.currentTime = time; });\n this.emit(\"update\", this.getProgress());\n return this;\n }\n\n /**\n * Set the Animation progress as a value from 0 to 100\n */\n public setProgress(percent: number): Animate {\n let time = (percent / 100) * this.totalDuration;\n this.setCurrentTime(time);\n return this;\n }\n\n /**\n * Set the playback speed of an Animation\n */\n public setSpeed(speed: number = 1): Animate {\n this.all(anim => { anim.playbackRate = speed; });\n return this;\n }\n\n /**\n * Adds a listener for a given event\n */\n public on(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.on(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Removes a listener from an event\n */\n public off(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.off(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Call all listeners within an event\n */\n public emit(events: AnimationEvents | string | any[], ...args: any): Animate {\n this.emitter.emit(events, ...args);\n return this;\n }\n\n\n /** Returns the Animate options, as JSON */\n public toJSON(): AnimationOptions {\n return this.getOptions();\n }\n\n /**\n * The Symbol.toStringTag well-known symbol is a string valued property that is used\n * in the creation of the default string description of an object.\n * It is accessed internally by the Object.prototype.toString() method.\n */\n get [Symbol.toStringTag]() {\n return `Animate`;\n }\n}\n\n/** Creates a new Animate instance */\nexport const animate = (options: AnimationOptions = {}): Animate => {\n return new Animate(options);\n};\n\nexport default animate;", "/** Manages complex lists of named data, eg. A page can be stored in a list by of other pages with the url being how the page is stored in the list. Managers use Maps to store data */\nexport class Manager {\n\t/** The complex list of named data, to which the Manager controls */\n\tpublic map: Map;\n\tconstructor(value?: Array<[K, V]>) {\n\t\tthis.map = new Map(value);\n\t}\n\n\t/** Returns the Manager classes base Map */\n\tpublic getMap(): Map {\n\t\treturn this.map;\n\t}\n\n\t/** Get a value stored in the Manager */\n\tpublic get(key: K): V {\n\t\treturn this.map.get(key);\n\t}\n\n\t/** Returns the keys of all items stored in the Manager as an Array */\n\tpublic keys(): Array {\n\t\treturn Array.from(this.map.keys());\n\t}\n\n\t/** Returns the values of all items stored in the Manager as an Array */\n\tpublic values(): Array {\n\t\treturn Array.from(this.map.values());\n\t}\n\n\t/** Set a value to the Manager using a key */\n\tpublic set(key: K, value: V): Manager {\n\t\tthis.map.set(key, value);\n\t\treturn this;\n\t}\n\n\t/** Adds a value to Manager, and uses the current size of the Manager as it's key, it works best when all the key in the Manager are numbers */\n\tpublic add(value: V): Manager {\n\t\tlet size = this.size;\n\t\t// @ts-ignore\n\t\tlet num: K = size as K;\n\t\tthis.set(num, value);\n\t\treturn this;\n\t}\n\n\t/** Returns the total number of items stored in the Manager */\n\tpublic get size(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** An alias for size */\n\tpublic get length(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** Returns the last item in the Manager who's index is a certain distance from the last item in the Manager */\n\tpublic last(distance: number = 1): V | undefined {\n\t\tlet key = this.keys()[this.size - distance];\n\t\treturn this.get(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns true if an element in the Map object existed and has been removed, or false if the element does not exist */\n\tpublic delete(key: K): boolean {\n\t\treturn this.map.delete(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns the Manager class, allowing for chains */\n\tpublic remove(key: K): Manager {\n\t\tthis.map.delete(key);\n\t\treturn this;\n\t}\n\n\t/** Clear the Manager of all its contents */\n\tpublic clear(): Manager {\n\t\tthis.map.clear();\n\t\treturn this;\n\t}\n\n\t/** Checks if the Manager contains a certain key */\n\tpublic has(key: K): boolean {\n\t\treturn this.map.has(key);\n\t}\n\n\t/** Returns a new Iterator object that contains an array of [key, value] for each element in the Map object in insertion order. */\n\tpublic entries(): IterableIterator<[K, V]> {\n\t\treturn this.map.entries();\n\t}\n\n\t/** Iterates through the Managers contents, calling a callback function every iteration */\n\tpublic forEach(\n\t\tcallback: (value?: V, key?: K, map?: Map) => void,\n\t\tcontext?: object\n\t): Manager {\n\t\tthis.map.forEach(callback, context);\n\t\treturn this;\n\t}\n\n\t/** Allows for iteration via for..of, learn more: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators] */\n\tpublic [Symbol.iterator](): IterableIterator<[K, V]> {\n\t\treturn this.entries();\n\t}\n}\n\n/**\n * Calls the method of a certain name for all items that are currently installed\n */\nexport const methodCall = (manager: Manager, method: string, ...args: any): void => {\n\tmanager.forEach((item) => {\n\t\t// @ts-ignore\n\t\titem[method](...args);\n\t});\n};\n\n/**\n * Asynchronously calls the method of a certain name for all items that are currently installed, similar to methodCall\n */\nexport const asyncMethodCall = async (manager: Manager, method: string, ...args: any): Promise => {\n\tfor (let [, item] of manager) {\n\t\t// @ts-ignore\n\t\tawait item[method](...args);\n\t}\n};\n\nexport default Manager;\n", "import { Manager, methodCall } from \"@okikio/manager\";\n\nexport type ListenerCallback = ((...args: any) => void);\nexport interface IListener {\n readonly callback: ListenerCallback;\n readonly scope: object;\n readonly name: string;\n}\n\n/** Represents a new event listener consisting of properties like: callback, scope, name */\nexport const newListener = ({\n callback = () => { },\n scope = null,\n name = \"event\",\n}: IListener): IListener => ({ callback, scope, name });\n\n/** Represents a new event */\nexport class Event extends Manager {\n /** The name of the event */\n public name: string;\n constructor(name: string = \"event\") {\n super();\n this.name = name;\n }\n}\n\nexport type EventInput = string | object | Array;\n\n/**\n * An Event Emitter\n * */\nexport class EventEmitter extends Manager {\n constructor() {\n super();\n }\n\n /** Gets event, if event doesn't exist create a new one */\n public getEvent(name: string): Event {\n let event = this.get(name);\n if (!(event instanceof Event)) {\n this.set(name, new Event(name));\n return this.get(name);\n }\n\n return event;\n }\n\n /** Creates a listener and adds it to an event */\n public newListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event = this.getEvent(name);\n event.add(newListener({ name, callback, scope }));\n return event;\n }\n\n /** Adds a listener to a given event */\n public on(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n this.newListener(_name, _callback, _scope);\n }, this);\n return this;\n }\n\n /** Removes a listener from an event */\n public removeListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event: Event = this.get(name);\n if (event instanceof Event && callback) {\n let listener = newListener({ name, callback, scope });\n\n event.forEach((value: IListener, i: number) => {\n if (\n value.callback === listener.callback &&\n value.scope === listener.scope\n ) {\n return event.remove(i);\n }\n });\n }\n\n return event;\n }\n\n /** Remove a listener from a given event, or just completely remove an event */\n public off(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n if (typeof _callback === \"function\") {\n this.removeListener(_name, _callback, _scope);\n } else this.remove(_name);\n }, this);\n return this;\n }\n\n /** Call all listeners within an event */\n public emit(\n events: string | Array,\n ...args: any\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n // Loop through the list of events\n events.forEach((event: string) => {\n let _event: Event = this.get(event);\n\n if (_event instanceof Event) {\n _event.forEach((listener: IListener) => {\n let { callback, scope } = listener;\n callback.apply(scope, args);\n });\n }\n }, this);\n return this;\n }\n\n /** Clears events and event listeners */\n public clear() {\n methodCall(this, \"clear\");\n super.clear();\n return this;\n }\n}\n\nexport default EventEmitter;\n"], - "mappings": "gIAAA,kMCCO,WAAoB,CAG1B,YAAY,EAAuB,CAClC,KAAK,IAAM,GAAI,KAAI,GAIb,QAAoB,CAC1B,MAAO,MAAK,IAIN,IAAI,EAAW,CACrB,MAAO,MAAK,IAAI,IAAI,GAId,MAAiB,CACvB,MAAO,OAAM,KAAK,KAAK,IAAI,QAIrB,QAAmB,CACzB,MAAO,OAAM,KAAK,KAAK,IAAI,UAIrB,IAAI,EAAQ,EAAyB,CAC3C,YAAK,IAAI,IAAI,EAAK,GACX,KAID,IAAI,EAAyB,CAGnC,GAAI,GAFO,KAAK,KAGhB,YAAK,IAAI,EAAK,GACP,QAIG,OAAe,CACzB,MAAO,MAAK,IAAI,QAIN,SAAiB,CAC3B,MAAO,MAAK,IAAI,KAIV,KAAK,EAAmB,EAAkB,CAChD,GAAI,GAAM,KAAK,OAAO,KAAK,KAAO,GAClC,MAAO,MAAK,IAAI,GAIV,OAAO,EAAiB,CAC9B,MAAO,MAAK,IAAI,OAAO,GAIjB,OAAO,EAAuB,CACpC,YAAK,IAAI,OAAO,GACT,KAID,OAAuB,CAC7B,YAAK,IAAI,QACF,KAID,IAAI,EAAiB,CAC3B,MAAO,MAAK,IAAI,IAAI,GAId,SAAoC,CAC1C,MAAO,M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U,CAAC,EAA4B,KACzC,GAAI,GAAQ,GAGhB,EAAQ", + "sourcesContent": ["import { EventEmitter, EventInput, ListenerCallback } from \"@okikio/emitter\";\nimport { Manager } from \"@okikio/manager\";\n\n// DOM\nexport type AnimationTarget = string | Node | NodeList | HTMLCollection | HTMLElement[] | AnimationTarget[];\nexport const getElements = (selector: string | Node): Node[] => {\n return typeof selector === \"string\" ? Array.from(document.querySelectorAll(selector as string)) : [selector];\n};\n\nconst flatten = (arr: AnimationTarget[]) => [].concat(...arr);\nexport const getTargets = (targets: AnimationTarget): Node[] => {\n if (Array.isArray(targets)) {\n return flatten((targets as AnimationTarget[]).map(getTargets));\n }\n if (typeof targets == \"string\" || targets instanceof Node)\n return getElements(targets);\n if (targets instanceof NodeList || targets instanceof HTMLCollection)\n return Array.from(targets);\n return [];\n};\n\n// VALUES\nexport type closureArgs = [number, number, HTMLElement];\nexport type closure = ((index?: number, total?: number, element?: HTMLElement) => (genericTypes[] | void)) | any;\nexport const computeValue = (value: closure, args: closureArgs, context: Animate) => {\n if (typeof value === \"function\") {\n return value.apply(context, args);\n } else { return value; }\n};\n\nexport const mapObject = (obj: object, args: closureArgs, options: Animate): any => {\n let key: string, value: any, result = {};\n let keys = Object.keys(obj);\n for (let i = 0, len = keys.length; i < len; i++) {\n key = keys[i];\n value = obj[key];\n result[key] = computeValue(value, args, options);\n }\n\n return result;\n};\n\n/** From: [https://easings.net] */\nexport const easings = {\n \"in\": \"ease-in\",\n \"out\": \"ease-out\",\n \"in-out\": \"ease-in-out\",\n\n // Sine\n \"in-sine\": \"cubic-bezier(0.47, 0, 0.745, 0.715)\",\n \"out-sine\": \"cubic-bezier(0.39, 0.575, 0.565, 1)\",\n \"in-out-sine\": \"cubic-bezier(0.445, 0.05, 0.55, 0.95)\",\n\n // Quad\n \"in-quad\": \"cubic-bezier(0.55, 0.085, 0.68, 0.53)\",\n \"out-quad\": \"cubic-bezier(0.25, 0.46, 0.45, 0.94)\",\n \"in-out-quad\": \"cubic-bezier(0.455, 0.03, 0.515, 0.955)\",\n\n // Cubic\n \"in-cubic\": \"cubic-bezier(0.55, 0.055, 0.675, 0.19)\",\n \"out-cubic\": \"cubic-bezier(0.215, 0.61, 0.355, 1)\",\n \"in-out-cubic\": \"cubic-bezier(0.645, 0.045, 0.355, 1)\",\n\n // Quart\n \"in-quart\": \"cubic-bezier(0.895, 0.03, 0.685, 0.22)\",\n \"out-quart\": \"cubic-bezier(0.165, 0.84, 0.44, 1)\",\n \"in-out-quart\": \"cubic-bezier(0.77, 0, 0.175, 1)\",\n\n // Quint\n \"in-quint\": \"cubic-bezier(0.755, 0.05, 0.855, 0.06)\",\n \"out-quint\": \"cubic-bezier(0.23, 1, 0.32, 1)\",\n \"in-out-quint\": \"cubic-bezier(0.86, 0, 0.07, 1)\",\n\n // Expo\n \"in-expo\": \"cubic-bezier(0.95, 0.05, 0.795, 0.035)\",\n \"out-expo\": \"cubic-bezier(0.19, 1, 0.22, 1)\",\n \"in-out-expo\": \"cubic-bezier(1, 0, 0, 1)\",\n\n // Circ\n \"in-circ\": \"cubic-bezier(0.6, 0.04, 0.98, 0.335)\",\n \"out-circ\": \"cubic-bezier(0.075, 0.82, 0.165, 1)\",\n \"in-out-circ\": \"cubic-bezier(0.785, 0.135, 0.15, 0.86)\",\n\n // Back\n \"in-back\": \"cubic-bezier(0.6, -0.28, 0.735, 0.045)\",\n \"out-back\": \"cubic-bezier(0.175, 0.885, 0.32, 1.275)\",\n \"in-out-back\": \"cubic-bezier(0.68, -0.55, 0.265, 1.55)\"\n};\n\nexport const getEase = (ease: string) => {\n return /^(in|out)/.test(ease) ? easings[ease] : ease;\n};\n\nexport type genericTypes = genericTypes[] | boolean | object | string | number | closure | null | undefined;\nexport interface AnimationOptions {\n target?: AnimationTarget,\n\n speed?: number,\n autoplay?: boolean,\n options?: AnimationOptions,\n delay?: number | closure,\n easing?: string | closure,\n endDelay?: number | closure,\n duration?: number | closure,\n keyframes?: Keyframe[] | object[] | closure,\n loop?: number | boolean | closure, // iterations: number,\n onfinish?: (element?: HTMLElement, index?: number, total?: number, animation?: Animation) => any,\n fillMode?: \"none\" | \"forwards\" | \"backwards\" | \"both\" | \"auto\" | closure,\n direction?: \"normal\" | \"reverse\" | \"alternate\" | \"alternate-reverse\" | closure,\n extend?: EffectTiming,\n [property: string]: genericTypes;\n};\n\nexport const DefaultAnimationOptions: AnimationOptions = {\n keyframes: [],\n\n loop: 1, // iterations: number,\n delay: 0,\n speed: 1,\n endDelay: 0,\n easing: \"ease\",\n autoplay: true,\n duration: 1000,\n fillMode: \"auto\",\n direction: \"normal\",\n extend: {}\n};\n\nexport type AnimationEvents = \"update\" | \"play\" | \"pause\" | \"start\" | \"begin\" | \"complete\" | \"finish\" | \"error\" | \"stop\";\n\n/** You can check it out here: https://codepen.io/okikio/pen/qBbdGaW?editors=0011 */\nexport class Animate {\n /**\n * Stores the options for the current animation\n */\n public options: AnimationOptions = {};\n\n /**\n * The Array of Elements to Animate\n */\n public targets: Node[] = [];\n\n /**\n * The properties to animate\n */\n public properties: object = {};\n\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n\n /**\n * The total duration of all Animation's\n */\n public totalDuration: number = 0;\n\n /**\n * The smallest delay out of all Animation's\n */\n public minDelay: number = 0;\n\n /**\n * The options for individual animations\n */\n public computedOptions: Manager = new Manager();\n\n /**\n * The Element the main animation uses\n */\n public mainElement: HTMLElement;\n\n /**\n * Stores an animation that runs on the total duration of the all other Animations, and as such it's the main Animation\n */\n public mainAnimation: Animation;\n\n /**\n * Stores request frame calls\n */\n public animationFrame: number;\n\n /**\n * An event emitter\n */\n public emitter: EventEmitter = new EventEmitter();\n\n /**\n * Returns a promise that is fulfilled when the mainAnimation is finished\n */\n public promise: Promise;\n constructor(options: AnimationOptions = {}) {\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n\n /**\n * Returns a new Promise that is resolve when this.finish is called\n */\n public newPromise(): Promise {\n return new Promise((resolve, reject) => {\n /*\n Note that the `this` keyword is in an Array when it is resolved,\n this is due to Promises not wanting to resolve references,\n so, you can't resolve `this` directly, so, I chose to resolve `this` in an\n Array\n */\n this.on(\"complete\", () => resolve([this]));\n this.on(\"error\", err => reject(err));\n });\n }\n\n /**\n * Fulfills the this.promise Promise\n */\n public then(\n onFulfilled?: (value?: any) => any,\n onRejected?: (reason?: any) => any\n ): Animate {\n onFulfilled = onFulfilled?.bind(this);\n onRejected = onRejected?.bind(this);\n this.promise.then(onFulfilled, onRejected);\n return this;\n }\n\n /**\n * Catches error that occur in the this.promise Promise\n */\n public catch(onRejected: (reason?: any) => any): Animate {\n onRejected = onRejected?.bind(this);\n this.promise.catch(onRejected);\n return this;\n }\n\n /**\n * If you don't care if the this.promise Promise has either been rejected or resolved\n */\n public finally(onFinally: () => any): Animate {\n onFinally = onFinally?.bind(this);\n this.promise.finally(onFinally);\n return this;\n }\n\n /**\n * Represents an Animation Frame Loop\n */\n public loop(): void {\n this.stopLoop();\n this.emit(\"update\", this.getProgress(), this);\n this.animationFrame = window.requestAnimationFrame(this.loop);\n }\n\n /**\n * Cancels animation frame\n */\n public stopLoop() {\n window.cancelAnimationFrame(this.animationFrame);\n }\n\n /**\n * Calls a method that affects all animations including the mainAnimation; the method only allows the animation parameter\n */\n public all(method: (animation?: Animation, target?: HTMLElement) => void) {\n method(this.mainAnimation, this.mainElement);\n this.animations.forEach(method);\n return this;\n }\n\n /**\n * Register the begin event\n */\n protected beginEvent() {\n if (this.getProgress() == 0) {\n let timer: number | void = window.setTimeout(() => {\n this.emit(\"begin\", this);\n timer = window.clearTimeout(timer as number);\n }, this.minDelay);\n }\n }\n\n /**\n * Play Animation\n */\n public play(): Animate {\n let playstate = this.getPlayState();\n this.beginEvent();\n this.all(anim => anim.play());\n this.emit(\"play\", playstate, this);\n this.loop();\n return this;\n }\n\n /**\n * Pause Animation\n */\n public pause(): Animate {\n let playstate = this.getPlayState();\n this.all(anim => anim.pause());\n this.emit(\"pause\", playstate, this);\n this.stopLoop();\n this.animationFrame = undefined;\n return this;\n }\n\n /**\n * Reset all Animations\n */\n public reset() {\n this.setProgress(0);\n this.beginEvent();\n\n if (this.options.autoplay) this.play();\n else this.pause();\n return this;\n }\n\n /**\n * Cancels all Animations\n */\n public cancel() {\n this.all(anim => anim.cancel());\n this.stopLoop();\n return this;\n }\n\n /**\n * Force complete all Animations\n */\n public finish() {\n this.all(anim => anim.finish());\n this.stopLoop();\n return this;\n }\n\n /**\n * Cancels & Clears all Animations\n */\n public stop() {\n this.cancel();\n this.animations.clear();\n while (this.targets.length) this.targets.pop();\n this.mainElement = undefined;\n this.emit(\"stop\");\n }\n\n /**\n * Returns an Array of targets\n */\n public getTargets(): Node[] {\n return this.targets;\n }\n\n /**\n * Get a specific Animation from an Animate instance\n */\n public getAnimation(element: HTMLElement): Animation {\n return this.animations.get(element);\n }\n\n /**\n * Returns the timings of an Animation, given a target\n * E.g. { duration, endDelay, delay, iterations, iterationStart, direction, easing, fill, etc... }\n */\n public getTiming(target: HTMLElement | Animation): AnimationOptions & EffectTiming {\n let animation = target instanceof Animation ? target : this.getAnimation(target);\n let keyframeOptions = this.computedOptions.get(animation) ?? {};\n let timings = animation.effect?.getTiming() ?? {};\n let options = this.getOptions();\n\n return { ...DefaultAnimationOptions, ...options, ...timings, ...keyframeOptions };\n }\n\n /**\n * Returns the total duration of Animation\n */\n public getTotalDuration(): number {\n return this.totalDuration;\n }\n\n /**\n * Returns the current time of the Main Animation\n */\n public getCurrentTime(): number {\n return this.mainAnimation.currentTime;\n }\n\n /**\n * Returns the Animation progress as a fraction of the current time / duration * 100\n */\n public getProgress() {\n return (this.getCurrentTime() / this.totalDuration) * 100;\n }\n\n /**\n * Return the playback speed of the animation\n */\n public getSpeed(): number {\n return this.mainAnimation.playbackRate;\n }\n\n /**\n * Returns the current playing state\n */\n public getPlayState(): \"idle\" | \"running\" | \"paused\" | \"finished\" {\n return this.mainAnimation.playState;\n }\n\n /**\n * Get the options of an Animate instance\n */\n public getOptions(): AnimationOptions {\n return this.options;\n }\n\n /**\n * Set the current time of the Main Animation\n */\n public setCurrentTime(time: number): Animate {\n this.all(anim => { anim.currentTime = time; });\n this.emit(\"update\", this.getProgress());\n return this;\n }\n\n /**\n * Set the Animation progress as a value from 0 to 100\n */\n public setProgress(percent: number): Animate {\n let time = (percent / 100) * this.totalDuration;\n this.setCurrentTime(time);\n return this;\n }\n\n /**\n * Set the playback speed of an Animation\n */\n public setSpeed(speed: number = 1): Animate {\n this.all(anim => { anim.playbackRate = speed; });\n return this;\n }\n\n /**\n * Adds a listener for a given event\n */\n public on(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.on(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Removes a listener from an event\n */\n public off(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.off(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Call all listeners within an event\n */\n public emit(events: AnimationEvents | string | any[], ...args: any): Animate {\n this.emitter.emit(events, ...args);\n return this;\n }\n\n\n /** Returns the Animate options, as JSON */\n public toJSON(): AnimationOptions {\n return this.getOptions();\n }\n\n /**\n * The Symbol.toStringTag well-known symbol is a string valued property that is used\n * in the creation of the default string description of an object.\n * It is accessed internally by the Object.prototype.toString() method.\n */\n get [Symbol.toStringTag]() {\n return `Animate`;\n }\n}\n\n/** Creates a new Animate instance */\nexport const animate = (options: AnimationOptions = {}): Animate => {\n return new Animate(options);\n};\n\nexport class Timeline extends Animate {\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n constructor(options: AnimationOptions = {}) {\n super();\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n public add(options: AnimationOptions) {\n return this;\n }\n}\n\nexport default animate;", "/** Manages complex lists of named data, eg. A page can be stored in a list by of other pages with the url being how the page is stored in the list. Managers use Maps to store data */\nexport class Manager {\n\t/** The complex list of named data, to which the Manager controls */\n\tpublic map: Map;\n\tconstructor(value?: Array<[K, V]>) {\n\t\tthis.map = new Map(value);\n\t}\n\n\t/** Returns the Manager classes base Map */\n\tpublic getMap(): Map {\n\t\treturn this.map;\n\t}\n\n\t/** Get a value stored in the Manager */\n\tpublic get(key: K): V {\n\t\treturn this.map.get(key);\n\t}\n\n\t/** Returns the keys of all items stored in the Manager as an Array */\n\tpublic keys(): Array {\n\t\treturn Array.from(this.map.keys());\n\t}\n\n\t/** Returns the values of all items stored in the Manager as an Array */\n\tpublic values(): Array {\n\t\treturn Array.from(this.map.values());\n\t}\n\n\t/** Set a value to the Manager using a key */\n\tpublic set(key: K, value: V): Manager {\n\t\tthis.map.set(key, value);\n\t\treturn this;\n\t}\n\n\t/** Adds a value to Manager, and uses the current size of the Manager as it's key, it works best when all the key in the Manager are numbers */\n\tpublic add(value: V): Manager {\n\t\tlet size = this.size;\n\t\t// @ts-ignore\n\t\tlet num: K = size as K;\n\t\tthis.set(num, value);\n\t\treturn this;\n\t}\n\n\t/** Returns the total number of items stored in the Manager */\n\tpublic get size(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** An alias for size */\n\tpublic get length(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** Returns the last item in the Manager who's index is a certain distance from the last item in the Manager */\n\tpublic last(distance: number = 1): V | undefined {\n\t\tlet key = this.keys()[this.size - distance];\n\t\treturn this.get(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns true if an element in the Map object existed and has been removed, or false if the element does not exist */\n\tpublic delete(key: K): boolean {\n\t\treturn this.map.delete(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns the Manager class, allowing for chains */\n\tpublic remove(key: K): Manager {\n\t\tthis.map.delete(key);\n\t\treturn this;\n\t}\n\n\t/** Clear the Manager of all its contents */\n\tpublic clear(): Manager {\n\t\tthis.map.clear();\n\t\treturn this;\n\t}\n\n\t/** Checks if the Manager contains a certain key */\n\tpublic has(key: K): boolean {\n\t\treturn this.map.has(key);\n\t}\n\n\t/** Returns a new Iterator object that contains an array of [key, value] for each element in the Map object in insertion order. */\n\tpublic entries(): IterableIterator<[K, V]> {\n\t\treturn this.map.entries();\n\t}\n\n\t/** Iterates through the Managers contents, calling a callback function every iteration */\n\tpublic forEach(\n\t\tcallback: (value?: V, key?: K, map?: Map) => void,\n\t\tcontext?: object\n\t): Manager {\n\t\tthis.map.forEach(callback, context);\n\t\treturn this;\n\t}\n\n\t/** Allows for iteration via for..of, learn more: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators] */\n\tpublic [Symbol.iterator](): IterableIterator<[K, V]> {\n\t\treturn this.entries();\n\t}\n}\n\n/**\n * Calls the method of a certain name for all items that are currently installed\n */\nexport const methodCall = (manager: Manager, method: string, ...args: any): void => {\n\tmanager.forEach((item) => {\n\t\t// @ts-ignore\n\t\titem[method](...args);\n\t});\n};\n\n/**\n * Asynchronously calls the method of a certain name for all items that are currently installed, similar to methodCall\n */\nexport const asyncMethodCall = async (manager: Manager, method: string, ...args: any): Promise => {\n\tfor (let [, item] of manager) {\n\t\t// @ts-ignore\n\t\tawait item[method](...args);\n\t}\n};\n\nexport default Manager;\n", "import { Manager, methodCall } from \"@okikio/manager\";\n\nexport type ListenerCallback = ((...args: any) => void);\nexport interface IListener {\n readonly callback: ListenerCallback;\n readonly scope: object;\n readonly name: string;\n}\n\n/** Represents a new event listener consisting of properties like: callback, scope, name */\nexport const newListener = ({\n callback = () => { },\n scope = null,\n name = \"event\",\n}: IListener): IListener => ({ callback, scope, name });\n\n/** Represents a new event */\nexport class Event extends Manager {\n /** The name of the event */\n public name: string;\n constructor(name: string = \"event\") {\n super();\n this.name = name;\n }\n}\n\nexport type EventInput = string | object | Array;\n\n/**\n * An Event Emitter\n * */\nexport class EventEmitter extends Manager {\n constructor() {\n super();\n }\n\n /** Gets event, if event doesn't exist create a new one */\n public getEvent(name: string): Event {\n let event = this.get(name);\n if (!(event instanceof Event)) {\n this.set(name, new Event(name));\n return this.get(name);\n }\n\n return event;\n }\n\n /** Creates a listener and adds it to an event */\n public newListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event = this.getEvent(name);\n event.add(newListener({ name, callback, scope }));\n return event;\n }\n\n /** Adds a listener to a given event */\n public on(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n this.newListener(_name, _callback, _scope);\n }, this);\n return this;\n }\n\n /** Removes a listener from an event */\n public removeListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event: Event = this.get(name);\n if (event instanceof Event && callback) {\n let listener = newListener({ name, callback, scope });\n\n event.forEach((value: IListener, i: number) => {\n if (\n value.callback === listener.callback &&\n value.scope === listener.scope\n ) {\n return event.remove(i);\n }\n });\n }\n\n return event;\n }\n\n /** Remove a listener from a given event, or just completely remove an event */\n public off(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n if (typeof _callback === \"function\") {\n this.removeListener(_name, _callback, _scope);\n } else this.remove(_name);\n }, this);\n return this;\n }\n\n /** Call all listeners within an event */\n public emit(\n events: string | Array,\n ...args: any\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n // Loop through the list of events\n events.forEach((event: string) => {\n let _event: Event = this.get(event);\n\n if (_event instanceof Event) {\n _event.forEach((listener: IListener) => {\n let { callback, scope } = listener;\n callback.apply(scope, args);\n });\n }\n }, this);\n return this;\n }\n\n /** Clears events and event listeners */\n public clear() {\n methodCall(this, \"clear\");\n super.clear();\n return this;\n }\n}\n\nexport default EventEmitter;\n"], + "mappings": "gIAAA,iNCCO,WAAoB,CAG1B,YAAY,EAAuB,CAClC,KAAK,IAAM,GAAI,KAAI,GAIb,QAAoB,CAC1B,M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I,EAAK,IAAK,CAC1B,GAAI,GAAS,KAAK,QAAQ,GACtB,EAAqC,CACrC,OAAQ,MAAO,IAAU,SAAW,EAAQ,GAAU,EACtD,WAAY,IAAS,GAAO,SAAY,EACxC,YACA,WACA,WACA,QACA,KAAM,KACH,GAMH,EAAe,EAAc,EAA0B,CAAC,EAAG,EAAK,GAAS,MAC7E,EAAoB,EAAa,OAAS,EACrC,KAAK,WAIV,EAAmB,EAAU,EAAkB,CAAC,EAAG,EAAK,GAAS,MAC3D,EAAa,OAAS,GACxB,GAAoB,EAAU,EAAmB,CAAC,EAAG,EAAK,GAAS,OAGvE,GAAI,GAAgB,EAAiB,MAChC,EAAiB,SAAW,EAAiB,WAC9C,EAAiB,SACrB,AAAI,KAAK,cAAgB,GAAe,MAAK,cAAgB,GAG7D,GAAI,GAAY,EAAO,QAAQ,EAAmB,GAGlD,EAAU,SAAW,IAAM,CACvB,MAAO,IAAY,YAAc,EAAS,KAAK,KAAM,EAAQ,EAAG,EAAK,GACrE,KAAK,KAAK,SAAU,EAAQ,EAAG,EAAK,IAIxC,KAAK,gBAAgB,IAAI,EAAW,GACpC,KAAK,WAAW,IAAI,EAAQ,GAC5B,EAAO,KAAK,EAAiB,OAGjC,KAAK,cAAgB,KAAK,YAAY,QAAQ,CAC1C,CAAE,QAAS,KACX,CAAE,QAAS,MACZ,CAEC,SAAU,KAAK,cACf,OAAQ,WAGZ,KAAK,SAAW,KAAK,IAAI,GAAG,GAC5B,KAAK,SAAS,GACd,AAAI,EAAU,KAAK,OACd,KAAK,QAEV,KAAK,QAAU,KAAK,aACpB,KAAK,cAAc,SAAW,IAAM,CAChC,KAAK,KAAK,WAAY,MACtB,KAAK,kBAEJ,EAAP,CACE,KAAK,KAAK,QAAS,IAGpB,IAAI,EAA2B,CAClC,MAAO,QAIR,EAAQ", "names": [] } diff --git a/packages/animate/lib/api.es.js b/packages/animate/lib/api.es.js index d28bab7..32dc245 100644 --- a/packages/animate/lib/api.es.js +++ b/packages/animate/lib/api.es.js @@ -1,2 +1,2 @@ -var m=class{constructor(t){this.map=new Map(t)}getMap(){return this.map}get(t){return this.map.get(t)}keys(){return Array.from(this.map.keys())}values(){return Array.from(this.map.values())}set(t,e){return this.map.set(t,e),this}add(t){let n=this.size;return this.set(n,t),this}get size(){return this.map.size}get length(){return this.map.size}last(t=1){let e=this.keys()[this.size-t];return this.get(e)}delete(t){return this.map.delete(t)}remove(t){return this.map.delete(t),this}clear(){return this.map.clear(),this}has(t){return this.map.has(t)}entries(){return this.map.entries()}forEach(t,e){return this.map.forEach(t,e),this}[Symbol.iterator](){return this.entries()}},k=(i,t,...e)=>{i.forEach(n=>{n[t](...e)})};var T=({callback:i=()=>{},scope:t=null,name:e="event"})=>({callback:i,scope:t,name:e}),g=class extends m{constructor(t="event"){super();this.name=t}},A=class extends m{constructor(){super()}getEvent(t){let e=this.get(t);return e instanceof g?e:(this.set(t,new g(t)),this.get(t))}newListener(t,e,n){let r=this.getEvent(t);return r.add(T({name:t,callback:e,scope:n})),r}on(t,e,n){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let r,s,a=typeof t=="object"&&!Array.isArray(t),o=a?e:n;return a||(s=e),Object.keys(t).forEach(l=>{a?(r=l,s=t[l]):r=t[l],this.newListener(r,s,o)},this),this}removeListener(t,e,n){let r=this.get(t);if(r instanceof g&&e){let s=T({name:t,callback:e,scope:n});r.forEach((a,o)=>{if(a.callback===s.callback&&a.scope===s.scope)return r.remove(o)})}return r}off(t,e,n){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let r,s,a=typeof t=="object"&&!Array.isArray(t),o=a?e:n;return a||(s=e),Object.keys(t).forEach(l=>{a?(r=l,s=t[l]):r=t[l],typeof s=="function"?this.removeListener(r,s,o):this.remove(r)},this),this}emit(t,...e){return typeof t=="undefined"?this:(typeof t=="string"&&(t=t.trim().split(/\s/g)),t.forEach(n=>{let r=this.get(n);r instanceof g&&r.forEach(s=>{let{callback:a,scope:o}=s;a.apply(o,e)})},this),this)}clear(){return k(this,"clear"),super.clear(),this}};var q=i=>typeof i=="string"?Array.from(document.querySelectorAll(i)):[i],H=i=>[].concat(...i),O=i=>Array.isArray(i)?H(i.map(O)):typeof i=="string"||i instanceof Node?q(i):i instanceof NodeList||i instanceof HTMLCollection?Array.from(i):[],M=(i,t,e)=>typeof i=="function"?i.apply(e,t):i,z=(i,t,e)=>{let n,r,s={},a=Object.keys(i);for(let o=0,l=a.length;o/^(in|out)/.test(i)?N[i]:i,v={keyframes:[],loop:1,delay:0,speed:1,endDelay:0,easing:"ease",autoplay:!0,duration:1e3,fillMode:"auto",direction:"normal",extend:{}},f=class{constructor(t={}){this.options={};this.targets=[];this.properties={};this.animations=new m;this.totalDuration=0;this.minDelay=0;this.computedOptions=new m;this.emitter=new A;try{let{options:e,...n}=t,r=e instanceof f?e.getOptions():Array.isArray(e)?e?.[0]?.getOptions():e;this.options=Object.assign({},v,r,n),this.loop=this.loop.bind(this);let{loop:s,delay:a,speed:o,easing:l,endDelay:K,duration:w,direction:C,fillMode:j,onfinish:E,target:I,keyframes:V,autoplay:D,extend:P,...S}=this.options;this.mainElement=document.createElement("div"),this.targets=O(I),this.properties=S;let L=[],b=this.targets.length,y;for(let c=0;c0||(y=z(y,[c,b,p],this));let x=u.delay+u.duration*u.iterations+u.endDelay;this.totalDuration{typeof E=="function"&&E.call(this,p,c,b,h),this.emit("finish",p,c,b,h)},this.computedOptions.set(h,u),this.animations.set(p,h),L.push(u.delay)}this.mainAnimation=this.mainElement.animate([{opacity:"0"},{opacity:"1"}],{duration:this.totalDuration,easing:"linear"}),this.minDelay=Math.min(...L),this.setSpeed(o),D?this.play():this.pause(),this.promise=this.newPromise(),this.mainAnimation.onfinish=()=>{this.emit("complete",this),this.stopLoop()}}catch(e){this.emit("error",e)}}newPromise(){return new Promise((t,e)=>{this.on("complete",()=>t([this])),this.on("error",n=>e(n))})}then(t,e){return t=t?.bind(this),e=e?.bind(this),this.promise.then(t,e),this}catch(t){return t=t?.bind(this),this.promise.catch(t),this}finally(t){return t=t?.bind(this),this.promise.finally(t),this}loop(){this.stopLoop(),this.emit("update",this.getProgress(),this),this.animationFrame=window.requestAnimationFrame(this.loop)}stopLoop(){window.cancelAnimationFrame(this.animationFrame)}all(t){return t(this.mainAnimation),this.animations.forEach(e=>t(e)),this}beginEvent(){if(this.getProgress()==0){let t=window.setTimeout(()=>{this.emit("begin",this),t=window.clearTimeout(t)},this.minDelay)}}play(){let t=this.getPlayState();return this.beginEvent(),this.all(e=>e.play()),this.emit("play",t,this),this.loop(),this}pause(){let t=this.getPlayState();return this.all(e=>e.pause()),this.emit("pause",t,this),this.stopLoop(),this.animationFrame=void 0,this}reset(){return this.setProgress(0),this.beginEvent(),this.options.autoplay?this.play():this.pause(),this}cancel(){return this.all(t=>t.cancel()),this.stopLoop(),this}finish(){return this.all(t=>t.finish()),this.stopLoop(),this}stop(){for(this.cancel(),this.animations.clear();this.targets.length;)this.targets.pop();this.mainElement=void 0,this.emit("stop")}getTargets(){return this.targets}getAnimation(t){return this.animations.get(t)}getTiming(t){let e=t instanceof Animation?t:this.getAnimation(t),n=this.computedOptions.get(e)??{},r=e.effect?.getTiming()??{},s=this.getOptions();return{...v,...s,...r,...n}}getTotalDuration(){return this.totalDuration}getCurrentTime(){return this.mainAnimation.currentTime}getProgress(){return this.getCurrentTime()/this.totalDuration*100}getSpeed(){return this.mainAnimation.playbackRate}getPlayState(){return this.mainAnimation.playState}getOptions(){return this.options}setCurrentTime(t){return this.all(e=>{e.currentTime=t}),this.emit("update",this.getProgress()),this}setProgress(t){let e=t/100*this.totalDuration;return this.setCurrentTime(e),this}setSpeed(t=1){return this.all(e=>{e.playbackRate=t}),this}on(t,e,n){return this.emitter.on(t,e,n??this),this}off(t,e,n){return this.emitter.off(t,e,n??this),this}emit(t,...e){return this.emitter.emit(t,...e),this}toJSON(){return this.getOptions()}get[Symbol.toStringTag](){return"Animate"}},F=(i={})=>new f(i),Z=F;export{f as Animate,v as DefaultAnimationOptions,F as animate,M as computeValue,Z as default,N as easings,_ as getEase,q as getElements,O as getTargets,z as mapObject}; +var y=class{constructor(t){this.map=new Map(t)}getMap(){return this.map}get(t){return this.map.get(t)}keys(){return Array.from(this.map.keys())}values(){return Array.from(this.map.values())}set(t,e){return this.map.set(t,e),this}add(t){let n=this.size;return this.set(n,t),this}get size(){return this.map.size}get length(){return this.map.size}last(t=1){let e=this.keys()[this.size-t];return this.get(e)}delete(t){return this.map.delete(t)}remove(t){return this.map.delete(t),this}clear(){return this.map.clear(),this}has(t){return this.map.has(t)}entries(){return this.map.entries()}forEach(t,e){return this.map.forEach(t,e),this}[Symbol.iterator](){return this.entries()}},V=(i,t,...e)=>{i.forEach(n=>{n[t](...e)})};var H=({callback:i=()=>{},scope:t=null,name:e="event"})=>({callback:i,scope:t,name:e}),L=class extends y{constructor(t="event"){super();this.name=t}},j=class extends y{constructor(){super()}getEvent(t){let e=this.get(t);return e instanceof L?e:(this.set(t,new L(t)),this.get(t))}newListener(t,e,n){let r=this.getEvent(t);return r.add(H({name:t,callback:e,scope:n})),r}on(t,e,n){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let r,s,a=typeof t=="object"&&!Array.isArray(t),p=a?e:n;return a||(s=e),Object.keys(t).forEach(l=>{a?(r=l,s=t[l]):r=t[l],this.newListener(r,s,p)},this),this}removeListener(t,e,n){let r=this.get(t);if(r instanceof L&&e){let s=H({name:t,callback:e,scope:n});r.forEach((a,p)=>{if(a.callback===s.callback&&a.scope===s.scope)return r.remove(p)})}return r}off(t,e,n){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let r,s,a=typeof t=="object"&&!Array.isArray(t),p=a?e:n;return a||(s=e),Object.keys(t).forEach(l=>{a?(r=l,s=t[l]):r=t[l],typeof s=="function"?this.removeListener(r,s,p):this.remove(r)},this),this}emit(t,...e){return typeof t=="undefined"?this:(typeof t=="string"&&(t=t.trim().split(/\s/g)),t.forEach(n=>{let r=this.get(n);r instanceof L&&r.forEach(s=>{let{callback:a,scope:p}=s;a.apply(p,e)})},this),this)}clear(){return V(this,"clear"),super.clear(),this}};var q=i=>typeof i=="string"?Array.from(document.querySelectorAll(i)):[i],N=i=>[].concat(...i),C=i=>Array.isArray(i)?N(i.map(C)):typeof i=="string"||i instanceof Node?q(i):i instanceof NodeList||i instanceof HTMLCollection?Array.from(i):[],I=(i,t,e)=>typeof i=="function"?i.apply(e,t):i,x=(i,t,e)=>{let n,r,s={},a=Object.keys(i);for(let p=0,l=a.length;p/^(in|out)/.test(i)?_[i]:i,P={keyframes:[],loop:1,delay:0,speed:1,endDelay:0,easing:"ease",autoplay:!0,duration:1e3,fillMode:"auto",direction:"normal",extend:{}},f=class{constructor(t={}){this.options={};this.targets=[];this.properties={};this.animations=new y;this.totalDuration=0;this.minDelay=0;this.computedOptions=new y;this.emitter=new j;try{let{options:e,...n}=t,r=e instanceof f?e.getOptions():Array.isArray(e)?e?.[0]?.getOptions():e;this.options=Object.assign({},P,r,n),this.loop=this.loop.bind(this);let{loop:s,delay:a,speed:p,easing:l,endDelay:O,duration:T,direction:k,fillMode:M,onfinish:d,target:K,keyframes:v,autoplay:z,extend:w,...D}=this.options;this.mainElement=document.createElement("div"),this.targets=C(K),this.properties=D;let A=[],m=this.targets.length,b;for(let u=0;u0||(b=x(b,[u,m,c],this));let E=o.delay+o.duration*o.iterations+o.endDelay;this.totalDuration{typeof d=="function"&&d.call(this,c,u,m,h),this.emit("finish",c,u,m,h)},this.computedOptions.set(h,o),this.animations.set(c,h),A.push(o.delay)}this.mainAnimation=this.mainElement.animate([{opacity:"0"},{opacity:"1"}],{duration:this.totalDuration,easing:"linear"}),this.minDelay=Math.min(...A),this.setSpeed(p),z?this.play():this.pause(),this.promise=this.newPromise(),this.mainAnimation.onfinish=()=>{this.emit("complete",this),this.stopLoop()}}catch(e){this.emit("error",e)}}newPromise(){return new Promise((t,e)=>{this.on("complete",()=>t([this])),this.on("error",n=>e(n))})}then(t,e){return t=t?.bind(this),e=e?.bind(this),this.promise.then(t,e),this}catch(t){return t=t?.bind(this),this.promise.catch(t),this}finally(t){return t=t?.bind(this),this.promise.finally(t),this}loop(){this.stopLoop(),this.emit("update",this.getProgress(),this),this.animationFrame=window.requestAnimationFrame(this.loop)}stopLoop(){window.cancelAnimationFrame(this.animationFrame)}all(t){return t(this.mainAnimation,this.mainElement),this.animations.forEach(t),this}beginEvent(){if(this.getProgress()==0){let t=window.setTimeout(()=>{this.emit("begin",this),t=window.clearTimeout(t)},this.minDelay)}}play(){let t=this.getPlayState();return this.beginEvent(),this.all(e=>e.play()),this.emit("play",t,this),this.loop(),this}pause(){let t=this.getPlayState();return this.all(e=>e.pause()),this.emit("pause",t,this),this.stopLoop(),this.animationFrame=void 0,this}reset(){return this.setProgress(0),this.beginEvent(),this.options.autoplay?this.play():this.pause(),this}cancel(){return this.all(t=>t.cancel()),this.stopLoop(),this}finish(){return this.all(t=>t.finish()),this.stopLoop(),this}stop(){for(this.cancel(),this.animations.clear();this.targets.length;)this.targets.pop();this.mainElement=void 0,this.emit("stop")}getTargets(){return this.targets}getAnimation(t){return this.animations.get(t)}getTiming(t){let e=t instanceof Animation?t:this.getAnimation(t),n=this.computedOptions.get(e)??{},r=e.effect?.getTiming()??{},s=this.getOptions();return{...P,...s,...r,...n}}getTotalDuration(){return this.totalDuration}getCurrentTime(){return this.mainAnimation.currentTime}getProgress(){return this.getCurrentTime()/this.totalDuration*100}getSpeed(){return this.mainAnimation.playbackRate}getPlayState(){return this.mainAnimation.playState}getOptions(){return this.options}setCurrentTime(t){return this.all(e=>{e.currentTime=t}),this.emit("update",this.getProgress()),this}setProgress(t){let e=t/100*this.totalDuration;return this.setCurrentTime(e),this}setSpeed(t=1){return this.all(e=>{e.playbackRate=t}),this}on(t,e,n){return this.emitter.on(t,e,n??this),this}off(t,e,n){return this.emitter.off(t,e,n??this),this}emit(t,...e){return this.emitter.emit(t,...e),this}toJSON(){return this.getOptions()}get[Symbol.toStringTag](){return"Animate"}},F=(i={})=>new f(i),J=class extends f{constructor(t={}){super();this.animations=new y;try{let{options:e,...n}=t,r=e instanceof f?e.getOptions():Array.isArray(e)?e?.[0]?.getOptions():e;this.options=Object.assign({},P,r,n),this.loop=this.loop.bind(this);let{loop:s,delay:a,speed:p,easing:l,endDelay:O,duration:T,direction:k,fillMode:M,onfinish:d,target:K,keyframes:v,autoplay:z,extend:w,...D}=this.options;this.mainElement=document.createElement("div"),this.targets=C(K),this.properties=D;let A=[],m=this.targets.length,b;for(let u=0;u0||(b=x(b,[u,m,c],this));let E=o.delay+o.duration*o.iterations+o.endDelay;this.totalDuration{typeof d=="function"&&d.call(this,c,u,m,h),this.emit("finish",c,u,m,h)},this.computedOptions.set(h,o),this.animations.set(c,h),A.push(o.delay)}this.mainAnimation=this.mainElement.animate([{opacity:"0"},{opacity:"1"}],{duration:this.totalDuration,easing:"linear"}),this.minDelay=Math.min(...A),this.setSpeed(p),z?this.play():this.pause(),this.promise=this.newPromise(),this.mainAnimation.onfinish=()=>{this.emit("complete",this),this.stopLoop()}}catch(e){this.emit("error",e)}}add(t){return this}},$=F;export{f as Animate,P as DefaultAnimationOptions,J as Timeline,F as animate,I as computeValue,$ as default,_ as easings,S as getEase,q as getElements,C as getTargets,x as mapObject}; //# sourceMappingURL=api.es.js.map diff --git a/packages/animate/lib/api.es.js.map b/packages/animate/lib/api.es.js.map index eebf55b..e85df52 100644 --- a/packages/animate/lib/api.es.js.map +++ b/packages/animate/lib/api.es.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../../manager/src/api.ts", "../../emitter/src/api.ts", "../src/api.ts"], - "sourcesContent": ["/** Manages complex lists of named data, eg. A page can be stored in a list by of other pages with the url being how the page is stored in the list. Managers use Maps to store data */\nexport class Manager {\n\t/** The complex list of named data, to which the Manager controls */\n\tpublic map: Map;\n\tconstructor(value?: Array<[K, V]>) {\n\t\tthis.map = new Map(value);\n\t}\n\n\t/** Returns the Manager classes base Map */\n\tpublic getMap(): Map {\n\t\treturn this.map;\n\t}\n\n\t/** Get a value stored in the Manager */\n\tpublic get(key: K): V {\n\t\treturn this.map.get(key);\n\t}\n\n\t/** Returns the keys of all items stored in the Manager as an Array */\n\tpublic keys(): Array {\n\t\treturn Array.from(this.map.keys());\n\t}\n\n\t/** Returns the values of all items stored in the Manager as an Array */\n\tpublic values(): Array {\n\t\treturn Array.from(this.map.values());\n\t}\n\n\t/** Set a value to the Manager using a key */\n\tpublic set(key: K, value: V): Manager {\n\t\tthis.map.set(key, value);\n\t\treturn this;\n\t}\n\n\t/** Adds a value to Manager, and uses the current size of the Manager as it's key, it works best when all the key in the Manager are numbers */\n\tpublic add(value: V): Manager {\n\t\tlet size = this.size;\n\t\t// @ts-ignore\n\t\tlet num: K = size as K;\n\t\tthis.set(num, value);\n\t\treturn this;\n\t}\n\n\t/** Returns the total number of items stored in the Manager */\n\tpublic get size(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** An alias for size */\n\tpublic get length(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** Returns the last item in the Manager who's index is a certain distance from the last item in the Manager */\n\tpublic last(distance: number = 1): V | undefined {\n\t\tlet key = this.keys()[this.size - distance];\n\t\treturn this.get(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns true if an element in the Map object existed and has been removed, or false if the element does not exist */\n\tpublic delete(key: K): boolean {\n\t\treturn this.map.delete(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns the Manager class, allowing for chains */\n\tpublic remove(key: K): Manager {\n\t\tthis.map.delete(key);\n\t\treturn this;\n\t}\n\n\t/** Clear the Manager of all its contents */\n\tpublic clear(): Manager {\n\t\tthis.map.clear();\n\t\treturn this;\n\t}\n\n\t/** Checks if the Manager contains a certain key */\n\tpublic has(key: K): boolean {\n\t\treturn this.map.has(key);\n\t}\n\n\t/** Returns a new Iterator object that contains an array of [key, value] for each element in the Map object in insertion order. */\n\tpublic entries(): IterableIterator<[K, V]> {\n\t\treturn this.map.entries();\n\t}\n\n\t/** Iterates through the Managers contents, calling a callback function every iteration */\n\tpublic forEach(\n\t\tcallback: (value?: V, key?: K, map?: Map) => void,\n\t\tcontext?: object\n\t): Manager {\n\t\tthis.map.forEach(callback, context);\n\t\treturn this;\n\t}\n\n\t/** Allows for iteration via for..of, learn more: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators] */\n\tpublic [Symbol.iterator](): IterableIterator<[K, V]> {\n\t\treturn this.entries();\n\t}\n}\n\n/**\n * Calls the method of a certain name for all items that are currently installed\n */\nexport const methodCall = (manager: Manager, method: string, ...args: any): void => {\n\tmanager.forEach((item) => {\n\t\t// @ts-ignore\n\t\titem[method](...args);\n\t});\n};\n\n/**\n * Asynchronously calls the method of a certain name for all items that are currently installed, similar to methodCall\n */\nexport const asyncMethodCall = async (manager: Manager, method: string, ...args: any): Promise => {\n\tfor (let [, item] of manager) {\n\t\t// @ts-ignore\n\t\tawait item[method](...args);\n\t}\n};\n\nexport default Manager;\n", "import { Manager, methodCall } from \"@okikio/manager\";\n\nexport type ListenerCallback = ((...args: any) => void);\nexport interface IListener {\n readonly callback: ListenerCallback;\n readonly scope: object;\n readonly name: string;\n}\n\n/** Represents a new event listener consisting of properties like: callback, scope, name */\nexport const newListener = ({\n callback = () => { },\n scope = null,\n name = \"event\",\n}: IListener): IListener => ({ callback, scope, name });\n\n/** Represents a new event */\nexport class Event extends Manager {\n /** The name of the event */\n public name: string;\n constructor(name: string = \"event\") {\n super();\n this.name = name;\n }\n}\n\nexport type EventInput = string | object | Array;\n\n/**\n * An Event Emitter\n * */\nexport class EventEmitter extends Manager {\n constructor() {\n super();\n }\n\n /** Gets event, if event doesn't exist create a new one */\n public getEvent(name: string): Event {\n let event = this.get(name);\n if (!(event instanceof Event)) {\n this.set(name, new Event(name));\n return this.get(name);\n }\n\n return event;\n }\n\n /** Creates a listener and adds it to an event */\n public newListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event = this.getEvent(name);\n event.add(newListener({ name, callback, scope }));\n return event;\n }\n\n /** Adds a listener to a given event */\n public on(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n this.newListener(_name, _callback, _scope);\n }, this);\n return this;\n }\n\n /** Removes a listener from an event */\n public removeListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event: Event = this.get(name);\n if (event instanceof Event && callback) {\n let listener = newListener({ name, callback, scope });\n\n event.forEach((value: IListener, i: number) => {\n if (\n value.callback === listener.callback &&\n value.scope === listener.scope\n ) {\n return event.remove(i);\n }\n });\n }\n\n return event;\n }\n\n /** Remove a listener from a given event, or just completely remove an event */\n public off(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n if (typeof _callback === \"function\") {\n this.removeListener(_name, _callback, _scope);\n } else this.remove(_name);\n }, this);\n return this;\n }\n\n /** Call all listeners within an event */\n public emit(\n events: string | Array,\n ...args: any\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n // Loop through the list of events\n events.forEach((event: string) => {\n let _event: Event = this.get(event);\n\n if (_event instanceof Event) {\n _event.forEach((listener: IListener) => {\n let { callback, scope } = listener;\n callback.apply(scope, args);\n });\n }\n }, this);\n return this;\n }\n\n /** Clears events and event listeners */\n public clear() {\n methodCall(this, \"clear\");\n super.clear();\n return this;\n }\n}\n\nexport default EventEmitter;\n", "import { EventEmitter, EventInput, ListenerCallback } from \"@okikio/emitter\";\nimport { Manager } from \"@okikio/manager\";\n\n// DOM\nexport type AnimationTarget = string | Node | NodeList | HTMLCollection | HTMLElement[] | AnimationTarget[];\nexport const getElements = (selector: string | Node): Node[] => {\n return typeof selector === \"string\" ? Array.from(document.querySelectorAll(selector as string)) : [selector];\n};\n\nconst flatten = (arr: AnimationTarget[]) => [].concat(...arr);\nexport const getTargets = (targets: AnimationTarget): Node[] => {\n if (Array.isArray(targets)) {\n return flatten((targets as AnimationTarget[]).map(getTargets));\n }\n if (typeof targets == \"string\" || targets instanceof Node)\n return getElements(targets);\n if (targets instanceof NodeList || targets instanceof HTMLCollection)\n return Array.from(targets);\n return [];\n};\n\n// VALUES\nexport type closureArgs = [number, number, HTMLElement];\nexport type closure = ((index?: number, total?: number, element?: HTMLElement) => (genericTypes[] | void)) | any;\nexport const computeValue = (value: closure, args: closureArgs, context: Animate) => {\n if (typeof value === \"function\") {\n return value.apply(context, args);\n } else { return value; }\n};\n\nexport const mapObject = (obj: object, args: closureArgs, options: Animate): any => {\n let key: string, value: any, result = {};\n let keys = Object.keys(obj);\n for (let i = 0, len = keys.length; i < len; i++) {\n key = keys[i];\n value = obj[key];\n result[key] = computeValue(value, args, options);\n }\n\n return result;\n};\n\n/** From: [https://easings.net] */\nexport const easings = {\n \"in\": \"ease-in\",\n \"out\": \"ease-out\",\n \"in-out\": \"ease-in-out\",\n\n // Sine\n \"in-sine\": \"cubic-bezier(0.47, 0, 0.745, 0.715)\",\n \"out-sine\": \"cubic-bezier(0.39, 0.575, 0.565, 1)\",\n \"in-out-sine\": \"cubic-bezier(0.445, 0.05, 0.55, 0.95)\",\n\n // Quad\n \"in-quad\": \"cubic-bezier(0.55, 0.085, 0.68, 0.53)\",\n \"out-quad\": \"cubic-bezier(0.25, 0.46, 0.45, 0.94)\",\n \"in-out-quad\": \"cubic-bezier(0.455, 0.03, 0.515, 0.955)\",\n\n // Cubic\n \"in-cubic\": \"cubic-bezier(0.55, 0.055, 0.675, 0.19)\",\n \"out-cubic\": \"cubic-bezier(0.215, 0.61, 0.355, 1)\",\n \"in-out-cubic\": \"cubic-bezier(0.645, 0.045, 0.355, 1)\",\n\n // Quart\n \"in-quart\": \"cubic-bezier(0.895, 0.03, 0.685, 0.22)\",\n \"out-quart\": \"cubic-bezier(0.165, 0.84, 0.44, 1)\",\n \"in-out-quart\": \"cubic-bezier(0.77, 0, 0.175, 1)\",\n\n // Quint\n \"in-quint\": \"cubic-bezier(0.755, 0.05, 0.855, 0.06)\",\n \"out-quint\": \"cubic-bezier(0.23, 1, 0.32, 1)\",\n \"in-out-quint\": \"cubic-bezier(0.86, 0, 0.07, 1)\",\n\n // Expo\n \"in-expo\": \"cubic-bezier(0.95, 0.05, 0.795, 0.035)\",\n \"out-expo\": \"cubic-bezier(0.19, 1, 0.22, 1)\",\n \"in-out-expo\": \"cubic-bezier(1, 0, 0, 1)\",\n\n // Circ\n \"in-circ\": \"cubic-bezier(0.6, 0.04, 0.98, 0.335)\",\n \"out-circ\": \"cubic-bezier(0.075, 0.82, 0.165, 1)\",\n \"in-out-circ\": \"cubic-bezier(0.785, 0.135, 0.15, 0.86)\",\n\n // Back\n \"in-back\": \"cubic-bezier(0.6, -0.28, 0.735, 0.045)\",\n \"out-back\": \"cubic-bezier(0.175, 0.885, 0.32, 1.275)\",\n \"in-out-back\": \"cubic-bezier(0.68, -0.55, 0.265, 1.55)\"\n};\n\nexport const getEase = (ease: string) => {\n return /^(in|out)/.test(ease) ? easings[ease] : ease;\n};\n\nexport type genericTypes = genericTypes[] | boolean | object | string | number | closure | null | undefined;\nexport interface AnimationOptions {\n target?: AnimationTarget,\n\n speed?: number,\n autoplay?: boolean,\n options?: AnimationOptions,\n delay?: number | closure,\n easing?: string | closure,\n endDelay?: number | closure,\n duration?: number | closure,\n keyframes?: Keyframe[] | object[] | closure,\n loop?: number | boolean | closure, // iterations: number,\n onfinish?: (element?: HTMLElement, index?: number, total?: number, animation?: Animation) => any,\n fillMode?: \"none\" | \"forwards\" | \"backwards\" | \"both\" | \"auto\" | closure,\n direction?: \"normal\" | \"reverse\" | \"alternate\" | \"alternate-reverse\" | closure,\n extend?: EffectTiming,\n [property: string]: genericTypes;\n};\n\nexport const DefaultAnimationOptions: AnimationOptions = {\n keyframes: [],\n\n loop: 1, // iterations: number,\n delay: 0,\n speed: 1,\n endDelay: 0,\n easing: \"ease\",\n autoplay: true,\n duration: 1000,\n fillMode: \"auto\",\n direction: \"normal\",\n extend: {}\n};\n\nexport type AnimationEvents = \"update\" | \"play\" | \"pause\" | \"start\" | \"begin\" | \"complete\" | \"finish\" | \"error\" | \"stop\";\n\n/** You can check it out here: https://codepen.io/okikio/pen/qBbdGaW?editors=0011 */\nexport class Animate {\n /**\n * Stores the options for the current animation\n */\n public options: AnimationOptions = {};\n\n /**\n * The Array of Elements to Animate\n */\n public targets: Node[] = [];\n\n /**\n * The properties to animate\n */\n public properties: object = {};\n\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n\n /**\n * The total duration of all Animation's\n */\n public totalDuration: number = 0;\n\n /**\n * The smallest delay out of all Animation's\n */\n public minDelay: number = 0;\n\n /**\n * The options for individual animations\n */\n public computedOptions: Manager = new Manager();\n\n /**\n * The Element the main animation uses\n */\n public mainElement: HTMLElement;\n\n /**\n * Stores an animation that runs on the total duration of the all other Animations, and as such it's the main Animation\n */\n public mainAnimation: Animation;\n\n /**\n * Stores request frame calls\n */\n public animationFrame: number;\n\n /**\n * An event emitter\n */\n public emitter: EventEmitter = new EventEmitter();\n\n /**\n * Returns a promise that is fulfilled when the mainAnimation is finished\n */\n public promise: Promise;\n constructor(options: AnimationOptions = {}) {\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n\n /**\n * Returns a new Promise that is resolve when this.finish is called\n */\n public newPromise(): Promise {\n return new Promise((resolve, reject) => {\n /*\n Note that the `this` keyword is in an Array when it is resolved,\n this is due to Promises not wanting to resolve references,\n so, you can't resolve `this` directly, so, I chose to resolve `this` in an\n Array\n */\n this.on(\"complete\", () => resolve([this]));\n this.on(\"error\", err => reject(err));\n });\n }\n\n /**\n * Fulfills the this.promise Promise\n */\n public then(\n onFulfilled?: (value?: any) => any,\n onRejected?: (reason?: any) => any\n ): Animate {\n onFulfilled = onFulfilled?.bind(this);\n onRejected = onRejected?.bind(this);\n this.promise.then(onFulfilled, onRejected);\n return this;\n }\n\n /**\n * Catches error that occur in the this.promise Promise\n */\n public catch(onRejected: (reason?: any) => any): Animate {\n onRejected = onRejected?.bind(this);\n this.promise.catch(onRejected);\n return this;\n }\n\n /**\n * If you don't care if the this.promise Promise has either been rejected or resolved\n */\n public finally(onFinally: () => any): Animate {\n onFinally = onFinally?.bind(this);\n this.promise.finally(onFinally);\n return this;\n }\n\n /**\n * Represents an Animation Frame Loop\n */\n public loop(): void {\n this.stopLoop();\n this.emit(\"update\", this.getProgress(), this);\n this.animationFrame = window.requestAnimationFrame(this.loop);\n }\n\n /**\n * Cancels animation frame\n */\n public stopLoop() {\n window.cancelAnimationFrame(this.animationFrame);\n }\n\n /**\n * Calls a method that affects all animations including the mainAnimation; the method only allows the animation parameter\n */\n public all(method: (animation: Animation) => void) {\n method(this.mainAnimation);\n this.animations.forEach(animation => method(animation));\n return this;\n }\n\n /**\n * Register the begin event\n */\n protected beginEvent() {\n if (this.getProgress() == 0) {\n let timer: number | void = window.setTimeout(() => {\n this.emit(\"begin\", this);\n timer = window.clearTimeout(timer as number);\n }, this.minDelay);\n }\n }\n\n /**\n * Play Animation\n */\n public play(): Animate {\n let playstate = this.getPlayState();\n this.beginEvent();\n this.all(anim => anim.play());\n this.emit(\"play\", playstate, this);\n this.loop();\n return this;\n }\n\n /**\n * Pause Animation\n */\n public pause(): Animate {\n let playstate = this.getPlayState();\n this.all(anim => anim.pause());\n this.emit(\"pause\", playstate, this);\n this.stopLoop();\n this.animationFrame = undefined;\n return this;\n }\n\n /**\n * Reset all Animations\n */\n public reset() {\n this.setProgress(0);\n this.beginEvent();\n\n if (this.options.autoplay) this.play();\n else this.pause();\n return this;\n }\n\n /**\n * Cancels all Animations\n */\n public cancel() {\n this.all(anim => anim.cancel());\n this.stopLoop();\n return this;\n }\n\n /**\n * Force complete all Animations\n */\n public finish() {\n this.all(anim => anim.finish());\n this.stopLoop();\n return this;\n }\n\n /**\n * Cancels & Clears all Animations\n */\n public stop() {\n this.cancel();\n this.animations.clear();\n while (this.targets.length) this.targets.pop();\n this.mainElement = undefined;\n this.emit(\"stop\");\n }\n\n /**\n * Returns an Array of targets\n */\n public getTargets(): Node[] {\n return this.targets;\n }\n\n /**\n * Get a specific Animation from an Animate instance\n */\n public getAnimation(element: HTMLElement): Animation {\n return this.animations.get(element);\n }\n\n /**\n * Returns the timings of an Animation, given a target\n * E.g. { duration, endDelay, delay, iterations, iterationStart, direction, easing, fill, etc... }\n */\n public getTiming(target: HTMLElement | Animation): AnimationOptions & EffectTiming {\n let animation = target instanceof Animation ? target : this.getAnimation(target);\n let keyframeOptions = this.computedOptions.get(animation) ?? {};\n let timings = animation.effect?.getTiming() ?? {};\n let options = this.getOptions();\n\n return { ...DefaultAnimationOptions, ...options, ...timings, ...keyframeOptions };\n }\n\n /**\n * Returns the total duration of Animation\n */\n public getTotalDuration(): number {\n return this.totalDuration;\n }\n\n /**\n * Returns the current time of the Main Animation\n */\n public getCurrentTime(): number {\n return this.mainAnimation.currentTime;\n }\n\n /**\n * Returns the Animation progress as a fraction of the current time / duration * 100\n */\n public getProgress() {\n return (this.getCurrentTime() / this.totalDuration) * 100;\n }\n\n /**\n * Return the playback speed of the animation\n */\n public getSpeed(): number {\n return this.mainAnimation.playbackRate;\n }\n\n /**\n * Returns the current playing state\n */\n public getPlayState(): \"idle\" | \"running\" | \"paused\" | \"finished\" {\n return this.mainAnimation.playState;\n }\n\n /**\n * Get the options of an Animate instance\n */\n public getOptions(): AnimationOptions {\n return this.options;\n }\n\n /**\n * Set the current time of the Main Animation\n */\n public setCurrentTime(time: number): Animate {\n this.all(anim => { anim.currentTime = time; });\n this.emit(\"update\", this.getProgress());\n return this;\n }\n\n /**\n * Set the Animation progress as a value from 0 to 100\n */\n public setProgress(percent: number): Animate {\n let time = (percent / 100) * this.totalDuration;\n this.setCurrentTime(time);\n return this;\n }\n\n /**\n * Set the playback speed of an Animation\n */\n public setSpeed(speed: number = 1): Animate {\n this.all(anim => { anim.playbackRate = speed; });\n return this;\n }\n\n /**\n * Adds a listener for a given event\n */\n public on(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.on(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Removes a listener from an event\n */\n public off(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.off(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Call all listeners within an event\n */\n public emit(events: AnimationEvents | string | any[], ...args: any): Animate {\n this.emitter.emit(events, ...args);\n return this;\n }\n\n\n /** Returns the Animate options, as JSON */\n public toJSON(): AnimationOptions {\n return this.getOptions();\n }\n\n /**\n * The Symbol.toStringTag well-known symbol is a string valued property that is used\n * in the creation of the default string description of an object.\n * It is accessed internally by the Object.prototype.toString() method.\n */\n get [Symbol.toStringTag]() {\n return `Animate`;\n }\n}\n\n/** Creates a new Animate instance */\nexport const animate = (options: AnimationOptions = {}): Animate => {\n return new Animate(options);\n};\n\nexport default animate;"], - "mappings": "AACO,WAAoB,CAG1B,YAAY,EAAuB,CAClC,KAAK,IAAM,GAAI,KAAI,GAIb,QAAoB,CAC1B,MAAO,MAAK,IAIN,IAAI,EAAW,CACrB,MAAO,MAAK,IAAI,IAAI,GAId,MAAiB,CACvB,MAAO,OAAM,KAAK,KAAK,IAAI,QAIrB,QAAmB,CACzB,MAAO,OAAM,KAAK,KAAK,IAAI,UAIrB,IAAI,EAAQ,EAAyB,CAC3C,YAAK,IAAI,IAAI,EAAK,GACX,KAID,IAAI,EAAyB,CAGnC,GAAI,GAFO,KAAK,KAGhB,YAAK,IAAI,EAAK,GACP,QAIG,OAAe,CACzB,MAAO,MAAK,IAAI,QAIN,SAAiB,CAC3B,MAAO,MAAK,IAAI,KAIV,KAAK,EAAmB,EAAkB,CAChD,GAAI,GAAM,KAAK,OAAO,KAAK,KAAO,GAClC,MAAO,MAAK,IAAI,GAIV,OAAO,EAAiB,CAC9B,MAAO,MAAK,IAAI,OAAO,GAIjB,OAAO,EAAuB,CACpC,YAAK,IAAI,OAAO,GACT,KAID,OAAuB,CAC7B,YAAK,IAAI,QACF,KAID,IAAI,EAAiB,CAC3B,MAAO,MAAK,IAAI,IAAI,GAId,SAAoC,CAC1C,MAAO,MAAK,IAAI,UAIV,QACN,EACA,EACgB,CAChB,YAAK,IAAI,QAAQ,EAAU,GACpB,MAIA,OAAO,WAAsC,CACpD,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other pages with the url being how the page is stored in the list. Managers use Maps to store data */\nexport class Manager {\n\t/** The complex list of named data, to which the Manager controls */\n\tpublic map: Map;\n\tconstructor(value?: Array<[K, V]>) {\n\t\tthis.map = new Map(value);\n\t}\n\n\t/** Returns the Manager classes base Map */\n\tpublic getMap(): Map {\n\t\treturn this.map;\n\t}\n\n\t/** Get a value stored in the Manager */\n\tpublic get(key: K): V {\n\t\treturn this.map.get(key);\n\t}\n\n\t/** Returns the keys of all items stored in the Manager as an Array */\n\tpublic keys(): Array {\n\t\treturn Array.from(this.map.keys());\n\t}\n\n\t/** Returns the values of all items stored in the Manager as an Array */\n\tpublic values(): Array {\n\t\treturn Array.from(this.map.values());\n\t}\n\n\t/** Set a value to the Manager using a key */\n\tpublic set(key: K, value: V): Manager {\n\t\tthis.map.set(key, value);\n\t\treturn this;\n\t}\n\n\t/** Adds a value to Manager, and uses the current size of the Manager as it's key, it works best when all the key in the Manager are numbers */\n\tpublic add(value: V): Manager {\n\t\tlet size = this.size;\n\t\t// @ts-ignore\n\t\tlet num: K = size as K;\n\t\tthis.set(num, value);\n\t\treturn this;\n\t}\n\n\t/** Returns the total number of items stored in the Manager */\n\tpublic get size(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** An alias for size */\n\tpublic get length(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** Returns the last item in the Manager who's index is a certain distance from the last item in the Manager */\n\tpublic last(distance: number = 1): V | undefined {\n\t\tlet key = this.keys()[this.size - distance];\n\t\treturn this.get(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns true if an element in the Map object existed and has been removed, or false if the element does not exist */\n\tpublic delete(key: K): boolean {\n\t\treturn this.map.delete(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns the Manager class, allowing for chains */\n\tpublic remove(key: K): Manager {\n\t\tthis.map.delete(key);\n\t\treturn this;\n\t}\n\n\t/** Clear the Manager of all its contents */\n\tpublic clear(): Manager {\n\t\tthis.map.clear();\n\t\treturn this;\n\t}\n\n\t/** Checks if the Manager contains a certain key */\n\tpublic has(key: K): boolean {\n\t\treturn this.map.has(key);\n\t}\n\n\t/** Returns a new Iterator object that contains an array of [key, value] for each element in the Map object in insertion order. */\n\tpublic entries(): IterableIterator<[K, V]> {\n\t\treturn this.map.entries();\n\t}\n\n\t/** Iterates through the Managers contents, calling a callback function every iteration */\n\tpublic forEach(\n\t\tcallback: (value?: V, key?: K, map?: Map) => void,\n\t\tcontext?: object\n\t): Manager {\n\t\tthis.map.forEach(callback, context);\n\t\treturn this;\n\t}\n\n\t/** Allows for iteration via for..of, learn more: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators] */\n\tpublic [Symbol.iterator](): IterableIterator<[K, V]> {\n\t\treturn this.entries();\n\t}\n}\n\n/**\n * Calls the method of a certain name for all items that are currently installed\n */\nexport const methodCall = (manager: Manager, method: string, ...args: any): void => {\n\tmanager.forEach((item) => {\n\t\t// @ts-ignore\n\t\titem[method](...args);\n\t});\n};\n\n/**\n * Asynchronously calls the method of a certain name for all items that are currently installed, similar to methodCall\n */\nexport const asyncMethodCall = async (manager: Manager, method: string, ...args: any): Promise => {\n\tfor (let [, item] of manager) {\n\t\t// @ts-ignore\n\t\tawait item[method](...args);\n\t}\n};\n\nexport default Manager;\n", "import { Manager, methodCall } from \"@okikio/manager\";\n\nexport type ListenerCallback = ((...args: any) => void);\nexport interface IListener {\n readonly callback: ListenerCallback;\n readonly scope: object;\n readonly name: string;\n}\n\n/** Represents a new event listener consisting of properties like: callback, scope, name */\nexport const newListener = ({\n callback = () => { },\n scope = null,\n name = \"event\",\n}: IListener): IListener => ({ callback, scope, name });\n\n/** Represents a new event */\nexport class Event extends Manager {\n /** The name of the event */\n public name: string;\n constructor(name: string = \"event\") {\n super();\n this.name = name;\n }\n}\n\nexport type EventInput = string | object | Array;\n\n/**\n * An Event Emitter\n * */\nexport class EventEmitter extends Manager {\n constructor() {\n super();\n }\n\n /** Gets event, if event doesn't exist create a new one */\n public getEvent(name: string): Event {\n let event = this.get(name);\n if (!(event instanceof Event)) {\n this.set(name, new Event(name));\n return this.get(name);\n }\n\n return event;\n }\n\n /** Creates a listener and adds it to an event */\n public newListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event = this.getEvent(name);\n event.add(newListener({ name, callback, scope }));\n return event;\n }\n\n /** Adds a listener to a given event */\n public on(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n this.newListener(_name, _callback, _scope);\n }, this);\n return this;\n }\n\n /** Removes a listener from an event */\n public removeListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event: Event = this.get(name);\n if (event instanceof Event && callback) {\n let listener = newListener({ name, callback, scope });\n\n event.forEach((value: IListener, i: number) => {\n if (\n value.callback === listener.callback &&\n value.scope === listener.scope\n ) {\n return event.remove(i);\n }\n });\n }\n\n return event;\n }\n\n /** Remove a listener from a given event, or just completely remove an event */\n public off(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n if (typeof _callback === \"function\") {\n this.removeListener(_name, _callback, _scope);\n } else this.remove(_name);\n }, this);\n return this;\n }\n\n /** Call all listeners within an event */\n public emit(\n events: string | Array,\n ...args: any\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n // Loop through the list of events\n events.forEach((event: string) => {\n let _event: Event = this.get(event);\n\n if (_event instanceof Event) {\n _event.forEach((listener: IListener) => {\n let { callback, scope } = listener;\n callback.apply(scope, args);\n });\n }\n }, this);\n return this;\n }\n\n /** Clears events and event listeners */\n public clear() {\n methodCall(this, \"clear\");\n super.clear();\n return this;\n }\n}\n\nexport default EventEmitter;\n", "import { EventEmitter, EventInput, ListenerCallback } from \"@okikio/emitter\";\nimport { Manager } from \"@okikio/manager\";\n\n// DOM\nexport type AnimationTarget = string | Node | NodeList | HTMLCollection | HTMLElement[] | AnimationTarget[];\nexport const getElements = (selector: string | Node): Node[] => {\n return typeof selector === \"string\" ? Array.from(document.querySelectorAll(selector as string)) : [selector];\n};\n\nconst flatten = (arr: AnimationTarget[]) => [].concat(...arr);\nexport const getTargets = (targets: AnimationTarget): Node[] => {\n if (Array.isArray(targets)) {\n return flatten((targets as AnimationTarget[]).map(getTargets));\n }\n if (typeof targets == \"string\" || targets instanceof Node)\n return getElements(targets);\n if (targets instanceof NodeList || targets instanceof HTMLCollection)\n return Array.from(targets);\n return [];\n};\n\n// VALUES\nexport type closureArgs = [number, number, HTMLElement];\nexport type closure = ((index?: number, total?: number, element?: HTMLElement) => (genericTypes[] | void)) | any;\nexport const computeValue = (value: closure, args: closureArgs, context: Animate) => {\n if (typeof value === \"function\") {\n return value.apply(context, args);\n } else { return value; }\n};\n\nexport const mapObject = (obj: object, args: closureArgs, options: Animate): any => {\n let key: string, value: any, result = {};\n let keys = Object.keys(obj);\n for (let i = 0, len = keys.length; i < len; i++) {\n key = keys[i];\n value = obj[key];\n result[key] = computeValue(value, args, options);\n }\n\n return result;\n};\n\n/** From: [https://easings.net] */\nexport const easings = {\n \"in\": \"ease-in\",\n \"out\": \"ease-out\",\n \"in-out\": \"ease-in-out\",\n\n // Sine\n \"in-sine\": \"cubic-bezier(0.47, 0, 0.745, 0.715)\",\n \"out-sine\": \"cubic-bezier(0.39, 0.575, 0.565, 1)\",\n \"in-out-sine\": \"cubic-bezier(0.445, 0.05, 0.55, 0.95)\",\n\n // Quad\n \"in-quad\": \"cubic-bezier(0.55, 0.085, 0.68, 0.53)\",\n \"out-quad\": \"cubic-bezier(0.25, 0.46, 0.45, 0.94)\",\n \"in-out-quad\": \"cubic-bezier(0.455, 0.03, 0.515, 0.955)\",\n\n // Cubic\n \"in-cubic\": \"cubic-bezier(0.55, 0.055, 0.675, 0.19)\",\n \"out-cubic\": \"cubic-bezier(0.215, 0.61, 0.355, 1)\",\n \"in-out-cubic\": \"cubic-bezier(0.645, 0.045, 0.355, 1)\",\n\n // Quart\n \"in-quart\": \"cubic-bezier(0.895, 0.03, 0.685, 0.22)\",\n \"out-quart\": \"cubic-bezier(0.165, 0.84, 0.44, 1)\",\n \"in-out-quart\": \"cubic-bezier(0.77, 0, 0.175, 1)\",\n\n // Quint\n \"in-quint\": \"cubic-bezier(0.755, 0.05, 0.855, 0.06)\",\n \"out-quint\": \"cubic-bezier(0.23, 1, 0.32, 1)\",\n \"in-out-quint\": \"cubic-bezier(0.86, 0, 0.07, 1)\",\n\n // Expo\n \"in-expo\": \"cubic-bezier(0.95, 0.05, 0.795, 0.035)\",\n \"out-expo\": \"cubic-bezier(0.19, 1, 0.22, 1)\",\n \"in-out-expo\": \"cubic-bezier(1, 0, 0, 1)\",\n\n // Circ\n \"in-circ\": \"cubic-bezier(0.6, 0.04, 0.98, 0.335)\",\n \"out-circ\": \"cubic-bezier(0.075, 0.82, 0.165, 1)\",\n \"in-out-circ\": \"cubic-bezier(0.785, 0.135, 0.15, 0.86)\",\n\n // Back\n \"in-back\": \"cubic-bezier(0.6, -0.28, 0.735, 0.045)\",\n \"out-back\": \"cubic-bezier(0.175, 0.885, 0.32, 1.275)\",\n \"in-out-back\": \"cubic-bezier(0.68, -0.55, 0.265, 1.55)\"\n};\n\nexport const getEase = (ease: string) => {\n return /^(in|out)/.test(ease) ? easings[ease] : ease;\n};\n\nexport type genericTypes = genericTypes[] | boolean | object | string | number | closure | null | undefined;\nexport interface AnimationOptions {\n target?: AnimationTarget,\n\n speed?: number,\n autoplay?: boolean,\n options?: AnimationOptions,\n delay?: number | closure,\n easing?: string | closure,\n endDelay?: number | closure,\n duration?: number | closure,\n keyframes?: Keyframe[] | object[] | closure,\n loop?: number | boolean | closure, // iterations: number,\n onfinish?: (element?: HTMLElement, index?: number, total?: number, animation?: Animation) => any,\n fillMode?: \"none\" | \"forwards\" | \"backwards\" | \"both\" | \"auto\" | closure,\n direction?: \"normal\" | \"reverse\" | \"alternate\" | \"alternate-reverse\" | closure,\n extend?: EffectTiming,\n [property: string]: genericTypes;\n};\n\nexport const DefaultAnimationOptions: AnimationOptions = {\n keyframes: [],\n\n loop: 1, // iterations: number,\n delay: 0,\n speed: 1,\n endDelay: 0,\n easing: \"ease\",\n autoplay: true,\n duration: 1000,\n fillMode: \"auto\",\n direction: \"normal\",\n extend: {}\n};\n\nexport type AnimationEvents = \"update\" | \"play\" | \"pause\" | \"start\" | \"begin\" | \"complete\" | \"finish\" | \"error\" | \"stop\";\n\n/** You can check it out here: https://codepen.io/okikio/pen/qBbdGaW?editors=0011 */\nexport class Animate {\n /**\n * Stores the options for the current animation\n */\n public options: AnimationOptions = {};\n\n /**\n * The Array of Elements to Animate\n */\n public targets: Node[] = [];\n\n /**\n * The properties to animate\n */\n public properties: object = {};\n\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n\n /**\n * The total duration of all Animation's\n */\n public totalDuration: number = 0;\n\n /**\n * The smallest delay out of all Animation's\n */\n public minDelay: number = 0;\n\n /**\n * The options for individual animations\n */\n public computedOptions: Manager = new Manager();\n\n /**\n * The Element the main animation uses\n */\n public mainElement: HTMLElement;\n\n /**\n * Stores an animation that runs on the total duration of the all other Animations, and as such it's the main Animation\n */\n public mainAnimation: Animation;\n\n /**\n * Stores request frame calls\n */\n public animationFrame: number;\n\n /**\n * An event emitter\n */\n public emitter: EventEmitter = new EventEmitter();\n\n /**\n * Returns a promise that is fulfilled when the mainAnimation is finished\n */\n public promise: Promise;\n constructor(options: AnimationOptions = {}) {\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n\n /**\n * Returns a new Promise that is resolve when this.finish is called\n */\n public newPromise(): Promise {\n return new Promise((resolve, reject) => {\n /*\n Note that the `this` keyword is in an Array when it is resolved,\n this is due to Promises not wanting to resolve references,\n so, you can't resolve `this` directly, so, I chose to resolve `this` in an\n Array\n */\n this.on(\"complete\", () => resolve([this]));\n this.on(\"error\", err => reject(err));\n });\n }\n\n /**\n * Fulfills the this.promise Promise\n */\n public then(\n onFulfilled?: (value?: any) => any,\n onRejected?: (reason?: any) => any\n ): Animate {\n onFulfilled = onFulfilled?.bind(this);\n onRejected = onRejected?.bind(this);\n this.promise.then(onFulfilled, onRejected);\n return this;\n }\n\n /**\n * Catches error that occur in the this.promise Promise\n */\n public catch(onRejected: (reason?: any) => any): Animate {\n onRejected = onRejected?.bind(this);\n this.promise.catch(onRejected);\n return this;\n }\n\n /**\n * If you don't care if the this.promise Promise has either been rejected or resolved\n */\n public finally(onFinally: () => any): Animate {\n onFinally = onFinally?.bind(this);\n this.promise.finally(onFinally);\n return this;\n }\n\n /**\n * Represents an Animation Frame Loop\n */\n public loop(): void {\n this.stopLoop();\n this.emit(\"update\", this.getProgress(), this);\n this.animationFrame = window.requestAnimationFrame(this.loop);\n }\n\n /**\n * Cancels animation frame\n */\n public stopLoop() {\n window.cancelAnimationFrame(this.animationFrame);\n }\n\n /**\n * Calls a method that affects all animations including the mainAnimation; the method only allows the animation parameter\n */\n public all(method: (animation?: Animation, target?: HTMLElement) => void) {\n method(this.mainAnimation, this.mainElement);\n this.animations.forEach(method);\n return this;\n }\n\n /**\n * Register the begin event\n */\n protected beginEvent() {\n if (this.getProgress() == 0) {\n let timer: number | void = window.setTimeout(() => {\n this.emit(\"begin\", this);\n timer = window.clearTimeout(timer as number);\n }, this.minDelay);\n }\n }\n\n /**\n * Play Animation\n */\n public play(): Animate {\n let playstate = this.getPlayState();\n this.beginEvent();\n this.all(anim => anim.play());\n this.emit(\"play\", playstate, this);\n this.loop();\n return this;\n }\n\n /**\n * Pause Animation\n */\n public pause(): Animate {\n let playstate = this.getPlayState();\n this.all(anim => anim.pause());\n this.emit(\"pause\", playstate, this);\n this.stopLoop();\n this.animationFrame = undefined;\n return this;\n }\n\n /**\n * Reset all Animations\n */\n public reset() {\n this.setProgress(0);\n this.beginEvent();\n\n if (this.options.autoplay) this.play();\n else this.pause();\n return this;\n }\n\n /**\n * Cancels all Animations\n */\n public cancel() {\n this.all(anim => anim.cancel());\n this.stopLoop();\n return this;\n }\n\n /**\n * Force complete all Animations\n */\n public finish() {\n this.all(anim => anim.finish());\n this.stopLoop();\n return this;\n }\n\n /**\n * Cancels & Clears all Animations\n */\n public stop() {\n this.cancel();\n this.animations.clear();\n while (this.targets.length) this.targets.pop();\n this.mainElement = undefined;\n this.emit(\"stop\");\n }\n\n /**\n * Returns an Array of targets\n */\n public getTargets(): Node[] {\n return this.targets;\n }\n\n /**\n * Get a specific Animation from an Animate instance\n */\n public getAnimation(element: HTMLElement): Animation {\n return this.animations.get(element);\n }\n\n /**\n * Returns the timings of an Animation, given a target\n * E.g. { duration, endDelay, delay, iterations, iterationStart, direction, easing, fill, etc... }\n */\n public getTiming(target: HTMLElement | Animation): AnimationOptions & EffectTiming {\n let animation = target instanceof Animation ? target : this.getAnimation(target);\n let keyframeOptions = this.computedOptions.get(animation) ?? {};\n let timings = animation.effect?.getTiming() ?? {};\n let options = this.getOptions();\n\n return { ...DefaultAnimationOptions, ...options, ...timings, ...keyframeOptions };\n }\n\n /**\n * Returns the total duration of Animation\n */\n public getTotalDuration(): number {\n return this.totalDuration;\n }\n\n /**\n * Returns the current time of the Main Animation\n */\n public getCurrentTime(): number {\n return this.mainAnimation.currentTime;\n }\n\n /**\n * Returns the Animation progress as a fraction of the current time / duration * 100\n */\n public getProgress() {\n return (this.getCurrentTime() / this.totalDuration) * 100;\n }\n\n /**\n * Return the playback speed of the animation\n */\n public getSpeed(): number {\n return this.mainAnimation.playbackRate;\n }\n\n /**\n * Returns the current playing state\n */\n public getPlayState(): \"idle\" | \"running\" | \"paused\" | \"finished\" {\n return this.mainAnimation.playState;\n }\n\n /**\n * Get the options of an Animate instance\n */\n public getOptions(): AnimationOptions {\n return this.options;\n }\n\n /**\n * Set the current time of the Main Animation\n */\n public setCurrentTime(time: number): Animate {\n this.all(anim => { anim.currentTime = time; });\n this.emit(\"update\", this.getProgress());\n return this;\n }\n\n /**\n * Set the Animation progress as a value from 0 to 100\n */\n public setProgress(percent: number): Animate {\n let time = (percent / 100) * this.totalDuration;\n this.setCurrentTime(time);\n return this;\n }\n\n /**\n * Set the playback speed of an Animation\n */\n public setSpeed(speed: number = 1): Animate {\n this.all(anim => { anim.playbackRate = speed; });\n return this;\n }\n\n /**\n * Adds a listener for a given event\n */\n public on(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.on(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Removes a listener from an event\n */\n public off(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.off(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Call all listeners within an event\n */\n public emit(events: AnimationEvents | string | any[], ...args: any): Animate {\n this.emitter.emit(events, ...args);\n return this;\n }\n\n\n /** Returns the Animate options, as JSON */\n public toJSON(): AnimationOptions {\n return this.getOptions();\n }\n\n /**\n * The Symbol.toStringTag well-known symbol is a string valued property that is used\n * in the creation of the default string description of an object.\n * It is accessed internally by the Object.prototype.toString() method.\n */\n get [Symbol.toStringTag]() {\n return `Animate`;\n }\n}\n\n/** Creates a new Animate instance */\nexport const animate = (options: AnimationOptions = {}): Animate => {\n return new Animate(options);\n};\n\nexport class Timeline extends Animate {\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n constructor(options: AnimationOptions = {}) {\n super();\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n public add(options: AnimationOptions) {\n return this;\n }\n}\n\nexport default animate;"], + "mappings": "AACO,WAAoB,CAG1B,YAAY,EAAuB,CAClC,KAAK,IAAM,GAAI,KAAI,GAIb,QAAoB,CAC1B,MAAO,MAAK,IAIN,IAAI,EAAW,CACrB,MAAO,MAAK,IAAI,IAAI,GAId,MAAiB,CACvB,MAAO,OAAM,KAAK,KAAK,IAA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EACtD,WAAY,IAAS,GAAO,SAAY,EACxC,YACA,WACA,WACA,QACA,KAAM,KACH,GAMH,EAAe,EAAc,EAA0B,CAAC,EAAG,EAAK,GAAS,MAC7E,EAAoB,EAAa,OAAS,EACrC,KAAK,WAIV,EAAmB,EAAU,EAAkB,CAAC,EAAG,EAAK,GAAS,MAC3D,EAAa,OAAS,GACxB,GAAoB,EAAU,EAAmB,CAAC,EAAG,EAAK,GAAS,OAGvE,GAAI,GAAgB,EAAiB,MAChC,EAAiB,SAAW,EAAiB,WAC9C,EAAiB,SACrB,AAAI,KAAK,cAAgB,GAAe,MAAK,cAAgB,GAG7D,GAAI,GAAY,EAAO,QAAQ,EAAmB,GAGlD,EAAU,SAAW,IAAM,CACvB,MAAO,IAAY,YAAc,EAAS,KAAK,KAAM,EAAQ,EAAG,EAAK,GACrE,KAAK,KAAK,SAAU,EAAQ,EAAG,EAAK,IAIxC,KAAK,gBAAgB,IAAI,EAAW,GACpC,KAAK,WAAW,IAAI,EAAQ,GAC5B,EAAO,KAAK,EAAiB,OAGjC,KAAK,cAAgB,KAAK,YAAY,QAAQ,CAC1C,CAAE,QAAS,KACX,CAAE,QAAS,MACZ,CAEC,SAAU,KAAK,cACf,OAAQ,WAGZ,KAAK,SAAW,KAAK,IAAI,GAAG,GAC5B,KAAK,SAAS,GACd,AAAI,EAAU,KAAK,OACd,KAAK,QAEV,KAAK,QAAU,KAAK,aACpB,KAAK,cAAc,SAAW,IAAM,CAChC,KAAK,KAAK,WAAY,MACtB,KAAK,kBAEJ,EAAP,CACE,KAAK,KAAK,QAAS,IAGpB,IAAI,EAA2B,CAClC,MAAO,QAIR,EAAQ", "names": [] } diff --git a/packages/animate/lib/api.js b/packages/animate/lib/api.js index cff3c44..618b81c 100644 --- a/packages/animate/lib/api.js +++ b/packages/animate/lib/api.js @@ -1,2 +1,2 @@ -var animate=(()=>{var F=Object.defineProperty;var J=(i,t)=>{for(var e in t)F(i,e,{get:t[e],enumerable:!0})};var B={};J(B,{Animate:()=>y,DefaultAnimationOptions:()=>k,animate:()=>j,computeValue:()=>L,default:()=>Q,easings:()=>w,getEase:()=>C,getElements:()=>K,getTargets:()=>E,mapObject:()=>x});var m=class{constructor(t){this.map=new Map(t)}getMap(){return this.map}get(t){return this.map.get(t)}keys(){return Array.from(this.map.keys())}values(){return Array.from(this.map.values())}set(t,e){return this.map.set(t,e),this}add(t){let n=this.size;return this.set(n,t),this}get size(){return this.map.size}get length(){return this.map.size}last(t=1){let e=this.keys()[this.size-t];return this.get(e)}delete(t){return this.map.delete(t)}remove(t){return this.map.delete(t),this}clear(){return this.map.clear(),this}has(t){return this.map.has(t)}entries(){return this.map.entries()}forEach(t,e){return this.map.forEach(t,e),this}[Symbol.iterator](){return this.entries()}},z=(i,t,...e)=>{i.forEach(n=>{n[t](...e)})};var v=({callback:i=()=>{},scope:t=null,name:e="event"})=>({callback:i,scope:t,name:e}),g=class extends m{constructor(t="event"){super();this.name=t}},A=class extends m{constructor(){super()}getEvent(t){let e=this.get(t);return e instanceof g?e:(this.set(t,new g(t)),this.get(t))}newListener(t,e,n){let r=this.getEvent(t);return r.add(v({name:t,callback:e,scope:n})),r}on(t,e,n){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let r,s,a=typeof t=="object"&&!Array.isArray(t),o=a?e:n;return a||(s=e),Object.keys(t).forEach(l=>{a?(r=l,s=t[l]):r=t[l],this.newListener(r,s,o)},this),this}removeListener(t,e,n){let r=this.get(t);if(r instanceof g&&e){let s=v({name:t,callback:e,scope:n});r.forEach((a,o)=>{if(a.callback===s.callback&&a.scope===s.scope)return r.remove(o)})}return r}off(t,e,n){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let r,s,a=typeof t=="object"&&!Array.isArray(t),o=a?e:n;return a||(s=e),Object.keys(t).forEach(l=>{a?(r=l,s=t[l]):r=t[l],typeof s=="function"?this.removeListener(r,s,o):this.remove(r)},this),this}emit(t,...e){return typeof t=="undefined"?this:(typeof t=="string"&&(t=t.trim().split(/\s/g)),t.forEach(n=>{let r=this.get(n);r instanceof g&&r.forEach(s=>{let{callback:a,scope:o}=s;a.apply(o,e)})},this),this)}clear(){return z(this,"clear"),super.clear(),this}};var K=i=>typeof i=="string"?Array.from(document.querySelectorAll(i)):[i],G=i=>[].concat(...i),E=i=>Array.isArray(i)?G(i.map(E)):typeof i=="string"||i instanceof Node?K(i):i instanceof NodeList||i instanceof HTMLCollection?Array.from(i):[],L=(i,t,e)=>typeof i=="function"?i.apply(e,t):i,x=(i,t,e)=>{let n,r,s={},a=Object.keys(i);for(let o=0,l=a.length;o/^(in|out)/.test(i)?w[i]:i,k={keyframes:[],loop:1,delay:0,speed:1,endDelay:0,easing:"ease",autoplay:!0,duration:1e3,fillMode:"auto",direction:"normal",extend:{}},y=class{constructor(t={}){this.options={};this.targets=[];this.properties={};this.animations=new m;this.totalDuration=0;this.minDelay=0;this.computedOptions=new m;this.emitter=new A;try{let{options:e,...n}=t,r=e instanceof y?e.getOptions():Array.isArray(e)?e?.[0]?.getOptions():e;this.options=Object.assign({},k,r,n),this.loop=this.loop.bind(this);let{loop:s,delay:a,speed:o,easing:l,endDelay:I,duration:V,direction:D,fillMode:P,onfinish:T,target:S,keyframes:q,autoplay:H,extend:N,..._}=this.options;this.mainElement=document.createElement("div"),this.targets=E(S),this.properties=_;let O=[],b=this.targets.length,f;for(let c=0;c0||(f=x(f,[c,b,p],this));let M=u.delay+u.duration*u.iterations+u.endDelay;this.totalDuration{typeof T=="function"&&T.call(this,p,c,b,h),this.emit("finish",p,c,b,h)},this.computedOptions.set(h,u),this.animations.set(p,h),O.push(u.delay)}this.mainAnimation=this.mainElement.animate([{opacity:"0"},{opacity:"1"}],{duration:this.totalDuration,easing:"linear"}),this.minDelay=Math.min(...O),this.setSpeed(o),H?this.play():this.pause(),this.promise=this.newPromise(),this.mainAnimation.onfinish=()=>{this.emit("complete",this),this.stopLoop()}}catch(e){this.emit("error",e)}}newPromise(){return new Promise((t,e)=>{this.on("complete",()=>t([this])),this.on("error",n=>e(n))})}then(t,e){return t=t?.bind(this),e=e?.bind(this),this.promise.then(t,e),this}catch(t){return t=t?.bind(this),this.promise.catch(t),this}finally(t){return t=t?.bind(this),this.promise.finally(t),this}loop(){this.stopLoop(),this.emit("update",this.getProgress(),this),this.animationFrame=window.requestAnimationFrame(this.loop)}stopLoop(){window.cancelAnimationFrame(this.animationFrame)}all(t){return t(this.mainAnimation),this.animations.forEach(e=>t(e)),this}beginEvent(){if(this.getProgress()==0){let t=window.setTimeout(()=>{this.emit("begin",this),t=window.clearTimeout(t)},this.minDelay)}}play(){let t=this.getPlayState();return this.beginEvent(),this.all(e=>e.play()),this.emit("play",t,this),this.loop(),this}pause(){let t=this.getPlayState();return this.all(e=>e.pause()),this.emit("pause",t,this),this.stopLoop(),this.animationFrame=void 0,this}reset(){return this.setProgress(0),this.beginEvent(),this.options.autoplay?this.play():this.pause(),this}cancel(){return this.all(t=>t.cancel()),this.stopLoop(),this}finish(){return this.all(t=>t.finish()),this.stopLoop(),this}stop(){for(this.cancel(),this.animations.clear();this.targets.length;)this.targets.pop();this.mainElement=void 0,this.emit("stop")}getTargets(){return this.targets}getAnimation(t){return this.animations.get(t)}getTiming(t){let e=t instanceof Animation?t:this.getAnimation(t),n=this.computedOptions.get(e)??{},r=e.effect?.getTiming()??{},s=this.getOptions();return{...k,...s,...r,...n}}getTotalDuration(){return this.totalDuration}getCurrentTime(){return this.mainAnimation.currentTime}getProgress(){return this.getCurrentTime()/this.totalDuration*100}getSpeed(){return this.mainAnimation.playbackRate}getPlayState(){return this.mainAnimation.playState}getOptions(){return this.options}setCurrentTime(t){return this.all(e=>{e.currentTime=t}),this.emit("update",this.getProgress()),this}setProgress(t){let e=t/100*this.totalDuration;return this.setCurrentTime(e),this}setSpeed(t=1){return this.all(e=>{e.playbackRate=t}),this}on(t,e,n){return this.emitter.on(t,e,n??this),this}off(t,e,n){return this.emitter.off(t,e,n??this),this}emit(t,...e){return this.emitter.emit(t,...e),this}toJSON(){return this.getOptions()}get[Symbol.toStringTag](){return"Animate"}},j=(i={})=>new y(i),Q=j;return B;})(); +var animate=(()=>{var J=Object.defineProperty;var B=(i,t)=>{for(var e in t)J(i,e,{get:t[e],enumerable:!0})};var G={};B(G,{Animate:()=>f,DefaultAnimationOptions:()=>k,Timeline:()=>F,animate:()=>_,computeValue:()=>T,default:()=>U,easings:()=>N,getEase:()=>V,getElements:()=>q,getTargets:()=>O,mapObject:()=>x});var y=class{constructor(t){this.map=new Map(t)}getMap(){return this.map}get(t){return this.map.get(t)}keys(){return Array.from(this.map.keys())}values(){return Array.from(this.map.values())}set(t,e){return this.map.set(t,e),this}add(t){let n=this.size;return this.set(n,t),this}get size(){return this.map.size}get length(){return this.map.size}last(t=1){let e=this.keys()[this.size-t];return this.get(e)}delete(t){return this.map.delete(t)}remove(t){return this.map.delete(t),this}clear(){return this.map.clear(),this}has(t){return this.map.has(t)}entries(){return this.map.entries()}forEach(t,e){return this.map.forEach(t,e),this}[Symbol.iterator](){return this.entries()}},H=(i,t,...e)=>{i.forEach(n=>{n[t](...e)})};var S=({callback:i=()=>{},scope:t=null,name:e="event"})=>({callback:i,scope:t,name:e}),L=class extends y{constructor(t="event"){super();this.name=t}},P=class extends y{constructor(){super()}getEvent(t){let e=this.get(t);return e instanceof L?e:(this.set(t,new L(t)),this.get(t))}newListener(t,e,n){let r=this.getEvent(t);return r.add(S({name:t,callback:e,scope:n})),r}on(t,e,n){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let r,s,a=typeof t=="object"&&!Array.isArray(t),p=a?e:n;return a||(s=e),Object.keys(t).forEach(l=>{a?(r=l,s=t[l]):r=t[l],this.newListener(r,s,p)},this),this}removeListener(t,e,n){let r=this.get(t);if(r instanceof L&&e){let s=S({name:t,callback:e,scope:n});r.forEach((a,p)=>{if(a.callback===s.callback&&a.scope===s.scope)return r.remove(p)})}return r}off(t,e,n){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let r,s,a=typeof t=="object"&&!Array.isArray(t),p=a?e:n;return a||(s=e),Object.keys(t).forEach(l=>{a?(r=l,s=t[l]):r=t[l],typeof s=="function"?this.removeListener(r,s,p):this.remove(r)},this),this}emit(t,...e){return typeof t=="undefined"?this:(typeof t=="string"&&(t=t.trim().split(/\s/g)),t.forEach(n=>{let r=this.get(n);r instanceof L&&r.forEach(s=>{let{callback:a,scope:p}=s;a.apply(p,e)})},this),this)}clear(){return H(this,"clear"),super.clear(),this}};var q=i=>typeof i=="string"?Array.from(document.querySelectorAll(i)):[i],Q=i=>[].concat(...i),O=i=>Array.isArray(i)?Q(i.map(O)):typeof i=="string"||i instanceof Node?q(i):i instanceof NodeList||i instanceof HTMLCollection?Array.from(i):[],T=(i,t,e)=>typeof i=="function"?i.apply(e,t):i,x=(i,t,e)=>{let n,r,s={},a=Object.keys(i);for(let p=0,l=a.length;p/^(in|out)/.test(i)?N[i]:i,k={keyframes:[],loop:1,delay:0,speed:1,endDelay:0,easing:"ease",autoplay:!0,duration:1e3,fillMode:"auto",direction:"normal",extend:{}},f=class{constructor(t={}){this.options={};this.targets=[];this.properties={};this.animations=new y;this.totalDuration=0;this.minDelay=0;this.computedOptions=new y;this.emitter=new P;try{let{options:e,...n}=t,r=e instanceof f?e.getOptions():Array.isArray(e)?e?.[0]?.getOptions():e;this.options=Object.assign({},k,r,n),this.loop=this.loop.bind(this);let{loop:s,delay:a,speed:p,easing:l,endDelay:M,duration:K,direction:v,fillMode:z,onfinish:d,target:w,keyframes:D,autoplay:j,extend:C,...I}=this.options;this.mainElement=document.createElement("div"),this.targets=O(w),this.properties=I;let A=[],m=this.targets.length,b;for(let u=0;u0||(b=x(b,[u,m,c],this));let E=o.delay+o.duration*o.iterations+o.endDelay;this.totalDuration{typeof d=="function"&&d.call(this,c,u,m,h),this.emit("finish",c,u,m,h)},this.computedOptions.set(h,o),this.animations.set(c,h),A.push(o.delay)}this.mainAnimation=this.mainElement.animate([{opacity:"0"},{opacity:"1"}],{duration:this.totalDuration,easing:"linear"}),this.minDelay=Math.min(...A),this.setSpeed(p),j?this.play():this.pause(),this.promise=this.newPromise(),this.mainAnimation.onfinish=()=>{this.emit("complete",this),this.stopLoop()}}catch(e){this.emit("error",e)}}newPromise(){return new Promise((t,e)=>{this.on("complete",()=>t([this])),this.on("error",n=>e(n))})}then(t,e){return t=t?.bind(this),e=e?.bind(this),this.promise.then(t,e),this}catch(t){return t=t?.bind(this),this.promise.catch(t),this}finally(t){return t=t?.bind(this),this.promise.finally(t),this}loop(){this.stopLoop(),this.emit("update",this.getProgress(),this),this.animationFrame=window.requestAnimationFrame(this.loop)}stopLoop(){window.cancelAnimationFrame(this.animationFrame)}all(t){return t(this.mainAnimation,this.mainElement),this.animations.forEach(t),this}beginEvent(){if(this.getProgress()==0){let t=window.setTimeout(()=>{this.emit("begin",this),t=window.clearTimeout(t)},this.minDelay)}}play(){let t=this.getPlayState();return this.beginEvent(),this.all(e=>e.play()),this.emit("play",t,this),this.loop(),this}pause(){let t=this.getPlayState();return this.all(e=>e.pause()),this.emit("pause",t,this),this.stopLoop(),this.animationFrame=void 0,this}reset(){return this.setProgress(0),this.beginEvent(),this.options.autoplay?this.play():this.pause(),this}cancel(){return this.all(t=>t.cancel()),this.stopLoop(),this}finish(){return this.all(t=>t.finish()),this.stopLoop(),this}stop(){for(this.cancel(),this.animations.clear();this.targets.length;)this.targets.pop();this.mainElement=void 0,this.emit("stop")}getTargets(){return this.targets}getAnimation(t){return this.animations.get(t)}getTiming(t){let e=t instanceof Animation?t:this.getAnimation(t),n=this.computedOptions.get(e)??{},r=e.effect?.getTiming()??{},s=this.getOptions();return{...k,...s,...r,...n}}getTotalDuration(){return this.totalDuration}getCurrentTime(){return this.mainAnimation.currentTime}getProgress(){return this.getCurrentTime()/this.totalDuration*100}getSpeed(){return this.mainAnimation.playbackRate}getPlayState(){return this.mainAnimation.playState}getOptions(){return this.options}setCurrentTime(t){return this.all(e=>{e.currentTime=t}),this.emit("update",this.getProgress()),this}setProgress(t){let e=t/100*this.totalDuration;return this.setCurrentTime(e),this}setSpeed(t=1){return this.all(e=>{e.playbackRate=t}),this}on(t,e,n){return this.emitter.on(t,e,n??this),this}off(t,e,n){return this.emitter.off(t,e,n??this),this}emit(t,...e){return this.emitter.emit(t,...e),this}toJSON(){return this.getOptions()}get[Symbol.toStringTag](){return"Animate"}},_=(i={})=>new f(i),F=class extends f{constructor(t={}){super();this.animations=new y;try{let{options:e,...n}=t,r=e instanceof f?e.getOptions():Array.isArray(e)?e?.[0]?.getOptions():e;this.options=Object.assign({},k,r,n),this.loop=this.loop.bind(this);let{loop:s,delay:a,speed:p,easing:l,endDelay:M,duration:K,direction:v,fillMode:z,onfinish:d,target:w,keyframes:D,autoplay:j,extend:C,...I}=this.options;this.mainElement=document.createElement("div"),this.targets=O(w),this.properties=I;let A=[],m=this.targets.length,b;for(let u=0;u0||(b=x(b,[u,m,c],this));let E=o.delay+o.duration*o.iterations+o.endDelay;this.totalDuration{typeof d=="function"&&d.call(this,c,u,m,h),this.emit("finish",c,u,m,h)},this.computedOptions.set(h,o),this.animations.set(c,h),A.push(o.delay)}this.mainAnimation=this.mainElement.animate([{opacity:"0"},{opacity:"1"}],{duration:this.totalDuration,easing:"linear"}),this.minDelay=Math.min(...A),this.setSpeed(p),j?this.play():this.pause(),this.promise=this.newPromise(),this.mainAnimation.onfinish=()=>{this.emit("complete",this),this.stopLoop()}}catch(e){this.emit("error",e)}}add(t){return this}},U=_;return G;})(); //# sourceMappingURL=api.js.map diff --git a/packages/animate/lib/api.js.map b/packages/animate/lib/api.js.map index cf86daf..528971d 100644 --- a/packages/animate/lib/api.js.map +++ b/packages/animate/lib/api.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../src/api.ts", "../../manager/src/api.ts", "../../emitter/src/api.ts"], - "sourcesContent": ["import { EventEmitter, EventInput, ListenerCallback } from \"@okikio/emitter\";\nimport { Manager } from \"@okikio/manager\";\n\n// DOM\nexport type AnimationTarget = string | Node | NodeList | HTMLCollection | HTMLElement[] | AnimationTarget[];\nexport const getElements = (selector: string | Node): Node[] => {\n return typeof selector === \"string\" ? Array.from(document.querySelectorAll(selector as string)) : [selector];\n};\n\nconst flatten = (arr: AnimationTarget[]) => [].concat(...arr);\nexport const getTargets = (targets: AnimationTarget): Node[] => {\n if (Array.isArray(targets)) {\n return flatten((targets as AnimationTarget[]).map(getTargets));\n }\n if (typeof targets == \"string\" || targets instanceof Node)\n return getElements(targets);\n if (targets instanceof NodeList || targets instanceof HTMLCollection)\n return Array.from(targets);\n return [];\n};\n\n// VALUES\nexport type closureArgs = [number, number, HTMLElement];\nexport type closure = ((index?: number, total?: number, element?: HTMLElement) => (genericTypes[] | void)) | any;\nexport const computeValue = (value: closure, args: closureArgs, context: Animate) => {\n if (typeof value === \"function\") {\n return value.apply(context, args);\n } else { return value; }\n};\n\nexport const mapObject = (obj: object, args: closureArgs, options: Animate): any => {\n let key: string, value: any, result = {};\n let keys = Object.keys(obj);\n for (let i = 0, len = keys.length; i < len; i++) {\n key = keys[i];\n value = obj[key];\n result[key] = computeValue(value, args, options);\n }\n\n return result;\n};\n\n/** From: [https://easings.net] */\nexport const easings = {\n \"in\": \"ease-in\",\n \"out\": \"ease-out\",\n \"in-out\": \"ease-in-out\",\n\n // Sine\n \"in-sine\": \"cubic-bezier(0.47, 0, 0.745, 0.715)\",\n \"out-sine\": \"cubic-bezier(0.39, 0.575, 0.565, 1)\",\n \"in-out-sine\": \"cubic-bezier(0.445, 0.05, 0.55, 0.95)\",\n\n // Quad\n \"in-quad\": \"cubic-bezier(0.55, 0.085, 0.68, 0.53)\",\n \"out-quad\": \"cubic-bezier(0.25, 0.46, 0.45, 0.94)\",\n \"in-out-quad\": \"cubic-bezier(0.455, 0.03, 0.515, 0.955)\",\n\n // Cubic\n \"in-cubic\": \"cubic-bezier(0.55, 0.055, 0.675, 0.19)\",\n \"out-cubic\": \"cubic-bezier(0.215, 0.61, 0.355, 1)\",\n \"in-out-cubic\": \"cubic-bezier(0.645, 0.045, 0.355, 1)\",\n\n // Quart\n \"in-quart\": \"cubic-bezier(0.895, 0.03, 0.685, 0.22)\",\n \"out-quart\": \"cubic-bezier(0.165, 0.84, 0.44, 1)\",\n \"in-out-quart\": \"cubic-bezier(0.77, 0, 0.175, 1)\",\n\n // Quint\n \"in-quint\": \"cubic-bezier(0.755, 0.05, 0.855, 0.06)\",\n \"out-quint\": \"cubic-bezier(0.23, 1, 0.32, 1)\",\n \"in-out-quint\": \"cubic-bezier(0.86, 0, 0.07, 1)\",\n\n // Expo\n \"in-expo\": \"cubic-bezier(0.95, 0.05, 0.795, 0.035)\",\n \"out-expo\": \"cubic-bezier(0.19, 1, 0.22, 1)\",\n \"in-out-expo\": \"cubic-bezier(1, 0, 0, 1)\",\n\n // Circ\n \"in-circ\": \"cubic-bezier(0.6, 0.04, 0.98, 0.335)\",\n \"out-circ\": \"cubic-bezier(0.075, 0.82, 0.165, 1)\",\n \"in-out-circ\": \"cubic-bezier(0.785, 0.135, 0.15, 0.86)\",\n\n // Back\n \"in-back\": \"cubic-bezier(0.6, -0.28, 0.735, 0.045)\",\n \"out-back\": \"cubic-bezier(0.175, 0.885, 0.32, 1.275)\",\n \"in-out-back\": \"cubic-bezier(0.68, -0.55, 0.265, 1.55)\"\n};\n\nexport const getEase = (ease: string) => {\n return /^(in|out)/.test(ease) ? easings[ease] : ease;\n};\n\nexport type genericTypes = genericTypes[] | boolean | object | string | number | closure | null | undefined;\nexport interface AnimationOptions {\n target?: AnimationTarget,\n\n speed?: number,\n autoplay?: boolean,\n options?: AnimationOptions,\n delay?: number | closure,\n easing?: string | closure,\n endDelay?: number | closure,\n duration?: number | closure,\n keyframes?: Keyframe[] | object[] | closure,\n loop?: number | boolean | closure, // iterations: number,\n onfinish?: (element?: HTMLElement, index?: number, total?: number, animation?: Animation) => any,\n fillMode?: \"none\" | \"forwards\" | \"backwards\" | \"both\" | \"auto\" | closure,\n direction?: \"normal\" | \"reverse\" | \"alternate\" | \"alternate-reverse\" | closure,\n extend?: EffectTiming,\n [property: string]: genericTypes;\n};\n\nexport const DefaultAnimationOptions: AnimationOptions = {\n keyframes: [],\n\n loop: 1, // iterations: number,\n delay: 0,\n speed: 1,\n endDelay: 0,\n easing: \"ease\",\n autoplay: true,\n duration: 1000,\n fillMode: \"auto\",\n direction: \"normal\",\n extend: {}\n};\n\nexport type AnimationEvents = \"update\" | \"play\" | \"pause\" | \"start\" | \"begin\" | \"complete\" | \"finish\" | \"error\" | \"stop\";\n\n/** You can check it out here: https://codepen.io/okikio/pen/qBbdGaW?editors=0011 */\nexport class Animate {\n /**\n * Stores the options for the current animation\n */\n public options: AnimationOptions = {};\n\n /**\n * The Array of Elements to Animate\n */\n public targets: Node[] = [];\n\n /**\n * The properties to animate\n */\n public properties: object = {};\n\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n\n /**\n * The total duration of all Animation's\n */\n public totalDuration: number = 0;\n\n /**\n * The smallest delay out of all Animation's\n */\n public minDelay: number = 0;\n\n /**\n * The options for individual animations\n */\n public computedOptions: Manager = new Manager();\n\n /**\n * The Element the main animation uses\n */\n public mainElement: HTMLElement;\n\n /**\n * Stores an animation that runs on the total duration of the all other Animations, and as such it's the main Animation\n */\n public mainAnimation: Animation;\n\n /**\n * Stores request frame calls\n */\n public animationFrame: number;\n\n /**\n * An event emitter\n */\n public emitter: EventEmitter = new EventEmitter();\n\n /**\n * Returns a promise that is fulfilled when the mainAnimation is finished\n */\n public promise: Promise;\n constructor(options: AnimationOptions = {}) {\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n\n /**\n * Returns a new Promise that is resolve when this.finish is called\n */\n public newPromise(): Promise {\n return new Promise((resolve, reject) => {\n /*\n Note that the `this` keyword is in an Array when it is resolved,\n this is due to Promises not wanting to resolve references,\n so, you can't resolve `this` directly, so, I chose to resolve `this` in an\n Array\n */\n this.on(\"complete\", () => resolve([this]));\n this.on(\"error\", err => reject(err));\n });\n }\n\n /**\n * Fulfills the this.promise Promise\n */\n public then(\n onFulfilled?: (value?: any) => any,\n onRejected?: (reason?: any) => any\n ): Animate {\n onFulfilled = onFulfilled?.bind(this);\n onRejected = onRejected?.bind(this);\n this.promise.then(onFulfilled, onRejected);\n return this;\n }\n\n /**\n * Catches error that occur in the this.promise Promise\n */\n public catch(onRejected: (reason?: any) => any): Animate {\n onRejected = onRejected?.bind(this);\n this.promise.catch(onRejected);\n return this;\n }\n\n /**\n * If you don't care if the this.promise Promise has either been rejected or resolved\n */\n public finally(onFinally: () => any): Animate {\n onFinally = onFinally?.bind(this);\n this.promise.finally(onFinally);\n return this;\n }\n\n /**\n * Represents an Animation Frame Loop\n */\n public loop(): void {\n this.stopLoop();\n this.emit(\"update\", this.getProgress(), this);\n this.animationFrame = window.requestAnimationFrame(this.loop);\n }\n\n /**\n * Cancels animation frame\n */\n public stopLoop() {\n window.cancelAnimationFrame(this.animationFrame);\n }\n\n /**\n * Calls a method that affects all animations including the mainAnimation; the method only allows the animation parameter\n */\n public all(method: (animation: Animation) => void) {\n method(this.mainAnimation);\n this.animations.forEach(animation => method(animation));\n return this;\n }\n\n /**\n * Register the begin event\n */\n protected beginEvent() {\n if (this.getProgress() == 0) {\n let timer: number | void = window.setTimeout(() => {\n this.emit(\"begin\", this);\n timer = window.clearTimeout(timer as number);\n }, this.minDelay);\n }\n }\n\n /**\n * Play Animation\n */\n public play(): Animate {\n let playstate = this.getPlayState();\n this.beginEvent();\n this.all(anim => anim.play());\n this.emit(\"play\", playstate, this);\n this.loop();\n return this;\n }\n\n /**\n * Pause Animation\n */\n public pause(): Animate {\n let playstate = this.getPlayState();\n this.all(anim => anim.pause());\n this.emit(\"pause\", playstate, this);\n this.stopLoop();\n this.animationFrame = undefined;\n return this;\n }\n\n /**\n * Reset all Animations\n */\n public reset() {\n this.setProgress(0);\n this.beginEvent();\n\n if (this.options.autoplay) this.play();\n else this.pause();\n return this;\n }\n\n /**\n * Cancels all Animations\n */\n public cancel() {\n this.all(anim => anim.cancel());\n this.stopLoop();\n return this;\n }\n\n /**\n * Force complete all Animations\n */\n public finish() {\n this.all(anim => anim.finish());\n this.stopLoop();\n return this;\n }\n\n /**\n * Cancels & Clears all Animations\n */\n public stop() {\n this.cancel();\n this.animations.clear();\n while (this.targets.length) this.targets.pop();\n this.mainElement = undefined;\n this.emit(\"stop\");\n }\n\n /**\n * Returns an Array of targets\n */\n public getTargets(): Node[] {\n return this.targets;\n }\n\n /**\n * Get a specific Animation from an Animate instance\n */\n public getAnimation(element: HTMLElement): Animation {\n return this.animations.get(element);\n }\n\n /**\n * Returns the timings of an Animation, given a target\n * E.g. { duration, endDelay, delay, iterations, iterationStart, direction, easing, fill, etc... }\n */\n public getTiming(target: HTMLElement | Animation): AnimationOptions & EffectTiming {\n let animation = target instanceof Animation ? target : this.getAnimation(target);\n let keyframeOptions = this.computedOptions.get(animation) ?? {};\n let timings = animation.effect?.getTiming() ?? {};\n let options = this.getOptions();\n\n return { ...DefaultAnimationOptions, ...options, ...timings, ...keyframeOptions };\n }\n\n /**\n * Returns the total duration of Animation\n */\n public getTotalDuration(): number {\n return this.totalDuration;\n }\n\n /**\n * Returns the current time of the Main Animation\n */\n public getCurrentTime(): number {\n return this.mainAnimation.currentTime;\n }\n\n /**\n * Returns the Animation progress as a fraction of the current time / duration * 100\n */\n public getProgress() {\n return (this.getCurrentTime() / this.totalDuration) * 100;\n }\n\n /**\n * Return the playback speed of the animation\n */\n public getSpeed(): number {\n return this.mainAnimation.playbackRate;\n }\n\n /**\n * Returns the current playing state\n */\n public getPlayState(): \"idle\" | \"running\" | \"paused\" | \"finished\" {\n return this.mainAnimation.playState;\n }\n\n /**\n * Get the options of an Animate instance\n */\n public getOptions(): AnimationOptions {\n return this.options;\n }\n\n /**\n * Set the current time of the Main Animation\n */\n public setCurrentTime(time: number): Animate {\n this.all(anim => { anim.currentTime = time; });\n this.emit(\"update\", this.getProgress());\n return this;\n }\n\n /**\n * Set the Animation progress as a value from 0 to 100\n */\n public setProgress(percent: number): Animate {\n let time = (percent / 100) * this.totalDuration;\n this.setCurrentTime(time);\n return this;\n }\n\n /**\n * Set the playback speed of an Animation\n */\n public setSpeed(speed: number = 1): Animate {\n this.all(anim => { anim.playbackRate = speed; });\n return this;\n }\n\n /**\n * Adds a listener for a given event\n */\n public on(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.on(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Removes a listener from an event\n */\n public off(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.off(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Call all listeners within an event\n */\n public emit(events: AnimationEvents | string | any[], ...args: any): Animate {\n this.emitter.emit(events, ...args);\n return this;\n }\n\n\n /** Returns the Animate options, as JSON */\n public toJSON(): AnimationOptions {\n return this.getOptions();\n }\n\n /**\n * The Symbol.toStringTag well-known symbol is a string valued property that is used\n * in the creation of the default string description of an object.\n * It is accessed internally by the Object.prototype.toString() method.\n */\n get [Symbol.toStringTag]() {\n return `Animate`;\n }\n}\n\n/** Creates a new Animate instance */\nexport const animate = (options: AnimationOptions = {}): Animate => {\n return new Animate(options);\n};\n\nexport default animate;", "/** Manages complex lists of named data, eg. A page can be stored in a list by of other pages with the url being how the page is stored in the list. Managers use Maps to store data */\nexport class Manager {\n\t/** The complex list of named data, to which the Manager controls */\n\tpublic map: Map;\n\tconstructor(value?: Array<[K, V]>) {\n\t\tthis.map = new Map(value);\n\t}\n\n\t/** Returns the Manager classes base Map */\n\tpublic getMap(): Map {\n\t\treturn this.map;\n\t}\n\n\t/** Get a value stored in the Manager */\n\tpublic get(key: K): V {\n\t\treturn this.map.get(key);\n\t}\n\n\t/** Returns the keys of all items stored in the Manager as an Array */\n\tpublic keys(): Array {\n\t\treturn Array.from(this.map.keys());\n\t}\n\n\t/** Returns the values of all items stored in the Manager as an Array */\n\tpublic values(): Array {\n\t\treturn Array.from(this.map.values());\n\t}\n\n\t/** Set a value to the Manager using a key */\n\tpublic set(key: K, value: V): Manager {\n\t\tthis.map.set(key, value);\n\t\treturn this;\n\t}\n\n\t/** Adds a value to Manager, and uses the current size of the Manager as it's key, it works best when all the key in the Manager are numbers */\n\tpublic add(value: V): Manager {\n\t\tlet size = this.size;\n\t\t// @ts-ignore\n\t\tlet num: K = size as K;\n\t\tthis.set(num, value);\n\t\treturn this;\n\t}\n\n\t/** Returns the total number of items stored in the Manager */\n\tpublic get size(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** An alias for size */\n\tpublic get length(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** Returns the last item in the Manager who's index is a certain distance from the last item in the Manager */\n\tpublic last(distance: number = 1): V | undefined {\n\t\tlet key = this.keys()[this.size - distance];\n\t\treturn this.get(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns true if an element in the Map object existed and has been removed, or false if the element does not exist */\n\tpublic delete(key: K): boolean {\n\t\treturn this.map.delete(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns the Manager class, allowing for chains */\n\tpublic remove(key: K): Manager {\n\t\tthis.map.delete(key);\n\t\treturn this;\n\t}\n\n\t/** Clear the Manager of all its contents */\n\tpublic clear(): Manager {\n\t\tthis.map.clear();\n\t\treturn this;\n\t}\n\n\t/** Checks if the Manager contains a certain key */\n\tpublic has(key: K): boolean {\n\t\treturn this.map.has(key);\n\t}\n\n\t/** Returns a new Iterator object that contains an array of [key, value] for each element in the Map object in insertion order. */\n\tpublic entries(): IterableIterator<[K, V]> {\n\t\treturn this.map.entries();\n\t}\n\n\t/** Iterates through the Managers contents, calling a callback function every iteration */\n\tpublic forEach(\n\t\tcallback: (value?: V, key?: K, map?: Map) => void,\n\t\tcontext?: object\n\t): Manager {\n\t\tthis.map.forEach(callback, context);\n\t\treturn this;\n\t}\n\n\t/** Allows for iteration via for..of, learn more: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators] */\n\tpublic [Symbol.iterator](): IterableIterator<[K, V]> {\n\t\treturn this.entries();\n\t}\n}\n\n/**\n * Calls the method of a certain name for all items that are currently installed\n */\nexport const methodCall = (manager: Manager, method: string, ...args: any): void => {\n\tmanager.forEach((item) => {\n\t\t// @ts-ignore\n\t\titem[method](...args);\n\t});\n};\n\n/**\n * Asynchronously calls the method of a certain name for all items that are currently installed, similar to methodCall\n */\nexport const asyncMethodCall = async (manager: Manager, method: string, ...args: any): Promise => {\n\tfor (let [, item] of manager) {\n\t\t// @ts-ignore\n\t\tawait item[method](...args);\n\t}\n};\n\nexport default Manager;\n", "import { Manager, methodCall } from \"@okikio/manager\";\n\nexport type ListenerCallback = ((...args: any) => void);\nexport interface IListener {\n readonly callback: ListenerCallback;\n readonly scope: object;\n readonly name: string;\n}\n\n/** Represents a new event listener consisting of properties like: callback, scope, name */\nexport const newListener = ({\n callback = () => { },\n scope = null,\n name = \"event\",\n}: IListener): IListener => ({ callback, scope, name });\n\n/** Represents a new event */\nexport class Event extends Manager {\n /** The name of the event */\n public name: string;\n constructor(name: string = \"event\") {\n super();\n this.name = name;\n }\n}\n\nexport type EventInput = string | object | Array;\n\n/**\n * An Event Emitter\n * */\nexport class EventEmitter extends Manager {\n constructor() {\n super();\n }\n\n /** Gets event, if event doesn't exist create a new one */\n public getEvent(name: string): Event {\n let event = this.get(name);\n if (!(event instanceof Event)) {\n this.set(name, new Event(name));\n return this.get(name);\n }\n\n return event;\n }\n\n /** Creates a listener and adds it to an event */\n public newListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event = this.getEvent(name);\n event.add(newListener({ name, callback, scope }));\n return event;\n }\n\n /** Adds a listener to a given event */\n public on(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n this.newListener(_name, _callback, _scope);\n }, this);\n return this;\n }\n\n /** Removes a listener from an event */\n public removeListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event: Event = this.get(name);\n if (event instanceof Event && callback) {\n let listener = newListener({ name, callback, scope });\n\n event.forEach((value: IListener, i: number) => {\n if (\n value.callback === listener.callback &&\n value.scope === listener.scope\n ) {\n return event.remove(i);\n }\n });\n }\n\n return event;\n }\n\n /** Remove a listener from a given event, or just completely remove an event */\n public off(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n if (typeof _callback === \"function\") {\n this.removeListener(_name, _callback, _scope);\n } else this.remove(_name);\n }, this);\n return this;\n }\n\n /** Call all listeners within an event */\n public emit(\n events: string | Array,\n ...args: any\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n // Loop through the list of events\n events.forEach((event: string) => {\n let _event: Event = this.get(event);\n\n if (_event instanceof Event) {\n _event.forEach((listener: IListener) => {\n let { callback, scope } = listener;\n callback.apply(scope, args);\n });\n }\n }, this);\n return this;\n }\n\n /** Clears events and event listeners */\n public clear() {\n methodCall(this, \"clear\");\n super.clear();\n return this;\n }\n}\n\nexport default EventEmitter;\n"], - "mappings": "4GAAA,0LCCO,WAAoB,CAG1B,YAAY,EAAuB,CAClC,KAAK,IAAM,GAAI,KAAI,GAIb,QAAoB,CAC1B,MAAO,MAAK,IAIN,IAAI,EAAW,CACrB,MAAO,MAAK,IAAI,IAAI,GAId,MAAiB,CACvB,MAAO,OAAM,KAAK,KAAK,IAAI,QAIrB,QAAmB,CACzB,MAAO,OAAM,KAAK,KAAK,IAAI,UAIrB,IAAI,EAAQ,EAAyB,CAC3C,YAAK,IAAI,IAAI,EAAK,GACX,KAID,IAAI,EAAyB,CAGnC,GAAI,GAFO,KAAK,KAGhB,YAAK,IAAI,EAAK,GACP,QAIG,OAAe,CACzB,MAAO,MAAK,IAAI,QAIN,SAAiB,CAC3B,MAAO,MAAK,IAAI,KAIV,KAAK,EAAmB,EAAkB,CAChD,GAAI,GAAM,KAAK,OAAO,KAAK,KAAO,GAClC,MAAO,MAAK,IAAI,GAIV,OAAO,EAAiB,CAC9B,MAAO,MAAK,IAAI,OAAO,GAIjB,OAAO,EAAuB,CACpC,YAAK,IAAI,OAAO,GACT,KAID,OAAuB,CAC7B,YAAK,IAAI,QACF,KAID,IAAI,EAAiB,CAC3B,MAAO,MAAK,I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QX,OAAO,cAAe,CACvB,MAAO,YAKF,EAAU,CAAC,EAA4B,KACzC,GAAI,GAAQ,GAGhB,EAAQ", + "sourcesContent": ["import { EventEmitter, EventInput, ListenerCallback } from \"@okikio/emitter\";\nimport { Manager } from \"@okikio/manager\";\n\n// DOM\nexport type AnimationTarget = string | Node | NodeList | HTMLCollection | HTMLElement[] | AnimationTarget[];\nexport const getElements = (selector: string | Node): Node[] => {\n return typeof selector === \"string\" ? Array.from(document.querySelectorAll(selector as string)) : [selector];\n};\n\nconst flatten = (arr: AnimationTarget[]) => [].concat(...arr);\nexport const getTargets = (targets: AnimationTarget): Node[] => {\n if (Array.isArray(targets)) {\n return flatten((targets as AnimationTarget[]).map(getTargets));\n }\n if (typeof targets == \"string\" || targets instanceof Node)\n return getElements(targets);\n if (targets instanceof NodeList || targets instanceof HTMLCollection)\n return Array.from(targets);\n return [];\n};\n\n// VALUES\nexport type closureArgs = [number, number, HTMLElement];\nexport type closure = ((index?: number, total?: number, element?: HTMLElement) => (genericTypes[] | void)) | any;\nexport const computeValue = (value: closure, args: closureArgs, context: Animate) => {\n if (typeof value === \"function\") {\n return value.apply(context, args);\n } else { return value; }\n};\n\nexport const mapObject = (obj: object, args: closureArgs, options: Animate): any => {\n let key: string, value: any, result = {};\n let keys = Object.keys(obj);\n for (let i = 0, len = keys.length; i < len; i++) {\n key = keys[i];\n value = obj[key];\n result[key] = computeValue(value, args, options);\n }\n\n return result;\n};\n\n/** From: [https://easings.net] */\nexport const easings = {\n \"in\": \"ease-in\",\n \"out\": \"ease-out\",\n \"in-out\": \"ease-in-out\",\n\n // Sine\n \"in-sine\": \"cubic-bezier(0.47, 0, 0.745, 0.715)\",\n \"out-sine\": \"cubic-bezier(0.39, 0.575, 0.565, 1)\",\n \"in-out-sine\": \"cubic-bezier(0.445, 0.05, 0.55, 0.95)\",\n\n // Quad\n \"in-quad\": \"cubic-bezier(0.55, 0.085, 0.68, 0.53)\",\n \"out-quad\": \"cubic-bezier(0.25, 0.46, 0.45, 0.94)\",\n \"in-out-quad\": \"cubic-bezier(0.455, 0.03, 0.515, 0.955)\",\n\n // Cubic\n \"in-cubic\": \"cubic-bezier(0.55, 0.055, 0.675, 0.19)\",\n \"out-cubic\": \"cubic-bezier(0.215, 0.61, 0.355, 1)\",\n \"in-out-cubic\": \"cubic-bezier(0.645, 0.045, 0.355, 1)\",\n\n // Quart\n \"in-quart\": \"cubic-bezier(0.895, 0.03, 0.685, 0.22)\",\n \"out-quart\": \"cubic-bezier(0.165, 0.84, 0.44, 1)\",\n \"in-out-quart\": \"cubic-bezier(0.77, 0, 0.175, 1)\",\n\n // Quint\n \"in-quint\": \"cubic-bezier(0.755, 0.05, 0.855, 0.06)\",\n \"out-quint\": \"cubic-bezier(0.23, 1, 0.32, 1)\",\n \"in-out-quint\": \"cubic-bezier(0.86, 0, 0.07, 1)\",\n\n // Expo\n \"in-expo\": \"cubic-bezier(0.95, 0.05, 0.795, 0.035)\",\n \"out-expo\": \"cubic-bezier(0.19, 1, 0.22, 1)\",\n \"in-out-expo\": \"cubic-bezier(1, 0, 0, 1)\",\n\n // Circ\n \"in-circ\": \"cubic-bezier(0.6, 0.04, 0.98, 0.335)\",\n \"out-circ\": \"cubic-bezier(0.075, 0.82, 0.165, 1)\",\n \"in-out-circ\": \"cubic-bezier(0.785, 0.135, 0.15, 0.86)\",\n\n // Back\n \"in-back\": \"cubic-bezier(0.6, -0.28, 0.735, 0.045)\",\n \"out-back\": \"cubic-bezier(0.175, 0.885, 0.32, 1.275)\",\n \"in-out-back\": \"cubic-bezier(0.68, -0.55, 0.265, 1.55)\"\n};\n\nexport const getEase = (ease: string) => {\n return /^(in|out)/.test(ease) ? easings[ease] : ease;\n};\n\nexport type genericTypes = genericTypes[] | boolean | object | string | number | closure | null | undefined;\nexport interface AnimationOptions {\n target?: AnimationTarget,\n\n speed?: number,\n autoplay?: boolean,\n options?: AnimationOptions,\n delay?: number | closure,\n easing?: string | closure,\n endDelay?: number | closure,\n duration?: number | closure,\n keyframes?: Keyframe[] | object[] | closure,\n loop?: number | boolean | closure, // iterations: number,\n onfinish?: (element?: HTMLElement, index?: number, total?: number, animation?: Animation) => any,\n fillMode?: \"none\" | \"forwards\" | \"backwards\" | \"both\" | \"auto\" | closure,\n direction?: \"normal\" | \"reverse\" | \"alternate\" | \"alternate-reverse\" | closure,\n extend?: EffectTiming,\n [property: string]: genericTypes;\n};\n\nexport const DefaultAnimationOptions: AnimationOptions = {\n keyframes: [],\n\n loop: 1, // iterations: number,\n delay: 0,\n speed: 1,\n endDelay: 0,\n easing: \"ease\",\n autoplay: true,\n duration: 1000,\n fillMode: \"auto\",\n direction: \"normal\",\n extend: {}\n};\n\nexport type AnimationEvents = \"update\" | \"play\" | \"pause\" | \"start\" | \"begin\" | \"complete\" | \"finish\" | \"error\" | \"stop\";\n\n/** You can check it out here: https://codepen.io/okikio/pen/qBbdGaW?editors=0011 */\nexport class Animate {\n /**\n * Stores the options for the current animation\n */\n public options: AnimationOptions = {};\n\n /**\n * The Array of Elements to Animate\n */\n public targets: Node[] = [];\n\n /**\n * The properties to animate\n */\n public properties: object = {};\n\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n\n /**\n * The total duration of all Animation's\n */\n public totalDuration: number = 0;\n\n /**\n * The smallest delay out of all Animation's\n */\n public minDelay: number = 0;\n\n /**\n * The options for individual animations\n */\n public computedOptions: Manager = new Manager();\n\n /**\n * The Element the main animation uses\n */\n public mainElement: HTMLElement;\n\n /**\n * Stores an animation that runs on the total duration of the all other Animations, and as such it's the main Animation\n */\n public mainAnimation: Animation;\n\n /**\n * Stores request frame calls\n */\n public animationFrame: number;\n\n /**\n * An event emitter\n */\n public emitter: EventEmitter = new EventEmitter();\n\n /**\n * Returns a promise that is fulfilled when the mainAnimation is finished\n */\n public promise: Promise;\n constructor(options: AnimationOptions = {}) {\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n\n /**\n * Returns a new Promise that is resolve when this.finish is called\n */\n public newPromise(): Promise {\n return new Promise((resolve, reject) => {\n /*\n Note that the `this` keyword is in an Array when it is resolved,\n this is due to Promises not wanting to resolve references,\n so, you can't resolve `this` directly, so, I chose to resolve `this` in an\n Array\n */\n this.on(\"complete\", () => resolve([this]));\n this.on(\"error\", err => reject(err));\n });\n }\n\n /**\n * Fulfills the this.promise Promise\n */\n public then(\n onFulfilled?: (value?: any) => any,\n onRejected?: (reason?: any) => any\n ): Animate {\n onFulfilled = onFulfilled?.bind(this);\n onRejected = onRejected?.bind(this);\n this.promise.then(onFulfilled, onRejected);\n return this;\n }\n\n /**\n * Catches error that occur in the this.promise Promise\n */\n public catch(onRejected: (reason?: any) => any): Animate {\n onRejected = onRejected?.bind(this);\n this.promise.catch(onRejected);\n return this;\n }\n\n /**\n * If you don't care if the this.promise Promise has either been rejected or resolved\n */\n public finally(onFinally: () => any): Animate {\n onFinally = onFinally?.bind(this);\n this.promise.finally(onFinally);\n return this;\n }\n\n /**\n * Represents an Animation Frame Loop\n */\n public loop(): void {\n this.stopLoop();\n this.emit(\"update\", this.getProgress(), this);\n this.animationFrame = window.requestAnimationFrame(this.loop);\n }\n\n /**\n * Cancels animation frame\n */\n public stopLoop() {\n window.cancelAnimationFrame(this.animationFrame);\n }\n\n /**\n * Calls a method that affects all animations including the mainAnimation; the method only allows the animation parameter\n */\n public all(method: (animation?: Animation, target?: HTMLElement) => void) {\n method(this.mainAnimation, this.mainElement);\n this.animations.forEach(method);\n return this;\n }\n\n /**\n * Register the begin event\n */\n protected beginEvent() {\n if (this.getProgress() == 0) {\n let timer: number | void = window.setTimeout(() => {\n this.emit(\"begin\", this);\n timer = window.clearTimeout(timer as number);\n }, this.minDelay);\n }\n }\n\n /**\n * Play Animation\n */\n public play(): Animate {\n let playstate = this.getPlayState();\n this.beginEvent();\n this.all(anim => anim.play());\n this.emit(\"play\", playstate, this);\n this.loop();\n return this;\n }\n\n /**\n * Pause Animation\n */\n public pause(): Animate {\n let playstate = this.getPlayState();\n this.all(anim => anim.pause());\n this.emit(\"pause\", playstate, this);\n this.stopLoop();\n this.animationFrame = undefined;\n return this;\n }\n\n /**\n * Reset all Animations\n */\n public reset() {\n this.setProgress(0);\n this.beginEvent();\n\n if (this.options.autoplay) this.play();\n else this.pause();\n return this;\n }\n\n /**\n * Cancels all Animations\n */\n public cancel() {\n this.all(anim => anim.cancel());\n this.stopLoop();\n return this;\n }\n\n /**\n * Force complete all Animations\n */\n public finish() {\n this.all(anim => anim.finish());\n this.stopLoop();\n return this;\n }\n\n /**\n * Cancels & Clears all Animations\n */\n public stop() {\n this.cancel();\n this.animations.clear();\n while (this.targets.length) this.targets.pop();\n this.mainElement = undefined;\n this.emit(\"stop\");\n }\n\n /**\n * Returns an Array of targets\n */\n public getTargets(): Node[] {\n return this.targets;\n }\n\n /**\n * Get a specific Animation from an Animate instance\n */\n public getAnimation(element: HTMLElement): Animation {\n return this.animations.get(element);\n }\n\n /**\n * Returns the timings of an Animation, given a target\n * E.g. { duration, endDelay, delay, iterations, iterationStart, direction, easing, fill, etc... }\n */\n public getTiming(target: HTMLElement | Animation): AnimationOptions & EffectTiming {\n let animation = target instanceof Animation ? target : this.getAnimation(target);\n let keyframeOptions = this.computedOptions.get(animation) ?? {};\n let timings = animation.effect?.getTiming() ?? {};\n let options = this.getOptions();\n\n return { ...DefaultAnimationOptions, ...options, ...timings, ...keyframeOptions };\n }\n\n /**\n * Returns the total duration of Animation\n */\n public getTotalDuration(): number {\n return this.totalDuration;\n }\n\n /**\n * Returns the current time of the Main Animation\n */\n public getCurrentTime(): number {\n return this.mainAnimation.currentTime;\n }\n\n /**\n * Returns the Animation progress as a fraction of the current time / duration * 100\n */\n public getProgress() {\n return (this.getCurrentTime() / this.totalDuration) * 100;\n }\n\n /**\n * Return the playback speed of the animation\n */\n public getSpeed(): number {\n return this.mainAnimation.playbackRate;\n }\n\n /**\n * Returns the current playing state\n */\n public getPlayState(): \"idle\" | \"running\" | \"paused\" | \"finished\" {\n return this.mainAnimation.playState;\n }\n\n /**\n * Get the options of an Animate instance\n */\n public getOptions(): AnimationOptions {\n return this.options;\n }\n\n /**\n * Set the current time of the Main Animation\n */\n public setCurrentTime(time: number): Animate {\n this.all(anim => { anim.currentTime = time; });\n this.emit(\"update\", this.getProgress());\n return this;\n }\n\n /**\n * Set the Animation progress as a value from 0 to 100\n */\n public setProgress(percent: number): Animate {\n let time = (percent / 100) * this.totalDuration;\n this.setCurrentTime(time);\n return this;\n }\n\n /**\n * Set the playback speed of an Animation\n */\n public setSpeed(speed: number = 1): Animate {\n this.all(anim => { anim.playbackRate = speed; });\n return this;\n }\n\n /**\n * Adds a listener for a given event\n */\n public on(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.on(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Removes a listener from an event\n */\n public off(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.off(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Call all listeners within an event\n */\n public emit(events: AnimationEvents | string | any[], ...args: any): Animate {\n this.emitter.emit(events, ...args);\n return this;\n }\n\n\n /** Returns the Animate options, as JSON */\n public toJSON(): AnimationOptions {\n return this.getOptions();\n }\n\n /**\n * The Symbol.toStringTag well-known symbol is a string valued property that is used\n * in the creation of the default string description of an object.\n * It is accessed internally by the Object.prototype.toString() method.\n */\n get [Symbol.toStringTag]() {\n return `Animate`;\n }\n}\n\n/** Creates a new Animate instance */\nexport const animate = (options: AnimationOptions = {}): Animate => {\n return new Animate(options);\n};\n\nexport class Timeline extends Animate {\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n constructor(options: AnimationOptions = {}) {\n super();\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n public add(options: AnimationOptions) {\n return this;\n }\n}\n\nexport default animate;", "/** Manages complex lists of named data, eg. A page can be stored in a list by of other pages with the url being how the page is stored in the list. Managers use Maps to store data */\nexport class Manager {\n\t/** The complex list of named data, to which the Manager controls */\n\tpublic map: Map;\n\tconstructor(value?: Array<[K, V]>) {\n\t\tthis.map = new Map(value);\n\t}\n\n\t/** Returns the Manager classes base Map */\n\tpublic getMap(): Map {\n\t\treturn this.map;\n\t}\n\n\t/** Get a value stored in the Manager */\n\tpublic get(key: K): V {\n\t\treturn this.map.get(key);\n\t}\n\n\t/** Returns the keys of all items stored in the Manager as an Array */\n\tpublic keys(): Array {\n\t\treturn Array.from(this.map.keys());\n\t}\n\n\t/** Returns the values of all items stored in the Manager as an Array */\n\tpublic values(): Array {\n\t\treturn Array.from(this.map.values());\n\t}\n\n\t/** Set a value to the Manager using a key */\n\tpublic set(key: K, value: V): Manager {\n\t\tthis.map.set(key, value);\n\t\treturn this;\n\t}\n\n\t/** Adds a value to Manager, and uses the current size of the Manager as it's key, it works best when all the key in the Manager are numbers */\n\tpublic add(value: V): Manager {\n\t\tlet size = this.size;\n\t\t// @ts-ignore\n\t\tlet num: K = size as K;\n\t\tthis.set(num, value);\n\t\treturn this;\n\t}\n\n\t/** Returns the total number of items stored in the Manager */\n\tpublic get size(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** An alias for size */\n\tpublic get length(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** Returns the last item in the Manager who's index is a certain distance from the last item in the Manager */\n\tpublic last(distance: number = 1): V | undefined {\n\t\tlet key = this.keys()[this.size - distance];\n\t\treturn this.get(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns true if an element in the Map object existed and has been removed, or false if the element does not exist */\n\tpublic delete(key: K): boolean {\n\t\treturn this.map.delete(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns the Manager class, allowing for chains */\n\tpublic remove(key: K): Manager {\n\t\tthis.map.delete(key);\n\t\treturn this;\n\t}\n\n\t/** Clear the Manager of all its contents */\n\tpublic clear(): Manager {\n\t\tthis.map.clear();\n\t\treturn this;\n\t}\n\n\t/** Checks if the Manager contains a certain key */\n\tpublic has(key: K): boolean {\n\t\treturn this.map.has(key);\n\t}\n\n\t/** Returns a new Iterator object that contains an array of [key, value] for each element in the Map object in insertion order. */\n\tpublic entries(): IterableIterator<[K, V]> {\n\t\treturn this.map.entries();\n\t}\n\n\t/** Iterates through the Managers contents, calling a callback function every iteration */\n\tpublic forEach(\n\t\tcallback: (value?: V, key?: K, map?: Map) => void,\n\t\tcontext?: object\n\t): Manager {\n\t\tthis.map.forEach(callback, context);\n\t\treturn this;\n\t}\n\n\t/** Allows for iteration via for..of, learn more: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators] */\n\tpublic [Symbol.iterator](): IterableIterator<[K, V]> {\n\t\treturn this.entries();\n\t}\n}\n\n/**\n * Calls the method of a certain name for all items that are currently installed\n */\nexport const methodCall = (manager: Manager, method: string, ...args: any): void => {\n\tmanager.forEach((item) => {\n\t\t// @ts-ignore\n\t\titem[method](...args);\n\t});\n};\n\n/**\n * Asynchronously calls the method of a certain name for all items that are currently installed, similar to methodCall\n */\nexport const asyncMethodCall = async (manager: Manager, method: string, ...args: any): Promise => {\n\tfor (let [, item] of manager) {\n\t\t// @ts-ignore\n\t\tawait item[method](...args);\n\t}\n};\n\nexport default Manager;\n", "import { Manager, methodCall } from \"@okikio/manager\";\n\nexport type ListenerCallback = ((...args: any) => void);\nexport interface IListener {\n readonly callback: ListenerCallback;\n readonly scope: object;\n readonly name: string;\n}\n\n/** Represents a new event listener consisting of properties like: callback, scope, name */\nexport const newListener = ({\n callback = () => { },\n scope = null,\n name = \"event\",\n}: IListener): IListener => ({ callback, scope, name });\n\n/** Represents a new event */\nexport class Event extends Manager {\n /** The name of the event */\n public name: string;\n constructor(name: string = \"event\") {\n super();\n this.name = name;\n }\n}\n\nexport type EventInput = string | object | Array;\n\n/**\n * An Event Emitter\n * */\nexport class EventEmitter extends Manager {\n constructor() {\n super();\n }\n\n /** Gets event, if event doesn't exist create a new one */\n public getEvent(name: string): Event {\n let event = this.get(name);\n if (!(event instanceof Event)) {\n this.set(name, new Event(name));\n return this.get(name);\n }\n\n return event;\n }\n\n /** Creates a listener and adds it to an event */\n public newListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event = this.getEvent(name);\n event.add(newListener({ name, callback, scope }));\n return event;\n }\n\n /** Adds a listener to a given event */\n public on(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n this.newListener(_name, _callback, _scope);\n }, this);\n return this;\n }\n\n /** Removes a listener from an event */\n public removeListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event: Event = this.get(name);\n if (event instanceof Event && callback) {\n let listener = newListener({ name, callback, scope });\n\n event.forEach((value: IListener, i: number) => {\n if (\n value.callback === listener.callback &&\n value.scope === listener.scope\n ) {\n return event.remove(i);\n }\n });\n }\n\n return event;\n }\n\n /** Remove a listener from a given event, or just completely remove an event */\n public off(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n if (typeof _callback === \"function\") {\n this.removeListener(_name, _callback, _scope);\n } else this.remove(_name);\n }, this);\n return this;\n }\n\n /** Call all listeners within an event */\n public emit(\n events: string | Array,\n ...args: any\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n // Loop through the list of events\n events.forEach((event: string) => {\n let _event: Event = this.get(event);\n\n if (_event instanceof Event) {\n _event.forEach((listener: IListener) => {\n let { callback, scope } = listener;\n callback.apply(scope, args);\n });\n }\n }, this);\n return this;\n }\n\n /** Clears events and event listeners */\n public clear() {\n methodCall(this, \"clear\");\n super.clear();\n return this;\n }\n}\n\nexport default EventEmitter;\n"], + "mappings": "4GAAA,yMCCO,WAAoB,CAG1B,YAAY,EAAuB,CAClC,KAAK,IA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65 100644 --- a/packages/native/lib/api.cjs.js +++ b/packages/native/lib/api.cjs.js @@ -1,3 +1,3 @@ -var B=Object.defineProperty;var mt=r=>B(r,"__esModule",{value:!0});var gt=(r,t)=>{for(var e in t)B(r,e,{get:t[e],enumerable:!0})};mt(exports);gt(exports,{AdvancedManager:()=>w,Animate:()=>R,App:()=>it,CONFIG_DEFAULTS:()=>W,DefaultAnimationOptions:()=>G,Event:()=>v,EventEmitter:()=>T,HistoryManager:()=>X,Manager:()=>h,ManagerItem:()=>x,PARSER:()=>Z,PJAX:()=>rt,Page:()=>N,PageManager:()=>tt,Router:()=>nt,Service:()=>g,ServiceManager:()=>H,TransitionManager:()=>et,animate:()=>yt,asyncMethodCall:()=>J,changeState:()=>Q,clean:()=>U,computeValue:()=>j,easings:()=>ot,equal:()=>S,getConfig:()=>u,getEase:()=>at,getElements:()=>st,getHash:()=>bt,getHashedPath:()=>b,getTargets:()=>F,hashAction:()=>D,mapObject:()=>V,methodCall:()=>A,newConfig:()=>_,newCoords:()=>d,newListener:()=>z,newState:()=>k,newURL:()=>c,toAttr:()=>Y});var W={wrapperAttr:"wrapper",noAjaxLinkAttr:"no-ajax-link",noPrefetchAttr:"no-prefetch",headers:[["x-partial","true"]],preventSelfAttr:'prevent="self"',preventAllAttr:'prevent="all"',transitionAttr:"transition",blockAttr:"block",timeout:3e4},_=r=>Object.assign({...W},r),Y=(r,t,e=!0)=>{let{prefix:i}=r,n=`data${i?"-"+i:""}-${t}`;return e?`[${n}]`:n},u=(r,t,e=!0)=>{if(typeof t!="string")return r;let i=r[t];return typeof i=="string"?Y(r,i,e):i};var h=class{constructor(t){this.map=new Map(t)}getMap(){return this.map}get(t){return this.map.get(t)}keys(){return Array.from(this.map.keys())}values(){return Array.from(this.map.values())}set(t,e){return this.map.set(t,e),this}add(t){let i=this.size;return this.set(i,t),this}get size(){return this.map.size}get length(){return this.map.size}last(t=1){let e=this.keys()[this.size-t];return this.get(e)}delete(t){return this.map.delete(t)}remove(t){return this.map.delete(t),this}clear(){return this.map.clear(),this}has(t){return this.map.has(t)}entries(){return this.map.entries()}forEach(t,e){return this.map.forEach(t,e),this}[Symbol.iterator](){return this.entries()}},A=(r,t,...e)=>{r.forEach(i=>{i[t](...e)})},J=async(r,t,...e)=>{for(let[,i]of r)await i[t](...e)};var x=class{constructor(){}install(){}register(t,e){return this.manager=t,this.app=t.app,this.config=t.config,this.emitter=t.emitter,this.key=e,this.install(),this}uninstall(){}unregister(){this.uninstall(),this.manager.remove(this.key),this.key=void 0,this.manager=void 0,this.app=void 0,this.config=void 0,this.emitter=void 0}},w=class extends h{constructor(t){super();this.app=t,this.config=t.config,this.emitter=t.emitter}set(t,e){return super.set(t,e),e.register(this,t),this}};var c=(r=window.location.href)=>r instanceof URL?r:new URL(r,window.location.origin),b=r=>`${r.pathname}${r.hash}`,bt=r=>r.hash.slice(1),U=r=>r.toString().replace(/(\/#.*|\/|#.*)$/,""),S=(r,t)=>{let e=c(r),i=c(t);return U(e)===U(i)};var g=class extends x{init(){}boot(){this.initEvents()}initEvents(){}stopEvents(){}stop(){this.stopEvents(),this.unregister()}},H=class extends w{constructor(t){super(t)}init(){return A(this,"init"),this}boot(){return A(this,"boot"),this}stop(){return A(this,"stop"),this}};var d=(r=window.scrollX,t=window.scrollY)=>({x:r,y:t}),k=(r={url:b(c()),index:0,transition:"default",data:{scroll:d(),trigger:"HistoryManager"}})=>r,X=class extends g{constructor(){super(...arguments);this.pointer=-1}init(){this.states=[];let t=k();this.add(t,"replace")}get(t){return this.states[t]}add(t,e="push"){let i=k(t),n=this.length;this.states.push({...i}),this.pointer=n;let s={index:this.pointer,states:[...this.states]};return Q(e,i,s),this}remove(t){return t?this.states.splice(t,1):this.states.pop(),this.pointer--,this}replace(t){return this.states=t,this}set(t,e){return this.states[t]=e}get current(){return this.get(this.pointer)}get last(){return this.get(this.length-1)}get previous(){return this.pointer<1?null:this.get(this.pointer-1)}get length(){return this.states.length}},Q=(r,t,e)=>{let i=b(c(t.url)),n=[e,"",i];if(window.history)switch(r){case"push":window.history.pushState.apply(window.history,n);break;case"replace":window.history.replaceState.apply(window.history,n);break}};var Z=new DOMParser,N=class extends x{constructor(t=c(),e=document){super();this.url=t,typeof e=="string"?this.data=e:this.dom=e||document}build(){if(this.dom instanceof Node||(this.dom=Z.parseFromString(this.data,"text/html")),!(this.body instanceof Node)){let{title:t,head:e,body:i}=this.dom;this.title=t,this.head=e,this.body=i,this.wrapper=this.body.querySelector(this.wrapperAttr)}}install(){this.wrapperAttr=u(this.config,"wrapperAttr")}uninstall(){this.url=void 0,this.title=void 0,this.head=void 0,this.body=void 0,this.dom=void 0,this.wrapper=void 0,this.data=void 0,this.wrapperAttr=void 0}},tt=class extends g{constructor(){super(...arguments);this.loading=new h}install(){this.pages=new w(this.app),this.maxPages=this.config.maxPages??5;let t=c().pathname;this.set(t,new N),t=void 0}get(t){return this.pages.get(t)}add(t){return this.pages.add(t),this}set(t,e){return this.pages.set(t,e),this}remove(t){return this.pages.remove(t),this}has(t){return this.pages.has(t)}clear(){return this.pages.clear(),this}get size(){return this.pages.size}keys(){return this.pages.keys()}async load(t=c()){let e=c(t),i=e.pathname,n,s;if(this.has(i))return n=this.get(i),Promise.resolve(n);this.loading.has(i)?s=this.loading.get(i):(s=this.request(i),this.loading.set(i,s));let a=await s;if(this.loading.remove(i),n=new N(e,a),this.set(i,n),this.size>this.maxPages){let l=c(),o=this.keys(),p=S(l,o[0])?o[1]:o[0],m=this.get(p);m.unregister(),m=void 0,o=void 0,l=void 0,p=void 0}return n}async request(t){let e=new Headers(u(this.config,"headers")),i=window.setTimeout(()=>{throw window.clearTimeout(i),"Request Timed Out!"},u(this.config,"timeout"));try{let n=await fetch(t,{mode:"same-origin",method:"GET",headers:e,cache:"default",credentials:"same-origin"});if(window.clearTimeout(i),n.status>=200&&n.status<300)return await n.text();throw new Error(n.statusText||""+n.status)}catch(n){throw window.clearTimeout(i),n}}};var z=({callback:r=()=>{},scope:t=null,name:e="event"})=>({callback:r,scope:t,name:e}),v=class extends h{constructor(t="event"){super();this.name=t}},T=class extends h{constructor(){super()}getEvent(t){let e=this.get(t);return e instanceof v?e:(this.set(t,new v(t)),this.get(t))}newListener(t,e,i){let n=this.getEvent(t);return n.add(z({name:t,callback:e,scope:i})),n}on(t,e,i){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let n,s,a=typeof t=="object"&&!Array.isArray(t),l=a?e:i;return a||(s=e),Object.keys(t).forEach(o=>{a?(n=o,s=t[o]):n=t[o],this.newListener(n,s,l)},this),this}removeListener(t,e,i){let n=this.get(t);if(n instanceof v&&e){let s=z({name:t,callback:e,scope:i});n.forEach((a,l)=>{if(a.callback===s.callback&&a.scope===s.scope)return n.remove(l)})}return n}off(t,e,i){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let n,s,a=typeof t=="object"&&!Array.isArray(t),l=a?e:i;return a||(s=e),Object.keys(t).forEach(o=>{a?(n=o,s=t[o]):n=t[o],typeof s=="function"?this.removeListener(n,s,l):this.remove(n)},this),this}emit(t,...e){return typeof t=="undefined"?this:(typeof t=="string"&&(t=t.trim().split(/\s/g)),t.forEach(i=>{let n=this.get(i);n instanceof v&&n.forEach(s=>{let{callback:a,scope:l}=s;a.apply(l,e)})},this),this)}clear(){return A(this,"clear"),super.clear(),this}};var D=(r,t=window.location.hash)=>{try{let e=t[0]=="#"?t:c(t).hash;if(e.length>1){let i=document.getElementById(e.slice(1));if(i)return d(i.offsetLeft,i.offsetTop)}}catch(e){console.warn("[hashAction] error",e)}return r??d(0,0)},ft={name:"default",scrollable:!0,out({done:r}){r()},in({scroll:r,done:t}){window.scroll(r.x,r.y),t()}},et=class extends g{constructor(t){super();this._arg=t}install(){super.install();let t=this._arg&&this._arg.length?this._arg:u(this.config,"transitions")??[];t=[["default",ft]].concat(t),this.transitions=new h(t)}get(t){return this.transitions.get(t)}set(t,e){return this.transitions.set(t,e),this}add(t){return this.transitions.add(t),this}has(t){return this.transitions.has(t)}async animate(t,e){let i=this.transitions.get(t),n=e.scroll,s=e.ignoreHashAction;if(!("wrapper"in e.oldPage)||!("wrapper"in e.newPage))throw`[Page] either oldPage or newPage aren't instances of the Page Class. - ${{newPage:e.newPage,oldPage:e.oldPage}}`;document.title=""+e.newPage.title;let a=e.oldPage.wrapper,l=e.newPage.wrapper;if(!(a instanceof Node)||!(l instanceof Node))throw`[Wrapper] the wrapper from the ${l instanceof Node?"current":"next"} page cannot be found. The wrapper must be an element that has the attribute ${u(this.config,"wrapperAttr")}.`;return i.init&&i?.init(e),this.emitter.emit("BEFORE_TRANSITION_OUT"),i.out&&await new Promise(o=>{i.out.call(i,{...e,from:e.oldPage,trigger:e.trigger,done:o})?.then(o)}),this.emitter.emit("AFTER_TRANSITION_OUT"),await new Promise(o=>{a.insertAdjacentElement("beforebegin",l),this.emitter.emit("CONTENT_INSERT"),!s&&!/back|popstate|forward/.test(e.trigger)&&(n=D(n)),o()}),await new Promise(o=>{a.remove(),a=void 0,l=void 0,this.emitter.emit("CONTENT_REPLACED"),o()}),this.emitter.emit("BEFORE_TRANSITION_IN"),i.in&&await new Promise(async o=>{i.in.call(i,{...e,from:e.oldPage,to:e.newPage,trigger:e.trigger,scroll:n,done:o})?.then(o)}),this.emitter.emit("AFTER_TRANSITION_IN"),i}};var it=class{constructor(t={}){this.register(t)}register(t={}){this.config=_(t),this.emitter=new T,this.services=new H(this);let e=(()=>{document.removeEventListener("DOMContentLoaded",e),window.removeEventListener("load",e),this.emitter.emit("READY ready")}).bind(this);return document.addEventListener("DOMContentLoaded",e),window.addEventListener("load",e),this}get(t){return this.services.get(t)}set(t,e){return this.services.set(t,e),this}add(t){return this.services.add(t),this}boot(){return this.services.init(),this.services.boot(),this}stop(){return this.services.stop(),this.emitter.clear(),this}on(t,e){return this.emitter.on(t,e,this),this}off(t,e){return this.emitter.off(t,e,this),this}emit(t,...e){return this.emitter.emit(t,...e),this}};var rt=class extends g{install(){super.install(),this.ignoreURLs=u(this.config,"ignoreURLs")??[],this.prefetchIgnore=u(this.config,"prefetchIgnore")??!1,this.stopOnTransitioning=u(this.config,"stopOnTransitioning")??!1,this.stickyScroll=u(this.config,"stickyScroll")??!1,this.forceOnError=u(this.config,"forceOnError")??!1,this.ignoreHashAction=u(this.config,"ignoreHashAction")??!1}transitionStart(){this.isTransitioning=!0}transitionStop(){this.isTransitioning=!1}init(){this.onHover=this.onHover.bind(this),this.onClick=this.onClick.bind(this),this.onStateChange=this.onStateChange.bind(this)}boot(){"scrollRestoration"in window.history&&(window.history.scrollRestoration="manual"),super.boot()}getTransitionName(t){if(!t||!t.getAttribute)return null;let e=t.getAttribute(u(this.config,"transitionAttr",!1));return typeof e=="string"?e:null}validLink(t,e,i){let n=!window.history.pushState,s=!t||!i,a=e.metaKey||e.ctrlKey||e.shiftKey||e.altKey,l=t.hasAttribute("target")&&t.target==="_blank",o=t.protocol!==location.protocol||t.hostname!==location.hostname,p=typeof t.getAttribute("download")=="string",m=t.matches(u(this.config,"preventSelfAttr")),O=Boolean(t.closest(u(this.config,"preventAllAttr"))),L=b(c())===b(c(i));return!(s||n||a||l||o||p||m||O||L)}getHref(t){return t&&t.tagName&&t.tagName.toLowerCase()==="a"&&typeof t.href=="string"?t.href:null}getLink(t){let e=t.target,i=this.getHref(e);for(;e&&!i;)e=e.parentNode,i=this.getHref(e);if(!(!e||!this.validLink(e,t,i)))return e}onClick(t){let e=this.getLink(t);if(!e)return;if(this.isTransitioning&&this.stopOnTransitioning){t.preventDefault(),t.stopPropagation();return}let i=this.getHref(e);this.emitter.emit("ANCHOR_CLICK CLICK",t),this.go({href:i,trigger:e,event:t})}getDirection(t){return Math.abs(t)>1?t>0?"forward":"back":t===0?"popstate":t>0?"back":"forward"}force(t){window.location.assign(t)}go({href:t,trigger:e="HistoryManager",event:i}){if(this.isTransitioning&&this.stopOnTransitioning||!(this.manager.has("TransitionManager")&&this.manager.has("HistoryManager")&&this.manager.has("PageManager"))){this.force(t);return}let n=this.manager.get("HistoryManager"),s=d(0,0),a=n.current,l=a.url;if(S(l,t))return;let o;if(i&&i.state){this.emitter.emit("POPSTATE",i);let{state:p}=i,{index:m}=p,L=a.index-m,M=n.get(n.pointer);o=M.transition,s=M.data.scroll,n.replace(p.states),n.pointer=m,e=this.getDirection(L),this.emitter.emit(e==="back"?"POPSTATE_BACK":"POPSTATE_FORWARD",i)}else{o=this.getTransitionName(e),s=d();let p=k({url:t,transition:o,data:{scroll:s}});!this.stickyScroll&&(s=d(0,0)),n.add(p),this.emitter.emit("HISTORY_NEW_ITEM",i)}return i&&(i.stopPropagation(),i.preventDefault()),this.emitter.emit("GO",i),this.load({oldHref:l,href:t,trigger:e,transitionName:o,scroll:s})}async load({oldHref:t,href:e,trigger:i,transitionName:n="default",scroll:s={x:0,y:0}}){try{let a=this.manager.get("PageManager"),l,o;this.emitter.emit("NAVIGATION_START",{oldHref:t,href:e,trigger:i,transitionName:n});try{this.transitionStart(),o=await a.load(t),!(o.dom instanceof Element)&&o.build(),this.emitter.emit("PAGE_LOADING",{href:e,oldPage:o,trigger:i}),l=await a.load(e),await l.build(),this.emitter.emit("PAGE_LOAD_COMPLETE",{newPage:l,oldPage:o,trigger:i})}catch(p){throw`[PJAX] page load error: ${p}`}try{let p=this.manager.get("TransitionManager");this.emitter.emit("TRANSITION_START",n);let m=await p.animate(p.has(n)?n:"default",{oldPage:o,newPage:l,trigger:i,scroll:s,ignoreHashAction:this.ignoreHashAction});m.scrollable||(!this.ignoreHashAction&&!/back|popstate|forward/.test(i)&&(s=D(s)),window.scroll(s.x,s.y)),this.emitter.emit("TRANSITION_END",{transition:m})}catch(p){throw`[PJAX] transition error: ${p}`}this.emitter.emit("NAVIGATION_END",{oldPage:o,newPage:l,trigger:i,transitionName:n})}catch(a){this.forceOnError?this.force(e):console.warn(a)}finally{this.transitionStop()}}ignoredURL({pathname:t}){return this.ignoreURLs.length&&this.ignoreURLs.some(e=>typeof e=="string"?e===t:e.exec(t)!==null)}onHover(t){let e=this.getLink(t);if(!e||!this.manager.has("PageManager"))return;let i=this.manager.get("PageManager"),n=c(this.getHref(e)),s=n.pathname;if(!(this.ignoredURL(n)||i.has(s))){this.emitter.emit("ANCHOR_HOVER HOVER",t);try{i.load(n)}catch(a){console.warn("[PJAX] prefetch error,",a)}}}onStateChange(t){this.go({href:window.location.href,trigger:"popstate",event:t})}initEvents(){this.prefetchIgnore!==!0&&(document.addEventListener("mouseover",this.onHover),document.addEventListener("touchstart",this.onHover)),document.addEventListener("click",this.onClick),window.addEventListener("popstate",this.onStateChange)}stopEvents(){this.prefetchIgnore!==!0&&(document.removeEventListener("mouseover",this.onHover),document.removeEventListener("touchstart",this.onHover)),document.removeEventListener("click",this.onClick),window.removeEventListener("popstate",this.onStateChange)}};var nt=class extends g{constructor(t=[]){super();this.routes=new h;for(let e of t)this.add(e)}add({path:t,method:e}){let i=this.parse(t);return this.routes.set(i,e),this}parsePath(t){if(typeof t=="string")return new RegExp(t,"i");if(t instanceof RegExp||typeof t=="boolean")return t;throw"[Router] only regular expressions, strings and booleans are accepted as paths."}isPath(t){return typeof t=="string"||t instanceof RegExp||typeof t=="boolean"}parse(t){let e=t,i={from:/(.*)/g,to:/(.*)/g};if(this.isPath(t))i={from:!0,to:t};else if(this.isPath(e.from)&&this.isPath(e.to))i=e;else throw"[Router] path is neither a string, regular expression, or a { from, to } object.";let{from:n,to:s}=i;return{from:this.parsePath(n),to:this.parsePath(s)}}route(){if(this.manager.has("HistoryManager")){let t=this.manager.get("HistoryManager"),e=b(c((t.length>1?t.previous:t.current).url)),i=b(c());this.routes.forEach((n,s)=>{let a=s.from,l=s.to;if(typeof a=="boolean"&&typeof l=="boolean")throw`[Router] path ({ from: ${a}, to: ${l} }) is not valid, remember paths can only be strings, regular expressions, or a boolean; however, both the from and to paths cannot be both booleans.`;let o=a,p=l;a instanceof RegExp&&a.test(e)&&(o=a.exec(e)),l instanceof RegExp&&l.test(i)&&(p=l.exec(i)),(Array.isArray(p)&&Array.isArray(o)||Array.isArray(p)&&typeof o=="boolean"&&o||Array.isArray(o)&&typeof p=="boolean"&&p)&&n({from:o,to:p,path:{from:e,to:i}})})}else console.warn("[Route] HistoryManager is missing.")}initEvents(){this.emitter.on("READY",this.route,this),this.emitter.on("CONTENT_REPLACED",this.route,this)}stopEvents(){this.emitter.off("READY",this.route,this),this.emitter.off("CONTENT_REPLACED",this.route,this)}};var st=r=>typeof r=="string"?Array.from(document.querySelectorAll(r)):[r],dt=r=>[].concat(...r),F=r=>Array.isArray(r)?dt(r.map(F)):typeof r=="string"||r instanceof Node?st(r):r instanceof NodeList||r instanceof HTMLCollection?Array.from(r):[],j=(r,t,e)=>typeof r=="function"?r.apply(e,t):r,V=(r,t,e)=>{let i,n,s={},a=Object.keys(r);for(let l=0,o=a.length;l/^(in|out)/.test(r)?ot[r]:r,G={keyframes:[],loop:1,delay:0,speed:1,endDelay:0,easing:"ease",autoplay:!0,duration:1e3,fillMode:"auto",direction:"normal",extend:{}},R=class{constructor(t={}){this.options={};this.targets=[];this.properties={};this.animations=new h;this.totalDuration=0;this.minDelay=0;this.computedOptions=new h;this.emitter=new T;try{let{options:e,...i}=t,n=e instanceof R?e.getOptions():Array.isArray(e)?e?.[0]?.getOptions():e;this.options=Object.assign({},G,n,i),this.loop=this.loop.bind(this);let{loop:s,delay:a,speed:l,easing:o,endDelay:p,duration:m,direction:O,fillMode:L,onfinish:M,target:lt,keyframes:pt,autoplay:ct,extend:ut,...ht}=this.options;this.mainElement=document.createElement("div"),this.targets=F(lt),this.properties=ht;let q=[],I=this.targets.length,C;for(let y=0;y0||(C=V(C,[y,I,E],this));let $=f.delay+f.duration*f.iterations+f.endDelay;this.totalDuration<$&&(this.totalDuration=$);let P=E.animate(C,f);P.onfinish=()=>{typeof M=="function"&&M.call(this,E,y,I,P),this.emit("finish",E,y,I,P)},this.computedOptions.set(P,f),this.animations.set(E,P),q.push(f.delay)}this.mainAnimation=this.mainElement.animate([{opacity:"0"},{opacity:"1"}],{duration:this.totalDuration,easing:"linear"}),this.minDelay=Math.min(...q),this.setSpeed(l),ct?this.play():this.pause(),this.promise=this.newPromise(),this.mainAnimation.onfinish=()=>{this.emit("complete",this),this.stopLoop()}}catch(e){this.emit("error",e)}}newPromise(){return new Promise((t,e)=>{this.on("complete",()=>t([this])),this.on("error",i=>e(i))})}then(t,e){return t=t?.bind(this),e=e?.bind(this),this.promise.then(t,e),this}catch(t){return t=t?.bind(this),this.promise.catch(t),this}finally(t){return t=t?.bind(this),this.promise.finally(t),this}loop(){this.stopLoop(),this.emit("update",this.getProgress(),this),this.animationFrame=window.requestAnimationFrame(this.loop)}stopLoop(){window.cancelAnimationFrame(this.animationFrame)}all(t){return t(this.mainAnimation),this.animations.forEach(e=>t(e)),this}beginEvent(){if(this.getProgress()==0){let t=window.setTimeout(()=>{this.emit("begin",this),t=window.clearTimeout(t)},this.minDelay)}}play(){let t=this.getPlayState();return this.beginEvent(),this.all(e=>e.play()),this.emit("play",t,this),this.loop(),this}pause(){let t=this.getPlayState();return this.all(e=>e.pause()),this.emit("pause",t,this),this.stopLoop(),this.animationFrame=void 0,this}reset(){return this.setProgress(0),this.beginEvent(),this.options.autoplay?this.play():this.pause(),this}cancel(){return this.all(t=>t.cancel()),this.stopLoop(),this}finish(){return this.all(t=>t.finish()),this.stopLoop(),this}stop(){for(this.cancel(),this.animations.clear();this.targets.length;)this.targets.pop();this.mainElement=void 0,this.emit("stop")}getTargets(){return this.targets}getAnimation(t){return this.animations.get(t)}getTiming(t){let e=t instanceof Animation?t:this.getAnimation(t),i=this.computedOptions.get(e)??{},n=e.effect?.getTiming()??{},s=this.getOptions();return{...G,...s,...n,...i}}getTotalDuration(){return this.totalDuration}getCurrentTime(){return this.mainAnimation.currentTime}getProgress(){return this.getCurrentTime()/this.totalDuration*100}getSpeed(){return this.mainAnimation.playbackRate}getPlayState(){return this.mainAnimation.playState}getOptions(){return this.options}setCurrentTime(t){return this.all(e=>{e.currentTime=t}),this.emit("update",this.getProgress()),this}setProgress(t){let e=t/100*this.totalDuration;return this.setCurrentTime(e),this}setSpeed(t=1){return this.all(e=>{e.playbackRate=t}),this}on(t,e,i){return this.emitter.on(t,e,i??this),this}off(t,e,i){return this.emitter.off(t,e,i??this),this}emit(t,...e){return this.emitter.emit(t,...e),this}toJSON(){return this.getOptions()}get[Symbol.toStringTag](){return"Animate"}},yt=(r={})=>new R(r);0&&(module.exports={AdvancedManager,Animate,App,CONFIG_DEFAULTS,DefaultAnimationOptions,Event,EventEmitter,HistoryManager,Manager,ManagerItem,PARSER,PJAX,Page,PageManager,Router,Service,ServiceManager,TransitionManager,animate,asyncMethodCall,changeState,clean,computeValue,easings,equal,getConfig,getEase,getElements,getHash,getHashedPath,getTargets,hashAction,mapObject,methodCall,newConfig,newCoords,newListener,newState,newURL,toAttr}); +var Z=Object.defineProperty;var gt=r=>Z(r,"__esModule",{value:!0});var ft=(r,t)=>{for(var e in t)Z(r,e,{get:t[e],enumerable:!0})};gt(exports);ft(exports,{AdvancedManager:()=>k,Animate:()=>M,App:()=>lt,CONFIG_DEFAULTS:()=>tt,DefaultAnimationOptions:()=>V,Event:()=>R,EventEmitter:()=>O,HistoryManager:()=>rt,Manager:()=>g,ManagerItem:()=>S,PARSER:()=>st,PJAX:()=>pt,Page:()=>U,PageManager:()=>ot,Router:()=>ct,Service:()=>y,ServiceManager:()=>_,Timeline:()=>mt,TransitionManager:()=>at,animate:()=>At,asyncMethodCall:()=>it,changeState:()=>nt,clean:()=>X,computeValue:()=>j,easings:()=>ht,equal:()=>N,getConfig:()=>h,getEase:()=>Q,getElements:()=>ut,getHash:()=>bt,getHashedPath:()=>E,getTargets:()=>F,hashAction:()=>z,mapObject:()=>K,methodCall:()=>v,newConfig:()=>W,newCoords:()=>w,newListener:()=>J,newState:()=>D,newURL:()=>c,toAttr:()=>et});var tt={wrapperAttr:"wrapper",noAjaxLinkAttr:"no-ajax-link",noPrefetchAttr:"no-prefetch",headers:[["x-partial","true"]],preventSelfAttr:'prevent="self"',preventAllAttr:'prevent="all"',transitionAttr:"transition",blockAttr:"block",timeout:3e4,maxPages:5},W=r=>Object.assign({...tt},r),et=(r,t,e=!0)=>{let{prefix:i}=r,n=`data${i?"-"+i:""}-${t}`;return e?`[${n}]`:n},h=(r,t,e=!0)=>{if(typeof t!="string")return r;let i=r[t];return typeof i=="string"?et(r,i,e):i};var g=class{constructor(t){this.map=new Map(t)}getMap(){return this.map}get(t){return this.map.get(t)}keys(){return Array.from(this.map.keys())}values(){return Array.from(this.map.values())}set(t,e){return this.map.set(t,e),this}add(t){let i=this.size;return this.set(i,t),this}get size(){return this.map.size}get length(){return this.map.size}last(t=1){let e=this.keys()[this.size-t];return this.get(e)}delete(t){return this.map.delete(t)}remove(t){return this.map.delete(t),this}clear(){return this.map.clear(),this}has(t){return this.map.has(t)}entries(){return this.map.entries()}forEach(t,e){return this.map.forEach(t,e),this}[Symbol.iterator](){return this.entries()}},v=(r,t,...e)=>{r.forEach(i=>{i[t](...e)})},it=async(r,t,...e)=>{for(let[,i]of r)await i[t](...e)};var S=class{constructor(){}install(){}register(t,e){return this.manager=t,this.app=t.app,this.config=t.config,this.emitter=t.emitter,this.key=e,this.install(),this}uninstall(){}unregister(){this.uninstall(),this.manager.remove(this.key),this.key=void 0,this.manager=void 0,this.app=void 0,this.config=void 0,this.emitter=void 0}},k=class extends g{constructor(t){super();this.app=t,this.config=t.config,this.emitter=t.emitter}set(t,e){return super.set(t,e),e.register(this,t),this}};var c=(r=window.location.href)=>r instanceof URL?r:new URL(r,window.location.origin),E=r=>{let t=c(r);return`${t.pathname}${t.hash}`},bt=r=>c(r).hash.slice(1),X=r=>c(r).toString().replace(/(\/#.*|\/|#.*)$/,""),N=(r,t)=>X(r)===X(t);var y=class extends S{init(){}boot(){this.initEvents()}initEvents(){}stopEvents(){}stop(){this.stopEvents(),this.unregister()}},_=class extends k{constructor(t){super(t)}init(){return v(this,"init"),this}boot(){return v(this,"boot"),this}stop(){return v(this,"stop"),this}};var w=(r=window.scrollX,t=window.scrollY)=>({x:r,y:t}),D=(r={url:E(c()),index:0,transition:"default",data:{scroll:w(),trigger:"HistoryManager"}})=>r,rt=class extends y{constructor(){super(...arguments);this.pointer=-1}init(){this.states=[];let t=D();this.add(t,"replace")}get(t){return this.states[t]}add(t,e="push"){let i=D(t),n=this.length;this.states.push({...i}),this.pointer=n;let s={index:this.pointer,states:[...this.states]};return nt(e,i,s),this}remove(t){return t?this.states.splice(t,1):this.states.pop(),this.pointer--,this}replace(t){return this.states=t,this}set(t,e){return this.states[t]=e}get current(){return this.get(this.pointer)}get last(){return this.get(this.length-1)}get previous(){return this.pointer<1?null:this.get(this.pointer-1)}get length(){return this.states.length}},nt=(r,t,e)=>{let i=E(t.url),n=[e,"",i];if(window.history)switch(r){case"push":window.history.pushState.apply(window.history,n);break;case"replace":window.history.replaceState.apply(window.history,n);break}};var st=new DOMParser,U=class extends S{constructor(t=c(),e=document){super();this.url=t,typeof e=="string"?this.data=e:this.dom=e||document}build(){if(this.dom instanceof Node||(this.dom=st.parseFromString(this.data,"text/html")),!(this.body instanceof Node)){let{title:t,head:e,body:i}=this.dom;this.title=t,this.head=e,this.body=i,this.wrapper=this.body.querySelector(this.wrapperAttr)}}install(){this.wrapperAttr=h(this.config,"wrapperAttr")}uninstall(){this.url=void 0,this.title=void 0,this.head=void 0,this.body=void 0,this.dom=void 0,this.wrapper=void 0,this.data=void 0,this.wrapperAttr=void 0}},ot=class extends y{constructor(){super(...arguments);this.loading=new g}install(){this.pages=new k(this.app);let t=c().pathname;this.set(t,new U),t=void 0}get(t){return this.pages.get(t)}add(t){return this.pages.add(t),this}set(t,e){return this.pages.set(t,e),this}remove(t){return this.pages.remove(t),this}has(t){return this.pages.has(t)}clear(){return this.pages.clear(),this}get size(){return this.pages.size}keys(){return this.pages.keys()}async load(t=c()){let e=c(t),i=e.pathname,n,s;if(this.has(i))return n=this.get(i),Promise.resolve(n);this.loading.has(i)?s=this.loading.get(i):(s=this.request(i),this.loading.set(i,s));let a=await s;if(this.loading.remove(i),n=new U(e,a),this.set(i,n),this.size>h(this.config,"maxPages")){let l=c(),o=this.keys(),p=N(l,o[0])?o[1]:o[0],f=this.get(p);f.unregister(),f=void 0,o=void 0,l=void 0,p=void 0}return n}async request(t){let e=new Headers(h(this.config,"headers")),i=window.setTimeout(()=>{throw window.clearTimeout(i),"Request Timed Out!"},h(this.config,"timeout"));try{let n=await fetch(t,{mode:"same-origin",method:"GET",headers:e,cache:"default",credentials:"same-origin"});if(window.clearTimeout(i),n.status>=200&&n.status<300)return await n.text();throw new Error(n.statusText||""+n.status)}catch(n){throw window.clearTimeout(i),n}}};var J=({callback:r=()=>{},scope:t=null,name:e="event"})=>({callback:r,scope:t,name:e}),R=class extends g{constructor(t="event"){super();this.name=t}},O=class extends g{constructor(){super()}getEvent(t){let e=this.get(t);return e instanceof R?e:(this.set(t,new R(t)),this.get(t))}newListener(t,e,i){let n=this.getEvent(t);return n.add(J({name:t,callback:e,scope:i})),n}on(t,e,i){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let n,s,a=typeof t=="object"&&!Array.isArray(t),l=a?e:i;return a||(s=e),Object.keys(t).forEach(o=>{a?(n=o,s=t[o]):n=t[o],this.newListener(n,s,l)},this),this}removeListener(t,e,i){let n=this.get(t);if(n instanceof R&&e){let s=J({name:t,callback:e,scope:i});n.forEach((a,l)=>{if(a.callback===s.callback&&a.scope===s.scope)return n.remove(l)})}return n}off(t,e,i){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let n,s,a=typeof t=="object"&&!Array.isArray(t),l=a?e:i;return a||(s=e),Object.keys(t).forEach(o=>{a?(n=o,s=t[o]):n=t[o],typeof s=="function"?this.removeListener(n,s,l):this.remove(n)},this),this}emit(t,...e){return typeof t=="undefined"?this:(typeof t=="string"&&(t=t.trim().split(/\s/g)),t.forEach(i=>{let n=this.get(i);n instanceof R&&n.forEach(s=>{let{callback:a,scope:l}=s;a.apply(l,e)})},this),this)}clear(){return v(this,"clear"),super.clear(),this}};var z=(r,t=window.location.hash)=>{try{let e=t[0]=="#"?t:c(t).hash;if(e.length>1){let i=document.getElementById(e.slice(1));if(i){let{left:n,top:s}=i.getBoundingClientRect(),a=window.pageXOffset,l=window.pageYOffset,o=n+a,p=s+l;return console.log(o,p),w(o,p)}}}catch(e){console.warn("[hashAction] error",e)}return r??w(0,0)},dt={name:"default",scrollable:!0,out({done:r}){r()},in({scroll:r,done:t}){window.scroll(r.x,r.y),t()}},at=class extends y{constructor(t){super();this._arg=t}install(){super.install();let t=this._arg&&this._arg.length?this._arg:h(this.config,"transitions")??[];t=[["default",dt]].concat(t),this.transitions=new g(t)}get(t){return this.transitions.get(t)}set(t,e){return this.transitions.set(t,e),this}add(t){return this.transitions.add(t),this}has(t){return this.transitions.has(t)}async animate(t,e){let i=this.transitions.get(t),n=e.scroll,s=e.ignoreHashAction;if(!("wrapper"in e.oldPage)||!("wrapper"in e.newPage))throw`[Page] either oldPage or newPage aren't instances of the Page Class. + ${{newPage:e.newPage,oldPage:e.oldPage}}`;document.title=""+e.newPage.title;let a=e.oldPage.wrapper,l=e.newPage.wrapper;if(!(a instanceof Node)||!(l instanceof Node))throw`[Wrapper] the wrapper from the ${l instanceof Node?"current":"next"} page cannot be found. The wrapper must be an element that has the attribute ${h(this.config,"wrapperAttr")}.`;return i.init&&i?.init(e),this.emitter.emit("BEFORE_TRANSITION_OUT"),i.out&&await new Promise(o=>{i.out.call(i,{...e,from:e.oldPage,trigger:e.trigger,done:o})?.then(o)}),this.emitter.emit("AFTER_TRANSITION_OUT"),await new Promise(o=>{a.insertAdjacentElement("beforebegin",l),this.emitter.emit("CONTENT_INSERT"),!s&&!/back|popstate|forward/.test(e.trigger)&&(n=z(n)),o()}),await new Promise(o=>{a.remove(),a=void 0,l=void 0,this.emitter.emit("CONTENT_REPLACED"),o()}),this.emitter.emit("BEFORE_TRANSITION_IN"),i.in&&await new Promise(async o=>{i.in.call(i,{...e,from:e.oldPage,to:e.newPage,trigger:e.trigger,scroll:n,done:o})?.then(o)}),this.emitter.emit("AFTER_TRANSITION_IN"),i}};var lt=class{constructor(t={}){this.register(t)}register(t={}){this.config=W(t),this.emitter=new O,this.services=new _(this);let e=(()=>{document.removeEventListener("DOMContentLoaded",e),window.removeEventListener("load",e),this.emitter.emit("READY ready")}).bind(this);return document.addEventListener("DOMContentLoaded",e),window.addEventListener("load",e),this}get(t){return this.services.get(t)}set(t,e){return this.services.set(t,e),this}add(t){return this.services.add(t),this}boot(){return this.services.init(),this.services.boot(),this}stop(){return this.services.stop(),this.emitter.clear(),this}on(t,e){return this.emitter.on(t,e,this),this}off(t,e){return this.emitter.off(t,e,this),this}emit(t,...e){return this.emitter.emit(t,...e),this}};var pt=class extends y{install(){super.install(),this.ignoreURLs=h(this.config,"ignoreURLs")??[],this.prefetchIgnore=h(this.config,"prefetchIgnore")??!1,this.stopOnTransitioning=h(this.config,"stopOnTransitioning")??!1,this.stickyScroll=h(this.config,"stickyScroll")??!1,this.forceOnError=h(this.config,"forceOnError")??!1,this.ignoreHashAction=h(this.config,"ignoreHashAction")??!1}transitionStart(){this.isTransitioning=!0}transitionStop(){this.isTransitioning=!1}init(){this.onHover=this.onHover.bind(this),this.onClick=this.onClick.bind(this),this.onStateChange=this.onStateChange.bind(this)}boot(){"scrollRestoration"in window.history&&(window.history.scrollRestoration="manual"),super.boot()}getTransitionName(t){if(!t||!t.getAttribute)return null;let e=t.getAttribute(h(this.config,"transitionAttr",!1));return typeof e=="string"?e:null}validLink(t,e,i){let n=!window.history.pushState,s=!t||!i,a=e.metaKey||e.ctrlKey||e.shiftKey||e.altKey,l=t.hasAttribute("target")&&t.target==="_blank",o=t.protocol!==location.protocol||t.hostname!==location.hostname,p=typeof t.getAttribute("download")=="string",f=t.matches(h(this.config,"preventSelfAttr")),P=Boolean(t.closest(h(this.config,"preventAllAttr"))),T=E(c())===E(c(i));return!(s||n||a||l||o||p||f||P||T)}getHref(t){return t&&t.tagName&&t.tagName.toLowerCase()==="a"&&typeof t.href=="string"?t.href:null}getLink(t){let e=t.target,i=this.getHref(e);for(;e&&!i;)e=e.parentNode,i=this.getHref(e);if(!(!e||!this.validLink(e,t,i)))return e}onClick(t){let e=this.getLink(t);if(!e)return;if(this.isTransitioning&&this.stopOnTransitioning){t.preventDefault(),t.stopPropagation();return}let i=this.getHref(e);this.emitter.emit("ANCHOR_CLICK CLICK",t),this.go({href:i,trigger:e,event:t})}getDirection(t){return Math.abs(t)>1?t>0?"forward":"back":t===0?"popstate":t>0?"back":"forward"}force(t){window.location.assign(t)}go({href:t,trigger:e="HistoryManager",event:i}){if(this.isTransitioning&&this.stopOnTransitioning||!(this.manager.has("TransitionManager")&&this.manager.has("HistoryManager")&&this.manager.has("PageManager"))){this.force(t);return}let n=this.manager.get("HistoryManager"),s=w(0,0),a=n.current,l=a.url;if(N(l,t))return;let o;if(i&&i.state){this.emitter.emit("POPSTATE",i);let{state:p}=i,{index:f}=p,T=a.index-f;n.replace(p.states),n.pointer=f;let x=n.get(f);o=x.transition,s=x.data.scroll,e=this.getDirection(T),console.log(e=="forward"&&n),this.emitter.emit(e==="back"?"POPSTATE_BACK":"POPSTATE_FORWARD",i)}else{o=this.getTransitionName(e),s=w();let p=D({url:t,transition:o,data:{scroll:s}});!this.stickyScroll&&(s=w(0,0)),n.add(p),this.emitter.emit("HISTORY_NEW_ITEM",i)}return i&&(i.stopPropagation(),i.preventDefault()),this.emitter.emit("GO",i),this.load({oldHref:l,href:t,trigger:e,transitionName:o,scroll:s})}async load({oldHref:t,href:e,trigger:i,transitionName:n="default",scroll:s={x:0,y:0}}){try{let a=this.manager.get("PageManager"),l,o;this.emitter.emit("NAVIGATION_START",{oldHref:t,href:e,trigger:i,transitionName:n});try{this.transitionStart(),o=await a.load(t),!(o.dom instanceof Element)&&o.build(),this.emitter.emit("PAGE_LOADING",{href:e,oldPage:o,trigger:i}),l=await a.load(e),await l.build(),this.emitter.emit("PAGE_LOAD_COMPLETE",{newPage:l,oldPage:o,trigger:i})}catch(p){console.warn(`[PJAX] Page load error: ${p}`)}try{let p=this.manager.get("TransitionManager");this.emitter.emit("TRANSITION_START",n);let f=await p.animate(p.has(n)?n:"default",{oldPage:o,newPage:l,trigger:i,scroll:s,ignoreHashAction:this.ignoreHashAction});f.scrollable||(!this.ignoreHashAction&&!/back|popstate|forward/.test(i)&&(s=z(s)),window.scroll(s.x,s.y)),this.emitter.emit("TRANSITION_END",{transition:f})}catch(p){console.warn(`[PJAX] Transition error: ${p}`)}this.emitter.emit("NAVIGATION_END",{oldPage:o,newPage:l,trigger:i,transitionName:n})}catch(a){this.forceOnError?this.force(e):console.warn(a)}finally{this.transitionStop()}}ignoredURL({pathname:t}){return this.ignoreURLs.length&&this.ignoreURLs.some(e=>typeof e=="string"?e===t:e.exec(t)!==null)}onHover(t){let e=this.getLink(t);if(!e||!this.manager.has("PageManager"))return;let i=this.manager.get("PageManager"),n=c(this.getHref(e)),s=n.pathname;if(!(this.ignoredURL(n)||i.has(s))){this.emitter.emit("ANCHOR_HOVER HOVER",t);try{i.load(n)}catch(a){console.warn("[PJAX] prefetch error,",a)}}}onStateChange(t){this.go({href:window.location.href,trigger:"popstate",event:t})}initEvents(){this.prefetchIgnore!==!0&&(document.addEventListener("mouseover",this.onHover),document.addEventListener("touchstart",this.onHover)),document.addEventListener("click",this.onClick),window.addEventListener("popstate",this.onStateChange)}stopEvents(){this.prefetchIgnore!==!0&&(document.removeEventListener("mouseover",this.onHover),document.removeEventListener("touchstart",this.onHover)),document.removeEventListener("click",this.onClick),window.removeEventListener("popstate",this.onStateChange)}};var ct=class extends y{constructor(t=[]){super();this.routes=new g;for(let e of t)this.add(e)}add({path:t,method:e}){let i=this.parse(t);return this.routes.set(i,e),this}parsePath(t){if(typeof t=="string")return new RegExp(t,"i");if(t instanceof RegExp||typeof t=="boolean")return t;throw"[Router] only regular expressions, strings and booleans are accepted as paths."}isPath(t){return typeof t=="string"||t instanceof RegExp||typeof t=="boolean"}parse(t){let e=t,i={from:/(.*)/g,to:/(.*)/g};if(this.isPath(t))i={from:!0,to:t};else if(this.isPath(e.from)&&this.isPath(e.to))i=e;else throw"[Router] path is neither a string, regular expression, or a { from, to } object.";let{from:n,to:s}=i;return{from:this.parsePath(n),to:this.parsePath(s)}}route(){if(this.manager.has("HistoryManager")){let t=this.manager.get("HistoryManager"),e=E(c((t.length>1?t.previous:t.current).url)),i=E(c());this.routes.forEach((n,s)=>{let a=s.from,l=s.to;if(typeof a=="boolean"&&typeof l=="boolean")throw`[Router] path ({ from: ${a}, to: ${l} }) is not valid, remember paths can only be strings, regular expressions, or a boolean; however, both the from and to paths cannot be both booleans.`;let o=a,p=l;a instanceof RegExp&&a.test(e)&&(o=a.exec(e)),l instanceof RegExp&&l.test(i)&&(p=l.exec(i)),(Array.isArray(p)&&Array.isArray(o)||Array.isArray(p)&&typeof o=="boolean"&&o||Array.isArray(o)&&typeof p=="boolean"&&p)&&n({from:o,to:p,path:{from:e,to:i}})})}else console.warn("[Route] HistoryManager is missing.")}initEvents(){this.emitter.on("READY",this.route,this),this.emitter.on("CONTENT_REPLACED",this.route,this)}stopEvents(){this.emitter.off("READY",this.route,this),this.emitter.off("CONTENT_REPLACED",this.route,this)}};var ut=r=>typeof r=="string"?Array.from(document.querySelectorAll(r)):[r],yt=r=>[].concat(...r),F=r=>Array.isArray(r)?yt(r.map(F)):typeof r=="string"||r instanceof Node?ut(r):r instanceof NodeList||r instanceof HTMLCollection?Array.from(r):[],j=(r,t,e)=>typeof r=="function"?r.apply(e,t):r,K=(r,t,e)=>{let i,n,s={},a=Object.keys(r);for(let l=0,o=a.length;l/^(in|out)/.test(r)?ht[r]:r,V={keyframes:[],loop:1,delay:0,speed:1,endDelay:0,easing:"ease",autoplay:!0,duration:1e3,fillMode:"auto",direction:"normal",extend:{}},M=class{constructor(t={}){this.options={};this.targets=[];this.properties={};this.animations=new g;this.totalDuration=0;this.minDelay=0;this.computedOptions=new g;this.emitter=new O;try{let{options:e,...i}=t,n=e instanceof M?e.getOptions():Array.isArray(e)?e?.[0]?.getOptions():e;this.options=Object.assign({},V,n,i),this.loop=this.loop.bind(this);let{loop:s,delay:a,speed:l,easing:o,endDelay:p,duration:f,direction:P,fillMode:T,onfinish:x,target:G,keyframes:q,autoplay:$,extend:B,...Y}=this.options;this.mainElement=document.createElement("div"),this.targets=F(G),this.properties=Y;let C=[],d=this.targets.length,I;for(let m=0;m0||(I=K(I,[m,d,b],this));let H=u.delay+u.duration*u.iterations+u.endDelay;this.totalDuration{typeof x=="function"&&x.call(this,b,m,d,A),this.emit("finish",b,m,d,A)},this.computedOptions.set(A,u),this.animations.set(b,A),C.push(u.delay)}this.mainAnimation=this.mainElement.animate([{opacity:"0"},{opacity:"1"}],{duration:this.totalDuration,easing:"linear"}),this.minDelay=Math.min(...C),this.setSpeed(l),$?this.play():this.pause(),this.promise=this.newPromise(),this.mainAnimation.onfinish=()=>{this.emit("complete",this),this.stopLoop()}}catch(e){this.emit("error",e)}}newPromise(){return new Promise((t,e)=>{this.on("complete",()=>t([this])),this.on("error",i=>e(i))})}then(t,e){return t=t?.bind(this),e=e?.bind(this),this.promise.then(t,e),this}catch(t){return t=t?.bind(this),this.promise.catch(t),this}finally(t){return t=t?.bind(this),this.promise.finally(t),this}loop(){this.stopLoop(),this.emit("update",this.getProgress(),this),this.animationFrame=window.requestAnimationFrame(this.loop)}stopLoop(){window.cancelAnimationFrame(this.animationFrame)}all(t){return t(this.mainAnimation,this.mainElement),this.animations.forEach(t),this}beginEvent(){if(this.getProgress()==0){let t=window.setTimeout(()=>{this.emit("begin",this),t=window.clearTimeout(t)},this.minDelay)}}play(){let t=this.getPlayState();return this.beginEvent(),this.all(e=>e.play()),this.emit("play",t,this),this.loop(),this}pause(){let t=this.getPlayState();return this.all(e=>e.pause()),this.emit("pause",t,this),this.stopLoop(),this.animationFrame=void 0,this}reset(){return this.setProgress(0),this.beginEvent(),this.options.autoplay?this.play():this.pause(),this}cancel(){return this.all(t=>t.cancel()),this.stopLoop(),this}finish(){return this.all(t=>t.finish()),this.stopLoop(),this}stop(){for(this.cancel(),this.animations.clear();this.targets.length;)this.targets.pop();this.mainElement=void 0,this.emit("stop")}getTargets(){return this.targets}getAnimation(t){return this.animations.get(t)}getTiming(t){let e=t instanceof Animation?t:this.getAnimation(t),i=this.computedOptions.get(e)??{},n=e.effect?.getTiming()??{},s=this.getOptions();return{...V,...s,...n,...i}}getTotalDuration(){return this.totalDuration}getCurrentTime(){return this.mainAnimation.currentTime}getProgress(){return this.getCurrentTime()/this.totalDuration*100}getSpeed(){return this.mainAnimation.playbackRate}getPlayState(){return this.mainAnimation.playState}getOptions(){return this.options}setCurrentTime(t){return this.all(e=>{e.currentTime=t}),this.emit("update",this.getProgress()),this}setProgress(t){let e=t/100*this.totalDuration;return this.setCurrentTime(e),this}setSpeed(t=1){return this.all(e=>{e.playbackRate=t}),this}on(t,e,i){return this.emitter.on(t,e,i??this),this}off(t,e,i){return this.emitter.off(t,e,i??this),this}emit(t,...e){return this.emitter.emit(t,...e),this}toJSON(){return this.getOptions()}get[Symbol.toStringTag](){return"Animate"}},At=(r={})=>new M(r),mt=class extends M{constructor(t={}){super();this.animations=new g;try{let{options:e,...i}=t,n=e instanceof M?e.getOptions():Array.isArray(e)?e?.[0]?.getOptions():e;this.options=Object.assign({},V,n,i),this.loop=this.loop.bind(this);let{loop:s,delay:a,speed:l,easing:o,endDelay:p,duration:f,direction:P,fillMode:T,onfinish:x,target:G,keyframes:q,autoplay:$,extend:B,...Y}=this.options;this.mainElement=document.createElement("div"),this.targets=F(G),this.properties=Y;let C=[],d=this.targets.length,I;for(let m=0;m0||(I=K(I,[m,d,b],this));let H=u.delay+u.duration*u.iterations+u.endDelay;this.totalDuration{typeof x=="function"&&x.call(this,b,m,d,A),this.emit("finish",b,m,d,A)},this.computedOptions.set(A,u),this.animations.set(b,A),C.push(u.delay)}this.mainAnimation=this.mainElement.animate([{opacity:"0"},{opacity:"1"}],{duration:this.totalDuration,easing:"linear"}),this.minDelay=Math.min(...C),this.setSpeed(l),$?this.play():this.pause(),this.promise=this.newPromise(),this.mainAnimation.onfinish=()=>{this.emit("complete",this),this.stopLoop()}}catch(e){this.emit("error",e)}}add(t){return this}};0&&(module.exports={AdvancedManager,Animate,App,CONFIG_DEFAULTS,DefaultAnimationOptions,Event,EventEmitter,HistoryManager,Manager,ManagerItem,PARSER,PJAX,Page,PageManager,Router,Service,ServiceManager,Timeline,TransitionManager,animate,asyncMethodCall,changeState,clean,computeValue,easings,equal,getConfig,getEase,getElements,getHash,getHashedPath,getTargets,hashAction,mapObject,methodCall,newConfig,newCoords,newListener,newState,newURL,toAttr}); //# sourceMappingURL=api.cjs.js.map diff --git a/packages/native/lib/api.cjs.js.map b/packages/native/lib/api.cjs.js.map index 5127aed..35c4db9 100644 --- a/packages/native/lib/api.cjs.js.map +++ b/packages/native/lib/api.cjs.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../src/api.ts", "../src/config.ts", "../../manager/src/api.ts", "../src/manager.ts", "../src/url.ts", "../src/service.ts", "../src/history.ts", "../src/page.ts", "../../emitter/src/api.ts", "../src/transition.ts", "../src/app.ts", "../src/pjax.ts", "../src/router.ts", "../../animate/src/api.ts"], - "sourcesContent": ["export * from \"./config\";\nexport * from \"./manager\";\nexport * from \"./url\";\n\nexport * from \"./history\";\nexport * from \"./page\";\n\nexport * from \"./emitter\";\nexport * from \"./service\";\n\nexport * from \"./transition\";\n\nexport * from \"./app\";\nexport * from \"./pjax\";\nexport * from \"./router\";\n\nexport * from \"./animate\";\n", "export interface ICONFIG {\n prefix?: string;\n wrapperAttr?: string;\n noAjaxLinkAttr?: string;\n noPrefetchAttr?: \"no-prefetch\";\n headers?: string[][];\n preventSelfAttr?: string;\n preventAllAttr?: string;\n transitionAttr?: string;\n blockAttr?: string;\n timeout?: number;\n [key: string]: any;\n}\n\nexport const CONFIG_DEFAULTS: ICONFIG = {\n wrapperAttr: \"wrapper\",\n noAjaxLinkAttr: \"no-ajax-link\",\n noPrefetchAttr: \"no-prefetch\",\n headers: [\n [\"x-partial\", \"true\"]\n ],\n preventSelfAttr: `prevent=\"self\"`,\n preventAllAttr: `prevent=\"all\"`,\n transitionAttr: \"transition\",\n blockAttr: `block`,\n timeout: 30000\n};\n\nexport type ConfigKeys = keyof ICONFIG;\nexport const newConfig = (config: ICONFIG): ICONFIG => {\n return Object.assign({ ...CONFIG_DEFAULTS }, config);\n};\n\n/** Converts string into properly formatted data attributes */\nexport const toAttr = (config: ICONFIG, value: string, brackets: boolean = true): string => {\n let { prefix } = config;\n let attr = `data${prefix ? \"-\" + prefix : \"\"}-${value}`;\n return brackets ? `[${attr}]` : attr;\n};\n\n/** Selects config vars, and formats them for use, or simply returns the current configurations for the framework */\nexport const getConfig = (config: ICONFIG, value?: ConfigKeys, brackets: boolean = true): any => {\n if (typeof value !== \"string\")\n return config;\n\n let prop = config[value];\n if (typeof prop === \"string\")\n return toAttr(config, prop, brackets);\n return prop;\n};\n", "/** Manages complex lists of named data, eg. A page can be stored in a list by of other pages with the url being how the page is stored in the list. Managers use Maps to store data */\nexport class Manager {\n\t/** The complex list of named data, to which the Manager controls */\n\tpublic map: Map;\n\tconstructor(value?: Array<[K, V]>) {\n\t\tthis.map = new Map(value);\n\t}\n\n\t/** Returns the Manager classes base Map */\n\tpublic getMap(): Map {\n\t\treturn this.map;\n\t}\n\n\t/** Get a value stored in the Manager */\n\tpublic get(key: K): V {\n\t\treturn this.map.get(key);\n\t}\n\n\t/** Returns the keys of all items stored in the Manager as an Array */\n\tpublic keys(): Array {\n\t\treturn Array.from(this.map.keys());\n\t}\n\n\t/** Returns the values of all items stored in the Manager as an Array */\n\tpublic values(): Array {\n\t\treturn Array.from(this.map.values());\n\t}\n\n\t/** Set a value to the Manager using a key */\n\tpublic set(key: K, value: V): Manager {\n\t\tthis.map.set(key, value);\n\t\treturn this;\n\t}\n\n\t/** Adds a value to Manager, and uses the current size of the Manager as it's key, it works best when all the key in the Manager are numbers */\n\tpublic add(value: V): Manager {\n\t\tlet size = this.size;\n\t\t// @ts-ignore\n\t\tlet num: K = size as K;\n\t\tthis.set(num, value);\n\t\treturn this;\n\t}\n\n\t/** Returns the total number of items stored in the Manager */\n\tpublic get size(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** An alias for size */\n\tpublic get length(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** Returns the last item in the Manager who's index is a certain distance from the last item in the Manager */\n\tpublic last(distance: number = 1): V | undefined {\n\t\tlet key = this.keys()[this.size - distance];\n\t\treturn this.get(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns true if an element in the Map object existed and has been removed, or false if the element does not exist */\n\tpublic delete(key: K): boolean {\n\t\treturn this.map.delete(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns the Manager class, allowing for chains */\n\tpublic remove(key: K): Manager {\n\t\tthis.map.delete(key);\n\t\treturn this;\n\t}\n\n\t/** Clear the Manager of all its contents */\n\tpublic clear(): Manager {\n\t\tthis.map.clear();\n\t\treturn this;\n\t}\n\n\t/** Checks if the Manager contains a certain key */\n\tpublic has(key: K): boolean {\n\t\treturn this.map.has(key);\n\t}\n\n\t/** Returns a new Iterator object that contains an array of [key, value] for each element in the Map object in insertion order. */\n\tpublic entries(): IterableIterator<[K, V]> {\n\t\treturn this.map.entries();\n\t}\n\n\t/** Iterates through the Managers contents, calling a callback function every iteration */\n\tpublic forEach(\n\t\tcallback: (value?: V, key?: K, map?: Map) => void,\n\t\tcontext?: object\n\t): Manager {\n\t\tthis.map.forEach(callback, context);\n\t\treturn this;\n\t}\n\n\t/** Allows for iteration via for..of, learn more: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators] */\n\tpublic [Symbol.iterator](): IterableIterator<[K, V]> {\n\t\treturn this.entries();\n\t}\n}\n\n/**\n * Calls the method of a certain name for all items that are currently installed\n */\nexport const methodCall = (manager: Manager, method: string, ...args: any): void => {\n\tmanager.forEach((item) => {\n\t\t// @ts-ignore\n\t\titem[method](...args);\n\t});\n};\n\n/**\n * Asynchronously calls the method of a certain name for all items that are currently installed, similar to methodCall\n */\nexport const asyncMethodCall = async (manager: Manager, method: string, ...args: any): Promise => {\n\tfor (let [, item] of manager) {\n\t\t// @ts-ignore\n\t\tawait item[method](...args);\n\t}\n};\n\nexport default Manager;\n", "import { Manager, methodCall, asyncMethodCall } from \"@okikio/manager\";\nimport { ICONFIG } from \"./config\";\nimport { IApp } from \"./app\";\nimport { EventEmitter } from \"./emitter\";\n\nexport type IAdvancedManager = AdvancedManager;\n\n/** The base class for AdvancedManager items */\nexport class ManagerItem {\n /** The AdvancedManager the ManagerItem is attached to */\n public manager: IAdvancedManager;\n\n /** The App the ManagerItem is attached to */\n public app: IApp;\n\n /** The Config of the App the ManagerItem is attached to */\n public config: ICONFIG;\n\n /** The EventEmitter of the App the ManagerItem is attached to */\n public emitter: EventEmitter;\n\n /** The key to where ManagerItem is stored in an AdvancedManager */\n public key: any;\n\n constructor() { }\n\n /** Run after the Manager Item has been registered */\n public install(): any { }\n\n /** Register the current Manager Item's manager */\n public register(manager: IAdvancedManager, key: any): ManagerItem {\n this.manager = manager;\n this.app = manager.app;\n this.config = manager.config;\n this.emitter = manager.emitter;\n this.key = key;\n this.install();\n return this;\n }\n\n /** Run before the ManagerItem has been unregistered */\n public uninstall(): any { }\n\n /** Basically removes a ManagerItem, in order to recover the ManagerItem, it needs to be re-added to an AdvancedManager */\n public unregister() {\n this.uninstall();\n\n this.manager.remove(this.key);\n this.key = undefined;\n this.manager = undefined;\n this.app = undefined;\n this.config = undefined;\n this.emitter = undefined;\n }\n}\n\n/** A tweak to the Manager class that makes it self aware of the App class it's instantiated in */\nexport class AdvancedManager extends Manager {\n /** The App the AdvancedManager is attached to */\n public app: IApp;\n\n /** The Config of the App the AdvancedManager is attached to */\n public config: ICONFIG;\n\n /** The EventEmitter of the App the AdvancedManager is attached to */\n public emitter: EventEmitter;\n\n /** Register App details */\n constructor(app: IApp) {\n super();\n this.app = app;\n this.config = app.config;\n this.emitter = app.emitter;\n }\n\n /** Add a ManagerItem to AdvancedManager at a specified key */\n public set(key: K, value: V) {\n super.set(key, value);\n value.register(this, key);\n return this;\n }\n}\n\nexport { Manager, methodCall, asyncMethodCall };\n", "export const newURL = (url: string | URL | Location = window.location.href): URL => {\n return url instanceof URL ? url : new URL(url as unknown as string, window.location.origin);\n};\n\n/** Returns the pathname with the hash at the end */\nexport const getHashedPath = (url: URL): string => (`${url.pathname}${url.hash}`);\n\n/** Returns the actual hash without the hashtag */\nexport const getHash = (url: URL): string => (url.hash.slice(1));\n\n/** Removes the hash from the full URL for a clean URL string */\nexport const clean = (url: URL): string => (url.toString().replace(/(\\/#.*|\\/|#.*)$/, ''));\n\n/** Compares two URLs to each other */\nexport const equal = (a: URL | string, b: URL | string): boolean => {\n let urlA = newURL(a);\n let urlB = newURL(b);\n return clean(urlA) === clean(urlB);\n};\n", "import { AdvancedManager, ManagerItem, methodCall } from \"./manager\";\nimport { IApp } from \"./app\";\n\n/** Controls specific kinds of actions that require JS */\nexport class Service extends ManagerItem {\n\t/** Called before the start of a Service, represents a constructor of sorts */\n\tpublic init(...args: any): any;\n\tpublic init(): any { }\n\n\t/** Called on start of Service */\n\tpublic boot(...args: any): any;\n\tpublic boot(): any {\n\t\tthis.initEvents();\n\t}\n\n\t/** Initialize events */\n\tpublic initEvents(): void { }\n\n\t/** Stop events */\n\tpublic stopEvents(): void { }\n\n\t/** Stop services */\n\tpublic stop(): void {\n\t\tthis.stopEvents();\n\t\tthis.unregister();\n\t}\n}\n\n/** The Service Manager controls the lifecycle of all Services in an App */\nexport class ServiceManager extends AdvancedManager {\n\tconstructor(app: IApp) {\n\t\tsuper(app);\n\t}\n\n\t/** Call the init method for all Services */\n\tpublic init(): ServiceManager {\n\t\tmethodCall(this, \"init\");\n\t\treturn this;\n\t}\n\n\t/** Call the boot method for all Services */\n\tpublic boot(): ServiceManager {\n\t\tmethodCall(this, \"boot\");\n\t\treturn this;\n\t}\n\n\t/** Call the stop method for all Services */\n\tpublic stop(): ServiceManager {\n\t\tmethodCall(this, \"stop\");\n\t\treturn this;\n\t}\n}\n", "import { Service } from \"./service\";\nimport { getHashedPath, newURL } from \"./url\";\n\nexport type Trigger = HTMLAnchorElement | \"HistoryManager\" | \"popstate\" | \"back\" | \"forward\";\nexport interface ICoords {\n\treadonly x: number;\n\treadonly y: number;\n}\n\nexport interface IStateData {\n\tscroll: ICoords;\n\t[key: string]: any;\n}\n\nexport interface IState {\n\turl: string;\n\tindex?: number;\n\ttransition: string;\n\tdata: IStateData;\n}\n\nexport interface IHistoryItem {\n\tindex: number;\n\tstates: IState[];\n}\n\nexport interface IHistoryManager extends Service {\n\tstates: IState[],\n\tpointer: number,\n\n\tinit(): any,\n\tget(index: number): IState,\n\tadd(value?: IState, historyAction?: \"replace\" | \"push\"): HistoryManager,\n\tremove(index?: number): HistoryManager,\n\treplace(newStates: IState[]): HistoryManager,\n\tset(i: number, state: IState): IState,\n\tcurrent: IState,\n\tlast: IState,\n\tprevious: IState | null,\n\tlength: number,\n}\n\n/** A quick snapshot of page scroll coordinates */\nexport const newCoords = (x: number = window.scrollX, y: number = window.scrollY): ICoords => ({ x, y });\n\n/** Creates a state; a state represents the current status of the page consisting of properties like: url, transition, and data */\nexport const newState = (state: IState = {\n\turl: getHashedPath(newURL()),\n\tindex: 0,\n\ttransition: \"default\",\n\tdata: {\n\t\tscroll: newCoords(),\n\t\ttrigger: \"HistoryManager\"\n\t}\n}): IState => (state);\n\n/** Keeps a record of the history of the App; it stores only the states of Pages */\nexport class HistoryManager extends Service implements IHistoryManager {\n\tpublic states: IState[];\n\tpublic pointer = -1;\n\n\t/** Initializes the states array, and replace the history pushState data with the states array */\n\tinit() {\n\t\tthis.states = [];\n\n\t\tlet state = newState();\n\t\tthis.add(state, \"replace\");\n\t}\n\n\t/** Get a state based on it's index */\n\tpublic get(index: number) {\n\t\treturn this.states[index];\n\t}\n\n\t/** Add a state to HistoryManager and change the history pushState data based on the historyAction specified */\n\tpublic add(value?: IState, historyAction: \"replace\" | \"push\" = \"push\"): HistoryManager {\n\t\tlet state = newState(value);\n\t\tlet len = this.length;\n\t\tthis.states.push({ ...state });\n\t\tthis.pointer = len;\n\n\t\tlet item: IHistoryItem = {\n\t\t\tindex: this.pointer,\n\t\t\tstates: [...this.states]\n\t\t};\n\t\tchangeState(historyAction, state, item);\n\t\treturn this;\n\t}\n\n\tpublic remove(index?: number) {\n\t\tif (index) {\n\t\t\tthis.states.splice(index, 1);\n\t\t} else {\n\t\t\tthis.states.pop();\n\t\t}\n\n\t\tthis.pointer--;\n\t\treturn this;\n\t}\n\n\t/** Replaces the states array with another states array, this is later used when going back and forward in page history */\n\tpublic replace(newStates: IState[]) {\n\t\tthis.states = newStates;\n\t\treturn this;\n\t}\n\n\t/** Set state by index. */\n\tpublic set(i: number, state: IState) {\n\t\treturn (this.states[i] = state);\n\t}\n\n\t/** Get the current state */\n\tget current(): IState {\n\t\treturn this.get(this.pointer);\n\t}\n\n\t/** Get the last state (top of the history stack). */\n\tget last(): IState {\n\t\treturn this.get(this.length - 1);\n\t}\n\n\t/** Get the previous state. */\n\tget previous(): IState | null {\n\t\treturn this.pointer < 1 ? null : this.get(this.pointer - 1);\n\t}\n\n\tget length() {\n\t\treturn this.states.length;\n\t}\n}\n\n/** Either push or replace history state */\nexport const changeState = (action: \"push\" | \"replace\", state: IState, item: object) => {\n\tlet href = getHashedPath(newURL(state.url));\n\tlet args = [item, \"\", href];\n\tif (window.history) {\n\t\tswitch (action) {\n\t\t\tcase \"push\":\n\t\t\t\twindow.history.pushState.apply(window.history, args);\n\t\t\t\tbreak;\n\t\t\tcase \"replace\":\n\t\t\t\twindow.history.replaceState.apply(window.history, args);\n\t\t\t\tbreak;\n\t\t}\n\t}\n};\n", "import { Manager, ManagerItem, AdvancedManager } from \"./manager\";\nimport { equal, newURL } from \"./url\";\nimport { getConfig } from \"./config\";\nimport { Service } from \"./service\";\n\nexport interface IPage extends ManagerItem {\n dom: Document,\n wrapper: HTMLElement,\n title: string,\n head: Element,\n body: Element,\n url: URL,\n data: string,\n wrapperAttr: string,\n\n build(): any,\n install(): void,\n uninstall(): any,\n}\n\n/**\n * Parses strings to DOM\n */\nexport const PARSER: DOMParser = new DOMParser();\n\n/** A page represents the DOM elements that create each page */\nexport class Page extends ManagerItem implements IPage {\n /** Holds the DOM of the current page */\n public dom: Document;\n\n /** Holds the wrapper element to be swapped out of each Page */\n public wrapper: HTMLElement;\n\n /** Holds the title of each page */\n public title: string;\n\n /** Holds the head element of each page */\n public head: Element;\n\n /** Holds the body element of each page */\n public body: Element;\n\n /** The URL of the current page */\n public url: URL;\n\n /** The payload of a page request */\n public data: string;\n\n /** Attr that identifies the wrapper */\n public wrapperAttr: string;\n\n constructor(url: URL = newURL(), dom: string | Document = document) {\n super();\n this.url = url;\n\n if (typeof dom === \"string\") {\n this.data = dom;\n } else this.dom = dom || document;\n }\n\n /** Builds the page's dom, and sets the title, head, body, and wrapper properties of the Page class */\n public build() {\n if (!(this.dom instanceof Node)) {\n this.dom = PARSER.parseFromString(this.data, \"text/html\");\n }\n\n if (!(this.body instanceof Node)) {\n let { title, head, body } = this.dom;\n this.title = title;\n this.head = head;\n this.body = body;\n this.wrapper = this.body.querySelector(this.wrapperAttr);\n }\n }\n\n public install() {\n this.wrapperAttr = getConfig(this.config, \"wrapperAttr\");\n }\n\n public uninstall() {\n this.url = undefined;\n this.title = undefined;\n this.head = undefined;\n this.body = undefined;\n this.dom = undefined;\n this.wrapper = undefined;\n this.data = undefined;\n this.wrapperAttr = undefined;\n }\n}\n\nexport interface IPageManager extends Service {\n loading: Manager>,\n maxPages: number,\n pages: AdvancedManager;\n\n install(): any,\n\n get(key): Page,\n add(value): PageManager,\n set(key, value): PageManager,\n remove(key): PageManager,\n has(key): boolean,\n clear(): PageManager,\n size: number,\n keys(): any[],\n\n load(_url: URL | string): Promise,\n request(url: string): Promise,\n}\n\n/** Controls which page to load */\nexport class PageManager extends Service implements IPageManager {\n /** Stores all fetch requests that are currently loading */\n public loading: Manager> = new Manager();\n public maxPages: number;\n\n pages: AdvancedManager;\n\n /** Instantiate pages, and add the current page to pages */\n install() {\n this.pages = new AdvancedManager(this.app);\n this.maxPages = this.config.maxPages ?? 5;\n\n let URLString = newURL().pathname;\n this.set(URLString, new Page());\n URLString = undefined;\n }\n\n get(key) { return this.pages.get(key); }\n add(value) { this.pages.add(value); return this; }\n set(key, value) { this.pages.set(key, value); return this; }\n remove(key) { this.pages.remove(key); return this; }\n has(key) { return this.pages.has(key); }\n clear() { this.pages.clear(); return this; }\n get size() { return this.pages.size; }\n keys() { return this.pages.keys(); }\n\n /** Load from cache or by requesting URL via a fetch request, avoid requesting for the same thing twice by storing the fetch request in \"this.loading\" */\n public async load(_url: URL | string = newURL()): Promise {\n let url: URL = newURL(_url);\n let urlString: string = url.pathname;\n let page: Page, request: Promise;\n if (this.has(urlString)) {\n page = this.get(urlString);\n return Promise.resolve(page);\n }\n\n if (!this.loading.has(urlString)) {\n request = this.request(urlString);\n this.loading.set(urlString, request);\n } else request = this.loading.get(urlString);\n\n let response = await request;\n this.loading.remove(urlString);\n\n page = new Page(url, response);\n this.set(urlString, page);\n\n if (this.size > this.maxPages) {\n let currentUrl = newURL();\n let keys = this.keys();\n let first = equal(currentUrl, keys[0]) ? keys[1] : keys[0];\n let page = this.get(first);\n page.unregister();\n page = undefined;\n keys = undefined;\n currentUrl = undefined;\n first = undefined;\n }\n return page;\n }\n\n /** Starts a fetch request */\n public async request(url: string): Promise {\n const headers = new Headers(getConfig(this.config, \"headers\"));\n const timeout = window.setTimeout(() => {\n window.clearTimeout(timeout);\n throw \"Request Timed Out!\";\n }, getConfig(this.config, \"timeout\"));\n\n try {\n let response = await fetch(url, {\n mode: 'same-origin',\n method: \"GET\",\n headers,\n cache: \"default\",\n credentials: \"same-origin\",\n });\n\n window.clearTimeout(timeout);\n if (response.status >= 200 && response.status < 300) {\n return await response.text();\n }\n\n const err = new Error(response.statusText || \"\" + response.status);\n throw err;\n } catch (err) {\n window.clearTimeout(timeout);\n throw err;\n }\n }\n}\n", "import { Manager, methodCall } from \"@okikio/manager\";\n\nexport type ListenerCallback = ((...args: any) => void);\nexport interface IListener {\n readonly callback: ListenerCallback;\n readonly scope: object;\n readonly name: string;\n}\n\n/** Represents a new event listener consisting of properties like: callback, scope, name */\nexport const newListener = ({\n callback = () => { },\n scope = null,\n name = \"event\",\n}: IListener): IListener => ({ callback, scope, name });\n\n/** Represents a new event */\nexport class Event extends Manager {\n /** The name of the event */\n public name: string;\n constructor(name: string = \"event\") {\n super();\n this.name = name;\n }\n}\n\nexport type EventInput = string | object | Array;\n\n/**\n * An Event Emitter\n * */\nexport class EventEmitter extends Manager {\n constructor() {\n super();\n }\n\n /** Gets event, if event doesn't exist create a new one */\n public getEvent(name: string): Event {\n let event = this.get(name);\n if (!(event instanceof Event)) {\n this.set(name, new Event(name));\n return this.get(name);\n }\n\n return event;\n }\n\n /** Creates a listener and adds it to an event */\n public newListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event = this.getEvent(name);\n event.add(newListener({ name, callback, scope }));\n return event;\n }\n\n /** Adds a listener to a given event */\n public on(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n this.newListener(_name, _callback, _scope);\n }, this);\n return this;\n }\n\n /** Removes a listener from an event */\n public removeListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event: Event = this.get(name);\n if (event instanceof Event && callback) {\n let listener = newListener({ name, callback, scope });\n\n event.forEach((value: IListener, i: number) => {\n if (\n value.callback === listener.callback &&\n value.scope === listener.scope\n ) {\n return event.remove(i);\n }\n });\n }\n\n return event;\n }\n\n /** Remove a listener from a given event, or just completely remove an event */\n public off(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n if (typeof _callback === \"function\") {\n this.removeListener(_name, _callback, _scope);\n } else this.remove(_name);\n }, this);\n return this;\n }\n\n /** Call all listeners within an event */\n public emit(\n events: string | Array,\n ...args: any\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n // Loop through the list of events\n events.forEach((event: string) => {\n let _event: Event = this.get(event);\n\n if (_event instanceof Event) {\n _event.forEach((listener: IListener) => {\n let { callback, scope } = listener;\n callback.apply(scope, args);\n });\n }\n }, this);\n return this;\n }\n\n /** Clears events and event listeners */\n public clear() {\n methodCall(this, \"clear\");\n super.clear();\n return this;\n }\n}\n\nexport default EventEmitter;\n", "import { Manager } from \"./manager\";\nimport { ICoords, newCoords, Trigger } from \"./history\";\nimport { IPage } from \"./page\";\nimport { getConfig } from \"./config\";\nimport { Service } from \"./service\";\nimport { newURL } from \"./url\";\n\n/**\n * The async function type, allows for smooth transition between Promises\n */\nexport type asyncFn = (err?: any, value?: any) => void;\nexport interface ITransition {\n oldPage?: IPage;\n newPage?: IPage;\n trigger?: Trigger;\n scroll?: { x: number; y: number };\n scrollable?: boolean;\n in: (data: ITransitionData) => any;\n out: (data: ITransitionData) => any;\n [key: string]: any;\n}\nexport interface ITransitionData {\n from?: IPage;\n to?: IPage;\n trigger?: Trigger;\n scroll?: ICoords;\n done: asyncFn;\n}\nexport interface ITransitionManager extends Service {\n transitions: Manager,\n\n get(key: string): ITransition,\n set(key: string, value: ITransition): TransitionManager,\n add(value: ITransition): TransitionManager,\n has(key: string): boolean,\n\n boot(): any,\n animate(name: string, data: any): Promise,\n}\n\n\n/** Auto scrolls to an elements position if the element has an hash */\nexport const hashAction = (coords?: ICoords, hash: string = window.location.hash) => {\n try {\n let _hash = hash[0] == \"#\" ? hash : newURL(hash).hash;\n if (_hash.length > 1) {\n let el = document.getElementById(_hash.slice(1)) as HTMLElement;\n\n if (el) {\n return newCoords(el.offsetLeft, el.offsetTop);\n }\n }\n } catch (e) {\n console.warn(\"[hashAction] error\", e);\n }\n\n return coords ?? newCoords(0, 0);\n};\n\n// The Default Transition\nconst Default: ITransition = {\n name: \"default\",\n scrollable: true,\n\n out({ done }: ITransitionData) {\n done();\n },\n in({ scroll, done }: ITransitionData) {\n window.scroll(scroll.x, scroll.y);\n done();\n }\n};\n\n/** Controls which Transition between pages to use */\nexport class TransitionManager extends Service implements ITransitionManager {\n transitions: Manager;\n private _arg: Array<[string, ITransition]>;\n constructor(transitions?: Array<[string, ITransition]>) {\n super();\n this._arg = transitions;\n }\n\n /** On Service install set Config */\n public install() {\n super.install();\n\n let transitions = this._arg && this._arg.length ? this._arg : (getConfig(this.config, \"transitions\") ?? []);\n\n // Manager like Maps use the most recent [key, value] Array it knows, replacing the default transition\n // With any other transitions called [\"default\", ...]\n transitions = [[\"default\", Default]].concat(transitions);\n this.transitions = new Manager(transitions);\n }\n\n get(key: string) { return this.transitions.get(key); }\n set(key: string, value: ITransition) { this.transitions.set(key, value); return this; }\n add(value: ITransition) { this.transitions.add(value); return this; }\n has(key: string) { return this.transitions.has(key); }\n\n /** Starts a transition */\n public async animate(name: string, data: any): Promise {\n let transition: ITransition = this.transitions.get(name);\n let scroll = data.scroll;\n let ignoreHashAction = data.ignoreHashAction;\n if (!(\"wrapper\" in data.oldPage) || !(\"wrapper\" in data.newPage))\n throw `[Page] either oldPage or newPage aren't instances of the Page Class.\\n ${{\n newPage: data.newPage,\n oldPage: data.oldPage,\n }}`;\n\n // Replace the title\n document.title = `` + data.newPage.title;\n\n let fromWrapper = data.oldPage.wrapper;\n let toWrapper = data.newPage.wrapper;\n\n if (!(fromWrapper instanceof Node) || !(toWrapper instanceof Node))\n throw `[Wrapper] the wrapper from the ${!(toWrapper instanceof Node) ? \"next\" : \"current\"\n } page cannot be found. The wrapper must be an element that has the attribute ${getConfig(this.config,\n \"wrapperAttr\"\n )}.`;\n\n // Give the Transition all the background data it may require\n transition.init && transition?.init(data);\n\n this.emitter.emit(\"BEFORE_TRANSITION_OUT\");\n\n // Start the out point of the Transition\n if (transition.out) {\n await new Promise((done) => {\n let outMethod: Promise = transition.out.call(transition, {\n ...data,\n from: data.oldPage,\n trigger: data.trigger,\n done,\n });\n\n outMethod?.then(done);\n });\n }\n\n this.emitter.emit(\"AFTER_TRANSITION_OUT\");\n\n // Add the new wrapper before the old one\n await new Promise((done) => {\n fromWrapper.insertAdjacentElement(\"beforebegin\", toWrapper);\n this.emitter.emit(\"CONTENT_INSERT\");\n\n if (!ignoreHashAction && !/back|popstate|forward/.test(data.trigger as string)) {\n scroll = hashAction(scroll);\n }\n done();\n });\n\n // Replace the old wrapper with the new one\n await new Promise((done) => {\n fromWrapper.remove();\n fromWrapper = undefined;\n toWrapper = undefined;\n this.emitter.emit(\"CONTENT_REPLACED\");\n done();\n });\n\n this.emitter.emit(\"BEFORE_TRANSITION_IN\");\n\n // Start the in point of the Transition (only the in method has access to the hashAction's scroll position)\n if (transition.in) {\n await new Promise(async (done) => {\n let inMethod: Promise = transition.in.call(transition, {\n ...data,\n from: data.oldPage,\n to: data.newPage,\n trigger: data.trigger,\n scroll,\n done,\n });\n\n inMethod?.then(done);\n });\n }\n\n this.emitter.emit(\"AFTER_TRANSITION_IN\");\n return transition;\n }\n}\n", "import { EventEmitter, ListenerCallback, EventInput } from \"./emitter\";\nimport { ServiceManager, Service } from \"./service\";\nimport { newConfig, ICONFIG } from \"./config\";\n\nexport interface IApp {\n services: ServiceManager,\n emitter: EventEmitter,\n config: ICONFIG,\n register(config: ICONFIG): App,\n get(key: string): Service,\n set(key: string, service: Service): App,\n add(value: Service): App,\n boot(): App,\n stop(): App,\n on(events: EventInput, callback?: ListenerCallback): App,\n off(events: EventInput, callback?: ListenerCallback): App,\n emit(events: string | any[], ...args: any): App,\n}\n\n/** The App class starts the entire process, it controls all managers and all services */\nexport class App implements IApp {\n /** An instance of the ServiceManager */\n public services: ServiceManager;\n\n /** An instance of an EventEmitter */\n public emitter: EventEmitter;\n\n /** The current Configuration's for the App */\n public config: ICONFIG;\n constructor(config: object = {}) {\n this.register(config);\n }\n\n /** Create new instances of the ServiceManager, EventEmitter and the configurations */\n public register(config: ICONFIG = {}): App {\n this.config = newConfig(config);\n this.emitter = new EventEmitter();\n this.services = new ServiceManager(this);\n\n let handler = (() => {\n document.removeEventListener(\"DOMContentLoaded\", handler);\n window.removeEventListener(\"load\", handler);\n this.emitter.emit(\"READY ready\");\n }).bind(this);\n\n document.addEventListener(\"DOMContentLoaded\", handler);\n window.addEventListener(\"load\", handler);\n return this;\n }\n\n /** Shortcuts to adding, setting, and getting Services */\n public get(key: string): Service {\n return this.services.get(key);\n }\n\n public set(key: string, value: Service): App {\n this.services.set(key, value);\n return this;\n }\n\n public add(value: Service): App {\n this.services.add(value);\n return this;\n }\n\n /** Initialize and boot all Services */\n public boot(): App {\n this.services.init();\n this.services.boot();\n return this;\n }\n\n /** Stops all Services and clears the even emitter of all events and listeners */\n public stop(): App {\n this.services.stop();\n this.emitter.clear();\n return this;\n }\n\n /** Shortcuts to the App EventEmitter on, off, and emit methods */\n public on(events: EventInput, callback?: ListenerCallback): App {\n this.emitter.on(events, callback, this);\n return this;\n }\n\n public off(events: EventInput, callback?: ListenerCallback): App {\n this.emitter.off(events, callback, this);\n return this;\n }\n\n public emit(events: string | any[], ...args: any): App {\n this.emitter.emit(events, ...args);\n return this;\n }\n}\n", "import { newState, Trigger, newCoords, IHistoryItem, IHistoryManager } from \"./history\";\nimport { Service } from \"./service\";\nimport { IPage, IPageManager } from \"./page\";\nimport { newURL, getHashedPath, equal } from \"./url\";\nimport { getConfig } from \"./config\";\nimport { hashAction, ITransitionManager } from \"./transition\";\n\nexport type LinkEvent = MouseEvent | TouchEvent;\nexport type StateEvent = LinkEvent | PopStateEvent;\nexport type IgnoreURLsList = Array;\n/**\n * Creates a barbajs like PJAX Service, for the native framework\n * Based on barbajs and StartingBlocks\n */\nexport class PJAX extends Service {\n /** URLs to ignore when prefetching */\n public ignoreURLs: IgnoreURLsList;\n\n /** Whether or not to disable prefetching */\n public prefetchIgnore: boolean;\n\n /** Current state of transitions */\n public isTransitioning: boolean;\n\n /** Ignore extra clicks of an anchor element if a transition has already started */\n public stopOnTransitioning: boolean;\n\n /** On page change (excluding popstate events) keep current scroll position */\n public stickyScroll: boolean;\n\n /** Force load a page if an error occurs */\n public forceOnError: boolean;\n\n /** Ignore hash action if set to true */\n public ignoreHashAction: boolean;\n\n public install() {\n super.install();\n\n this.ignoreURLs = getConfig(this.config, \"ignoreURLs\") ?? [];\n this.prefetchIgnore = getConfig(this.config, \"prefetchIgnore\") ?? false;\n this.stopOnTransitioning = getConfig(this.config, \"stopOnTransitioning\") ?? false;\n this.stickyScroll = getConfig(this.config, \"stickyScroll\") ?? false;\n this.forceOnError = getConfig(this.config, \"forceOnError\") ?? false;\n this.ignoreHashAction = getConfig(this.config, \"ignoreHashAction\") ?? false\n }\n\n /** Sets the transition state to either true or false */\n public transitionStart() {\n this.isTransitioning = true;\n }\n\n public transitionStop() {\n this.isTransitioning = false;\n }\n\n public init() {\n /**\n * Bind the event listeners to the PJAX class\n *\n * @memberof PJAX\n */\n this.onHover = this.onHover.bind(this);\n this.onClick = this.onClick.bind(this);\n this.onStateChange = this.onStateChange.bind(this);\n }\n\n /** Starts the PJAX Service */\n public boot() {\n if (\"scrollRestoration\" in window.history) {\n // Back off, browser, I got this...\n window.history.scrollRestoration = \"manual\";\n }\n\n super.boot();\n }\n\n /** Gets the transition to use for a certain anchor */\n public getTransitionName(el: HTMLAnchorElement): string | null {\n if (!el || !el.getAttribute) return null;\n let transitionAttr = el.getAttribute(\n getConfig(this.config, \"transitionAttr\", false)\n );\n\n if (typeof transitionAttr === \"string\") return transitionAttr;\n return null;\n }\n\n /** Checks to see if the anchor is valid */\n public validLink(\n el: HTMLAnchorElement,\n event: LinkEvent | KeyboardEvent,\n href: string\n ): boolean {\n let pushStateSupport = !window.history.pushState;\n let exists = !el || !href;\n let eventMutate =\n (event as KeyboardEvent).metaKey ||\n (event as KeyboardEvent).ctrlKey ||\n (event as KeyboardEvent).shiftKey ||\n (event as KeyboardEvent).altKey;\n let newTab =\n el.hasAttribute(\"target\") &&\n (el as HTMLAnchorElement).target === \"_blank\";\n let crossOrigin =\n (el as HTMLAnchorElement).protocol !== location.protocol ||\n (el as HTMLAnchorElement).hostname !== location.hostname;\n let download = typeof el.getAttribute(\"download\") === \"string\";\n let preventSelf = el.matches(getConfig(this.config, \"preventSelfAttr\"));\n let preventAll = Boolean(\n el.closest(getConfig(this.config, \"preventAllAttr\"))\n );\n let sameURL = getHashedPath(newURL()) === getHashedPath(newURL(href));\n return !(\n exists ||\n pushStateSupport ||\n eventMutate ||\n newTab ||\n crossOrigin ||\n download ||\n preventSelf ||\n preventAll ||\n sameURL\n );\n }\n\n /** Returns the href of an Anchor element */\n public getHref(el: HTMLAnchorElement): string | null {\n if (\n el &&\n el.tagName &&\n el.tagName.toLowerCase() === \"a\" &&\n typeof el.href === \"string\"\n )\n return el.href;\n return null;\n }\n\n /** Check if event target is a valid anchor with an href, if so, return the anchor */\n public getLink(event: LinkEvent): HTMLAnchorElement {\n let el = event.target as HTMLAnchorElement;\n let href: string = this.getHref(el);\n\n while (el && !href) {\n el = (el as HTMLElement).parentNode as HTMLAnchorElement;\n href = this.getHref(el);\n }\n\n // Check for a valid link\n if (!el || !this.validLink(el, event, href)) return;\n return el;\n }\n\n /** When an element is clicked, get valid anchor element, go for a transition */\n public onClick(event: LinkEvent) {\n let el = this.getLink(event);\n if (!el) return;\n\n if (this.isTransitioning && this.stopOnTransitioning) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n let href = this.getHref(el);\n this.emitter.emit(\"ANCHOR_CLICK CLICK\", event);\n this.go({ href, trigger: el, event });\n }\n\n /** Returns the direction of the State change as a String, either the Back button or the Forward button */\n public getDirection(value: number): Trigger {\n if (Math.abs(value) > 1) {\n // Ex 6-0 > 0 -> forward, 0-6 < 0 -> back\n return value > 0 ? \"forward\" : \"back\";\n } else {\n if (value === 0) {\n return \"popstate\";\n } else {\n // Ex 6-5 > 0 -> back, 5-6 < 0 -> forward\n return value > 0 ? \"back\" : \"forward\";\n }\n }\n }\n\n /** Force a page to go to a certain URL */\n public force(href: string): void {\n window.location.assign(href);\n }\n\n /**\n * If transition is running force load page.\n * Stop if currentURL is the same as new url.\n * On state change, change the current state history, to reflect the direction of said state change\n * Load page and page transition.\n */\n public go({\n href,\n trigger = \"HistoryManager\",\n event,\n }: {\n href: string;\n trigger?: Trigger;\n event?: StateEvent;\n }): Promise {\n // If transition is already running and the go method is called again, force load page\n if (this.isTransitioning && this.stopOnTransitioning ||\n !(this.manager.has(\"TransitionManager\") &&\n this.manager.has(\"HistoryManager\") &&\n this.manager.has(\"PageManager\"))) {\n this.force(href);\n return;\n }\n\n const history = this.manager.get(\"HistoryManager\") as IHistoryManager;\n let scroll = newCoords(0, 0);\n let currentState = history.current;\n let currentURL = currentState.url;\n if (equal(currentURL, href)) {\n return;\n }\n\n let transitionName: string;\n if (event && (event as PopStateEvent).state) {\n this.emitter.emit(\"POPSTATE\", event);\n\n // If popstate, get back/forward direction.\n let { state }: { state: IHistoryItem } = event as PopStateEvent;\n let { index } = state;\n let currentIndex = currentState.index;\n let difference = currentIndex - index;\n\n let _state = history.get(history.pointer);\n transitionName = _state.transition;\n scroll = _state.data.scroll;\n\n history.replace(state.states);\n history.pointer = index;\n\n trigger = this.getDirection(difference);\n\n // Based on the direction of the state change either remove or add a state\n this.emitter.emit(trigger === \"back\" ? `POPSTATE_BACK` : `POPSTATE_FORWARD`, event);\n } else {\n // Add new state\n transitionName = this.getTransitionName(trigger as HTMLAnchorElement);\n\n scroll = newCoords();\n let state = newState({\n url: href,\n transition: transitionName,\n data: { scroll },\n });\n\n !this.stickyScroll && (scroll = newCoords(0, 0));\n\n history.add(state);\n this.emitter.emit(\"HISTORY_NEW_ITEM\", event);\n }\n\n if (event) {\n event.stopPropagation();\n event.preventDefault();\n }\n\n this.emitter.emit(\"GO\", event);\n return this.load({\n oldHref: currentURL,\n href,\n trigger,\n transitionName,\n scroll,\n });\n }\n\n /** Load the new Page as well as a Transition; starts the Transition */\n public async load({\n oldHref,\n href,\n trigger,\n transitionName = \"default\",\n scroll = { x: 0, y: 0 },\n }: {\n oldHref: string;\n href: string;\n trigger: Trigger;\n transitionName?: string;\n scroll: { x: number; y: number };\n }): Promise {\n try {\n const pages = this.manager.get(\"PageManager\") as IPageManager;\n let newPage: IPage, oldPage: IPage;\n\n this.emitter.emit(\"NAVIGATION_START\", {\n oldHref,\n href,\n trigger,\n transitionName,\n });\n\n // Load & Build both the old and new pages\n try {\n this.transitionStart();\n oldPage = await pages.load(oldHref);\n !(oldPage.dom instanceof Element) && oldPage.build();\n\n this.emitter.emit(\"PAGE_LOADING\", { href, oldPage, trigger });\n newPage = await pages.load(href);\n await newPage.build();\n this.emitter.emit(\"PAGE_LOAD_COMPLETE\", {\n newPage,\n oldPage,\n trigger,\n });\n } catch (err) {\n throw `[PJAX] page load error: ${err}`;\n }\n\n // --\n // --\n\n // Start Transition\n try {\n const TransitionManager = this.manager.get(\"TransitionManager\") as ITransitionManager;\n this.emitter.emit(\"TRANSITION_START\", transitionName);\n\n let transition = await TransitionManager.animate(TransitionManager.has(transitionName) ? transitionName : \"default\", {\n oldPage,\n newPage,\n trigger,\n scroll,\n ignoreHashAction: this.ignoreHashAction\n });\n\n if (!transition.scrollable) {\n if (!this.ignoreHashAction && !/back|popstate|forward/.test(trigger as string)) scroll = hashAction(scroll);\n window.scroll(scroll.x, scroll.y);\n }\n\n this.emitter.emit(\"TRANSITION_END\", { transition });\n } catch (err) {\n throw `[PJAX] transition error: ${err}`;\n }\n\n this.emitter.emit(\"NAVIGATION_END\", {\n oldPage,\n newPage,\n trigger,\n transitionName,\n });\n } catch (err) {\n if (this.forceOnError) this.force(href);\n else console.warn(err);\n } finally {\n this.transitionStop(); // Sets isTransitioning to false\n }\n }\n\n /** Check to see if the URL is to be ignored, uses either RegExp of Strings to check */\n public ignoredURL({ pathname }: URL): boolean {\n return (\n this.ignoreURLs.length &&\n this.ignoreURLs.some((url) => {\n return typeof url === \"string\"\n ? url === pathname\n : (url as RegExp).exec(pathname) !== null;\n })\n );\n }\n\n /** When you hover over an anchor, prefetch the event target's href */\n public onHover(event: LinkEvent): Promise {\n let el = this.getLink(event);\n if (!el || !this.manager.has(\"PageManager\")) return;\n\n const pages = this.manager.get(\"PageManager\") as IPageManager;\n let url = newURL(this.getHref(el));\n let urlString: string = url.pathname;\n\n // If Url is ignored or already in cache, don't do any think\n if (this.ignoredURL(url) || pages.has(urlString)) return;\n this.emitter.emit(\"ANCHOR_HOVER HOVER\", event);\n\n try {\n pages.load(url);\n } catch (err) {\n console.warn(\"[PJAX] prefetch error,\", err);\n }\n }\n\n /** When History state changes, get url from State, go for a Transition. */\n public onStateChange(event: PopStateEvent): void {\n this.go({ href: window.location.href, trigger: \"popstate\", event });\n }\n\n /** Initialize DOM Events */\n public initEvents() {\n if (this.prefetchIgnore !== true) {\n document.addEventListener(\"mouseover\", this.onHover);\n document.addEventListener(\"touchstart\", this.onHover);\n }\n\n document.addEventListener(\"click\", this.onClick);\n window.addEventListener(\"popstate\", this.onStateChange);\n }\n\n /** Stop DOM Events */\n public stopEvents() {\n if (this.prefetchIgnore !== true) {\n document.removeEventListener(\"mouseover\", this.onHover);\n document.removeEventListener(\"touchstart\", this.onHover);\n }\n\n document.removeEventListener(\"click\", this.onClick);\n window.removeEventListener(\"popstate\", this.onStateChange);\n }\n}\n", "import { Service } from \"./service\";\nimport { Manager } from \"./manager\";\nimport { newURL, getHashedPath } from \"./url\";\nimport { IHistoryManager } from \"./history\";\n\nexport type RouteMethod = (...args: any) => any;\nexport type RouteStyle = string | RegExp | boolean;\nexport interface IRouteToFrom {\n to: RouteStyle,\n from: RouteStyle\n}\nexport type RoutePath = IRouteToFrom | RouteStyle;\nexport interface IRoute {\n path: RoutePath,\n method: RouteMethod\n}\n\n/** Controls what happens when certain url paths match a set of criteria */\nexport class Router extends Service {\n /** List of routes */\n protected routes: Manager;\n constructor(routes: IRoute[] = []) {\n super();\n this.routes = new Manager();\n for (let route of routes) {\n this.add(route);\n }\n }\n\n /** Add a new route to watch for */\n public add({ path, method }: IRoute): Router {\n let key = this.parse(path);\n this.routes.set(key, method);\n return this;\n }\n\n /** Convert strings into path match functions */\n public parsePath(path: RouteStyle): RegExp | boolean {\n if (typeof path === \"string\") return new RegExp(path, \"i\");\n else if (path instanceof RegExp || typeof path === \"boolean\")\n return path;\n throw \"[Router] only regular expressions, strings and booleans are accepted as paths.\";\n }\n\n /** Determines if a strings counts has a path */\n public isPath(input: RouteStyle): boolean {\n return (\n typeof input === \"string\" ||\n input instanceof RegExp ||\n typeof input === \"boolean\"\n );\n }\n\n /** Parse the multiple different formats for paths, into a { from, to } object */\n public parse(input: RoutePath): IRouteToFrom {\n let route = input as IRouteToFrom;\n let toFromPath: IRouteToFrom = {\n from: /(.*)/g,\n to: /(.*)/g,\n };\n\n if (this.isPath(input as RouteStyle))\n toFromPath = {\n from: true,\n to: input as RouteStyle,\n };\n else if (this.isPath(route.from) && this.isPath(route.to as RouteStyle))\n toFromPath = route;\n else\n throw \"[Router] path is neither a string, regular expression, or a { from, to } object.\";\n\n let { from, to } = toFromPath;\n return {\n from: this.parsePath(from),\n to: this.parsePath(to),\n };\n }\n\n /** Test if route paths are true, if so run their methods */\n public route() {\n if (this.manager.has(\"HistoryManager\")) {\n let history = this.manager.get(\"HistoryManager\") as IHistoryManager;\n let from: string = getHashedPath(newURL((history.length > 1 ? history.previous : history.current).url));\n let to: string = getHashedPath(newURL());\n\n this.routes.forEach((method: RouteMethod, path: IRouteToFrom) => {\n let fromRegExp = path.from as RegExp | boolean;\n let toRegExp = path.to as RegExp | boolean;\n\n if (\n typeof fromRegExp === \"boolean\" &&\n typeof toRegExp === \"boolean\"\n ) {\n throw `[Router] path ({ from: ${fromRegExp}, to: ${toRegExp} }) is not valid, remember paths can only be strings, regular expressions, or a boolean; however, both the from and to paths cannot be both booleans.`;\n }\n\n let fromParam: RegExpExecArray | RegExp | boolean = fromRegExp;\n let toParam: RegExpExecArray | RegExp | boolean = toRegExp;\n\n if (fromRegExp instanceof RegExp && fromRegExp.test(from))\n fromParam = fromRegExp.exec(from);\n if (toRegExp instanceof RegExp && toRegExp.test(to))\n toParam = toRegExp.exec(to);\n\n if (\n (Array.isArray(toParam) && Array.isArray(fromParam)) ||\n (Array.isArray(toParam) &&\n typeof fromParam == \"boolean\" &&\n fromParam) ||\n (Array.isArray(fromParam) &&\n typeof toParam == \"boolean\" &&\n toParam)\n )\n method({ from: fromParam, to: toParam, path: { from, to } });\n });\n } else {\n console.warn(\"[Route] HistoryManager is missing.\");\n }\n }\n\n /** Add listeners for PJAX Events */\n public initEvents() {\n this.emitter.on(\"READY\", this.route, this);\n this.emitter.on(\"CONTENT_REPLACED\", this.route, this);\n }\n\n /** Remove listeners for PJAX Events */\n public stopEvents() {\n this.emitter.off(\"READY\", this.route, this);\n this.emitter.off(\"CONTENT_REPLACED\", this.route, this);\n }\n}\n", "import { EventEmitter, EventInput, ListenerCallback } from \"@okikio/emitter\";\nimport { Manager } from \"@okikio/manager\";\n\n// DOM\nexport type AnimationTarget = string | Node | NodeList | HTMLCollection | HTMLElement[] | AnimationTarget[];\nexport const getElements = (selector: string | Node): Node[] => {\n return typeof selector === \"string\" ? Array.from(document.querySelectorAll(selector as string)) : [selector];\n};\n\nconst flatten = (arr: AnimationTarget[]) => [].concat(...arr);\nexport const getTargets = (targets: AnimationTarget): Node[] => {\n if (Array.isArray(targets)) {\n return flatten((targets as AnimationTarget[]).map(getTargets));\n }\n if (typeof targets == \"string\" || targets instanceof Node)\n return getElements(targets);\n if (targets instanceof NodeList || targets instanceof HTMLCollection)\n return Array.from(targets);\n return [];\n};\n\n// VALUES\nexport type closureArgs = [number, number, HTMLElement];\nexport type closure = ((index?: number, total?: number, element?: HTMLElement) => (genericTypes[] | void)) | any;\nexport const computeValue = (value: closure, args: closureArgs, context: Animate) => {\n if (typeof value === \"function\") {\n return value.apply(context, args);\n } else { return value; }\n};\n\nexport const mapObject = (obj: object, args: closureArgs, options: Animate): any => {\n let key: string, value: any, result = {};\n let keys = Object.keys(obj);\n for (let i = 0, len = keys.length; i < len; i++) {\n key = keys[i];\n value = obj[key];\n result[key] = computeValue(value, args, options);\n }\n\n return result;\n};\n\n/** From: [https://easings.net] */\nexport const easings = {\n \"in\": \"ease-in\",\n \"out\": \"ease-out\",\n \"in-out\": \"ease-in-out\",\n\n // Sine\n \"in-sine\": \"cubic-bezier(0.47, 0, 0.745, 0.715)\",\n \"out-sine\": \"cubic-bezier(0.39, 0.575, 0.565, 1)\",\n \"in-out-sine\": \"cubic-bezier(0.445, 0.05, 0.55, 0.95)\",\n\n // Quad\n \"in-quad\": \"cubic-bezier(0.55, 0.085, 0.68, 0.53)\",\n \"out-quad\": \"cubic-bezier(0.25, 0.46, 0.45, 0.94)\",\n \"in-out-quad\": \"cubic-bezier(0.455, 0.03, 0.515, 0.955)\",\n\n // Cubic\n \"in-cubic\": \"cubic-bezier(0.55, 0.055, 0.675, 0.19)\",\n \"out-cubic\": \"cubic-bezier(0.215, 0.61, 0.355, 1)\",\n \"in-out-cubic\": \"cubic-bezier(0.645, 0.045, 0.355, 1)\",\n\n // Quart\n \"in-quart\": \"cubic-bezier(0.895, 0.03, 0.685, 0.22)\",\n \"out-quart\": \"cubic-bezier(0.165, 0.84, 0.44, 1)\",\n \"in-out-quart\": \"cubic-bezier(0.77, 0, 0.175, 1)\",\n\n // Quint\n \"in-quint\": \"cubic-bezier(0.755, 0.05, 0.855, 0.06)\",\n \"out-quint\": \"cubic-bezier(0.23, 1, 0.32, 1)\",\n \"in-out-quint\": \"cubic-bezier(0.86, 0, 0.07, 1)\",\n\n // Expo\n \"in-expo\": \"cubic-bezier(0.95, 0.05, 0.795, 0.035)\",\n \"out-expo\": \"cubic-bezier(0.19, 1, 0.22, 1)\",\n \"in-out-expo\": \"cubic-bezier(1, 0, 0, 1)\",\n\n // Circ\n \"in-circ\": \"cubic-bezier(0.6, 0.04, 0.98, 0.335)\",\n \"out-circ\": \"cubic-bezier(0.075, 0.82, 0.165, 1)\",\n \"in-out-circ\": \"cubic-bezier(0.785, 0.135, 0.15, 0.86)\",\n\n // Back\n \"in-back\": \"cubic-bezier(0.6, -0.28, 0.735, 0.045)\",\n \"out-back\": \"cubic-bezier(0.175, 0.885, 0.32, 1.275)\",\n \"in-out-back\": \"cubic-bezier(0.68, -0.55, 0.265, 1.55)\"\n};\n\nexport const getEase = (ease: string) => {\n return /^(in|out)/.test(ease) ? easings[ease] : ease;\n};\n\nexport type genericTypes = genericTypes[] | boolean | object | string | number | closure | null | undefined;\nexport interface AnimationOptions {\n target?: AnimationTarget,\n\n speed?: number,\n autoplay?: boolean,\n options?: AnimationOptions,\n delay?: number | closure,\n easing?: string | closure,\n endDelay?: number | closure,\n duration?: number | closure,\n keyframes?: Keyframe[] | object[] | closure,\n loop?: number | boolean | closure, // iterations: number,\n onfinish?: (element?: HTMLElement, index?: number, total?: number, animation?: Animation) => any,\n fillMode?: \"none\" | \"forwards\" | \"backwards\" | \"both\" | \"auto\" | closure,\n direction?: \"normal\" | \"reverse\" | \"alternate\" | \"alternate-reverse\" | closure,\n extend?: EffectTiming,\n [property: string]: genericTypes;\n};\n\nexport const DefaultAnimationOptions: AnimationOptions = {\n keyframes: [],\n\n loop: 1, // iterations: number,\n delay: 0,\n speed: 1,\n endDelay: 0,\n easing: \"ease\",\n autoplay: true,\n duration: 1000,\n fillMode: \"auto\",\n direction: \"normal\",\n extend: {}\n};\n\nexport type AnimationEvents = \"update\" | \"play\" | \"pause\" | \"start\" | \"begin\" | \"complete\" | \"finish\" | \"error\" | \"stop\";\n\n/** You can check it out here: https://codepen.io/okikio/pen/qBbdGaW?editors=0011 */\nexport class Animate {\n /**\n * Stores the options for the current animation\n */\n public options: AnimationOptions = {};\n\n /**\n * The Array of Elements to Animate\n */\n public targets: Node[] = [];\n\n /**\n * The properties to animate\n */\n public properties: object = {};\n\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n\n /**\n * The total duration of all Animation's\n */\n public totalDuration: number = 0;\n\n /**\n * The smallest delay out of all Animation's\n */\n public minDelay: number = 0;\n\n /**\n * The options for individual animations\n */\n public computedOptions: Manager = new Manager();\n\n /**\n * The Element the main animation uses\n */\n public mainElement: HTMLElement;\n\n /**\n * Stores an animation that runs on the total duration of the all other Animations, and as such it's the main Animation\n */\n public mainAnimation: Animation;\n\n /**\n * Stores request frame calls\n */\n public animationFrame: number;\n\n /**\n * An event emitter\n */\n public emitter: EventEmitter = new EventEmitter();\n\n /**\n * Returns a promise that is fulfilled when the mainAnimation is finished\n */\n public promise: Promise;\n constructor(options: AnimationOptions = {}) {\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n\n /**\n * Returns a new Promise that is resolve when this.finish is called\n */\n public newPromise(): Promise {\n return new Promise((resolve, reject) => {\n /*\n Note that the `this` keyword is in an Array when it is resolved,\n this is due to Promises not wanting to resolve references,\n so, you can't resolve `this` directly, so, I chose to resolve `this` in an\n Array\n */\n this.on(\"complete\", () => resolve([this]));\n this.on(\"error\", err => reject(err));\n });\n }\n\n /**\n * Fulfills the this.promise Promise\n */\n public then(\n onFulfilled?: (value?: any) => any,\n onRejected?: (reason?: any) => any\n ): Animate {\n onFulfilled = onFulfilled?.bind(this);\n onRejected = onRejected?.bind(this);\n this.promise.then(onFulfilled, onRejected);\n return this;\n }\n\n /**\n * Catches error that occur in the this.promise Promise\n */\n public catch(onRejected: (reason?: any) => any): Animate {\n onRejected = onRejected?.bind(this);\n this.promise.catch(onRejected);\n return this;\n }\n\n /**\n * If you don't care if the this.promise Promise has either been rejected or resolved\n */\n public finally(onFinally: () => any): Animate {\n onFinally = onFinally?.bind(this);\n this.promise.finally(onFinally);\n return this;\n }\n\n /**\n * Represents an Animation Frame Loop\n */\n public loop(): void {\n this.stopLoop();\n this.emit(\"update\", this.getProgress(), this);\n this.animationFrame = window.requestAnimationFrame(this.loop);\n }\n\n /**\n * Cancels animation frame\n */\n public stopLoop() {\n window.cancelAnimationFrame(this.animationFrame);\n }\n\n /**\n * Calls a method that affects all animations including the mainAnimation; the method only allows the animation parameter\n */\n public all(method: (animation: Animation) => void) {\n method(this.mainAnimation);\n this.animations.forEach(animation => method(animation));\n return this;\n }\n\n /**\n * Register the begin event\n */\n protected beginEvent() {\n if (this.getProgress() == 0) {\n let timer: number | void = window.setTimeout(() => {\n this.emit(\"begin\", this);\n timer = window.clearTimeout(timer as number);\n }, this.minDelay);\n }\n }\n\n /**\n * Play Animation\n */\n public play(): Animate {\n let playstate = this.getPlayState();\n this.beginEvent();\n this.all(anim => anim.play());\n this.emit(\"play\", playstate, this);\n this.loop();\n return this;\n }\n\n /**\n * Pause Animation\n */\n public pause(): Animate {\n let playstate = this.getPlayState();\n this.all(anim => anim.pause());\n this.emit(\"pause\", playstate, this);\n this.stopLoop();\n this.animationFrame = undefined;\n return this;\n }\n\n /**\n * Reset all Animations\n */\n public reset() {\n this.setProgress(0);\n this.beginEvent();\n\n if (this.options.autoplay) this.play();\n else this.pause();\n return this;\n }\n\n /**\n * Cancels all Animations\n */\n public cancel() {\n this.all(anim => anim.cancel());\n this.stopLoop();\n return this;\n }\n\n /**\n * Force complete all Animations\n */\n public finish() {\n this.all(anim => anim.finish());\n this.stopLoop();\n return this;\n }\n\n /**\n * Cancels & Clears all Animations\n */\n public stop() {\n this.cancel();\n this.animations.clear();\n while (this.targets.length) this.targets.pop();\n this.mainElement = undefined;\n this.emit(\"stop\");\n }\n\n /**\n * Returns an Array of targets\n */\n public getTargets(): Node[] {\n return this.targets;\n }\n\n /**\n * Get a specific Animation from an Animate instance\n */\n public getAnimation(element: HTMLElement): Animation {\n return this.animations.get(element);\n }\n\n /**\n * Returns the timings of an Animation, given a target\n * E.g. { duration, endDelay, delay, iterations, iterationStart, direction, easing, fill, etc... }\n */\n public getTiming(target: HTMLElement | Animation): AnimationOptions & EffectTiming {\n let animation = target instanceof Animation ? target : this.getAnimation(target);\n let keyframeOptions = this.computedOptions.get(animation) ?? {};\n let timings = animation.effect?.getTiming() ?? {};\n let options = this.getOptions();\n\n return { ...DefaultAnimationOptions, ...options, ...timings, ...keyframeOptions };\n }\n\n /**\n * Returns the total duration of Animation\n */\n public getTotalDuration(): number {\n return this.totalDuration;\n }\n\n /**\n * Returns the current time of the Main Animation\n */\n public getCurrentTime(): number {\n return this.mainAnimation.currentTime;\n }\n\n /**\n * Returns the Animation progress as a fraction of the current time / duration * 100\n */\n public getProgress() {\n return (this.getCurrentTime() / this.totalDuration) * 100;\n }\n\n /**\n * Return the playback speed of the animation\n */\n public getSpeed(): number {\n return this.mainAnimation.playbackRate;\n }\n\n /**\n * Returns the current playing state\n */\n public getPlayState(): \"idle\" | \"running\" | \"paused\" | \"finished\" {\n return this.mainAnimation.playState;\n }\n\n /**\n * Get the options of an Animate instance\n */\n public getOptions(): AnimationOptions {\n return this.options;\n }\n\n /**\n * Set the current time of the Main Animation\n */\n public setCurrentTime(time: number): Animate {\n this.all(anim => { anim.currentTime = time; });\n this.emit(\"update\", this.getProgress());\n return this;\n }\n\n /**\n * Set the Animation progress as a value from 0 to 100\n */\n public setProgress(percent: number): Animate {\n let time = (percent / 100) * this.totalDuration;\n this.setCurrentTime(time);\n return this;\n }\n\n /**\n * Set the playback speed of an Animation\n */\n public setSpeed(speed: number = 1): Animate {\n this.all(anim => { anim.playbackRate = speed; });\n return this;\n }\n\n /**\n * Adds a listener for a given event\n */\n public on(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.on(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Removes a listener from an event\n */\n public off(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.off(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Call all listeners within an event\n */\n public emit(events: AnimationEvents | string | any[], ...args: any): Animate {\n this.emitter.emit(events, ...args);\n return this;\n }\n\n\n /** Returns the Animate options, as JSON */\n public toJSON(): AnimationOptions {\n return this.getOptions();\n }\n\n /**\n * The Symbol.toStringTag well-known symbol is a string valued property that is used\n * in the creation of the default string description of an object.\n * It is accessed internally by the Object.prototype.toString() method.\n */\n get [Symbol.toStringTag]() {\n return `Animate`;\n }\n}\n\n/** Creates a new Animate instance */\nexport const animate = (options: AnimationOptions = {}): Animate => {\n return new Animate(options);\n};\n\nexport default animate;"], - "mappings": "kIAAA,srBCcO,GAAM,GAA2B,CACpC,YAA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ACtB,MAAO,MAAK,cAAc,aAMvB,cAA2D,CAC9D,MAAO,MAAK,cAAc,UAMvB,YAA+B,CAClC,MAAO,MAAK,QAMT,eAAe,EAAuB,CACzC,YAAK,IAAI,GAAQ,CAAE,EAAK,YAAc,IACtC,KAAK,KAAK,SAAU,KAAK,eAClB,KAMJ,YAAY,EAA0B,CACzC,GAAI,GAAQ,EAAU,IAAO,KAAK,cAClC,YAAK,eAAe,GACb,KAMJ,SAAS,EAAgB,EAAY,CACxC,YAAK,IAAI,GAAQ,CAAE,EAAK,aAAe,IAChC,KAMJ,GAAG,EAAsC,EAA6B,EAAyB,CAClG,YAAK,QAAQ,GAAG,EAAQ,EAAU,GAAS,MACpC,KAMJ,IAAI,EAAsC,EAA6B,EAAyB,CACnG,YAAK,QAAQ,IAAI,EAAQ,EAAU,GAAS,MACrC,KAMJ,KAAK,KAA6C,EAAoB,CACzE,YAAK,QAAQ,KAAK,EAAQ,GAAG,GACtB,KAKJ,QAA2B,CAC9B,MAAO,MAAK,iBAQX,OAAO,cAAe,CACvB,MAAO,YAKF,GAAU,CAAC,EAA4B,KACzC,GAAI,GAAQ", + "sourcesContent": ["export * from \"./config\";\nexport * from \"./manager\";\nexport * from \"./url\";\n\nexport * from \"./history\";\nexport * from \"./page\";\n\nexport * from \"./emitter\";\nexport * from \"./service\";\n\nexport * from \"./transition\";\n\nexport * from \"./app\";\nexport * from \"./pjax\";\nexport * from \"./router\";\n\nexport * from \"./animate\";\n", "export interface ICONFIG {\n prefix?: string;\n wrapperAttr?: string;\n noAjaxLinkAttr?: string;\n noPrefetchAttr?: \"no-prefetch\";\n headers?: string[][];\n preventSelfAttr?: string;\n preventAllAttr?: string;\n transitionAttr?: string;\n blockAttr?: string;\n timeout?: number;\n maxPages?: number;\n [key: string]: any;\n}\n\nexport const CONFIG_DEFAULTS = {\n wrapperAttr: \"wrapper\",\n noAjaxLinkAttr: \"no-ajax-link\",\n noPrefetchAttr: \"no-prefetch\",\n headers: [\n [\"x-partial\", \"true\"]\n ],\n preventSelfAttr: `prevent=\"self\"`,\n preventAllAttr: `prevent=\"all\"`,\n transitionAttr: \"transition\",\n blockAttr: `block`,\n timeout: 30000,\n maxPages: 5\n};\n\nexport type ConfigKeys = keyof typeof CONFIG_DEFAULTS | string;\nexport const newConfig = (config: ICONFIG): ICONFIG => {\n return Object.assign({ ...CONFIG_DEFAULTS }, config);\n};\n\n/** Converts string into properly formatted data attributes */\nexport const toAttr = (config: ICONFIG, value: string, brackets: boolean = true): string => {\n let { prefix } = config;\n let attr = `data${prefix ? \"-\" + prefix : \"\"}-${value}`;\n return brackets ? `[${attr}]` : attr;\n};\n\n/** Selects config vars, and formats them for use, or simply returns the current configurations for the framework */\nexport const getConfig = (config: ICONFIG, value?: ConfigKeys, brackets: boolean = true): any => {\n if (typeof value !== \"string\")\n return config;\n\n let prop = config[value];\n if (typeof prop === \"string\")\n return toAttr(config, prop, brackets);\n return prop;\n};\n", "/** Manages complex lists of named data, eg. A page can be stored in a list by of other pages with the url being how the page is stored in the list. Managers use Maps to store data */\nexport class Manager {\n\t/** The complex list of named data, to which the Manager controls */\n\tpublic map: Map;\n\tconstructor(value?: Array<[K, V]>) {\n\t\tthis.map = new Map(value);\n\t}\n\n\t/** Returns the Manager classes base Map */\n\tpublic getMap(): Map {\n\t\treturn this.map;\n\t}\n\n\t/** Get a value stored in the Manager */\n\tpublic get(key: K): V {\n\t\treturn this.map.get(key);\n\t}\n\n\t/** Returns the keys of all items stored in the Manager as an Array */\n\tpublic keys(): Array {\n\t\treturn Array.from(this.map.keys());\n\t}\n\n\t/** Returns the values of all items stored in the Manager as an Array */\n\tpublic values(): Array {\n\t\treturn Array.from(this.map.values());\n\t}\n\n\t/** Set a value to the Manager using a key */\n\tpublic set(key: K, value: V): Manager {\n\t\tthis.map.set(key, value);\n\t\treturn this;\n\t}\n\n\t/** Adds a value to Manager, and uses the current size of the Manager as it's key, it works best when all the key in the Manager are numbers */\n\tpublic add(value: V): Manager {\n\t\tlet size = this.size;\n\t\t// @ts-ignore\n\t\tlet num: K = size as K;\n\t\tthis.set(num, value);\n\t\treturn this;\n\t}\n\n\t/** Returns the total number of items stored in the Manager */\n\tpublic get size(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** An alias for size */\n\tpublic get length(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** Returns the last item in the Manager who's index is a certain distance from the last item in the Manager */\n\tpublic last(distance: number = 1): V | undefined {\n\t\tlet key = this.keys()[this.size - distance];\n\t\treturn this.get(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns true if an element in the Map object existed and has been removed, or false if the element does not exist */\n\tpublic delete(key: K): boolean {\n\t\treturn this.map.delete(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns the Manager class, allowing for chains */\n\tpublic remove(key: K): Manager {\n\t\tthis.map.delete(key);\n\t\treturn this;\n\t}\n\n\t/** Clear the Manager of all its contents */\n\tpublic clear(): Manager {\n\t\tthis.map.clear();\n\t\treturn this;\n\t}\n\n\t/** Checks if the Manager contains a certain key */\n\tpublic has(key: K): boolean {\n\t\treturn this.map.has(key);\n\t}\n\n\t/** Returns a new Iterator object that contains an array of [key, value] for each element in the Map object in insertion order. */\n\tpublic entries(): IterableIterator<[K, V]> {\n\t\treturn this.map.entries();\n\t}\n\n\t/** Iterates through the Managers contents, calling a callback function every iteration */\n\tpublic forEach(\n\t\tcallback: (value?: V, key?: K, map?: Map) => void,\n\t\tcontext?: object\n\t): Manager {\n\t\tthis.map.forEach(callback, context);\n\t\treturn this;\n\t}\n\n\t/** Allows for iteration via for..of, learn more: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators] */\n\tpublic [Symbol.iterator](): IterableIterator<[K, V]> {\n\t\treturn this.entries();\n\t}\n}\n\n/**\n * Calls the method of a certain name for all items that are currently installed\n */\nexport const methodCall = (manager: Manager, method: string, ...args: any): void => {\n\tmanager.forEach((item) => {\n\t\t// @ts-ignore\n\t\titem[method](...args);\n\t});\n};\n\n/**\n * Asynchronously calls the method of a certain name for all items that are currently installed, similar to methodCall\n */\nexport const asyncMethodCall = async (manager: Manager, method: string, ...args: any): Promise => {\n\tfor (let [, item] of manager) {\n\t\t// @ts-ignore\n\t\tawait item[method](...args);\n\t}\n};\n\nexport default Manager;\n", "import { Manager, methodCall, asyncMethodCall } from \"@okikio/manager\";\nimport { ICONFIG } from \"./config\";\nimport { IApp } from \"./app\";\nimport { EventEmitter } from \"./emitter\";\n\nexport type IAdvancedManager = AdvancedManager;\n\n/** The base class for AdvancedManager items */\nexport class ManagerItem {\n /** The AdvancedManager the ManagerItem is attached to */\n public manager: IAdvancedManager;\n\n /** The App the ManagerItem is attached to */\n public app: IApp;\n\n /** The Config of the App the ManagerItem is attached to */\n public config: ICONFIG;\n\n /** The EventEmitter of the App the ManagerItem is attached to */\n public emitter: EventEmitter;\n\n /** The key to where ManagerItem is stored in an AdvancedManager */\n public key: any;\n\n constructor() { }\n\n /** Run after the Manager Item has been registered */\n public install(): any { }\n\n /** Register the current Manager Item's manager */\n public register(manager: IAdvancedManager, key: any): ManagerItem {\n this.manager = manager;\n this.app = manager.app;\n this.config = manager.config;\n this.emitter = manager.emitter;\n this.key = key;\n this.install();\n return this;\n }\n\n /** Run before the ManagerItem has been unregistered */\n public uninstall(): any { }\n\n /** Basically removes a ManagerItem, in order to recover the ManagerItem, it needs to be re-added to an AdvancedManager */\n public unregister() {\n this.uninstall();\n\n this.manager.remove(this.key);\n this.key = undefined;\n this.manager = undefined;\n this.app = undefined;\n this.config = undefined;\n this.emitter = undefined;\n }\n}\n\n/** A tweak to the Manager class that makes it self aware of the App class it's instantiated in */\nexport class AdvancedManager extends Manager {\n /** The App the AdvancedManager is attached to */\n public app: IApp;\n\n /** The Config of the App the AdvancedManager is attached to */\n public config: ICONFIG;\n\n /** The EventEmitter of the App the AdvancedManager is attached to */\n public emitter: EventEmitter;\n\n /** Register App details */\n constructor(app: IApp) {\n super();\n this.app = app;\n this.config = app.config;\n this.emitter = app.emitter;\n }\n\n /** Add a ManagerItem to AdvancedManager at a specified key */\n public set(key: K, value: V) {\n super.set(key, value);\n value.register(this, key);\n return this;\n }\n}\n\nexport { Manager, methodCall, asyncMethodCall };\n", "export const newURL = (url: string | URL | Location = window.location.href): URL => {\n return url instanceof URL ? url : new URL(url as unknown as string, window.location.origin);\n};\n\n/** Returns the pathname with the hash at the end */\nexport const getHashedPath = (url: URL | string): string => {\n let _url = newURL(url);\n return `${_url.pathname}${_url.hash}`;\n};\n\n/** Returns the actual hash without the hashtag */\nexport const getHash = (url: URL | string): string => newURL(url).hash.slice(1);\n\n/** Removes the hash from the full URL for a clean URL string */\nexport const clean = (url: URL | string): string => newURL(url).toString().replace(/(\\/#.*|\\/|#.*)$/, '');\n\n/** Compares two URLs to each other */\nexport const equal = (a: URL | string, b: URL | string): boolean => (clean(a) === clean(b));\n\n", "import { AdvancedManager, ManagerItem, methodCall } from \"./manager\";\nimport { IApp } from \"./app\";\n\n/** Controls specific kinds of actions that require JS */\nexport class Service extends ManagerItem {\n\t/** Called before the start of a Service, represents a constructor of sorts */\n\tpublic init(...args: any): any;\n\tpublic init(): any { }\n\n\t/** Called on start of Service */\n\tpublic boot(...args: any): any;\n\tpublic boot(): any {\n\t\tthis.initEvents();\n\t}\n\n\t/** Initialize events */\n\tpublic initEvents(): void { }\n\n\t/** Stop events */\n\tpublic stopEvents(): void { }\n\n\t/** Stop services */\n\tpublic stop(): void {\n\t\tthis.stopEvents();\n\t\tthis.unregister();\n\t}\n}\n\n/** The Service Manager controls the lifecycle of all Services in an App */\nexport class ServiceManager extends AdvancedManager {\n\tconstructor(app: IApp) {\n\t\tsuper(app);\n\t}\n\n\t/** Call the init method for all Services */\n\tpublic init(): ServiceManager {\n\t\tmethodCall(this, \"init\");\n\t\treturn this;\n\t}\n\n\t/** Call the boot method for all Services */\n\tpublic boot(): ServiceManager {\n\t\tmethodCall(this, \"boot\");\n\t\treturn this;\n\t}\n\n\t/** Call the stop method for all Services */\n\tpublic stop(): ServiceManager {\n\t\tmethodCall(this, \"stop\");\n\t\treturn this;\n\t}\n}\n", "import { Service } from \"./service\";\nimport { getHashedPath, newURL } from \"./url\";\n\nexport type Trigger = HTMLAnchorElement | \"HistoryManager\" | \"popstate\" | \"back\" | \"forward\";\nexport interface ICoords {\n\treadonly x: number;\n\treadonly y: number;\n}\n\nexport interface IStateData {\n\tscroll: ICoords;\n\t[key: string]: any;\n}\n\nexport interface IState {\n\turl: string;\n\tindex?: number;\n\ttransition: string;\n\tdata: IStateData;\n}\n\nexport interface IHistoryItem {\n\tindex: number;\n\tstates: IState[];\n}\n\nexport interface IHistoryManager extends Service {\n\tstates: IState[],\n\tpointer: number,\n\n\tinit(): any,\n\tget(index: number): IState,\n\tadd(value?: IState, historyAction?: \"replace\" | \"push\"): HistoryManager,\n\tremove(index?: number): HistoryManager,\n\treplace(newStates: IState[]): HistoryManager,\n\tset(i: number, state: IState): IState,\n\tcurrent: IState,\n\tlast: IState,\n\tprevious: IState | null,\n\tlength: number,\n}\n\n/** A quick snapshot of page scroll coordinates */\nexport const newCoords = (x: number = window.scrollX, y: number = window.scrollY): ICoords => ({ x, y });\n\n/** Creates a state; a state represents the current status of the page consisting of properties like: url, transition, and data */\nexport const newState = (state: IState = {\n\turl: getHashedPath(newURL()),\n\tindex: 0,\n\ttransition: \"default\",\n\tdata: {\n\t\tscroll: newCoords(),\n\t\ttrigger: \"HistoryManager\"\n\t}\n}): IState => (state);\n\n/** Keeps a record of the history of the App; it stores only the states of Pages */\nexport class HistoryManager extends Service implements IHistoryManager {\n\tpublic states: IState[];\n\tpublic pointer = -1;\n\n\t/** Initializes the states array, and replace the history pushState data with the states array */\n\tinit() {\n\t\tthis.states = [];\n\n\t\tlet state = newState();\n\t\tthis.add(state, \"replace\");\n\t}\n\n\t/** Get a state based on it's index */\n\tpublic get(index: number) {\n\t\treturn this.states[index];\n\t}\n\n\t/** Add a state to HistoryManager and change the history pushState data based on the historyAction specified */\n\tpublic add(value?: IState, historyAction: \"replace\" | \"push\" = \"push\"): HistoryManager {\n\t\tlet state = newState(value);\n\t\tlet len = this.length;\n\t\tthis.states.push({ ...state });\n\t\tthis.pointer = len;\n\n\t\tlet item: IHistoryItem = {\n\t\t\tindex: this.pointer,\n\t\t\tstates: [...this.states]\n\t\t};\n\t\tchangeState(historyAction, state, item);\n\t\treturn this;\n\t}\n\n\tpublic remove(index?: number) {\n\t\tif (index) {\n\t\t\tthis.states.splice(index, 1);\n\t\t} else {\n\t\t\tthis.states.pop();\n\t\t}\n\n\t\tthis.pointer--;\n\t\treturn this;\n\t}\n\n\t/** Replaces the states array with another states array, this is later used when going back and forward in page history */\n\tpublic replace(newStates: IState[]) {\n\t\tthis.states = newStates;\n\t\treturn this;\n\t}\n\n\t/** Set state by index. */\n\tpublic set(i: number, state: IState) {\n\t\treturn (this.states[i] = state);\n\t}\n\n\t/** Get the current state */\n\tget current(): IState {\n\t\treturn this.get(this.pointer);\n\t}\n\n\t/** Get the last state (top of the history stack). */\n\tget last(): IState {\n\t\treturn this.get(this.length - 1);\n\t}\n\n\t/** Get the previous state. */\n\tget previous(): IState | null {\n\t\treturn this.pointer < 1 ? null : this.get(this.pointer - 1);\n\t}\n\n\tget length() {\n\t\treturn this.states.length;\n\t}\n}\n\n/** Either push or replace history state */\nexport const changeState = (action: \"push\" | \"replace\", state: IState, item: object) => {\n\tlet href = getHashedPath(state.url);\n\tlet args = [item, \"\", href];\n\tif (window.history) {\n\t\tswitch (action) {\n\t\t\tcase \"push\":\n\t\t\t\twindow.history.pushState.apply(window.history, args);\n\t\t\t\tbreak;\n\t\t\tcase \"replace\":\n\t\t\t\twindow.history.replaceState.apply(window.history, args);\n\t\t\t\tbreak;\n\t\t}\n\t}\n};\n", "import { Manager, ManagerItem, AdvancedManager } from \"./manager\";\nimport { equal, newURL } from \"./url\";\nimport { getConfig } from \"./config\";\nimport { Service } from \"./service\";\n\nexport interface IPage extends ManagerItem {\n dom: Document,\n wrapper: HTMLElement,\n title: string,\n head: Element,\n body: Element,\n url: URL,\n data: string,\n wrapperAttr: string,\n\n build(): any,\n install(): void,\n uninstall(): any,\n}\n\n/**\n * Parses strings to DOM\n */\nexport const PARSER: DOMParser = new DOMParser();\n\n/** A page represents the DOM elements that create each page */\nexport class Page extends ManagerItem implements IPage {\n /** Holds the DOM of the current page */\n public dom: Document;\n\n /** Holds the wrapper element to be swapped out of each Page */\n public wrapper: HTMLElement;\n\n /** Holds the title of each page */\n public title: string;\n\n /** Holds the head element of each page */\n public head: Element;\n\n /** Holds the body element of each page */\n public body: Element;\n\n /** The URL of the current page */\n public url: URL;\n\n /** The payload of a page request */\n public data: string;\n\n /** Attr that identifies the wrapper */\n public wrapperAttr: string;\n\n constructor(url: URL = newURL(), dom: string | Document = document) {\n super();\n this.url = url;\n\n if (typeof dom === \"string\") {\n this.data = dom;\n } else this.dom = dom || document;\n }\n\n /** Builds the page's dom, and sets the title, head, body, and wrapper properties of the Page class */\n public build() {\n if (!(this.dom instanceof Node)) {\n this.dom = PARSER.parseFromString(this.data, \"text/html\");\n }\n\n if (!(this.body instanceof Node)) {\n let { title, head, body } = this.dom;\n this.title = title;\n this.head = head;\n this.body = body;\n this.wrapper = this.body.querySelector(this.wrapperAttr);\n }\n }\n\n public install() {\n this.wrapperAttr = getConfig(this.config, \"wrapperAttr\");\n }\n\n public uninstall() {\n this.url = undefined;\n this.title = undefined;\n this.head = undefined;\n this.body = undefined;\n this.dom = undefined;\n this.wrapper = undefined;\n this.data = undefined;\n this.wrapperAttr = undefined;\n }\n}\n\nexport interface IPageManager extends Service {\n loading: Manager>,\n pages: AdvancedManager;\n\n install(): any,\n\n get(key): Page,\n add(value): PageManager,\n set(key, value): PageManager,\n remove(key): PageManager,\n has(key): boolean,\n clear(): PageManager,\n size: number,\n keys(): any[],\n\n load(_url: URL | string): Promise,\n request(url: string): Promise,\n}\n\n/** Controls which page to load */\nexport class PageManager extends Service implements IPageManager {\n /** Stores all fetch requests that are currently loading */\n public loading: Manager> = new Manager();\n\n pages: AdvancedManager;\n\n /** Instantiate pages, and add the current page to pages */\n install() {\n this.pages = new AdvancedManager(this.app);\n\n let URLString = newURL().pathname;\n this.set(URLString, new Page());\n URLString = undefined;\n }\n\n get(key) { return this.pages.get(key); }\n add(value) { this.pages.add(value); return this; }\n set(key, value) { this.pages.set(key, value); return this; }\n remove(key) { this.pages.remove(key); return this; }\n has(key) { return this.pages.has(key); }\n clear() { this.pages.clear(); return this; }\n get size() { return this.pages.size; }\n keys() { return this.pages.keys(); }\n\n /** Load from cache or by requesting URL via a fetch request, avoid requesting for the same thing twice by storing the fetch request in \"this.loading\" */\n public async load(_url: URL | string = newURL()): Promise {\n let url: URL = newURL(_url);\n let urlString: string = url.pathname;\n let page: Page, request: Promise;\n\n if (this.has(urlString)) {\n page = this.get(urlString);\n return Promise.resolve(page);\n }\n\n if (!this.loading.has(urlString)) {\n request = this.request(urlString);\n this.loading.set(urlString, request);\n } else request = this.loading.get(urlString);\n\n let response = await request;\n this.loading.remove(urlString);\n\n page = new Page(url, response);\n this.set(urlString, page);\n\n if (this.size > getConfig(this.config, \"maxPages\")) {\n let currentUrl = newURL();\n let keys = this.keys();\n let first = equal(currentUrl, keys[0]) ? keys[1] : keys[0];\n let page = this.get(first);\n page.unregister();\n page = undefined;\n keys = undefined;\n currentUrl = undefined;\n first = undefined;\n }\n\n return page;\n }\n\n /** Starts a fetch request */\n public async request(url: string): Promise {\n const headers = new Headers(getConfig(this.config, \"headers\"));\n const timeout = window.setTimeout(() => {\n window.clearTimeout(timeout);\n throw \"Request Timed Out!\";\n }, getConfig(this.config, \"timeout\"));\n\n try {\n let response = await fetch(url, {\n mode: 'same-origin',\n method: \"GET\",\n headers,\n cache: \"default\",\n credentials: \"same-origin\",\n });\n\n window.clearTimeout(timeout);\n if (response.status >= 200 && response.status < 300) {\n return await response.text();\n }\n\n const err = new Error(response.statusText || \"\" + response.status);\n throw err;\n } catch (err) {\n window.clearTimeout(timeout);\n throw err;\n }\n }\n}\n", "import { Manager, methodCall } from \"@okikio/manager\";\n\nexport type ListenerCallback = ((...args: any) => void);\nexport interface IListener {\n readonly callback: ListenerCallback;\n readonly scope: object;\n readonly name: string;\n}\n\n/** Represents a new event listener consisting of properties like: callback, scope, name */\nexport const newListener = ({\n callback = () => { },\n scope = null,\n name = \"event\",\n}: IListener): IListener => ({ callback, scope, name });\n\n/** Represents a new event */\nexport class Event extends Manager {\n /** The name of the event */\n public name: string;\n constructor(name: string = \"event\") {\n super();\n this.name = name;\n }\n}\n\nexport type EventInput = string | object | Array;\n\n/**\n * An Event Emitter\n * */\nexport class EventEmitter extends Manager {\n constructor() {\n super();\n }\n\n /** Gets event, if event doesn't exist create a new one */\n public getEvent(name: string): Event {\n let event = this.get(name);\n if (!(event instanceof Event)) {\n this.set(name, new Event(name));\n return this.get(name);\n }\n\n return event;\n }\n\n /** Creates a listener and adds it to an event */\n public newListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event = this.getEvent(name);\n event.add(newListener({ name, callback, scope }));\n return event;\n }\n\n /** Adds a listener to a given event */\n public on(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n this.newListener(_name, _callback, _scope);\n }, this);\n return this;\n }\n\n /** Removes a listener from an event */\n public removeListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event: Event = this.get(name);\n if (event instanceof Event && callback) {\n let listener = newListener({ name, callback, scope });\n\n event.forEach((value: IListener, i: number) => {\n if (\n value.callback === listener.callback &&\n value.scope === listener.scope\n ) {\n return event.remove(i);\n }\n });\n }\n\n return event;\n }\n\n /** Remove a listener from a given event, or just completely remove an event */\n public off(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n if (typeof _callback === \"function\") {\n this.removeListener(_name, _callback, _scope);\n } else this.remove(_name);\n }, this);\n return this;\n }\n\n /** Call all listeners within an event */\n public emit(\n events: string | Array,\n ...args: any\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n // Loop through the list of events\n events.forEach((event: string) => {\n let _event: Event = this.get(event);\n\n if (_event instanceof Event) {\n _event.forEach((listener: IListener) => {\n let { callback, scope } = listener;\n callback.apply(scope, args);\n });\n }\n }, this);\n return this;\n }\n\n /** Clears events and event listeners */\n public clear() {\n methodCall(this, \"clear\");\n super.clear();\n return this;\n }\n}\n\nexport default EventEmitter;\n", "import { Manager } from \"./manager\";\nimport { ICoords, newCoords, Trigger } from \"./history\";\nimport { IPage } from \"./page\";\nimport { getConfig } from \"./config\";\nimport { Service } from \"./service\";\nimport { newURL } from \"./url\";\n\n/**\n * The async function type, allows for smooth transition between Promises\n */\nexport type asyncFn = (err?: any, value?: any) => void;\nexport interface ITransition {\n oldPage?: IPage;\n newPage?: IPage;\n trigger?: Trigger;\n scroll?: { x: number; y: number };\n scrollable?: boolean;\n in: (data: ITransitionData) => any;\n out: (data: ITransitionData) => any;\n [key: string]: any;\n}\nexport interface ITransitionData {\n from?: IPage;\n to?: IPage;\n trigger?: Trigger;\n scroll?: ICoords;\n done: asyncFn;\n}\nexport interface ITransitionManager extends Service {\n transitions: Manager,\n\n get(key: string): ITransition,\n set(key: string, value: ITransition): TransitionManager,\n add(value: ITransition): TransitionManager,\n has(key: string): boolean,\n\n boot(): any,\n animate(name: string, data: any): Promise,\n}\n\n/** Auto scrolls to an elements position if the element has an hash */\nexport const hashAction = (coords?: ICoords, hash: string = window.location.hash) => {\n try {\n let _hash = hash[0] == \"#\" ? hash : newURL(hash).hash;\n if (_hash.length > 1) {\n let el = document.getElementById(_hash.slice(1));\n if (el) {\n let { left, top } = el.getBoundingClientRect();\n let scrollLeft = window.pageXOffset;\n let scrollTop = window.pageYOffset;\n let x = left + scrollLeft;\n let y = top + scrollTop;\n\n console.log(x, y);\n return newCoords(x, y);\n }\n }\n } catch (e) {\n console.warn(\"[hashAction] error\", e);\n }\n\n return coords ?? newCoords(0, 0);\n};\n\n// The Default Transition\nconst Default: ITransition = {\n name: \"default\",\n scrollable: true,\n\n out({ done }: ITransitionData) {\n done();\n },\n in({ scroll, done }: ITransitionData) {\n window.scroll(scroll.x, scroll.y);\n done();\n }\n};\n\n/** Controls which Transition between pages to use */\nexport class TransitionManager extends Service implements ITransitionManager {\n transitions: Manager;\n private _arg: Array<[string, ITransition]>;\n constructor(transitions?: Array<[string, ITransition]>) {\n super();\n this._arg = transitions;\n }\n\n /** On Service install set Config */\n public install() {\n super.install();\n\n let transitions = this._arg && this._arg.length ? this._arg : (getConfig(this.config, \"transitions\") ?? []);\n\n // Manager like Maps use the most recent [key, value] Array it knows, replacing the default transition\n // With any other transitions called [\"default\", ...]\n transitions = [[\"default\", Default]].concat(transitions);\n this.transitions = new Manager(transitions);\n }\n\n get(key: string) { return this.transitions.get(key); }\n set(key: string, value: ITransition) { this.transitions.set(key, value); return this; }\n add(value: ITransition) { this.transitions.add(value); return this; }\n has(key: string) { return this.transitions.has(key); }\n\n /** Starts a transition */\n public async animate(name: string, data: any): Promise {\n let transition: ITransition = this.transitions.get(name);\n let scroll = data.scroll;\n let ignoreHashAction = data.ignoreHashAction;\n if (!(\"wrapper\" in data.oldPage) || !(\"wrapper\" in data.newPage))\n throw `[Page] either oldPage or newPage aren't instances of the Page Class.\\n ${{\n newPage: data.newPage,\n oldPage: data.oldPage,\n }}`;\n\n // Replace the title\n document.title = `` + data.newPage.title;\n\n let fromWrapper = data.oldPage.wrapper;\n let toWrapper = data.newPage.wrapper;\n\n if (!(fromWrapper instanceof Node) || !(toWrapper instanceof Node))\n throw `[Wrapper] the wrapper from the ${!(toWrapper instanceof Node) ? \"next\" : \"current\"\n } page cannot be found. The wrapper must be an element that has the attribute ${getConfig(this.config,\n \"wrapperAttr\"\n )}.`;\n\n // Give the Transition all the background data it may require\n transition.init && transition?.init(data);\n\n this.emitter.emit(\"BEFORE_TRANSITION_OUT\");\n\n // Start the out point of the Transition\n if (transition.out) {\n await new Promise((done) => {\n let outMethod: Promise = transition.out.call(transition, {\n ...data,\n from: data.oldPage,\n trigger: data.trigger,\n done,\n });\n\n outMethod?.then(done);\n });\n }\n\n this.emitter.emit(\"AFTER_TRANSITION_OUT\");\n\n // Add the new wrapper before the old one\n await new Promise((done) => {\n fromWrapper.insertAdjacentElement(\"beforebegin\", toWrapper);\n this.emitter.emit(\"CONTENT_INSERT\");\n\n if (!ignoreHashAction && !/back|popstate|forward/.test(data.trigger as string)) {\n scroll = hashAction(scroll);\n }\n done();\n });\n\n // Replace the old wrapper with the new one\n await new Promise((done) => {\n fromWrapper.remove();\n fromWrapper = undefined;\n toWrapper = undefined;\n this.emitter.emit(\"CONTENT_REPLACED\");\n done();\n });\n\n this.emitter.emit(\"BEFORE_TRANSITION_IN\");\n\n // Start the in point of the Transition (only the in method has access to the hashAction's scroll position)\n if (transition.in) {\n await new Promise(async (done) => {\n let inMethod: Promise = transition.in.call(transition, {\n ...data,\n from: data.oldPage,\n to: data.newPage,\n trigger: data.trigger,\n scroll,\n done,\n });\n\n inMethod?.then(done);\n });\n }\n\n this.emitter.emit(\"AFTER_TRANSITION_IN\");\n return transition;\n }\n}\n", "import { EventEmitter, ListenerCallback, EventInput } from \"./emitter\";\nimport { ServiceManager, Service } from \"./service\";\nimport { newConfig, ICONFIG } from \"./config\";\n\nexport interface IApp {\n services: ServiceManager,\n emitter: EventEmitter,\n config: ICONFIG,\n register(config: ICONFIG): App,\n get(key: string): Service,\n set(key: string, service: Service): App,\n add(value: Service): App,\n boot(): App,\n stop(): App,\n on(events: EventInput, callback?: ListenerCallback): App,\n off(events: EventInput, callback?: ListenerCallback): App,\n emit(events: string | any[], ...args: any): App,\n}\n\n/** The App class starts the entire process, it controls all managers and all services */\nexport class App implements IApp {\n /** An instance of the ServiceManager */\n public services: ServiceManager;\n\n /** An instance of an EventEmitter */\n public emitter: EventEmitter;\n\n /** The current Configuration's for the App */\n public config: ICONFIG;\n constructor(config: object = {}) {\n this.register(config);\n }\n\n /** Create new instances of the ServiceManager, EventEmitter and the configurations */\n public register(config: ICONFIG = {}): App {\n this.config = newConfig(config);\n this.emitter = new EventEmitter();\n this.services = new ServiceManager(this);\n\n let handler = (() => {\n document.removeEventListener(\"DOMContentLoaded\", handler);\n window.removeEventListener(\"load\", handler);\n this.emitter.emit(\"READY ready\");\n }).bind(this);\n\n document.addEventListener(\"DOMContentLoaded\", handler);\n window.addEventListener(\"load\", handler);\n return this;\n }\n\n /** Shortcuts to adding, setting, and getting Services */\n public get(key: string): Service {\n return this.services.get(key);\n }\n\n public set(key: string, value: Service): App {\n this.services.set(key, value);\n return this;\n }\n\n public add(value: Service): App {\n this.services.add(value);\n return this;\n }\n\n /** Initialize and boot all Services */\n public boot(): App {\n this.services.init();\n this.services.boot();\n return this;\n }\n\n /** Stops all Services and clears the even emitter of all events and listeners */\n public stop(): App {\n this.services.stop();\n this.emitter.clear();\n return this;\n }\n\n /** Shortcuts to the App EventEmitter on, off, and emit methods */\n public on(events: EventInput, callback?: ListenerCallback): App {\n this.emitter.on(events, callback, this);\n return this;\n }\n\n public off(events: EventInput, callback?: ListenerCallback): App {\n this.emitter.off(events, callback, this);\n return this;\n }\n\n public emit(events: string | any[], ...args: any): App {\n this.emitter.emit(events, ...args);\n return this;\n }\n}\n", "import { newState, Trigger, newCoords, IHistoryItem, IHistoryManager } from \"./history\";\nimport { Service } from \"./service\";\nimport { IPage, IPageManager } from \"./page\";\nimport { newURL, getHashedPath, equal } from \"./url\";\nimport { getConfig } from \"./config\";\nimport { hashAction, ITransitionManager } from \"./transition\";\n\nexport type LinkEvent = MouseEvent | TouchEvent;\nexport type StateEvent = LinkEvent | PopStateEvent;\nexport type IgnoreURLsList = Array;\n/**\n * Creates a barbajs like PJAX Service, for the native framework\n * Based on barbajs and StartingBlocks\n */\nexport class PJAX extends Service {\n /** URLs to ignore when prefetching */\n public ignoreURLs: IgnoreURLsList;\n\n /** Whether or not to disable prefetching */\n public prefetchIgnore: boolean;\n\n /** Current state of transitions */\n public isTransitioning: boolean;\n\n /** Ignore extra clicks of an anchor element if a transition has already started */\n public stopOnTransitioning: boolean;\n\n /** On page change (excluding popstate events) keep current scroll position */\n public stickyScroll: boolean;\n\n /** Force load a page if an error occurs */\n public forceOnError: boolean;\n\n /** Ignore hash action if set to true */\n public ignoreHashAction: boolean;\n\n public install() {\n super.install();\n\n this.ignoreURLs = getConfig(this.config, \"ignoreURLs\") ?? [];\n this.prefetchIgnore = getConfig(this.config, \"prefetchIgnore\") ?? false;\n this.stopOnTransitioning = getConfig(this.config, \"stopOnTransitioning\") ?? false;\n this.stickyScroll = getConfig(this.config, \"stickyScroll\") ?? false;\n this.forceOnError = getConfig(this.config, \"forceOnError\") ?? false;\n this.ignoreHashAction = getConfig(this.config, \"ignoreHashAction\") ?? false\n }\n\n /** Sets the transition state to either true or false */\n public transitionStart() {\n this.isTransitioning = true;\n }\n\n public transitionStop() {\n this.isTransitioning = false;\n }\n\n public init() {\n /**\n * Bind the event listeners to the PJAX class\n *\n * @memberof PJAX\n */\n this.onHover = this.onHover.bind(this);\n this.onClick = this.onClick.bind(this);\n this.onStateChange = this.onStateChange.bind(this);\n }\n\n /** Starts the PJAX Service */\n public boot() {\n if (\"scrollRestoration\" in window.history) {\n // Back off, browser, I got this...\n window.history.scrollRestoration = \"manual\";\n }\n\n super.boot();\n }\n\n /** Gets the transition to use for a certain anchor */\n public getTransitionName(el: HTMLAnchorElement): string | null {\n if (!el || !el.getAttribute) return null;\n let transitionAttr = el.getAttribute(\n getConfig(this.config, \"transitionAttr\", false)\n );\n\n if (typeof transitionAttr === \"string\") return transitionAttr;\n return null;\n }\n\n /** Checks to see if the anchor is valid */\n public validLink(\n el: HTMLAnchorElement,\n event: LinkEvent | KeyboardEvent,\n href: string\n ): boolean {\n let pushStateSupport = !window.history.pushState;\n let exists = !el || !href;\n let eventMutate =\n (event as KeyboardEvent).metaKey ||\n (event as KeyboardEvent).ctrlKey ||\n (event as KeyboardEvent).shiftKey ||\n (event as KeyboardEvent).altKey;\n let newTab =\n el.hasAttribute(\"target\") &&\n (el as HTMLAnchorElement).target === \"_blank\";\n let crossOrigin =\n (el as HTMLAnchorElement).protocol !== location.protocol ||\n (el as HTMLAnchorElement).hostname !== location.hostname;\n let download = typeof el.getAttribute(\"download\") === \"string\";\n let preventSelf = el.matches(getConfig(this.config, \"preventSelfAttr\"));\n let preventAll = Boolean(\n el.closest(getConfig(this.config, \"preventAllAttr\"))\n );\n let sameURL = getHashedPath(newURL()) === getHashedPath(newURL(href));\n return !(\n exists ||\n pushStateSupport ||\n eventMutate ||\n newTab ||\n crossOrigin ||\n download ||\n preventSelf ||\n preventAll ||\n sameURL\n );\n }\n\n /** Returns the href of an Anchor element */\n public getHref(el: HTMLAnchorElement): string | null {\n if (\n el &&\n el.tagName &&\n el.tagName.toLowerCase() === \"a\" &&\n typeof el.href === \"string\"\n )\n return el.href;\n return null;\n }\n\n /** Check if event target is a valid anchor with an href, if so, return the anchor */\n public getLink(event: LinkEvent): HTMLAnchorElement {\n let el = event.target as HTMLAnchorElement;\n let href: string = this.getHref(el);\n\n while (el && !href) {\n el = (el as HTMLElement).parentNode as HTMLAnchorElement;\n href = this.getHref(el);\n }\n\n // Check for a valid link\n if (!el || !this.validLink(el, event, href)) return;\n return el;\n }\n\n /** When an element is clicked, get valid anchor element, go for a transition */\n public onClick(event: LinkEvent) {\n let el = this.getLink(event);\n if (!el) return;\n\n if (this.isTransitioning && this.stopOnTransitioning) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n let href = this.getHref(el);\n this.emitter.emit(\"ANCHOR_CLICK CLICK\", event);\n this.go({ href, trigger: el, event });\n }\n\n /** Returns the direction of the State change as a String, either the Back button or the Forward button */\n public getDirection(value: number): Trigger {\n if (Math.abs(value) > 1) {\n // Ex 6-0 > 0 -> forward, 0-6 < 0 -> back\n return value > 0 ? \"forward\" : \"back\";\n } else {\n if (value === 0) {\n return \"popstate\";\n } else {\n // Ex 6-5 > 0 -> back, 5-6 < 0 -> forward\n return value > 0 ? \"back\" : \"forward\";\n }\n }\n }\n\n /** Force a page to go to a certain URL */\n public force(href: string): void {\n window.location.assign(href);\n }\n\n /**\n * If transition is running force load page.\n * Stop if currentURL is the same as new url.\n * On state change, change the current state history, to reflect the direction of said state change\n * Load page and page transition.\n */\n public go({\n href,\n trigger = \"HistoryManager\",\n event,\n }: {\n href: string;\n trigger?: Trigger;\n event?: StateEvent;\n }): Promise {\n // If transition is already running and the go method is called again, force load page\n if (this.isTransitioning && this.stopOnTransitioning ||\n !(this.manager.has(\"TransitionManager\") &&\n this.manager.has(\"HistoryManager\") &&\n this.manager.has(\"PageManager\"))) {\n this.force(href);\n return;\n }\n\n const history = this.manager.get(\"HistoryManager\") as IHistoryManager;\n let scroll = newCoords(0, 0);\n let currentState = history.current;\n let currentURL = currentState.url;\n if (equal(currentURL, href)) {\n return;\n }\n\n let transitionName: string;\n if (event && (event as PopStateEvent).state) {\n this.emitter.emit(\"POPSTATE\", event);\n\n // If popstate, get back/forward direction.\n let { state }: { state: IHistoryItem } = event as PopStateEvent;\n let { index } = state;\n let currentIndex = currentState.index;\n let difference = currentIndex - index;\n\n history.replace(state.states);\n history.pointer = index;\n\n let _state = history.get(index);\n transitionName = _state.transition;\n scroll = _state.data.scroll;\n\n trigger = this.getDirection(difference);\n console.log(trigger == \"forward\" && history)\n\n // Based on the direction of the state change either remove or add a state\n this.emitter.emit(trigger === \"back\" ? `POPSTATE_BACK` : `POPSTATE_FORWARD`, event);\n } else {\n // Add new state\n transitionName = this.getTransitionName(trigger as HTMLAnchorElement);\n\n scroll = newCoords();\n let state = newState({\n url: href,\n transition: transitionName,\n data: { scroll },\n });\n\n !this.stickyScroll && (scroll = newCoords(0, 0));\n\n history.add(state);\n this.emitter.emit(\"HISTORY_NEW_ITEM\", event);\n }\n\n if (event) {\n event.stopPropagation();\n event.preventDefault();\n }\n\n this.emitter.emit(\"GO\", event);\n return this.load({\n oldHref: currentURL,\n href,\n trigger,\n transitionName,\n scroll,\n });\n }\n\n /** Load the new Page as well as a Transition; starts the Transition */\n public async load({\n oldHref,\n href,\n trigger,\n transitionName = \"default\",\n scroll = { x: 0, y: 0 },\n }: {\n oldHref: string;\n href: string;\n trigger: Trigger;\n transitionName?: string;\n scroll: { x: number; y: number };\n }): Promise {\n try {\n const pages = this.manager.get(\"PageManager\") as IPageManager;\n let newPage: IPage, oldPage: IPage;\n this.emitter.emit(\"NAVIGATION_START\", {\n oldHref,\n href,\n trigger,\n transitionName,\n });\n\n // Load & Build both the old and new pages\n try {\n this.transitionStart();\n oldPage = await pages.load(oldHref);\n !(oldPage.dom instanceof Element) && oldPage.build();\n\n this.emitter.emit(\"PAGE_LOADING\", { href, oldPage, trigger });\n newPage = await pages.load(href);\n await newPage.build();\n this.emitter.emit(\"PAGE_LOAD_COMPLETE\", {\n newPage,\n oldPage,\n trigger,\n });\n } catch (err) {\n console.warn(`[PJAX] Page load error: ${err}`);\n }\n\n // Transition Between Pages\n try {\n const TransitionManager = this.manager.get(\"TransitionManager\") as ITransitionManager;\n this.emitter.emit(\"TRANSITION_START\", transitionName);\n\n let transition = await TransitionManager.animate(TransitionManager.has(transitionName) ? transitionName : \"default\", {\n oldPage,\n newPage,\n trigger,\n scroll,\n ignoreHashAction: this.ignoreHashAction\n });\n\n if (!transition.scrollable) {\n if (!this.ignoreHashAction && !/back|popstate|forward/.test(trigger as string)) scroll = hashAction(scroll);\n window.scroll(scroll.x, scroll.y);\n }\n\n this.emitter.emit(\"TRANSITION_END\", { transition });\n } catch (err) {\n console.warn(`[PJAX] Transition error: ${err}`);\n }\n\n // Navigation is over\n this.emitter.emit(\"NAVIGATION_END\", {\n oldPage,\n newPage,\n trigger,\n transitionName,\n });\n } catch (err) {\n if (this.forceOnError) this.force(href);\n else console.warn(err);\n } finally {\n this.transitionStop(); // Sets isTransitioning to false\n }\n }\n\n /** Check to see if the URL is to be ignored, uses either RegExp of Strings to check */\n public ignoredURL({ pathname }: URL): boolean {\n return (\n this.ignoreURLs.length &&\n this.ignoreURLs.some((url) => {\n return typeof url === \"string\"\n ? url === pathname\n : (url as RegExp).exec(pathname) !== null;\n })\n );\n }\n\n /** When you hover over an anchor, prefetch the event target's href */\n public onHover(event: LinkEvent): Promise {\n let el = this.getLink(event);\n if (!el || !this.manager.has(\"PageManager\")) return;\n\n const pages = this.manager.get(\"PageManager\") as IPageManager;\n let url = newURL(this.getHref(el));\n let urlString: string = url.pathname;\n\n // If Url is ignored or already in cache, don't do any think\n if (this.ignoredURL(url) || pages.has(urlString)) return;\n this.emitter.emit(\"ANCHOR_HOVER HOVER\", event);\n\n try {\n pages.load(url);\n } catch (err) {\n console.warn(\"[PJAX] prefetch error,\", err);\n }\n }\n\n /** When History state changes, get url from State, go for a Transition. */\n public onStateChange(event: PopStateEvent): void {\n this.go({ href: window.location.href, trigger: \"popstate\", event });\n }\n\n /** Initialize DOM Events */\n public initEvents() {\n if (this.prefetchIgnore !== true) {\n document.addEventListener(\"mouseover\", this.onHover);\n document.addEventListener(\"touchstart\", this.onHover);\n }\n\n document.addEventListener(\"click\", this.onClick);\n window.addEventListener(\"popstate\", this.onStateChange);\n }\n\n /** Stop DOM Events */\n public stopEvents() {\n if (this.prefetchIgnore !== true) {\n document.removeEventListener(\"mouseover\", this.onHover);\n document.removeEventListener(\"touchstart\", this.onHover);\n }\n\n document.removeEventListener(\"click\", this.onClick);\n window.removeEventListener(\"popstate\", this.onStateChange);\n }\n}\n", "import { Service } from \"./service\";\nimport { Manager } from \"./manager\";\nimport { newURL, getHashedPath } from \"./url\";\nimport { IHistoryManager } from \"./history\";\n\nexport type RouteMethod = (...args: any) => any;\nexport type RouteStyle = string | RegExp | boolean;\nexport interface IRouteToFrom {\n to: RouteStyle,\n from: RouteStyle\n}\nexport type RoutePath = IRouteToFrom | RouteStyle;\nexport interface IRoute {\n path: RoutePath,\n method: RouteMethod\n}\n\n/** Controls what happens when certain url paths match a set of criteria */\nexport class Router extends Service {\n /** List of routes */\n protected routes: Manager;\n constructor(routes: IRoute[] = []) {\n super();\n this.routes = new Manager();\n for (let route of routes) {\n this.add(route);\n }\n }\n\n /** Add a new route to watch for */\n public add({ path, method }: IRoute): Router {\n let key = this.parse(path);\n this.routes.set(key, method);\n return this;\n }\n\n /** Convert strings into path match functions */\n public parsePath(path: RouteStyle): RegExp | boolean {\n if (typeof path === \"string\") return new RegExp(path, \"i\");\n else if (path instanceof RegExp || typeof path === \"boolean\")\n return path;\n throw \"[Router] only regular expressions, strings and booleans are accepted as paths.\";\n }\n\n /** Determines if a strings counts has a path */\n public isPath(input: RouteStyle): boolean {\n return (\n typeof input === \"string\" ||\n input instanceof RegExp ||\n typeof input === \"boolean\"\n );\n }\n\n /** Parse the multiple different formats for paths, into a { from, to } object */\n public parse(input: RoutePath): IRouteToFrom {\n let route = input as IRouteToFrom;\n let toFromPath: IRouteToFrom = {\n from: /(.*)/g,\n to: /(.*)/g,\n };\n\n if (this.isPath(input as RouteStyle))\n toFromPath = {\n from: true,\n to: input as RouteStyle,\n };\n else if (this.isPath(route.from) && this.isPath(route.to as RouteStyle))\n toFromPath = route;\n else\n throw \"[Router] path is neither a string, regular expression, or a { from, to } object.\";\n\n let { from, to } = toFromPath;\n return {\n from: this.parsePath(from),\n to: this.parsePath(to),\n };\n }\n\n /** Test if route paths are true, if so run their methods */\n public route() {\n if (this.manager.has(\"HistoryManager\")) {\n let history = this.manager.get(\"HistoryManager\") as IHistoryManager;\n let from: string = getHashedPath(newURL((history.length > 1 ? history.previous : history.current).url));\n let to: string = getHashedPath(newURL());\n\n this.routes.forEach((method: RouteMethod, path: IRouteToFrom) => {\n let fromRegExp = path.from as RegExp | boolean;\n let toRegExp = path.to as RegExp | boolean;\n\n if (\n typeof fromRegExp === \"boolean\" &&\n typeof toRegExp === \"boolean\"\n ) {\n throw `[Router] path ({ from: ${fromRegExp}, to: ${toRegExp} }) is not valid, remember paths can only be strings, regular expressions, or a boolean; however, both the from and to paths cannot be both booleans.`;\n }\n\n let fromParam: RegExpExecArray | RegExp | boolean = fromRegExp;\n let toParam: RegExpExecArray | RegExp | boolean = toRegExp;\n\n if (fromRegExp instanceof RegExp && fromRegExp.test(from))\n fromParam = fromRegExp.exec(from);\n if (toRegExp instanceof RegExp && toRegExp.test(to))\n toParam = toRegExp.exec(to);\n\n if (\n (Array.isArray(toParam) && Array.isArray(fromParam)) ||\n (Array.isArray(toParam) &&\n typeof fromParam == \"boolean\" &&\n fromParam) ||\n (Array.isArray(fromParam) &&\n typeof toParam == \"boolean\" &&\n toParam)\n )\n method({ from: fromParam, to: toParam, path: { from, to } });\n });\n } else {\n console.warn(\"[Route] HistoryManager is missing.\");\n }\n }\n\n /** Add listeners for PJAX Events */\n public initEvents() {\n this.emitter.on(\"READY\", this.route, this);\n this.emitter.on(\"CONTENT_REPLACED\", this.route, this);\n }\n\n /** Remove listeners for PJAX Events */\n public stopEvents() {\n this.emitter.off(\"READY\", this.route, this);\n this.emitter.off(\"CONTENT_REPLACED\", this.route, this);\n }\n}\n", "import { EventEmitter, EventInput, ListenerCallback } from \"@okikio/emitter\";\nimport { Manager } from \"@okikio/manager\";\n\n// DOM\nexport type AnimationTarget = string | Node | NodeList | HTMLCollection | HTMLElement[] | AnimationTarget[];\nexport const getElements = (selector: string | Node): Node[] => {\n return typeof selector === \"string\" ? Array.from(document.querySelectorAll(selector as string)) : [selector];\n};\n\nconst flatten = (arr: AnimationTarget[]) => [].concat(...arr);\nexport const getTargets = (targets: AnimationTarget): Node[] => {\n if (Array.isArray(targets)) {\n return flatten((targets as AnimationTarget[]).map(getTargets));\n }\n if (typeof targets == \"string\" || targets instanceof Node)\n return getElements(targets);\n if (targets instanceof NodeList || targets instanceof HTMLCollection)\n return Array.from(targets);\n return [];\n};\n\n// VALUES\nexport type closureArgs = [number, number, HTMLElement];\nexport type closure = ((index?: number, total?: number, element?: HTMLElement) => (genericTypes[] | void)) | any;\nexport const computeValue = (value: closure, args: closureArgs, context: Animate) => {\n if (typeof value === \"function\") {\n return value.apply(context, args);\n } else { return value; }\n};\n\nexport const mapObject = (obj: object, args: closureArgs, options: Animate): any => {\n let key: string, value: any, result = {};\n let keys = Object.keys(obj);\n for (let i = 0, len = keys.length; i < len; i++) {\n key = keys[i];\n value = obj[key];\n result[key] = computeValue(value, args, options);\n }\n\n return result;\n};\n\n/** From: [https://easings.net] */\nexport const easings = {\n \"in\": \"ease-in\",\n \"out\": \"ease-out\",\n \"in-out\": \"ease-in-out\",\n\n // Sine\n \"in-sine\": \"cubic-bezier(0.47, 0, 0.745, 0.715)\",\n \"out-sine\": \"cubic-bezier(0.39, 0.575, 0.565, 1)\",\n \"in-out-sine\": \"cubic-bezier(0.445, 0.05, 0.55, 0.95)\",\n\n // Quad\n \"in-quad\": \"cubic-bezier(0.55, 0.085, 0.68, 0.53)\",\n \"out-quad\": \"cubic-bezier(0.25, 0.46, 0.45, 0.94)\",\n \"in-out-quad\": \"cubic-bezier(0.455, 0.03, 0.515, 0.955)\",\n\n // Cubic\n \"in-cubic\": \"cubic-bezier(0.55, 0.055, 0.675, 0.19)\",\n \"out-cubic\": \"cubic-bezier(0.215, 0.61, 0.355, 1)\",\n \"in-out-cubic\": \"cubic-bezier(0.645, 0.045, 0.355, 1)\",\n\n // Quart\n \"in-quart\": \"cubic-bezier(0.895, 0.03, 0.685, 0.22)\",\n \"out-quart\": \"cubic-bezier(0.165, 0.84, 0.44, 1)\",\n \"in-out-quart\": \"cubic-bezier(0.77, 0, 0.175, 1)\",\n\n // Quint\n \"in-quint\": \"cubic-bezier(0.755, 0.05, 0.855, 0.06)\",\n \"out-quint\": \"cubic-bezier(0.23, 1, 0.32, 1)\",\n \"in-out-quint\": \"cubic-bezier(0.86, 0, 0.07, 1)\",\n\n // Expo\n \"in-expo\": \"cubic-bezier(0.95, 0.05, 0.795, 0.035)\",\n \"out-expo\": \"cubic-bezier(0.19, 1, 0.22, 1)\",\n \"in-out-expo\": \"cubic-bezier(1, 0, 0, 1)\",\n\n // Circ\n \"in-circ\": \"cubic-bezier(0.6, 0.04, 0.98, 0.335)\",\n \"out-circ\": \"cubic-bezier(0.075, 0.82, 0.165, 1)\",\n \"in-out-circ\": \"cubic-bezier(0.785, 0.135, 0.15, 0.86)\",\n\n // Back\n \"in-back\": \"cubic-bezier(0.6, -0.28, 0.735, 0.045)\",\n \"out-back\": \"cubic-bezier(0.175, 0.885, 0.32, 1.275)\",\n \"in-out-back\": \"cubic-bezier(0.68, -0.55, 0.265, 1.55)\"\n};\n\nexport const getEase = (ease: string) => {\n return /^(in|out)/.test(ease) ? easings[ease] : ease;\n};\n\nexport type genericTypes = genericTypes[] | boolean | object | string | number | closure | null | undefined;\nexport interface AnimationOptions {\n target?: AnimationTarget,\n\n speed?: number,\n autoplay?: boolean,\n options?: AnimationOptions,\n delay?: number | closure,\n easing?: string | closure,\n endDelay?: number | closure,\n duration?: number | closure,\n keyframes?: Keyframe[] | object[] | closure,\n loop?: number | boolean | closure, // iterations: number,\n onfinish?: (element?: HTMLElement, index?: number, total?: number, animation?: Animation) => any,\n fillMode?: \"none\" | \"forwards\" | \"backwards\" | \"both\" | \"auto\" | closure,\n direction?: \"normal\" | \"reverse\" | \"alternate\" | \"alternate-reverse\" | closure,\n extend?: EffectTiming,\n [property: string]: genericTypes;\n};\n\nexport const DefaultAnimationOptions: AnimationOptions = {\n keyframes: [],\n\n loop: 1, // iterations: number,\n delay: 0,\n speed: 1,\n endDelay: 0,\n easing: \"ease\",\n autoplay: true,\n duration: 1000,\n fillMode: \"auto\",\n direction: \"normal\",\n extend: {}\n};\n\nexport type AnimationEvents = \"update\" | \"play\" | \"pause\" | \"start\" | \"begin\" | \"complete\" | \"finish\" | \"error\" | \"stop\";\n\n/** You can check it out here: https://codepen.io/okikio/pen/qBbdGaW?editors=0011 */\nexport class Animate {\n /**\n * Stores the options for the current animation\n */\n public options: AnimationOptions = {};\n\n /**\n * The Array of Elements to Animate\n */\n public targets: Node[] = [];\n\n /**\n * The properties to animate\n */\n public properties: object = {};\n\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n\n /**\n * The total duration of all Animation's\n */\n public totalDuration: number = 0;\n\n /**\n * The smallest delay out of all Animation's\n */\n public minDelay: number = 0;\n\n /**\n * The options for individual animations\n */\n public computedOptions: Manager = new Manager();\n\n /**\n * The Element the main animation uses\n */\n public mainElement: HTMLElement;\n\n /**\n * Stores an animation that runs on the total duration of the all other Animations, and as such it's the main Animation\n */\n public mainAnimation: Animation;\n\n /**\n * Stores request frame calls\n */\n public animationFrame: number;\n\n /**\n * An event emitter\n */\n public emitter: EventEmitter = new EventEmitter();\n\n /**\n * Returns a promise that is fulfilled when the mainAnimation is finished\n */\n public promise: Promise;\n constructor(options: AnimationOptions = {}) {\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n\n /**\n * Returns a new Promise that is resolve when this.finish is called\n */\n public newPromise(): Promise {\n return new Promise((resolve, reject) => {\n /*\n Note that the `this` keyword is in an Array when it is resolved,\n this is due to Promises not wanting to resolve references,\n so, you can't resolve `this` directly, so, I chose to resolve `this` in an\n Array\n */\n this.on(\"complete\", () => resolve([this]));\n this.on(\"error\", err => reject(err));\n });\n }\n\n /**\n * Fulfills the this.promise Promise\n */\n public then(\n onFulfilled?: (value?: any) => any,\n onRejected?: (reason?: any) => any\n ): Animate {\n onFulfilled = onFulfilled?.bind(this);\n onRejected = onRejected?.bind(this);\n this.promise.then(onFulfilled, onRejected);\n return this;\n }\n\n /**\n * Catches error that occur in the this.promise Promise\n */\n public catch(onRejected: (reason?: any) => any): Animate {\n onRejected = onRejected?.bind(this);\n this.promise.catch(onRejected);\n return this;\n }\n\n /**\n * If you don't care if the this.promise Promise has either been rejected or resolved\n */\n public finally(onFinally: () => any): Animate {\n onFinally = onFinally?.bind(this);\n this.promise.finally(onFinally);\n return this;\n }\n\n /**\n * Represents an Animation Frame Loop\n */\n public loop(): void {\n this.stopLoop();\n this.emit(\"update\", this.getProgress(), this);\n this.animationFrame = window.requestAnimationFrame(this.loop);\n }\n\n /**\n * Cancels animation frame\n */\n public stopLoop() {\n window.cancelAnimationFrame(this.animationFrame);\n }\n\n /**\n * Calls a method that affects all animations including the mainAnimation; the method only allows the animation parameter\n */\n public all(method: (animation?: Animation, target?: HTMLElement) => void) {\n method(this.mainAnimation, this.mainElement);\n this.animations.forEach(method);\n return this;\n }\n\n /**\n * Register the begin event\n */\n protected beginEvent() {\n if (this.getProgress() == 0) {\n let timer: number | void = window.setTimeout(() => {\n this.emit(\"begin\", this);\n timer = window.clearTimeout(timer as number);\n }, this.minDelay);\n }\n }\n\n /**\n * Play Animation\n */\n public play(): Animate {\n let playstate = this.getPlayState();\n this.beginEvent();\n this.all(anim => anim.play());\n this.emit(\"play\", playstate, this);\n this.loop();\n return this;\n }\n\n /**\n * Pause Animation\n */\n public pause(): Animate {\n let playstate = this.getPlayState();\n this.all(anim => anim.pause());\n this.emit(\"pause\", playstate, this);\n this.stopLoop();\n this.animationFrame = undefined;\n return this;\n }\n\n /**\n * Reset all Animations\n */\n public reset() {\n this.setProgress(0);\n this.beginEvent();\n\n if (this.options.autoplay) this.play();\n else this.pause();\n return this;\n }\n\n /**\n * Cancels all Animations\n */\n public cancel() {\n this.all(anim => anim.cancel());\n this.stopLoop();\n return this;\n }\n\n /**\n * Force complete all Animations\n */\n public finish() {\n this.all(anim => anim.finish());\n this.stopLoop();\n return this;\n }\n\n /**\n * Cancels & Clears all Animations\n */\n public stop() {\n this.cancel();\n this.animations.clear();\n while (this.targets.length) this.targets.pop();\n this.mainElement = undefined;\n this.emit(\"stop\");\n }\n\n /**\n * Returns an Array of targets\n */\n public getTargets(): Node[] {\n return this.targets;\n }\n\n /**\n * Get a specific Animation from an Animate instance\n */\n public getAnimation(element: HTMLElement): Animation {\n return this.animations.get(element);\n }\n\n /**\n * Returns the timings of an Animation, given a target\n * E.g. { duration, endDelay, delay, iterations, iterationStart, direction, easing, fill, etc... }\n */\n public getTiming(target: HTMLElement | Animation): AnimationOptions & EffectTiming {\n let animation = target instanceof Animation ? target : this.getAnimation(target);\n let keyframeOptions = this.computedOptions.get(animation) ?? {};\n let timings = animation.effect?.getTiming() ?? {};\n let options = this.getOptions();\n\n return { ...DefaultAnimationOptions, ...options, ...timings, ...keyframeOptions };\n }\n\n /**\n * Returns the total duration of Animation\n */\n public getTotalDuration(): number {\n return this.totalDuration;\n }\n\n /**\n * Returns the current time of the Main Animation\n */\n public getCurrentTime(): number {\n return this.mainAnimation.currentTime;\n }\n\n /**\n * Returns the Animation progress as a fraction of the current time / duration * 100\n */\n public getProgress() {\n return (this.getCurrentTime() / this.totalDuration) * 100;\n }\n\n /**\n * Return the playback speed of the animation\n */\n public getSpeed(): number {\n return this.mainAnimation.playbackRate;\n }\n\n /**\n * Returns the current playing state\n */\n public getPlayState(): \"idle\" | \"running\" | \"paused\" | \"finished\" {\n return this.mainAnimation.playState;\n }\n\n /**\n * Get the options of an Animate instance\n */\n public getOptions(): AnimationOptions {\n return this.options;\n }\n\n /**\n * Set the current time of the Main Animation\n */\n public setCurrentTime(time: number): Animate {\n this.all(anim => { anim.currentTime = time; });\n this.emit(\"update\", this.getProgress());\n return this;\n }\n\n /**\n * Set the Animation progress as a value from 0 to 100\n */\n public setProgress(percent: number): Animate {\n let time = (percent / 100) * this.totalDuration;\n this.setCurrentTime(time);\n return this;\n }\n\n /**\n * Set the playback speed of an Animation\n */\n public setSpeed(speed: number = 1): Animate {\n this.all(anim => { anim.playbackRate = speed; });\n return this;\n }\n\n /**\n * Adds a listener for a given event\n */\n public on(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.on(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Removes a listener from an event\n */\n public off(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.off(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Call all listeners within an event\n */\n public emit(events: AnimationEvents | string | any[], ...args: any): Animate {\n this.emitter.emit(events, ...args);\n return this;\n }\n\n\n /** Returns the Animate options, as JSON */\n public toJSON(): AnimationOptions {\n return this.getOptions();\n }\n\n /**\n * The Symbol.toStringTag well-known symbol is a string valued property that is used\n * in the creation of the default string description of an object.\n * It is accessed internally by the Object.prototype.toString() method.\n */\n get [Symbol.toStringTag]() {\n return `Animate`;\n }\n}\n\n/** Creates a new Animate instance */\nexport const animate = (options: AnimationOptions = {}): Animate => {\n return new Animate(options);\n};\n\nexport class Timeline extends Animate {\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n constructor(options: AnimationOptions = {}) {\n super();\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n public add(options: AnimationOptions) {\n return this;\n }\n}\n\nexport default animate;"], + "mappings": "kIAAA,2sBCeO,GAAM,IAAkB,CAC3B,YAAa,UACb,eAAgB,eAChB,eAAgB,cAChB,QAAS,CACL,CAAC,YAAa,SAElB,gBAAiB,iBACjB,eAAgB,gBAChB,eAAgB,aAChB,UAAW,QACX,QAAS,IACT,SAAU,GAID,EAAY,AAAC,GACf,OAAO,OAAO,IAAK,IAAmB,GAIpC,GAAS,CAAC,EAAiB,EAAe,EAAoB,KAAiB,CACxF,GAAI,CAAE,UAAW,EACb,EAAO,OAAO,EAAS,IAAM,EAAS,MAAM,IAChD,MAAO,GAAW,IAAI,KAAU,GAIvB,EAAY,CAAC,EAAiB,EAAoB,EAAoB,KAAc,CAC7F,GAAI,MAAO,IAAU,SACjB,MAAO,GAEX,GAAI,GAAO,EAAO,GAClB,MAAI,OAAO,IAAS,SACT,GAAO,EAAQ,EAAM,GACzB,GCjDJ,WAAoB,CAG1B,YAAY,EAAuB,CAClC,KAAK,IAAM,GAAI,KAAI,GAIb,QAAoB,CAC1B,MAAO,MAAK,IAIN,IAAI,EAAW,CACrB,MAAO,MAAK,IAAI,IAAI,GAId,MAAiB,CACvB,MAA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AAO,QAAQ,EAAmB,GAGlD,EAAU,SAAW,IAAM,CACvB,MAAO,IAAY,YAAc,EAAS,KAAK,KAAM,EAAQ,EAAG,EAAK,GACrE,KAAK,KAAK,SAAU,EAAQ,EAAG,EAAK,IAIxC,KAAK,gBAAgB,IAAI,EAAW,GACpC,KAAK,WAAW,IAAI,EAAQ,GAC5B,EAAO,KAAK,EAAiB,OAGjC,KAAK,cAAgB,KAAK,YAAY,QAAQ,CAC1C,CAAE,QAAS,KACX,CAAE,QAAS,MACZ,CAEC,SAAU,KAAK,cACf,OAAQ,WAGZ,KAAK,SAAW,KAAK,IAAI,GAAG,GAC5B,KAAK,SAAS,GACd,AAAI,EAAU,KAAK,OACd,KAAK,QAEV,KAAK,QAAU,KAAK,aACpB,KAAK,cAAc,SAAW,IAAM,CAChC,KAAK,KAAK,WAAY,MACtB,KAAK,kBAEJ,EAAP,CACE,KAAK,KAAK,QAAS,IAGpB,IAAI,EAA2B,CAClC,MAAO", "names": [] } diff --git a/packages/native/lib/api.es.js b/packages/native/lib/api.es.js index 67f77b3..57978b9 100644 --- a/packages/native/lib/api.es.js +++ b/packages/native/lib/api.es.js @@ -1,3 +1,3 @@ -var Q={wrapperAttr:"wrapper",noAjaxLinkAttr:"no-ajax-link",noPrefetchAttr:"no-prefetch",headers:[["x-partial","true"]],preventSelfAttr:'prevent="self"',preventAllAttr:'prevent="all"',transitionAttr:"transition",blockAttr:"block",timeout:3e4},z=r=>Object.assign({...Q},r),Z=(r,t,e=!0)=>{let{prefix:i}=r,n=`data${i?"-"+i:""}-${t}`;return e?`[${n}]`:n},u=(r,t,e=!0)=>{if(typeof t!="string")return r;let i=r[t];return typeof i=="string"?Z(r,i,e):i};var h=class{constructor(t){this.map=new Map(t)}getMap(){return this.map}get(t){return this.map.get(t)}keys(){return Array.from(this.map.keys())}values(){return Array.from(this.map.values())}set(t,e){return this.map.set(t,e),this}add(t){let i=this.size;return this.set(i,t),this}get size(){return this.map.size}get length(){return this.map.size}last(t=1){let e=this.keys()[this.size-t];return this.get(e)}delete(t){return this.map.delete(t)}remove(t){return this.map.delete(t),this}clear(){return this.map.clear(),this}has(t){return this.map.has(t)}entries(){return this.map.entries()}forEach(t,e){return this.map.forEach(t,e),this}[Symbol.iterator](){return this.entries()}},E=(r,t,...e)=>{r.forEach(i=>{i[t](...e)})},tt=async(r,t,...e)=>{for(let[,i]of r)await i[t](...e)};var T=class{constructor(){}install(){}register(t,e){return this.manager=t,this.app=t.app,this.config=t.config,this.emitter=t.emitter,this.key=e,this.install(),this}uninstall(){}unregister(){this.uninstall(),this.manager.remove(this.key),this.key=void 0,this.manager=void 0,this.app=void 0,this.config=void 0,this.emitter=void 0}},L=class extends h{constructor(t){super();this.app=t,this.config=t.config,this.emitter=t.emitter}set(t,e){return super.set(t,e),e.register(this,t),this}};var c=(r=window.location.href)=>r instanceof URL?r:new URL(r,window.location.origin),f=r=>`${r.pathname}${r.hash}`,At=r=>r.hash.slice(1),F=r=>r.toString().replace(/(\/#.*|\/|#.*)$/,""),R=(r,t)=>{let e=c(r),i=c(t);return F(e)===F(i)};var g=class extends T{init(){}boot(){this.initEvents()}initEvents(){}stopEvents(){}stop(){this.stopEvents(),this.unregister()}},N=class extends L{constructor(t){super(t)}init(){return E(this,"init"),this}boot(){return E(this,"boot"),this}stop(){return E(this,"stop"),this}};var y=(r=window.scrollX,t=window.scrollY)=>({x:r,y:t}),O=(r={url:f(c()),index:0,transition:"default",data:{scroll:y(),trigger:"HistoryManager"}})=>r,et=class extends g{constructor(){super(...arguments);this.pointer=-1}init(){this.states=[];let t=O();this.add(t,"replace")}get(t){return this.states[t]}add(t,e="push"){let i=O(t),n=this.length;this.states.push({...i}),this.pointer=n;let s={index:this.pointer,states:[...this.states]};return it(e,i,s),this}remove(t){return t?this.states.splice(t,1):this.states.pop(),this.pointer--,this}replace(t){return this.states=t,this}set(t,e){return this.states[t]=e}get current(){return this.get(this.pointer)}get last(){return this.get(this.length-1)}get previous(){return this.pointer<1?null:this.get(this.pointer-1)}get length(){return this.states.length}},it=(r,t,e)=>{let i=f(c(t.url)),n=[e,"",i];if(window.history)switch(r){case"push":window.history.pushState.apply(window.history,n);break;case"replace":window.history.replaceState.apply(window.history,n);break}};var rt=new DOMParser,D=class extends T{constructor(t=c(),e=document){super();this.url=t,typeof e=="string"?this.data=e:this.dom=e||document}build(){if(this.dom instanceof Node||(this.dom=rt.parseFromString(this.data,"text/html")),!(this.body instanceof Node)){let{title:t,head:e,body:i}=this.dom;this.title=t,this.head=e,this.body=i,this.wrapper=this.body.querySelector(this.wrapperAttr)}}install(){this.wrapperAttr=u(this.config,"wrapperAttr")}uninstall(){this.url=void 0,this.title=void 0,this.head=void 0,this.body=void 0,this.dom=void 0,this.wrapper=void 0,this.data=void 0,this.wrapperAttr=void 0}},nt=class extends g{constructor(){super(...arguments);this.loading=new h}install(){this.pages=new L(this.app),this.maxPages=this.config.maxPages??5;let t=c().pathname;this.set(t,new D),t=void 0}get(t){return this.pages.get(t)}add(t){return this.pages.add(t),this}set(t,e){return this.pages.set(t,e),this}remove(t){return this.pages.remove(t),this}has(t){return this.pages.has(t)}clear(){return this.pages.clear(),this}get size(){return this.pages.size}keys(){return this.pages.keys()}async load(t=c()){let e=c(t),i=e.pathname,n,s;if(this.has(i))return n=this.get(i),Promise.resolve(n);this.loading.has(i)?s=this.loading.get(i):(s=this.request(i),this.loading.set(i,s));let a=await s;if(this.loading.remove(i),n=new D(e,a),this.set(i,n),this.size>this.maxPages){let l=c(),o=this.keys(),p=R(l,o[0])?o[1]:o[0],m=this.get(p);m.unregister(),m=void 0,o=void 0,l=void 0,p=void 0}return n}async request(t){let e=new Headers(u(this.config,"headers")),i=window.setTimeout(()=>{throw window.clearTimeout(i),"Request Timed Out!"},u(this.config,"timeout"));try{let n=await fetch(t,{mode:"same-origin",method:"GET",headers:e,cache:"default",credentials:"same-origin"});if(window.clearTimeout(i),n.status>=200&&n.status<300)return await n.text();throw new Error(n.statusText||""+n.status)}catch(n){throw window.clearTimeout(i),n}}};var j=({callback:r=()=>{},scope:t=null,name:e="event"})=>({callback:r,scope:t,name:e}),M=class extends h{constructor(t="event"){super();this.name=t}},P=class extends h{constructor(){super()}getEvent(t){let e=this.get(t);return e instanceof M?e:(this.set(t,new M(t)),this.get(t))}newListener(t,e,i){let n=this.getEvent(t);return n.add(j({name:t,callback:e,scope:i})),n}on(t,e,i){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let n,s,a=typeof t=="object"&&!Array.isArray(t),l=a?e:i;return a||(s=e),Object.keys(t).forEach(o=>{a?(n=o,s=t[o]):n=t[o],this.newListener(n,s,l)},this),this}removeListener(t,e,i){let n=this.get(t);if(n instanceof M&&e){let s=j({name:t,callback:e,scope:i});n.forEach((a,l)=>{if(a.callback===s.callback&&a.scope===s.scope)return n.remove(l)})}return n}off(t,e,i){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let n,s,a=typeof t=="object"&&!Array.isArray(t),l=a?e:i;return a||(s=e),Object.keys(t).forEach(o=>{a?(n=o,s=t[o]):n=t[o],typeof s=="function"?this.removeListener(n,s,l):this.remove(n)},this),this}emit(t,...e){return typeof t=="undefined"?this:(typeof t=="string"&&(t=t.trim().split(/\s/g)),t.forEach(i=>{let n=this.get(i);n instanceof M&&n.forEach(s=>{let{callback:a,scope:l}=s;a.apply(l,e)})},this),this)}clear(){return E(this,"clear"),super.clear(),this}};var K=(r,t=window.location.hash)=>{try{let e=t[0]=="#"?t:c(t).hash;if(e.length>1){let i=document.getElementById(e.slice(1));if(i)return y(i.offsetLeft,i.offsetTop)}}catch(e){console.warn("[hashAction] error",e)}return r??y(0,0)},st={name:"default",scrollable:!0,out({done:r}){r()},in({scroll:r,done:t}){window.scroll(r.x,r.y),t()}},ot=class extends g{constructor(t){super();this._arg=t}install(){super.install();let t=this._arg&&this._arg.length?this._arg:u(this.config,"transitions")??[];t=[["default",st]].concat(t),this.transitions=new h(t)}get(t){return this.transitions.get(t)}set(t,e){return this.transitions.set(t,e),this}add(t){return this.transitions.add(t),this}has(t){return this.transitions.has(t)}async animate(t,e){let i=this.transitions.get(t),n=e.scroll,s=e.ignoreHashAction;if(!("wrapper"in e.oldPage)||!("wrapper"in e.newPage))throw`[Page] either oldPage or newPage aren't instances of the Page Class. - ${{newPage:e.newPage,oldPage:e.oldPage}}`;document.title=""+e.newPage.title;let a=e.oldPage.wrapper,l=e.newPage.wrapper;if(!(a instanceof Node)||!(l instanceof Node))throw`[Wrapper] the wrapper from the ${l instanceof Node?"current":"next"} page cannot be found. The wrapper must be an element that has the attribute ${u(this.config,"wrapperAttr")}.`;return i.init&&i?.init(e),this.emitter.emit("BEFORE_TRANSITION_OUT"),i.out&&await new Promise(o=>{i.out.call(i,{...e,from:e.oldPage,trigger:e.trigger,done:o})?.then(o)}),this.emitter.emit("AFTER_TRANSITION_OUT"),await new Promise(o=>{a.insertAdjacentElement("beforebegin",l),this.emitter.emit("CONTENT_INSERT"),!s&&!/back|popstate|forward/.test(e.trigger)&&(n=K(n)),o()}),await new Promise(o=>{a.remove(),a=void 0,l=void 0,this.emitter.emit("CONTENT_REPLACED"),o()}),this.emitter.emit("BEFORE_TRANSITION_IN"),i.in&&await new Promise(async o=>{i.in.call(i,{...e,from:e.oldPage,to:e.newPage,trigger:e.trigger,scroll:n,done:o})?.then(o)}),this.emitter.emit("AFTER_TRANSITION_IN"),i}};var at=class{constructor(t={}){this.register(t)}register(t={}){this.config=z(t),this.emitter=new P,this.services=new N(this);let e=(()=>{document.removeEventListener("DOMContentLoaded",e),window.removeEventListener("load",e),this.emitter.emit("READY ready")}).bind(this);return document.addEventListener("DOMContentLoaded",e),window.addEventListener("load",e),this}get(t){return this.services.get(t)}set(t,e){return this.services.set(t,e),this}add(t){return this.services.add(t),this}boot(){return this.services.init(),this.services.boot(),this}stop(){return this.services.stop(),this.emitter.clear(),this}on(t,e){return this.emitter.on(t,e,this),this}off(t,e){return this.emitter.off(t,e,this),this}emit(t,...e){return this.emitter.emit(t,...e),this}};var lt=class extends g{install(){super.install(),this.ignoreURLs=u(this.config,"ignoreURLs")??[],this.prefetchIgnore=u(this.config,"prefetchIgnore")??!1,this.stopOnTransitioning=u(this.config,"stopOnTransitioning")??!1,this.stickyScroll=u(this.config,"stickyScroll")??!1,this.forceOnError=u(this.config,"forceOnError")??!1,this.ignoreHashAction=u(this.config,"ignoreHashAction")??!1}transitionStart(){this.isTransitioning=!0}transitionStop(){this.isTransitioning=!1}init(){this.onHover=this.onHover.bind(this),this.onClick=this.onClick.bind(this),this.onStateChange=this.onStateChange.bind(this)}boot(){"scrollRestoration"in window.history&&(window.history.scrollRestoration="manual"),super.boot()}getTransitionName(t){if(!t||!t.getAttribute)return null;let e=t.getAttribute(u(this.config,"transitionAttr",!1));return typeof e=="string"?e:null}validLink(t,e,i){let n=!window.history.pushState,s=!t||!i,a=e.metaKey||e.ctrlKey||e.shiftKey||e.altKey,l=t.hasAttribute("target")&&t.target==="_blank",o=t.protocol!==location.protocol||t.hostname!==location.hostname,p=typeof t.getAttribute("download")=="string",m=t.matches(u(this.config,"preventSelfAttr")),S=Boolean(t.closest(u(this.config,"preventAllAttr"))),x=f(c())===f(c(i));return!(s||n||a||l||o||p||m||S||x)}getHref(t){return t&&t.tagName&&t.tagName.toLowerCase()==="a"&&typeof t.href=="string"?t.href:null}getLink(t){let e=t.target,i=this.getHref(e);for(;e&&!i;)e=e.parentNode,i=this.getHref(e);if(!(!e||!this.validLink(e,t,i)))return e}onClick(t){let e=this.getLink(t);if(!e)return;if(this.isTransitioning&&this.stopOnTransitioning){t.preventDefault(),t.stopPropagation();return}let i=this.getHref(e);this.emitter.emit("ANCHOR_CLICK CLICK",t),this.go({href:i,trigger:e,event:t})}getDirection(t){return Math.abs(t)>1?t>0?"forward":"back":t===0?"popstate":t>0?"back":"forward"}force(t){window.location.assign(t)}go({href:t,trigger:e="HistoryManager",event:i}){if(this.isTransitioning&&this.stopOnTransitioning||!(this.manager.has("TransitionManager")&&this.manager.has("HistoryManager")&&this.manager.has("PageManager"))){this.force(t);return}let n=this.manager.get("HistoryManager"),s=y(0,0),a=n.current,l=a.url;if(R(l,t))return;let o;if(i&&i.state){this.emitter.emit("POPSTATE",i);let{state:p}=i,{index:m}=p,x=a.index-m,w=n.get(n.pointer);o=w.transition,s=w.data.scroll,n.replace(p.states),n.pointer=m,e=this.getDirection(x),this.emitter.emit(e==="back"?"POPSTATE_BACK":"POPSTATE_FORWARD",i)}else{o=this.getTransitionName(e),s=y();let p=O({url:t,transition:o,data:{scroll:s}});!this.stickyScroll&&(s=y(0,0)),n.add(p),this.emitter.emit("HISTORY_NEW_ITEM",i)}return i&&(i.stopPropagation(),i.preventDefault()),this.emitter.emit("GO",i),this.load({oldHref:l,href:t,trigger:e,transitionName:o,scroll:s})}async load({oldHref:t,href:e,trigger:i,transitionName:n="default",scroll:s={x:0,y:0}}){try{let a=this.manager.get("PageManager"),l,o;this.emitter.emit("NAVIGATION_START",{oldHref:t,href:e,trigger:i,transitionName:n});try{this.transitionStart(),o=await a.load(t),!(o.dom instanceof Element)&&o.build(),this.emitter.emit("PAGE_LOADING",{href:e,oldPage:o,trigger:i}),l=await a.load(e),await l.build(),this.emitter.emit("PAGE_LOAD_COMPLETE",{newPage:l,oldPage:o,trigger:i})}catch(p){throw`[PJAX] page load error: ${p}`}try{let p=this.manager.get("TransitionManager");this.emitter.emit("TRANSITION_START",n);let m=await p.animate(p.has(n)?n:"default",{oldPage:o,newPage:l,trigger:i,scroll:s,ignoreHashAction:this.ignoreHashAction});m.scrollable||(!this.ignoreHashAction&&!/back|popstate|forward/.test(i)&&(s=K(s)),window.scroll(s.x,s.y)),this.emitter.emit("TRANSITION_END",{transition:m})}catch(p){throw`[PJAX] transition error: ${p}`}this.emitter.emit("NAVIGATION_END",{oldPage:o,newPage:l,trigger:i,transitionName:n})}catch(a){this.forceOnError?this.force(e):console.warn(a)}finally{this.transitionStop()}}ignoredURL({pathname:t}){return this.ignoreURLs.length&&this.ignoreURLs.some(e=>typeof e=="string"?e===t:e.exec(t)!==null)}onHover(t){let e=this.getLink(t);if(!e||!this.manager.has("PageManager"))return;let i=this.manager.get("PageManager"),n=c(this.getHref(e)),s=n.pathname;if(!(this.ignoredURL(n)||i.has(s))){this.emitter.emit("ANCHOR_HOVER HOVER",t);try{i.load(n)}catch(a){console.warn("[PJAX] prefetch error,",a)}}}onStateChange(t){this.go({href:window.location.href,trigger:"popstate",event:t})}initEvents(){this.prefetchIgnore!==!0&&(document.addEventListener("mouseover",this.onHover),document.addEventListener("touchstart",this.onHover)),document.addEventListener("click",this.onClick),window.addEventListener("popstate",this.onStateChange)}stopEvents(){this.prefetchIgnore!==!0&&(document.removeEventListener("mouseover",this.onHover),document.removeEventListener("touchstart",this.onHover)),document.removeEventListener("click",this.onClick),window.removeEventListener("popstate",this.onStateChange)}};var pt=class extends g{constructor(t=[]){super();this.routes=new h;for(let e of t)this.add(e)}add({path:t,method:e}){let i=this.parse(t);return this.routes.set(i,e),this}parsePath(t){if(typeof t=="string")return new RegExp(t,"i");if(t instanceof RegExp||typeof t=="boolean")return t;throw"[Router] only regular expressions, strings and booleans are accepted as paths."}isPath(t){return typeof t=="string"||t instanceof RegExp||typeof t=="boolean"}parse(t){let e=t,i={from:/(.*)/g,to:/(.*)/g};if(this.isPath(t))i={from:!0,to:t};else if(this.isPath(e.from)&&this.isPath(e.to))i=e;else throw"[Router] path is neither a string, regular expression, or a { from, to } object.";let{from:n,to:s}=i;return{from:this.parsePath(n),to:this.parsePath(s)}}route(){if(this.manager.has("HistoryManager")){let t=this.manager.get("HistoryManager"),e=f(c((t.length>1?t.previous:t.current).url)),i=f(c());this.routes.forEach((n,s)=>{let a=s.from,l=s.to;if(typeof a=="boolean"&&typeof l=="boolean")throw`[Router] path ({ from: ${a}, to: ${l} }) is not valid, remember paths can only be strings, regular expressions, or a boolean; however, both the from and to paths cannot be both booleans.`;let o=a,p=l;a instanceof RegExp&&a.test(e)&&(o=a.exec(e)),l instanceof RegExp&&l.test(i)&&(p=l.exec(i)),(Array.isArray(p)&&Array.isArray(o)||Array.isArray(p)&&typeof o=="boolean"&&o||Array.isArray(o)&&typeof p=="boolean"&&p)&&n({from:o,to:p,path:{from:e,to:i}})})}else console.warn("[Route] HistoryManager is missing.")}initEvents(){this.emitter.on("READY",this.route,this),this.emitter.on("CONTENT_REPLACED",this.route,this)}stopEvents(){this.emitter.off("READY",this.route,this),this.emitter.off("CONTENT_REPLACED",this.route,this)}};var ct=r=>typeof r=="string"?Array.from(document.querySelectorAll(r)):[r],ut=r=>[].concat(...r),V=r=>Array.isArray(r)?ut(r.map(V)):typeof r=="string"||r instanceof Node?ct(r):r instanceof NodeList||r instanceof HTMLCollection?Array.from(r):[],G=(r,t,e)=>typeof r=="function"?r.apply(e,t):r,q=(r,t,e)=>{let i,n,s={},a=Object.keys(r);for(let l=0,o=a.length;l/^(in|out)/.test(r)?ht[r]:r,$={keyframes:[],loop:1,delay:0,speed:1,endDelay:0,easing:"ease",autoplay:!0,duration:1e3,fillMode:"auto",direction:"normal",extend:{}},C=class{constructor(t={}){this.options={};this.targets=[];this.properties={};this.animations=new h;this.totalDuration=0;this.minDelay=0;this.computedOptions=new h;this.emitter=new P;try{let{options:e,...i}=t,n=e instanceof C?e.getOptions():Array.isArray(e)?e?.[0]?.getOptions():e;this.options=Object.assign({},$,n,i),this.loop=this.loop.bind(this);let{loop:s,delay:a,speed:l,easing:o,endDelay:p,duration:m,direction:S,fillMode:x,onfinish:w,target:B,keyframes:W,autoplay:Y,extend:J,...X}=this.options;this.mainElement=document.createElement("div"),this.targets=V(B),this.properties=X;let _=[],I=this.targets.length,k;for(let d=0;d0||(k=q(k,[d,I,A],this));let U=b.delay+b.duration*b.iterations+b.endDelay;this.totalDuration{typeof w=="function"&&w.call(this,A,d,I,v),this.emit("finish",A,d,I,v)},this.computedOptions.set(v,b),this.animations.set(A,v),_.push(b.delay)}this.mainAnimation=this.mainElement.animate([{opacity:"0"},{opacity:"1"}],{duration:this.totalDuration,easing:"linear"}),this.minDelay=Math.min(..._),this.setSpeed(l),Y?this.play():this.pause(),this.promise=this.newPromise(),this.mainAnimation.onfinish=()=>{this.emit("complete",this),this.stopLoop()}}catch(e){this.emit("error",e)}}newPromise(){return new Promise((t,e)=>{this.on("complete",()=>t([this])),this.on("error",i=>e(i))})}then(t,e){return t=t?.bind(this),e=e?.bind(this),this.promise.then(t,e),this}catch(t){return t=t?.bind(this),this.promise.catch(t),this}finally(t){return t=t?.bind(this),this.promise.finally(t),this}loop(){this.stopLoop(),this.emit("update",this.getProgress(),this),this.animationFrame=window.requestAnimationFrame(this.loop)}stopLoop(){window.cancelAnimationFrame(this.animationFrame)}all(t){return t(this.mainAnimation),this.animations.forEach(e=>t(e)),this}beginEvent(){if(this.getProgress()==0){let t=window.setTimeout(()=>{this.emit("begin",this),t=window.clearTimeout(t)},this.minDelay)}}play(){let t=this.getPlayState();return this.beginEvent(),this.all(e=>e.play()),this.emit("play",t,this),this.loop(),this}pause(){let t=this.getPlayState();return this.all(e=>e.pause()),this.emit("pause",t,this),this.stopLoop(),this.animationFrame=void 0,this}reset(){return this.setProgress(0),this.beginEvent(),this.options.autoplay?this.play():this.pause(),this}cancel(){return this.all(t=>t.cancel()),this.stopLoop(),this}finish(){return this.all(t=>t.finish()),this.stopLoop(),this}stop(){for(this.cancel(),this.animations.clear();this.targets.length;)this.targets.pop();this.mainElement=void 0,this.emit("stop")}getTargets(){return this.targets}getAnimation(t){return this.animations.get(t)}getTiming(t){let e=t instanceof Animation?t:this.getAnimation(t),i=this.computedOptions.get(e)??{},n=e.effect?.getTiming()??{},s=this.getOptions();return{...$,...s,...n,...i}}getTotalDuration(){return this.totalDuration}getCurrentTime(){return this.mainAnimation.currentTime}getProgress(){return this.getCurrentTime()/this.totalDuration*100}getSpeed(){return this.mainAnimation.playbackRate}getPlayState(){return this.mainAnimation.playState}getOptions(){return this.options}setCurrentTime(t){return this.all(e=>{e.currentTime=t}),this.emit("update",this.getProgress()),this}setProgress(t){let e=t/100*this.totalDuration;return this.setCurrentTime(e),this}setSpeed(t=1){return this.all(e=>{e.playbackRate=t}),this}on(t,e,i){return this.emitter.on(t,e,i??this),this}off(t,e,i){return this.emitter.off(t,e,i??this),this}emit(t,...e){return this.emitter.emit(t,...e),this}toJSON(){return this.getOptions()}get[Symbol.toStringTag](){return"Animate"}},be=(r={})=>new C(r);export{L as AdvancedManager,C as Animate,at as App,Q as CONFIG_DEFAULTS,$ as DefaultAnimationOptions,M as Event,P as EventEmitter,et as HistoryManager,h as Manager,T as ManagerItem,rt as PARSER,lt as PJAX,D as Page,nt as PageManager,pt as Router,g as Service,N as ServiceManager,ot as TransitionManager,be as animate,tt as asyncMethodCall,it as changeState,F as clean,G as computeValue,ht as easings,R as equal,u as getConfig,mt as getEase,ct as getElements,At as getHash,f as getHashedPath,V as getTargets,K as hashAction,q as mapObject,E as methodCall,z as newConfig,y as newCoords,j as newListener,O as newState,c as newURL,Z as toAttr}; +var Z={wrapperAttr:"wrapper",noAjaxLinkAttr:"no-ajax-link",noPrefetchAttr:"no-prefetch",headers:[["x-partial","true"]],preventSelfAttr:'prevent="self"',preventAllAttr:'prevent="all"',transitionAttr:"transition",blockAttr:"block",timeout:3e4,maxPages:5},W=r=>Object.assign({...Z},r),tt=(r,t,e=!0)=>{let{prefix:i}=r,n=`data${i?"-"+i:""}-${t}`;return e?`[${n}]`:n},h=(r,t,e=!0)=>{if(typeof t!="string")return r;let i=r[t];return typeof i=="string"?tt(r,i,e):i};var g=class{constructor(t){this.map=new Map(t)}getMap(){return this.map}get(t){return this.map.get(t)}keys(){return Array.from(this.map.keys())}values(){return Array.from(this.map.values())}set(t,e){return this.map.set(t,e),this}add(t){let i=this.size;return this.set(i,t),this}get size(){return this.map.size}get length(){return this.map.size}last(t=1){let e=this.keys()[this.size-t];return this.get(e)}delete(t){return this.map.delete(t)}remove(t){return this.map.delete(t),this}clear(){return this.map.clear(),this}has(t){return this.map.has(t)}entries(){return this.map.entries()}forEach(t,e){return this.map.forEach(t,e),this}[Symbol.iterator](){return this.entries()}},L=(r,t,...e)=>{r.forEach(i=>{i[t](...e)})},et=async(r,t,...e)=>{for(let[,i]of r)await i[t](...e)};var R=class{constructor(){}install(){}register(t,e){return this.manager=t,this.app=t.app,this.config=t.config,this.emitter=t.emitter,this.key=e,this.install(),this}uninstall(){}unregister(){this.uninstall(),this.manager.remove(this.key),this.key=void 0,this.manager=void 0,this.app=void 0,this.config=void 0,this.emitter=void 0}},O=class extends g{constructor(t){super();this.app=t,this.config=t.config,this.emitter=t.emitter}set(t,e){return super.set(t,e),e.register(this,t),this}};var c=(r=window.location.href)=>r instanceof URL?r:new URL(r,window.location.origin),I=r=>{let t=c(r);return`${t.pathname}${t.hash}`},Et=r=>c(r).hash.slice(1),X=r=>c(r).toString().replace(/(\/#.*|\/|#.*)$/,""),N=(r,t)=>X(r)===X(t);var A=class extends R{init(){}boot(){this.initEvents()}initEvents(){}stopEvents(){}stop(){this.stopEvents(),this.unregister()}},V=class extends O{constructor(t){super(t)}init(){return L(this,"init"),this}boot(){return L(this,"boot"),this}stop(){return L(this,"stop"),this}};var x=(r=window.scrollX,t=window.scrollY)=>({x:r,y:t}),D=(r={url:I(c()),index:0,transition:"default",data:{scroll:x(),trigger:"HistoryManager"}})=>r,it=class extends A{constructor(){super(...arguments);this.pointer=-1}init(){this.states=[];let t=D();this.add(t,"replace")}get(t){return this.states[t]}add(t,e="push"){let i=D(t),n=this.length;this.states.push({...i}),this.pointer=n;let s={index:this.pointer,states:[...this.states]};return rt(e,i,s),this}remove(t){return t?this.states.splice(t,1):this.states.pop(),this.pointer--,this}replace(t){return this.states=t,this}set(t,e){return this.states[t]=e}get current(){return this.get(this.pointer)}get last(){return this.get(this.length-1)}get previous(){return this.pointer<1?null:this.get(this.pointer-1)}get length(){return this.states.length}},rt=(r,t,e)=>{let i=I(t.url),n=[e,"",i];if(window.history)switch(r){case"push":window.history.pushState.apply(window.history,n);break;case"replace":window.history.replaceState.apply(window.history,n);break}};var nt=new DOMParser,G=class extends R{constructor(t=c(),e=document){super();this.url=t,typeof e=="string"?this.data=e:this.dom=e||document}build(){if(this.dom instanceof Node||(this.dom=nt.parseFromString(this.data,"text/html")),!(this.body instanceof Node)){let{title:t,head:e,body:i}=this.dom;this.title=t,this.head=e,this.body=i,this.wrapper=this.body.querySelector(this.wrapperAttr)}}install(){this.wrapperAttr=h(this.config,"wrapperAttr")}uninstall(){this.url=void 0,this.title=void 0,this.head=void 0,this.body=void 0,this.dom=void 0,this.wrapper=void 0,this.data=void 0,this.wrapperAttr=void 0}},st=class extends A{constructor(){super(...arguments);this.loading=new g}install(){this.pages=new O(this.app);let t=c().pathname;this.set(t,new G),t=void 0}get(t){return this.pages.get(t)}add(t){return this.pages.add(t),this}set(t,e){return this.pages.set(t,e),this}remove(t){return this.pages.remove(t),this}has(t){return this.pages.has(t)}clear(){return this.pages.clear(),this}get size(){return this.pages.size}keys(){return this.pages.keys()}async load(t=c()){let e=c(t),i=e.pathname,n,s;if(this.has(i))return n=this.get(i),Promise.resolve(n);this.loading.has(i)?s=this.loading.get(i):(s=this.request(i),this.loading.set(i,s));let a=await s;if(this.loading.remove(i),n=new G(e,a),this.set(i,n),this.size>h(this.config,"maxPages")){let l=c(),o=this.keys(),p=N(l,o[0])?o[1]:o[0],f=this.get(p);f.unregister(),f=void 0,o=void 0,l=void 0,p=void 0}return n}async request(t){let e=new Headers(h(this.config,"headers")),i=window.setTimeout(()=>{throw window.clearTimeout(i),"Request Timed Out!"},h(this.config,"timeout"));try{let n=await fetch(t,{mode:"same-origin",method:"GET",headers:e,cache:"default",credentials:"same-origin"});if(window.clearTimeout(i),n.status>=200&&n.status<300)return await n.text();throw new Error(n.statusText||""+n.status)}catch(n){throw window.clearTimeout(i),n}}};var J=({callback:r=()=>{},scope:t=null,name:e="event"})=>({callback:r,scope:t,name:e}),C=class extends g{constructor(t="event"){super();this.name=t}},H=class extends g{constructor(){super()}getEvent(t){let e=this.get(t);return e instanceof C?e:(this.set(t,new C(t)),this.get(t))}newListener(t,e,i){let n=this.getEvent(t);return n.add(J({name:t,callback:e,scope:i})),n}on(t,e,i){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let n,s,a=typeof t=="object"&&!Array.isArray(t),l=a?e:i;return a||(s=e),Object.keys(t).forEach(o=>{a?(n=o,s=t[o]):n=t[o],this.newListener(n,s,l)},this),this}removeListener(t,e,i){let n=this.get(t);if(n instanceof C&&e){let s=J({name:t,callback:e,scope:i});n.forEach((a,l)=>{if(a.callback===s.callback&&a.scope===s.scope)return n.remove(l)})}return n}off(t,e,i){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let n,s,a=typeof t=="object"&&!Array.isArray(t),l=a?e:i;return a||(s=e),Object.keys(t).forEach(o=>{a?(n=o,s=t[o]):n=t[o],typeof s=="function"?this.removeListener(n,s,l):this.remove(n)},this),this}emit(t,...e){return typeof t=="undefined"?this:(typeof t=="string"&&(t=t.trim().split(/\s/g)),t.forEach(i=>{let n=this.get(i);n instanceof C&&n.forEach(s=>{let{callback:a,scope:l}=s;a.apply(l,e)})},this),this)}clear(){return L(this,"clear"),super.clear(),this}};var q=(r,t=window.location.hash)=>{try{let e=t[0]=="#"?t:c(t).hash;if(e.length>1){let i=document.getElementById(e.slice(1));if(i){let{left:n,top:s}=i.getBoundingClientRect(),a=window.pageXOffset,l=window.pageYOffset,o=n+a,p=s+l;return console.log(o,p),x(o,p)}}}catch(e){console.warn("[hashAction] error",e)}return r??x(0,0)},ot={name:"default",scrollable:!0,out({done:r}){r()},in({scroll:r,done:t}){window.scroll(r.x,r.y),t()}},at=class extends A{constructor(t){super();this._arg=t}install(){super.install();let t=this._arg&&this._arg.length?this._arg:h(this.config,"transitions")??[];t=[["default",ot]].concat(t),this.transitions=new g(t)}get(t){return this.transitions.get(t)}set(t,e){return this.transitions.set(t,e),this}add(t){return this.transitions.add(t),this}has(t){return this.transitions.has(t)}async animate(t,e){let i=this.transitions.get(t),n=e.scroll,s=e.ignoreHashAction;if(!("wrapper"in e.oldPage)||!("wrapper"in e.newPage))throw`[Page] either oldPage or newPage aren't instances of the Page Class. + ${{newPage:e.newPage,oldPage:e.oldPage}}`;document.title=""+e.newPage.title;let a=e.oldPage.wrapper,l=e.newPage.wrapper;if(!(a instanceof Node)||!(l instanceof Node))throw`[Wrapper] the wrapper from the ${l instanceof Node?"current":"next"} page cannot be found. The wrapper must be an element that has the attribute ${h(this.config,"wrapperAttr")}.`;return i.init&&i?.init(e),this.emitter.emit("BEFORE_TRANSITION_OUT"),i.out&&await new Promise(o=>{i.out.call(i,{...e,from:e.oldPage,trigger:e.trigger,done:o})?.then(o)}),this.emitter.emit("AFTER_TRANSITION_OUT"),await new Promise(o=>{a.insertAdjacentElement("beforebegin",l),this.emitter.emit("CONTENT_INSERT"),!s&&!/back|popstate|forward/.test(e.trigger)&&(n=q(n)),o()}),await new Promise(o=>{a.remove(),a=void 0,l=void 0,this.emitter.emit("CONTENT_REPLACED"),o()}),this.emitter.emit("BEFORE_TRANSITION_IN"),i.in&&await new Promise(async o=>{i.in.call(i,{...e,from:e.oldPage,to:e.newPage,trigger:e.trigger,scroll:n,done:o})?.then(o)}),this.emitter.emit("AFTER_TRANSITION_IN"),i}};var lt=class{constructor(t={}){this.register(t)}register(t={}){this.config=W(t),this.emitter=new H,this.services=new V(this);let e=(()=>{document.removeEventListener("DOMContentLoaded",e),window.removeEventListener("load",e),this.emitter.emit("READY ready")}).bind(this);return document.addEventListener("DOMContentLoaded",e),window.addEventListener("load",e),this}get(t){return this.services.get(t)}set(t,e){return this.services.set(t,e),this}add(t){return this.services.add(t),this}boot(){return this.services.init(),this.services.boot(),this}stop(){return this.services.stop(),this.emitter.clear(),this}on(t,e){return this.emitter.on(t,e,this),this}off(t,e){return this.emitter.off(t,e,this),this}emit(t,...e){return this.emitter.emit(t,...e),this}};var pt=class extends A{install(){super.install(),this.ignoreURLs=h(this.config,"ignoreURLs")??[],this.prefetchIgnore=h(this.config,"prefetchIgnore")??!1,this.stopOnTransitioning=h(this.config,"stopOnTransitioning")??!1,this.stickyScroll=h(this.config,"stickyScroll")??!1,this.forceOnError=h(this.config,"forceOnError")??!1,this.ignoreHashAction=h(this.config,"ignoreHashAction")??!1}transitionStart(){this.isTransitioning=!0}transitionStop(){this.isTransitioning=!1}init(){this.onHover=this.onHover.bind(this),this.onClick=this.onClick.bind(this),this.onStateChange=this.onStateChange.bind(this)}boot(){"scrollRestoration"in window.history&&(window.history.scrollRestoration="manual"),super.boot()}getTransitionName(t){if(!t||!t.getAttribute)return null;let e=t.getAttribute(h(this.config,"transitionAttr",!1));return typeof e=="string"?e:null}validLink(t,e,i){let n=!window.history.pushState,s=!t||!i,a=e.metaKey||e.ctrlKey||e.shiftKey||e.altKey,l=t.hasAttribute("target")&&t.target==="_blank",o=t.protocol!==location.protocol||t.hostname!==location.hostname,p=typeof t.getAttribute("download")=="string",f=t.matches(h(this.config,"preventSelfAttr")),M=Boolean(t.closest(h(this.config,"preventAllAttr"))),v=I(c())===I(c(i));return!(s||n||a||l||o||p||f||M||v)}getHref(t){return t&&t.tagName&&t.tagName.toLowerCase()==="a"&&typeof t.href=="string"?t.href:null}getLink(t){let e=t.target,i=this.getHref(e);for(;e&&!i;)e=e.parentNode,i=this.getHref(e);if(!(!e||!this.validLink(e,t,i)))return e}onClick(t){let e=this.getLink(t);if(!e)return;if(this.isTransitioning&&this.stopOnTransitioning){t.preventDefault(),t.stopPropagation();return}let i=this.getHref(e);this.emitter.emit("ANCHOR_CLICK CLICK",t),this.go({href:i,trigger:e,event:t})}getDirection(t){return Math.abs(t)>1?t>0?"forward":"back":t===0?"popstate":t>0?"back":"forward"}force(t){window.location.assign(t)}go({href:t,trigger:e="HistoryManager",event:i}){if(this.isTransitioning&&this.stopOnTransitioning||!(this.manager.has("TransitionManager")&&this.manager.has("HistoryManager")&&this.manager.has("PageManager"))){this.force(t);return}let n=this.manager.get("HistoryManager"),s=x(0,0),a=n.current,l=a.url;if(N(l,t))return;let o;if(i&&i.state){this.emitter.emit("POPSTATE",i);let{state:p}=i,{index:f}=p,v=a.index-f;n.replace(p.states),n.pointer=f;let w=n.get(f);o=w.transition,s=w.data.scroll,e=this.getDirection(v),console.log(e=="forward"&&n),this.emitter.emit(e==="back"?"POPSTATE_BACK":"POPSTATE_FORWARD",i)}else{o=this.getTransitionName(e),s=x();let p=D({url:t,transition:o,data:{scroll:s}});!this.stickyScroll&&(s=x(0,0)),n.add(p),this.emitter.emit("HISTORY_NEW_ITEM",i)}return i&&(i.stopPropagation(),i.preventDefault()),this.emitter.emit("GO",i),this.load({oldHref:l,href:t,trigger:e,transitionName:o,scroll:s})}async load({oldHref:t,href:e,trigger:i,transitionName:n="default",scroll:s={x:0,y:0}}){try{let a=this.manager.get("PageManager"),l,o;this.emitter.emit("NAVIGATION_START",{oldHref:t,href:e,trigger:i,transitionName:n});try{this.transitionStart(),o=await a.load(t),!(o.dom instanceof Element)&&o.build(),this.emitter.emit("PAGE_LOADING",{href:e,oldPage:o,trigger:i}),l=await a.load(e),await l.build(),this.emitter.emit("PAGE_LOAD_COMPLETE",{newPage:l,oldPage:o,trigger:i})}catch(p){console.warn(`[PJAX] Page load error: ${p}`)}try{let p=this.manager.get("TransitionManager");this.emitter.emit("TRANSITION_START",n);let f=await p.animate(p.has(n)?n:"default",{oldPage:o,newPage:l,trigger:i,scroll:s,ignoreHashAction:this.ignoreHashAction});f.scrollable||(!this.ignoreHashAction&&!/back|popstate|forward/.test(i)&&(s=q(s)),window.scroll(s.x,s.y)),this.emitter.emit("TRANSITION_END",{transition:f})}catch(p){console.warn(`[PJAX] Transition error: ${p}`)}this.emitter.emit("NAVIGATION_END",{oldPage:o,newPage:l,trigger:i,transitionName:n})}catch(a){this.forceOnError?this.force(e):console.warn(a)}finally{this.transitionStop()}}ignoredURL({pathname:t}){return this.ignoreURLs.length&&this.ignoreURLs.some(e=>typeof e=="string"?e===t:e.exec(t)!==null)}onHover(t){let e=this.getLink(t);if(!e||!this.manager.has("PageManager"))return;let i=this.manager.get("PageManager"),n=c(this.getHref(e)),s=n.pathname;if(!(this.ignoredURL(n)||i.has(s))){this.emitter.emit("ANCHOR_HOVER HOVER",t);try{i.load(n)}catch(a){console.warn("[PJAX] prefetch error,",a)}}}onStateChange(t){this.go({href:window.location.href,trigger:"popstate",event:t})}initEvents(){this.prefetchIgnore!==!0&&(document.addEventListener("mouseover",this.onHover),document.addEventListener("touchstart",this.onHover)),document.addEventListener("click",this.onClick),window.addEventListener("popstate",this.onStateChange)}stopEvents(){this.prefetchIgnore!==!0&&(document.removeEventListener("mouseover",this.onHover),document.removeEventListener("touchstart",this.onHover)),document.removeEventListener("click",this.onClick),window.removeEventListener("popstate",this.onStateChange)}};var ct=class extends A{constructor(t=[]){super();this.routes=new g;for(let e of t)this.add(e)}add({path:t,method:e}){let i=this.parse(t);return this.routes.set(i,e),this}parsePath(t){if(typeof t=="string")return new RegExp(t,"i");if(t instanceof RegExp||typeof t=="boolean")return t;throw"[Router] only regular expressions, strings and booleans are accepted as paths."}isPath(t){return typeof t=="string"||t instanceof RegExp||typeof t=="boolean"}parse(t){let e=t,i={from:/(.*)/g,to:/(.*)/g};if(this.isPath(t))i={from:!0,to:t};else if(this.isPath(e.from)&&this.isPath(e.to))i=e;else throw"[Router] path is neither a string, regular expression, or a { from, to } object.";let{from:n,to:s}=i;return{from:this.parsePath(n),to:this.parsePath(s)}}route(){if(this.manager.has("HistoryManager")){let t=this.manager.get("HistoryManager"),e=I(c((t.length>1?t.previous:t.current).url)),i=I(c());this.routes.forEach((n,s)=>{let a=s.from,l=s.to;if(typeof a=="boolean"&&typeof l=="boolean")throw`[Router] path ({ from: ${a}, to: ${l} }) is not valid, remember paths can only be strings, regular expressions, or a boolean; however, both the from and to paths cannot be both booleans.`;let o=a,p=l;a instanceof RegExp&&a.test(e)&&(o=a.exec(e)),l instanceof RegExp&&l.test(i)&&(p=l.exec(i)),(Array.isArray(p)&&Array.isArray(o)||Array.isArray(p)&&typeof o=="boolean"&&o||Array.isArray(o)&&typeof p=="boolean"&&p)&&n({from:o,to:p,path:{from:e,to:i}})})}else console.warn("[Route] HistoryManager is missing.")}initEvents(){this.emitter.on("READY",this.route,this),this.emitter.on("CONTENT_REPLACED",this.route,this)}stopEvents(){this.emitter.off("READY",this.route,this),this.emitter.off("CONTENT_REPLACED",this.route,this)}};var ut=r=>typeof r=="string"?Array.from(document.querySelectorAll(r)):[r],ht=r=>[].concat(...r),$=r=>Array.isArray(r)?ht(r.map($)):typeof r=="string"||r instanceof Node?ut(r):r instanceof NodeList||r instanceof HTMLCollection?Array.from(r):[],B=(r,t,e)=>typeof r=="function"?r.apply(e,t):r,K=(r,t,e)=>{let i,n,s={},a=Object.keys(r);for(let l=0,o=a.length;l/^(in|out)/.test(r)?mt[r]:r,Y={keyframes:[],loop:1,delay:0,speed:1,endDelay:0,easing:"ease",autoplay:!0,duration:1e3,fillMode:"auto",direction:"normal",extend:{}},P=class{constructor(t={}){this.options={};this.targets=[];this.properties={};this.animations=new g;this.totalDuration=0;this.minDelay=0;this.computedOptions=new g;this.emitter=new H;try{let{options:e,...i}=t,n=e instanceof P?e.getOptions():Array.isArray(e)?e?.[0]?.getOptions():e;this.options=Object.assign({},Y,n,i),this.loop=this.loop.bind(this);let{loop:s,delay:a,speed:l,easing:o,endDelay:p,duration:f,direction:M,fillMode:v,onfinish:w,target:_,keyframes:U,autoplay:z,extend:F,...j}=this.options;this.mainElement=document.createElement("div"),this.targets=$(_),this.properties=j;let S=[],d=this.targets.length,E;for(let m=0;m0||(E=K(E,[m,d,b],this));let k=u.delay+u.duration*u.iterations+u.endDelay;this.totalDuration{typeof w=="function"&&w.call(this,b,m,d,y),this.emit("finish",b,m,d,y)},this.computedOptions.set(y,u),this.animations.set(b,y),S.push(u.delay)}this.mainAnimation=this.mainElement.animate([{opacity:"0"},{opacity:"1"}],{duration:this.totalDuration,easing:"linear"}),this.minDelay=Math.min(...S),this.setSpeed(l),z?this.play():this.pause(),this.promise=this.newPromise(),this.mainAnimation.onfinish=()=>{this.emit("complete",this),this.stopLoop()}}catch(e){this.emit("error",e)}}newPromise(){return new Promise((t,e)=>{this.on("complete",()=>t([this])),this.on("error",i=>e(i))})}then(t,e){return t=t?.bind(this),e=e?.bind(this),this.promise.then(t,e),this}catch(t){return t=t?.bind(this),this.promise.catch(t),this}finally(t){return t=t?.bind(this),this.promise.finally(t),this}loop(){this.stopLoop(),this.emit("update",this.getProgress(),this),this.animationFrame=window.requestAnimationFrame(this.loop)}stopLoop(){window.cancelAnimationFrame(this.animationFrame)}all(t){return t(this.mainAnimation,this.mainElement),this.animations.forEach(t),this}beginEvent(){if(this.getProgress()==0){let t=window.setTimeout(()=>{this.emit("begin",this),t=window.clearTimeout(t)},this.minDelay)}}play(){let t=this.getPlayState();return this.beginEvent(),this.all(e=>e.play()),this.emit("play",t,this),this.loop(),this}pause(){let t=this.getPlayState();return this.all(e=>e.pause()),this.emit("pause",t,this),this.stopLoop(),this.animationFrame=void 0,this}reset(){return this.setProgress(0),this.beginEvent(),this.options.autoplay?this.play():this.pause(),this}cancel(){return this.all(t=>t.cancel()),this.stopLoop(),this}finish(){return this.all(t=>t.finish()),this.stopLoop(),this}stop(){for(this.cancel(),this.animations.clear();this.targets.length;)this.targets.pop();this.mainElement=void 0,this.emit("stop")}getTargets(){return this.targets}getAnimation(t){return this.animations.get(t)}getTiming(t){let e=t instanceof Animation?t:this.getAnimation(t),i=this.computedOptions.get(e)??{},n=e.effect?.getTiming()??{},s=this.getOptions();return{...Y,...s,...n,...i}}getTotalDuration(){return this.totalDuration}getCurrentTime(){return this.mainAnimation.currentTime}getProgress(){return this.getCurrentTime()/this.totalDuration*100}getSpeed(){return this.mainAnimation.playbackRate}getPlayState(){return this.mainAnimation.playState}getOptions(){return this.options}setCurrentTime(t){return this.all(e=>{e.currentTime=t}),this.emit("update",this.getProgress()),this}setProgress(t){let e=t/100*this.totalDuration;return this.setCurrentTime(e),this}setSpeed(t=1){return this.all(e=>{e.playbackRate=t}),this}on(t,e,i){return this.emitter.on(t,e,i??this),this}off(t,e,i){return this.emitter.off(t,e,i??this),this}emit(t,...e){return this.emitter.emit(t,...e),this}toJSON(){return this.getOptions()}get[Symbol.toStringTag](){return"Animate"}},be=(r={})=>new P(r),gt=class extends P{constructor(t={}){super();this.animations=new g;try{let{options:e,...i}=t,n=e instanceof P?e.getOptions():Array.isArray(e)?e?.[0]?.getOptions():e;this.options=Object.assign({},Y,n,i),this.loop=this.loop.bind(this);let{loop:s,delay:a,speed:l,easing:o,endDelay:p,duration:f,direction:M,fillMode:v,onfinish:w,target:_,keyframes:U,autoplay:z,extend:F,...j}=this.options;this.mainElement=document.createElement("div"),this.targets=$(_),this.properties=j;let S=[],d=this.targets.length,E;for(let m=0;m0||(E=K(E,[m,d,b],this));let k=u.delay+u.duration*u.iterations+u.endDelay;this.totalDuration{typeof w=="function"&&w.call(this,b,m,d,y),this.emit("finish",b,m,d,y)},this.computedOptions.set(y,u),this.animations.set(b,y),S.push(u.delay)}this.mainAnimation=this.mainElement.animate([{opacity:"0"},{opacity:"1"}],{duration:this.totalDuration,easing:"linear"}),this.minDelay=Math.min(...S),this.setSpeed(l),z?this.play():this.pause(),this.promise=this.newPromise(),this.mainAnimation.onfinish=()=>{this.emit("complete",this),this.stopLoop()}}catch(e){this.emit("error",e)}}add(t){return this}};export{O as AdvancedManager,P as Animate,lt as App,Z as CONFIG_DEFAULTS,Y as DefaultAnimationOptions,C as Event,H as EventEmitter,it as HistoryManager,g as Manager,R as ManagerItem,nt as PARSER,pt as PJAX,G as Page,st as PageManager,ct as Router,A as Service,V as ServiceManager,gt as Timeline,at as TransitionManager,be as animate,et as asyncMethodCall,rt as changeState,X as clean,B as computeValue,mt as easings,N as equal,h as getConfig,Q as getEase,ut as getElements,Et as getHash,I as getHashedPath,$ as getTargets,q as hashAction,K as mapObject,L as methodCall,W as newConfig,x as newCoords,J as newListener,D as newState,c as newURL,tt as toAttr}; //# sourceMappingURL=api.es.js.map diff --git a/packages/native/lib/api.es.js.map b/packages/native/lib/api.es.js.map index 6c6a969..3b14d87 100644 --- a/packages/native/lib/api.es.js.map +++ b/packages/native/lib/api.es.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../src/config.ts", "../../manager/src/api.ts", "../src/manager.ts", "../src/url.ts", "../src/service.ts", "../src/history.ts", "../src/page.ts", "../../emitter/src/api.ts", "../src/transition.ts", "../src/app.ts", "../src/pjax.ts", "../src/router.ts", "../../animate/src/api.ts"], - "sourcesContent": ["export interface ICONFIG {\n prefix?: string;\n wrapperAttr?: string;\n noAjaxLinkAttr?: string;\n noPrefetchAttr?: \"no-prefetch\";\n headers?: string[][];\n preventSelfAttr?: string;\n preventAllAttr?: string;\n transitionAttr?: string;\n blockAttr?: string;\n timeout?: number;\n [key: string]: any;\n}\n\nexport const CONFIG_DEFAULTS: ICONFIG = {\n wrapperAttr: \"wrapper\",\n noAjaxLinkAttr: \"no-ajax-link\",\n noPrefetchAttr: \"no-prefetch\",\n headers: [\n [\"x-partial\", \"true\"]\n ],\n preventSelfAttr: `prevent=\"self\"`,\n preventAllAttr: `prevent=\"all\"`,\n transitionAttr: \"transition\",\n blockAttr: `block`,\n timeout: 30000\n};\n\nexport type ConfigKeys = keyof ICONFIG;\nexport const newConfig = (config: ICONFIG): ICONFIG => {\n return Object.assign({ ...CONFIG_DEFAULTS }, config);\n};\n\n/** Converts string into properly formatted data attributes */\nexport const toAttr = (config: ICONFIG, value: string, brackets: boolean = true): string => {\n let { prefix } = config;\n let attr = `data${prefix ? \"-\" + prefix : \"\"}-${value}`;\n return brackets ? `[${attr}]` : attr;\n};\n\n/** Selects config vars, and formats them for use, or simply returns the current configurations for the framework */\nexport const getConfig = (config: ICONFIG, value?: ConfigKeys, brackets: boolean = true): any => {\n if (typeof value !== \"string\")\n return config;\n\n let prop = config[value];\n if (typeof prop === \"string\")\n return toAttr(config, prop, brackets);\n return prop;\n};\n", "/** Manages complex lists of named data, eg. A page can be stored in a list by of other pages with the url being how the page is stored in the list. Managers use Maps to store data */\nexport class Manager {\n\t/** The complex list of named data, to which the Manager controls */\n\tpublic map: Map;\n\tconstructor(value?: Array<[K, V]>) {\n\t\tthis.map = new Map(value);\n\t}\n\n\t/** Returns the Manager classes base Map */\n\tpublic getMap(): Map {\n\t\treturn this.map;\n\t}\n\n\t/** Get a value stored in the Manager */\n\tpublic get(key: K): V {\n\t\treturn this.map.get(key);\n\t}\n\n\t/** Returns the keys of all items stored in the Manager as an Array */\n\tpublic keys(): Array {\n\t\treturn Array.from(this.map.keys());\n\t}\n\n\t/** Returns the values of all items stored in the Manager as an Array */\n\tpublic values(): Array {\n\t\treturn Array.from(this.map.values());\n\t}\n\n\t/** Set a value to the Manager using a key */\n\tpublic set(key: K, value: V): Manager {\n\t\tthis.map.set(key, value);\n\t\treturn this;\n\t}\n\n\t/** Adds a value to Manager, and uses the current size of the Manager as it's key, it works best when all the key in the Manager are numbers */\n\tpublic add(value: V): Manager {\n\t\tlet size = this.size;\n\t\t// @ts-ignore\n\t\tlet num: K = size as K;\n\t\tthis.set(num, value);\n\t\treturn this;\n\t}\n\n\t/** Returns the total number of items stored in the Manager */\n\tpublic get size(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** An alias for size */\n\tpublic get length(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** Returns the last item in the Manager who's index is a certain distance from the last item in the Manager */\n\tpublic last(distance: number = 1): V | undefined {\n\t\tlet key = this.keys()[this.size - distance];\n\t\treturn this.get(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns true if an element in the Map object existed and has been removed, or false if the element does not exist */\n\tpublic delete(key: K): boolean {\n\t\treturn this.map.delete(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns the Manager class, allowing for chains */\n\tpublic remove(key: K): Manager {\n\t\tthis.map.delete(key);\n\t\treturn this;\n\t}\n\n\t/** Clear the Manager of all its contents */\n\tpublic clear(): Manager {\n\t\tthis.map.clear();\n\t\treturn this;\n\t}\n\n\t/** Checks if the Manager contains a certain key */\n\tpublic has(key: K): boolean {\n\t\treturn this.map.has(key);\n\t}\n\n\t/** Returns a new Iterator object that contains an array of [key, value] for each element in the Map object in insertion order. */\n\tpublic entries(): IterableIterator<[K, V]> {\n\t\treturn this.map.entries();\n\t}\n\n\t/** Iterates through the Managers contents, calling a callback function every iteration */\n\tpublic forEach(\n\t\tcallback: (value?: V, key?: K, map?: Map) => void,\n\t\tcontext?: object\n\t): Manager {\n\t\tthis.map.forEach(callback, context);\n\t\treturn this;\n\t}\n\n\t/** Allows for iteration via for..of, learn more: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators] */\n\tpublic [Symbol.iterator](): IterableIterator<[K, V]> {\n\t\treturn this.entries();\n\t}\n}\n\n/**\n * Calls the method of a certain name for all items that are currently installed\n */\nexport const methodCall = (manager: Manager, method: string, ...args: any): void => {\n\tmanager.forEach((item) => {\n\t\t// @ts-ignore\n\t\titem[method](...args);\n\t});\n};\n\n/**\n * Asynchronously calls the method of a certain name for all items that are currently installed, similar to methodCall\n */\nexport const asyncMethodCall = async (manager: Manager, method: string, ...args: any): Promise => {\n\tfor (let [, item] of manager) {\n\t\t// @ts-ignore\n\t\tawait item[method](...args);\n\t}\n};\n\nexport default Manager;\n", "import { Manager, methodCall, asyncMethodCall } from \"@okikio/manager\";\nimport { ICONFIG } from \"./config\";\nimport { IApp } from \"./app\";\nimport { EventEmitter } from \"./emitter\";\n\nexport type IAdvancedManager = AdvancedManager;\n\n/** The base class for AdvancedManager items */\nexport class ManagerItem {\n /** The AdvancedManager the ManagerItem is attached to */\n public manager: IAdvancedManager;\n\n /** The App the ManagerItem is attached to */\n public app: IApp;\n\n /** The Config of the App the ManagerItem is attached to */\n public config: ICONFIG;\n\n /** The EventEmitter of the App the ManagerItem is attached to */\n public emitter: EventEmitter;\n\n /** The key to where ManagerItem is stored in an AdvancedManager */\n public key: any;\n\n constructor() { }\n\n /** Run after the Manager Item has been registered */\n public install(): any { }\n\n /** Register the current Manager Item's manager */\n public register(manager: IAdvancedManager, key: any): ManagerItem {\n this.manager = manager;\n this.app = manager.app;\n this.config = manager.config;\n this.emitter = manager.emitter;\n this.key = key;\n this.install();\n return this;\n }\n\n /** Run before the ManagerItem has been unregistered */\n public uninstall(): any { }\n\n /** Basically removes a ManagerItem, in order to recover the ManagerItem, it needs to be re-added to an AdvancedManager */\n public unregister() {\n this.uninstall();\n\n this.manager.remove(this.key);\n this.key = undefined;\n this.manager = undefined;\n this.app = undefined;\n this.config = undefined;\n this.emitter = undefined;\n }\n}\n\n/** A tweak to the Manager class that makes it self aware of the App class it's instantiated in */\nexport class AdvancedManager extends Manager {\n /** The App the AdvancedManager is attached to */\n public app: IApp;\n\n /** The Config of the App the AdvancedManager is attached to */\n public config: ICONFIG;\n\n /** The EventEmitter of the App the AdvancedManager is attached to */\n public emitter: EventEmitter;\n\n /** Register App details */\n constructor(app: IApp) {\n super();\n this.app = app;\n this.config = app.config;\n this.emitter = app.emitter;\n }\n\n /** Add a ManagerItem to AdvancedManager at a specified key */\n public set(key: K, value: V) {\n super.set(key, value);\n value.register(this, key);\n return this;\n }\n}\n\nexport { Manager, methodCall, asyncMethodCall };\n", "export const newURL = (url: string | URL | Location = window.location.href): URL => {\n return url instanceof URL ? url : new URL(url as unknown as string, window.location.origin);\n};\n\n/** Returns the pathname with the hash at the end */\nexport const getHashedPath = (url: URL): string => (`${url.pathname}${url.hash}`);\n\n/** Returns the actual hash without the hashtag */\nexport const getHash = (url: URL): string => (url.hash.slice(1));\n\n/** Removes the hash from the full URL for a clean URL string */\nexport const clean = (url: URL): string => (url.toString().replace(/(\\/#.*|\\/|#.*)$/, ''));\n\n/** Compares two URLs to each other */\nexport const equal = (a: URL | string, b: URL | string): boolean => {\n let urlA = newURL(a);\n let urlB = newURL(b);\n return clean(urlA) === clean(urlB);\n};\n", "import { AdvancedManager, ManagerItem, methodCall } from \"./manager\";\nimport { IApp } from \"./app\";\n\n/** Controls specific kinds of actions that require JS */\nexport class Service extends ManagerItem {\n\t/** Called before the start of a Service, represents a constructor of sorts */\n\tpublic init(...args: any): any;\n\tpublic init(): any { }\n\n\t/** Called on start of Service */\n\tpublic boot(...args: any): any;\n\tpublic boot(): any {\n\t\tthis.initEvents();\n\t}\n\n\t/** Initialize events */\n\tpublic initEvents(): void { }\n\n\t/** Stop events */\n\tpublic stopEvents(): void { }\n\n\t/** Stop services */\n\tpublic stop(): void {\n\t\tthis.stopEvents();\n\t\tthis.unregister();\n\t}\n}\n\n/** The Service Manager controls the lifecycle of all Services in an App */\nexport class ServiceManager extends AdvancedManager {\n\tconstructor(app: IApp) {\n\t\tsuper(app);\n\t}\n\n\t/** Call the init method for all Services */\n\tpublic init(): ServiceManager {\n\t\tmethodCall(this, \"init\");\n\t\treturn this;\n\t}\n\n\t/** Call the boot method for all Services */\n\tpublic boot(): ServiceManager {\n\t\tmethodCall(this, \"boot\");\n\t\treturn this;\n\t}\n\n\t/** Call the stop method for all Services */\n\tpublic stop(): ServiceManager {\n\t\tmethodCall(this, \"stop\");\n\t\treturn this;\n\t}\n}\n", "import { Service } from \"./service\";\nimport { getHashedPath, newURL } from \"./url\";\n\nexport type Trigger = HTMLAnchorElement | \"HistoryManager\" | \"popstate\" | \"back\" | \"forward\";\nexport interface ICoords {\n\treadonly x: number;\n\treadonly y: number;\n}\n\nexport interface IStateData {\n\tscroll: ICoords;\n\t[key: string]: any;\n}\n\nexport interface IState {\n\turl: string;\n\tindex?: number;\n\ttransition: string;\n\tdata: IStateData;\n}\n\nexport interface IHistoryItem {\n\tindex: number;\n\tstates: IState[];\n}\n\nexport interface IHistoryManager extends Service {\n\tstates: IState[],\n\tpointer: number,\n\n\tinit(): any,\n\tget(index: number): IState,\n\tadd(value?: IState, historyAction?: \"replace\" | \"push\"): HistoryManager,\n\tremove(index?: number): HistoryManager,\n\treplace(newStates: IState[]): HistoryManager,\n\tset(i: number, state: IState): IState,\n\tcurrent: IState,\n\tlast: IState,\n\tprevious: IState | null,\n\tlength: number,\n}\n\n/** A quick snapshot of page scroll coordinates */\nexport const newCoords = (x: number = window.scrollX, y: number = window.scrollY): ICoords => ({ x, y });\n\n/** Creates a state; a state represents the current status of the page consisting of properties like: url, transition, and data */\nexport const newState = (state: IState = {\n\turl: getHashedPath(newURL()),\n\tindex: 0,\n\ttransition: \"default\",\n\tdata: {\n\t\tscroll: newCoords(),\n\t\ttrigger: \"HistoryManager\"\n\t}\n}): IState => (state);\n\n/** Keeps a record of the history of the App; it stores only the states of Pages */\nexport class HistoryManager extends Service implements IHistoryManager {\n\tpublic states: IState[];\n\tpublic pointer = -1;\n\n\t/** Initializes the states array, and replace the history pushState data with the states array */\n\tinit() {\n\t\tthis.states = [];\n\n\t\tlet state = newState();\n\t\tthis.add(state, \"replace\");\n\t}\n\n\t/** Get a state based on it's index */\n\tpublic get(index: number) {\n\t\treturn this.states[index];\n\t}\n\n\t/** Add a state to HistoryManager and change the history pushState data based on the historyAction specified */\n\tpublic add(value?: IState, historyAction: \"replace\" | \"push\" = \"push\"): HistoryManager {\n\t\tlet state = newState(value);\n\t\tlet len = this.length;\n\t\tthis.states.push({ ...state });\n\t\tthis.pointer = len;\n\n\t\tlet item: IHistoryItem = {\n\t\t\tindex: this.pointer,\n\t\t\tstates: [...this.states]\n\t\t};\n\t\tchangeState(historyAction, state, item);\n\t\treturn this;\n\t}\n\n\tpublic remove(index?: number) {\n\t\tif (index) {\n\t\t\tthis.states.splice(index, 1);\n\t\t} else {\n\t\t\tthis.states.pop();\n\t\t}\n\n\t\tthis.pointer--;\n\t\treturn this;\n\t}\n\n\t/** Replaces the states array with another states array, this is later used when going back and forward in page history */\n\tpublic replace(newStates: IState[]) {\n\t\tthis.states = newStates;\n\t\treturn this;\n\t}\n\n\t/** Set state by index. */\n\tpublic set(i: number, state: IState) {\n\t\treturn (this.states[i] = state);\n\t}\n\n\t/** Get the current state */\n\tget current(): IState {\n\t\treturn this.get(this.pointer);\n\t}\n\n\t/** Get the last state (top of the history stack). */\n\tget last(): IState {\n\t\treturn this.get(this.length - 1);\n\t}\n\n\t/** Get the previous state. */\n\tget previous(): IState | null {\n\t\treturn this.pointer < 1 ? null : this.get(this.pointer - 1);\n\t}\n\n\tget length() {\n\t\treturn this.states.length;\n\t}\n}\n\n/** Either push or replace history state */\nexport const changeState = (action: \"push\" | \"replace\", state: IState, item: object) => {\n\tlet href = getHashedPath(newURL(state.url));\n\tlet args = [item, \"\", href];\n\tif (window.history) {\n\t\tswitch (action) {\n\t\t\tcase \"push\":\n\t\t\t\twindow.history.pushState.apply(window.history, args);\n\t\t\t\tbreak;\n\t\t\tcase \"replace\":\n\t\t\t\twindow.history.replaceState.apply(window.history, args);\n\t\t\t\tbreak;\n\t\t}\n\t}\n};\n", "import { Manager, ManagerItem, AdvancedManager } from \"./manager\";\nimport { equal, newURL } from \"./url\";\nimport { getConfig } from \"./config\";\nimport { Service } from \"./service\";\n\nexport interface IPage extends ManagerItem {\n dom: Document,\n wrapper: HTMLElement,\n title: string,\n head: Element,\n body: Element,\n url: URL,\n data: string,\n wrapperAttr: string,\n\n build(): any,\n install(): void,\n uninstall(): any,\n}\n\n/**\n * Parses strings to DOM\n */\nexport const PARSER: DOMParser = new DOMParser();\n\n/** A page represents the DOM elements that create each page */\nexport class Page extends ManagerItem implements IPage {\n /** Holds the DOM of the current page */\n public dom: Document;\n\n /** Holds the wrapper element to be swapped out of each Page */\n public wrapper: HTMLElement;\n\n /** Holds the title of each page */\n public title: string;\n\n /** Holds the head element of each page */\n public head: Element;\n\n /** Holds the body element of each page */\n public body: Element;\n\n /** The URL of the current page */\n public url: URL;\n\n /** The payload of a page request */\n public data: string;\n\n /** Attr that identifies the wrapper */\n public wrapperAttr: string;\n\n constructor(url: URL = newURL(), dom: string | Document = document) {\n super();\n this.url = url;\n\n if (typeof dom === \"string\") {\n this.data = dom;\n } else this.dom = dom || document;\n }\n\n /** Builds the page's dom, and sets the title, head, body, and wrapper properties of the Page class */\n public build() {\n if (!(this.dom instanceof Node)) {\n this.dom = PARSER.parseFromString(this.data, \"text/html\");\n }\n\n if (!(this.body instanceof Node)) {\n let { title, head, body } = this.dom;\n this.title = title;\n this.head = head;\n this.body = body;\n this.wrapper = this.body.querySelector(this.wrapperAttr);\n }\n }\n\n public install() {\n this.wrapperAttr = getConfig(this.config, \"wrapperAttr\");\n }\n\n public uninstall() {\n this.url = undefined;\n this.title = undefined;\n this.head = undefined;\n this.body = undefined;\n this.dom = undefined;\n this.wrapper = undefined;\n this.data = undefined;\n this.wrapperAttr = undefined;\n }\n}\n\nexport interface IPageManager extends Service {\n loading: Manager>,\n maxPages: number,\n pages: AdvancedManager;\n\n install(): any,\n\n get(key): Page,\n add(value): PageManager,\n set(key, value): PageManager,\n remove(key): PageManager,\n has(key): boolean,\n clear(): PageManager,\n size: number,\n keys(): any[],\n\n load(_url: URL | string): Promise,\n request(url: string): Promise,\n}\n\n/** Controls which page to load */\nexport class PageManager extends Service implements IPageManager {\n /** Stores all fetch requests that are currently loading */\n public loading: Manager> = new Manager();\n public maxPages: number;\n\n pages: AdvancedManager;\n\n /** Instantiate pages, and add the current page to pages */\n install() {\n this.pages = new AdvancedManager(this.app);\n this.maxPages = this.config.maxPages ?? 5;\n\n let URLString = newURL().pathname;\n this.set(URLString, new Page());\n URLString = undefined;\n }\n\n get(key) { return this.pages.get(key); }\n add(value) { this.pages.add(value); return this; }\n set(key, value) { this.pages.set(key, value); return this; }\n remove(key) { this.pages.remove(key); return this; }\n has(key) { return this.pages.has(key); }\n clear() { this.pages.clear(); return this; }\n get size() { return this.pages.size; }\n keys() { return this.pages.keys(); }\n\n /** Load from cache or by requesting URL via a fetch request, avoid requesting for the same thing twice by storing the fetch request in \"this.loading\" */\n public async load(_url: URL | string = newURL()): Promise {\n let url: URL = newURL(_url);\n let urlString: string = url.pathname;\n let page: Page, request: Promise;\n if (this.has(urlString)) {\n page = this.get(urlString);\n return Promise.resolve(page);\n }\n\n if (!this.loading.has(urlString)) {\n request = this.request(urlString);\n this.loading.set(urlString, request);\n } else request = this.loading.get(urlString);\n\n let response = await request;\n this.loading.remove(urlString);\n\n page = new Page(url, response);\n this.set(urlString, page);\n\n if (this.size > this.maxPages) {\n let currentUrl = newURL();\n let keys = this.keys();\n let first = equal(currentUrl, keys[0]) ? keys[1] : keys[0];\n let page = this.get(first);\n page.unregister();\n page = undefined;\n keys = undefined;\n currentUrl = undefined;\n first = undefined;\n }\n return page;\n }\n\n /** Starts a fetch request */\n public async request(url: string): Promise {\n const headers = new Headers(getConfig(this.config, \"headers\"));\n const timeout = window.setTimeout(() => {\n window.clearTimeout(timeout);\n throw \"Request Timed Out!\";\n }, getConfig(this.config, \"timeout\"));\n\n try {\n let response = await fetch(url, {\n mode: 'same-origin',\n method: \"GET\",\n headers,\n cache: \"default\",\n credentials: \"same-origin\",\n });\n\n window.clearTimeout(timeout);\n if (response.status >= 200 && response.status < 300) {\n return await response.text();\n }\n\n const err = new Error(response.statusText || \"\" + response.status);\n throw err;\n } catch (err) {\n window.clearTimeout(timeout);\n throw err;\n }\n }\n}\n", "import { Manager, methodCall } from \"@okikio/manager\";\n\nexport type ListenerCallback = ((...args: any) => void);\nexport interface IListener {\n readonly callback: ListenerCallback;\n readonly scope: object;\n readonly name: string;\n}\n\n/** Represents a new event listener consisting of properties like: callback, scope, name */\nexport const newListener = ({\n callback = () => { },\n scope = null,\n name = \"event\",\n}: IListener): IListener => ({ callback, scope, name });\n\n/** Represents a new event */\nexport class Event extends Manager {\n /** The name of the event */\n public name: string;\n constructor(name: string = \"event\") {\n super();\n this.name = name;\n }\n}\n\nexport type EventInput = string | object | Array;\n\n/**\n * An Event Emitter\n * */\nexport class EventEmitter extends Manager {\n constructor() {\n super();\n }\n\n /** Gets event, if event doesn't exist create a new one */\n public getEvent(name: string): Event {\n let event = this.get(name);\n if (!(event instanceof Event)) {\n this.set(name, new Event(name));\n return this.get(name);\n }\n\n return event;\n }\n\n /** Creates a listener and adds it to an event */\n public newListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event = this.getEvent(name);\n event.add(newListener({ name, callback, scope }));\n return event;\n }\n\n /** Adds a listener to a given event */\n public on(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n this.newListener(_name, _callback, _scope);\n }, this);\n return this;\n }\n\n /** Removes a listener from an event */\n public removeListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event: Event = this.get(name);\n if (event instanceof Event && callback) {\n let listener = newListener({ name, callback, scope });\n\n event.forEach((value: IListener, i: number) => {\n if (\n value.callback === listener.callback &&\n value.scope === listener.scope\n ) {\n return event.remove(i);\n }\n });\n }\n\n return event;\n }\n\n /** Remove a listener from a given event, or just completely remove an event */\n public off(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n if (typeof _callback === \"function\") {\n this.removeListener(_name, _callback, _scope);\n } else this.remove(_name);\n }, this);\n return this;\n }\n\n /** Call all listeners within an event */\n public emit(\n events: string | Array,\n ...args: any\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n // Loop through the list of events\n events.forEach((event: string) => {\n let _event: Event = this.get(event);\n\n if (_event instanceof Event) {\n _event.forEach((listener: IListener) => {\n let { callback, scope } = listener;\n callback.apply(scope, args);\n });\n }\n }, this);\n return this;\n }\n\n /** Clears events and event listeners */\n public clear() {\n methodCall(this, \"clear\");\n super.clear();\n return this;\n }\n}\n\nexport default EventEmitter;\n", "import { Manager } from \"./manager\";\nimport { ICoords, newCoords, Trigger } from \"./history\";\nimport { IPage } from \"./page\";\nimport { getConfig } from \"./config\";\nimport { Service } from \"./service\";\nimport { newURL } from \"./url\";\n\n/**\n * The async function type, allows for smooth transition between Promises\n */\nexport type asyncFn = (err?: any, value?: any) => void;\nexport interface ITransition {\n oldPage?: IPage;\n newPage?: IPage;\n trigger?: Trigger;\n scroll?: { x: number; y: number };\n scrollable?: boolean;\n in: (data: ITransitionData) => any;\n out: (data: ITransitionData) => any;\n [key: string]: any;\n}\nexport interface ITransitionData {\n from?: IPage;\n to?: IPage;\n trigger?: Trigger;\n scroll?: ICoords;\n done: asyncFn;\n}\nexport interface ITransitionManager extends Service {\n transitions: Manager,\n\n get(key: string): ITransition,\n set(key: string, value: ITransition): TransitionManager,\n add(value: ITransition): TransitionManager,\n has(key: string): boolean,\n\n boot(): any,\n animate(name: string, data: any): Promise,\n}\n\n\n/** Auto scrolls to an elements position if the element has an hash */\nexport const hashAction = (coords?: ICoords, hash: string = window.location.hash) => {\n try {\n let _hash = hash[0] == \"#\" ? hash : newURL(hash).hash;\n if (_hash.length > 1) {\n let el = document.getElementById(_hash.slice(1)) as HTMLElement;\n\n if (el) {\n return newCoords(el.offsetLeft, el.offsetTop);\n }\n }\n } catch (e) {\n console.warn(\"[hashAction] error\", e);\n }\n\n return coords ?? newCoords(0, 0);\n};\n\n// The Default Transition\nconst Default: ITransition = {\n name: \"default\",\n scrollable: true,\n\n out({ done }: ITransitionData) {\n done();\n },\n in({ scroll, done }: ITransitionData) {\n window.scroll(scroll.x, scroll.y);\n done();\n }\n};\n\n/** Controls which Transition between pages to use */\nexport class TransitionManager extends Service implements ITransitionManager {\n transitions: Manager;\n private _arg: Array<[string, ITransition]>;\n constructor(transitions?: Array<[string, ITransition]>) {\n super();\n this._arg = transitions;\n }\n\n /** On Service install set Config */\n public install() {\n super.install();\n\n let transitions = this._arg && this._arg.length ? this._arg : (getConfig(this.config, \"transitions\") ?? []);\n\n // Manager like Maps use the most recent [key, value] Array it knows, replacing the default transition\n // With any other transitions called [\"default\", ...]\n transitions = [[\"default\", Default]].concat(transitions);\n this.transitions = new Manager(transitions);\n }\n\n get(key: string) { return this.transitions.get(key); }\n set(key: string, value: ITransition) { this.transitions.set(key, value); return this; }\n add(value: ITransition) { this.transitions.add(value); return this; }\n has(key: string) { return this.transitions.has(key); }\n\n /** Starts a transition */\n public async animate(name: string, data: any): Promise {\n let transition: ITransition = this.transitions.get(name);\n let scroll = data.scroll;\n let ignoreHashAction = data.ignoreHashAction;\n if (!(\"wrapper\" in data.oldPage) || !(\"wrapper\" in data.newPage))\n throw `[Page] either oldPage or newPage aren't instances of the Page Class.\\n ${{\n newPage: data.newPage,\n oldPage: data.oldPage,\n }}`;\n\n // Replace the title\n document.title = `` + data.newPage.title;\n\n let fromWrapper = data.oldPage.wrapper;\n let toWrapper = data.newPage.wrapper;\n\n if (!(fromWrapper instanceof Node) || !(toWrapper instanceof Node))\n throw `[Wrapper] the wrapper from the ${!(toWrapper instanceof Node) ? \"next\" : \"current\"\n } page cannot be found. The wrapper must be an element that has the attribute ${getConfig(this.config,\n \"wrapperAttr\"\n )}.`;\n\n // Give the Transition all the background data it may require\n transition.init && transition?.init(data);\n\n this.emitter.emit(\"BEFORE_TRANSITION_OUT\");\n\n // Start the out point of the Transition\n if (transition.out) {\n await new Promise((done) => {\n let outMethod: Promise = transition.out.call(transition, {\n ...data,\n from: data.oldPage,\n trigger: data.trigger,\n done,\n });\n\n outMethod?.then(done);\n });\n }\n\n this.emitter.emit(\"AFTER_TRANSITION_OUT\");\n\n // Add the new wrapper before the old one\n await new Promise((done) => {\n fromWrapper.insertAdjacentElement(\"beforebegin\", toWrapper);\n this.emitter.emit(\"CONTENT_INSERT\");\n\n if (!ignoreHashAction && !/back|popstate|forward/.test(data.trigger as string)) {\n scroll = hashAction(scroll);\n }\n done();\n });\n\n // Replace the old wrapper with the new one\n await new Promise((done) => {\n fromWrapper.remove();\n fromWrapper = undefined;\n toWrapper = undefined;\n this.emitter.emit(\"CONTENT_REPLACED\");\n done();\n });\n\n this.emitter.emit(\"BEFORE_TRANSITION_IN\");\n\n // Start the in point of the Transition (only the in method has access to the hashAction's scroll position)\n if (transition.in) {\n await new Promise(async (done) => {\n let inMethod: Promise = transition.in.call(transition, {\n ...data,\n from: data.oldPage,\n to: data.newPage,\n trigger: data.trigger,\n scroll,\n done,\n });\n\n inMethod?.then(done);\n });\n }\n\n this.emitter.emit(\"AFTER_TRANSITION_IN\");\n return transition;\n }\n}\n", "import { EventEmitter, ListenerCallback, EventInput } from \"./emitter\";\nimport { ServiceManager, Service } from \"./service\";\nimport { newConfig, ICONFIG } from \"./config\";\n\nexport interface IApp {\n services: ServiceManager,\n emitter: EventEmitter,\n config: ICONFIG,\n register(config: ICONFIG): App,\n get(key: string): Service,\n set(key: string, service: Service): App,\n add(value: Service): App,\n boot(): App,\n stop(): App,\n on(events: EventInput, callback?: ListenerCallback): App,\n off(events: EventInput, callback?: ListenerCallback): App,\n emit(events: string | any[], ...args: any): App,\n}\n\n/** The App class starts the entire process, it controls all managers and all services */\nexport class App implements IApp {\n /** An instance of the ServiceManager */\n public services: ServiceManager;\n\n /** An instance of an EventEmitter */\n public emitter: EventEmitter;\n\n /** The current Configuration's for the App */\n public config: ICONFIG;\n constructor(config: object = {}) {\n this.register(config);\n }\n\n /** Create new instances of the ServiceManager, EventEmitter and the configurations */\n public register(config: ICONFIG = {}): App {\n this.config = newConfig(config);\n this.emitter = new EventEmitter();\n this.services = new ServiceManager(this);\n\n let handler = (() => {\n document.removeEventListener(\"DOMContentLoaded\", handler);\n window.removeEventListener(\"load\", handler);\n this.emitter.emit(\"READY ready\");\n }).bind(this);\n\n document.addEventListener(\"DOMContentLoaded\", handler);\n window.addEventListener(\"load\", handler);\n return this;\n }\n\n /** Shortcuts to adding, setting, and getting Services */\n public get(key: string): Service {\n return this.services.get(key);\n }\n\n public set(key: string, value: Service): App {\n this.services.set(key, value);\n return this;\n }\n\n public add(value: Service): App {\n this.services.add(value);\n return this;\n }\n\n /** Initialize and boot all Services */\n public boot(): App {\n this.services.init();\n this.services.boot();\n return this;\n }\n\n /** Stops all Services and clears the even emitter of all events and listeners */\n public stop(): App {\n this.services.stop();\n this.emitter.clear();\n return this;\n }\n\n /** Shortcuts to the App EventEmitter on, off, and emit methods */\n public on(events: EventInput, callback?: ListenerCallback): App {\n this.emitter.on(events, callback, this);\n return this;\n }\n\n public off(events: EventInput, callback?: ListenerCallback): App {\n this.emitter.off(events, callback, this);\n return this;\n }\n\n public emit(events: string | any[], ...args: any): App {\n this.emitter.emit(events, ...args);\n return this;\n }\n}\n", "import { newState, Trigger, newCoords, IHistoryItem, IHistoryManager } from \"./history\";\nimport { Service } from \"./service\";\nimport { IPage, IPageManager } from \"./page\";\nimport { newURL, getHashedPath, equal } from \"./url\";\nimport { getConfig } from \"./config\";\nimport { hashAction, ITransitionManager } from \"./transition\";\n\nexport type LinkEvent = MouseEvent | TouchEvent;\nexport type StateEvent = LinkEvent | PopStateEvent;\nexport type IgnoreURLsList = Array;\n/**\n * Creates a barbajs like PJAX Service, for the native framework\n * Based on barbajs and StartingBlocks\n */\nexport class PJAX extends Service {\n /** URLs to ignore when prefetching */\n public ignoreURLs: IgnoreURLsList;\n\n /** Whether or not to disable prefetching */\n public prefetchIgnore: boolean;\n\n /** Current state of transitions */\n public isTransitioning: boolean;\n\n /** Ignore extra clicks of an anchor element if a transition has already started */\n public stopOnTransitioning: boolean;\n\n /** On page change (excluding popstate events) keep current scroll position */\n public stickyScroll: boolean;\n\n /** Force load a page if an error occurs */\n public forceOnError: boolean;\n\n /** Ignore hash action if set to true */\n public ignoreHashAction: boolean;\n\n public install() {\n super.install();\n\n this.ignoreURLs = getConfig(this.config, \"ignoreURLs\") ?? [];\n this.prefetchIgnore = getConfig(this.config, \"prefetchIgnore\") ?? false;\n this.stopOnTransitioning = getConfig(this.config, \"stopOnTransitioning\") ?? false;\n this.stickyScroll = getConfig(this.config, \"stickyScroll\") ?? false;\n this.forceOnError = getConfig(this.config, \"forceOnError\") ?? false;\n this.ignoreHashAction = getConfig(this.config, \"ignoreHashAction\") ?? false\n }\n\n /** Sets the transition state to either true or false */\n public transitionStart() {\n this.isTransitioning = true;\n }\n\n public transitionStop() {\n this.isTransitioning = false;\n }\n\n public init() {\n /**\n * Bind the event listeners to the PJAX class\n *\n * @memberof PJAX\n */\n this.onHover = this.onHover.bind(this);\n this.onClick = this.onClick.bind(this);\n this.onStateChange = this.onStateChange.bind(this);\n }\n\n /** Starts the PJAX Service */\n public boot() {\n if (\"scrollRestoration\" in window.history) {\n // Back off, browser, I got this...\n window.history.scrollRestoration = \"manual\";\n }\n\n super.boot();\n }\n\n /** Gets the transition to use for a certain anchor */\n public getTransitionName(el: HTMLAnchorElement): string | null {\n if (!el || !el.getAttribute) return null;\n let transitionAttr = el.getAttribute(\n getConfig(this.config, \"transitionAttr\", false)\n );\n\n if (typeof transitionAttr === \"string\") return transitionAttr;\n return null;\n }\n\n /** Checks to see if the anchor is valid */\n public validLink(\n el: HTMLAnchorElement,\n event: LinkEvent | KeyboardEvent,\n href: string\n ): boolean {\n let pushStateSupport = !window.history.pushState;\n let exists = !el || !href;\n let eventMutate =\n (event as KeyboardEvent).metaKey ||\n (event as KeyboardEvent).ctrlKey ||\n (event as KeyboardEvent).shiftKey ||\n (event as KeyboardEvent).altKey;\n let newTab =\n el.hasAttribute(\"target\") &&\n (el as HTMLAnchorElement).target === \"_blank\";\n let crossOrigin =\n (el as HTMLAnchorElement).protocol !== location.protocol ||\n (el as HTMLAnchorElement).hostname !== location.hostname;\n let download = typeof el.getAttribute(\"download\") === \"string\";\n let preventSelf = el.matches(getConfig(this.config, \"preventSelfAttr\"));\n let preventAll = Boolean(\n el.closest(getConfig(this.config, \"preventAllAttr\"))\n );\n let sameURL = getHashedPath(newURL()) === getHashedPath(newURL(href));\n return !(\n exists ||\n pushStateSupport ||\n eventMutate ||\n newTab ||\n crossOrigin ||\n download ||\n preventSelf ||\n preventAll ||\n sameURL\n );\n }\n\n /** Returns the href of an Anchor element */\n public getHref(el: HTMLAnchorElement): string | null {\n if (\n el &&\n el.tagName &&\n el.tagName.toLowerCase() === \"a\" &&\n typeof el.href === \"string\"\n )\n return el.href;\n return null;\n }\n\n /** Check if event target is a valid anchor with an href, if so, return the anchor */\n public getLink(event: LinkEvent): HTMLAnchorElement {\n let el = event.target as HTMLAnchorElement;\n let href: string = this.getHref(el);\n\n while (el && !href) {\n el = (el as HTMLElement).parentNode as HTMLAnchorElement;\n href = this.getHref(el);\n }\n\n // Check for a valid link\n if (!el || !this.validLink(el, event, href)) return;\n return el;\n }\n\n /** When an element is clicked, get valid anchor element, go for a transition */\n public onClick(event: LinkEvent) {\n let el = this.getLink(event);\n if (!el) return;\n\n if (this.isTransitioning && this.stopOnTransitioning) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n let href = this.getHref(el);\n this.emitter.emit(\"ANCHOR_CLICK CLICK\", event);\n this.go({ href, trigger: el, event });\n }\n\n /** Returns the direction of the State change as a String, either the Back button or the Forward button */\n public getDirection(value: number): Trigger {\n if (Math.abs(value) > 1) {\n // Ex 6-0 > 0 -> forward, 0-6 < 0 -> back\n return value > 0 ? \"forward\" : \"back\";\n } else {\n if (value === 0) {\n return \"popstate\";\n } else {\n // Ex 6-5 > 0 -> back, 5-6 < 0 -> forward\n return value > 0 ? \"back\" : \"forward\";\n }\n }\n }\n\n /** Force a page to go to a certain URL */\n public force(href: string): void {\n window.location.assign(href);\n }\n\n /**\n * If transition is running force load page.\n * Stop if currentURL is the same as new url.\n * On state change, change the current state history, to reflect the direction of said state change\n * Load page and page transition.\n */\n public go({\n href,\n trigger = \"HistoryManager\",\n event,\n }: {\n href: string;\n trigger?: Trigger;\n event?: StateEvent;\n }): Promise {\n // If transition is already running and the go method is called again, force load page\n if (this.isTransitioning && this.stopOnTransitioning ||\n !(this.manager.has(\"TransitionManager\") &&\n this.manager.has(\"HistoryManager\") &&\n this.manager.has(\"PageManager\"))) {\n this.force(href);\n return;\n }\n\n const history = this.manager.get(\"HistoryManager\") as IHistoryManager;\n let scroll = newCoords(0, 0);\n let currentState = history.current;\n let currentURL = currentState.url;\n if (equal(currentURL, href)) {\n return;\n }\n\n let transitionName: string;\n if (event && (event as PopStateEvent).state) {\n this.emitter.emit(\"POPSTATE\", event);\n\n // If popstate, get back/forward direction.\n let { state }: { state: IHistoryItem } = event as PopStateEvent;\n let { index } = state;\n let currentIndex = currentState.index;\n let difference = currentIndex - index;\n\n let _state = history.get(history.pointer);\n transitionName = _state.transition;\n scroll = _state.data.scroll;\n\n history.replace(state.states);\n history.pointer = index;\n\n trigger = this.getDirection(difference);\n\n // Based on the direction of the state change either remove or add a state\n this.emitter.emit(trigger === \"back\" ? `POPSTATE_BACK` : `POPSTATE_FORWARD`, event);\n } else {\n // Add new state\n transitionName = this.getTransitionName(trigger as HTMLAnchorElement);\n\n scroll = newCoords();\n let state = newState({\n url: href,\n transition: transitionName,\n data: { scroll },\n });\n\n !this.stickyScroll && (scroll = newCoords(0, 0));\n\n history.add(state);\n this.emitter.emit(\"HISTORY_NEW_ITEM\", event);\n }\n\n if (event) {\n event.stopPropagation();\n event.preventDefault();\n }\n\n this.emitter.emit(\"GO\", event);\n return this.load({\n oldHref: currentURL,\n href,\n trigger,\n transitionName,\n scroll,\n });\n }\n\n /** Load the new Page as well as a Transition; starts the Transition */\n public async load({\n oldHref,\n href,\n trigger,\n transitionName = \"default\",\n scroll = { x: 0, y: 0 },\n }: {\n oldHref: string;\n href: string;\n trigger: Trigger;\n transitionName?: string;\n scroll: { x: number; y: number };\n }): Promise {\n try {\n const pages = this.manager.get(\"PageManager\") as IPageManager;\n let newPage: IPage, oldPage: IPage;\n\n this.emitter.emit(\"NAVIGATION_START\", {\n oldHref,\n href,\n trigger,\n transitionName,\n });\n\n // Load & Build both the old and new pages\n try {\n this.transitionStart();\n oldPage = await pages.load(oldHref);\n !(oldPage.dom instanceof Element) && oldPage.build();\n\n this.emitter.emit(\"PAGE_LOADING\", { href, oldPage, trigger });\n newPage = await pages.load(href);\n await newPage.build();\n this.emitter.emit(\"PAGE_LOAD_COMPLETE\", {\n newPage,\n oldPage,\n trigger,\n });\n } catch (err) {\n throw `[PJAX] page load error: ${err}`;\n }\n\n // --\n // --\n\n // Start Transition\n try {\n const TransitionManager = this.manager.get(\"TransitionManager\") as ITransitionManager;\n this.emitter.emit(\"TRANSITION_START\", transitionName);\n\n let transition = await TransitionManager.animate(TransitionManager.has(transitionName) ? transitionName : \"default\", {\n oldPage,\n newPage,\n trigger,\n scroll,\n ignoreHashAction: this.ignoreHashAction\n });\n\n if (!transition.scrollable) {\n if (!this.ignoreHashAction && !/back|popstate|forward/.test(trigger as string)) scroll = hashAction(scroll);\n window.scroll(scroll.x, scroll.y);\n }\n\n this.emitter.emit(\"TRANSITION_END\", { transition });\n } catch (err) {\n throw `[PJAX] transition error: ${err}`;\n }\n\n this.emitter.emit(\"NAVIGATION_END\", {\n oldPage,\n newPage,\n trigger,\n transitionName,\n });\n } catch (err) {\n if (this.forceOnError) this.force(href);\n else console.warn(err);\n } finally {\n this.transitionStop(); // Sets isTransitioning to false\n }\n }\n\n /** Check to see if the URL is to be ignored, uses either RegExp of Strings to check */\n public ignoredURL({ pathname }: URL): boolean {\n return (\n this.ignoreURLs.length &&\n this.ignoreURLs.some((url) => {\n return typeof url === \"string\"\n ? url === pathname\n : (url as RegExp).exec(pathname) !== null;\n })\n );\n }\n\n /** When you hover over an anchor, prefetch the event target's href */\n public onHover(event: LinkEvent): Promise {\n let el = this.getLink(event);\n if (!el || !this.manager.has(\"PageManager\")) return;\n\n const pages = this.manager.get(\"PageManager\") as IPageManager;\n let url = newURL(this.getHref(el));\n let urlString: string = url.pathname;\n\n // If Url is ignored or already in cache, don't do any think\n if (this.ignoredURL(url) || pages.has(urlString)) return;\n this.emitter.emit(\"ANCHOR_HOVER HOVER\", event);\n\n try {\n pages.load(url);\n } catch (err) {\n console.warn(\"[PJAX] prefetch error,\", err);\n }\n }\n\n /** When History state changes, get url from State, go for a Transition. */\n public onStateChange(event: PopStateEvent): void {\n this.go({ href: window.location.href, trigger: \"popstate\", event });\n }\n\n /** Initialize DOM Events */\n public initEvents() {\n if (this.prefetchIgnore !== true) {\n document.addEventListener(\"mouseover\", this.onHover);\n document.addEventListener(\"touchstart\", this.onHover);\n }\n\n document.addEventListener(\"click\", this.onClick);\n window.addEventListener(\"popstate\", this.onStateChange);\n }\n\n /** Stop DOM Events */\n public stopEvents() {\n if (this.prefetchIgnore !== true) {\n document.removeEventListener(\"mouseover\", this.onHover);\n document.removeEventListener(\"touchstart\", this.onHover);\n }\n\n document.removeEventListener(\"click\", this.onClick);\n window.removeEventListener(\"popstate\", this.onStateChange);\n }\n}\n", "import { Service } from \"./service\";\nimport { Manager } from \"./manager\";\nimport { newURL, getHashedPath } from \"./url\";\nimport { IHistoryManager } from \"./history\";\n\nexport type RouteMethod = (...args: any) => any;\nexport type RouteStyle = string | RegExp | boolean;\nexport interface IRouteToFrom {\n to: RouteStyle,\n from: RouteStyle\n}\nexport type RoutePath = IRouteToFrom | RouteStyle;\nexport interface IRoute {\n path: RoutePath,\n method: RouteMethod\n}\n\n/** Controls what happens when certain url paths match a set of criteria */\nexport class Router extends Service {\n /** List of routes */\n protected routes: Manager;\n constructor(routes: IRoute[] = []) {\n super();\n this.routes = new Manager();\n for (let route of routes) {\n this.add(route);\n }\n }\n\n /** Add a new route to watch for */\n public add({ path, method }: IRoute): Router {\n let key = this.parse(path);\n this.routes.set(key, method);\n return this;\n }\n\n /** Convert strings into path match functions */\n public parsePath(path: RouteStyle): RegExp | boolean {\n if (typeof path === \"string\") return new RegExp(path, \"i\");\n else if (path instanceof RegExp || typeof path === \"boolean\")\n return path;\n throw \"[Router] only regular expressions, strings and booleans are accepted as paths.\";\n }\n\n /** Determines if a strings counts has a path */\n public isPath(input: RouteStyle): boolean {\n return (\n typeof input === \"string\" ||\n input instanceof RegExp ||\n typeof input === \"boolean\"\n );\n }\n\n /** Parse the multiple different formats for paths, into a { from, to } object */\n public parse(input: RoutePath): IRouteToFrom {\n let route = input as IRouteToFrom;\n let toFromPath: IRouteToFrom = {\n from: /(.*)/g,\n to: /(.*)/g,\n };\n\n if (this.isPath(input as RouteStyle))\n toFromPath = {\n from: true,\n to: input as RouteStyle,\n };\n else if (this.isPath(route.from) && this.isPath(route.to as RouteStyle))\n toFromPath = route;\n else\n throw \"[Router] path is neither a string, regular expression, or a { from, to } object.\";\n\n let { from, to } = toFromPath;\n return {\n from: this.parsePath(from),\n to: this.parsePath(to),\n };\n }\n\n /** Test if route paths are true, if so run their methods */\n public route() {\n if (this.manager.has(\"HistoryManager\")) {\n let history = this.manager.get(\"HistoryManager\") as IHistoryManager;\n let from: string = getHashedPath(newURL((history.length > 1 ? history.previous : history.current).url));\n let to: string = getHashedPath(newURL());\n\n this.routes.forEach((method: RouteMethod, path: IRouteToFrom) => {\n let fromRegExp = path.from as RegExp | boolean;\n let toRegExp = path.to as RegExp | boolean;\n\n if (\n typeof fromRegExp === \"boolean\" &&\n typeof toRegExp === \"boolean\"\n ) {\n throw `[Router] path ({ from: ${fromRegExp}, to: ${toRegExp} }) is not valid, remember paths can only be strings, regular expressions, or a boolean; however, both the from and to paths cannot be both booleans.`;\n }\n\n let fromParam: RegExpExecArray | RegExp | boolean = fromRegExp;\n let toParam: RegExpExecArray | RegExp | boolean = toRegExp;\n\n if (fromRegExp instanceof RegExp && fromRegExp.test(from))\n fromParam = fromRegExp.exec(from);\n if (toRegExp instanceof RegExp && toRegExp.test(to))\n toParam = toRegExp.exec(to);\n\n if (\n (Array.isArray(toParam) && Array.isArray(fromParam)) ||\n (Array.isArray(toParam) &&\n typeof fromParam == \"boolean\" &&\n fromParam) ||\n (Array.isArray(fromParam) &&\n typeof toParam == \"boolean\" &&\n toParam)\n )\n method({ from: fromParam, to: toParam, path: { from, to } });\n });\n } else {\n console.warn(\"[Route] HistoryManager is missing.\");\n }\n }\n\n /** Add listeners for PJAX Events */\n public initEvents() {\n this.emitter.on(\"READY\", this.route, this);\n this.emitter.on(\"CONTENT_REPLACED\", this.route, this);\n }\n\n /** Remove listeners for PJAX Events */\n public stopEvents() {\n this.emitter.off(\"READY\", this.route, this);\n this.emitter.off(\"CONTENT_REPLACED\", this.route, this);\n }\n}\n", "import { EventEmitter, EventInput, ListenerCallback } from \"@okikio/emitter\";\nimport { Manager } from \"@okikio/manager\";\n\n// DOM\nexport type AnimationTarget = string | Node | NodeList | HTMLCollection | HTMLElement[] | AnimationTarget[];\nexport const getElements = (selector: string | Node): Node[] => {\n return typeof selector === \"string\" ? Array.from(document.querySelectorAll(selector as string)) : [selector];\n};\n\nconst flatten = (arr: AnimationTarget[]) => [].concat(...arr);\nexport const getTargets = (targets: AnimationTarget): Node[] => {\n if (Array.isArray(targets)) {\n return flatten((targets as AnimationTarget[]).map(getTargets));\n }\n if (typeof targets == \"string\" || targets instanceof Node)\n return getElements(targets);\n if (targets instanceof NodeList || targets instanceof HTMLCollection)\n return Array.from(targets);\n return [];\n};\n\n// VALUES\nexport type closureArgs = [number, number, HTMLElement];\nexport type closure = ((index?: number, total?: number, element?: HTMLElement) => (genericTypes[] | void)) | any;\nexport const computeValue = (value: closure, args: closureArgs, context: Animate) => {\n if (typeof value === \"function\") {\n return value.apply(context, args);\n } else { return value; }\n};\n\nexport const mapObject = (obj: object, args: closureArgs, options: Animate): any => {\n let key: string, value: any, result = {};\n let keys = Object.keys(obj);\n for (let i = 0, len = keys.length; i < len; i++) {\n key = keys[i];\n value = obj[key];\n result[key] = computeValue(value, args, options);\n }\n\n return result;\n};\n\n/** From: [https://easings.net] */\nexport const easings = {\n \"in\": \"ease-in\",\n \"out\": \"ease-out\",\n \"in-out\": \"ease-in-out\",\n\n // Sine\n \"in-sine\": \"cubic-bezier(0.47, 0, 0.745, 0.715)\",\n \"out-sine\": \"cubic-bezier(0.39, 0.575, 0.565, 1)\",\n \"in-out-sine\": \"cubic-bezier(0.445, 0.05, 0.55, 0.95)\",\n\n // Quad\n \"in-quad\": \"cubic-bezier(0.55, 0.085, 0.68, 0.53)\",\n \"out-quad\": \"cubic-bezier(0.25, 0.46, 0.45, 0.94)\",\n \"in-out-quad\": \"cubic-bezier(0.455, 0.03, 0.515, 0.955)\",\n\n // Cubic\n \"in-cubic\": \"cubic-bezier(0.55, 0.055, 0.675, 0.19)\",\n \"out-cubic\": \"cubic-bezier(0.215, 0.61, 0.355, 1)\",\n \"in-out-cubic\": \"cubic-bezier(0.645, 0.045, 0.355, 1)\",\n\n // Quart\n \"in-quart\": \"cubic-bezier(0.895, 0.03, 0.685, 0.22)\",\n \"out-quart\": \"cubic-bezier(0.165, 0.84, 0.44, 1)\",\n \"in-out-quart\": \"cubic-bezier(0.77, 0, 0.175, 1)\",\n\n // Quint\n \"in-quint\": \"cubic-bezier(0.755, 0.05, 0.855, 0.06)\",\n \"out-quint\": \"cubic-bezier(0.23, 1, 0.32, 1)\",\n \"in-out-quint\": \"cubic-bezier(0.86, 0, 0.07, 1)\",\n\n // Expo\n \"in-expo\": \"cubic-bezier(0.95, 0.05, 0.795, 0.035)\",\n \"out-expo\": \"cubic-bezier(0.19, 1, 0.22, 1)\",\n \"in-out-expo\": \"cubic-bezier(1, 0, 0, 1)\",\n\n // Circ\n \"in-circ\": \"cubic-bezier(0.6, 0.04, 0.98, 0.335)\",\n \"out-circ\": \"cubic-bezier(0.075, 0.82, 0.165, 1)\",\n \"in-out-circ\": \"cubic-bezier(0.785, 0.135, 0.15, 0.86)\",\n\n // Back\n \"in-back\": \"cubic-bezier(0.6, -0.28, 0.735, 0.045)\",\n \"out-back\": \"cubic-bezier(0.175, 0.885, 0.32, 1.275)\",\n \"in-out-back\": \"cubic-bezier(0.68, -0.55, 0.265, 1.55)\"\n};\n\nexport const getEase = (ease: string) => {\n return /^(in|out)/.test(ease) ? easings[ease] : ease;\n};\n\nexport type genericTypes = genericTypes[] | boolean | object | string | number | closure | null | undefined;\nexport interface AnimationOptions {\n target?: AnimationTarget,\n\n speed?: number,\n autoplay?: boolean,\n options?: AnimationOptions,\n delay?: number | closure,\n easing?: string | closure,\n endDelay?: number | closure,\n duration?: number | closure,\n keyframes?: Keyframe[] | object[] | closure,\n loop?: number | boolean | closure, // iterations: number,\n onfinish?: (element?: HTMLElement, index?: number, total?: number, animation?: Animation) => any,\n fillMode?: \"none\" | \"forwards\" | \"backwards\" | \"both\" | \"auto\" | closure,\n direction?: \"normal\" | \"reverse\" | \"alternate\" | \"alternate-reverse\" | closure,\n extend?: EffectTiming,\n [property: string]: genericTypes;\n};\n\nexport const DefaultAnimationOptions: AnimationOptions = {\n keyframes: [],\n\n loop: 1, // iterations: number,\n delay: 0,\n speed: 1,\n endDelay: 0,\n easing: \"ease\",\n autoplay: true,\n duration: 1000,\n fillMode: \"auto\",\n direction: \"normal\",\n extend: {}\n};\n\nexport type AnimationEvents = \"update\" | \"play\" | \"pause\" | \"start\" | \"begin\" | \"complete\" | \"finish\" | \"error\" | \"stop\";\n\n/** You can check it out here: https://codepen.io/okikio/pen/qBbdGaW?editors=0011 */\nexport class Animate {\n /**\n * Stores the options for the current animation\n */\n public options: AnimationOptions = {};\n\n /**\n * The Array of Elements to Animate\n */\n public targets: Node[] = [];\n\n /**\n * The properties to animate\n */\n public properties: object = {};\n\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n\n /**\n * The total duration of all Animation's\n */\n public totalDuration: number = 0;\n\n /**\n * The smallest delay out of all Animation's\n */\n public minDelay: number = 0;\n\n /**\n * The options for individual animations\n */\n public computedOptions: Manager = new Manager();\n\n /**\n * The Element the main animation uses\n */\n public mainElement: HTMLElement;\n\n /**\n * Stores an animation that runs on the total duration of the all other Animations, and as such it's the main Animation\n */\n public mainAnimation: Animation;\n\n /**\n * Stores request frame calls\n */\n public animationFrame: number;\n\n /**\n * An event emitter\n */\n public emitter: EventEmitter = new EventEmitter();\n\n /**\n * Returns a promise that is fulfilled when the mainAnimation is finished\n */\n public promise: Promise;\n constructor(options: AnimationOptions = {}) {\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n\n /**\n * Returns a new Promise that is resolve when this.finish is called\n */\n public newPromise(): Promise {\n return new Promise((resolve, reject) => {\n /*\n Note that the `this` keyword is in an Array when it is resolved,\n this is due to Promises not wanting to resolve references,\n so, you can't resolve `this` directly, so, I chose to resolve `this` in an\n Array\n */\n this.on(\"complete\", () => resolve([this]));\n this.on(\"error\", err => reject(err));\n });\n }\n\n /**\n * Fulfills the this.promise Promise\n */\n public then(\n onFulfilled?: (value?: any) => any,\n onRejected?: (reason?: any) => any\n ): Animate {\n onFulfilled = onFulfilled?.bind(this);\n onRejected = onRejected?.bind(this);\n this.promise.then(onFulfilled, onRejected);\n return this;\n }\n\n /**\n * Catches error that occur in the this.promise Promise\n */\n public catch(onRejected: (reason?: any) => any): Animate {\n onRejected = onRejected?.bind(this);\n this.promise.catch(onRejected);\n return this;\n }\n\n /**\n * If you don't care if the this.promise Promise has either been rejected or resolved\n */\n public finally(onFinally: () => any): Animate {\n onFinally = onFinally?.bind(this);\n this.promise.finally(onFinally);\n return this;\n }\n\n /**\n * Represents an Animation Frame Loop\n */\n public loop(): void {\n this.stopLoop();\n this.emit(\"update\", this.getProgress(), this);\n this.animationFrame = window.requestAnimationFrame(this.loop);\n }\n\n /**\n * Cancels animation frame\n */\n public stopLoop() {\n window.cancelAnimationFrame(this.animationFrame);\n }\n\n /**\n * Calls a method that affects all animations including the mainAnimation; the method only allows the animation parameter\n */\n public all(method: (animation: Animation) => void) {\n method(this.mainAnimation);\n this.animations.forEach(animation => method(animation));\n return this;\n }\n\n /**\n * Register the begin event\n */\n protected beginEvent() {\n if (this.getProgress() == 0) {\n let timer: number | void = window.setTimeout(() => {\n this.emit(\"begin\", this);\n timer = window.clearTimeout(timer as number);\n }, this.minDelay);\n }\n }\n\n /**\n * Play Animation\n */\n public play(): Animate {\n let playstate = this.getPlayState();\n this.beginEvent();\n this.all(anim => anim.play());\n this.emit(\"play\", playstate, this);\n this.loop();\n return this;\n }\n\n /**\n * Pause Animation\n */\n public pause(): Animate {\n let playstate = this.getPlayState();\n this.all(anim => anim.pause());\n this.emit(\"pause\", playstate, this);\n this.stopLoop();\n this.animationFrame = undefined;\n return this;\n }\n\n /**\n * Reset all Animations\n */\n public reset() {\n this.setProgress(0);\n this.beginEvent();\n\n if (this.options.autoplay) this.play();\n else this.pause();\n return this;\n }\n\n /**\n * Cancels all Animations\n */\n public cancel() {\n this.all(anim => anim.cancel());\n this.stopLoop();\n return this;\n }\n\n /**\n * Force complete all Animations\n */\n public finish() {\n this.all(anim => anim.finish());\n this.stopLoop();\n return this;\n }\n\n /**\n * Cancels & Clears all Animations\n */\n public stop() {\n this.cancel();\n this.animations.clear();\n while (this.targets.length) this.targets.pop();\n this.mainElement = undefined;\n this.emit(\"stop\");\n }\n\n /**\n * Returns an Array of targets\n */\n public getTargets(): Node[] {\n return this.targets;\n }\n\n /**\n * Get a specific Animation from an Animate instance\n */\n public getAnimation(element: HTMLElement): Animation {\n return this.animations.get(element);\n }\n\n /**\n * Returns the timings of an Animation, given a target\n * E.g. { duration, endDelay, delay, iterations, iterationStart, direction, easing, fill, etc... }\n */\n public getTiming(target: HTMLElement | Animation): AnimationOptions & EffectTiming {\n let animation = target instanceof Animation ? target : this.getAnimation(target);\n let keyframeOptions = this.computedOptions.get(animation) ?? {};\n let timings = animation.effect?.getTiming() ?? {};\n let options = this.getOptions();\n\n return { ...DefaultAnimationOptions, ...options, ...timings, ...keyframeOptions };\n }\n\n /**\n * Returns the total duration of Animation\n */\n public getTotalDuration(): number {\n return this.totalDuration;\n }\n\n /**\n * Returns the current time of the Main Animation\n */\n public getCurrentTime(): number {\n return this.mainAnimation.currentTime;\n }\n\n /**\n * Returns the Animation progress as a fraction of the current time / duration * 100\n */\n public getProgress() {\n return (this.getCurrentTime() / this.totalDuration) * 100;\n }\n\n /**\n * Return the playback speed of the animation\n */\n public getSpeed(): number {\n return this.mainAnimation.playbackRate;\n }\n\n /**\n * Returns the current playing state\n */\n public getPlayState(): \"idle\" | \"running\" | \"paused\" | \"finished\" {\n return this.mainAnimation.playState;\n }\n\n /**\n * Get the options of an Animate instance\n */\n public getOptions(): AnimationOptions {\n return this.options;\n }\n\n /**\n * Set the current time of the Main Animation\n */\n public setCurrentTime(time: number): Animate {\n this.all(anim => { anim.currentTime = time; });\n this.emit(\"update\", this.getProgress());\n return this;\n }\n\n /**\n * Set the Animation progress as a value from 0 to 100\n */\n public setProgress(percent: number): Animate {\n let time = (percent / 100) * this.totalDuration;\n this.setCurrentTime(time);\n return this;\n }\n\n /**\n * Set the playback speed of an Animation\n */\n public setSpeed(speed: number = 1): Animate {\n this.all(anim => { anim.playbackRate = speed; });\n return this;\n }\n\n /**\n * Adds a listener for a given event\n */\n public on(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.on(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Removes a listener from an event\n */\n public off(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.off(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Call all listeners within an event\n */\n public emit(events: AnimationEvents | string | any[], ...args: any): Animate {\n this.emitter.emit(events, ...args);\n return this;\n }\n\n\n /** Returns the Animate options, as JSON */\n public toJSON(): AnimationOptions {\n return this.getOptions();\n }\n\n /**\n * The Symbol.toStringTag well-known symbol is a string valued property that is used\n * in the creation of the default string description of an object.\n * It is accessed internally by the Object.prototype.toString() method.\n */\n get [Symbol.toStringTag]() {\n return `Animate`;\n }\n}\n\n/** Creates a new Animate instance */\nexport const animate = (options: AnimationOptions = {}): Animate => {\n return new Animate(options);\n};\n\nexport default animate;"], - "mappings": "AAcO,GAAM,GAA2B,CACpC,YAAa,UACb,eAAgB,eAChB,eAAgB,cAChB,QAAS,CACL,CAAC,YAAa,SAElB,gBAAiB,iBACjB,eAAgB,gBAChB,eAAgB,aAChB,UAAW,QACX,QAAS,KAIA,EAAY,AAAC,GACf,OAAO,OAAO,IAAK,GAAmB,GAIpC,EAAS,CAAC,EAAiB,EAAe,EAAoB,KAAiB,CACxF,GAAI,CAAE,UAAW,EACb,EAAO,OAAO,EAAS,IAAM,EAAS,MAAM,IAChD,MAAO,GAAW,IAAI,KAAU,GAIvB,EAAY,CAAC,EAAiB,EAAoB,EAAoB,KAAc,CAC7F,GAAI,MAAO,IAAU,SACjB,MAAO,GAEX,GAAI,GAAO,EAAO,GAClB,MAAI,OAAO,IAAS,SACT,EAAO,EAAQ,EAAM,GACzB,GC/CJ,WAAoB,CAG1B,YAAY,EAAuB,CAClC,KAAK,IAAM,GAAI,KAAI,GAIb,QAAoB,CAC1B,MAAO,MAAK,IAIN,IAAI,EAAW,CACrB,MAAO,MAAK,IAAI,IAAI,GAId,MAAiB,CACvB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O,cAAe,CACvB,MAAO,YAKF,GAAU,CAAC,EAA4B,KACzC,GAAI,GAAQ", + "sourcesContent": ["export interface ICONFIG {\n prefix?: string;\n wrapperAttr?: string;\n noAjaxLinkAttr?: string;\n noPrefetchAttr?: \"no-prefetch\";\n headers?: string[][];\n preventSelfAttr?: string;\n preventAllAttr?: string;\n transitionAttr?: string;\n blockAttr?: string;\n timeout?: number;\n maxPages?: number;\n [key: string]: any;\n}\n\nexport const CONFIG_DEFAULTS = {\n wrapperAttr: \"wrapper\",\n noAjaxLinkAttr: \"no-ajax-link\",\n noPrefetchAttr: \"no-prefetch\",\n headers: [\n [\"x-partial\", \"true\"]\n ],\n preventSelfAttr: `prevent=\"self\"`,\n preventAllAttr: `prevent=\"all\"`,\n transitionAttr: \"transition\",\n blockAttr: `block`,\n timeout: 30000,\n maxPages: 5\n};\n\nexport type ConfigKeys = keyof typeof CONFIG_DEFAULTS | string;\nexport const newConfig = (config: ICONFIG): ICONFIG => {\n return Object.assign({ ...CONFIG_DEFAULTS }, config);\n};\n\n/** Converts string into properly formatted data attributes */\nexport const toAttr = (config: ICONFIG, value: string, brackets: boolean = true): string => {\n let { prefix } = config;\n let attr = `data${prefix ? \"-\" + prefix : \"\"}-${value}`;\n return brackets ? `[${attr}]` : attr;\n};\n\n/** Selects config vars, and formats them for use, or simply returns the current configurations for the framework */\nexport const getConfig = (config: ICONFIG, value?: ConfigKeys, brackets: boolean = true): any => {\n if (typeof value !== \"string\")\n return config;\n\n let prop = config[value];\n if (typeof prop === \"string\")\n return toAttr(config, prop, brackets);\n return prop;\n};\n", "/** Manages complex lists of named data, eg. A page can be stored in a list by of other pages with the url being how the page is stored in the list. Managers use Maps to store data */\nexport class Manager {\n\t/** The complex list of named data, to which the Manager controls */\n\tpublic map: Map;\n\tconstructor(value?: Array<[K, V]>) {\n\t\tthis.map = new Map(value);\n\t}\n\n\t/** Returns the Manager classes base Map */\n\tpublic getMap(): Map {\n\t\treturn this.map;\n\t}\n\n\t/** Get a value stored in the Manager */\n\tpublic get(key: K): V {\n\t\treturn this.map.get(key);\n\t}\n\n\t/** Returns the keys of all items stored in the Manager as an Array */\n\tpublic keys(): Array {\n\t\treturn Array.from(this.map.keys());\n\t}\n\n\t/** Returns the values of all items stored in the Manager as an Array */\n\tpublic values(): Array {\n\t\treturn Array.from(this.map.values());\n\t}\n\n\t/** Set a value to the Manager using a key */\n\tpublic set(key: K, value: V): Manager {\n\t\tthis.map.set(key, value);\n\t\treturn this;\n\t}\n\n\t/** Adds a value to Manager, and uses the current size of the Manager as it's key, it works best when all the key in the Manager are numbers */\n\tpublic add(value: V): Manager {\n\t\tlet size = this.size;\n\t\t// @ts-ignore\n\t\tlet num: K = size as K;\n\t\tthis.set(num, value);\n\t\treturn this;\n\t}\n\n\t/** Returns the total number of items stored in the Manager */\n\tpublic get size(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** An alias for size */\n\tpublic get length(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** Returns the last item in the Manager who's index is a certain distance from the last item in the Manager */\n\tpublic last(distance: number = 1): V | undefined {\n\t\tlet key = this.keys()[this.size - distance];\n\t\treturn this.get(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns true if an element in the Map object existed and has been removed, or false if the element does not exist */\n\tpublic delete(key: K): boolean {\n\t\treturn this.map.delete(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns the Manager class, allowing for chains */\n\tpublic remove(key: K): Manager {\n\t\tthis.map.delete(key);\n\t\treturn this;\n\t}\n\n\t/** Clear the Manager of all its contents */\n\tpublic clear(): Manager {\n\t\tthis.map.clear();\n\t\treturn this;\n\t}\n\n\t/** Checks if the Manager contains a certain key */\n\tpublic has(key: K): boolean {\n\t\treturn this.map.has(key);\n\t}\n\n\t/** Returns a new Iterator object that contains an array of [key, value] for each element in the Map object in insertion order. */\n\tpublic entries(): IterableIterator<[K, V]> {\n\t\treturn this.map.entries();\n\t}\n\n\t/** Iterates through the Managers contents, calling a callback function every iteration */\n\tpublic forEach(\n\t\tcallback: (value?: V, key?: K, map?: Map) => void,\n\t\tcontext?: object\n\t): Manager {\n\t\tthis.map.forEach(callback, context);\n\t\treturn this;\n\t}\n\n\t/** Allows for iteration via for..of, learn more: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators] */\n\tpublic [Symbol.iterator](): IterableIterator<[K, V]> {\n\t\treturn this.entries();\n\t}\n}\n\n/**\n * Calls the method of a certain name for all items that are currently installed\n */\nexport const methodCall = (manager: Manager, method: string, ...args: any): void => {\n\tmanager.forEach((item) => {\n\t\t// @ts-ignore\n\t\titem[method](...args);\n\t});\n};\n\n/**\n * Asynchronously calls the method of a certain name for all items that are currently installed, similar to methodCall\n */\nexport const asyncMethodCall = async (manager: Manager, method: string, ...args: any): Promise => {\n\tfor (let [, item] of manager) {\n\t\t// @ts-ignore\n\t\tawait item[method](...args);\n\t}\n};\n\nexport default Manager;\n", "import { Manager, methodCall, asyncMethodCall } from \"@okikio/manager\";\nimport { ICONFIG } from \"./config\";\nimport { IApp } from \"./app\";\nimport { EventEmitter } from \"./emitter\";\n\nexport type IAdvancedManager = AdvancedManager;\n\n/** The base class for AdvancedManager items */\nexport class ManagerItem {\n /** The AdvancedManager the ManagerItem is attached to */\n public manager: IAdvancedManager;\n\n /** The App the ManagerItem is attached to */\n public app: IApp;\n\n /** The Config of the App the ManagerItem is attached to */\n public config: ICONFIG;\n\n /** The EventEmitter of the App the ManagerItem is attached to */\n public emitter: EventEmitter;\n\n /** The key to where ManagerItem is stored in an AdvancedManager */\n public key: any;\n\n constructor() { }\n\n /** Run after the Manager Item has been registered */\n public install(): any { }\n\n /** Register the current Manager Item's manager */\n public register(manager: IAdvancedManager, key: any): ManagerItem {\n this.manager = manager;\n this.app = manager.app;\n this.config = manager.config;\n this.emitter = manager.emitter;\n this.key = key;\n this.install();\n return this;\n }\n\n /** Run before the ManagerItem has been unregistered */\n public uninstall(): any { }\n\n /** Basically removes a ManagerItem, in order to recover the ManagerItem, it needs to be re-added to an AdvancedManager */\n public unregister() {\n this.uninstall();\n\n this.manager.remove(this.key);\n this.key = undefined;\n this.manager = undefined;\n this.app = undefined;\n this.config = undefined;\n this.emitter = undefined;\n }\n}\n\n/** A tweak to the Manager class that makes it self aware of the App class it's instantiated in */\nexport class AdvancedManager extends Manager {\n /** The App the AdvancedManager is attached to */\n public app: IApp;\n\n /** The Config of the App the AdvancedManager is attached to */\n public config: ICONFIG;\n\n /** The EventEmitter of the App the AdvancedManager is attached to */\n public emitter: EventEmitter;\n\n /** Register App details */\n constructor(app: IApp) {\n super();\n this.app = app;\n this.config = app.config;\n this.emitter = app.emitter;\n }\n\n /** Add a ManagerItem to AdvancedManager at a specified key */\n public set(key: K, value: V) {\n super.set(key, value);\n value.register(this, key);\n return this;\n }\n}\n\nexport { Manager, methodCall, asyncMethodCall };\n", "export const newURL = (url: string | URL | Location = window.location.href): URL => {\n return url instanceof URL ? url : new URL(url as unknown as string, window.location.origin);\n};\n\n/** Returns the pathname with the hash at the end */\nexport const getHashedPath = (url: URL | string): string => {\n let _url = newURL(url);\n return `${_url.pathname}${_url.hash}`;\n};\n\n/** Returns the actual hash without the hashtag */\nexport const getHash = (url: URL | string): string => newURL(url).hash.slice(1);\n\n/** Removes the hash from the full URL for a clean URL string */\nexport const clean = (url: URL | string): string => newURL(url).toString().replace(/(\\/#.*|\\/|#.*)$/, '');\n\n/** Compares two URLs to each other */\nexport const equal = (a: URL | string, b: URL | string): boolean => (clean(a) === clean(b));\n\n", "import { AdvancedManager, ManagerItem, methodCall } from \"./manager\";\nimport { IApp } from \"./app\";\n\n/** Controls specific kinds of actions that require JS */\nexport class Service extends ManagerItem {\n\t/** Called before the start of a Service, represents a constructor of sorts */\n\tpublic init(...args: any): any;\n\tpublic init(): any { }\n\n\t/** Called on start of Service */\n\tpublic boot(...args: any): any;\n\tpublic boot(): any {\n\t\tthis.initEvents();\n\t}\n\n\t/** Initialize events */\n\tpublic initEvents(): void { }\n\n\t/** Stop events */\n\tpublic stopEvents(): void { }\n\n\t/** Stop services */\n\tpublic stop(): void {\n\t\tthis.stopEvents();\n\t\tthis.unregister();\n\t}\n}\n\n/** The Service Manager controls the lifecycle of all Services in an App */\nexport class ServiceManager extends AdvancedManager {\n\tconstructor(app: IApp) {\n\t\tsuper(app);\n\t}\n\n\t/** Call the init method for all Services */\n\tpublic init(): ServiceManager {\n\t\tmethodCall(this, \"init\");\n\t\treturn this;\n\t}\n\n\t/** Call the boot method for all Services */\n\tpublic boot(): ServiceManager {\n\t\tmethodCall(this, \"boot\");\n\t\treturn this;\n\t}\n\n\t/** Call the stop method for all Services */\n\tpublic stop(): ServiceManager {\n\t\tmethodCall(this, \"stop\");\n\t\treturn this;\n\t}\n}\n", "import { Service } from \"./service\";\nimport { getHashedPath, newURL } from \"./url\";\n\nexport type Trigger = HTMLAnchorElement | \"HistoryManager\" | \"popstate\" | \"back\" | \"forward\";\nexport interface ICoords {\n\treadonly x: number;\n\treadonly y: number;\n}\n\nexport interface IStateData {\n\tscroll: ICoords;\n\t[key: string]: any;\n}\n\nexport interface IState {\n\turl: string;\n\tindex?: number;\n\ttransition: string;\n\tdata: IStateData;\n}\n\nexport interface IHistoryItem {\n\tindex: number;\n\tstates: IState[];\n}\n\nexport interface IHistoryManager extends Service {\n\tstates: IState[],\n\tpointer: number,\n\n\tinit(): any,\n\tget(index: number): IState,\n\tadd(value?: IState, historyAction?: \"replace\" | \"push\"): HistoryManager,\n\tremove(index?: number): HistoryManager,\n\treplace(newStates: IState[]): HistoryManager,\n\tset(i: number, state: IState): IState,\n\tcurrent: IState,\n\tlast: IState,\n\tprevious: IState | null,\n\tlength: number,\n}\n\n/** A quick snapshot of page scroll coordinates */\nexport const newCoords = (x: number = window.scrollX, y: number = window.scrollY): ICoords => ({ x, y });\n\n/** Creates a state; a state represents the current status of the page consisting of properties like: url, transition, and data */\nexport const newState = (state: IState = {\n\turl: getHashedPath(newURL()),\n\tindex: 0,\n\ttransition: \"default\",\n\tdata: {\n\t\tscroll: newCoords(),\n\t\ttrigger: \"HistoryManager\"\n\t}\n}): IState => (state);\n\n/** Keeps a record of the history of the App; it stores only the states of Pages */\nexport class HistoryManager extends Service implements IHistoryManager {\n\tpublic states: IState[];\n\tpublic pointer = -1;\n\n\t/** Initializes the states array, and replace the history pushState data with the states array */\n\tinit() {\n\t\tthis.states = [];\n\n\t\tlet state = newState();\n\t\tthis.add(state, \"replace\");\n\t}\n\n\t/** Get a state based on it's index */\n\tpublic get(index: number) {\n\t\treturn this.states[index];\n\t}\n\n\t/** Add a state to HistoryManager and change the history pushState data based on the historyAction specified */\n\tpublic add(value?: IState, historyAction: \"replace\" | \"push\" = \"push\"): HistoryManager {\n\t\tlet state = newState(value);\n\t\tlet len = this.length;\n\t\tthis.states.push({ ...state });\n\t\tthis.pointer = len;\n\n\t\tlet item: IHistoryItem = {\n\t\t\tindex: this.pointer,\n\t\t\tstates: [...this.states]\n\t\t};\n\t\tchangeState(historyAction, state, item);\n\t\treturn this;\n\t}\n\n\tpublic remove(index?: number) {\n\t\tif (index) {\n\t\t\tthis.states.splice(index, 1);\n\t\t} else {\n\t\t\tthis.states.pop();\n\t\t}\n\n\t\tthis.pointer--;\n\t\treturn this;\n\t}\n\n\t/** Replaces the states array with another states array, this is later used when going back and forward in page history */\n\tpublic replace(newStates: IState[]) {\n\t\tthis.states = newStates;\n\t\treturn this;\n\t}\n\n\t/** Set state by index. */\n\tpublic set(i: number, state: IState) {\n\t\treturn (this.states[i] = state);\n\t}\n\n\t/** Get the current state */\n\tget current(): IState {\n\t\treturn this.get(this.pointer);\n\t}\n\n\t/** Get the last state (top of the history stack). */\n\tget last(): IState {\n\t\treturn this.get(this.length - 1);\n\t}\n\n\t/** Get the previous state. */\n\tget previous(): IState | null {\n\t\treturn this.pointer < 1 ? null : this.get(this.pointer - 1);\n\t}\n\n\tget length() {\n\t\treturn this.states.length;\n\t}\n}\n\n/** Either push or replace history state */\nexport const changeState = (action: \"push\" | \"replace\", state: IState, item: object) => {\n\tlet href = getHashedPath(state.url);\n\tlet args = [item, \"\", href];\n\tif (window.history) {\n\t\tswitch (action) {\n\t\t\tcase \"push\":\n\t\t\t\twindow.history.pushState.apply(window.history, args);\n\t\t\t\tbreak;\n\t\t\tcase \"replace\":\n\t\t\t\twindow.history.replaceState.apply(window.history, args);\n\t\t\t\tbreak;\n\t\t}\n\t}\n};\n", "import { Manager, ManagerItem, AdvancedManager } from \"./manager\";\nimport { equal, newURL } from \"./url\";\nimport { getConfig } from \"./config\";\nimport { Service } from \"./service\";\n\nexport interface IPage extends ManagerItem {\n dom: Document,\n wrapper: HTMLElement,\n title: string,\n head: Element,\n body: Element,\n url: URL,\n data: string,\n wrapperAttr: string,\n\n build(): any,\n install(): void,\n uninstall(): any,\n}\n\n/**\n * Parses strings to DOM\n */\nexport const PARSER: DOMParser = new DOMParser();\n\n/** A page represents the DOM elements that create each page */\nexport class Page extends ManagerItem implements IPage {\n /** Holds the DOM of the current page */\n public dom: Document;\n\n /** Holds the wrapper element to be swapped out of each Page */\n public wrapper: HTMLElement;\n\n /** Holds the title of each page */\n public title: string;\n\n /** Holds the head element of each page */\n public head: Element;\n\n /** Holds the body element of each page */\n public body: Element;\n\n /** The URL of the current page */\n public url: URL;\n\n /** The payload of a page request */\n public data: string;\n\n /** Attr that identifies the wrapper */\n public wrapperAttr: string;\n\n constructor(url: URL = newURL(), dom: string | Document = document) {\n super();\n this.url = url;\n\n if (typeof dom === \"string\") {\n this.data = dom;\n } else this.dom = dom || document;\n }\n\n /** Builds the page's dom, and sets the title, head, body, and wrapper properties of the Page class */\n public build() {\n if (!(this.dom instanceof Node)) {\n this.dom = PARSER.parseFromString(this.data, \"text/html\");\n }\n\n if (!(this.body instanceof Node)) {\n let { title, head, body } = this.dom;\n this.title = title;\n this.head = head;\n this.body = body;\n this.wrapper = this.body.querySelector(this.wrapperAttr);\n }\n }\n\n public install() {\n this.wrapperAttr = getConfig(this.config, \"wrapperAttr\");\n }\n\n public uninstall() {\n this.url = undefined;\n this.title = undefined;\n this.head = undefined;\n this.body = undefined;\n this.dom = undefined;\n this.wrapper = undefined;\n this.data = undefined;\n this.wrapperAttr = undefined;\n }\n}\n\nexport interface IPageManager extends Service {\n loading: Manager>,\n pages: AdvancedManager;\n\n install(): any,\n\n get(key): Page,\n add(value): PageManager,\n set(key, value): PageManager,\n remove(key): PageManager,\n has(key): boolean,\n clear(): PageManager,\n size: number,\n keys(): any[],\n\n load(_url: URL | string): Promise,\n request(url: string): Promise,\n}\n\n/** Controls which page to load */\nexport class PageManager extends Service implements IPageManager {\n /** Stores all fetch requests that are currently loading */\n public loading: Manager> = new Manager();\n\n pages: AdvancedManager;\n\n /** Instantiate pages, and add the current page to pages */\n install() {\n this.pages = new AdvancedManager(this.app);\n\n let URLString = newURL().pathname;\n this.set(URLString, new Page());\n URLString = undefined;\n }\n\n get(key) { return this.pages.get(key); }\n add(value) { this.pages.add(value); return this; }\n set(key, value) { this.pages.set(key, value); return this; }\n remove(key) { this.pages.remove(key); return this; }\n has(key) { return this.pages.has(key); }\n clear() { this.pages.clear(); return this; }\n get size() { return this.pages.size; }\n keys() { return this.pages.keys(); }\n\n /** Load from cache or by requesting URL via a fetch request, avoid requesting for the same thing twice by storing the fetch request in \"this.loading\" */\n public async load(_url: URL | string = newURL()): Promise {\n let url: URL = newURL(_url);\n let urlString: string = url.pathname;\n let page: Page, request: Promise;\n\n if (this.has(urlString)) {\n page = this.get(urlString);\n return Promise.resolve(page);\n }\n\n if (!this.loading.has(urlString)) {\n request = this.request(urlString);\n this.loading.set(urlString, request);\n } else request = this.loading.get(urlString);\n\n let response = await request;\n this.loading.remove(urlString);\n\n page = new Page(url, response);\n this.set(urlString, page);\n\n if (this.size > getConfig(this.config, \"maxPages\")) {\n let currentUrl = newURL();\n let keys = this.keys();\n let first = equal(currentUrl, keys[0]) ? keys[1] : keys[0];\n let page = this.get(first);\n page.unregister();\n page = undefined;\n keys = undefined;\n currentUrl = undefined;\n first = undefined;\n }\n\n return page;\n }\n\n /** Starts a fetch request */\n public async request(url: string): Promise {\n const headers = new Headers(getConfig(this.config, \"headers\"));\n const timeout = window.setTimeout(() => {\n window.clearTimeout(timeout);\n throw \"Request Timed Out!\";\n }, getConfig(this.config, \"timeout\"));\n\n try {\n let response = await fetch(url, {\n mode: 'same-origin',\n method: \"GET\",\n headers,\n cache: \"default\",\n credentials: \"same-origin\",\n });\n\n window.clearTimeout(timeout);\n if (response.status >= 200 && response.status < 300) {\n return await response.text();\n }\n\n const err = new Error(response.statusText || \"\" + response.status);\n throw err;\n } catch (err) {\n window.clearTimeout(timeout);\n throw err;\n }\n }\n}\n", "import { Manager, methodCall } from \"@okikio/manager\";\n\nexport type ListenerCallback = ((...args: any) => void);\nexport interface IListener {\n readonly callback: ListenerCallback;\n readonly scope: object;\n readonly name: string;\n}\n\n/** Represents a new event listener consisting of properties like: callback, scope, name */\nexport const newListener = ({\n callback = () => { },\n scope = null,\n name = \"event\",\n}: IListener): IListener => ({ callback, scope, name });\n\n/** Represents a new event */\nexport class Event extends Manager {\n /** The name of the event */\n public name: string;\n constructor(name: string = \"event\") {\n super();\n this.name = name;\n }\n}\n\nexport type EventInput = string | object | Array;\n\n/**\n * An Event Emitter\n * */\nexport class EventEmitter extends Manager {\n constructor() {\n super();\n }\n\n /** Gets event, if event doesn't exist create a new one */\n public getEvent(name: string): Event {\n let event = this.get(name);\n if (!(event instanceof Event)) {\n this.set(name, new Event(name));\n return this.get(name);\n }\n\n return event;\n }\n\n /** Creates a listener and adds it to an event */\n public newListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event = this.getEvent(name);\n event.add(newListener({ name, callback, scope }));\n return event;\n }\n\n /** Adds a listener to a given event */\n public on(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n this.newListener(_name, _callback, _scope);\n }, this);\n return this;\n }\n\n /** Removes a listener from an event */\n public removeListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event: Event = this.get(name);\n if (event instanceof Event && callback) {\n let listener = newListener({ name, callback, scope });\n\n event.forEach((value: IListener, i: number) => {\n if (\n value.callback === listener.callback &&\n value.scope === listener.scope\n ) {\n return event.remove(i);\n }\n });\n }\n\n return event;\n }\n\n /** Remove a listener from a given event, or just completely remove an event */\n public off(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n if (typeof _callback === \"function\") {\n this.removeListener(_name, _callback, _scope);\n } else this.remove(_name);\n }, this);\n return this;\n }\n\n /** Call all listeners within an event */\n public emit(\n events: string | Array,\n ...args: any\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n // Loop through the list of events\n events.forEach((event: string) => {\n let _event: Event = this.get(event);\n\n if (_event instanceof Event) {\n _event.forEach((listener: IListener) => {\n let { callback, scope } = listener;\n callback.apply(scope, args);\n });\n }\n }, this);\n return this;\n }\n\n /** Clears events and event listeners */\n public clear() {\n methodCall(this, \"clear\");\n super.clear();\n return this;\n }\n}\n\nexport default EventEmitter;\n", "import { Manager } from \"./manager\";\nimport { ICoords, newCoords, Trigger } from \"./history\";\nimport { IPage } from \"./page\";\nimport { getConfig } from \"./config\";\nimport { Service } from \"./service\";\nimport { newURL } from \"./url\";\n\n/**\n * The async function type, allows for smooth transition between Promises\n */\nexport type asyncFn = (err?: any, value?: any) => void;\nexport interface ITransition {\n oldPage?: IPage;\n newPage?: IPage;\n trigger?: Trigger;\n scroll?: { x: number; y: number };\n scrollable?: boolean;\n in: (data: ITransitionData) => any;\n out: (data: ITransitionData) => any;\n [key: string]: any;\n}\nexport interface ITransitionData {\n from?: IPage;\n to?: IPage;\n trigger?: Trigger;\n scroll?: ICoords;\n done: asyncFn;\n}\nexport interface ITransitionManager extends Service {\n transitions: Manager,\n\n get(key: string): ITransition,\n set(key: string, value: ITransition): TransitionManager,\n add(value: ITransition): TransitionManager,\n has(key: string): boolean,\n\n boot(): any,\n animate(name: string, data: any): Promise,\n}\n\n/** Auto scrolls to an elements position if the element has an hash */\nexport const hashAction = (coords?: ICoords, hash: string = window.location.hash) => {\n try {\n let _hash = hash[0] == \"#\" ? hash : newURL(hash).hash;\n if (_hash.length > 1) {\n let el = document.getElementById(_hash.slice(1));\n if (el) {\n let { left, top } = el.getBoundingClientRect();\n let scrollLeft = window.pageXOffset;\n let scrollTop = window.pageYOffset;\n let x = left + scrollLeft;\n let y = top + scrollTop;\n\n console.log(x, y);\n return newCoords(x, y);\n }\n }\n } catch (e) {\n console.warn(\"[hashAction] error\", e);\n }\n\n return coords ?? newCoords(0, 0);\n};\n\n// The Default Transition\nconst Default: ITransition = {\n name: \"default\",\n scrollable: true,\n\n out({ done }: ITransitionData) {\n done();\n },\n in({ scroll, done }: ITransitionData) {\n window.scroll(scroll.x, scroll.y);\n done();\n }\n};\n\n/** Controls which Transition between pages to use */\nexport class TransitionManager extends Service implements ITransitionManager {\n transitions: Manager;\n private _arg: Array<[string, ITransition]>;\n constructor(transitions?: Array<[string, ITransition]>) {\n super();\n this._arg = transitions;\n }\n\n /** On Service install set Config */\n public install() {\n super.install();\n\n let transitions = this._arg && this._arg.length ? this._arg : (getConfig(this.config, \"transitions\") ?? []);\n\n // Manager like Maps use the most recent [key, value] Array it knows, replacing the default transition\n // With any other transitions called [\"default\", ...]\n transitions = [[\"default\", Default]].concat(transitions);\n this.transitions = new Manager(transitions);\n }\n\n get(key: string) { return this.transitions.get(key); }\n set(key: string, value: ITransition) { this.transitions.set(key, value); return this; }\n add(value: ITransition) { this.transitions.add(value); return this; }\n has(key: string) { return this.transitions.has(key); }\n\n /** Starts a transition */\n public async animate(name: string, data: any): Promise {\n let transition: ITransition = this.transitions.get(name);\n let scroll = data.scroll;\n let ignoreHashAction = data.ignoreHashAction;\n if (!(\"wrapper\" in data.oldPage) || !(\"wrapper\" in data.newPage))\n throw `[Page] either oldPage or newPage aren't instances of the Page Class.\\n ${{\n newPage: data.newPage,\n oldPage: data.oldPage,\n }}`;\n\n // Replace the title\n document.title = `` + data.newPage.title;\n\n let fromWrapper = data.oldPage.wrapper;\n let toWrapper = data.newPage.wrapper;\n\n if (!(fromWrapper instanceof Node) || !(toWrapper instanceof Node))\n throw `[Wrapper] the wrapper from the ${!(toWrapper instanceof Node) ? \"next\" : \"current\"\n } page cannot be found. The wrapper must be an element that has the attribute ${getConfig(this.config,\n \"wrapperAttr\"\n )}.`;\n\n // Give the Transition all the background data it may require\n transition.init && transition?.init(data);\n\n this.emitter.emit(\"BEFORE_TRANSITION_OUT\");\n\n // Start the out point of the Transition\n if (transition.out) {\n await new Promise((done) => {\n let outMethod: Promise = transition.out.call(transition, {\n ...data,\n from: data.oldPage,\n trigger: data.trigger,\n done,\n });\n\n outMethod?.then(done);\n });\n }\n\n this.emitter.emit(\"AFTER_TRANSITION_OUT\");\n\n // Add the new wrapper before the old one\n await new Promise((done) => {\n fromWrapper.insertAdjacentElement(\"beforebegin\", toWrapper);\n this.emitter.emit(\"CONTENT_INSERT\");\n\n if (!ignoreHashAction && !/back|popstate|forward/.test(data.trigger as string)) {\n scroll = hashAction(scroll);\n }\n done();\n });\n\n // Replace the old wrapper with the new one\n await new Promise((done) => {\n fromWrapper.remove();\n fromWrapper = undefined;\n toWrapper = undefined;\n this.emitter.emit(\"CONTENT_REPLACED\");\n done();\n });\n\n this.emitter.emit(\"BEFORE_TRANSITION_IN\");\n\n // Start the in point of the Transition (only the in method has access to the hashAction's scroll position)\n if (transition.in) {\n await new Promise(async (done) => {\n let inMethod: Promise = transition.in.call(transition, {\n ...data,\n from: data.oldPage,\n to: data.newPage,\n trigger: data.trigger,\n scroll,\n done,\n });\n\n inMethod?.then(done);\n });\n }\n\n this.emitter.emit(\"AFTER_TRANSITION_IN\");\n return transition;\n }\n}\n", "import { EventEmitter, ListenerCallback, EventInput } from \"./emitter\";\nimport { ServiceManager, Service } from \"./service\";\nimport { newConfig, ICONFIG } from \"./config\";\n\nexport interface IApp {\n services: ServiceManager,\n emitter: EventEmitter,\n config: ICONFIG,\n register(config: ICONFIG): App,\n get(key: string): Service,\n set(key: string, service: Service): App,\n add(value: Service): App,\n boot(): App,\n stop(): App,\n on(events: EventInput, callback?: ListenerCallback): App,\n off(events: EventInput, callback?: ListenerCallback): App,\n emit(events: string | any[], ...args: any): App,\n}\n\n/** The App class starts the entire process, it controls all managers and all services */\nexport class App implements IApp {\n /** An instance of the ServiceManager */\n public services: ServiceManager;\n\n /** An instance of an EventEmitter */\n public emitter: EventEmitter;\n\n /** The current Configuration's for the App */\n public config: ICONFIG;\n constructor(config: object = {}) {\n this.register(config);\n }\n\n /** Create new instances of the ServiceManager, EventEmitter and the configurations */\n public register(config: ICONFIG = {}): App {\n this.config = newConfig(config);\n this.emitter = new EventEmitter();\n this.services = new ServiceManager(this);\n\n let handler = (() => {\n document.removeEventListener(\"DOMContentLoaded\", handler);\n window.removeEventListener(\"load\", handler);\n this.emitter.emit(\"READY ready\");\n }).bind(this);\n\n document.addEventListener(\"DOMContentLoaded\", handler);\n window.addEventListener(\"load\", handler);\n return this;\n }\n\n /** Shortcuts to adding, setting, and getting Services */\n public get(key: string): Service {\n return this.services.get(key);\n }\n\n public set(key: string, value: Service): App {\n this.services.set(key, value);\n return this;\n }\n\n public add(value: Service): App {\n this.services.add(value);\n return this;\n }\n\n /** Initialize and boot all Services */\n public boot(): App {\n this.services.init();\n this.services.boot();\n return this;\n }\n\n /** Stops all Services and clears the even emitter of all events and listeners */\n public stop(): App {\n this.services.stop();\n this.emitter.clear();\n return this;\n }\n\n /** Shortcuts to the App EventEmitter on, off, and emit methods */\n public on(events: EventInput, callback?: ListenerCallback): App {\n this.emitter.on(events, callback, this);\n return this;\n }\n\n public off(events: EventInput, callback?: ListenerCallback): App {\n this.emitter.off(events, callback, this);\n return this;\n }\n\n public emit(events: string | any[], ...args: any): App {\n this.emitter.emit(events, ...args);\n return this;\n }\n}\n", "import { newState, Trigger, newCoords, IHistoryItem, IHistoryManager } from \"./history\";\nimport { Service } from \"./service\";\nimport { IPage, IPageManager } from \"./page\";\nimport { newURL, getHashedPath, equal } from \"./url\";\nimport { getConfig } from \"./config\";\nimport { hashAction, ITransitionManager } from \"./transition\";\n\nexport type LinkEvent = MouseEvent | TouchEvent;\nexport type StateEvent = LinkEvent | PopStateEvent;\nexport type IgnoreURLsList = Array;\n/**\n * Creates a barbajs like PJAX Service, for the native framework\n * Based on barbajs and StartingBlocks\n */\nexport class PJAX extends Service {\n /** URLs to ignore when prefetching */\n public ignoreURLs: IgnoreURLsList;\n\n /** Whether or not to disable prefetching */\n public prefetchIgnore: boolean;\n\n /** Current state of transitions */\n public isTransitioning: boolean;\n\n /** Ignore extra clicks of an anchor element if a transition has already started */\n public stopOnTransitioning: boolean;\n\n /** On page change (excluding popstate events) keep current scroll position */\n public stickyScroll: boolean;\n\n /** Force load a page if an error occurs */\n public forceOnError: boolean;\n\n /** Ignore hash action if set to true */\n public ignoreHashAction: boolean;\n\n public install() {\n super.install();\n\n this.ignoreURLs = getConfig(this.config, \"ignoreURLs\") ?? [];\n this.prefetchIgnore = getConfig(this.config, \"prefetchIgnore\") ?? false;\n this.stopOnTransitioning = getConfig(this.config, \"stopOnTransitioning\") ?? false;\n this.stickyScroll = getConfig(this.config, \"stickyScroll\") ?? false;\n this.forceOnError = getConfig(this.config, \"forceOnError\") ?? false;\n this.ignoreHashAction = getConfig(this.config, \"ignoreHashAction\") ?? false\n }\n\n /** Sets the transition state to either true or false */\n public transitionStart() {\n this.isTransitioning = true;\n }\n\n public transitionStop() {\n this.isTransitioning = false;\n }\n\n public init() {\n /**\n * Bind the event listeners to the PJAX class\n *\n * @memberof PJAX\n */\n this.onHover = this.onHover.bind(this);\n this.onClick = this.onClick.bind(this);\n this.onStateChange = this.onStateChange.bind(this);\n }\n\n /** Starts the PJAX Service */\n public boot() {\n if (\"scrollRestoration\" in window.history) {\n // Back off, browser, I got this...\n window.history.scrollRestoration = \"manual\";\n }\n\n super.boot();\n }\n\n /** Gets the transition to use for a certain anchor */\n public getTransitionName(el: HTMLAnchorElement): string | null {\n if (!el || !el.getAttribute) return null;\n let transitionAttr = el.getAttribute(\n getConfig(this.config, \"transitionAttr\", false)\n );\n\n if (typeof transitionAttr === \"string\") return transitionAttr;\n return null;\n }\n\n /** Checks to see if the anchor is valid */\n public validLink(\n el: HTMLAnchorElement,\n event: LinkEvent | KeyboardEvent,\n href: string\n ): boolean {\n let pushStateSupport = !window.history.pushState;\n let exists = !el || !href;\n let eventMutate =\n (event as KeyboardEvent).metaKey ||\n (event as KeyboardEvent).ctrlKey ||\n (event as KeyboardEvent).shiftKey ||\n (event as KeyboardEvent).altKey;\n let newTab =\n el.hasAttribute(\"target\") &&\n (el as HTMLAnchorElement).target === \"_blank\";\n let crossOrigin =\n (el as HTMLAnchorElement).protocol !== location.protocol ||\n (el as HTMLAnchorElement).hostname !== location.hostname;\n let download = typeof el.getAttribute(\"download\") === \"string\";\n let preventSelf = el.matches(getConfig(this.config, \"preventSelfAttr\"));\n let preventAll = Boolean(\n el.closest(getConfig(this.config, \"preventAllAttr\"))\n );\n let sameURL = getHashedPath(newURL()) === getHashedPath(newURL(href));\n return !(\n exists ||\n pushStateSupport ||\n eventMutate ||\n newTab ||\n crossOrigin ||\n download ||\n preventSelf ||\n preventAll ||\n sameURL\n );\n }\n\n /** Returns the href of an Anchor element */\n public getHref(el: HTMLAnchorElement): string | null {\n if (\n el &&\n el.tagName &&\n el.tagName.toLowerCase() === \"a\" &&\n typeof el.href === \"string\"\n )\n return el.href;\n return null;\n }\n\n /** Check if event target is a valid anchor with an href, if so, return the anchor */\n public getLink(event: LinkEvent): HTMLAnchorElement {\n let el = event.target as HTMLAnchorElement;\n let href: string = this.getHref(el);\n\n while (el && !href) {\n el = (el as HTMLElement).parentNode as HTMLAnchorElement;\n href = this.getHref(el);\n }\n\n // Check for a valid link\n if (!el || !this.validLink(el, event, href)) return;\n return el;\n }\n\n /** When an element is clicked, get valid anchor element, go for a transition */\n public onClick(event: LinkEvent) {\n let el = this.getLink(event);\n if (!el) return;\n\n if (this.isTransitioning && this.stopOnTransitioning) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n let href = this.getHref(el);\n this.emitter.emit(\"ANCHOR_CLICK CLICK\", event);\n this.go({ href, trigger: el, event });\n }\n\n /** Returns the direction of the State change as a String, either the Back button or the Forward button */\n public getDirection(value: number): Trigger {\n if (Math.abs(value) > 1) {\n // Ex 6-0 > 0 -> forward, 0-6 < 0 -> back\n return value > 0 ? \"forward\" : \"back\";\n } else {\n if (value === 0) {\n return \"popstate\";\n } else {\n // Ex 6-5 > 0 -> back, 5-6 < 0 -> forward\n return value > 0 ? \"back\" : \"forward\";\n }\n }\n }\n\n /** Force a page to go to a certain URL */\n public force(href: string): void {\n window.location.assign(href);\n }\n\n /**\n * If transition is running force load page.\n * Stop if currentURL is the same as new url.\n * On state change, change the current state history, to reflect the direction of said state change\n * Load page and page transition.\n */\n public go({\n href,\n trigger = \"HistoryManager\",\n event,\n }: {\n href: string;\n trigger?: Trigger;\n event?: StateEvent;\n }): Promise {\n // If transition is already running and the go method is called again, force load page\n if (this.isTransitioning && this.stopOnTransitioning ||\n !(this.manager.has(\"TransitionManager\") &&\n this.manager.has(\"HistoryManager\") &&\n this.manager.has(\"PageManager\"))) {\n this.force(href);\n return;\n }\n\n const history = this.manager.get(\"HistoryManager\") as IHistoryManager;\n let scroll = newCoords(0, 0);\n let currentState = history.current;\n let currentURL = currentState.url;\n if (equal(currentURL, href)) {\n return;\n }\n\n let transitionName: string;\n if (event && (event as PopStateEvent).state) {\n this.emitter.emit(\"POPSTATE\", event);\n\n // If popstate, get back/forward direction.\n let { state }: { state: IHistoryItem } = event as PopStateEvent;\n let { index } = state;\n let currentIndex = currentState.index;\n let difference = currentIndex - index;\n\n history.replace(state.states);\n history.pointer = index;\n\n let _state = history.get(index);\n transitionName = _state.transition;\n scroll = _state.data.scroll;\n\n trigger = this.getDirection(difference);\n console.log(trigger == \"forward\" && history)\n\n // Based on the direction of the state change either remove or add a state\n this.emitter.emit(trigger === \"back\" ? `POPSTATE_BACK` : `POPSTATE_FORWARD`, event);\n } else {\n // Add new state\n transitionName = this.getTransitionName(trigger as HTMLAnchorElement);\n\n scroll = newCoords();\n let state = newState({\n url: href,\n transition: transitionName,\n data: { scroll },\n });\n\n !this.stickyScroll && (scroll = newCoords(0, 0));\n\n history.add(state);\n this.emitter.emit(\"HISTORY_NEW_ITEM\", event);\n }\n\n if (event) {\n event.stopPropagation();\n event.preventDefault();\n }\n\n this.emitter.emit(\"GO\", event);\n return this.load({\n oldHref: currentURL,\n href,\n trigger,\n transitionName,\n scroll,\n });\n }\n\n /** Load the new Page as well as a Transition; starts the Transition */\n public async load({\n oldHref,\n href,\n trigger,\n transitionName = \"default\",\n scroll = { x: 0, y: 0 },\n }: {\n oldHref: string;\n href: string;\n trigger: Trigger;\n transitionName?: string;\n scroll: { x: number; y: number };\n }): Promise {\n try {\n const pages = this.manager.get(\"PageManager\") as IPageManager;\n let newPage: IPage, oldPage: IPage;\n this.emitter.emit(\"NAVIGATION_START\", {\n oldHref,\n href,\n trigger,\n transitionName,\n });\n\n // Load & Build both the old and new pages\n try {\n this.transitionStart();\n oldPage = await pages.load(oldHref);\n !(oldPage.dom instanceof Element) && oldPage.build();\n\n this.emitter.emit(\"PAGE_LOADING\", { href, oldPage, trigger });\n newPage = await pages.load(href);\n await newPage.build();\n this.emitter.emit(\"PAGE_LOAD_COMPLETE\", {\n newPage,\n oldPage,\n trigger,\n });\n } catch (err) {\n console.warn(`[PJAX] Page load error: ${err}`);\n }\n\n // Transition Between Pages\n try {\n const TransitionManager = this.manager.get(\"TransitionManager\") as ITransitionManager;\n this.emitter.emit(\"TRANSITION_START\", transitionName);\n\n let transition = await TransitionManager.animate(TransitionManager.has(transitionName) ? transitionName : \"default\", {\n oldPage,\n newPage,\n trigger,\n scroll,\n ignoreHashAction: this.ignoreHashAction\n });\n\n if (!transition.scrollable) {\n if (!this.ignoreHashAction && !/back|popstate|forward/.test(trigger as string)) scroll = hashAction(scroll);\n window.scroll(scroll.x, scroll.y);\n }\n\n this.emitter.emit(\"TRANSITION_END\", { transition });\n } catch (err) {\n console.warn(`[PJAX] Transition error: ${err}`);\n }\n\n // Navigation is over\n this.emitter.emit(\"NAVIGATION_END\", {\n oldPage,\n newPage,\n trigger,\n transitionName,\n });\n } catch (err) {\n if (this.forceOnError) this.force(href);\n else console.warn(err);\n } finally {\n this.transitionStop(); // Sets isTransitioning to false\n }\n }\n\n /** Check to see if the URL is to be ignored, uses either RegExp of Strings to check */\n public ignoredURL({ pathname }: URL): boolean {\n return (\n this.ignoreURLs.length &&\n this.ignoreURLs.some((url) => {\n return typeof url === \"string\"\n ? url === pathname\n : (url as RegExp).exec(pathname) !== null;\n })\n );\n }\n\n /** When you hover over an anchor, prefetch the event target's href */\n public onHover(event: LinkEvent): Promise {\n let el = this.getLink(event);\n if (!el || !this.manager.has(\"PageManager\")) return;\n\n const pages = this.manager.get(\"PageManager\") as IPageManager;\n let url = newURL(this.getHref(el));\n let urlString: string = url.pathname;\n\n // If Url is ignored or already in cache, don't do any think\n if (this.ignoredURL(url) || pages.has(urlString)) return;\n this.emitter.emit(\"ANCHOR_HOVER HOVER\", event);\n\n try {\n pages.load(url);\n } catch (err) {\n console.warn(\"[PJAX] prefetch error,\", err);\n }\n }\n\n /** When History state changes, get url from State, go for a Transition. */\n public onStateChange(event: PopStateEvent): void {\n this.go({ href: window.location.href, trigger: \"popstate\", event });\n }\n\n /** Initialize DOM Events */\n public initEvents() {\n if (this.prefetchIgnore !== true) {\n document.addEventListener(\"mouseover\", this.onHover);\n document.addEventListener(\"touchstart\", this.onHover);\n }\n\n document.addEventListener(\"click\", this.onClick);\n window.addEventListener(\"popstate\", this.onStateChange);\n }\n\n /** Stop DOM Events */\n public stopEvents() {\n if (this.prefetchIgnore !== true) {\n document.removeEventListener(\"mouseover\", this.onHover);\n document.removeEventListener(\"touchstart\", this.onHover);\n }\n\n document.removeEventListener(\"click\", this.onClick);\n window.removeEventListener(\"popstate\", this.onStateChange);\n }\n}\n", "import { Service } from \"./service\";\nimport { Manager } from \"./manager\";\nimport { newURL, getHashedPath } from \"./url\";\nimport { IHistoryManager } from \"./history\";\n\nexport type RouteMethod = (...args: any) => any;\nexport type RouteStyle = string | RegExp | boolean;\nexport interface IRouteToFrom {\n to: RouteStyle,\n from: RouteStyle\n}\nexport type RoutePath = IRouteToFrom | RouteStyle;\nexport interface IRoute {\n path: RoutePath,\n method: RouteMethod\n}\n\n/** Controls what happens when certain url paths match a set of criteria */\nexport class Router extends Service {\n /** List of routes */\n protected routes: Manager;\n constructor(routes: IRoute[] = []) {\n super();\n this.routes = new Manager();\n for (let route of routes) {\n this.add(route);\n }\n }\n\n /** Add a new route to watch for */\n public add({ path, method }: IRoute): Router {\n let key = this.parse(path);\n this.routes.set(key, method);\n return this;\n }\n\n /** Convert strings into path match functions */\n public parsePath(path: RouteStyle): RegExp | boolean {\n if (typeof path === \"string\") return new RegExp(path, \"i\");\n else if (path instanceof RegExp || typeof path === \"boolean\")\n return path;\n throw \"[Router] only regular expressions, strings and booleans are accepted as paths.\";\n }\n\n /** Determines if a strings counts has a path */\n public isPath(input: RouteStyle): boolean {\n return (\n typeof input === \"string\" ||\n input instanceof RegExp ||\n typeof input === \"boolean\"\n );\n }\n\n /** Parse the multiple different formats for paths, into a { from, to } object */\n public parse(input: RoutePath): IRouteToFrom {\n let route = input as IRouteToFrom;\n let toFromPath: IRouteToFrom = {\n from: /(.*)/g,\n to: /(.*)/g,\n };\n\n if (this.isPath(input as RouteStyle))\n toFromPath = {\n from: true,\n to: input as RouteStyle,\n };\n else if (this.isPath(route.from) && this.isPath(route.to as RouteStyle))\n toFromPath = route;\n else\n throw \"[Router] path is neither a string, regular expression, or a { from, to } object.\";\n\n let { from, to } = toFromPath;\n return {\n from: this.parsePath(from),\n to: this.parsePath(to),\n };\n }\n\n /** Test if route paths are true, if so run their methods */\n public route() {\n if (this.manager.has(\"HistoryManager\")) {\n let history = this.manager.get(\"HistoryManager\") as IHistoryManager;\n let from: string = getHashedPath(newURL((history.length > 1 ? history.previous : history.current).url));\n let to: string = getHashedPath(newURL());\n\n this.routes.forEach((method: RouteMethod, path: IRouteToFrom) => {\n let fromRegExp = path.from as RegExp | boolean;\n let toRegExp = path.to as RegExp | boolean;\n\n if (\n typeof fromRegExp === \"boolean\" &&\n typeof toRegExp === \"boolean\"\n ) {\n throw `[Router] path ({ from: ${fromRegExp}, to: ${toRegExp} }) is not valid, remember paths can only be strings, regular expressions, or a boolean; however, both the from and to paths cannot be both booleans.`;\n }\n\n let fromParam: RegExpExecArray | RegExp | boolean = fromRegExp;\n let toParam: RegExpExecArray | RegExp | boolean = toRegExp;\n\n if (fromRegExp instanceof RegExp && fromRegExp.test(from))\n fromParam = fromRegExp.exec(from);\n if (toRegExp instanceof RegExp && toRegExp.test(to))\n toParam = toRegExp.exec(to);\n\n if (\n (Array.isArray(toParam) && Array.isArray(fromParam)) ||\n (Array.isArray(toParam) &&\n typeof fromParam == \"boolean\" &&\n fromParam) ||\n (Array.isArray(fromParam) &&\n typeof toParam == \"boolean\" &&\n toParam)\n )\n method({ from: fromParam, to: toParam, path: { from, to } });\n });\n } else {\n console.warn(\"[Route] HistoryManager is missing.\");\n }\n }\n\n /** Add listeners for PJAX Events */\n public initEvents() {\n this.emitter.on(\"READY\", this.route, this);\n this.emitter.on(\"CONTENT_REPLACED\", this.route, this);\n }\n\n /** Remove listeners for PJAX Events */\n public stopEvents() {\n this.emitter.off(\"READY\", this.route, this);\n this.emitter.off(\"CONTENT_REPLACED\", this.route, this);\n }\n}\n", "import { EventEmitter, EventInput, ListenerCallback } from \"@okikio/emitter\";\nimport { Manager } from \"@okikio/manager\";\n\n// DOM\nexport type AnimationTarget = string | Node | NodeList | HTMLCollection | HTMLElement[] | AnimationTarget[];\nexport const getElements = (selector: string | Node): Node[] => {\n return typeof selector === \"string\" ? Array.from(document.querySelectorAll(selector as string)) : [selector];\n};\n\nconst flatten = (arr: AnimationTarget[]) => [].concat(...arr);\nexport const getTargets = (targets: AnimationTarget): Node[] => {\n if (Array.isArray(targets)) {\n return flatten((targets as AnimationTarget[]).map(getTargets));\n }\n if (typeof targets == \"string\" || targets instanceof Node)\n return getElements(targets);\n if (targets instanceof NodeList || targets instanceof HTMLCollection)\n return Array.from(targets);\n return [];\n};\n\n// VALUES\nexport type closureArgs = [number, number, HTMLElement];\nexport type closure = ((index?: number, total?: number, element?: HTMLElement) => (genericTypes[] | void)) | any;\nexport const computeValue = (value: closure, args: closureArgs, context: Animate) => {\n if (typeof value === \"function\") {\n return value.apply(context, args);\n } else { return value; }\n};\n\nexport const mapObject = (obj: object, args: closureArgs, options: Animate): any => {\n let key: string, value: any, result = {};\n let keys = Object.keys(obj);\n for (let i = 0, len = keys.length; i < len; i++) {\n key = keys[i];\n value = obj[key];\n result[key] = computeValue(value, args, options);\n }\n\n return result;\n};\n\n/** From: [https://easings.net] */\nexport const easings = {\n \"in\": \"ease-in\",\n \"out\": \"ease-out\",\n \"in-out\": \"ease-in-out\",\n\n // Sine\n \"in-sine\": \"cubic-bezier(0.47, 0, 0.745, 0.715)\",\n \"out-sine\": \"cubic-bezier(0.39, 0.575, 0.565, 1)\",\n \"in-out-sine\": \"cubic-bezier(0.445, 0.05, 0.55, 0.95)\",\n\n // Quad\n \"in-quad\": \"cubic-bezier(0.55, 0.085, 0.68, 0.53)\",\n \"out-quad\": \"cubic-bezier(0.25, 0.46, 0.45, 0.94)\",\n \"in-out-quad\": \"cubic-bezier(0.455, 0.03, 0.515, 0.955)\",\n\n // Cubic\n \"in-cubic\": \"cubic-bezier(0.55, 0.055, 0.675, 0.19)\",\n \"out-cubic\": \"cubic-bezier(0.215, 0.61, 0.355, 1)\",\n \"in-out-cubic\": \"cubic-bezier(0.645, 0.045, 0.355, 1)\",\n\n // Quart\n \"in-quart\": \"cubic-bezier(0.895, 0.03, 0.685, 0.22)\",\n \"out-quart\": \"cubic-bezier(0.165, 0.84, 0.44, 1)\",\n \"in-out-quart\": \"cubic-bezier(0.77, 0, 0.175, 1)\",\n\n // Quint\n \"in-quint\": \"cubic-bezier(0.755, 0.05, 0.855, 0.06)\",\n \"out-quint\": \"cubic-bezier(0.23, 1, 0.32, 1)\",\n \"in-out-quint\": \"cubic-bezier(0.86, 0, 0.07, 1)\",\n\n // Expo\n \"in-expo\": \"cubic-bezier(0.95, 0.05, 0.795, 0.035)\",\n \"out-expo\": \"cubic-bezier(0.19, 1, 0.22, 1)\",\n \"in-out-expo\": \"cubic-bezier(1, 0, 0, 1)\",\n\n // Circ\n \"in-circ\": \"cubic-bezier(0.6, 0.04, 0.98, 0.335)\",\n \"out-circ\": \"cubic-bezier(0.075, 0.82, 0.165, 1)\",\n \"in-out-circ\": \"cubic-bezier(0.785, 0.135, 0.15, 0.86)\",\n\n // Back\n \"in-back\": \"cubic-bezier(0.6, -0.28, 0.735, 0.045)\",\n \"out-back\": \"cubic-bezier(0.175, 0.885, 0.32, 1.275)\",\n \"in-out-back\": \"cubic-bezier(0.68, -0.55, 0.265, 1.55)\"\n};\n\nexport const getEase = (ease: string) => {\n return /^(in|out)/.test(ease) ? easings[ease] : ease;\n};\n\nexport type genericTypes = genericTypes[] | boolean | object | string | number | closure | null | undefined;\nexport interface AnimationOptions {\n target?: AnimationTarget,\n\n speed?: number,\n autoplay?: boolean,\n options?: AnimationOptions,\n delay?: number | closure,\n easing?: string | closure,\n endDelay?: number | closure,\n duration?: number | closure,\n keyframes?: Keyframe[] | object[] | closure,\n loop?: number | boolean | closure, // iterations: number,\n onfinish?: (element?: HTMLElement, index?: number, total?: number, animation?: Animation) => any,\n fillMode?: \"none\" | \"forwards\" | \"backwards\" | \"both\" | \"auto\" | closure,\n direction?: \"normal\" | \"reverse\" | \"alternate\" | \"alternate-reverse\" | closure,\n extend?: EffectTiming,\n [property: string]: genericTypes;\n};\n\nexport const DefaultAnimationOptions: AnimationOptions = {\n keyframes: [],\n\n loop: 1, // iterations: number,\n delay: 0,\n speed: 1,\n endDelay: 0,\n easing: \"ease\",\n autoplay: true,\n duration: 1000,\n fillMode: \"auto\",\n direction: \"normal\",\n extend: {}\n};\n\nexport type AnimationEvents = \"update\" | \"play\" | \"pause\" | \"start\" | \"begin\" | \"complete\" | \"finish\" | \"error\" | \"stop\";\n\n/** You can check it out here: https://codepen.io/okikio/pen/qBbdGaW?editors=0011 */\nexport class Animate {\n /**\n * Stores the options for the current animation\n */\n public options: AnimationOptions = {};\n\n /**\n * The Array of Elements to Animate\n */\n public targets: Node[] = [];\n\n /**\n * The properties to animate\n */\n public properties: object = {};\n\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n\n /**\n * The total duration of all Animation's\n */\n public totalDuration: number = 0;\n\n /**\n * The smallest delay out of all Animation's\n */\n public minDelay: number = 0;\n\n /**\n * The options for individual animations\n */\n public computedOptions: Manager = new Manager();\n\n /**\n * The Element the main animation uses\n */\n public mainElement: HTMLElement;\n\n /**\n * Stores an animation that runs on the total duration of the all other Animations, and as such it's the main Animation\n */\n public mainAnimation: Animation;\n\n /**\n * Stores request frame calls\n */\n public animationFrame: number;\n\n /**\n * An event emitter\n */\n public emitter: EventEmitter = new EventEmitter();\n\n /**\n * Returns a promise that is fulfilled when the mainAnimation is finished\n */\n public promise: Promise;\n constructor(options: AnimationOptions = {}) {\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n\n /**\n * Returns a new Promise that is resolve when this.finish is called\n */\n public newPromise(): Promise {\n return new Promise((resolve, reject) => {\n /*\n Note that the `this` keyword is in an Array when it is resolved,\n this is due to Promises not wanting to resolve references,\n so, you can't resolve `this` directly, so, I chose to resolve `this` in an\n Array\n */\n this.on(\"complete\", () => resolve([this]));\n this.on(\"error\", err => reject(err));\n });\n }\n\n /**\n * Fulfills the this.promise Promise\n */\n public then(\n onFulfilled?: (value?: any) => any,\n onRejected?: (reason?: any) => any\n ): Animate {\n onFulfilled = onFulfilled?.bind(this);\n onRejected = onRejected?.bind(this);\n this.promise.then(onFulfilled, onRejected);\n return this;\n }\n\n /**\n * Catches error that occur in the this.promise Promise\n */\n public catch(onRejected: (reason?: any) => any): Animate {\n onRejected = onRejected?.bind(this);\n this.promise.catch(onRejected);\n return this;\n }\n\n /**\n * If you don't care if the this.promise Promise has either been rejected or resolved\n */\n public finally(onFinally: () => any): Animate {\n onFinally = onFinally?.bind(this);\n this.promise.finally(onFinally);\n return this;\n }\n\n /**\n * Represents an Animation Frame Loop\n */\n public loop(): void {\n this.stopLoop();\n this.emit(\"update\", this.getProgress(), this);\n this.animationFrame = window.requestAnimationFrame(this.loop);\n }\n\n /**\n * Cancels animation frame\n */\n public stopLoop() {\n window.cancelAnimationFrame(this.animationFrame);\n }\n\n /**\n * Calls a method that affects all animations including the mainAnimation; the method only allows the animation parameter\n */\n public all(method: (animation?: Animation, target?: HTMLElement) => void) {\n method(this.mainAnimation, this.mainElement);\n this.animations.forEach(method);\n return this;\n }\n\n /**\n * Register the begin event\n */\n protected beginEvent() {\n if (this.getProgress() == 0) {\n let timer: number | void = window.setTimeout(() => {\n this.emit(\"begin\", this);\n timer = window.clearTimeout(timer as number);\n }, this.minDelay);\n }\n }\n\n /**\n * Play Animation\n */\n public play(): Animate {\n let playstate = this.getPlayState();\n this.beginEvent();\n this.all(anim => anim.play());\n this.emit(\"play\", playstate, this);\n this.loop();\n return this;\n }\n\n /**\n * Pause Animation\n */\n public pause(): Animate {\n let playstate = this.getPlayState();\n this.all(anim => anim.pause());\n this.emit(\"pause\", playstate, this);\n this.stopLoop();\n this.animationFrame = undefined;\n return this;\n }\n\n /**\n * Reset all Animations\n */\n public reset() {\n this.setProgress(0);\n this.beginEvent();\n\n if (this.options.autoplay) this.play();\n else this.pause();\n return this;\n }\n\n /**\n * Cancels all Animations\n */\n public cancel() {\n this.all(anim => anim.cancel());\n this.stopLoop();\n return this;\n }\n\n /**\n * Force complete all Animations\n */\n public finish() {\n this.all(anim => anim.finish());\n this.stopLoop();\n return this;\n }\n\n /**\n * Cancels & Clears all Animations\n */\n public stop() {\n this.cancel();\n this.animations.clear();\n while (this.targets.length) this.targets.pop();\n this.mainElement = undefined;\n this.emit(\"stop\");\n }\n\n /**\n * Returns an Array of targets\n */\n public getTargets(): Node[] {\n return this.targets;\n }\n\n /**\n * Get a specific Animation from an Animate instance\n */\n public getAnimation(element: HTMLElement): Animation {\n return this.animations.get(element);\n }\n\n /**\n * Returns the timings of an Animation, given a target\n * E.g. { duration, endDelay, delay, iterations, iterationStart, direction, easing, fill, etc... }\n */\n public getTiming(target: HTMLElement | Animation): AnimationOptions & EffectTiming {\n let animation = target instanceof Animation ? target : this.getAnimation(target);\n let keyframeOptions = this.computedOptions.get(animation) ?? {};\n let timings = animation.effect?.getTiming() ?? {};\n let options = this.getOptions();\n\n return { ...DefaultAnimationOptions, ...options, ...timings, ...keyframeOptions };\n }\n\n /**\n * Returns the total duration of Animation\n */\n public getTotalDuration(): number {\n return this.totalDuration;\n }\n\n /**\n * Returns the current time of the Main Animation\n */\n public getCurrentTime(): number {\n return this.mainAnimation.currentTime;\n }\n\n /**\n * Returns the Animation progress as a fraction of the current time / duration * 100\n */\n public getProgress() {\n return (this.getCurrentTime() / this.totalDuration) * 100;\n }\n\n /**\n * Return the playback speed of the animation\n */\n public getSpeed(): number {\n return this.mainAnimation.playbackRate;\n }\n\n /**\n * Returns the current playing state\n */\n public getPlayState(): \"idle\" | \"running\" | \"paused\" | \"finished\" {\n return this.mainAnimation.playState;\n }\n\n /**\n * Get the options of an Animate instance\n */\n public getOptions(): AnimationOptions {\n return this.options;\n }\n\n /**\n * Set the current time of the Main Animation\n */\n public setCurrentTime(time: number): Animate {\n this.all(anim => { anim.currentTime = time; });\n this.emit(\"update\", this.getProgress());\n return this;\n }\n\n /**\n * Set the Animation progress as a value from 0 to 100\n */\n public setProgress(percent: number): Animate {\n let time = (percent / 100) * this.totalDuration;\n this.setCurrentTime(time);\n return this;\n }\n\n /**\n * Set the playback speed of an Animation\n */\n public setSpeed(speed: number = 1): Animate {\n this.all(anim => { anim.playbackRate = speed; });\n return this;\n }\n\n /**\n * Adds a listener for a given event\n */\n public on(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.on(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Removes a listener from an event\n */\n public off(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.off(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Call all listeners within an event\n */\n public emit(events: AnimationEvents | string | any[], ...args: any): Animate {\n this.emitter.emit(events, ...args);\n return this;\n }\n\n\n /** Returns the Animate options, as JSON */\n public toJSON(): AnimationOptions {\n return this.getOptions();\n }\n\n /**\n * The Symbol.toStringTag well-known symbol is a string valued property that is used\n * in the creation of the default string description of an object.\n * It is accessed internally by the Object.prototype.toString() method.\n */\n get [Symbol.toStringTag]() {\n return `Animate`;\n }\n}\n\n/** Creates a new Animate instance */\nexport const animate = (options: AnimationOptions = {}): Animate => {\n return new Animate(options);\n};\n\nexport class Timeline extends Animate {\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n constructor(options: AnimationOptions = {}) {\n super();\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n public add(options: AnimationOptions) {\n return this;\n }\n}\n\nexport default animate;"], + "mappings": "AAeO,GAAM,GAAkB,CAC3B,YAAa,UACb,eAAgB,eAChB,eAAgB,cAChB,QAAS,CACL,CAAC,YAAa,SAElB,gBAAiB,iBACjB,eAAgB,gBAChB,eAAgB,aAChB,UAAW,QACX,QAAS,IACT,SAAU,GAID,EAAY,AAAC,GACf,OAAO,OAAO,IAAK,GAAmB,GAIpC,GAAS,CAAC,EAAiB,EAAe,EAAoB,KAAiB,CACxF,GAAI,CAAE,UAAW,EACb,EAAO,O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GAAO,SAAY,EACxC,YACA,WACA,WACA,QACA,KAAM,KACH,GAMH,EAAe,EAAc,EAA0B,CAAC,EAAG,EAAK,GAAS,MAC7E,EAAoB,EAAa,OAAS,EACrC,KAAK,WAIV,EAAmB,EAAU,EAAkB,CAAC,EAAG,EAAK,GAAS,MAC3D,EAAa,OAAS,GACxB,GAAoB,EAAU,EAAmB,CAAC,EAAG,EAAK,GAAS,OAGvE,GAAI,GAAgB,EAAiB,MAChC,EAAiB,SAAW,EAAiB,WAC9C,EAAiB,SACrB,AAAI,KAAK,cAAgB,GAAe,MAAK,cAAgB,GAG7D,GAAI,GAAY,EAAO,QAAQ,EAAmB,GAGlD,EAAU,SAAW,IAAM,CACvB,MAAO,IAAY,YAAc,EAAS,KAAK,KAAM,EAAQ,EAAG,EAAK,GACrE,KAAK,KAAK,SAAU,EAAQ,EAAG,EAAK,IAIxC,KAAK,gBAAgB,IAAI,EAAW,GACpC,KAAK,WAAW,IAAI,EAAQ,GAC5B,EAAO,KAAK,EAAiB,OAGjC,KAAK,cAAgB,KAAK,YAAY,QAAQ,CAC1C,CAAE,QAAS,KACX,CAAE,QAAS,MACZ,CAEC,SAAU,KAAK,cACf,OAAQ,WAGZ,KAAK,SAAW,KAAK,IAAI,GAAG,GAC5B,KAAK,SAAS,GACd,AAAI,EAAU,KAAK,OACd,KAAK,QAEV,KAAK,QAAU,KAAK,aACpB,KAAK,cAAc,SAAW,IAAM,CAChC,KAAK,KAAK,WAAY,MACtB,KAAK,kBAEJ,EAAP,CACE,KAAK,KAAK,QAAS,IAGpB,IAAI,EAA2B,CAClC,MAAO", "names": [] } diff --git a/packages/native/lib/api.js b/packages/native/lib/api.js index 1636207..c2fc4ca 100644 --- a/packages/native/lib/api.js +++ b/packages/native/lib/api.js @@ -1,3 +1,3 @@ -var native=(()=>{var ht=Object.defineProperty;var mt=(r,t)=>{for(var e in t)ht(r,e,{get:t[e],enumerable:!0})};var yt={};mt(yt,{AdvancedManager:()=>w,Animate:()=>R,App:()=>et,CONFIG_DEFAULTS:()=>B,DefaultAnimationOptions:()=>G,Event:()=>v,EventEmitter:()=>T,HistoryManager:()=>J,Manager:()=>h,ManagerItem:()=>x,PARSER:()=>Q,PJAX:()=>it,Page:()=>N,PageManager:()=>Z,Router:()=>rt,Service:()=>g,ServiceManager:()=>H,TransitionManager:()=>tt,animate:()=>dt,asyncMethodCall:()=>Y,changeState:()=>X,clean:()=>U,computeValue:()=>j,easings:()=>st,equal:()=>S,getConfig:()=>u,getEase:()=>ot,getElements:()=>nt,getHash:()=>gt,getHashedPath:()=>b,getTargets:()=>F,hashAction:()=>D,mapObject:()=>V,methodCall:()=>A,newConfig:()=>_,newCoords:()=>d,newListener:()=>z,newState:()=>k,newURL:()=>c,toAttr:()=>W});var B={wrapperAttr:"wrapper",noAjaxLinkAttr:"no-ajax-link",noPrefetchAttr:"no-prefetch",headers:[["x-partial","true"]],preventSelfAttr:'prevent="self"',preventAllAttr:'prevent="all"',transitionAttr:"transition",blockAttr:"block",timeout:3e4},_=r=>Object.assign({...B},r),W=(r,t,e=!0)=>{let{prefix:i}=r,n=`data${i?"-"+i:""}-${t}`;return e?`[${n}]`:n},u=(r,t,e=!0)=>{if(typeof t!="string")return r;let i=r[t];return typeof i=="string"?W(r,i,e):i};var h=class{constructor(t){this.map=new Map(t)}getMap(){return this.map}get(t){return this.map.get(t)}keys(){return Array.from(this.map.keys())}values(){return Array.from(this.map.values())}set(t,e){return this.map.set(t,e),this}add(t){let i=this.size;return this.set(i,t),this}get size(){return this.map.size}get length(){return this.map.size}last(t=1){let e=this.keys()[this.size-t];return this.get(e)}delete(t){return this.map.delete(t)}remove(t){return this.map.delete(t),this}clear(){return this.map.clear(),this}has(t){return this.map.has(t)}entries(){return this.map.entries()}forEach(t,e){return this.map.forEach(t,e),this}[Symbol.iterator](){return this.entries()}},A=(r,t,...e)=>{r.forEach(i=>{i[t](...e)})},Y=async(r,t,...e)=>{for(let[,i]of r)await i[t](...e)};var x=class{constructor(){}install(){}register(t,e){return this.manager=t,this.app=t.app,this.config=t.config,this.emitter=t.emitter,this.key=e,this.install(),this}uninstall(){}unregister(){this.uninstall(),this.manager.remove(this.key),this.key=void 0,this.manager=void 0,this.app=void 0,this.config=void 0,this.emitter=void 0}},w=class extends h{constructor(t){super();this.app=t,this.config=t.config,this.emitter=t.emitter}set(t,e){return super.set(t,e),e.register(this,t),this}};var c=(r=window.location.href)=>r instanceof URL?r:new URL(r,window.location.origin),b=r=>`${r.pathname}${r.hash}`,gt=r=>r.hash.slice(1),U=r=>r.toString().replace(/(\/#.*|\/|#.*)$/,""),S=(r,t)=>{let e=c(r),i=c(t);return U(e)===U(i)};var g=class extends x{init(){}boot(){this.initEvents()}initEvents(){}stopEvents(){}stop(){this.stopEvents(),this.unregister()}},H=class extends w{constructor(t){super(t)}init(){return A(this,"init"),this}boot(){return A(this,"boot"),this}stop(){return A(this,"stop"),this}};var d=(r=window.scrollX,t=window.scrollY)=>({x:r,y:t}),k=(r={url:b(c()),index:0,transition:"default",data:{scroll:d(),trigger:"HistoryManager"}})=>r,J=class extends g{constructor(){super(...arguments);this.pointer=-1}init(){this.states=[];let t=k();this.add(t,"replace")}get(t){return this.states[t]}add(t,e="push"){let i=k(t),n=this.length;this.states.push({...i}),this.pointer=n;let s={index:this.pointer,states:[...this.states]};return X(e,i,s),this}remove(t){return t?this.states.splice(t,1):this.states.pop(),this.pointer--,this}replace(t){return this.states=t,this}set(t,e){return this.states[t]=e}get current(){return this.get(this.pointer)}get last(){return this.get(this.length-1)}get previous(){return this.pointer<1?null:this.get(this.pointer-1)}get length(){return this.states.length}},X=(r,t,e)=>{let i=b(c(t.url)),n=[e,"",i];if(window.history)switch(r){case"push":window.history.pushState.apply(window.history,n);break;case"replace":window.history.replaceState.apply(window.history,n);break}};var Q=new DOMParser,N=class extends x{constructor(t=c(),e=document){super();this.url=t,typeof e=="string"?this.data=e:this.dom=e||document}build(){if(this.dom instanceof Node||(this.dom=Q.parseFromString(this.data,"text/html")),!(this.body instanceof Node)){let{title:t,head:e,body:i}=this.dom;this.title=t,this.head=e,this.body=i,this.wrapper=this.body.querySelector(this.wrapperAttr)}}install(){this.wrapperAttr=u(this.config,"wrapperAttr")}uninstall(){this.url=void 0,this.title=void 0,this.head=void 0,this.body=void 0,this.dom=void 0,this.wrapper=void 0,this.data=void 0,this.wrapperAttr=void 0}},Z=class extends g{constructor(){super(...arguments);this.loading=new h}install(){this.pages=new w(this.app),this.maxPages=this.config.maxPages??5;let t=c().pathname;this.set(t,new N),t=void 0}get(t){return this.pages.get(t)}add(t){return this.pages.add(t),this}set(t,e){return this.pages.set(t,e),this}remove(t){return this.pages.remove(t),this}has(t){return this.pages.has(t)}clear(){return this.pages.clear(),this}get size(){return this.pages.size}keys(){return this.pages.keys()}async load(t=c()){let e=c(t),i=e.pathname,n,s;if(this.has(i))return n=this.get(i),Promise.resolve(n);this.loading.has(i)?s=this.loading.get(i):(s=this.request(i),this.loading.set(i,s));let a=await s;if(this.loading.remove(i),n=new N(e,a),this.set(i,n),this.size>this.maxPages){let l=c(),o=this.keys(),p=S(l,o[0])?o[1]:o[0],m=this.get(p);m.unregister(),m=void 0,o=void 0,l=void 0,p=void 0}return n}async request(t){let e=new Headers(u(this.config,"headers")),i=window.setTimeout(()=>{throw window.clearTimeout(i),"Request Timed Out!"},u(this.config,"timeout"));try{let n=await fetch(t,{mode:"same-origin",method:"GET",headers:e,cache:"default",credentials:"same-origin"});if(window.clearTimeout(i),n.status>=200&&n.status<300)return await n.text();throw new Error(n.statusText||""+n.status)}catch(n){throw window.clearTimeout(i),n}}};var z=({callback:r=()=>{},scope:t=null,name:e="event"})=>({callback:r,scope:t,name:e}),v=class extends h{constructor(t="event"){super();this.name=t}},T=class extends h{constructor(){super()}getEvent(t){let e=this.get(t);return e instanceof v?e:(this.set(t,new v(t)),this.get(t))}newListener(t,e,i){let n=this.getEvent(t);return n.add(z({name:t,callback:e,scope:i})),n}on(t,e,i){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let n,s,a=typeof t=="object"&&!Array.isArray(t),l=a?e:i;return a||(s=e),Object.keys(t).forEach(o=>{a?(n=o,s=t[o]):n=t[o],this.newListener(n,s,l)},this),this}removeListener(t,e,i){let n=this.get(t);if(n instanceof v&&e){let s=z({name:t,callback:e,scope:i});n.forEach((a,l)=>{if(a.callback===s.callback&&a.scope===s.scope)return n.remove(l)})}return n}off(t,e,i){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let n,s,a=typeof t=="object"&&!Array.isArray(t),l=a?e:i;return a||(s=e),Object.keys(t).forEach(o=>{a?(n=o,s=t[o]):n=t[o],typeof s=="function"?this.removeListener(n,s,l):this.remove(n)},this),this}emit(t,...e){return typeof t=="undefined"?this:(typeof t=="string"&&(t=t.trim().split(/\s/g)),t.forEach(i=>{let n=this.get(i);n instanceof v&&n.forEach(s=>{let{callback:a,scope:l}=s;a.apply(l,e)})},this),this)}clear(){return A(this,"clear"),super.clear(),this}};var D=(r,t=window.location.hash)=>{try{let e=t[0]=="#"?t:c(t).hash;if(e.length>1){let i=document.getElementById(e.slice(1));if(i)return d(i.offsetLeft,i.offsetTop)}}catch(e){console.warn("[hashAction] error",e)}return r??d(0,0)},bt={name:"default",scrollable:!0,out({done:r}){r()},in({scroll:r,done:t}){window.scroll(r.x,r.y),t()}},tt=class extends g{constructor(t){super();this._arg=t}install(){super.install();let t=this._arg&&this._arg.length?this._arg:u(this.config,"transitions")??[];t=[["default",bt]].concat(t),this.transitions=new h(t)}get(t){return this.transitions.get(t)}set(t,e){return this.transitions.set(t,e),this}add(t){return this.transitions.add(t),this}has(t){return this.transitions.has(t)}async animate(t,e){let i=this.transitions.get(t),n=e.scroll,s=e.ignoreHashAction;if(!("wrapper"in e.oldPage)||!("wrapper"in e.newPage))throw`[Page] either oldPage or newPage aren't instances of the Page Class. - ${{newPage:e.newPage,oldPage:e.oldPage}}`;document.title=""+e.newPage.title;let a=e.oldPage.wrapper,l=e.newPage.wrapper;if(!(a instanceof Node)||!(l instanceof Node))throw`[Wrapper] the wrapper from the ${l instanceof Node?"current":"next"} page cannot be found. The wrapper must be an element that has the attribute ${u(this.config,"wrapperAttr")}.`;return i.init&&i?.init(e),this.emitter.emit("BEFORE_TRANSITION_OUT"),i.out&&await new Promise(o=>{i.out.call(i,{...e,from:e.oldPage,trigger:e.trigger,done:o})?.then(o)}),this.emitter.emit("AFTER_TRANSITION_OUT"),await new Promise(o=>{a.insertAdjacentElement("beforebegin",l),this.emitter.emit("CONTENT_INSERT"),!s&&!/back|popstate|forward/.test(e.trigger)&&(n=D(n)),o()}),await new Promise(o=>{a.remove(),a=void 0,l=void 0,this.emitter.emit("CONTENT_REPLACED"),o()}),this.emitter.emit("BEFORE_TRANSITION_IN"),i.in&&await new Promise(async o=>{i.in.call(i,{...e,from:e.oldPage,to:e.newPage,trigger:e.trigger,scroll:n,done:o})?.then(o)}),this.emitter.emit("AFTER_TRANSITION_IN"),i}};var et=class{constructor(t={}){this.register(t)}register(t={}){this.config=_(t),this.emitter=new T,this.services=new H(this);let e=(()=>{document.removeEventListener("DOMContentLoaded",e),window.removeEventListener("load",e),this.emitter.emit("READY ready")}).bind(this);return document.addEventListener("DOMContentLoaded",e),window.addEventListener("load",e),this}get(t){return this.services.get(t)}set(t,e){return this.services.set(t,e),this}add(t){return this.services.add(t),this}boot(){return this.services.init(),this.services.boot(),this}stop(){return this.services.stop(),this.emitter.clear(),this}on(t,e){return this.emitter.on(t,e,this),this}off(t,e){return this.emitter.off(t,e,this),this}emit(t,...e){return this.emitter.emit(t,...e),this}};var it=class extends g{install(){super.install(),this.ignoreURLs=u(this.config,"ignoreURLs")??[],this.prefetchIgnore=u(this.config,"prefetchIgnore")??!1,this.stopOnTransitioning=u(this.config,"stopOnTransitioning")??!1,this.stickyScroll=u(this.config,"stickyScroll")??!1,this.forceOnError=u(this.config,"forceOnError")??!1,this.ignoreHashAction=u(this.config,"ignoreHashAction")??!1}transitionStart(){this.isTransitioning=!0}transitionStop(){this.isTransitioning=!1}init(){this.onHover=this.onHover.bind(this),this.onClick=this.onClick.bind(this),this.onStateChange=this.onStateChange.bind(this)}boot(){"scrollRestoration"in window.history&&(window.history.scrollRestoration="manual"),super.boot()}getTransitionName(t){if(!t||!t.getAttribute)return null;let e=t.getAttribute(u(this.config,"transitionAttr",!1));return typeof e=="string"?e:null}validLink(t,e,i){let n=!window.history.pushState,s=!t||!i,a=e.metaKey||e.ctrlKey||e.shiftKey||e.altKey,l=t.hasAttribute("target")&&t.target==="_blank",o=t.protocol!==location.protocol||t.hostname!==location.hostname,p=typeof t.getAttribute("download")=="string",m=t.matches(u(this.config,"preventSelfAttr")),O=Boolean(t.closest(u(this.config,"preventAllAttr"))),L=b(c())===b(c(i));return!(s||n||a||l||o||p||m||O||L)}getHref(t){return t&&t.tagName&&t.tagName.toLowerCase()==="a"&&typeof t.href=="string"?t.href:null}getLink(t){let e=t.target,i=this.getHref(e);for(;e&&!i;)e=e.parentNode,i=this.getHref(e);if(!(!e||!this.validLink(e,t,i)))return e}onClick(t){let e=this.getLink(t);if(!e)return;if(this.isTransitioning&&this.stopOnTransitioning){t.preventDefault(),t.stopPropagation();return}let i=this.getHref(e);this.emitter.emit("ANCHOR_CLICK CLICK",t),this.go({href:i,trigger:e,event:t})}getDirection(t){return Math.abs(t)>1?t>0?"forward":"back":t===0?"popstate":t>0?"back":"forward"}force(t){window.location.assign(t)}go({href:t,trigger:e="HistoryManager",event:i}){if(this.isTransitioning&&this.stopOnTransitioning||!(this.manager.has("TransitionManager")&&this.manager.has("HistoryManager")&&this.manager.has("PageManager"))){this.force(t);return}let n=this.manager.get("HistoryManager"),s=d(0,0),a=n.current,l=a.url;if(S(l,t))return;let o;if(i&&i.state){this.emitter.emit("POPSTATE",i);let{state:p}=i,{index:m}=p,L=a.index-m,M=n.get(n.pointer);o=M.transition,s=M.data.scroll,n.replace(p.states),n.pointer=m,e=this.getDirection(L),this.emitter.emit(e==="back"?"POPSTATE_BACK":"POPSTATE_FORWARD",i)}else{o=this.getTransitionName(e),s=d();let p=k({url:t,transition:o,data:{scroll:s}});!this.stickyScroll&&(s=d(0,0)),n.add(p),this.emitter.emit("HISTORY_NEW_ITEM",i)}return i&&(i.stopPropagation(),i.preventDefault()),this.emitter.emit("GO",i),this.load({oldHref:l,href:t,trigger:e,transitionName:o,scroll:s})}async load({oldHref:t,href:e,trigger:i,transitionName:n="default",scroll:s={x:0,y:0}}){try{let a=this.manager.get("PageManager"),l,o;this.emitter.emit("NAVIGATION_START",{oldHref:t,href:e,trigger:i,transitionName:n});try{this.transitionStart(),o=await a.load(t),!(o.dom instanceof Element)&&o.build(),this.emitter.emit("PAGE_LOADING",{href:e,oldPage:o,trigger:i}),l=await a.load(e),await l.build(),this.emitter.emit("PAGE_LOAD_COMPLETE",{newPage:l,oldPage:o,trigger:i})}catch(p){throw`[PJAX] page load error: ${p}`}try{let p=this.manager.get("TransitionManager");this.emitter.emit("TRANSITION_START",n);let m=await p.animate(p.has(n)?n:"default",{oldPage:o,newPage:l,trigger:i,scroll:s,ignoreHashAction:this.ignoreHashAction});m.scrollable||(!this.ignoreHashAction&&!/back|popstate|forward/.test(i)&&(s=D(s)),window.scroll(s.x,s.y)),this.emitter.emit("TRANSITION_END",{transition:m})}catch(p){throw`[PJAX] transition error: ${p}`}this.emitter.emit("NAVIGATION_END",{oldPage:o,newPage:l,trigger:i,transitionName:n})}catch(a){this.forceOnError?this.force(e):console.warn(a)}finally{this.transitionStop()}}ignoredURL({pathname:t}){return this.ignoreURLs.length&&this.ignoreURLs.some(e=>typeof e=="string"?e===t:e.exec(t)!==null)}onHover(t){let e=this.getLink(t);if(!e||!this.manager.has("PageManager"))return;let i=this.manager.get("PageManager"),n=c(this.getHref(e)),s=n.pathname;if(!(this.ignoredURL(n)||i.has(s))){this.emitter.emit("ANCHOR_HOVER HOVER",t);try{i.load(n)}catch(a){console.warn("[PJAX] prefetch error,",a)}}}onStateChange(t){this.go({href:window.location.href,trigger:"popstate",event:t})}initEvents(){this.prefetchIgnore!==!0&&(document.addEventListener("mouseover",this.onHover),document.addEventListener("touchstart",this.onHover)),document.addEventListener("click",this.onClick),window.addEventListener("popstate",this.onStateChange)}stopEvents(){this.prefetchIgnore!==!0&&(document.removeEventListener("mouseover",this.onHover),document.removeEventListener("touchstart",this.onHover)),document.removeEventListener("click",this.onClick),window.removeEventListener("popstate",this.onStateChange)}};var rt=class extends g{constructor(t=[]){super();this.routes=new h;for(let e of t)this.add(e)}add({path:t,method:e}){let i=this.parse(t);return this.routes.set(i,e),this}parsePath(t){if(typeof t=="string")return new RegExp(t,"i");if(t instanceof RegExp||typeof t=="boolean")return t;throw"[Router] only regular expressions, strings and booleans are accepted as paths."}isPath(t){return typeof t=="string"||t instanceof RegExp||typeof t=="boolean"}parse(t){let e=t,i={from:/(.*)/g,to:/(.*)/g};if(this.isPath(t))i={from:!0,to:t};else if(this.isPath(e.from)&&this.isPath(e.to))i=e;else throw"[Router] path is neither a string, regular expression, or a { from, to } object.";let{from:n,to:s}=i;return{from:this.parsePath(n),to:this.parsePath(s)}}route(){if(this.manager.has("HistoryManager")){let t=this.manager.get("HistoryManager"),e=b(c((t.length>1?t.previous:t.current).url)),i=b(c());this.routes.forEach((n,s)=>{let a=s.from,l=s.to;if(typeof a=="boolean"&&typeof l=="boolean")throw`[Router] path ({ from: ${a}, to: ${l} }) is not valid, remember paths can only be strings, regular expressions, or a boolean; however, both the from and to paths cannot be both booleans.`;let o=a,p=l;a instanceof RegExp&&a.test(e)&&(o=a.exec(e)),l instanceof RegExp&&l.test(i)&&(p=l.exec(i)),(Array.isArray(p)&&Array.isArray(o)||Array.isArray(p)&&typeof o=="boolean"&&o||Array.isArray(o)&&typeof p=="boolean"&&p)&&n({from:o,to:p,path:{from:e,to:i}})})}else console.warn("[Route] HistoryManager is missing.")}initEvents(){this.emitter.on("READY",this.route,this),this.emitter.on("CONTENT_REPLACED",this.route,this)}stopEvents(){this.emitter.off("READY",this.route,this),this.emitter.off("CONTENT_REPLACED",this.route,this)}};var nt=r=>typeof r=="string"?Array.from(document.querySelectorAll(r)):[r],ft=r=>[].concat(...r),F=r=>Array.isArray(r)?ft(r.map(F)):typeof r=="string"||r instanceof Node?nt(r):r instanceof NodeList||r instanceof HTMLCollection?Array.from(r):[],j=(r,t,e)=>typeof r=="function"?r.apply(e,t):r,V=(r,t,e)=>{let i,n,s={},a=Object.keys(r);for(let l=0,o=a.length;l/^(in|out)/.test(r)?st[r]:r,G={keyframes:[],loop:1,delay:0,speed:1,endDelay:0,easing:"ease",autoplay:!0,duration:1e3,fillMode:"auto",direction:"normal",extend:{}},R=class{constructor(t={}){this.options={};this.targets=[];this.properties={};this.animations=new h;this.totalDuration=0;this.minDelay=0;this.computedOptions=new h;this.emitter=new T;try{let{options:e,...i}=t,n=e instanceof R?e.getOptions():Array.isArray(e)?e?.[0]?.getOptions():e;this.options=Object.assign({},G,n,i),this.loop=this.loop.bind(this);let{loop:s,delay:a,speed:l,easing:o,endDelay:p,duration:m,direction:O,fillMode:L,onfinish:M,target:at,keyframes:lt,autoplay:pt,extend:ct,...ut}=this.options;this.mainElement=document.createElement("div"),this.targets=F(at),this.properties=ut;let q=[],I=this.targets.length,C;for(let y=0;y0||(C=V(C,[y,I,E],this));let $=f.delay+f.duration*f.iterations+f.endDelay;this.totalDuration<$&&(this.totalDuration=$);let P=E.animate(C,f);P.onfinish=()=>{typeof M=="function"&&M.call(this,E,y,I,P),this.emit("finish",E,y,I,P)},this.computedOptions.set(P,f),this.animations.set(E,P),q.push(f.delay)}this.mainAnimation=this.mainElement.animate([{opacity:"0"},{opacity:"1"}],{duration:this.totalDuration,easing:"linear"}),this.minDelay=Math.min(...q),this.setSpeed(l),pt?this.play():this.pause(),this.promise=this.newPromise(),this.mainAnimation.onfinish=()=>{this.emit("complete",this),this.stopLoop()}}catch(e){this.emit("error",e)}}newPromise(){return new Promise((t,e)=>{this.on("complete",()=>t([this])),this.on("error",i=>e(i))})}then(t,e){return t=t?.bind(this),e=e?.bind(this),this.promise.then(t,e),this}catch(t){return t=t?.bind(this),this.promise.catch(t),this}finally(t){return t=t?.bind(this),this.promise.finally(t),this}loop(){this.stopLoop(),this.emit("update",this.getProgress(),this),this.animationFrame=window.requestAnimationFrame(this.loop)}stopLoop(){window.cancelAnimationFrame(this.animationFrame)}all(t){return t(this.mainAnimation),this.animations.forEach(e=>t(e)),this}beginEvent(){if(this.getProgress()==0){let t=window.setTimeout(()=>{this.emit("begin",this),t=window.clearTimeout(t)},this.minDelay)}}play(){let t=this.getPlayState();return this.beginEvent(),this.all(e=>e.play()),this.emit("play",t,this),this.loop(),this}pause(){let t=this.getPlayState();return this.all(e=>e.pause()),this.emit("pause",t,this),this.stopLoop(),this.animationFrame=void 0,this}reset(){return this.setProgress(0),this.beginEvent(),this.options.autoplay?this.play():this.pause(),this}cancel(){return this.all(t=>t.cancel()),this.stopLoop(),this}finish(){return this.all(t=>t.finish()),this.stopLoop(),this}stop(){for(this.cancel(),this.animations.clear();this.targets.length;)this.targets.pop();this.mainElement=void 0,this.emit("stop")}getTargets(){return this.targets}getAnimation(t){return this.animations.get(t)}getTiming(t){let e=t instanceof Animation?t:this.getAnimation(t),i=this.computedOptions.get(e)??{},n=e.effect?.getTiming()??{},s=this.getOptions();return{...G,...s,...n,...i}}getTotalDuration(){return this.totalDuration}getCurrentTime(){return this.mainAnimation.currentTime}getProgress(){return this.getCurrentTime()/this.totalDuration*100}getSpeed(){return this.mainAnimation.playbackRate}getPlayState(){return this.mainAnimation.playState}getOptions(){return this.options}setCurrentTime(t){return this.all(e=>{e.currentTime=t}),this.emit("update",this.getProgress()),this}setProgress(t){let e=t/100*this.totalDuration;return this.setCurrentTime(e),this}setSpeed(t=1){return this.all(e=>{e.playbackRate=t}),this}on(t,e,i){return this.emitter.on(t,e,i??this),this}off(t,e,i){return this.emitter.off(t,e,i??this),this}emit(t,...e){return this.emitter.emit(t,...e),this}toJSON(){return this.getOptions()}get[Symbol.toStringTag](){return"Animate"}},dt=(r={})=>new R(r);return yt;})(); +var native=(()=>{var mt=Object.defineProperty;var gt=(r,t)=>{for(var e in t)mt(r,e,{get:t[e],enumerable:!0})};var At={};gt(At,{AdvancedManager:()=>k,Animate:()=>M,App:()=>at,CONFIG_DEFAULTS:()=>Z,DefaultAnimationOptions:()=>V,Event:()=>R,EventEmitter:()=>O,HistoryManager:()=>it,Manager:()=>g,ManagerItem:()=>S,PARSER:()=>nt,PJAX:()=>lt,Page:()=>U,PageManager:()=>st,Router:()=>pt,Service:()=>y,ServiceManager:()=>_,Timeline:()=>ht,TransitionManager:()=>ot,animate:()=>yt,asyncMethodCall:()=>et,changeState:()=>rt,clean:()=>X,computeValue:()=>j,easings:()=>ut,equal:()=>N,getConfig:()=>h,getEase:()=>Q,getElements:()=>ct,getHash:()=>ft,getHashedPath:()=>E,getTargets:()=>F,hashAction:()=>z,mapObject:()=>K,methodCall:()=>v,newConfig:()=>W,newCoords:()=>w,newListener:()=>J,newState:()=>D,newURL:()=>c,toAttr:()=>tt});var Z={wrapperAttr:"wrapper",noAjaxLinkAttr:"no-ajax-link",noPrefetchAttr:"no-prefetch",headers:[["x-partial","true"]],preventSelfAttr:'prevent="self"',preventAllAttr:'prevent="all"',transitionAttr:"transition",blockAttr:"block",timeout:3e4,maxPages:5},W=r=>Object.assign({...Z},r),tt=(r,t,e=!0)=>{let{prefix:i}=r,n=`data${i?"-"+i:""}-${t}`;return e?`[${n}]`:n},h=(r,t,e=!0)=>{if(typeof t!="string")return r;let i=r[t];return typeof i=="string"?tt(r,i,e):i};var g=class{constructor(t){this.map=new Map(t)}getMap(){return this.map}get(t){return this.map.get(t)}keys(){return Array.from(this.map.keys())}values(){return Array.from(this.map.values())}set(t,e){return this.map.set(t,e),this}add(t){let i=this.size;return this.set(i,t),this}get size(){return this.map.size}get length(){return this.map.size}last(t=1){let e=this.keys()[this.size-t];return this.get(e)}delete(t){return this.map.delete(t)}remove(t){return this.map.delete(t),this}clear(){return this.map.clear(),this}has(t){return this.map.has(t)}entries(){return this.map.entries()}forEach(t,e){return this.map.forEach(t,e),this}[Symbol.iterator](){return this.entries()}},v=(r,t,...e)=>{r.forEach(i=>{i[t](...e)})},et=async(r,t,...e)=>{for(let[,i]of r)await i[t](...e)};var S=class{constructor(){}install(){}register(t,e){return this.manager=t,this.app=t.app,this.config=t.config,this.emitter=t.emitter,this.key=e,this.install(),this}uninstall(){}unregister(){this.uninstall(),this.manager.remove(this.key),this.key=void 0,this.manager=void 0,this.app=void 0,this.config=void 0,this.emitter=void 0}},k=class extends g{constructor(t){super();this.app=t,this.config=t.config,this.emitter=t.emitter}set(t,e){return super.set(t,e),e.register(this,t),this}};var c=(r=window.location.href)=>r instanceof URL?r:new URL(r,window.location.origin),E=r=>{let t=c(r);return`${t.pathname}${t.hash}`},ft=r=>c(r).hash.slice(1),X=r=>c(r).toString().replace(/(\/#.*|\/|#.*)$/,""),N=(r,t)=>X(r)===X(t);var y=class extends S{init(){}boot(){this.initEvents()}initEvents(){}stopEvents(){}stop(){this.stopEvents(),this.unregister()}},_=class extends k{constructor(t){super(t)}init(){return v(this,"init"),this}boot(){return v(this,"boot"),this}stop(){return v(this,"stop"),this}};var w=(r=window.scrollX,t=window.scrollY)=>({x:r,y:t}),D=(r={url:E(c()),index:0,transition:"default",data:{scroll:w(),trigger:"HistoryManager"}})=>r,it=class extends y{constructor(){super(...arguments);this.pointer=-1}init(){this.states=[];let t=D();this.add(t,"replace")}get(t){return this.states[t]}add(t,e="push"){let i=D(t),n=this.length;this.states.push({...i}),this.pointer=n;let s={index:this.pointer,states:[...this.states]};return rt(e,i,s),this}remove(t){return t?this.states.splice(t,1):this.states.pop(),this.pointer--,this}replace(t){return this.states=t,this}set(t,e){return this.states[t]=e}get current(){return this.get(this.pointer)}get last(){return this.get(this.length-1)}get previous(){return this.pointer<1?null:this.get(this.pointer-1)}get length(){return this.states.length}},rt=(r,t,e)=>{let i=E(t.url),n=[e,"",i];if(window.history)switch(r){case"push":window.history.pushState.apply(window.history,n);break;case"replace":window.history.replaceState.apply(window.history,n);break}};var nt=new DOMParser,U=class extends S{constructor(t=c(),e=document){super();this.url=t,typeof e=="string"?this.data=e:this.dom=e||document}build(){if(this.dom instanceof Node||(this.dom=nt.parseFromString(this.data,"text/html")),!(this.body instanceof Node)){let{title:t,head:e,body:i}=this.dom;this.title=t,this.head=e,this.body=i,this.wrapper=this.body.querySelector(this.wrapperAttr)}}install(){this.wrapperAttr=h(this.config,"wrapperAttr")}uninstall(){this.url=void 0,this.title=void 0,this.head=void 0,this.body=void 0,this.dom=void 0,this.wrapper=void 0,this.data=void 0,this.wrapperAttr=void 0}},st=class extends y{constructor(){super(...arguments);this.loading=new g}install(){this.pages=new k(this.app);let t=c().pathname;this.set(t,new U),t=void 0}get(t){return this.pages.get(t)}add(t){return this.pages.add(t),this}set(t,e){return this.pages.set(t,e),this}remove(t){return this.pages.remove(t),this}has(t){return this.pages.has(t)}clear(){return this.pages.clear(),this}get size(){return this.pages.size}keys(){return this.pages.keys()}async load(t=c()){let e=c(t),i=e.pathname,n,s;if(this.has(i))return n=this.get(i),Promise.resolve(n);this.loading.has(i)?s=this.loading.get(i):(s=this.request(i),this.loading.set(i,s));let a=await s;if(this.loading.remove(i),n=new U(e,a),this.set(i,n),this.size>h(this.config,"maxPages")){let l=c(),o=this.keys(),p=N(l,o[0])?o[1]:o[0],f=this.get(p);f.unregister(),f=void 0,o=void 0,l=void 0,p=void 0}return n}async request(t){let e=new Headers(h(this.config,"headers")),i=window.setTimeout(()=>{throw window.clearTimeout(i),"Request Timed Out!"},h(this.config,"timeout"));try{let n=await fetch(t,{mode:"same-origin",method:"GET",headers:e,cache:"default",credentials:"same-origin"});if(window.clearTimeout(i),n.status>=200&&n.status<300)return await n.text();throw new Error(n.statusText||""+n.status)}catch(n){throw window.clearTimeout(i),n}}};var J=({callback:r=()=>{},scope:t=null,name:e="event"})=>({callback:r,scope:t,name:e}),R=class extends g{constructor(t="event"){super();this.name=t}},O=class extends g{constructor(){super()}getEvent(t){let e=this.get(t);return e instanceof R?e:(this.set(t,new R(t)),this.get(t))}newListener(t,e,i){let n=this.getEvent(t);return n.add(J({name:t,callback:e,scope:i})),n}on(t,e,i){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let n,s,a=typeof t=="object"&&!Array.isArray(t),l=a?e:i;return a||(s=e),Object.keys(t).forEach(o=>{a?(n=o,s=t[o]):n=t[o],this.newListener(n,s,l)},this),this}removeListener(t,e,i){let n=this.get(t);if(n instanceof R&&e){let s=J({name:t,callback:e,scope:i});n.forEach((a,l)=>{if(a.callback===s.callback&&a.scope===s.scope)return n.remove(l)})}return n}off(t,e,i){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let n,s,a=typeof t=="object"&&!Array.isArray(t),l=a?e:i;return a||(s=e),Object.keys(t).forEach(o=>{a?(n=o,s=t[o]):n=t[o],typeof s=="function"?this.removeListener(n,s,l):this.remove(n)},this),this}emit(t,...e){return typeof t=="undefined"?this:(typeof t=="string"&&(t=t.trim().split(/\s/g)),t.forEach(i=>{let n=this.get(i);n instanceof R&&n.forEach(s=>{let{callback:a,scope:l}=s;a.apply(l,e)})},this),this)}clear(){return v(this,"clear"),super.clear(),this}};var z=(r,t=window.location.hash)=>{try{let e=t[0]=="#"?t:c(t).hash;if(e.length>1){let i=document.getElementById(e.slice(1));if(i){let{left:n,top:s}=i.getBoundingClientRect(),a=window.pageXOffset,l=window.pageYOffset,o=n+a,p=s+l;return console.log(o,p),w(o,p)}}}catch(e){console.warn("[hashAction] error",e)}return r??w(0,0)},bt={name:"default",scrollable:!0,out({done:r}){r()},in({scroll:r,done:t}){window.scroll(r.x,r.y),t()}},ot=class extends y{constructor(t){super();this._arg=t}install(){super.install();let t=this._arg&&this._arg.length?this._arg:h(this.config,"transitions")??[];t=[["default",bt]].concat(t),this.transitions=new g(t)}get(t){return this.transitions.get(t)}set(t,e){return this.transitions.set(t,e),this}add(t){return this.transitions.add(t),this}has(t){return this.transitions.has(t)}async animate(t,e){let i=this.transitions.get(t),n=e.scroll,s=e.ignoreHashAction;if(!("wrapper"in e.oldPage)||!("wrapper"in e.newPage))throw`[Page] either oldPage or newPage aren't instances of the Page Class. + ${{newPage:e.newPage,oldPage:e.oldPage}}`;document.title=""+e.newPage.title;let a=e.oldPage.wrapper,l=e.newPage.wrapper;if(!(a instanceof Node)||!(l instanceof Node))throw`[Wrapper] the wrapper from the ${l instanceof Node?"current":"next"} page cannot be found. The wrapper must be an element that has the attribute ${h(this.config,"wrapperAttr")}.`;return i.init&&i?.init(e),this.emitter.emit("BEFORE_TRANSITION_OUT"),i.out&&await new Promise(o=>{i.out.call(i,{...e,from:e.oldPage,trigger:e.trigger,done:o})?.then(o)}),this.emitter.emit("AFTER_TRANSITION_OUT"),await new Promise(o=>{a.insertAdjacentElement("beforebegin",l),this.emitter.emit("CONTENT_INSERT"),!s&&!/back|popstate|forward/.test(e.trigger)&&(n=z(n)),o()}),await new Promise(o=>{a.remove(),a=void 0,l=void 0,this.emitter.emit("CONTENT_REPLACED"),o()}),this.emitter.emit("BEFORE_TRANSITION_IN"),i.in&&await new Promise(async o=>{i.in.call(i,{...e,from:e.oldPage,to:e.newPage,trigger:e.trigger,scroll:n,done:o})?.then(o)}),this.emitter.emit("AFTER_TRANSITION_IN"),i}};var at=class{constructor(t={}){this.register(t)}register(t={}){this.config=W(t),this.emitter=new O,this.services=new _(this);let e=(()=>{document.removeEventListener("DOMContentLoaded",e),window.removeEventListener("load",e),this.emitter.emit("READY ready")}).bind(this);return document.addEventListener("DOMContentLoaded",e),window.addEventListener("load",e),this}get(t){return this.services.get(t)}set(t,e){return this.services.set(t,e),this}add(t){return this.services.add(t),this}boot(){return this.services.init(),this.services.boot(),this}stop(){return this.services.stop(),this.emitter.clear(),this}on(t,e){return this.emitter.on(t,e,this),this}off(t,e){return this.emitter.off(t,e,this),this}emit(t,...e){return this.emitter.emit(t,...e),this}};var lt=class extends y{install(){super.install(),this.ignoreURLs=h(this.config,"ignoreURLs")??[],this.prefetchIgnore=h(this.config,"prefetchIgnore")??!1,this.stopOnTransitioning=h(this.config,"stopOnTransitioning")??!1,this.stickyScroll=h(this.config,"stickyScroll")??!1,this.forceOnError=h(this.config,"forceOnError")??!1,this.ignoreHashAction=h(this.config,"ignoreHashAction")??!1}transitionStart(){this.isTransitioning=!0}transitionStop(){this.isTransitioning=!1}init(){this.onHover=this.onHover.bind(this),this.onClick=this.onClick.bind(this),this.onStateChange=this.onStateChange.bind(this)}boot(){"scrollRestoration"in window.history&&(window.history.scrollRestoration="manual"),super.boot()}getTransitionName(t){if(!t||!t.getAttribute)return null;let e=t.getAttribute(h(this.config,"transitionAttr",!1));return typeof e=="string"?e:null}validLink(t,e,i){let n=!window.history.pushState,s=!t||!i,a=e.metaKey||e.ctrlKey||e.shiftKey||e.altKey,l=t.hasAttribute("target")&&t.target==="_blank",o=t.protocol!==location.protocol||t.hostname!==location.hostname,p=typeof t.getAttribute("download")=="string",f=t.matches(h(this.config,"preventSelfAttr")),P=Boolean(t.closest(h(this.config,"preventAllAttr"))),T=E(c())===E(c(i));return!(s||n||a||l||o||p||f||P||T)}getHref(t){return t&&t.tagName&&t.tagName.toLowerCase()==="a"&&typeof t.href=="string"?t.href:null}getLink(t){let e=t.target,i=this.getHref(e);for(;e&&!i;)e=e.parentNode,i=this.getHref(e);if(!(!e||!this.validLink(e,t,i)))return e}onClick(t){let e=this.getLink(t);if(!e)return;if(this.isTransitioning&&this.stopOnTransitioning){t.preventDefault(),t.stopPropagation();return}let i=this.getHref(e);this.emitter.emit("ANCHOR_CLICK CLICK",t),this.go({href:i,trigger:e,event:t})}getDirection(t){return Math.abs(t)>1?t>0?"forward":"back":t===0?"popstate":t>0?"back":"forward"}force(t){window.location.assign(t)}go({href:t,trigger:e="HistoryManager",event:i}){if(this.isTransitioning&&this.stopOnTransitioning||!(this.manager.has("TransitionManager")&&this.manager.has("HistoryManager")&&this.manager.has("PageManager"))){this.force(t);return}let n=this.manager.get("HistoryManager"),s=w(0,0),a=n.current,l=a.url;if(N(l,t))return;let o;if(i&&i.state){this.emitter.emit("POPSTATE",i);let{state:p}=i,{index:f}=p,T=a.index-f;n.replace(p.states),n.pointer=f;let x=n.get(f);o=x.transition,s=x.data.scroll,e=this.getDirection(T),console.log(e=="forward"&&n),this.emitter.emit(e==="back"?"POPSTATE_BACK":"POPSTATE_FORWARD",i)}else{o=this.getTransitionName(e),s=w();let p=D({url:t,transition:o,data:{scroll:s}});!this.stickyScroll&&(s=w(0,0)),n.add(p),this.emitter.emit("HISTORY_NEW_ITEM",i)}return i&&(i.stopPropagation(),i.preventDefault()),this.emitter.emit("GO",i),this.load({oldHref:l,href:t,trigger:e,transitionName:o,scroll:s})}async load({oldHref:t,href:e,trigger:i,transitionName:n="default",scroll:s={x:0,y:0}}){try{let a=this.manager.get("PageManager"),l,o;this.emitter.emit("NAVIGATION_START",{oldHref:t,href:e,trigger:i,transitionName:n});try{this.transitionStart(),o=await a.load(t),!(o.dom instanceof Element)&&o.build(),this.emitter.emit("PAGE_LOADING",{href:e,oldPage:o,trigger:i}),l=await a.load(e),await l.build(),this.emitter.emit("PAGE_LOAD_COMPLETE",{newPage:l,oldPage:o,trigger:i})}catch(p){console.warn(`[PJAX] Page load error: ${p}`)}try{let p=this.manager.get("TransitionManager");this.emitter.emit("TRANSITION_START",n);let f=await p.animate(p.has(n)?n:"default",{oldPage:o,newPage:l,trigger:i,scroll:s,ignoreHashAction:this.ignoreHashAction});f.scrollable||(!this.ignoreHashAction&&!/back|popstate|forward/.test(i)&&(s=z(s)),window.scroll(s.x,s.y)),this.emitter.emit("TRANSITION_END",{transition:f})}catch(p){console.warn(`[PJAX] Transition error: ${p}`)}this.emitter.emit("NAVIGATION_END",{oldPage:o,newPage:l,trigger:i,transitionName:n})}catch(a){this.forceOnError?this.force(e):console.warn(a)}finally{this.transitionStop()}}ignoredURL({pathname:t}){return this.ignoreURLs.length&&this.ignoreURLs.some(e=>typeof e=="string"?e===t:e.exec(t)!==null)}onHover(t){let e=this.getLink(t);if(!e||!this.manager.has("PageManager"))return;let i=this.manager.get("PageManager"),n=c(this.getHref(e)),s=n.pathname;if(!(this.ignoredURL(n)||i.has(s))){this.emitter.emit("ANCHOR_HOVER HOVER",t);try{i.load(n)}catch(a){console.warn("[PJAX] prefetch error,",a)}}}onStateChange(t){this.go({href:window.location.href,trigger:"popstate",event:t})}initEvents(){this.prefetchIgnore!==!0&&(document.addEventListener("mouseover",this.onHover),document.addEventListener("touchstart",this.onHover)),document.addEventListener("click",this.onClick),window.addEventListener("popstate",this.onStateChange)}stopEvents(){this.prefetchIgnore!==!0&&(document.removeEventListener("mouseover",this.onHover),document.removeEventListener("touchstart",this.onHover)),document.removeEventListener("click",this.onClick),window.removeEventListener("popstate",this.onStateChange)}};var pt=class extends y{constructor(t=[]){super();this.routes=new g;for(let e of t)this.add(e)}add({path:t,method:e}){let i=this.parse(t);return this.routes.set(i,e),this}parsePath(t){if(typeof t=="string")return new RegExp(t,"i");if(t instanceof RegExp||typeof t=="boolean")return t;throw"[Router] only regular expressions, strings and booleans are accepted as paths."}isPath(t){return typeof t=="string"||t instanceof RegExp||typeof t=="boolean"}parse(t){let e=t,i={from:/(.*)/g,to:/(.*)/g};if(this.isPath(t))i={from:!0,to:t};else if(this.isPath(e.from)&&this.isPath(e.to))i=e;else throw"[Router] path is neither a string, regular expression, or a { from, to } object.";let{from:n,to:s}=i;return{from:this.parsePath(n),to:this.parsePath(s)}}route(){if(this.manager.has("HistoryManager")){let t=this.manager.get("HistoryManager"),e=E(c((t.length>1?t.previous:t.current).url)),i=E(c());this.routes.forEach((n,s)=>{let a=s.from,l=s.to;if(typeof a=="boolean"&&typeof l=="boolean")throw`[Router] path ({ from: ${a}, to: ${l} }) is not valid, remember paths can only be strings, regular expressions, or a boolean; however, both the from and to paths cannot be both booleans.`;let o=a,p=l;a instanceof RegExp&&a.test(e)&&(o=a.exec(e)),l instanceof RegExp&&l.test(i)&&(p=l.exec(i)),(Array.isArray(p)&&Array.isArray(o)||Array.isArray(p)&&typeof o=="boolean"&&o||Array.isArray(o)&&typeof p=="boolean"&&p)&&n({from:o,to:p,path:{from:e,to:i}})})}else console.warn("[Route] HistoryManager is missing.")}initEvents(){this.emitter.on("READY",this.route,this),this.emitter.on("CONTENT_REPLACED",this.route,this)}stopEvents(){this.emitter.off("READY",this.route,this),this.emitter.off("CONTENT_REPLACED",this.route,this)}};var ct=r=>typeof r=="string"?Array.from(document.querySelectorAll(r)):[r],dt=r=>[].concat(...r),F=r=>Array.isArray(r)?dt(r.map(F)):typeof r=="string"||r instanceof Node?ct(r):r instanceof NodeList||r instanceof HTMLCollection?Array.from(r):[],j=(r,t,e)=>typeof r=="function"?r.apply(e,t):r,K=(r,t,e)=>{let i,n,s={},a=Object.keys(r);for(let l=0,o=a.length;l/^(in|out)/.test(r)?ut[r]:r,V={keyframes:[],loop:1,delay:0,speed:1,endDelay:0,easing:"ease",autoplay:!0,duration:1e3,fillMode:"auto",direction:"normal",extend:{}},M=class{constructor(t={}){this.options={};this.targets=[];this.properties={};this.animations=new g;this.totalDuration=0;this.minDelay=0;this.computedOptions=new g;this.emitter=new O;try{let{options:e,...i}=t,n=e instanceof M?e.getOptions():Array.isArray(e)?e?.[0]?.getOptions():e;this.options=Object.assign({},V,n,i),this.loop=this.loop.bind(this);let{loop:s,delay:a,speed:l,easing:o,endDelay:p,duration:f,direction:P,fillMode:T,onfinish:x,target:G,keyframes:q,autoplay:$,extend:B,...Y}=this.options;this.mainElement=document.createElement("div"),this.targets=F(G),this.properties=Y;let C=[],d=this.targets.length,I;for(let m=0;m0||(I=K(I,[m,d,b],this));let H=u.delay+u.duration*u.iterations+u.endDelay;this.totalDuration{typeof x=="function"&&x.call(this,b,m,d,A),this.emit("finish",b,m,d,A)},this.computedOptions.set(A,u),this.animations.set(b,A),C.push(u.delay)}this.mainAnimation=this.mainElement.animate([{opacity:"0"},{opacity:"1"}],{duration:this.totalDuration,easing:"linear"}),this.minDelay=Math.min(...C),this.setSpeed(l),$?this.play():this.pause(),this.promise=this.newPromise(),this.mainAnimation.onfinish=()=>{this.emit("complete",this),this.stopLoop()}}catch(e){this.emit("error",e)}}newPromise(){return new Promise((t,e)=>{this.on("complete",()=>t([this])),this.on("error",i=>e(i))})}then(t,e){return t=t?.bind(this),e=e?.bind(this),this.promise.then(t,e),this}catch(t){return t=t?.bind(this),this.promise.catch(t),this}finally(t){return t=t?.bind(this),this.promise.finally(t),this}loop(){this.stopLoop(),this.emit("update",this.getProgress(),this),this.animationFrame=window.requestAnimationFrame(this.loop)}stopLoop(){window.cancelAnimationFrame(this.animationFrame)}all(t){return t(this.mainAnimation,this.mainElement),this.animations.forEach(t),this}beginEvent(){if(this.getProgress()==0){let t=window.setTimeout(()=>{this.emit("begin",this),t=window.clearTimeout(t)},this.minDelay)}}play(){let t=this.getPlayState();return this.beginEvent(),this.all(e=>e.play()),this.emit("play",t,this),this.loop(),this}pause(){let t=this.getPlayState();return this.all(e=>e.pause()),this.emit("pause",t,this),this.stopLoop(),this.animationFrame=void 0,this}reset(){return this.setProgress(0),this.beginEvent(),this.options.autoplay?this.play():this.pause(),this}cancel(){return this.all(t=>t.cancel()),this.stopLoop(),this}finish(){return this.all(t=>t.finish()),this.stopLoop(),this}stop(){for(this.cancel(),this.animations.clear();this.targets.length;)this.targets.pop();this.mainElement=void 0,this.emit("stop")}getTargets(){return this.targets}getAnimation(t){return this.animations.get(t)}getTiming(t){let e=t instanceof Animation?t:this.getAnimation(t),i=this.computedOptions.get(e)??{},n=e.effect?.getTiming()??{},s=this.getOptions();return{...V,...s,...n,...i}}getTotalDuration(){return this.totalDuration}getCurrentTime(){return this.mainAnimation.currentTime}getProgress(){return this.getCurrentTime()/this.totalDuration*100}getSpeed(){return this.mainAnimation.playbackRate}getPlayState(){return this.mainAnimation.playState}getOptions(){return this.options}setCurrentTime(t){return this.all(e=>{e.currentTime=t}),this.emit("update",this.getProgress()),this}setProgress(t){let e=t/100*this.totalDuration;return this.setCurrentTime(e),this}setSpeed(t=1){return this.all(e=>{e.playbackRate=t}),this}on(t,e,i){return this.emitter.on(t,e,i??this),this}off(t,e,i){return this.emitter.off(t,e,i??this),this}emit(t,...e){return this.emitter.emit(t,...e),this}toJSON(){return this.getOptions()}get[Symbol.toStringTag](){return"Animate"}},yt=(r={})=>new M(r),ht=class extends M{constructor(t={}){super();this.animations=new g;try{let{options:e,...i}=t,n=e instanceof M?e.getOptions():Array.isArray(e)?e?.[0]?.getOptions():e;this.options=Object.assign({},V,n,i),this.loop=this.loop.bind(this);let{loop:s,delay:a,speed:l,easing:o,endDelay:p,duration:f,direction:P,fillMode:T,onfinish:x,target:G,keyframes:q,autoplay:$,extend:B,...Y}=this.options;this.mainElement=document.createElement("div"),this.targets=F(G),this.properties=Y;let C=[],d=this.targets.length,I;for(let m=0;m0||(I=K(I,[m,d,b],this));let H=u.delay+u.duration*u.iterations+u.endDelay;this.totalDuration{typeof x=="function"&&x.call(this,b,m,d,A),this.emit("finish",b,m,d,A)},this.computedOptions.set(A,u),this.animations.set(b,A),C.push(u.delay)}this.mainAnimation=this.mainElement.animate([{opacity:"0"},{opacity:"1"}],{duration:this.totalDuration,easing:"linear"}),this.minDelay=Math.min(...C),this.setSpeed(l),$?this.play():this.pause(),this.promise=this.newPromise(),this.mainAnimation.onfinish=()=>{this.emit("complete",this),this.stopLoop()}}catch(e){this.emit("error",e)}}add(t){return this}};return At;})(); //# sourceMappingURL=api.js.map diff --git a/packages/native/lib/api.js.map b/packages/native/lib/api.js.map index e29aee6..f3d8f9e 100644 --- a/packages/native/lib/api.js.map +++ b/packages/native/lib/api.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../src/api.ts", "../src/config.ts", "../../manager/src/api.ts", "../src/manager.ts", "../src/url.ts", "../src/service.ts", "../src/history.ts", "../src/page.ts", "../../emitter/src/api.ts", "../src/transition.ts", "../src/app.ts", "../src/pjax.ts", "../src/router.ts", "../../animate/src/api.ts"], - "sourcesContent": ["export * from \"./config\";\nexport * from \"./manager\";\nexport * from \"./url\";\n\nexport * from \"./history\";\nexport * from \"./page\";\n\nexport * from \"./emitter\";\nexport * from \"./service\";\n\nexport * from \"./transition\";\n\nexport * from \"./app\";\nexport * from \"./pjax\";\nexport * from \"./router\";\n\nexport * from \"./animate\";\n", "export interface ICONFIG {\n prefix?: string;\n wrapperAttr?: string;\n noAjaxLinkAttr?: string;\n noPrefetchAttr?: \"no-prefetch\";\n headers?: string[][];\n preventSelfAttr?: string;\n preventAllAttr?: string;\n transitionAttr?: string;\n blockAttr?: string;\n timeout?: number;\n [key: string]: any;\n}\n\nexport const CONFIG_DEFAULTS: ICONFIG = {\n wrapperAttr: \"wrapper\",\n noAjaxLinkAttr: \"no-ajax-link\",\n noPrefetchAttr: \"no-prefetch\",\n headers: [\n [\"x-partial\", \"true\"]\n ],\n preventSelfAttr: `prevent=\"self\"`,\n preventAllAttr: `prevent=\"all\"`,\n transitionAttr: \"transition\",\n blockAttr: `block`,\n timeout: 30000\n};\n\nexport type ConfigKeys = keyof ICONFIG;\nexport const newConfig = (config: ICONFIG): ICONFIG => {\n return Object.assign({ ...CONFIG_DEFAULTS }, config);\n};\n\n/** Converts string into properly formatted data attributes */\nexport const toAttr = (config: ICONFIG, value: string, brackets: boolean = true): string => {\n let { prefix } = config;\n let attr = `data${prefix ? \"-\" + prefix : \"\"}-${value}`;\n return brackets ? `[${attr}]` : attr;\n};\n\n/** Selects config vars, and formats them for use, or simply returns the current configurations for the framework */\nexport const getConfig = (config: ICONFIG, value?: ConfigKeys, brackets: boolean = true): any => {\n if (typeof value !== \"string\")\n return config;\n\n let prop = config[value];\n if (typeof prop === \"string\")\n return toAttr(config, prop, brackets);\n return prop;\n};\n", "/** Manages complex lists of named data, eg. A page can be stored in a list by of other pages with the url being how the page is stored in the list. Managers use Maps to store data */\nexport class Manager {\n\t/** The complex list of named data, to which the Manager controls */\n\tpublic map: Map;\n\tconstructor(value?: Array<[K, V]>) {\n\t\tthis.map = new Map(value);\n\t}\n\n\t/** Returns the Manager classes base Map */\n\tpublic getMap(): Map {\n\t\treturn this.map;\n\t}\n\n\t/** Get a value stored in the Manager */\n\tpublic get(key: K): V {\n\t\treturn this.map.get(key);\n\t}\n\n\t/** Returns the keys of all items stored in the Manager as an Array */\n\tpublic keys(): Array {\n\t\treturn Array.from(this.map.keys());\n\t}\n\n\t/** Returns the values of all items stored in the Manager as an Array */\n\tpublic values(): Array {\n\t\treturn Array.from(this.map.values());\n\t}\n\n\t/** Set a value to the Manager using a key */\n\tpublic set(key: K, value: V): Manager {\n\t\tthis.map.set(key, value);\n\t\treturn this;\n\t}\n\n\t/** Adds a value to Manager, and uses the current size of the Manager as it's key, it works best when all the key in the Manager are numbers */\n\tpublic add(value: V): Manager {\n\t\tlet size = this.size;\n\t\t// @ts-ignore\n\t\tlet num: K = size as K;\n\t\tthis.set(num, value);\n\t\treturn this;\n\t}\n\n\t/** Returns the total number of items stored in the Manager */\n\tpublic get size(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** An alias for size */\n\tpublic get length(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** Returns the last item in the Manager who's index is a certain distance from the last item in the Manager */\n\tpublic last(distance: number = 1): V | undefined {\n\t\tlet key = this.keys()[this.size - distance];\n\t\treturn this.get(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns true if an element in the Map object existed and has been removed, or false if the element does not exist */\n\tpublic delete(key: K): boolean {\n\t\treturn this.map.delete(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns the Manager class, allowing for chains */\n\tpublic remove(key: K): Manager {\n\t\tthis.map.delete(key);\n\t\treturn this;\n\t}\n\n\t/** Clear the Manager of all its contents */\n\tpublic clear(): Manager {\n\t\tthis.map.clear();\n\t\treturn this;\n\t}\n\n\t/** Checks if the Manager contains a certain key */\n\tpublic has(key: K): boolean {\n\t\treturn this.map.has(key);\n\t}\n\n\t/** Returns a new Iterator object that contains an array of [key, value] for each element in the Map object in insertion order. */\n\tpublic entries(): IterableIterator<[K, V]> {\n\t\treturn this.map.entries();\n\t}\n\n\t/** Iterates through the Managers contents, calling a callback function every iteration */\n\tpublic forEach(\n\t\tcallback: (value?: V, key?: K, map?: Map) => void,\n\t\tcontext?: object\n\t): Manager {\n\t\tthis.map.forEach(callback, context);\n\t\treturn this;\n\t}\n\n\t/** Allows for iteration via for..of, learn more: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators] */\n\tpublic [Symbol.iterator](): IterableIterator<[K, V]> {\n\t\treturn this.entries();\n\t}\n}\n\n/**\n * Calls the method of a certain name for all items that are currently installed\n */\nexport const methodCall = (manager: Manager, method: string, ...args: any): void => {\n\tmanager.forEach((item) => {\n\t\t// @ts-ignore\n\t\titem[method](...args);\n\t});\n};\n\n/**\n * Asynchronously calls the method of a certain name for all items that are currently installed, similar to methodCall\n */\nexport const asyncMethodCall = async (manager: Manager, method: string, ...args: any): Promise => {\n\tfor (let [, item] of manager) {\n\t\t// @ts-ignore\n\t\tawait item[method](...args);\n\t}\n};\n\nexport default Manager;\n", "import { Manager, methodCall, asyncMethodCall } from \"@okikio/manager\";\nimport { ICONFIG } from \"./config\";\nimport { IApp } from \"./app\";\nimport { EventEmitter } from \"./emitter\";\n\nexport type IAdvancedManager = AdvancedManager;\n\n/** The base class for AdvancedManager items */\nexport class ManagerItem {\n /** The AdvancedManager the ManagerItem is attached to */\n public manager: IAdvancedManager;\n\n /** The App the ManagerItem is attached to */\n public app: IApp;\n\n /** The Config of the App the ManagerItem is attached to */\n public config: ICONFIG;\n\n /** The EventEmitter of the App the ManagerItem is attached to */\n public emitter: EventEmitter;\n\n /** The key to where ManagerItem is stored in an AdvancedManager */\n public key: any;\n\n constructor() { }\n\n /** Run after the Manager Item has been registered */\n public install(): any { }\n\n /** Register the current Manager Item's manager */\n public register(manager: IAdvancedManager, key: any): ManagerItem {\n this.manager = manager;\n this.app = manager.app;\n this.config = manager.config;\n this.emitter = manager.emitter;\n this.key = key;\n this.install();\n return this;\n }\n\n /** Run before the ManagerItem has been unregistered */\n public uninstall(): any { }\n\n /** Basically removes a ManagerItem, in order to recover the ManagerItem, it needs to be re-added to an AdvancedManager */\n public unregister() {\n this.uninstall();\n\n this.manager.remove(this.key);\n this.key = undefined;\n this.manager = undefined;\n this.app = undefined;\n this.config = undefined;\n this.emitter = undefined;\n }\n}\n\n/** A tweak to the Manager class that makes it self aware of the App class it's instantiated in */\nexport class AdvancedManager extends Manager {\n /** The App the AdvancedManager is attached to */\n public app: IApp;\n\n /** The Config of the App the AdvancedManager is attached to */\n public config: ICONFIG;\n\n /** The EventEmitter of the App the AdvancedManager is attached to */\n public emitter: EventEmitter;\n\n /** Register App details */\n constructor(app: IApp) {\n super();\n this.app = app;\n this.config = app.config;\n this.emitter = app.emitter;\n }\n\n /** Add a ManagerItem to AdvancedManager at a specified key */\n public set(key: K, value: V) {\n super.set(key, value);\n value.register(this, key);\n return this;\n }\n}\n\nexport { Manager, methodCall, asyncMethodCall };\n", "export const newURL = (url: string | URL | Location = window.location.href): URL => {\n return url instanceof URL ? url : new URL(url as unknown as string, window.location.origin);\n};\n\n/** Returns the pathname with the hash at the end */\nexport const getHashedPath = (url: URL): string => (`${url.pathname}${url.hash}`);\n\n/** Returns the actual hash without the hashtag */\nexport const getHash = (url: URL): string => (url.hash.slice(1));\n\n/** Removes the hash from the full URL for a clean URL string */\nexport const clean = (url: URL): string => (url.toString().replace(/(\\/#.*|\\/|#.*)$/, ''));\n\n/** Compares two URLs to each other */\nexport const equal = (a: URL | string, b: URL | string): boolean => {\n let urlA = newURL(a);\n let urlB = newURL(b);\n return clean(urlA) === clean(urlB);\n};\n", "import { AdvancedManager, ManagerItem, methodCall } from \"./manager\";\nimport { IApp } from \"./app\";\n\n/** Controls specific kinds of actions that require JS */\nexport class Service extends ManagerItem {\n\t/** Called before the start of a Service, represents a constructor of sorts */\n\tpublic init(...args: any): any;\n\tpublic init(): any { }\n\n\t/** Called on start of Service */\n\tpublic boot(...args: any): any;\n\tpublic boot(): any {\n\t\tthis.initEvents();\n\t}\n\n\t/** Initialize events */\n\tpublic initEvents(): void { }\n\n\t/** Stop events */\n\tpublic stopEvents(): void { }\n\n\t/** Stop services */\n\tpublic stop(): void {\n\t\tthis.stopEvents();\n\t\tthis.unregister();\n\t}\n}\n\n/** The Service Manager controls the lifecycle of all Services in an App */\nexport class ServiceManager extends AdvancedManager {\n\tconstructor(app: IApp) {\n\t\tsuper(app);\n\t}\n\n\t/** Call the init method for all Services */\n\tpublic init(): ServiceManager {\n\t\tmethodCall(this, \"init\");\n\t\treturn this;\n\t}\n\n\t/** Call the boot method for all Services */\n\tpublic boot(): ServiceManager {\n\t\tmethodCall(this, \"boot\");\n\t\treturn this;\n\t}\n\n\t/** Call the stop method for all Services */\n\tpublic stop(): ServiceManager {\n\t\tmethodCall(this, \"stop\");\n\t\treturn this;\n\t}\n}\n", "import { Service } from \"./service\";\nimport { getHashedPath, newURL } from \"./url\";\n\nexport type Trigger = HTMLAnchorElement | \"HistoryManager\" | \"popstate\" | \"back\" | \"forward\";\nexport interface ICoords {\n\treadonly x: number;\n\treadonly y: number;\n}\n\nexport interface IStateData {\n\tscroll: ICoords;\n\t[key: string]: any;\n}\n\nexport interface IState {\n\turl: string;\n\tindex?: number;\n\ttransition: string;\n\tdata: IStateData;\n}\n\nexport interface IHistoryItem {\n\tindex: number;\n\tstates: IState[];\n}\n\nexport interface IHistoryManager extends Service {\n\tstates: IState[],\n\tpointer: number,\n\n\tinit(): any,\n\tget(index: number): IState,\n\tadd(value?: IState, historyAction?: \"replace\" | \"push\"): HistoryManager,\n\tremove(index?: number): HistoryManager,\n\treplace(newStates: IState[]): HistoryManager,\n\tset(i: number, state: IState): IState,\n\tcurrent: IState,\n\tlast: IState,\n\tprevious: IState | null,\n\tlength: number,\n}\n\n/** A quick snapshot of page scroll coordinates */\nexport const newCoords = (x: number = window.scrollX, y: number = window.scrollY): ICoords => ({ x, y });\n\n/** Creates a state; a state represents the current status of the page consisting of properties like: url, transition, and data */\nexport const newState = (state: IState = {\n\turl: getHashedPath(newURL()),\n\tindex: 0,\n\ttransition: \"default\",\n\tdata: {\n\t\tscroll: newCoords(),\n\t\ttrigger: \"HistoryManager\"\n\t}\n}): IState => (state);\n\n/** Keeps a record of the history of the App; it stores only the states of Pages */\nexport class HistoryManager extends Service implements IHistoryManager {\n\tpublic states: IState[];\n\tpublic pointer = -1;\n\n\t/** Initializes the states array, and replace the history pushState data with the states array */\n\tinit() {\n\t\tthis.states = [];\n\n\t\tlet state = newState();\n\t\tthis.add(state, \"replace\");\n\t}\n\n\t/** Get a state based on it's index */\n\tpublic get(index: number) {\n\t\treturn this.states[index];\n\t}\n\n\t/** Add a state to HistoryManager and change the history pushState data based on the historyAction specified */\n\tpublic add(value?: IState, historyAction: \"replace\" | \"push\" = \"push\"): HistoryManager {\n\t\tlet state = newState(value);\n\t\tlet len = this.length;\n\t\tthis.states.push({ ...state });\n\t\tthis.pointer = len;\n\n\t\tlet item: IHistoryItem = {\n\t\t\tindex: this.pointer,\n\t\t\tstates: [...this.states]\n\t\t};\n\t\tchangeState(historyAction, state, item);\n\t\treturn this;\n\t}\n\n\tpublic remove(index?: number) {\n\t\tif (index) {\n\t\t\tthis.states.splice(index, 1);\n\t\t} else {\n\t\t\tthis.states.pop();\n\t\t}\n\n\t\tthis.pointer--;\n\t\treturn this;\n\t}\n\n\t/** Replaces the states array with another states array, this is later used when going back and forward in page history */\n\tpublic replace(newStates: IState[]) {\n\t\tthis.states = newStates;\n\t\treturn this;\n\t}\n\n\t/** Set state by index. */\n\tpublic set(i: number, state: IState) {\n\t\treturn (this.states[i] = state);\n\t}\n\n\t/** Get the current state */\n\tget current(): IState {\n\t\treturn this.get(this.pointer);\n\t}\n\n\t/** Get the last state (top of the history stack). */\n\tget last(): IState {\n\t\treturn this.get(this.length - 1);\n\t}\n\n\t/** Get the previous state. */\n\tget previous(): IState | null {\n\t\treturn this.pointer < 1 ? null : this.get(this.pointer - 1);\n\t}\n\n\tget length() {\n\t\treturn this.states.length;\n\t}\n}\n\n/** Either push or replace history state */\nexport const changeState = (action: \"push\" | \"replace\", state: IState, item: object) => {\n\tlet href = getHashedPath(newURL(state.url));\n\tlet args = [item, \"\", href];\n\tif (window.history) {\n\t\tswitch (action) {\n\t\t\tcase \"push\":\n\t\t\t\twindow.history.pushState.apply(window.history, args);\n\t\t\t\tbreak;\n\t\t\tcase \"replace\":\n\t\t\t\twindow.history.replaceState.apply(window.history, args);\n\t\t\t\tbreak;\n\t\t}\n\t}\n};\n", "import { Manager, ManagerItem, AdvancedManager } from \"./manager\";\nimport { equal, newURL } from \"./url\";\nimport { getConfig } from \"./config\";\nimport { Service } from \"./service\";\n\nexport interface IPage extends ManagerItem {\n dom: Document,\n wrapper: HTMLElement,\n title: string,\n head: Element,\n body: Element,\n url: URL,\n data: string,\n wrapperAttr: string,\n\n build(): any,\n install(): void,\n uninstall(): any,\n}\n\n/**\n * Parses strings to DOM\n */\nexport const PARSER: DOMParser = new DOMParser();\n\n/** A page represents the DOM elements that create each page */\nexport class Page extends ManagerItem implements IPage {\n /** Holds the DOM of the current page */\n public dom: Document;\n\n /** Holds the wrapper element to be swapped out of each Page */\n public wrapper: HTMLElement;\n\n /** Holds the title of each page */\n public title: string;\n\n /** Holds the head element of each page */\n public head: Element;\n\n /** Holds the body element of each page */\n public body: Element;\n\n /** The URL of the current page */\n public url: URL;\n\n /** The payload of a page request */\n public data: string;\n\n /** Attr that identifies the wrapper */\n public wrapperAttr: string;\n\n constructor(url: URL = newURL(), dom: string | Document = document) {\n super();\n this.url = url;\n\n if (typeof dom === \"string\") {\n this.data = dom;\n } else this.dom = dom || document;\n }\n\n /** Builds the page's dom, and sets the title, head, body, and wrapper properties of the Page class */\n public build() {\n if (!(this.dom instanceof Node)) {\n this.dom = PARSER.parseFromString(this.data, \"text/html\");\n }\n\n if (!(this.body instanceof Node)) {\n let { title, head, body } = this.dom;\n this.title = title;\n this.head = head;\n this.body = body;\n this.wrapper = this.body.querySelector(this.wrapperAttr);\n }\n }\n\n public install() {\n this.wrapperAttr = getConfig(this.config, \"wrapperAttr\");\n }\n\n public uninstall() {\n this.url = undefined;\n this.title = undefined;\n this.head = undefined;\n this.body = undefined;\n this.dom = undefined;\n this.wrapper = undefined;\n this.data = undefined;\n this.wrapperAttr = undefined;\n }\n}\n\nexport interface IPageManager extends Service {\n loading: Manager>,\n maxPages: number,\n pages: AdvancedManager;\n\n install(): any,\n\n get(key): Page,\n add(value): PageManager,\n set(key, value): PageManager,\n remove(key): PageManager,\n has(key): boolean,\n clear(): PageManager,\n size: number,\n keys(): any[],\n\n load(_url: URL | string): Promise,\n request(url: string): Promise,\n}\n\n/** Controls which page to load */\nexport class PageManager extends Service implements IPageManager {\n /** Stores all fetch requests that are currently loading */\n public loading: Manager> = new Manager();\n public maxPages: number;\n\n pages: AdvancedManager;\n\n /** Instantiate pages, and add the current page to pages */\n install() {\n this.pages = new AdvancedManager(this.app);\n this.maxPages = this.config.maxPages ?? 5;\n\n let URLString = newURL().pathname;\n this.set(URLString, new Page());\n URLString = undefined;\n }\n\n get(key) { return this.pages.get(key); }\n add(value) { this.pages.add(value); return this; }\n set(key, value) { this.pages.set(key, value); return this; }\n remove(key) { this.pages.remove(key); return this; }\n has(key) { return this.pages.has(key); }\n clear() { this.pages.clear(); return this; }\n get size() { return this.pages.size; }\n keys() { return this.pages.keys(); }\n\n /** Load from cache or by requesting URL via a fetch request, avoid requesting for the same thing twice by storing the fetch request in \"this.loading\" */\n public async load(_url: URL | string = newURL()): Promise {\n let url: URL = newURL(_url);\n let urlString: string = url.pathname;\n let page: Page, request: Promise;\n if (this.has(urlString)) {\n page = this.get(urlString);\n return Promise.resolve(page);\n }\n\n if (!this.loading.has(urlString)) {\n request = this.request(urlString);\n this.loading.set(urlString, request);\n } else request = this.loading.get(urlString);\n\n let response = await request;\n this.loading.remove(urlString);\n\n page = new Page(url, response);\n this.set(urlString, page);\n\n if (this.size > this.maxPages) {\n let currentUrl = newURL();\n let keys = this.keys();\n let first = equal(currentUrl, keys[0]) ? keys[1] : keys[0];\n let page = this.get(first);\n page.unregister();\n page = undefined;\n keys = undefined;\n currentUrl = undefined;\n first = undefined;\n }\n return page;\n }\n\n /** Starts a fetch request */\n public async request(url: string): Promise {\n const headers = new Headers(getConfig(this.config, \"headers\"));\n const timeout = window.setTimeout(() => {\n window.clearTimeout(timeout);\n throw \"Request Timed Out!\";\n }, getConfig(this.config, \"timeout\"));\n\n try {\n let response = await fetch(url, {\n mode: 'same-origin',\n method: \"GET\",\n headers,\n cache: \"default\",\n credentials: \"same-origin\",\n });\n\n window.clearTimeout(timeout);\n if (response.status >= 200 && response.status < 300) {\n return await response.text();\n }\n\n const err = new Error(response.statusText || \"\" + response.status);\n throw err;\n } catch (err) {\n window.clearTimeout(timeout);\n throw err;\n }\n }\n}\n", "import { Manager, methodCall } from \"@okikio/manager\";\n\nexport type ListenerCallback = ((...args: any) => void);\nexport interface IListener {\n readonly callback: ListenerCallback;\n readonly scope: object;\n readonly name: string;\n}\n\n/** Represents a new event listener consisting of properties like: callback, scope, name */\nexport const newListener = ({\n callback = () => { },\n scope = null,\n name = \"event\",\n}: IListener): IListener => ({ callback, scope, name });\n\n/** Represents a new event */\nexport class Event extends Manager {\n /** The name of the event */\n public name: string;\n constructor(name: string = \"event\") {\n super();\n this.name = name;\n }\n}\n\nexport type EventInput = string | object | Array;\n\n/**\n * An Event Emitter\n * */\nexport class EventEmitter extends Manager {\n constructor() {\n super();\n }\n\n /** Gets event, if event doesn't exist create a new one */\n public getEvent(name: string): Event {\n let event = this.get(name);\n if (!(event instanceof Event)) {\n this.set(name, new Event(name));\n return this.get(name);\n }\n\n return event;\n }\n\n /** Creates a listener and adds it to an event */\n public newListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event = this.getEvent(name);\n event.add(newListener({ name, callback, scope }));\n return event;\n }\n\n /** Adds a listener to a given event */\n public on(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n this.newListener(_name, _callback, _scope);\n }, this);\n return this;\n }\n\n /** Removes a listener from an event */\n public removeListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event: Event = this.get(name);\n if (event instanceof Event && callback) {\n let listener = newListener({ name, callback, scope });\n\n event.forEach((value: IListener, i: number) => {\n if (\n value.callback === listener.callback &&\n value.scope === listener.scope\n ) {\n return event.remove(i);\n }\n });\n }\n\n return event;\n }\n\n /** Remove a listener from a given event, or just completely remove an event */\n public off(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n if (typeof _callback === \"function\") {\n this.removeListener(_name, _callback, _scope);\n } else this.remove(_name);\n }, this);\n return this;\n }\n\n /** Call all listeners within an event */\n public emit(\n events: string | Array,\n ...args: any\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n // Loop through the list of events\n events.forEach((event: string) => {\n let _event: Event = this.get(event);\n\n if (_event instanceof Event) {\n _event.forEach((listener: IListener) => {\n let { callback, scope } = listener;\n callback.apply(scope, args);\n });\n }\n }, this);\n return this;\n }\n\n /** Clears events and event listeners */\n public clear() {\n methodCall(this, \"clear\");\n super.clear();\n return this;\n }\n}\n\nexport default EventEmitter;\n", "import { Manager } from \"./manager\";\nimport { ICoords, newCoords, Trigger } from \"./history\";\nimport { IPage } from \"./page\";\nimport { getConfig } from \"./config\";\nimport { Service } from \"./service\";\nimport { newURL } from \"./url\";\n\n/**\n * The async function type, allows for smooth transition between Promises\n */\nexport type asyncFn = (err?: any, value?: any) => void;\nexport interface ITransition {\n oldPage?: IPage;\n newPage?: IPage;\n trigger?: Trigger;\n scroll?: { x: number; y: number };\n scrollable?: boolean;\n in: (data: ITransitionData) => any;\n out: (data: ITransitionData) => any;\n [key: string]: any;\n}\nexport interface ITransitionData {\n from?: IPage;\n to?: IPage;\n trigger?: Trigger;\n scroll?: ICoords;\n done: asyncFn;\n}\nexport interface ITransitionManager extends Service {\n transitions: Manager,\n\n get(key: string): ITransition,\n set(key: string, value: ITransition): TransitionManager,\n add(value: ITransition): TransitionManager,\n has(key: string): boolean,\n\n boot(): any,\n animate(name: string, data: any): Promise,\n}\n\n\n/** Auto scrolls to an elements position if the element has an hash */\nexport const hashAction = (coords?: ICoords, hash: string = window.location.hash) => {\n try {\n let _hash = hash[0] == \"#\" ? hash : newURL(hash).hash;\n if (_hash.length > 1) {\n let el = document.getElementById(_hash.slice(1)) as HTMLElement;\n\n if (el) {\n return newCoords(el.offsetLeft, el.offsetTop);\n }\n }\n } catch (e) {\n console.warn(\"[hashAction] error\", e);\n }\n\n return coords ?? newCoords(0, 0);\n};\n\n// The Default Transition\nconst Default: ITransition = {\n name: \"default\",\n scrollable: true,\n\n out({ done }: ITransitionData) {\n done();\n },\n in({ scroll, done }: ITransitionData) {\n window.scroll(scroll.x, scroll.y);\n done();\n }\n};\n\n/** Controls which Transition between pages to use */\nexport class TransitionManager extends Service implements ITransitionManager {\n transitions: Manager;\n private _arg: Array<[string, ITransition]>;\n constructor(transitions?: Array<[string, ITransition]>) {\n super();\n this._arg = transitions;\n }\n\n /** On Service install set Config */\n public install() {\n super.install();\n\n let transitions = this._arg && this._arg.length ? this._arg : (getConfig(this.config, \"transitions\") ?? []);\n\n // Manager like Maps use the most recent [key, value] Array it knows, replacing the default transition\n // With any other transitions called [\"default\", ...]\n transitions = [[\"default\", Default]].concat(transitions);\n this.transitions = new Manager(transitions);\n }\n\n get(key: string) { return this.transitions.get(key); }\n set(key: string, value: ITransition) { this.transitions.set(key, value); return this; }\n add(value: ITransition) { this.transitions.add(value); return this; }\n has(key: string) { return this.transitions.has(key); }\n\n /** Starts a transition */\n public async animate(name: string, data: any): Promise {\n let transition: ITransition = this.transitions.get(name);\n let scroll = data.scroll;\n let ignoreHashAction = data.ignoreHashAction;\n if (!(\"wrapper\" in data.oldPage) || !(\"wrapper\" in data.newPage))\n throw `[Page] either oldPage or newPage aren't instances of the Page Class.\\n ${{\n newPage: data.newPage,\n oldPage: data.oldPage,\n }}`;\n\n // Replace the title\n document.title = `` + data.newPage.title;\n\n let fromWrapper = data.oldPage.wrapper;\n let toWrapper = data.newPage.wrapper;\n\n if (!(fromWrapper instanceof Node) || !(toWrapper instanceof Node))\n throw `[Wrapper] the wrapper from the ${!(toWrapper instanceof Node) ? \"next\" : \"current\"\n } page cannot be found. The wrapper must be an element that has the attribute ${getConfig(this.config,\n \"wrapperAttr\"\n )}.`;\n\n // Give the Transition all the background data it may require\n transition.init && transition?.init(data);\n\n this.emitter.emit(\"BEFORE_TRANSITION_OUT\");\n\n // Start the out point of the Transition\n if (transition.out) {\n await new Promise((done) => {\n let outMethod: Promise = transition.out.call(transition, {\n ...data,\n from: data.oldPage,\n trigger: data.trigger,\n done,\n });\n\n outMethod?.then(done);\n });\n }\n\n this.emitter.emit(\"AFTER_TRANSITION_OUT\");\n\n // Add the new wrapper before the old one\n await new Promise((done) => {\n fromWrapper.insertAdjacentElement(\"beforebegin\", toWrapper);\n this.emitter.emit(\"CONTENT_INSERT\");\n\n if (!ignoreHashAction && !/back|popstate|forward/.test(data.trigger as string)) {\n scroll = hashAction(scroll);\n }\n done();\n });\n\n // Replace the old wrapper with the new one\n await new Promise((done) => {\n fromWrapper.remove();\n fromWrapper = undefined;\n toWrapper = undefined;\n this.emitter.emit(\"CONTENT_REPLACED\");\n done();\n });\n\n this.emitter.emit(\"BEFORE_TRANSITION_IN\");\n\n // Start the in point of the Transition (only the in method has access to the hashAction's scroll position)\n if (transition.in) {\n await new Promise(async (done) => {\n let inMethod: Promise = transition.in.call(transition, {\n ...data,\n from: data.oldPage,\n to: data.newPage,\n trigger: data.trigger,\n scroll,\n done,\n });\n\n inMethod?.then(done);\n });\n }\n\n this.emitter.emit(\"AFTER_TRANSITION_IN\");\n return transition;\n }\n}\n", "import { EventEmitter, ListenerCallback, EventInput } from \"./emitter\";\nimport { ServiceManager, Service } from \"./service\";\nimport { newConfig, ICONFIG } from \"./config\";\n\nexport interface IApp {\n services: ServiceManager,\n emitter: EventEmitter,\n config: ICONFIG,\n register(config: ICONFIG): App,\n get(key: string): Service,\n set(key: string, service: Service): App,\n add(value: Service): App,\n boot(): App,\n stop(): App,\n on(events: EventInput, callback?: ListenerCallback): App,\n off(events: EventInput, callback?: ListenerCallback): App,\n emit(events: string | any[], ...args: any): App,\n}\n\n/** The App class starts the entire process, it controls all managers and all services */\nexport class App implements IApp {\n /** An instance of the ServiceManager */\n public services: ServiceManager;\n\n /** An instance of an EventEmitter */\n public emitter: EventEmitter;\n\n /** The current Configuration's for the App */\n public config: ICONFIG;\n constructor(config: object = {}) {\n this.register(config);\n }\n\n /** Create new instances of the ServiceManager, EventEmitter and the configurations */\n public register(config: ICONFIG = {}): App {\n this.config = newConfig(config);\n this.emitter = new EventEmitter();\n this.services = new ServiceManager(this);\n\n let handler = (() => {\n document.removeEventListener(\"DOMContentLoaded\", handler);\n window.removeEventListener(\"load\", handler);\n this.emitter.emit(\"READY ready\");\n }).bind(this);\n\n document.addEventListener(\"DOMContentLoaded\", handler);\n window.addEventListener(\"load\", handler);\n return this;\n }\n\n /** Shortcuts to adding, setting, and getting Services */\n public get(key: string): Service {\n return this.services.get(key);\n }\n\n public set(key: string, value: Service): App {\n this.services.set(key, value);\n return this;\n }\n\n public add(value: Service): App {\n this.services.add(value);\n return this;\n }\n\n /** Initialize and boot all Services */\n public boot(): App {\n this.services.init();\n this.services.boot();\n return this;\n }\n\n /** Stops all Services and clears the even emitter of all events and listeners */\n public stop(): App {\n this.services.stop();\n this.emitter.clear();\n return this;\n }\n\n /** Shortcuts to the App EventEmitter on, off, and emit methods */\n public on(events: EventInput, callback?: ListenerCallback): App {\n this.emitter.on(events, callback, this);\n return this;\n }\n\n public off(events: EventInput, callback?: ListenerCallback): App {\n this.emitter.off(events, callback, this);\n return this;\n }\n\n public emit(events: string | any[], ...args: any): App {\n this.emitter.emit(events, ...args);\n return this;\n }\n}\n", "import { newState, Trigger, newCoords, IHistoryItem, IHistoryManager } from \"./history\";\nimport { Service } from \"./service\";\nimport { IPage, IPageManager } from \"./page\";\nimport { newURL, getHashedPath, equal } from \"./url\";\nimport { getConfig } from \"./config\";\nimport { hashAction, ITransitionManager } from \"./transition\";\n\nexport type LinkEvent = MouseEvent | TouchEvent;\nexport type StateEvent = LinkEvent | PopStateEvent;\nexport type IgnoreURLsList = Array;\n/**\n * Creates a barbajs like PJAX Service, for the native framework\n * Based on barbajs and StartingBlocks\n */\nexport class PJAX extends Service {\n /** URLs to ignore when prefetching */\n public ignoreURLs: IgnoreURLsList;\n\n /** Whether or not to disable prefetching */\n public prefetchIgnore: boolean;\n\n /** Current state of transitions */\n public isTransitioning: boolean;\n\n /** Ignore extra clicks of an anchor element if a transition has already started */\n public stopOnTransitioning: boolean;\n\n /** On page change (excluding popstate events) keep current scroll position */\n public stickyScroll: boolean;\n\n /** Force load a page if an error occurs */\n public forceOnError: boolean;\n\n /** Ignore hash action if set to true */\n public ignoreHashAction: boolean;\n\n public install() {\n super.install();\n\n this.ignoreURLs = getConfig(this.config, \"ignoreURLs\") ?? [];\n this.prefetchIgnore = getConfig(this.config, \"prefetchIgnore\") ?? false;\n this.stopOnTransitioning = getConfig(this.config, \"stopOnTransitioning\") ?? false;\n this.stickyScroll = getConfig(this.config, \"stickyScroll\") ?? false;\n this.forceOnError = getConfig(this.config, \"forceOnError\") ?? false;\n this.ignoreHashAction = getConfig(this.config, \"ignoreHashAction\") ?? false\n }\n\n /** Sets the transition state to either true or false */\n public transitionStart() {\n this.isTransitioning = true;\n }\n\n public transitionStop() {\n this.isTransitioning = false;\n }\n\n public init() {\n /**\n * Bind the event listeners to the PJAX class\n *\n * @memberof PJAX\n */\n this.onHover = this.onHover.bind(this);\n this.onClick = this.onClick.bind(this);\n this.onStateChange = this.onStateChange.bind(this);\n }\n\n /** Starts the PJAX Service */\n public boot() {\n if (\"scrollRestoration\" in window.history) {\n // Back off, browser, I got this...\n window.history.scrollRestoration = \"manual\";\n }\n\n super.boot();\n }\n\n /** Gets the transition to use for a certain anchor */\n public getTransitionName(el: HTMLAnchorElement): string | null {\n if (!el || !el.getAttribute) return null;\n let transitionAttr = el.getAttribute(\n getConfig(this.config, \"transitionAttr\", false)\n );\n\n if (typeof transitionAttr === \"string\") return transitionAttr;\n return null;\n }\n\n /** Checks to see if the anchor is valid */\n public validLink(\n el: HTMLAnchorElement,\n event: LinkEvent | KeyboardEvent,\n href: string\n ): boolean {\n let pushStateSupport = !window.history.pushState;\n let exists = !el || !href;\n let eventMutate =\n (event as KeyboardEvent).metaKey ||\n (event as KeyboardEvent).ctrlKey ||\n (event as KeyboardEvent).shiftKey ||\n (event as KeyboardEvent).altKey;\n let newTab =\n el.hasAttribute(\"target\") &&\n (el as HTMLAnchorElement).target === \"_blank\";\n let crossOrigin =\n (el as HTMLAnchorElement).protocol !== location.protocol ||\n (el as HTMLAnchorElement).hostname !== location.hostname;\n let download = typeof el.getAttribute(\"download\") === \"string\";\n let preventSelf = el.matches(getConfig(this.config, \"preventSelfAttr\"));\n let preventAll = Boolean(\n el.closest(getConfig(this.config, \"preventAllAttr\"))\n );\n let sameURL = getHashedPath(newURL()) === getHashedPath(newURL(href));\n return !(\n exists ||\n pushStateSupport ||\n eventMutate ||\n newTab ||\n crossOrigin ||\n download ||\n preventSelf ||\n preventAll ||\n sameURL\n );\n }\n\n /** Returns the href of an Anchor element */\n public getHref(el: HTMLAnchorElement): string | null {\n if (\n el &&\n el.tagName &&\n el.tagName.toLowerCase() === \"a\" &&\n typeof el.href === \"string\"\n )\n return el.href;\n return null;\n }\n\n /** Check if event target is a valid anchor with an href, if so, return the anchor */\n public getLink(event: LinkEvent): HTMLAnchorElement {\n let el = event.target as HTMLAnchorElement;\n let href: string = this.getHref(el);\n\n while (el && !href) {\n el = (el as HTMLElement).parentNode as HTMLAnchorElement;\n href = this.getHref(el);\n }\n\n // Check for a valid link\n if (!el || !this.validLink(el, event, href)) return;\n return el;\n }\n\n /** When an element is clicked, get valid anchor element, go for a transition */\n public onClick(event: LinkEvent) {\n let el = this.getLink(event);\n if (!el) return;\n\n if (this.isTransitioning && this.stopOnTransitioning) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n let href = this.getHref(el);\n this.emitter.emit(\"ANCHOR_CLICK CLICK\", event);\n this.go({ href, trigger: el, event });\n }\n\n /** Returns the direction of the State change as a String, either the Back button or the Forward button */\n public getDirection(value: number): Trigger {\n if (Math.abs(value) > 1) {\n // Ex 6-0 > 0 -> forward, 0-6 < 0 -> back\n return value > 0 ? \"forward\" : \"back\";\n } else {\n if (value === 0) {\n return \"popstate\";\n } else {\n // Ex 6-5 > 0 -> back, 5-6 < 0 -> forward\n return value > 0 ? \"back\" : \"forward\";\n }\n }\n }\n\n /** Force a page to go to a certain URL */\n public force(href: string): void {\n window.location.assign(href);\n }\n\n /**\n * If transition is running force load page.\n * Stop if currentURL is the same as new url.\n * On state change, change the current state history, to reflect the direction of said state change\n * Load page and page transition.\n */\n public go({\n href,\n trigger = \"HistoryManager\",\n event,\n }: {\n href: string;\n trigger?: Trigger;\n event?: StateEvent;\n }): Promise {\n // If transition is already running and the go method is called again, force load page\n if (this.isTransitioning && this.stopOnTransitioning ||\n !(this.manager.has(\"TransitionManager\") &&\n this.manager.has(\"HistoryManager\") &&\n this.manager.has(\"PageManager\"))) {\n this.force(href);\n return;\n }\n\n const history = this.manager.get(\"HistoryManager\") as IHistoryManager;\n let scroll = newCoords(0, 0);\n let currentState = history.current;\n let currentURL = currentState.url;\n if (equal(currentURL, href)) {\n return;\n }\n\n let transitionName: string;\n if (event && (event as PopStateEvent).state) {\n this.emitter.emit(\"POPSTATE\", event);\n\n // If popstate, get back/forward direction.\n let { state }: { state: IHistoryItem } = event as PopStateEvent;\n let { index } = state;\n let currentIndex = currentState.index;\n let difference = currentIndex - index;\n\n let _state = history.get(history.pointer);\n transitionName = _state.transition;\n scroll = _state.data.scroll;\n\n history.replace(state.states);\n history.pointer = index;\n\n trigger = this.getDirection(difference);\n\n // Based on the direction of the state change either remove or add a state\n this.emitter.emit(trigger === \"back\" ? `POPSTATE_BACK` : `POPSTATE_FORWARD`, event);\n } else {\n // Add new state\n transitionName = this.getTransitionName(trigger as HTMLAnchorElement);\n\n scroll = newCoords();\n let state = newState({\n url: href,\n transition: transitionName,\n data: { scroll },\n });\n\n !this.stickyScroll && (scroll = newCoords(0, 0));\n\n history.add(state);\n this.emitter.emit(\"HISTORY_NEW_ITEM\", event);\n }\n\n if (event) {\n event.stopPropagation();\n event.preventDefault();\n }\n\n this.emitter.emit(\"GO\", event);\n return this.load({\n oldHref: currentURL,\n href,\n trigger,\n transitionName,\n scroll,\n });\n }\n\n /** Load the new Page as well as a Transition; starts the Transition */\n public async load({\n oldHref,\n href,\n trigger,\n transitionName = \"default\",\n scroll = { x: 0, y: 0 },\n }: {\n oldHref: string;\n href: string;\n trigger: Trigger;\n transitionName?: string;\n scroll: { x: number; y: number };\n }): Promise {\n try {\n const pages = this.manager.get(\"PageManager\") as IPageManager;\n let newPage: IPage, oldPage: IPage;\n\n this.emitter.emit(\"NAVIGATION_START\", {\n oldHref,\n href,\n trigger,\n transitionName,\n });\n\n // Load & Build both the old and new pages\n try {\n this.transitionStart();\n oldPage = await pages.load(oldHref);\n !(oldPage.dom instanceof Element) && oldPage.build();\n\n this.emitter.emit(\"PAGE_LOADING\", { href, oldPage, trigger });\n newPage = await pages.load(href);\n await newPage.build();\n this.emitter.emit(\"PAGE_LOAD_COMPLETE\", {\n newPage,\n oldPage,\n trigger,\n });\n } catch (err) {\n throw `[PJAX] page load error: ${err}`;\n }\n\n // --\n // --\n\n // Start Transition\n try {\n const TransitionManager = this.manager.get(\"TransitionManager\") as ITransitionManager;\n this.emitter.emit(\"TRANSITION_START\", transitionName);\n\n let transition = await TransitionManager.animate(TransitionManager.has(transitionName) ? transitionName : \"default\", {\n oldPage,\n newPage,\n trigger,\n scroll,\n ignoreHashAction: this.ignoreHashAction\n });\n\n if (!transition.scrollable) {\n if (!this.ignoreHashAction && !/back|popstate|forward/.test(trigger as string)) scroll = hashAction(scroll);\n window.scroll(scroll.x, scroll.y);\n }\n\n this.emitter.emit(\"TRANSITION_END\", { transition });\n } catch (err) {\n throw `[PJAX] transition error: ${err}`;\n }\n\n this.emitter.emit(\"NAVIGATION_END\", {\n oldPage,\n newPage,\n trigger,\n transitionName,\n });\n } catch (err) {\n if (this.forceOnError) this.force(href);\n else console.warn(err);\n } finally {\n this.transitionStop(); // Sets isTransitioning to false\n }\n }\n\n /** Check to see if the URL is to be ignored, uses either RegExp of Strings to check */\n public ignoredURL({ pathname }: URL): boolean {\n return (\n this.ignoreURLs.length &&\n this.ignoreURLs.some((url) => {\n return typeof url === \"string\"\n ? url === pathname\n : (url as RegExp).exec(pathname) !== null;\n })\n );\n }\n\n /** When you hover over an anchor, prefetch the event target's href */\n public onHover(event: LinkEvent): Promise {\n let el = this.getLink(event);\n if (!el || !this.manager.has(\"PageManager\")) return;\n\n const pages = this.manager.get(\"PageManager\") as IPageManager;\n let url = newURL(this.getHref(el));\n let urlString: string = url.pathname;\n\n // If Url is ignored or already in cache, don't do any think\n if (this.ignoredURL(url) || pages.has(urlString)) return;\n this.emitter.emit(\"ANCHOR_HOVER HOVER\", event);\n\n try {\n pages.load(url);\n } catch (err) {\n console.warn(\"[PJAX] prefetch error,\", err);\n }\n }\n\n /** When History state changes, get url from State, go for a Transition. */\n public onStateChange(event: PopStateEvent): void {\n this.go({ href: window.location.href, trigger: \"popstate\", event });\n }\n\n /** Initialize DOM Events */\n public initEvents() {\n if (this.prefetchIgnore !== true) {\n document.addEventListener(\"mouseover\", this.onHover);\n document.addEventListener(\"touchstart\", this.onHover);\n }\n\n document.addEventListener(\"click\", this.onClick);\n window.addEventListener(\"popstate\", this.onStateChange);\n }\n\n /** Stop DOM Events */\n public stopEvents() {\n if (this.prefetchIgnore !== true) {\n document.removeEventListener(\"mouseover\", this.onHover);\n document.removeEventListener(\"touchstart\", this.onHover);\n }\n\n document.removeEventListener(\"click\", this.onClick);\n window.removeEventListener(\"popstate\", this.onStateChange);\n }\n}\n", "import { Service } from \"./service\";\nimport { Manager } from \"./manager\";\nimport { newURL, getHashedPath } from \"./url\";\nimport { IHistoryManager } from \"./history\";\n\nexport type RouteMethod = (...args: any) => any;\nexport type RouteStyle = string | RegExp | boolean;\nexport interface IRouteToFrom {\n to: RouteStyle,\n from: RouteStyle\n}\nexport type RoutePath = IRouteToFrom | RouteStyle;\nexport interface IRoute {\n path: RoutePath,\n method: RouteMethod\n}\n\n/** Controls what happens when certain url paths match a set of criteria */\nexport class Router extends Service {\n /** List of routes */\n protected routes: Manager;\n constructor(routes: IRoute[] = []) {\n super();\n this.routes = new Manager();\n for (let route of routes) {\n this.add(route);\n }\n }\n\n /** Add a new route to watch for */\n public add({ path, method }: IRoute): Router {\n let key = this.parse(path);\n this.routes.set(key, method);\n return this;\n }\n\n /** Convert strings into path match functions */\n public parsePath(path: RouteStyle): RegExp | boolean {\n if (typeof path === \"string\") return new RegExp(path, \"i\");\n else if (path instanceof RegExp || typeof path === \"boolean\")\n return path;\n throw \"[Router] only regular expressions, strings and booleans are accepted as paths.\";\n }\n\n /** Determines if a strings counts has a path */\n public isPath(input: RouteStyle): boolean {\n return (\n typeof input === \"string\" ||\n input instanceof RegExp ||\n typeof input === \"boolean\"\n );\n }\n\n /** Parse the multiple different formats for paths, into a { from, to } object */\n public parse(input: RoutePath): IRouteToFrom {\n let route = input as IRouteToFrom;\n let toFromPath: IRouteToFrom = {\n from: /(.*)/g,\n to: /(.*)/g,\n };\n\n if (this.isPath(input as RouteStyle))\n toFromPath = {\n from: true,\n to: input as RouteStyle,\n };\n else if (this.isPath(route.from) && this.isPath(route.to as RouteStyle))\n toFromPath = route;\n else\n throw \"[Router] path is neither a string, regular expression, or a { from, to } object.\";\n\n let { from, to } = toFromPath;\n return {\n from: this.parsePath(from),\n to: this.parsePath(to),\n };\n }\n\n /** Test if route paths are true, if so run their methods */\n public route() {\n if (this.manager.has(\"HistoryManager\")) {\n let history = this.manager.get(\"HistoryManager\") as IHistoryManager;\n let from: string = getHashedPath(newURL((history.length > 1 ? history.previous : history.current).url));\n let to: string = getHashedPath(newURL());\n\n this.routes.forEach((method: RouteMethod, path: IRouteToFrom) => {\n let fromRegExp = path.from as RegExp | boolean;\n let toRegExp = path.to as RegExp | boolean;\n\n if (\n typeof fromRegExp === \"boolean\" &&\n typeof toRegExp === \"boolean\"\n ) {\n throw `[Router] path ({ from: ${fromRegExp}, to: ${toRegExp} }) is not valid, remember paths can only be strings, regular expressions, or a boolean; however, both the from and to paths cannot be both booleans.`;\n }\n\n let fromParam: RegExpExecArray | RegExp | boolean = fromRegExp;\n let toParam: RegExpExecArray | RegExp | boolean = toRegExp;\n\n if (fromRegExp instanceof RegExp && fromRegExp.test(from))\n fromParam = fromRegExp.exec(from);\n if (toRegExp instanceof RegExp && toRegExp.test(to))\n toParam = toRegExp.exec(to);\n\n if (\n (Array.isArray(toParam) && Array.isArray(fromParam)) ||\n (Array.isArray(toParam) &&\n typeof fromParam == \"boolean\" &&\n fromParam) ||\n (Array.isArray(fromParam) &&\n typeof toParam == \"boolean\" &&\n toParam)\n )\n method({ from: fromParam, to: toParam, path: { from, to } });\n });\n } else {\n console.warn(\"[Route] HistoryManager is missing.\");\n }\n }\n\n /** Add listeners for PJAX Events */\n public initEvents() {\n this.emitter.on(\"READY\", this.route, this);\n this.emitter.on(\"CONTENT_REPLACED\", this.route, this);\n }\n\n /** Remove listeners for PJAX Events */\n public stopEvents() {\n this.emitter.off(\"READY\", this.route, this);\n this.emitter.off(\"CONTENT_REPLACED\", this.route, this);\n }\n}\n", "import { EventEmitter, EventInput, ListenerCallback } from \"@okikio/emitter\";\nimport { Manager } from \"@okikio/manager\";\n\n// DOM\nexport type AnimationTarget = string | Node | NodeList | HTMLCollection | HTMLElement[] | AnimationTarget[];\nexport const getElements = (selector: string | Node): Node[] => {\n return typeof selector === \"string\" ? Array.from(document.querySelectorAll(selector as string)) : [selector];\n};\n\nconst flatten = (arr: AnimationTarget[]) => [].concat(...arr);\nexport const getTargets = (targets: AnimationTarget): Node[] => {\n if (Array.isArray(targets)) {\n return flatten((targets as AnimationTarget[]).map(getTargets));\n }\n if (typeof targets == \"string\" || targets instanceof Node)\n return getElements(targets);\n if (targets instanceof NodeList || targets instanceof HTMLCollection)\n return Array.from(targets);\n return [];\n};\n\n// VALUES\nexport type closureArgs = [number, number, HTMLElement];\nexport type closure = ((index?: number, total?: number, element?: HTMLElement) => (genericTypes[] | void)) | any;\nexport const computeValue = (value: closure, args: closureArgs, context: Animate) => {\n if (typeof value === \"function\") {\n return value.apply(context, args);\n } else { return value; }\n};\n\nexport const mapObject = (obj: object, args: closureArgs, options: Animate): any => {\n let key: string, value: any, result = {};\n let keys = Object.keys(obj);\n for (let i = 0, len = keys.length; i < len; i++) {\n key = keys[i];\n value = obj[key];\n result[key] = computeValue(value, args, options);\n }\n\n return result;\n};\n\n/** From: [https://easings.net] */\nexport const easings = {\n \"in\": \"ease-in\",\n \"out\": \"ease-out\",\n \"in-out\": \"ease-in-out\",\n\n // Sine\n \"in-sine\": \"cubic-bezier(0.47, 0, 0.745, 0.715)\",\n \"out-sine\": \"cubic-bezier(0.39, 0.575, 0.565, 1)\",\n \"in-out-sine\": \"cubic-bezier(0.445, 0.05, 0.55, 0.95)\",\n\n // Quad\n \"in-quad\": \"cubic-bezier(0.55, 0.085, 0.68, 0.53)\",\n \"out-quad\": \"cubic-bezier(0.25, 0.46, 0.45, 0.94)\",\n \"in-out-quad\": \"cubic-bezier(0.455, 0.03, 0.515, 0.955)\",\n\n // Cubic\n \"in-cubic\": \"cubic-bezier(0.55, 0.055, 0.675, 0.19)\",\n \"out-cubic\": \"cubic-bezier(0.215, 0.61, 0.355, 1)\",\n \"in-out-cubic\": \"cubic-bezier(0.645, 0.045, 0.355, 1)\",\n\n // Quart\n \"in-quart\": \"cubic-bezier(0.895, 0.03, 0.685, 0.22)\",\n \"out-quart\": \"cubic-bezier(0.165, 0.84, 0.44, 1)\",\n \"in-out-quart\": \"cubic-bezier(0.77, 0, 0.175, 1)\",\n\n // Quint\n \"in-quint\": \"cubic-bezier(0.755, 0.05, 0.855, 0.06)\",\n \"out-quint\": \"cubic-bezier(0.23, 1, 0.32, 1)\",\n \"in-out-quint\": \"cubic-bezier(0.86, 0, 0.07, 1)\",\n\n // Expo\n \"in-expo\": \"cubic-bezier(0.95, 0.05, 0.795, 0.035)\",\n \"out-expo\": \"cubic-bezier(0.19, 1, 0.22, 1)\",\n \"in-out-expo\": \"cubic-bezier(1, 0, 0, 1)\",\n\n // Circ\n \"in-circ\": \"cubic-bezier(0.6, 0.04, 0.98, 0.335)\",\n \"out-circ\": \"cubic-bezier(0.075, 0.82, 0.165, 1)\",\n \"in-out-circ\": \"cubic-bezier(0.785, 0.135, 0.15, 0.86)\",\n\n // Back\n \"in-back\": \"cubic-bezier(0.6, -0.28, 0.735, 0.045)\",\n \"out-back\": \"cubic-bezier(0.175, 0.885, 0.32, 1.275)\",\n \"in-out-back\": \"cubic-bezier(0.68, -0.55, 0.265, 1.55)\"\n};\n\nexport const getEase = (ease: string) => {\n return /^(in|out)/.test(ease) ? easings[ease] : ease;\n};\n\nexport type genericTypes = genericTypes[] | boolean | object | string | number | closure | null | undefined;\nexport interface AnimationOptions {\n target?: AnimationTarget,\n\n speed?: number,\n autoplay?: boolean,\n options?: AnimationOptions,\n delay?: number | closure,\n easing?: string | closure,\n endDelay?: number | closure,\n duration?: number | closure,\n keyframes?: Keyframe[] | object[] | closure,\n loop?: number | boolean | closure, // iterations: number,\n onfinish?: (element?: HTMLElement, index?: number, total?: number, animation?: Animation) => any,\n fillMode?: \"none\" | \"forwards\" | \"backwards\" | \"both\" | \"auto\" | closure,\n direction?: \"normal\" | \"reverse\" | \"alternate\" | \"alternate-reverse\" | closure,\n extend?: EffectTiming,\n [property: string]: genericTypes;\n};\n\nexport const DefaultAnimationOptions: AnimationOptions = {\n keyframes: [],\n\n loop: 1, // iterations: number,\n delay: 0,\n speed: 1,\n endDelay: 0,\n easing: \"ease\",\n autoplay: true,\n duration: 1000,\n fillMode: \"auto\",\n direction: \"normal\",\n extend: {}\n};\n\nexport type AnimationEvents = \"update\" | \"play\" | \"pause\" | \"start\" | \"begin\" | \"complete\" | \"finish\" | \"error\" | \"stop\";\n\n/** You can check it out here: https://codepen.io/okikio/pen/qBbdGaW?editors=0011 */\nexport class Animate {\n /**\n * Stores the options for the current animation\n */\n public options: AnimationOptions = {};\n\n /**\n * The Array of Elements to Animate\n */\n public targets: Node[] = [];\n\n /**\n * The properties to animate\n */\n public properties: object = {};\n\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n\n /**\n * The total duration of all Animation's\n */\n public totalDuration: number = 0;\n\n /**\n * The smallest delay out of all Animation's\n */\n public minDelay: number = 0;\n\n /**\n * The options for individual animations\n */\n public computedOptions: Manager = new Manager();\n\n /**\n * The Element the main animation uses\n */\n public mainElement: HTMLElement;\n\n /**\n * Stores an animation that runs on the total duration of the all other Animations, and as such it's the main Animation\n */\n public mainAnimation: Animation;\n\n /**\n * Stores request frame calls\n */\n public animationFrame: number;\n\n /**\n * An event emitter\n */\n public emitter: EventEmitter = new EventEmitter();\n\n /**\n * Returns a promise that is fulfilled when the mainAnimation is finished\n */\n public promise: Promise;\n constructor(options: AnimationOptions = {}) {\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n\n /**\n * Returns a new Promise that is resolve when this.finish is called\n */\n public newPromise(): Promise {\n return new Promise((resolve, reject) => {\n /*\n Note that the `this` keyword is in an Array when it is resolved,\n this is due to Promises not wanting to resolve references,\n so, you can't resolve `this` directly, so, I chose to resolve `this` in an\n Array\n */\n this.on(\"complete\", () => resolve([this]));\n this.on(\"error\", err => reject(err));\n });\n }\n\n /**\n * Fulfills the this.promise Promise\n */\n public then(\n onFulfilled?: (value?: any) => any,\n onRejected?: (reason?: any) => any\n ): Animate {\n onFulfilled = onFulfilled?.bind(this);\n onRejected = onRejected?.bind(this);\n this.promise.then(onFulfilled, onRejected);\n return this;\n }\n\n /**\n * Catches error that occur in the this.promise Promise\n */\n public catch(onRejected: (reason?: any) => any): Animate {\n onRejected = onRejected?.bind(this);\n this.promise.catch(onRejected);\n return this;\n }\n\n /**\n * If you don't care if the this.promise Promise has either been rejected or resolved\n */\n public finally(onFinally: () => any): Animate {\n onFinally = onFinally?.bind(this);\n this.promise.finally(onFinally);\n return this;\n }\n\n /**\n * Represents an Animation Frame Loop\n */\n public loop(): void {\n this.stopLoop();\n this.emit(\"update\", this.getProgress(), this);\n this.animationFrame = window.requestAnimationFrame(this.loop);\n }\n\n /**\n * Cancels animation frame\n */\n public stopLoop() {\n window.cancelAnimationFrame(this.animationFrame);\n }\n\n /**\n * Calls a method that affects all animations including the mainAnimation; the method only allows the animation parameter\n */\n public all(method: (animation: Animation) => void) {\n method(this.mainAnimation);\n this.animations.forEach(animation => method(animation));\n return this;\n }\n\n /**\n * Register the begin event\n */\n protected beginEvent() {\n if (this.getProgress() == 0) {\n let timer: number | void = window.setTimeout(() => {\n this.emit(\"begin\", this);\n timer = window.clearTimeout(timer as number);\n }, this.minDelay);\n }\n }\n\n /**\n * Play Animation\n */\n public play(): Animate {\n let playstate = this.getPlayState();\n this.beginEvent();\n this.all(anim => anim.play());\n this.emit(\"play\", playstate, this);\n this.loop();\n return this;\n }\n\n /**\n * Pause Animation\n */\n public pause(): Animate {\n let playstate = this.getPlayState();\n this.all(anim => anim.pause());\n this.emit(\"pause\", playstate, this);\n this.stopLoop();\n this.animationFrame = undefined;\n return this;\n }\n\n /**\n * Reset all Animations\n */\n public reset() {\n this.setProgress(0);\n this.beginEvent();\n\n if (this.options.autoplay) this.play();\n else this.pause();\n return this;\n }\n\n /**\n * Cancels all Animations\n */\n public cancel() {\n this.all(anim => anim.cancel());\n this.stopLoop();\n return this;\n }\n\n /**\n * Force complete all Animations\n */\n public finish() {\n this.all(anim => anim.finish());\n this.stopLoop();\n return this;\n }\n\n /**\n * Cancels & Clears all Animations\n */\n public stop() {\n this.cancel();\n this.animations.clear();\n while (this.targets.length) this.targets.pop();\n this.mainElement = undefined;\n this.emit(\"stop\");\n }\n\n /**\n * Returns an Array of targets\n */\n public getTargets(): Node[] {\n return this.targets;\n }\n\n /**\n * Get a specific Animation from an Animate instance\n */\n public getAnimation(element: HTMLElement): Animation {\n return this.animations.get(element);\n }\n\n /**\n * Returns the timings of an Animation, given a target\n * E.g. { duration, endDelay, delay, iterations, iterationStart, direction, easing, fill, etc... }\n */\n public getTiming(target: HTMLElement | Animation): AnimationOptions & EffectTiming {\n let animation = target instanceof Animation ? target : this.getAnimation(target);\n let keyframeOptions = this.computedOptions.get(animation) ?? {};\n let timings = animation.effect?.getTiming() ?? {};\n let options = this.getOptions();\n\n return { ...DefaultAnimationOptions, ...options, ...timings, ...keyframeOptions };\n }\n\n /**\n * Returns the total duration of Animation\n */\n public getTotalDuration(): number {\n return this.totalDuration;\n }\n\n /**\n * Returns the current time of the Main Animation\n */\n public getCurrentTime(): number {\n return this.mainAnimation.currentTime;\n }\n\n /**\n * Returns the Animation progress as a fraction of the current time / duration * 100\n */\n public getProgress() {\n return (this.getCurrentTime() / this.totalDuration) * 100;\n }\n\n /**\n * Return the playback speed of the animation\n */\n public getSpeed(): number {\n return this.mainAnimation.playbackRate;\n }\n\n /**\n * Returns the current playing state\n */\n public getPlayState(): \"idle\" | \"running\" | \"paused\" | \"finished\" {\n return this.mainAnimation.playState;\n }\n\n /**\n * Get the options of an Animate instance\n */\n public getOptions(): AnimationOptions {\n return this.options;\n }\n\n /**\n * Set the current time of the Main Animation\n */\n public setCurrentTime(time: number): Animate {\n this.all(anim => { anim.currentTime = time; });\n this.emit(\"update\", this.getProgress());\n return this;\n }\n\n /**\n * Set the Animation progress as a value from 0 to 100\n */\n public setProgress(percent: number): Animate {\n let time = (percent / 100) * this.totalDuration;\n this.setCurrentTime(time);\n return this;\n }\n\n /**\n * Set the playback speed of an Animation\n */\n public setSpeed(speed: number = 1): Animate {\n this.all(anim => { anim.playbackRate = speed; });\n return this;\n }\n\n /**\n * Adds a listener for a given event\n */\n public on(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.on(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Removes a listener from an event\n */\n public off(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.off(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Call all listeners within an event\n */\n public emit(events: AnimationEvents | string | any[], ...args: any): Animate {\n this.emitter.emit(events, ...args);\n return this;\n }\n\n\n /** Returns the Animate options, as JSON */\n public toJSON(): AnimationOptions {\n return this.getOptions();\n }\n\n /**\n * The Symbol.toStringTag well-known symbol is a string valued property that is used\n * in the creation of the default string description of an object.\n * It is accessed internally by the Object.prototype.toString() method.\n */\n get [Symbol.toStringTag]() {\n return `Animate`;\n }\n}\n\n/** Creates a new Animate instance */\nexport const animate = (options: AnimationOptions = {}): Animate => {\n return new Animate(options);\n};\n\nexport default animate;"], - "mappings": "8GAAA,8qBCcO,GAAM,GAA2B,CACpC,YAAa,UACb,eAAgB,eAChB,eAAgB,cAChB,QAAS,CACL,CAAC,YAAa,SAElB,gBAAiB,iBACjB,eAAgB,gBAChB,eAAgB,aAChB,UAAW,QACX,QAAS,KAIA,EAAY,AAAC,GACf,OAAO,OAAO,IAAK,GAAmB,GAIpC,EAAS,CAAC,EAAiB,EAAe,EAAoB,KAAiB,CACxF,GAAI,CAAE,UAAW,EACb,EAAO,OAAO,EAAS,IAAM,EAAS,MAAM,IAChD,MAAO,GAAW,IAAI,KAAU,GAIvB,EAAY,CAAC,EAAiB,EAAoB,EAAoB,KAAc,CAC7F,GAAI,MAAO,IAAU,SACjB,MAAO,GAEX,GAAI,GAAO,EAAO,GAClB,MAAI,OAAO,IAAS,SACT,EAAO,EAAQ,EAAM,GACzB,GC/CJ,WAAoB,CAG1B,YAAY,EAAuB,CAClC,KAAK,IAAM,GAAI,KAAI,GAIb,QAAoB,CAC1B,MAAO,MAAK,IAIN,IAAI,EAAW,CACrB,MAAO,MAAK,IAAI,IAAI,GAId,MAAiB,CACvB,MAAO,OAAM,KAAK,KAAK,IAAI,QAIrB,QAAmB,CACzB,MAAO,OAAM,KAAK,KAAK,IAAI,UAIrB,IAAI,EAAQ,EAAyB,CAC3C,YAAK,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port * from \"./history\";\nexport * from \"./page\";\n\nexport * from \"./emitter\";\nexport * from \"./service\";\n\nexport * from \"./transition\";\n\nexport * from \"./app\";\nexport * from \"./pjax\";\nexport * from \"./router\";\n\nexport * from \"./animate\";\n", "export interface ICONFIG {\n prefix?: string;\n wrapperAttr?: string;\n noAjaxLinkAttr?: string;\n noPrefetchAttr?: \"no-prefetch\";\n headers?: string[][];\n preventSelfAttr?: string;\n preventAllAttr?: string;\n transitionAttr?: string;\n blockAttr?: string;\n timeout?: number;\n maxPages?: number;\n [key: string]: any;\n}\n\nexport const CONFIG_DEFAULTS = {\n wrapperAttr: \"wrapper\",\n noAjaxLinkAttr: \"no-ajax-link\",\n noPrefetchAttr: \"no-prefetch\",\n headers: [\n [\"x-partial\", \"true\"]\n ],\n preventSelfAttr: `prevent=\"self\"`,\n preventAllAttr: `prevent=\"all\"`,\n transitionAttr: \"transition\",\n blockAttr: `block`,\n timeout: 30000,\n maxPages: 5\n};\n\nexport type ConfigKeys = keyof typeof CONFIG_DEFAULTS | string;\nexport const newConfig = (config: ICONFIG): ICONFIG => {\n return Object.assign({ ...CONFIG_DEFAULTS }, config);\n};\n\n/** Converts string into properly formatted data attributes */\nexport const toAttr = (config: ICONFIG, value: string, brackets: boolean = true): string => {\n let { prefix } = config;\n let attr = `data${prefix ? \"-\" + prefix : \"\"}-${value}`;\n return brackets ? `[${attr}]` : attr;\n};\n\n/** Selects config vars, and formats them for use, or simply returns the current configurations for the framework */\nexport const getConfig = (config: ICONFIG, value?: ConfigKeys, brackets: boolean = true): any => {\n if (typeof value !== \"string\")\n return config;\n\n let prop = config[value];\n if (typeof prop === \"string\")\n return toAttr(config, prop, brackets);\n return prop;\n};\n", "/** Manages complex lists of named data, eg. A page can be stored in a list by of other pages with the url being how the page is stored in the list. Managers use Maps to store data */\nexport class Manager {\n\t/** The complex list of named data, to which the Manager controls */\n\tpublic map: Map;\n\tconstructor(value?: Array<[K, V]>) {\n\t\tthis.map = new Map(value);\n\t}\n\n\t/** Returns the Manager classes base Map */\n\tpublic getMap(): Map {\n\t\treturn this.map;\n\t}\n\n\t/** Get a value stored in the Manager */\n\tpublic get(key: K): V {\n\t\treturn this.map.get(key);\n\t}\n\n\t/** Returns the keys of all items stored in the Manager as an Array */\n\tpublic keys(): Array {\n\t\treturn Array.from(this.map.keys());\n\t}\n\n\t/** Returns the values of all items stored in the Manager as an Array */\n\tpublic values(): Array {\n\t\treturn Array.from(this.map.values());\n\t}\n\n\t/** Set a value to the Manager using a key */\n\tpublic set(key: K, value: V): Manager {\n\t\tthis.map.set(key, value);\n\t\treturn this;\n\t}\n\n\t/** Adds a value to Manager, and uses the current size of the Manager as it's key, it works best when all the key in the Manager are numbers */\n\tpublic add(value: V): Manager {\n\t\tlet size = this.size;\n\t\t// @ts-ignore\n\t\tlet num: K = size as K;\n\t\tthis.set(num, value);\n\t\treturn this;\n\t}\n\n\t/** Returns the total number of items stored in the Manager */\n\tpublic get size(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** An alias for size */\n\tpublic get length(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** Returns the last item in the Manager who's index is a certain distance from the last item in the Manager */\n\tpublic last(distance: number = 1): V | undefined {\n\t\tlet key = this.keys()[this.size - distance];\n\t\treturn this.get(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns true if an element in the Map object existed and has been removed, or false if the element does not exist */\n\tpublic delete(key: K): boolean {\n\t\treturn this.map.delete(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns the Manager class, allowing for chains */\n\tpublic remove(key: K): Manager {\n\t\tthis.map.delete(key);\n\t\treturn this;\n\t}\n\n\t/** Clear the Manager of all its contents */\n\tpublic clear(): Manager {\n\t\tthis.map.clear();\n\t\treturn this;\n\t}\n\n\t/** Checks if the Manager contains a certain key */\n\tpublic has(key: K): boolean {\n\t\treturn this.map.has(key);\n\t}\n\n\t/** Returns a new Iterator object that contains an array of [key, value] for each element in the Map object in insertion order. */\n\tpublic entries(): IterableIterator<[K, V]> {\n\t\treturn this.map.entries();\n\t}\n\n\t/** Iterates through the Managers contents, calling a callback function every iteration */\n\tpublic forEach(\n\t\tcallback: (value?: V, key?: K, map?: Map) => void,\n\t\tcontext?: object\n\t): Manager {\n\t\tthis.map.forEach(callback, context);\n\t\treturn this;\n\t}\n\n\t/** Allows for iteration via for..of, learn more: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators] */\n\tpublic [Symbol.iterator](): IterableIterator<[K, V]> {\n\t\treturn this.entries();\n\t}\n}\n\n/**\n * Calls the method of a certain name for all items that are currently installed\n */\nexport const methodCall = (manager: Manager, method: string, ...args: any): void => {\n\tmanager.forEach((item) => {\n\t\t// @ts-ignore\n\t\titem[method](...args);\n\t});\n};\n\n/**\n * Asynchronously calls the method of a certain name for all items that are currently installed, similar to methodCall\n */\nexport const asyncMethodCall = async (manager: Manager, method: string, ...args: any): Promise => {\n\tfor (let [, item] of manager) {\n\t\t// @ts-ignore\n\t\tawait item[method](...args);\n\t}\n};\n\nexport default Manager;\n", "import { Manager, methodCall, asyncMethodCall } from \"@okikio/manager\";\nimport { ICONFIG } from \"./config\";\nimport { IApp } from \"./app\";\nimport { EventEmitter } from \"./emitter\";\n\nexport type IAdvancedManager = AdvancedManager;\n\n/** The base class for AdvancedManager items */\nexport class ManagerItem {\n /** The AdvancedManager the ManagerItem is attached to */\n public manager: IAdvancedManager;\n\n /** The App the ManagerItem is attached to */\n public app: IApp;\n\n /** The Config of the App the ManagerItem is attached to */\n public config: ICONFIG;\n\n /** The EventEmitter of the App the ManagerItem is attached to */\n public emitter: EventEmitter;\n\n /** The key to where ManagerItem is stored in an AdvancedManager */\n public key: any;\n\n constructor() { }\n\n /** Run after the Manager Item has been registered */\n public install(): any { }\n\n /** Register the current Manager Item's manager */\n public register(manager: IAdvancedManager, key: any): ManagerItem {\n this.manager = manager;\n this.app = manager.app;\n this.config = manager.config;\n this.emitter = manager.emitter;\n this.key = key;\n this.install();\n return this;\n }\n\n /** Run before the ManagerItem has been unregistered */\n public uninstall(): any { }\n\n /** Basically removes a ManagerItem, in order to recover the ManagerItem, it needs to be re-added to an AdvancedManager */\n public unregister() {\n this.uninstall();\n\n this.manager.remove(this.key);\n this.key = undefined;\n this.manager = undefined;\n this.app = undefined;\n this.config = undefined;\n this.emitter = undefined;\n }\n}\n\n/** A tweak to the Manager class that makes it self aware of the App class it's instantiated in */\nexport class AdvancedManager extends Manager {\n /** The App the AdvancedManager is attached to */\n public app: IApp;\n\n /** The Config of the App the AdvancedManager is attached to */\n public config: ICONFIG;\n\n /** The EventEmitter of the App the AdvancedManager is attached to */\n public emitter: EventEmitter;\n\n /** Register App details */\n constructor(app: IApp) {\n super();\n this.app = app;\n this.config = app.config;\n this.emitter = app.emitter;\n }\n\n /** Add a ManagerItem to AdvancedManager at a specified key */\n public set(key: K, value: V) {\n super.set(key, value);\n value.register(this, key);\n return this;\n }\n}\n\nexport { Manager, methodCall, asyncMethodCall };\n", "export const newURL = (url: string | URL | Location = window.location.href): URL => {\n return url instanceof URL ? url : new URL(url as unknown as string, window.location.origin);\n};\n\n/** Returns the pathname with the hash at the end */\nexport const getHashedPath = (url: URL | string): string => {\n let _url = newURL(url);\n return `${_url.pathname}${_url.hash}`;\n};\n\n/** Returns the actual hash without the hashtag */\nexport const getHash = (url: URL | string): string => newURL(url).hash.slice(1);\n\n/** Removes the hash from the full URL for a clean URL string */\nexport const clean = (url: URL | string): string => newURL(url).toString().replace(/(\\/#.*|\\/|#.*)$/, '');\n\n/** Compares two URLs to each other */\nexport const equal = (a: URL | string, b: URL | string): boolean => (clean(a) === clean(b));\n\n", "import { AdvancedManager, ManagerItem, methodCall } from \"./manager\";\nimport { IApp } from \"./app\";\n\n/** Controls specific kinds of actions that require JS */\nexport class Service extends ManagerItem {\n\t/** Called before the start of a Service, represents a constructor of sorts */\n\tpublic init(...args: any): any;\n\tpublic init(): any { }\n\n\t/** Called on start of Service */\n\tpublic boot(...args: any): any;\n\tpublic boot(): any {\n\t\tthis.initEvents();\n\t}\n\n\t/** Initialize events */\n\tpublic initEvents(): void { }\n\n\t/** Stop events */\n\tpublic stopEvents(): void { }\n\n\t/** Stop services */\n\tpublic stop(): void {\n\t\tthis.stopEvents();\n\t\tthis.unregister();\n\t}\n}\n\n/** The Service Manager controls the lifecycle of all Services in an App */\nexport class ServiceManager extends AdvancedManager {\n\tconstructor(app: IApp) {\n\t\tsuper(app);\n\t}\n\n\t/** Call the init method for all Services */\n\tpublic init(): ServiceManager {\n\t\tmethodCall(this, \"init\");\n\t\treturn this;\n\t}\n\n\t/** Call the boot method for all Services */\n\tpublic boot(): ServiceManager {\n\t\tmethodCall(this, \"boot\");\n\t\treturn this;\n\t}\n\n\t/** Call the stop method for all Services */\n\tpublic stop(): ServiceManager {\n\t\tmethodCall(this, \"stop\");\n\t\treturn this;\n\t}\n}\n", "import { Service } from \"./service\";\nimport { getHashedPath, newURL } from \"./url\";\n\nexport type Trigger = HTMLAnchorElement | \"HistoryManager\" | \"popstate\" | \"back\" | \"forward\";\nexport interface ICoords {\n\treadonly x: number;\n\treadonly y: number;\n}\n\nexport interface IStateData {\n\tscroll: ICoords;\n\t[key: string]: any;\n}\n\nexport interface IState {\n\turl: string;\n\tindex?: number;\n\ttransition: string;\n\tdata: IStateData;\n}\n\nexport interface IHistoryItem {\n\tindex: number;\n\tstates: IState[];\n}\n\nexport interface IHistoryManager extends Service {\n\tstates: IState[],\n\tpointer: number,\n\n\tinit(): any,\n\tget(index: number): IState,\n\tadd(value?: IState, historyAction?: \"replace\" | \"push\"): HistoryManager,\n\tremove(index?: number): HistoryManager,\n\treplace(newStates: IState[]): HistoryManager,\n\tset(i: number, state: IState): IState,\n\tcurrent: IState,\n\tlast: IState,\n\tprevious: IState | null,\n\tlength: number,\n}\n\n/** A quick snapshot of page scroll coordinates */\nexport const newCoords = (x: number = window.scrollX, y: number = window.scrollY): ICoords => ({ x, y });\n\n/** Creates a state; a state represents the current status of the page consisting of properties like: url, transition, and data */\nexport const newState = (state: IState = {\n\turl: getHashedPath(newURL()),\n\tindex: 0,\n\ttransition: \"default\",\n\tdata: {\n\t\tscroll: newCoords(),\n\t\ttrigger: \"HistoryManager\"\n\t}\n}): IState => (state);\n\n/** Keeps a record of the history of the App; it stores only the states of Pages */\nexport class HistoryManager extends Service implements IHistoryManager {\n\tpublic states: IState[];\n\tpublic pointer = -1;\n\n\t/** Initializes the states array, and replace the history pushState data with the states array */\n\tinit() {\n\t\tthis.states = [];\n\n\t\tlet state = newState();\n\t\tthis.add(state, \"replace\");\n\t}\n\n\t/** Get a state based on it's index */\n\tpublic get(index: number) {\n\t\treturn this.states[index];\n\t}\n\n\t/** Add a state to HistoryManager and change the history pushState data based on the historyAction specified */\n\tpublic add(value?: IState, historyAction: \"replace\" | \"push\" = \"push\"): HistoryManager {\n\t\tlet state = newState(value);\n\t\tlet len = this.length;\n\t\tthis.states.push({ ...state });\n\t\tthis.pointer = len;\n\n\t\tlet item: IHistoryItem = {\n\t\t\tindex: this.pointer,\n\t\t\tstates: [...this.states]\n\t\t};\n\t\tchangeState(historyAction, state, item);\n\t\treturn this;\n\t}\n\n\tpublic remove(index?: number) {\n\t\tif (index) {\n\t\t\tthis.states.splice(index, 1);\n\t\t} else {\n\t\t\tthis.states.pop();\n\t\t}\n\n\t\tthis.pointer--;\n\t\treturn this;\n\t}\n\n\t/** Replaces the states array with another states array, this is later used when going back and forward in page history */\n\tpublic replace(newStates: IState[]) {\n\t\tthis.states = newStates;\n\t\treturn this;\n\t}\n\n\t/** Set state by index. */\n\tpublic set(i: number, state: IState) {\n\t\treturn (this.states[i] = state);\n\t}\n\n\t/** Get the current state */\n\tget current(): IState {\n\t\treturn this.get(this.pointer);\n\t}\n\n\t/** Get the last state (top of the history stack). */\n\tget last(): IState {\n\t\treturn this.get(this.length - 1);\n\t}\n\n\t/** Get the previous state. */\n\tget previous(): IState | null {\n\t\treturn this.pointer < 1 ? null : this.get(this.pointer - 1);\n\t}\n\n\tget length() {\n\t\treturn this.states.length;\n\t}\n}\n\n/** Either push or replace history state */\nexport const changeState = (action: \"push\" | \"replace\", state: IState, item: object) => {\n\tlet href = getHashedPath(state.url);\n\tlet args = [item, \"\", href];\n\tif (window.history) {\n\t\tswitch (action) {\n\t\t\tcase \"push\":\n\t\t\t\twindow.history.pushState.apply(window.history, args);\n\t\t\t\tbreak;\n\t\t\tcase \"replace\":\n\t\t\t\twindow.history.replaceState.apply(window.history, args);\n\t\t\t\tbreak;\n\t\t}\n\t}\n};\n", "import { Manager, ManagerItem, AdvancedManager } from \"./manager\";\nimport { equal, newURL } from \"./url\";\nimport { getConfig } from \"./config\";\nimport { Service } from \"./service\";\n\nexport interface IPage extends ManagerItem {\n dom: Document,\n wrapper: HTMLElement,\n title: string,\n head: Element,\n body: Element,\n url: URL,\n data: string,\n wrapperAttr: string,\n\n build(): any,\n install(): void,\n uninstall(): any,\n}\n\n/**\n * Parses strings to DOM\n */\nexport const PARSER: DOMParser = new DOMParser();\n\n/** A page represents the DOM elements that create each page */\nexport class Page extends ManagerItem implements IPage {\n /** Holds the DOM of the current page */\n public dom: Document;\n\n /** Holds the wrapper element to be swapped out of each Page */\n public wrapper: HTMLElement;\n\n /** Holds the title of each page */\n public title: string;\n\n /** Holds the head element of each page */\n public head: Element;\n\n /** Holds the body element of each page */\n public body: Element;\n\n /** The URL of the current page */\n public url: URL;\n\n /** The payload of a page request */\n public data: string;\n\n /** Attr that identifies the wrapper */\n public wrapperAttr: string;\n\n constructor(url: URL = newURL(), dom: string | Document = document) {\n super();\n this.url = url;\n\n if (typeof dom === \"string\") {\n this.data = dom;\n } else this.dom = dom || document;\n }\n\n /** Builds the page's dom, and sets the title, head, body, and wrapper properties of the Page class */\n public build() {\n if (!(this.dom instanceof Node)) {\n this.dom = PARSER.parseFromString(this.data, \"text/html\");\n }\n\n if (!(this.body instanceof Node)) {\n let { title, head, body } = this.dom;\n this.title = title;\n this.head = head;\n this.body = body;\n this.wrapper = this.body.querySelector(this.wrapperAttr);\n }\n }\n\n public install() {\n this.wrapperAttr = getConfig(this.config, \"wrapperAttr\");\n }\n\n public uninstall() {\n this.url = undefined;\n this.title = undefined;\n this.head = undefined;\n this.body = undefined;\n this.dom = undefined;\n this.wrapper = undefined;\n this.data = undefined;\n this.wrapperAttr = undefined;\n }\n}\n\nexport interface IPageManager extends Service {\n loading: Manager>,\n pages: AdvancedManager;\n\n install(): any,\n\n get(key): Page,\n add(value): PageManager,\n set(key, value): PageManager,\n remove(key): PageManager,\n has(key): boolean,\n clear(): PageManager,\n size: number,\n keys(): any[],\n\n load(_url: URL | string): Promise,\n request(url: string): Promise,\n}\n\n/** Controls which page to load */\nexport class PageManager extends Service implements IPageManager {\n /** Stores all fetch requests that are currently loading */\n public loading: Manager> = new Manager();\n\n pages: AdvancedManager;\n\n /** Instantiate pages, and add the current page to pages */\n install() {\n this.pages = new AdvancedManager(this.app);\n\n let URLString = newURL().pathname;\n this.set(URLString, new Page());\n URLString = undefined;\n }\n\n get(key) { return this.pages.get(key); }\n add(value) { this.pages.add(value); return this; }\n set(key, value) { this.pages.set(key, value); return this; }\n remove(key) { this.pages.remove(key); return this; }\n has(key) { return this.pages.has(key); }\n clear() { this.pages.clear(); return this; }\n get size() { return this.pages.size; }\n keys() { return this.pages.keys(); }\n\n /** Load from cache or by requesting URL via a fetch request, avoid requesting for the same thing twice by storing the fetch request in \"this.loading\" */\n public async load(_url: URL | string = newURL()): Promise {\n let url: URL = newURL(_url);\n let urlString: string = url.pathname;\n let page: Page, request: Promise;\n\n if (this.has(urlString)) {\n page = this.get(urlString);\n return Promise.resolve(page);\n }\n\n if (!this.loading.has(urlString)) {\n request = this.request(urlString);\n this.loading.set(urlString, request);\n } else request = this.loading.get(urlString);\n\n let response = await request;\n this.loading.remove(urlString);\n\n page = new Page(url, response);\n this.set(urlString, page);\n\n if (this.size > getConfig(this.config, \"maxPages\")) {\n let currentUrl = newURL();\n let keys = this.keys();\n let first = equal(currentUrl, keys[0]) ? keys[1] : keys[0];\n let page = this.get(first);\n page.unregister();\n page = undefined;\n keys = undefined;\n currentUrl = undefined;\n first = undefined;\n }\n\n return page;\n }\n\n /** Starts a fetch request */\n public async request(url: string): Promise {\n const headers = new Headers(getConfig(this.config, \"headers\"));\n const timeout = window.setTimeout(() => {\n window.clearTimeout(timeout);\n throw \"Request Timed Out!\";\n }, getConfig(this.config, \"timeout\"));\n\n try {\n let response = await fetch(url, {\n mode: 'same-origin',\n method: \"GET\",\n headers,\n cache: \"default\",\n credentials: \"same-origin\",\n });\n\n window.clearTimeout(timeout);\n if (response.status >= 200 && response.status < 300) {\n return await response.text();\n }\n\n const err = new Error(response.statusText || \"\" + response.status);\n throw err;\n } catch (err) {\n window.clearTimeout(timeout);\n throw err;\n }\n }\n}\n", "import { Manager, methodCall } from \"@okikio/manager\";\n\nexport type ListenerCallback = ((...args: any) => void);\nexport interface IListener {\n readonly callback: ListenerCallback;\n readonly scope: object;\n readonly name: string;\n}\n\n/** Represents a new event listener consisting of properties like: callback, scope, name */\nexport const newListener = ({\n callback = () => { },\n scope = null,\n name = \"event\",\n}: IListener): IListener => ({ callback, scope, name });\n\n/** Represents a new event */\nexport class Event extends Manager {\n /** The name of the event */\n public name: string;\n constructor(name: string = \"event\") {\n super();\n this.name = name;\n }\n}\n\nexport type EventInput = string | object | Array;\n\n/**\n * An Event Emitter\n * */\nexport class EventEmitter extends Manager {\n constructor() {\n super();\n }\n\n /** Gets event, if event doesn't exist create a new one */\n public getEvent(name: string): Event {\n let event = this.get(name);\n if (!(event instanceof Event)) {\n this.set(name, new Event(name));\n return this.get(name);\n }\n\n return event;\n }\n\n /** Creates a listener and adds it to an event */\n public newListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event = this.getEvent(name);\n event.add(newListener({ name, callback, scope }));\n return event;\n }\n\n /** Adds a listener to a given event */\n public on(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n this.newListener(_name, _callback, _scope);\n }, this);\n return this;\n }\n\n /** Removes a listener from an event */\n public removeListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event: Event = this.get(name);\n if (event instanceof Event && callback) {\n let listener = newListener({ name, callback, scope });\n\n event.forEach((value: IListener, i: number) => {\n if (\n value.callback === listener.callback &&\n value.scope === listener.scope\n ) {\n return event.remove(i);\n }\n });\n }\n\n return event;\n }\n\n /** Remove a listener from a given event, or just completely remove an event */\n public off(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n if (typeof _callback === \"function\") {\n this.removeListener(_name, _callback, _scope);\n } else this.remove(_name);\n }, this);\n return this;\n }\n\n /** Call all listeners within an event */\n public emit(\n events: string | Array,\n ...args: any\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n // Loop through the list of events\n events.forEach((event: string) => {\n let _event: Event = this.get(event);\n\n if (_event instanceof Event) {\n _event.forEach((listener: IListener) => {\n let { callback, scope } = listener;\n callback.apply(scope, args);\n });\n }\n }, this);\n return this;\n }\n\n /** Clears events and event listeners */\n public clear() {\n methodCall(this, \"clear\");\n super.clear();\n return this;\n }\n}\n\nexport default EventEmitter;\n", "import { Manager } from \"./manager\";\nimport { ICoords, newCoords, Trigger } from \"./history\";\nimport { IPage } from \"./page\";\nimport { getConfig } from \"./config\";\nimport { Service } from \"./service\";\nimport { newURL } from \"./url\";\n\n/**\n * The async function type, allows for smooth transition between Promises\n */\nexport type asyncFn = (err?: any, value?: any) => void;\nexport interface ITransition {\n oldPage?: IPage;\n newPage?: IPage;\n trigger?: Trigger;\n scroll?: { x: number; y: number };\n scrollable?: boolean;\n in: (data: ITransitionData) => any;\n out: (data: ITransitionData) => any;\n [key: string]: any;\n}\nexport interface ITransitionData {\n from?: IPage;\n to?: IPage;\n trigger?: Trigger;\n scroll?: ICoords;\n done: asyncFn;\n}\nexport interface ITransitionManager extends Service {\n transitions: Manager,\n\n get(key: string): ITransition,\n set(key: string, value: ITransition): TransitionManager,\n add(value: ITransition): TransitionManager,\n has(key: string): boolean,\n\n boot(): any,\n animate(name: string, data: any): Promise,\n}\n\n/** Auto scrolls to an elements position if the element has an hash */\nexport const hashAction = (coords?: ICoords, hash: string = window.location.hash) => {\n try {\n let _hash = hash[0] == \"#\" ? hash : newURL(hash).hash;\n if (_hash.length > 1) {\n let el = document.getElementById(_hash.slice(1));\n if (el) {\n let { left, top } = el.getBoundingClientRect();\n let scrollLeft = window.pageXOffset;\n let scrollTop = window.pageYOffset;\n let x = left + scrollLeft;\n let y = top + scrollTop;\n\n console.log(x, y);\n return newCoords(x, y);\n }\n }\n } catch (e) {\n console.warn(\"[hashAction] error\", e);\n }\n\n return coords ?? newCoords(0, 0);\n};\n\n// The Default Transition\nconst Default: ITransition = {\n name: \"default\",\n scrollable: true,\n\n out({ done }: ITransitionData) {\n done();\n },\n in({ scroll, done }: ITransitionData) {\n window.scroll(scroll.x, scroll.y);\n done();\n }\n};\n\n/** Controls which Transition between pages to use */\nexport class TransitionManager extends Service implements ITransitionManager {\n transitions: Manager;\n private _arg: Array<[string, ITransition]>;\n constructor(transitions?: Array<[string, ITransition]>) {\n super();\n this._arg = transitions;\n }\n\n /** On Service install set Config */\n public install() {\n super.install();\n\n let transitions = this._arg && this._arg.length ? this._arg : (getConfig(this.config, \"transitions\") ?? []);\n\n // Manager like Maps use the most recent [key, value] Array it knows, replacing the default transition\n // With any other transitions called [\"default\", ...]\n transitions = [[\"default\", Default]].concat(transitions);\n this.transitions = new Manager(transitions);\n }\n\n get(key: string) { return this.transitions.get(key); }\n set(key: string, value: ITransition) { this.transitions.set(key, value); return this; }\n add(value: ITransition) { this.transitions.add(value); return this; }\n has(key: string) { return this.transitions.has(key); }\n\n /** Starts a transition */\n public async animate(name: string, data: any): Promise {\n let transition: ITransition = this.transitions.get(name);\n let scroll = data.scroll;\n let ignoreHashAction = data.ignoreHashAction;\n if (!(\"wrapper\" in data.oldPage) || !(\"wrapper\" in data.newPage))\n throw `[Page] either oldPage or newPage aren't instances of the Page Class.\\n ${{\n newPage: data.newPage,\n oldPage: data.oldPage,\n }}`;\n\n // Replace the title\n document.title = `` + data.newPage.title;\n\n let fromWrapper = data.oldPage.wrapper;\n let toWrapper = data.newPage.wrapper;\n\n if (!(fromWrapper instanceof Node) || !(toWrapper instanceof Node))\n throw `[Wrapper] the wrapper from the ${!(toWrapper instanceof Node) ? \"next\" : \"current\"\n } page cannot be found. The wrapper must be an element that has the attribute ${getConfig(this.config,\n \"wrapperAttr\"\n )}.`;\n\n // Give the Transition all the background data it may require\n transition.init && transition?.init(data);\n\n this.emitter.emit(\"BEFORE_TRANSITION_OUT\");\n\n // Start the out point of the Transition\n if (transition.out) {\n await new Promise((done) => {\n let outMethod: Promise = transition.out.call(transition, {\n ...data,\n from: data.oldPage,\n trigger: data.trigger,\n done,\n });\n\n outMethod?.then(done);\n });\n }\n\n this.emitter.emit(\"AFTER_TRANSITION_OUT\");\n\n // Add the new wrapper before the old one\n await new Promise((done) => {\n fromWrapper.insertAdjacentElement(\"beforebegin\", toWrapper);\n this.emitter.emit(\"CONTENT_INSERT\");\n\n if (!ignoreHashAction && !/back|popstate|forward/.test(data.trigger as string)) {\n scroll = hashAction(scroll);\n }\n done();\n });\n\n // Replace the old wrapper with the new one\n await new Promise((done) => {\n fromWrapper.remove();\n fromWrapper = undefined;\n toWrapper = undefined;\n this.emitter.emit(\"CONTENT_REPLACED\");\n done();\n });\n\n this.emitter.emit(\"BEFORE_TRANSITION_IN\");\n\n // Start the in point of the Transition (only the in method has access to the hashAction's scroll position)\n if (transition.in) {\n await new Promise(async (done) => {\n let inMethod: Promise = transition.in.call(transition, {\n ...data,\n from: data.oldPage,\n to: data.newPage,\n trigger: data.trigger,\n scroll,\n done,\n });\n\n inMethod?.then(done);\n });\n }\n\n this.emitter.emit(\"AFTER_TRANSITION_IN\");\n return transition;\n }\n}\n", "import { EventEmitter, ListenerCallback, EventInput } from \"./emitter\";\nimport { ServiceManager, Service } from \"./service\";\nimport { newConfig, ICONFIG } from \"./config\";\n\nexport interface IApp {\n services: ServiceManager,\n emitter: EventEmitter,\n config: ICONFIG,\n register(config: ICONFIG): App,\n get(key: string): Service,\n set(key: string, service: Service): App,\n add(value: Service): App,\n boot(): App,\n stop(): App,\n on(events: EventInput, callback?: ListenerCallback): App,\n off(events: EventInput, callback?: ListenerCallback): App,\n emit(events: string | any[], ...args: any): App,\n}\n\n/** The App class starts the entire process, it controls all managers and all services */\nexport class App implements IApp {\n /** An instance of the ServiceManager */\n public services: ServiceManager;\n\n /** An instance of an EventEmitter */\n public emitter: EventEmitter;\n\n /** The current Configuration's for the App */\n public config: ICONFIG;\n constructor(config: object = {}) {\n this.register(config);\n }\n\n /** Create new instances of the ServiceManager, EventEmitter and the configurations */\n public register(config: ICONFIG = {}): App {\n this.config = newConfig(config);\n this.emitter = new EventEmitter();\n this.services = new ServiceManager(this);\n\n let handler = (() => {\n document.removeEventListener(\"DOMContentLoaded\", handler);\n window.removeEventListener(\"load\", handler);\n this.emitter.emit(\"READY ready\");\n }).bind(this);\n\n document.addEventListener(\"DOMContentLoaded\", handler);\n window.addEventListener(\"load\", handler);\n return this;\n }\n\n /** Shortcuts to adding, setting, and getting Services */\n public get(key: string): Service {\n return this.services.get(key);\n }\n\n public set(key: string, value: Service): App {\n this.services.set(key, value);\n return this;\n }\n\n public add(value: Service): App {\n this.services.add(value);\n return this;\n }\n\n /** Initialize and boot all Services */\n public boot(): App {\n this.services.init();\n this.services.boot();\n return this;\n }\n\n /** Stops all Services and clears the even emitter of all events and listeners */\n public stop(): App {\n this.services.stop();\n this.emitter.clear();\n return this;\n }\n\n /** Shortcuts to the App EventEmitter on, off, and emit methods */\n public on(events: EventInput, callback?: ListenerCallback): App {\n this.emitter.on(events, callback, this);\n return this;\n }\n\n public off(events: EventInput, callback?: ListenerCallback): App {\n this.emitter.off(events, callback, this);\n return this;\n }\n\n public emit(events: string | any[], ...args: any): App {\n this.emitter.emit(events, ...args);\n return this;\n }\n}\n", "import { newState, Trigger, newCoords, IHistoryItem, IHistoryManager } from \"./history\";\nimport { Service } from \"./service\";\nimport { IPage, IPageManager } from \"./page\";\nimport { newURL, getHashedPath, equal } from \"./url\";\nimport { getConfig } from \"./config\";\nimport { hashAction, ITransitionManager } from \"./transition\";\n\nexport type LinkEvent = MouseEvent | TouchEvent;\nexport type StateEvent = LinkEvent | PopStateEvent;\nexport type IgnoreURLsList = Array;\n/**\n * Creates a barbajs like PJAX Service, for the native framework\n * Based on barbajs and StartingBlocks\n */\nexport class PJAX extends Service {\n /** URLs to ignore when prefetching */\n public ignoreURLs: IgnoreURLsList;\n\n /** Whether or not to disable prefetching */\n public prefetchIgnore: boolean;\n\n /** Current state of transitions */\n public isTransitioning: boolean;\n\n /** Ignore extra clicks of an anchor element if a transition has already started */\n public stopOnTransitioning: boolean;\n\n /** On page change (excluding popstate events) keep current scroll position */\n public stickyScroll: boolean;\n\n /** Force load a page if an error occurs */\n public forceOnError: boolean;\n\n /** Ignore hash action if set to true */\n public ignoreHashAction: boolean;\n\n public install() {\n super.install();\n\n this.ignoreURLs = getConfig(this.config, \"ignoreURLs\") ?? [];\n this.prefetchIgnore = getConfig(this.config, \"prefetchIgnore\") ?? false;\n this.stopOnTransitioning = getConfig(this.config, \"stopOnTransitioning\") ?? false;\n this.stickyScroll = getConfig(this.config, \"stickyScroll\") ?? false;\n this.forceOnError = getConfig(this.config, \"forceOnError\") ?? false;\n this.ignoreHashAction = getConfig(this.config, \"ignoreHashAction\") ?? false\n }\n\n /** Sets the transition state to either true or false */\n public transitionStart() {\n this.isTransitioning = true;\n }\n\n public transitionStop() {\n this.isTransitioning = false;\n }\n\n public init() {\n /**\n * Bind the event listeners to the PJAX class\n *\n * @memberof PJAX\n */\n this.onHover = this.onHover.bind(this);\n this.onClick = this.onClick.bind(this);\n this.onStateChange = this.onStateChange.bind(this);\n }\n\n /** Starts the PJAX Service */\n public boot() {\n if (\"scrollRestoration\" in window.history) {\n // Back off, browser, I got this...\n window.history.scrollRestoration = \"manual\";\n }\n\n super.boot();\n }\n\n /** Gets the transition to use for a certain anchor */\n public getTransitionName(el: HTMLAnchorElement): string | null {\n if (!el || !el.getAttribute) return null;\n let transitionAttr = el.getAttribute(\n getConfig(this.config, \"transitionAttr\", false)\n );\n\n if (typeof transitionAttr === \"string\") return transitionAttr;\n return null;\n }\n\n /** Checks to see if the anchor is valid */\n public validLink(\n el: HTMLAnchorElement,\n event: LinkEvent | KeyboardEvent,\n href: string\n ): boolean {\n let pushStateSupport = !window.history.pushState;\n let exists = !el || !href;\n let eventMutate =\n (event as KeyboardEvent).metaKey ||\n (event as KeyboardEvent).ctrlKey ||\n (event as KeyboardEvent).shiftKey ||\n (event as KeyboardEvent).altKey;\n let newTab =\n el.hasAttribute(\"target\") &&\n (el as HTMLAnchorElement).target === \"_blank\";\n let crossOrigin =\n (el as HTMLAnchorElement).protocol !== location.protocol ||\n (el as HTMLAnchorElement).hostname !== location.hostname;\n let download = typeof el.getAttribute(\"download\") === \"string\";\n let preventSelf = el.matches(getConfig(this.config, \"preventSelfAttr\"));\n let preventAll = Boolean(\n el.closest(getConfig(this.config, \"preventAllAttr\"))\n );\n let sameURL = getHashedPath(newURL()) === getHashedPath(newURL(href));\n return !(\n exists ||\n pushStateSupport ||\n eventMutate ||\n newTab ||\n crossOrigin ||\n download ||\n preventSelf ||\n preventAll ||\n sameURL\n );\n }\n\n /** Returns the href of an Anchor element */\n public getHref(el: HTMLAnchorElement): string | null {\n if (\n el &&\n el.tagName &&\n el.tagName.toLowerCase() === \"a\" &&\n typeof el.href === \"string\"\n )\n return el.href;\n return null;\n }\n\n /** Check if event target is a valid anchor with an href, if so, return the anchor */\n public getLink(event: LinkEvent): HTMLAnchorElement {\n let el = event.target as HTMLAnchorElement;\n let href: string = this.getHref(el);\n\n while (el && !href) {\n el = (el as HTMLElement).parentNode as HTMLAnchorElement;\n href = this.getHref(el);\n }\n\n // Check for a valid link\n if (!el || !this.validLink(el, event, href)) return;\n return el;\n }\n\n /** When an element is clicked, get valid anchor element, go for a transition */\n public onClick(event: LinkEvent) {\n let el = this.getLink(event);\n if (!el) return;\n\n if (this.isTransitioning && this.stopOnTransitioning) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n let href = this.getHref(el);\n this.emitter.emit(\"ANCHOR_CLICK CLICK\", event);\n this.go({ href, trigger: el, event });\n }\n\n /** Returns the direction of the State change as a String, either the Back button or the Forward button */\n public getDirection(value: number): Trigger {\n if (Math.abs(value) > 1) {\n // Ex 6-0 > 0 -> forward, 0-6 < 0 -> back\n return value > 0 ? \"forward\" : \"back\";\n } else {\n if (value === 0) {\n return \"popstate\";\n } else {\n // Ex 6-5 > 0 -> back, 5-6 < 0 -> forward\n return value > 0 ? \"back\" : \"forward\";\n }\n }\n }\n\n /** Force a page to go to a certain URL */\n public force(href: string): void {\n window.location.assign(href);\n }\n\n /**\n * If transition is running force load page.\n * Stop if currentURL is the same as new url.\n * On state change, change the current state history, to reflect the direction of said state change\n * Load page and page transition.\n */\n public go({\n href,\n trigger = \"HistoryManager\",\n event,\n }: {\n href: string;\n trigger?: Trigger;\n event?: StateEvent;\n }): Promise {\n // If transition is already running and the go method is called again, force load page\n if (this.isTransitioning && this.stopOnTransitioning ||\n !(this.manager.has(\"TransitionManager\") &&\n this.manager.has(\"HistoryManager\") &&\n this.manager.has(\"PageManager\"))) {\n this.force(href);\n return;\n }\n\n const history = this.manager.get(\"HistoryManager\") as IHistoryManager;\n let scroll = newCoords(0, 0);\n let currentState = history.current;\n let currentURL = currentState.url;\n if (equal(currentURL, href)) {\n return;\n }\n\n let transitionName: string;\n if (event && (event as PopStateEvent).state) {\n this.emitter.emit(\"POPSTATE\", event);\n\n // If popstate, get back/forward direction.\n let { state }: { state: IHistoryItem } = event as PopStateEvent;\n let { index } = state;\n let currentIndex = currentState.index;\n let difference = currentIndex - index;\n\n history.replace(state.states);\n history.pointer = index;\n\n let _state = history.get(index);\n transitionName = _state.transition;\n scroll = _state.data.scroll;\n\n trigger = this.getDirection(difference);\n console.log(trigger == \"forward\" && history)\n\n // Based on the direction of the state change either remove or add a state\n this.emitter.emit(trigger === \"back\" ? `POPSTATE_BACK` : `POPSTATE_FORWARD`, event);\n } else {\n // Add new state\n transitionName = this.getTransitionName(trigger as HTMLAnchorElement);\n\n scroll = newCoords();\n let state = newState({\n url: href,\n transition: transitionName,\n data: { scroll },\n });\n\n !this.stickyScroll && (scroll = newCoords(0, 0));\n\n history.add(state);\n this.emitter.emit(\"HISTORY_NEW_ITEM\", event);\n }\n\n if (event) {\n event.stopPropagation();\n event.preventDefault();\n }\n\n this.emitter.emit(\"GO\", event);\n return this.load({\n oldHref: currentURL,\n href,\n trigger,\n transitionName,\n scroll,\n });\n }\n\n /** Load the new Page as well as a Transition; starts the Transition */\n public async load({\n oldHref,\n href,\n trigger,\n transitionName = \"default\",\n scroll = { x: 0, y: 0 },\n }: {\n oldHref: string;\n href: string;\n trigger: Trigger;\n transitionName?: string;\n scroll: { x: number; y: number };\n }): Promise {\n try {\n const pages = this.manager.get(\"PageManager\") as IPageManager;\n let newPage: IPage, oldPage: IPage;\n this.emitter.emit(\"NAVIGATION_START\", {\n oldHref,\n href,\n trigger,\n transitionName,\n });\n\n // Load & Build both the old and new pages\n try {\n this.transitionStart();\n oldPage = await pages.load(oldHref);\n !(oldPage.dom instanceof Element) && oldPage.build();\n\n this.emitter.emit(\"PAGE_LOADING\", { href, oldPage, trigger });\n newPage = await pages.load(href);\n await newPage.build();\n this.emitter.emit(\"PAGE_LOAD_COMPLETE\", {\n newPage,\n oldPage,\n trigger,\n });\n } catch (err) {\n console.warn(`[PJAX] Page load error: ${err}`);\n }\n\n // Transition Between Pages\n try {\n const TransitionManager = this.manager.get(\"TransitionManager\") as ITransitionManager;\n this.emitter.emit(\"TRANSITION_START\", transitionName);\n\n let transition = await TransitionManager.animate(TransitionManager.has(transitionName) ? transitionName : \"default\", {\n oldPage,\n newPage,\n trigger,\n scroll,\n ignoreHashAction: this.ignoreHashAction\n });\n\n if (!transition.scrollable) {\n if (!this.ignoreHashAction && !/back|popstate|forward/.test(trigger as string)) scroll = hashAction(scroll);\n window.scroll(scroll.x, scroll.y);\n }\n\n this.emitter.emit(\"TRANSITION_END\", { transition });\n } catch (err) {\n console.warn(`[PJAX] Transition error: ${err}`);\n }\n\n // Navigation is over\n this.emitter.emit(\"NAVIGATION_END\", {\n oldPage,\n newPage,\n trigger,\n transitionName,\n });\n } catch (err) {\n if (this.forceOnError) this.force(href);\n else console.warn(err);\n } finally {\n this.transitionStop(); // Sets isTransitioning to false\n }\n }\n\n /** Check to see if the URL is to be ignored, uses either RegExp of Strings to check */\n public ignoredURL({ pathname }: URL): boolean {\n return (\n this.ignoreURLs.length &&\n this.ignoreURLs.some((url) => {\n return typeof url === \"string\"\n ? url === pathname\n : (url as RegExp).exec(pathname) !== null;\n })\n );\n }\n\n /** When you hover over an anchor, prefetch the event target's href */\n public onHover(event: LinkEvent): Promise {\n let el = this.getLink(event);\n if (!el || !this.manager.has(\"PageManager\")) return;\n\n const pages = this.manager.get(\"PageManager\") as IPageManager;\n let url = newURL(this.getHref(el));\n let urlString: string = url.pathname;\n\n // If Url is ignored or already in cache, don't do any think\n if (this.ignoredURL(url) || pages.has(urlString)) return;\n this.emitter.emit(\"ANCHOR_HOVER HOVER\", event);\n\n try {\n pages.load(url);\n } catch (err) {\n console.warn(\"[PJAX] prefetch error,\", err);\n }\n }\n\n /** When History state changes, get url from State, go for a Transition. */\n public onStateChange(event: PopStateEvent): void {\n this.go({ href: window.location.href, trigger: \"popstate\", event });\n }\n\n /** Initialize DOM Events */\n public initEvents() {\n if (this.prefetchIgnore !== true) {\n document.addEventListener(\"mouseover\", this.onHover);\n document.addEventListener(\"touchstart\", this.onHover);\n }\n\n document.addEventListener(\"click\", this.onClick);\n window.addEventListener(\"popstate\", this.onStateChange);\n }\n\n /** Stop DOM Events */\n public stopEvents() {\n if (this.prefetchIgnore !== true) {\n document.removeEventListener(\"mouseover\", this.onHover);\n document.removeEventListener(\"touchstart\", this.onHover);\n }\n\n document.removeEventListener(\"click\", this.onClick);\n window.removeEventListener(\"popstate\", this.onStateChange);\n }\n}\n", "import { Service } from \"./service\";\nimport { Manager } from \"./manager\";\nimport { newURL, getHashedPath } from \"./url\";\nimport { IHistoryManager } from \"./history\";\n\nexport type RouteMethod = (...args: any) => any;\nexport type RouteStyle = string | RegExp | boolean;\nexport interface IRouteToFrom {\n to: RouteStyle,\n from: RouteStyle\n}\nexport type RoutePath = IRouteToFrom | RouteStyle;\nexport interface IRoute {\n path: RoutePath,\n method: RouteMethod\n}\n\n/** Controls what happens when certain url paths match a set of criteria */\nexport class Router extends Service {\n /** List of routes */\n protected routes: Manager;\n constructor(routes: IRoute[] = []) {\n super();\n this.routes = new Manager();\n for (let route of routes) {\n this.add(route);\n }\n }\n\n /** Add a new route to watch for */\n public add({ path, method }: IRoute): Router {\n let key = this.parse(path);\n this.routes.set(key, method);\n return this;\n }\n\n /** Convert strings into path match functions */\n public parsePath(path: RouteStyle): RegExp | boolean {\n if (typeof path === \"string\") return new RegExp(path, \"i\");\n else if (path instanceof RegExp || typeof path === \"boolean\")\n return path;\n throw \"[Router] only regular expressions, strings and booleans are accepted as paths.\";\n }\n\n /** Determines if a strings counts has a path */\n public isPath(input: RouteStyle): boolean {\n return (\n typeof input === \"string\" ||\n input instanceof RegExp ||\n typeof input === \"boolean\"\n );\n }\n\n /** Parse the multiple different formats for paths, into a { from, to } object */\n public parse(input: RoutePath): IRouteToFrom {\n let route = input as IRouteToFrom;\n let toFromPath: IRouteToFrom = {\n from: /(.*)/g,\n to: /(.*)/g,\n };\n\n if (this.isPath(input as RouteStyle))\n toFromPath = {\n from: true,\n to: input as RouteStyle,\n };\n else if (this.isPath(route.from) && this.isPath(route.to as RouteStyle))\n toFromPath = route;\n else\n throw \"[Router] path is neither a string, regular expression, or a { from, to } object.\";\n\n let { from, to } = toFromPath;\n return {\n from: this.parsePath(from),\n to: this.parsePath(to),\n };\n }\n\n /** Test if route paths are true, if so run their methods */\n public route() {\n if (this.manager.has(\"HistoryManager\")) {\n let history = this.manager.get(\"HistoryManager\") as IHistoryManager;\n let from: string = getHashedPath(newURL((history.length > 1 ? history.previous : history.current).url));\n let to: string = getHashedPath(newURL());\n\n this.routes.forEach((method: RouteMethod, path: IRouteToFrom) => {\n let fromRegExp = path.from as RegExp | boolean;\n let toRegExp = path.to as RegExp | boolean;\n\n if (\n typeof fromRegExp === \"boolean\" &&\n typeof toRegExp === \"boolean\"\n ) {\n throw `[Router] path ({ from: ${fromRegExp}, to: ${toRegExp} }) is not valid, remember paths can only be strings, regular expressions, or a boolean; however, both the from and to paths cannot be both booleans.`;\n }\n\n let fromParam: RegExpExecArray | RegExp | boolean = fromRegExp;\n let toParam: RegExpExecArray | RegExp | boolean = toRegExp;\n\n if (fromRegExp instanceof RegExp && fromRegExp.test(from))\n fromParam = fromRegExp.exec(from);\n if (toRegExp instanceof RegExp && toRegExp.test(to))\n toParam = toRegExp.exec(to);\n\n if (\n (Array.isArray(toParam) && Array.isArray(fromParam)) ||\n (Array.isArray(toParam) &&\n typeof fromParam == \"boolean\" &&\n fromParam) ||\n (Array.isArray(fromParam) &&\n typeof toParam == \"boolean\" &&\n toParam)\n )\n method({ from: fromParam, to: toParam, path: { from, to } });\n });\n } else {\n console.warn(\"[Route] HistoryManager is missing.\");\n }\n }\n\n /** Add listeners for PJAX Events */\n public initEvents() {\n this.emitter.on(\"READY\", this.route, this);\n this.emitter.on(\"CONTENT_REPLACED\", this.route, this);\n }\n\n /** Remove listeners for PJAX Events */\n public stopEvents() {\n this.emitter.off(\"READY\", this.route, this);\n this.emitter.off(\"CONTENT_REPLACED\", this.route, this);\n }\n}\n", "import { EventEmitter, EventInput, ListenerCallback } from \"@okikio/emitter\";\nimport { Manager } from \"@okikio/manager\";\n\n// DOM\nexport type AnimationTarget = string | Node | NodeList | HTMLCollection | HTMLElement[] | AnimationTarget[];\nexport const getElements = (selector: string | Node): Node[] => {\n return typeof selector === \"string\" ? Array.from(document.querySelectorAll(selector as string)) : [selector];\n};\n\nconst flatten = (arr: AnimationTarget[]) => [].concat(...arr);\nexport const getTargets = (targets: AnimationTarget): Node[] => {\n if (Array.isArray(targets)) {\n return flatten((targets as AnimationTarget[]).map(getTargets));\n }\n if (typeof targets == \"string\" || targets instanceof Node)\n return getElements(targets);\n if (targets instanceof NodeList || targets instanceof HTMLCollection)\n return Array.from(targets);\n return [];\n};\n\n// VALUES\nexport type closureArgs = [number, number, HTMLElement];\nexport type closure = ((index?: number, total?: number, element?: HTMLElement) => (genericTypes[] | void)) | any;\nexport const computeValue = (value: closure, args: closureArgs, context: Animate) => {\n if (typeof value === \"function\") {\n return value.apply(context, args);\n } else { return value; }\n};\n\nexport const mapObject = (obj: object, args: closureArgs, options: Animate): any => {\n let key: string, value: any, result = {};\n let keys = Object.keys(obj);\n for (let i = 0, len = keys.length; i < len; i++) {\n key = keys[i];\n value = obj[key];\n result[key] = computeValue(value, args, options);\n }\n\n return result;\n};\n\n/** From: [https://easings.net] */\nexport const easings = {\n \"in\": \"ease-in\",\n \"out\": \"ease-out\",\n \"in-out\": \"ease-in-out\",\n\n // Sine\n \"in-sine\": \"cubic-bezier(0.47, 0, 0.745, 0.715)\",\n \"out-sine\": \"cubic-bezier(0.39, 0.575, 0.565, 1)\",\n \"in-out-sine\": \"cubic-bezier(0.445, 0.05, 0.55, 0.95)\",\n\n // Quad\n \"in-quad\": \"cubic-bezier(0.55, 0.085, 0.68, 0.53)\",\n \"out-quad\": \"cubic-bezier(0.25, 0.46, 0.45, 0.94)\",\n \"in-out-quad\": \"cubic-bezier(0.455, 0.03, 0.515, 0.955)\",\n\n // Cubic\n \"in-cubic\": \"cubic-bezier(0.55, 0.055, 0.675, 0.19)\",\n \"out-cubic\": \"cubic-bezier(0.215, 0.61, 0.355, 1)\",\n \"in-out-cubic\": \"cubic-bezier(0.645, 0.045, 0.355, 1)\",\n\n // Quart\n \"in-quart\": \"cubic-bezier(0.895, 0.03, 0.685, 0.22)\",\n \"out-quart\": \"cubic-bezier(0.165, 0.84, 0.44, 1)\",\n \"in-out-quart\": \"cubic-bezier(0.77, 0, 0.175, 1)\",\n\n // Quint\n \"in-quint\": \"cubic-bezier(0.755, 0.05, 0.855, 0.06)\",\n \"out-quint\": \"cubic-bezier(0.23, 1, 0.32, 1)\",\n \"in-out-quint\": \"cubic-bezier(0.86, 0, 0.07, 1)\",\n\n // Expo\n \"in-expo\": \"cubic-bezier(0.95, 0.05, 0.795, 0.035)\",\n \"out-expo\": \"cubic-bezier(0.19, 1, 0.22, 1)\",\n \"in-out-expo\": \"cubic-bezier(1, 0, 0, 1)\",\n\n // Circ\n \"in-circ\": \"cubic-bezier(0.6, 0.04, 0.98, 0.335)\",\n \"out-circ\": \"cubic-bezier(0.075, 0.82, 0.165, 1)\",\n \"in-out-circ\": \"cubic-bezier(0.785, 0.135, 0.15, 0.86)\",\n\n // Back\n \"in-back\": \"cubic-bezier(0.6, -0.28, 0.735, 0.045)\",\n \"out-back\": \"cubic-bezier(0.175, 0.885, 0.32, 1.275)\",\n \"in-out-back\": \"cubic-bezier(0.68, -0.55, 0.265, 1.55)\"\n};\n\nexport const getEase = (ease: string) => {\n return /^(in|out)/.test(ease) ? easings[ease] : ease;\n};\n\nexport type genericTypes = genericTypes[] | boolean | object | string | number | closure | null | undefined;\nexport interface AnimationOptions {\n target?: AnimationTarget,\n\n speed?: number,\n autoplay?: boolean,\n options?: AnimationOptions,\n delay?: number | closure,\n easing?: string | closure,\n endDelay?: number | closure,\n duration?: number | closure,\n keyframes?: Keyframe[] | object[] | closure,\n loop?: number | boolean | closure, // iterations: number,\n onfinish?: (element?: HTMLElement, index?: number, total?: number, animation?: Animation) => any,\n fillMode?: \"none\" | \"forwards\" | \"backwards\" | \"both\" | \"auto\" | closure,\n direction?: \"normal\" | \"reverse\" | \"alternate\" | \"alternate-reverse\" | closure,\n extend?: EffectTiming,\n [property: string]: genericTypes;\n};\n\nexport const DefaultAnimationOptions: AnimationOptions = {\n keyframes: [],\n\n loop: 1, // iterations: number,\n delay: 0,\n speed: 1,\n endDelay: 0,\n easing: \"ease\",\n autoplay: true,\n duration: 1000,\n fillMode: \"auto\",\n direction: \"normal\",\n extend: {}\n};\n\nexport type AnimationEvents = \"update\" | \"play\" | \"pause\" | \"start\" | \"begin\" | \"complete\" | \"finish\" | \"error\" | \"stop\";\n\n/** You can check it out here: https://codepen.io/okikio/pen/qBbdGaW?editors=0011 */\nexport class Animate {\n /**\n * Stores the options for the current animation\n */\n public options: AnimationOptions = {};\n\n /**\n * The Array of Elements to Animate\n */\n public targets: Node[] = [];\n\n /**\n * The properties to animate\n */\n public properties: object = {};\n\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n\n /**\n * The total duration of all Animation's\n */\n public totalDuration: number = 0;\n\n /**\n * The smallest delay out of all Animation's\n */\n public minDelay: number = 0;\n\n /**\n * The options for individual animations\n */\n public computedOptions: Manager = new Manager();\n\n /**\n * The Element the main animation uses\n */\n public mainElement: HTMLElement;\n\n /**\n * Stores an animation that runs on the total duration of the all other Animations, and as such it's the main Animation\n */\n public mainAnimation: Animation;\n\n /**\n * Stores request frame calls\n */\n public animationFrame: number;\n\n /**\n * An event emitter\n */\n public emitter: EventEmitter = new EventEmitter();\n\n /**\n * Returns a promise that is fulfilled when the mainAnimation is finished\n */\n public promise: Promise;\n constructor(options: AnimationOptions = {}) {\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n\n /**\n * Returns a new Promise that is resolve when this.finish is called\n */\n public newPromise(): Promise {\n return new Promise((resolve, reject) => {\n /*\n Note that the `this` keyword is in an Array when it is resolved,\n this is due to Promises not wanting to resolve references,\n so, you can't resolve `this` directly, so, I chose to resolve `this` in an\n Array\n */\n this.on(\"complete\", () => resolve([this]));\n this.on(\"error\", err => reject(err));\n });\n }\n\n /**\n * Fulfills the this.promise Promise\n */\n public then(\n onFulfilled?: (value?: any) => any,\n onRejected?: (reason?: any) => any\n ): Animate {\n onFulfilled = onFulfilled?.bind(this);\n onRejected = onRejected?.bind(this);\n this.promise.then(onFulfilled, onRejected);\n return this;\n }\n\n /**\n * Catches error that occur in the this.promise Promise\n */\n public catch(onRejected: (reason?: any) => any): Animate {\n onRejected = onRejected?.bind(this);\n this.promise.catch(onRejected);\n return this;\n }\n\n /**\n * If you don't care if the this.promise Promise has either been rejected or resolved\n */\n public finally(onFinally: () => any): Animate {\n onFinally = onFinally?.bind(this);\n this.promise.finally(onFinally);\n return this;\n }\n\n /**\n * Represents an Animation Frame Loop\n */\n public loop(): void {\n this.stopLoop();\n this.emit(\"update\", this.getProgress(), this);\n this.animationFrame = window.requestAnimationFrame(this.loop);\n }\n\n /**\n * Cancels animation frame\n */\n public stopLoop() {\n window.cancelAnimationFrame(this.animationFrame);\n }\n\n /**\n * Calls a method that affects all animations including the mainAnimation; the method only allows the animation parameter\n */\n public all(method: (animation?: Animation, target?: HTMLElement) => void) {\n method(this.mainAnimation, this.mainElement);\n this.animations.forEach(method);\n return this;\n }\n\n /**\n * Register the begin event\n */\n protected beginEvent() {\n if (this.getProgress() == 0) {\n let timer: number | void = window.setTimeout(() => {\n this.emit(\"begin\", this);\n timer = window.clearTimeout(timer as number);\n }, this.minDelay);\n }\n }\n\n /**\n * Play Animation\n */\n public play(): Animate {\n let playstate = this.getPlayState();\n this.beginEvent();\n this.all(anim => anim.play());\n this.emit(\"play\", playstate, this);\n this.loop();\n return this;\n }\n\n /**\n * Pause Animation\n */\n public pause(): Animate {\n let playstate = this.getPlayState();\n this.all(anim => anim.pause());\n this.emit(\"pause\", playstate, this);\n this.stopLoop();\n this.animationFrame = undefined;\n return this;\n }\n\n /**\n * Reset all Animations\n */\n public reset() {\n this.setProgress(0);\n this.beginEvent();\n\n if (this.options.autoplay) this.play();\n else this.pause();\n return this;\n }\n\n /**\n * Cancels all Animations\n */\n public cancel() {\n this.all(anim => anim.cancel());\n this.stopLoop();\n return this;\n }\n\n /**\n * Force complete all Animations\n */\n public finish() {\n this.all(anim => anim.finish());\n this.stopLoop();\n return this;\n }\n\n /**\n * Cancels & Clears all Animations\n */\n public stop() {\n this.cancel();\n this.animations.clear();\n while (this.targets.length) this.targets.pop();\n this.mainElement = undefined;\n this.emit(\"stop\");\n }\n\n /**\n * Returns an Array of targets\n */\n public getTargets(): Node[] {\n return this.targets;\n }\n\n /**\n * Get a specific Animation from an Animate instance\n */\n public getAnimation(element: HTMLElement): Animation {\n return this.animations.get(element);\n }\n\n /**\n * Returns the timings of an Animation, given a target\n * E.g. { duration, endDelay, delay, iterations, iterationStart, direction, easing, fill, etc... }\n */\n public getTiming(target: HTMLElement | Animation): AnimationOptions & EffectTiming {\n let animation = target instanceof Animation ? target : this.getAnimation(target);\n let keyframeOptions = this.computedOptions.get(animation) ?? {};\n let timings = animation.effect?.getTiming() ?? {};\n let options = this.getOptions();\n\n return { ...DefaultAnimationOptions, ...options, ...timings, ...keyframeOptions };\n }\n\n /**\n * Returns the total duration of Animation\n */\n public getTotalDuration(): number {\n return this.totalDuration;\n }\n\n /**\n * Returns the current time of the Main Animation\n */\n public getCurrentTime(): number {\n return this.mainAnimation.currentTime;\n }\n\n /**\n * Returns the Animation progress as a fraction of the current time / duration * 100\n */\n public getProgress() {\n return (this.getCurrentTime() / this.totalDuration) * 100;\n }\n\n /**\n * Return the playback speed of the animation\n */\n public getSpeed(): number {\n return this.mainAnimation.playbackRate;\n }\n\n /**\n * Returns the current playing state\n */\n public getPlayState(): \"idle\" | \"running\" | \"paused\" | \"finished\" {\n return this.mainAnimation.playState;\n }\n\n /**\n * Get the options of an Animate instance\n */\n public getOptions(): AnimationOptions {\n return this.options;\n }\n\n /**\n * Set the current time of the Main Animation\n */\n public setCurrentTime(time: number): Animate {\n this.all(anim => { anim.currentTime = time; });\n this.emit(\"update\", this.getProgress());\n return this;\n }\n\n /**\n * Set the Animation progress as a value from 0 to 100\n */\n public setProgress(percent: number): Animate {\n let time = (percent / 100) * this.totalDuration;\n this.setCurrentTime(time);\n return this;\n }\n\n /**\n * Set the playback speed of an Animation\n */\n public setSpeed(speed: number = 1): Animate {\n this.all(anim => { anim.playbackRate = speed; });\n return this;\n }\n\n /**\n * Adds a listener for a given event\n */\n public on(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.on(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Removes a listener from an event\n */\n public off(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.off(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Call all listeners within an event\n */\n public emit(events: AnimationEvents | string | any[], ...args: any): Animate {\n this.emitter.emit(events, ...args);\n return this;\n }\n\n\n /** Returns the Animate options, as JSON */\n public toJSON(): AnimationOptions {\n return this.getOptions();\n }\n\n /**\n * The Symbol.toStringTag well-known symbol is a string valued property that is used\n * in the creation of the default string description of an object.\n * It is accessed internally by the Object.prototype.toString() method.\n */\n get [Symbol.toStringTag]() {\n return `Animate`;\n }\n}\n\n/** Creates a new Animate instance */\nexport const animate = (options: AnimationOptions = {}): Animate => {\n return new Animate(options);\n};\n\nexport class Timeline extends Animate {\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n constructor(options: AnimationOptions = {}) {\n super();\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n public add(options: AnimationOptions) {\n return this;\n }\n}\n\nexport default animate;"], + "mappings": "8GAAA,msBCeO,GAAM,GAAkB,CAC3B,YAAa,UACb,eAAgB,eAChB,eAAgB,cAChB,QAAS,CACL,CAAC,YAAa,SAElB,gBAAiB,iBACjB,eAAgB,gBAChB,eAAgB,aAChB,UAAW,QACX,QAAS,IACT,SAAU,GAID,EAAY,AAAC,GACf,OAAO,OAAO,IAAK,GAAmB,GAIp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,GACtB,EAAqC,CACrC,OAAQ,MAAO,IAAU,SAAW,EAAQ,GAAU,EACtD,WAAY,IAAS,GAAO,SAAY,EACxC,YACA,WACA,WACA,QACA,KAAM,KACH,GAMH,EAAe,EAAc,EAA0B,CAAC,EAAG,EAAK,GAAS,MAC7E,EAAoB,EAAa,OAAS,EACrC,KAAK,WAIV,EAAmB,EAAU,EAAkB,CAAC,EAAG,EAAK,GAAS,MAC3D,EAAa,OAAS,GACxB,GAAoB,EAAU,EAAmB,CAAC,EAAG,EAAK,GAAS,OAGvE,GAAI,GAAgB,EAAiB,MAChC,EAAiB,SAAW,EAAiB,WAC9C,EAAiB,SACrB,AAAI,KAAK,cAAgB,GAAe,MAAK,cAAgB,GAG7D,GAAI,GAAY,EAAO,QAAQ,EAAmB,GAGlD,EAAU,SAAW,IAAM,CACvB,MAAO,IAAY,YAAc,EAAS,KAAK,KAAM,EAAQ,EAAG,EAAK,GACrE,KAAK,KAAK,SAAU,EAAQ,EAAG,EAAK,IAIxC,KAAK,gBAAgB,IAAI,EAAW,GACpC,KAAK,WAAW,IAAI,EAAQ,GAC5B,EAAO,KAAK,EAAiB,OAGjC,KAAK,cAAgB,KAAK,YAAY,QAAQ,CAC1C,CAAE,QAAS,KACX,CAAE,QAAS,MACZ,CAEC,SAAU,KAAK,cACf,OAAQ,WAGZ,KAAK,SAAW,KAAK,IAAI,GAAG,GAC5B,KAAK,SAAS,GACd,AAAI,EAAU,KAAK,OACd,KAAK,QAEV,KAAK,QAAU,KAAK,aACpB,KAAK,cAAc,SAAW,IAAM,CAChC,KAAK,KAAK,WAAY,MACtB,KAAK,kBAEJ,EAAP,CACE,KAAK,KAAK,QAAS,IAGpB,IAAI,EAA2B,CAClC,MAAO", "names": [] } -- knotmirror 0.0.1 From 4b5a07378c9852784d5a46bead9bbd4d8aa5ee3c Mon Sep 17 00:00:00 2001 From: Okiki Date: Sat, 24 Apr 2021 09:01:10 +0000 Subject: [PATCH 2/5] docs: update TODO with currently completed tasks --- TODO.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/TODO.md b/TODO.md index ba16d2e..cd8886b 100644 --- a/TODO.md +++ b/TODO.md @@ -2,11 +2,11 @@ * [x] Update README.md * [x] Create TODO.md for all packages -* [ ] Fix 404 pages requiring a second press on mobile -* [ ] Fix Hash Action not scrolling to correct element of a new page (switch to using getBoundingClientRects) +* [x] Fix 404 pages requiring a second press on mobile +* [x] Fix Hash Action not scrolling to correct element of a new page (switch to using getBoundingClientRects) * [ ] Add the `Shell` class that allows for frameworks to interupt the PJAX process * [ ] Allow for an Hybrid between PJAX, and JS SPA frameworks * [ ] Use Cypress to automate Demo tests * [ ] Update TODO.md for all packages -* [ ] Update to Node v15 -* [ ] Remove gulp-sass, replace with postcss@2.0.0 & postcss-sass +* [x] Update to Node v15 +* [x] Remove gulp-sass, replace with postcss@2.0.0 & postcss-sass -- knotmirror 0.0.1 From b0b9b2f48141cdbff7851e5848191488c38be9a9 Mon Sep 17 00:00:00 2001 From: Okiki Date: Sat, 24 Apr 2021 09:01:39 +0000 Subject: [PATCH 3/5] chore: WIP update demo site --- .gitignore | 2 +- .vscode/settings.json | 5 + build/pug/about.pug | 2 +- build/pug/animate.pug | 17 +- build/pug/components/big-transition.pug | 16 + build/pug/components/footer.pug | 9 + build/pug/components/navbar.pug | 26 +- build/pug/index.pug | 346 +++++----- build/pug/layouts/layout.pug | 60 +- build/sass/app.scss | 432 +++---------- build/ts/animate.ts | 90 +++ build/ts/main.ts | 110 +--- build/ts/services/Navbar.ts | 66 ++ build/ts/services/Splashscreen.ts | 72 --- build/ts/toArr.ts | 2 + demo/404.html | 4 +- demo/about.html | 8 +- demo/animate.html | 4 +- demo/css/app.css | 823 +++++++++++++++++++++++- demo/css/components/old.css | 0 demo/index.html | 30 +- demo/other.html | 6 +- gulpfile.js | 46 +- old.scss | 256 ++++++++ package.json | 15 +- pnpm-lock.yaml | 197 ++++-- tailwind.cjs | 34 +- util.js | 181 +----- 28 files changed, 1812 insertions(+), 1047 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 build/pug/components/big-transition.pug create mode 100644 build/pug/components/footer.pug create mode 100644 build/ts/services/Navbar.ts delete mode 100644 build/ts/services/Splashscreen.ts create mode 100644 build/ts/toArr.ts create mode 100644 demo/css/components/old.css create mode 100644 old.scss diff --git a/.gitignore b/.gitignore index 3c84321..db24bd8 100644 --- a/.gitignore +++ b/.gitignore @@ -110,7 +110,7 @@ coverage/ .ultra.cache.json # VSCode -.vscode/ +# .vscode/ # Theia .theia/ diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..e89a8b4 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "scss.lint.unknownAtRules": "ignore", + "scss.lint.unknownProperties": "ignore", + "scss.validate": false +} \ No newline at end of file diff --git a/build/pug/about.pug b/build/pug/about.pug index 4c6d090..98ce681 100644 --- a/build/pug/about.pug +++ b/build/pug/about.pug @@ -19,7 +19,7 @@ block content | ultrices ex non, faucibus velit. Aliquam laoreet sed turpis a blandit. Nulla fringilla massa non | fermentum rutrum. .intro-animation - #inview-01.card.my-3.border-light.rounded.box-shadow.page-block(data-direction='right' data-node-type='InViewBlock' data-block='InViewBlock') + #inview-01.card.my-3.border-light.rounded.box-shadow.page-block(data-direction='right') picture source(data-srcset='/img/test2.webp' type='image/webp') img#snd-image1.card-img-top.img-fluid.lazyload(loading='eager' width='747' src='https://images.unsplash.com/photo-1570506020466-17c74d2f4590?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1500&q=80' alt='Lazyloaded img') diff --git a/build/pug/animate.pug b/build/pug/animate.pug index 9dccd6d..06e218f 100644 --- a/build/pug/animate.pug +++ b/build/pug/animate.pug @@ -3,6 +3,18 @@ extends /layouts/layout.pug block content main#home-page(data-wrapper='' role='main') .container + .jumbotron.jumbotron-fluid.my-2.p-4.rounded-lg.box-shadow.text-dark.intro-animation + label(for='scrub') @okikio/animate + input#scrub(type='range' value='0' min='0' max='100' step='0.01') + button(type="button").btn.btn-dark.playtoggle Play/Pause/Reset + p.support Requires native Web Animation Support (latest Firefox, Chrome, Opera) + + p.info This is pretty cool right + p.fix.progress 0% + - for (let i = 0; i < 5; i ++) { + .div + - } + .jumbotron.jumbotron-fluid.my-3.px-4.rounded-lg.box-shadow.text-dark.bg-warning h1.font-sz-5xl.font-sans.font-100 @okikio/animate p.lead Dynamic example's based off of animejs to get you started. @@ -52,7 +64,4 @@ block content svg.svg(xmlns='http://www.w3.org/2000/svg' width='500px' height='300px' viewbox='0 0 1310 680') path(d='M53,234c143.452,-81.953,313.407,-167.554,430,-107c116.592,45.554,70.404,361.126,236,472c235.595,95.873,447.977,-197.535,477,-306' style='stroke:red;fill:none;stroke-width:5px;') - - -block script - script(src="./js/animate.js" type="module") +//- script(src="./js/animate.js" type="module") diff --git a/build/pug/components/big-transition.pug b/build/pug/components/big-transition.pug new file mode 100644 index 0000000..703ad28 --- /dev/null +++ b/build/pug/components/big-transition.pug @@ -0,0 +1,16 @@ +mixin big-transition + #big-transition + .spinner + svg(viewbox='0 0 66 66' xmlns='http://www.w3.org/2000/svg') + circle.length(fill='none' stroke-width='8' stroke-linecap='round' cx='33' cy='33' r='28') + svg(viewbox='0 0 66 66' xmlns='http://www.w3.org/2000/svg') + circle(fill='none' stroke-width='8' stroke-linecap='round' cx='33' cy='33' r='28') + svg(viewbox='0 0 66 66' xmlns='http://www.w3.org/2000/svg') + circle(fill='none' stroke-width='8' stroke-linecap='round' cx='33' cy='33' r='28') + svg(viewbox='0 0 66 66' xmlns='http://www.w3.org/2000/svg') + circle(fill='none' stroke-width='8' stroke-linecap='round' cx='33' cy='33' r='28') + #big-transition-horizontal + div + div + div + div diff --git a/build/pug/components/footer.pug b/build/pug/components/footer.pug new file mode 100644 index 0000000..fa32786 --- /dev/null +++ b/build/pug/components/footer.pug @@ -0,0 +1,9 @@ +mixin footer + footer.footer.text-gray-500.text-right + .container.p-5.align-middle(class="lg:max-w-screen-xl") + p.bg-gray-200.inline-block.px-4.py-2.rounded-md + | Made by + a(href='https://github.com/okikio' target='_blank') Okiki Ojo + | Based on + a(href='https://github.com/rezozero/starting-blocks' target='_blank') Starting blocks + | . diff --git a/build/pug/components/navbar.pug b/build/pug/components/navbar.pug index f8515dd..4d20ec3 100644 --- a/build/pug/components/navbar.pug +++ b/build/pug/components/navbar.pug @@ -1,17 +1,11 @@ mixin navbar() - nav#main-nav.navbar.navbar-expand-md.fixed-top.navbar-light.bg-light - a.navbar-brand(href='./index.html') - | Starting Blocks - small v4 - button.navbar-toggler(type='button' data-toggle='collapse' data-target='#navbarSupportedContent' aria-controls='navbarSupportedContent' aria-expanded='false' aria-label='Toggle navigation') - span.navbar-toggler-icon - #navbarSupportedContent.collapse.navbar-collapse - ul.navbar-nav.mr-auto - li.nav-item - a.nav-link.active(href='./animate.html' data-prevent="self") @okikio/animate (prevent-pjax) - li.nav-item - a.nav-link(href='./index.html' data-path='(index|\/$)(\.html)?' data-transition='default') Homepage - li.nav-item - a.nav-link(href='./about.html' data-path='/about(.html)?' data-transition='SlideLeft') About - li.nav-item - a.nav-link(href='./other.html' data-path='/other(.html)?' data-transition='BigTransition') Other + nav.navbar + .container + a.navbar-logo(href='./index.html') @okikio/native + button.navbar-toggle(type='button') + span.icon menu + .navbar-collapse.collapse + ul.navbar-list + a.active(href='./index.html' data-path='(index|\/$)(\.html)?' data-transition='default') Home + a(href='./about.html' data-path='/about(.html)?' data-transition='SlideLeft') About + a(href='./other.html' data-path='/other(.html)?' data-transition='BigTransition' data-prevent="self") Docs (prevent-pjax) diff --git a/build/pug/index.pug b/build/pug/index.pug index 4926dc8..bef8647 100644 --- a/build/pug/index.pug +++ b/build/pug/index.pug @@ -1,192 +1,164 @@ extends /layouts/layout.pug block content - main#home-page(data-wrapper='' role='main') - #page-home-page.page-content.page-content-ajax(data-node-name='home-page' data-is-home='1' data-node-type='HomePage' data-meta-title='Home page') - .container - .row - .col - .jumbotron.jumbotron-fluid.my-3.px-1.px-4.px-0.rounded-lg.box-shadow.text-dark.intro-animation - .container - h1.font-sz-5xl.font-sans.font-100 Homepage. - p.lead Dynamic example. + .container.py-5(class="lg:max-w-screen-xl") + .m-5.px-12.py-24.bg-white.rounded-lg.border.border-gray-200.intro-animation + h1.text-5xl.mb-2 Homepage + p.font-light.text-lg Dynamic example. - .jumbotron.jumbotron-fluid.my-2.p-4.rounded-lg.box-shadow.text-dark.intro-animation - label(for='scrub') @okikio/animate - input#scrub(type='range' value='0' min='0' max='100' step='0.01') - button(type="button").btn.btn-dark.playtoggle Play/Pause/Reset - p.support Requires native Web Animation Support (latest Firefox, Chrome, Opera) + .grid.grid-cols-12.gap-6.m-5.p-5.bg-white.rounded-lg.border.border-gray-200.intro-animation + .col-span-3 + ul.flex.flex-col(role='tablist' aria-orientation='vertical') + a.btn.active(href='./index.html') Link to homepage + a.btn(href='./about.html') Link to the about page + a.btn(href='./about.html#5-image') Link to fifth image + .col-span-9 + p + | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis fringilla. + | Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed vestibulum orci. + | Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin ut porttitor + | lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, sapien orci dignissim ligula, + | aliquam interdum erat urna a nibh. Morbi quis tellus maximus, pellentesque erat ac, porttitor nulla. + | Curabitur rhoncus urna non magna mattis aliquet. Vestibulum non lobortis turpis. Nunc aliquet velit a + | magna dictum pulvinar vitae laoreet tortor. Duis auctor iaculis arcu ac rutrum. Suspendisse vel odio + | risus. + + .grid.grid-cols-12.gap-6.m-5 + .col-span-6.bg-white.rounded-lg.overflow-hidden.border.border-gray-200.intro-animation + img(loading='eager' width='747' src='https://images.unsplash.com/photo-1589646609975-cb53c8e5b37a?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=747&q=80' alt='Normal img') + p.p-5 Normal image. - p.info This is pretty cool right - p.fix.progress 0% - - for (let i = 0; i < 5; i ++) { - .div - - } - .row - .col - .my-3.p-3.bg-white.rounded.box-shadow.text-dark.intro-animation - .row - .col-sm-3.mb-3 - nav#in-page-nav.nav.nav-pills.flex-column(role='tablist' aria-orientation='vertical') - a.nav-link.active(href='./index.html') Link to homepage - a.nav-link(href='./about.html') Link to the about page - a.nav-link(href='./about.html#5-image') Link to fifth image - .col-sm-9 - p - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis fringilla. - | Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed vestibulum orci. - | Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin ut porttitor - | lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, sapien orci dignissim ligula, - | aliquam interdum erat urna a nibh. Morbi quis tellus maximus, pellentesque erat ac, porttitor nulla. - | Curabitur rhoncus urna non magna mattis aliquet. Vestibulum non lobortis turpis. Nunc aliquet velit a - | magna dictum pulvinar vitae laoreet tortor. Duis auctor iaculis arcu ac rutrum. Suspendisse vel odio - | risus. - .row - .col-sm-6.intro-animation - #inview-00.card.my-3.border-light.rounded.box-shadow.page-block(data-direction='left' data-node-type='InViewBlock' data-block='InViewBlock') - img#first-image.card-img-top.img-fluid(loading='eager' width='747' src='https://images.unsplash.com/photo-1589646609975-cb53c8e5b37a?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=747&q=80' alt='Normal img') - .card-body.text-dark - p.card-text Normal image. - .col-sm-6.intro-animation - #inview-01.card.my-3.border-light.rounded.box-shadow.page-block(data-direction='right' data-node-type='InViewBlock' data-block='InViewBlock') - picture - source(data-srcset='/img/test2.webp' type='image/webp') - img#snd-image1.card-img-top.img-fluid.lazyload(loading='eager' width='747' src='https://images.unsplash.com/photo-1570506020466-17c74d2f4590?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1500&q=80' alt='Lazyloaded img') - .card-body.text-dark - p.card-text Lazyloaded picture with webp (for chrome). - .row - .col - .my-3.p-3 - .row - .col-sm-6.intro-animation - p - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. - .col-sm-6.intro-animation - p - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. - .col-sm-12 - #block-1.page-block.intro-animation - p - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. - #block-2.page-block.intro-animation - p - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. - p - | Cras mattis consectetur purus sit amet fermentum. Nulla vitae elit libero, a pharetra augue. Sed - | posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam - | venenatis vestibulum. Vestibulum id ligula porta felis euismod semper. Praesent commodo cursus - | magna, vel scelerisque nisl consectetur et. - p - | Etiam porta sem malesuada magna mollis euismod. Cum sociis natoque penatibus et magnis dis parturient - | montes, nascetur ridiculus mus. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor - | auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec - | elit. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Cras justo odio, dapibus - | ac facilisis in, egestas eget quam. - | Donec ullamcorper nulla non metus auctor fringilla. Sed posuere consectetur est at lobortis. Etiam - | porta sem malesuada magna mollis euismod. Donec sed odio dui. Donec id elit non mi porta gravida at - | eget metus. Cras mattis consectetur purus sit amet fermentum. - p.intro-animation - img#snd-image.lazyload.img-fluid(loading='eager' width='700' src='https://images.unsplash.com/photo-1590510325281-54a9164cf0f4?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1502&q=80' data-src='/img/test2.jpg' alt='Lazyloaded img') - p - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. - p - | Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus - | sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Integer posuere erat a ante venenatis - | dapibus posuere velit aliquet. Curabitur blandit tempus porttitor. - | Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta felis euismod semper. - | Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Nulla vitae elit libero, a - | pharetra augue. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio - | sem nec elit. - | Cras justo odio, dapibus ac facilisis in, egestas eget quam. Nulla vitae elit libero, a pharetra - | augue. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Praesent commodo cursus magna, - | vel scelerisque nisl consectetur et. - p - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. - p - | Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus - | sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Integer posuere erat a ante venenatis - | dapibus posuere velit aliquet. Curabitur blandit tempus porttitor. - | Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta felis euismod semper. - | Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Nulla vitae elit libero, a - | pharetra augue. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio - | sem nec elit. - | Cras justo odio, dapibus ac facilisis in, egestas eget quam. Nulla vitae elit libero, a pharetra - | augue. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Praesent commodo cursus magna, - | vel scelerisque nisl consectetur et. - p - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. - p - | Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus - | sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Integer posuere erat a ante venenatis - | dapibus posuere velit aliquet. Curabitur blandit tempus porttitor. - | Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta felis euismod semper. - | Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Nulla vitae elit libero, a - | pharetra augue. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio - | sem nec elit. - | Cras justo odio, dapibus ac facilisis in, egestas eget quam. Nulla vitae elit libero, a pharetra - | augue. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Praesent commodo cursus magna, - | vel scelerisque nisl consectetur et. - .row - .col-sm-6 - #in-view-block-1.card.my-3.border-light.rounded.box-shadow.page-block(data-direction='left' data-node-type='InViewBlock' data-block='InViewBlock') - img#3-image.card-img-top.lazyload.img-fluid(loading='eager' src='https://images.unsplash.com/photo-1464553186862-680edae5b2bc?ixlib=rb-1.2.1&auto=format&fit=crop&w=1510&q=80' width='700' data-src='/img/test3.jpg' alt='Lazyloaded img') - .card-body.text-dark - p.card-text Lazyloaded image. - .col-sm-6 - #in-view-block-2.card.my-3.border-light.rounded.box-shadow.page-block(data-direction='right' data-node-type='InViewBlock' data-block='InViewBlock') - img#4-image.card-img-top.lazyload.img-fluid(loading='eager' src='https://images.unsplash.com/photo-1590169434951-f1622a03fe93?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=750&q=80' width='700' data-src='/img/test4.jpg' alt='Lazyloaded img') - .card-body.text-dark - p.card-text Lazyloaded image. - #in-view-block-3.card.my-3.border-light.rounded.box-shadow.page-block(data-direction='right' data-node-type='InViewBlock' data-block='InViewBlock') - img#5-image.card-img-top.lazyload.img-fluid(loading='eager' src='https://images.unsplash.com/photo-1590071688906-d9df3f7bbd91?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1482&q=80' width='700' data-src='/img/test5.jpg' alt='Lazyloaded img') - .card-body.text-dark - p.card-text Lazyloaded image. + .col-span-6.bg-white.rounded-lg.overflow-hidden.border.border-gray-200.intro-animation + picture + source(data-srcset='/img/test2.webp' type='image/webp') + img(loading='lazy' width='747' src='https://images.unsplash.com/photo-1570506020466-17c74d2f4590?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1500&q=80' alt='Lazyloaded img') + p.p-5 Lazyloaded picture. + + .grid.grid-cols-12.gap-6 + .col-span-6.intro-animation + p + | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis + | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed + | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus + | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, + | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, + | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum + | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor + | iaculis arcu ac rutrum. Suspendisse vel odio risus. + .col-span-6.intro-animation + p + | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis + | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed + | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus + | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, + | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, + | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum + | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor + | iaculis arcu ac rutrum. Suspendisse vel odio risus. + .col-span-12.space-y-6 + p.intro-animation + | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis + | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed + | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus + | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, + | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, + | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum + | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor + | iaculis arcu ac rutrum. Suspendisse vel odio risus. + p.intro-animation + | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis + | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed + | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus + | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, + | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, + | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum + | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor + | iaculis arcu ac rutrum. Suspendisse vel odio risus. + p.intro-animation + | Cras mattis consectetur purus sit amet fermentum. Nulla vitae elit libero, a pharetra augue. Sed + | posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam + | venenatis vestibulum. Vestibulum id ligula porta felis euismod semper. Praesent commodo cursus + | magna, vel scelerisque nisl consectetur et. + p.intro-animation + | Etiam porta sem malesuada magna mollis euismod. Cum sociis natoque penatibus et magnis dis parturient + | montes, nascetur ridiculus mus. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor + | auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec + | elit. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Cras justo odio, dapibus + | ac facilisis in, egestas eget quam. + | Donec ullamcorper nulla non metus auctor fringilla. Sed posuere consectetur est at lobortis. Etiam + | porta sem malesuada magna mollis euismod. Donec sed odio dui. Donec id elit non mi porta gravida at + | eget metus. Cras mattis consectetur purus sit amet fermentum. + img.m-5.intro-animation(loading='eager' width='700' src='https://images.unsplash.com/photo-1590510325281-54a9164cf0f4?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1502&q=80' alt='Lazyloaded img') + p.intro-animation + | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis + | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed + | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus + | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, + | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, + | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum + | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor + | iaculis arcu ac rutrum. Suspendisse vel odio risus. + p.intro-animation + | Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus + | sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Integer posuere erat a ante venenatis + | dapibus posuere velit aliquet. Curabitur blandit tempus porttitor. + | Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta felis euismod semper. + | Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Nulla vitae elit libero, a + | pharetra augue. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio + | sem nec elit. + | Cras justo odio, dapibus ac facilisis in, egestas eget quam. Nulla vitae elit libero, a pharetra + | augue. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Praesent commodo cursus magna, + | vel scelerisque nisl consectetur et. + p.intro-animation + | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis + | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed + | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus + | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, + | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, + | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum + | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor + | iaculis arcu ac rutrum. Suspendisse vel odio risus. + p.intro-animation + | Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus + | sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Integer posuere erat a ante venenatis + | dapibus posuere velit aliquet. Curabitur blandit tempus porttitor. + | Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta felis euismod semper. + | Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Nulla vitae elit libero, a + | pharetra augue. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio + | sem nec elit. + | Cras justo odio, dapibus ac facilisis in, egestas eget quam. Nulla vitae elit libero, a pharetra + | augue. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Praesent commodo cursus magna, + | vel scelerisque nisl consectetur et. + p.intro-animation + | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis + | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed + | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus + | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, + | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, + | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum + | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor + | iaculis arcu ac rutrum. Suspendisse vel odio risus. + p.intro-animation + | Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus + | sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Integer posuere erat a ante venenatis + | dapibus posuere velit aliquet. Curabitur blandit tempus porttitor. + | Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta felis euismod semper. + | Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Nulla vitae elit libero, a + | pharetra augue. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio + | sem nec elit. + | Cras justo odio, dapibus ac facilisis in, egestas eget quam. Nulla vitae elit libero, a pharetra + | augue. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Praesent commodo cursus magna, + | vel scelerisque nisl consectetur et. + + .grid.grid-cols-12.gap-6.mt-8.mb-5 + .col-span-6.bg-white.rounded-lg.overflow-hidden.border.border-gray-200.intro-animation + img(loading='lazy' width='1510' src='https://images.unsplash.com/photo-1464553186862-680edae5b2bc?ixlib=rb-1.2.1&auto=format&fit=crop&w=1510&q=80' alt='Lazyloaded img') + p.p-5 Lazyloaded image. + + .col-span-6.bg-white.rounded-lg.overflow-hidden.border.border-gray-200.intro-animation + img(loading='lazy' width='750' src='https://images.unsplash.com/photo-1590169434951-f1622a03fe93?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=750&q=80' alt='Lazyloaded img') + p.p-5 Lazyloaded image. + + .col-span-6.bg-white.rounded-lg.overflow-hidden.border.border-gray-200.intro-animation + img(loading='lazy' width='1482' src='https://images.unsplash.com/photo-1590071688906-d9df3f7bbd91?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1482&q=80' alt='Lazyloaded img') + p.p-5 Lazyloaded image. diff --git a/build/pug/layouts/layout.pug b/build/pug/layouts/layout.pug index c5bd855..976a865 100644 --- a/build/pug/layouts/layout.pug +++ b/build/pug/layouts/layout.pug @@ -1,4 +1,6 @@ include /components/navbar.pug +include /components/footer.pug +include /components/big-transition.pug doctype html head @@ -9,55 +11,19 @@ head meta(name='description' content='') meta(name="color-scheme" content="dark light") meta(name='viewport' content='width=device-width, initial-scale=1') - //- Latest compiled and minified CSS - //- link(rel='stylesheet' href='./css/base/base.css') - link(rel='stylesheet' href='./css/app.css') - link(rel='stylesheet' href='https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css' integrity='sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2' crossorigin='anonymous') -body(class="home-page bg-dark text-white") - #splashscreen - .splashscreen-inner - .spinner - svg(viewbox='0 0 66 66' xmlns='http://www.w3.org/2000/svg') - circle.length(fill='none' stroke-width='8' stroke-linecap='round' cx='33' cy='33' r='28') - svg(viewbox='0 0 66 66' xmlns='http://www.w3.org/2000/svg') - circle(fill='none' stroke-width='8' stroke-linecap='round' cx='33' cy='33' r='28') - svg(viewbox='0 0 66 66' xmlns='http://www.w3.org/2000/svg') - circle(fill='none' stroke-width='8' stroke-linecap='round' cx='33' cy='33' r='28') - svg(viewbox='0 0 66 66' xmlns='http://www.w3.org/2000/svg') - circle(fill='none' stroke-width='8' stroke-linecap='round' cx='33' cy='33' r='28') - .splashscreen-bg - #big-transition - .spinner - svg(viewbox='0 0 66 66' xmlns='http://www.w3.org/2000/svg') - circle.length(fill='none' stroke-width='8' stroke-linecap='round' cx='33' cy='33' r='28') - svg(viewbox='0 0 66 66' xmlns='http://www.w3.org/2000/svg') - circle(fill='none' stroke-width='8' stroke-linecap='round' cx='33' cy='33' r='28') - svg(viewbox='0 0 66 66' xmlns='http://www.w3.org/2000/svg') - circle(fill='none' stroke-width='8' stroke-linecap='round' cx='33' cy='33' r='28') - svg(viewbox='0 0 66 66' xmlns='http://www.w3.org/2000/svg') - circle(fill='none' stroke-width='8' stroke-linecap='round' cx='33' cy='33' r='28') - #big-transition-horizontal - div - div - div - div + + link(rel='stylesheet' href='./css/app.css' async) + link(rel='preconnect' href='https://fonts.gstatic.com') + link(href='https://fonts.googleapis.com/icon?family=Material+Icons' rel='stylesheet' async) +body +navbar - block content - footer.footer.text-dark - .container - | Made by - | - a.text-muted(href='https://github.com/okikio' target='_blank') Okiki Ojo - | Based on - | - a.text-muted(href='https://github.com/rezozero/starting-blocks' target='_blank') Starting blocks - //- script(src='https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js' integrity='sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo' crossorigin='anonymous') - script(src='https://code.jquery.com/jquery-3.5.1.slim.min.js' integrity='sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj' crossorigin='anonymous') - script(src='https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.bundle.min.js' integrity='sha384-ho+j7jyWK8fNQe+A12Hb8AhRq26LrZ/JpcUGGOn+Y7RsweNrtN/tE3MoK7ZeZDyx' crossorigin='anonymous') + //- +big-transition + .navbar-offset + main(data-wrapper) + block content - block script - script(src='./js/main.js' type='module') - //- script(src='./js/app.js') + +footer + script(src='./js/main.js' type='module') diff --git a/build/sass/app.scss b/build/sass/app.scss index e307b36..3ceb673 100644 --- a/build/sass/app.scss +++ b/build/sass/app.scss @@ -1,383 +1,125 @@ -$themeColors: ( - "primary": ( - "light": #ff3a6b, - "dark": #000, - ), - "secondary": ( - "light": #ff3a6b, - "dark": #ff3a6b, - ), - "tertiary": ( - "light": #ff3a6b, - "dark": #ff3a6b, - ), - "background": ( - "light": #ff3a6b, - "dark": #ff3a6b, - ), -); +@tailwind base; +@tailwind components; +@tailwind utilities; -$themeFonts: ( - "title": ( - "Frank Ruhl Libre", - serif, - ), - "light": ( - "Varela Round", - sans-serif, - ), - "icon": ( - "Material Icons", - sans-serif, - ), - "default": ( - "Roboto", - sans-serif, - ), - "bold": ( - "Montserrat", - sans-serif, - ), -); - -.div { - --size: 8vmin; - width: var(--size); - height: var(--size); - /* transform: scale(1); */ - border-radius: 8%; - background: #616aff; -} - -.el, -.el-initial { - --size: 4vmin; - width: var(--size); - height: var(--size); - /* transform: scale(1); */ - // border-radius: 8%; - margin: 5px; - background: #616aff; +body { + @apply bg-white text-black; + font-size: 1rem; + line-height: 1.5; +} + +.icon { + -webkit-font-feature-settings: "liga" off, "dlig"; + -moz-font-feature-settings: "liga=0, dlig=1"; + font-feature-settings: "liga", "dlig"; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + text-rendering: optimizeLegibility; + font-family: 'Material Icons'; + vertical-align: middle; + letter-spacing: normal; + display: inline-block; + text-decoration: none; + text-transform: none; + white-space: nowrap; + font-weight: normal; position: relative; + font-style: normal; + word-wrap: normal; + font-size: 24px; + line-height: 1; + direction: ltr; + height: 1em; + width: 1em; } -.svg { - margin: auto; - display: block; - width: 500px; - height: 300px; - max-height: 100vh; - max-width: 100%; - - & path { - stroke: #fff2b1; - stroke-dasharray: 400 400; - stroke-dashoffset: 0; - } +a { + @apply text-blue-500 underline hover:text-blue-700; } -.el-initial { - opacity: 0.6; - position: absolute; - display: block; - margin-top: 0; - top: 0; +button, a { + transition: color .2s ease-out, box-shadow .2s ease-out; + @apply focus:ring-4 focus:ring-blue-500 focus:ring-opacity-50; + @apply focus:outline-none focus:rounded-sm; + + -webkit-tap-highlight-color: transparent; } -.animation-container { - transition: background-color 0.5s ease; - background-color: rgba(0, 0, 0, 0.085); - border-radius: 5px; - padding: 5px; - cursor: pointer; +.navbar { + @apply fixed top-0 left-0 w-full z-50; - &:hover { - background-color: rgba(255, 255, 255, 0.25); + .container { + @apply bg-white border-b border-gray-200; + @apply flex flex-wrap items-center justify-between; + @apply lg:max-w-screen-xl px-5 py-2; } } -.contain { - position: relative; -} - -.animation-container + .animation-container { - margin-top: 2em; +.navbar-offset { + @apply mt-16; } -input[type="range"] { - width: 100%; - padding: 0; - margin: 0; -} -html:not(.unsupported) .support { - display: none; -} +.navbar-collapse { + @apply items-center; -p.fix { - line-height: 1; -} + @screen lt-sm { + --height: 100vh; + transition: height ease-out 0.25s; + overflow: hidden; + @apply flex-grow; + flex-basis: 100%; -.theme { - &-bg { - @each $colorName, $color in $themeColors { - &-#{$colorName} { - background-color: map-get($color, "light"); - } - - html[theme="dark"] &-#{$colorName} { - background-color: map-get($color, "dark") !important; - } + &.show { + height: 100%; + height: var(--height, 100vh); } - } - &-color { - @each $colorName, $color in $themeColors { - &-#{$colorName} { - color: map-get($color, "light"); - } - - html[theme="dark"] &-#{$colorName} { - color: map-get($color, "dark") !important; - } + &.collapse { + height: 0; } } - - &-font { - @each $fontType, $font in $themeFonts { - &-#{$fontType} { - font-family: $font; - } - } - } -} - -html { - position: relative; - min-height: 100%; -} - -html, -body { - overflow-x: hidden; - /* Prevent scroll on narrow devices */ -} - -body { - padding-top: 75px; - margin-bottom: 60px; -} - -.box-shadow { - box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.05); -} - -.text-white-50 { - color: rgba(255, 255, 255, 0.5); -} - -#splashscreen { - position: fixed; - z-index: 1040; - top: 0; - right: 0; - bottom: 0; - left: 0; - display: flex; - align-content: center; - align-items: center; - justify-content: center; - visibility: hidden; - pointer-events: none; } -.splashscreen-inner { - position: relative; - z-index: 11; - display: block; -} - -.splashscreen-bg { - position: absolute; - z-index: 10; - top: 0; - right: 0; - bottom: 0; - left: 0; - background-color: #eeeeee; -} - -.splashscreen-text { - position: relative; - z-index: 11; - font-size: 16px; - margin-top: 150px; - letter-spacing: 5px; -} - -.spinner { - position: absolute; - z-index: 12; - top: 50%; - left: 50%; - width: 66px; - height: 66px; - margin-top: -33px; - margin-left: -33px; - animation: contanim 2s linear infinite; -} - -.spinner svg { - display: block; - margin: 0; - padding: 0; - width: 100%; - height: 100%; - left: 0; - top: 0; - position: absolute; - -webkit-transform: rotate(-90deg); - transform: rotate(-90deg); -} - -.spinner svg:nth-child(1) circle { - stroke: #84ebbd; - stroke-dasharray: 1, 300; - stroke-dashoffset: 0; - animation: strokeanim 3s calc(0.2s * (1)) ease infinite; - transform-origin: center center; -} - -.spinner svg:nth-child(2) circle { - stroke: #4977ec; - stroke-dasharray: 1, 300; - stroke-dashoffset: 0; - animation: strokeanim 3s calc(0.2s * (2)) ease infinite; - transform-origin: center center; +.navbar-list { + @apply flex lt-sm:flex-col flex-nowrap; } -.spinner svg:nth-child(3) circle { - stroke: #f6bb67; - stroke-dasharray: 1, 300; - stroke-dashoffset: 0; - animation: strokeanim 3s calc(0.2s * (3)) ease infinite; - transform-origin: center center; +.navbar-logo { + @apply text-xl font-bold; } -.spinner svg:nth-child(4) circle { - stroke: #ff5050; - stroke-dasharray: 1, 300; - stroke-dashoffset: 0; - animation: strokeanim 3s calc(0.2s * (4)) ease infinite; - transform-origin: center center; +.navbar-list a { + @apply sm:mx-1 lt-sm:w-full lt-sm:my-1; } -// @-webkit-keyframes strokeanim { -// 0% { -// stroke-dasharray: 1, 300; -// stroke-dashoffset: 0; -// } - -// 50% { -// stroke-dasharray: 120, 300; -// stroke-dashoffset: -58.548324585; -// } - -// 100% { -// stroke-dasharray: 120, 300; -// stroke-dashoffset: -175.6449737549; -// } -// } - -@keyframes strokeanim { - 0% { - stroke-dasharray: 1, 300; - stroke-dashoffset: 0; - } +.navbar-logo, +.navbar-list a { + @apply px-3 py-2 rounded-md no-underline hover:text-blue-400; - 50% { - stroke-dasharray: 120, 300; - stroke-dashoffset: -58.548324585; - } - - 100% { - stroke-dasharray: 120, 300; - stroke-dashoffset: -175.6449737549; + &.active { + @apply bg-blue-600 text-white; } } -// @-webkit-keyframes contanim { -// 100% { -// -webkit-transform: rotate(360deg); -// transform: rotate(360deg); -// } -// } +.navbar-toggle, +.navbar-logo, +.navbar-list a { + transition: + background-color .15s ease-out, color .15s ease-out, + border-color .2s ease-out, box-shadow .2s ease-out; -@keyframes contanim { - 100% { - -webkit-transform: rotate(360deg); - transform: rotate(360deg); - } } -/** Big transition **/ -#big-transition { - position: fixed; - z-index: 2000; - top: 0; - left: 0; - right: 0; - bottom: 0; - display: flex; - opacity: 0; - visibility: hidden; +.navbar-toggle { + @apply sm:hidden border border-gray-300 border-solid rounded-md; + @apply w-10 h-10 text-blue-500 hover:ring-4 hover:ring-blue-500 hover:ring-opacity-50; + @apply focus:border-blue-600 focus:ring-4 focus:rounded-md; } -#big-transition .spinner { - opacity: 0; - visibility: hidden; -} +.btn { + @apply px-3 py-2 rounded-md no-underline; -#big-transition #big-transition-horizontal { - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - display: flex; -} - -#big-transition #big-transition-horizontal { - flex-flow: column; -} - -#big-transition #big-transition-horizontal > div { - width: 100%; - flex: 1 1; - background: #fff; - transform-origin: 0 0; - transform: scaleX(0); -} - -/** Footer **/ -.footer { - // position: absolute; - position: relative; - bottom: 0; - width: 100%; - height: 60px; - line-height: 60px; - background-color: #f5f5f5; -} - -main { - overflow: hidden; -} - -// [data-block="IntroBlock"] { -// transition: transform .5s ease, opacity .5s ease; - -// &.active { -// transform: translateX(0%) !important; -// opacity: 1 !important; -// } -// } + &.active { + @apply bg-blue-600 text-white; + } +} \ No newline at end of file diff --git a/build/ts/animate.ts b/build/ts/animate.ts index d89ed2b..148bd7f 100644 --- a/build/ts/animate.ts +++ b/build/ts/animate.ts @@ -1,5 +1,95 @@ import { animate } from "@okikio/native"; +/* + anim = animate({ + target: ".div", + keyframes(index, total) { + return [ + { transform: "translateX(0px)", opacity: 0.1 }, + { transform: "translateX(300px)", opacity: 0.2 + ((index + 1) / total) } + ] + }, + // transform: ["translateX(0px)", "translateX(300px)"], + // opacity(index, total, element) { + // return [0, ((index + 1) / total)]; + // }, + + // It is best to use the onfinish() method, but in this situation fillMode works best + fillMode: "both", + // onfinish(element, index, total) { + // element.style.opacity = `${((index + 1) / total)}`; + // element.style.transform = "translateX(300px)"; + // }, + + easing: "out-cubic", + duration(index: number) { + return (index + 1) * 500; + }, + loop: 5, + speed: 1.5, + direction: "alternate", + delay(index: number) { + return ((index + 1) * 500) / 2; + }, + autoplay: false + }); + + let el: HTMLElement = document.querySelector(".info"); + let backupInfo = el.textContent; + let info = backupInfo; + anim.on({ + begin() { + if (el) { + info = backupInfo; + el.textContent = info; + el.style.color = "initial"; + } + } + }) + anim.on("complete", () => { + if (el) { + info = "Done."; + el.textContent = info; + el.style.color = "red"; + + console.log(info); + } + }); + + let scrub = document.getElementById('scrub') as HTMLInputElement; + scrub.addEventListener('input', e => { + var percent = +(e.target as HTMLInputElement).value; + anim.setProgress(percent); + anim.pause(); + }); + + let progressSpan = document.querySelector(".progress"); + anim.on("update", progress => { + scrub.value = `` + progress; + progressSpan && (progressSpan.textContent = `${Math.round(progress)}%`); + }); + + scrub.addEventListener('change', () => { + if (Math.round(anim.getProgress()) >= 100) { + anim.finish(); + return false; + } + anim.play(); + }); + + + let playtoggle = document.querySelector(".playtoggle"); + if (playtoggle) { + playtoggle.addEventListener("click", () => { + let state = anim.getPlayState(); + if (state === "running") anim.pause(); + else if (state === "finished") anim.reset(); + else anim.play(); + console.log(state); + }); + } +*/ + /* Target Section */ // CSS Selector Demo (() => { diff --git a/build/ts/main.ts b/build/ts/main.ts index f38f859..ce72e4b 100644 --- a/build/ts/main.ts +++ b/build/ts/main.ts @@ -1,18 +1,17 @@ import { PJAX, App, TransitionManager, Router, HistoryManager, PageManager, animate, Animate } from "@okikio/native"; - -import { Splashscreen } from "./services/Splashscreen"; import { IntroAnimation } from "./services/IntroAnimation"; import { Fade } from "./transitions/Fade"; import { BigTransition } from "./transitions/BigTransition"; import { Slide, SlideLeft, SlideRight } from "./transitions/Slide"; -let splashscreen: Splashscreen; +import { toArr } from "./toArr"; +import { Navbar } from "./services/Navbar"; + let router: Router, pjax: PJAX; const app: App = new App(); app .add(new IntroAnimation()) - .add(splashscreen = new Splashscreen()) .set("HistoryManager", new HistoryManager()) .set("PageManager", new PageManager()) .set("TransitionManager", new TransitionManager([ @@ -22,6 +21,7 @@ app ["SlideLeft", SlideLeft], ["SlideRight", SlideRight] ])) + .add(new Navbar()) .set("router", router = new Router()) .add(pjax = new PJAX()); @@ -29,7 +29,7 @@ try { router = app.get("router") as Router; // This isn't nessceary, but it changes the nav link in focus depending on the page - let navLink = document.querySelectorAll(".navbar .nav-link"); + let navLink: HTMLElement[] = toArr(document.querySelectorAll(".navbar .nav-link")); for (let item of navLink) { let navItem = (item as HTMLAnchorElement); router.add({ @@ -45,108 +45,16 @@ try { }); } - let anim: Animate; router.add({ path: /(index|\/$)(\.html)?/, - method() { - anim = animate({ - target: ".div", - keyframes(index, total) { - return [ - { transform: "translateX(0px)", opacity: 0.1 }, - { transform: "translateX(300px)", opacity: 0.2 + ((index + 1) / total) } - ] - }, - - /* You can uncomment this out, and comment the keyframes options above and still get the same animation */ - // transform: ["translateX(0px)", "translateX(300px)"], - // opacity(index, total, element) { - // return [0, ((index + 1) / total)]; - // }, - - // It is best to use the onfinish() method, but in this situation fillMode works best - fillMode: "both", - // onfinish(element, index, total) { - // element.style.opacity = `${((index + 1) / total)}`; - // element.style.transform = "translateX(300px)"; - // }, - - easing: "out-cubic", - duration(index: number) { - return (index + 1) * 500; - }, - loop: 5, - speed: 1.5, - direction: "alternate", - delay(index: number) { - return ((index + 1) * 500) / 2; - }, - autoplay: false - }); - - let el: HTMLElement = document.querySelector(".info"); - let backupInfo = el.textContent; - let info = backupInfo; - anim.on({ - begin() { - if (el) { - info = backupInfo; - el.textContent = info; - el.style.color = "initial"; - } - } - }) - anim.on("complete", () => { - if (el) { - info = "Done."; - el.textContent = info; - el.style.color = "red"; - - console.log(info); - } - }); - - let scrub = document.getElementById('scrub') as HTMLInputElement; - scrub.addEventListener('input', e => { - var percent = +(e.target as HTMLInputElement).value; - anim.setProgress(percent); - anim.pause(); - }); - - let progressSpan = document.querySelector(".progress"); - anim.on("update", progress => { - scrub.value = `` + progress; - progressSpan && (progressSpan.textContent = `${Math.round(progress)}%`); - }); - - scrub.addEventListener('change', () => { - if (Math.round(anim.getProgress()) >= 100) { - anim.finish(); - return false; - } - anim.play(); - }); - - - let playtoggle = document.querySelector(".playtoggle"); - if (playtoggle) { - playtoggle.addEventListener("click", () => { - let state = anim.getPlayState(); - if (state === "running") anim.pause(); - else if (state === "finished") anim.reset(); - else anim.play(); - console.log(state); - }); - } - } + method() { } }); - app.on("AFTER_SPLASHSCREEN_HIDE", () => { - anim?.play(); - }); + // app.on("AFTER_SPLASHSCREEN_HIDE", () => { + // anim?.play(); + // }); app.boot(); } catch (err) { - splashscreen.show(); console.warn("[App] boot failed,", err); } diff --git a/build/ts/services/Navbar.ts b/build/ts/services/Navbar.ts new file mode 100644 index 0000000..b872414 --- /dev/null +++ b/build/ts/services/Navbar.ts @@ -0,0 +1,66 @@ +import { Service, animate } from "../../../packages/native/src/api"; +import { toArr } from "../toArr"; + +export class Navbar extends Service { + public navbar: HTMLElement; + public elements: HTMLElement[]; + public menu: HTMLElement; + public collapseSection: HTMLElement; + public navbarList: HTMLElement; + toggleStatus: boolean; + + public init() { + // Elements + this.navbar = document.querySelector(".navbar") as HTMLElement; + this.collapseSection = this.navbar.querySelector(".navbar-collapse") as HTMLElement; + this.navbarList = this.navbar.querySelector(".navbar-list") as HTMLElement; + this.elements = toArr(this.navbar.querySelectorAll(".navbar-list a")); + this.menu = this.navbar.querySelector(".navbar-toggle") as HTMLElement; + + this.toggleStatus = false; + this.toggleClick = this.toggleClick.bind(this); + } + + public activateLink() { + let { href } = window.location; + + for (let el of this.elements) { + let itemHref = + el.getAttribute("data-path") || + (el as HTMLAnchorElement).href; + if (!itemHref || itemHref.length < 1) return; + + let URLmatch = new RegExp(itemHref).test(href); + let isActive = el.classList.contains("active"); + if (!(URLmatch && isActive)) { + el.classList.toggle("active", URLmatch); + } + } + } + + public toggleClick() { + this.collapseSection.style?.setProperty?.("--height", `${this.navbarList.clientHeight}px`); + this.toggleStatus = !this.toggleStatus; + this.collapseSection.classList.toggle("collapse", !this.toggleStatus); + this.collapseSection.classList.toggle("show", this.toggleStatus); + } + + public initEvents() { + this.menu.addEventListener("click", this.toggleClick); + this.emitter.on("READY", this.activateLink, this); + this.emitter.on("GO", this.activateLink, this); + } + + public stopEvents() { + this.navbar.removeEventListener("click", this.toggleClick); + this.emitter.off("READY", this.activateLink, this); + this.emitter.off("GO", this.activateLink, this); + } + + public uninstall() { + while (this.elements.length) this.elements.pop(); + this.elements = undefined; + this.menu = undefined; + this.navbar = undefined; + } +} \ No newline at end of file diff --git a/build/ts/services/Splashscreen.ts b/build/ts/services/Splashscreen.ts deleted file mode 100644 index 86b6dad..0000000 --- a/build/ts/services/Splashscreen.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { Service, animate } from "../../../packages/native/src/api"; - -export class Splashscreen extends Service { - public rootElement: HTMLElement; - public innerEl: HTMLElement; - public bgEl: HTMLElement; - public minimalDuration: number = 1000; // ms - spinnerEl: Element[]; - - public init() { - super.init(); - - // Elements - this.rootElement = document.getElementById('splashscreen'); - if (this.rootElement) { - this.innerEl = this.rootElement.querySelector('.splashscreen-inner'); - this.bgEl = this.rootElement.querySelector('.splashscreen-bg'); - this.spinnerEl = [...this.rootElement.querySelectorAll('.spinner')]; - } - - this.rootElement.style.visibility = "visible"; - this.rootElement.style.pointerEvents = "auto"; - } - - public boot() { - if (this.rootElement) { - this.hide(); - } - } - - public async hide() { - await new Promise(resolve => { - window.setTimeout(() => { - this.emitter.emit("BEFORE_SPLASHSCREEN_HIDE"); - resolve(); - }, this.minimalDuration); - }); - - await new Promise(async resolve => { - animate({ - target: this.innerEl, - opacity: [1, 0], - autoplay: true, - duration: 500, - onfinish(el) { - el.style.opacity = "0"; - } - }).then(function () { - this.stop(); - }); - - this.emitter.emit("START_SPLASHSCREEN_HIDE"); - await this.show(); - resolve(); - }); - } - - public async show() { - let [anim] = await animate({ - target: this.rootElement, - transform: ["translateY(0%)", "translateY(100%)"], - duration: 1200, - easing: "in-out-cubic" // in-out-cubic - }); - this.emitter.emit("AFTER_SPLASHSCREEN_HIDE"); - anim.stop(); - - this.rootElement.style.transform = "translateY(100%)"; - this.rootElement.style.visibility = "hidden"; - this.rootElement.style.pointerEvents = "none"; - } -} diff --git a/build/ts/toArr.ts b/build/ts/toArr.ts new file mode 100644 index 0000000..6b7c0b4 --- /dev/null +++ b/build/ts/toArr.ts @@ -0,0 +1,2 @@ +export const toArr = (input: any): any[] => Array.from(input); +export default toArr; \ No newline at end of file diff --git a/demo/404.html b/demo/404.html index 1713475..017a1d4 100644 --- a/demo/404.html +++ b/demo/404.html @@ -1,3 +1 @@ -404 Page

404 Page

Dynamic blocks example.

\ No newline at end of file +404 Page

404 Page

Dynamic blocks example.

\ No newline at end of file diff --git a/demo/about.html b/demo/about.html index 199a182..4e3657d 100644 --- a/demo/about.html +++ b/demo/about.html @@ -1,4 +1,4 @@ -About page

About Page

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ex est, maximus aliquam sagittis vel, +About page

About Page

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ex est, maximus aliquam sagittis vel, tempus vel odio. Praesent felis elit, blandit et laoreet nec, hendrerit et arcu. Aenean ligula sapien, sodales vel semper in, pulvinar id nulla. Donec pellentesque non tellus vel imperdiet. Pellentesque posuere, nisl sed rutrum tincidunt, augue augue vestibulum ex, vel ornare justo arcu eu magna. Praesent @@ -6,7 +6,7 @@ vel nisl enim. Aenean a odio porttitor, fermentum est et, mattis sem. Suspendiss aliquam vestibulum, eros ipsum pulvinar sem, quis posuere tellus ex id velit. Quisque eu pellentesque nisl, sed volutpat purus. Sed auctor convallis sapien sed hendrerit. Vivamus et neque facilisis, ultrices ex non, faucibus velit. Aliquam laoreet sed turpis a blandit. Nulla fringilla massa non -fermentum rutrum.

Lazyloaded img

Lazyloaded picture with webp (for chrome).

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et +fermentum rutrum.

Lazyloaded img

Lazyloaded picture with webp (for chrome).

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed @@ -206,6 +206,4 @@ mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae el sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor -iaculis arcu ac rutrum. Suspendisse vel odio risus.

Lazyloaded img

\ No newline at end of file +iaculis arcu ac rutrum. Suspendisse vel odio risus.

Lazyloaded img

\ No newline at end of file diff --git a/demo/animate.html b/demo/animate.html index 2751bfd..5dcdd3a 100644 --- a/demo/animate.html +++ b/demo/animate.html @@ -1,3 +1 @@ -Homepage

@okikio/animate

Dynamic example's based off of animejs to get you started.

Target

CSS Selector

DOM Node / Nodelist

Array

Properties

CSS Properties

CSS Transforms

SVG Attributes

\ No newline at end of file +Homepage

Requires native Web Animation Support (latest Firefox, Chrome, Opera)

This is pretty cool right

0%

@okikio/animate

Dynamic example's based off of animejs to get you started.

Target

CSS Selector

DOM Node / Nodelist

Array

Properties

CSS Properties

CSS Transforms

SVG Attributes

\ No newline at end of file diff --git a/demo/css/app.css b/demo/css/app.css index 1b3b7fe..4cada01 100644 --- a/demo/css/app.css +++ b/demo/css/app.css @@ -1 +1,822 @@ -@-webkit-keyframes strokeanim{0%{stroke-dasharray:1,300;stroke-dashoffset:0}50%{stroke-dasharray:120,300;stroke-dashoffset:-58.548324585}to{stroke-dasharray:120,300;stroke-dashoffset:-175.6449737549}}@keyframes strokeanim{0%{stroke-dasharray:1,300;stroke-dashoffset:0}50%{stroke-dasharray:120,300;stroke-dashoffset:-58.548324585}to{stroke-dasharray:120,300;stroke-dashoffset:-175.6449737549}}@-webkit-keyframes contanim{to{transform:rotate(360deg)}}@keyframes contanim{to{transform:rotate(360deg)}}.div{--size:8vmin;width:var(--size);height:var(--size);border-radius:8%;background:#616aff}.el{position:relative}.el,.el-initial{--size:4vmin;width:var(--size);height:var(--size);margin:5px;background:#616aff}.svg{margin:auto;display:block;width:500px;height:300px;max-height:100vh;max-width:100%}.svg path{stroke:#fff2b1;stroke-dasharray:400 400;stroke-dashoffset:0}.el-initial{opacity:.6;position:absolute;display:block;margin-top:0;top:0}.animation-container{transition:background-color .5s ease;background-color:rgba(0,0,0,.085);border-radius:5px;padding:5px;cursor:pointer}.animation-container:hover{background-color:rgba(255,255,255,.25)}.contain{position:relative}.animation-container+.animation-container{margin-top:2em}input[type=range]{width:100%;padding:0;margin:0}html:not(.unsupported) .support{display:none}p.fix{line-height:1}.theme-bg-background,.theme-bg-primary,.theme-bg-secondary,.theme-bg-tertiary{background-color:#ff3a6b}html[theme=dark] .theme-bg-primary{background-color:#000!important}html[theme=dark] .theme-bg-background,html[theme=dark] .theme-bg-secondary,html[theme=dark] .theme-bg-tertiary{background-color:#ff3a6b!important}.theme-color-background,.theme-color-primary,.theme-color-secondary,.theme-color-tertiary{color:#ff3a6b}html[theme=dark] .theme-color-primary{color:#000!important}html[theme=dark] .theme-color-background,html[theme=dark] .theme-color-secondary,html[theme=dark] .theme-color-tertiary{color:#ff3a6b!important}.theme-font-title{font-family:"Frank Ruhl Libre",serif}.theme-font-light{font-family:"Varela Round",sans-serif}.theme-font-icon{font-family:"Material Icons",sans-serif}.theme-font-default{font-family:"Roboto",sans-serif}.theme-font-bold{font-family:"Montserrat",sans-serif}body,html{overflow-x:hidden}html{position:relative;min-height:100%}body{padding-top:75px;margin-bottom:60px}.box-shadow{box-shadow:0 .25rem .75rem rgba(0,0,0,.05)}.text-white-50{color:rgba(255,255,255,.5)}#splashscreen{position:fixed;z-index:1040;top:0;right:0;bottom:0;left:0;display:flex;align-content:center;align-items:center;justify-content:center;visibility:hidden;pointer-events:none}.splashscreen-inner{position:relative;z-index:11;display:block}.splashscreen-bg{position:absolute;z-index:10;top:0;right:0;bottom:0;left:0;background-color:#eee}.splashscreen-text{position:relative;z-index:11;font-size:16px;margin-top:150px;letter-spacing:5px}.spinner{position:absolute;z-index:12;top:50%;left:50%;width:66px;height:66px;margin-top:-33px;margin-left:-33px;-webkit-animation:contanim 2s linear infinite;animation:contanim 2s linear infinite}.spinner svg{display:block;margin:0;padding:0;width:100%;height:100%;left:0;top:0;position:absolute;transform:rotate(-90deg)}.spinner svg:nth-child(1) circle{stroke:#84ebbd;stroke-dasharray:1,300;stroke-dashoffset:0;-webkit-animation:strokeanim 3s calc(.2s*(1)) ease infinite;animation:strokeanim 3s calc(.2s*(1)) ease infinite;transform-origin:center center}.spinner svg:nth-child(2) circle,.spinner svg:nth-child(3) circle,.spinner svg:nth-child(4) circle{stroke:#4977ec;stroke-dasharray:1,300;stroke-dashoffset:0;-webkit-animation:strokeanim 3s calc(.2s*(2)) ease infinite;animation:strokeanim 3s calc(.2s*(2)) ease infinite;transform-origin:center center}.spinner svg:nth-child(3) circle,.spinner svg:nth-child(4) circle{stroke:#f6bb67;-webkit-animation:strokeanim 3s calc(.2s*(3)) ease infinite;animation:strokeanim 3s calc(.2s*(3)) ease infinite}.spinner svg:nth-child(4) circle{stroke:#ff5050;-webkit-animation:strokeanim 3s calc(.2s*(4)) ease infinite;animation:strokeanim 3s calc(.2s*(4)) ease infinite}#big-transition{position:fixed;z-index:2000;top:0;left:0;right:0;bottom:0;display:flex}#big-transition,#big-transition .spinner{opacity:0;visibility:hidden}#big-transition #big-transition-horizontal{position:absolute;top:0;left:0;right:0;bottom:0;display:flex;flex-flow:column}#big-transition #big-transition-horizontal>div{width:100%;flex:1 1;background:#fff;transform-origin:0 0;transform:scaleX(0)}.footer{position:relative;bottom:0;width:100%;height:60px;line-height:60px;background-color:#f5f5f5}main{overflow:hidden} \ No newline at end of file +/*! tailwindcss v2.1.2 | MIT License | https://tailwindcss.com *//*! modern-normalize v1.0.0 | MIT License | https://github.com/sindresorhus/modern-normalize */ + +/* +Document +======== +*/ + +/** +Use a better box model (opinionated). +*/ + +*, +*::before, +*::after { + box-sizing: border-box; +} + +/** +Use a more readable tab size (opinionated). +*/ + +:root { + -moz-tab-size: 4; + tab-size: 4; +} + +/** +1. Correct the line height in all browsers. +2. Prevent adjustments of font size after orientation changes in iOS. +*/ + +html { + line-height: 1.15; /* 1 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +/* +Sections +======== +*/ + +/** +Remove the margin in all browsers. +*/ + +body { + margin: 0; +} + +/** +Improve consistency of default fonts in all browsers. (https://github.com/sindresorhus/modern-normalize/issues/3) +*/ + +body { + font-family: + system-ui, + -apple-system, /* Firefox supports this but not yet `system-ui` */ + 'Segoe UI', + Roboto, + Helvetica, + Arial, + sans-serif, + 'Apple Color Emoji', + 'Segoe UI Emoji'; +} + +/* +Grouping content +================ +*/ + +/** +1. Add the correct height in Firefox. +2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655) +*/ + +hr { + height: 0; /* 1 */ + color: inherit; /* 2 */ +} + +/* +Text-level semantics +==================== +*/ + +/** +Add the correct text decoration in Chrome, Edge, and Safari. +*/ + +abbr[title] { + text-decoration: underline dotted; +} + +/** +Add the correct font weight in Edge and Safari. +*/ + +b, +strong { + font-weight: bolder; +} + +/** +1. Improve consistency of default fonts in all browsers. (https://github.com/sindresorhus/modern-normalize/issues/3) +2. Correct the odd 'em' font sizing in all browsers. +*/ + +code, +kbd, +samp, +pre { + font-family: + ui-monospace, + SFMono-Regular, + Consolas, + 'Liberation Mono', + Menlo, + monospace; /* 1 */ + font-size: 1em; /* 2 */ +} + +/** +Add the correct font size in all browsers. +*/ + +small { + font-size: 80%; +} + +/** +Prevent 'sub' and 'sup' elements from affecting the line height in all browsers. +*/ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sub { + bottom: -0.25em; +} + +sup { + top: -0.5em; +} + +/* +Tabular data +============ +*/ + +/** +1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297) +2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016) +*/ + +table { + text-indent: 0; /* 1 */ + border-color: inherit; /* 2 */ +} + +/* +Forms +===== +*/ + +/** +1. Change the font styles in all browsers. +2. Remove the margin in Firefox and Safari. +*/ + +button, +input, +optgroup, +select, +textarea { + font-family: inherit; /* 1 */ + font-size: 100%; /* 1 */ + line-height: 1.15; /* 1 */ + margin: 0; /* 2 */ +} + +/** +Remove the inheritance of text transform in Edge and Firefox. +1. Remove the inheritance of text transform in Firefox. +*/ + +button, +select { /* 1 */ + text-transform: none; +} + +/** +Correct the inability to style clickable types in iOS and Safari. +*/ + +button, +[type='button'], +[type='reset'], +[type='submit'] { + -webkit-appearance: button; +} + +/** +Remove the inner border and padding in Firefox. +*/ + +::-moz-focus-inner { + border-style: none; + padding: 0; +} + +/** +Restore the focus styles unset by the previous rule. +*/ + +:-moz-focusring { + outline: 1px dotted ButtonText; +} + +/** +Remove the additional ':invalid' styles in Firefox. +See: https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737 +*/ + +:-moz-ui-invalid { + box-shadow: none; +} + +/** +Remove the padding so developers are not caught out when they zero out 'fieldset' elements in all browsers. +*/ + +legend { + padding: 0; +} + +/** +Add the correct vertical alignment in Chrome and Firefox. +*/ + +progress { + vertical-align: baseline; +} + +/** +Correct the cursor style of increment and decrement buttons in Safari. +*/ + +::-webkit-inner-spin-button, +::-webkit-outer-spin-button { + height: auto; +} + +/** +1. Correct the odd appearance in Chrome and Safari. +2. Correct the outline style in Safari. +*/ + +[type='search'] { + -webkit-appearance: textfield; /* 1 */ + outline-offset: -2px; /* 2 */ +} + +/** +Remove the inner padding in Chrome and Safari on macOS. +*/ + +::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** +1. Correct the inability to style clickable types in iOS and Safari. +2. Change font properties to 'inherit' in Safari. +*/ + +::-webkit-file-upload-button { + -webkit-appearance: button; /* 1 */ + font: inherit; /* 2 */ +} + +/* +Interactive +=========== +*/ + +/* +Add the correct display in Chrome and Safari. +*/ + +summary { + display: list-item; +}/** + * Manually forked from SUIT CSS Base: https://github.com/suitcss/base + * A thin layer on top of normalize.css that provides a starting point more + * suitable for web applications. + */ + +/** + * Removes the default spacing and border for appropriate elements. + */ + +blockquote, +dl, +dd, +h1, +h2, +h3, +h4, +h5, +h6, +hr, +figure, +p, +pre { + margin: 0; +} + +button { + background-color: transparent; + background-image: none; +} + +/** + * Work around a Firefox/IE bug where the transparent `button` background + * results in a loss of the default `button` focus styles. + */ + +button:focus { + outline: 1px dotted; + outline: 5px auto -webkit-focus-ring-color; +} + +fieldset { + margin: 0; + padding: 0; +} + +ol, +ul { + list-style: none; + margin: 0; + padding: 0; +} + +/** + * Tailwind custom reset styles + */ + +/** + * 1. Use the user's configured `sans` font-family (with Tailwind's default + * sans-serif font stack as a fallback) as a sane default. + * 2. Use Tailwind's default "normal" line-height so the user isn't forced + * to override it to ensure consistency even when using the default theme. + */ + +html { + font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; /* 1 */ + line-height: 1.5; /* 2 */ +} + + +/** + * Inherit font-family and line-height from `html` so users can set them as + * a class directly on the `html` element. + */ + +body { + font-family: inherit; + line-height: inherit; +} + +/** + * 1. Prevent padding and border from affecting element width. + * + * We used to set this in the html element and inherit from + * the parent element for everything else. This caused issues + * in shadow-dom-enhanced elements like
where the content + * is wrapped by a div with box-sizing set to `content-box`. + * + * https://github.com/mozdevs/cssremedy/issues/4 + * + * + * 2. Allow adding a border to an element by just adding a border-width. + * + * By default, the way the browser specifies that an element should have no + * border is by setting it's border-style to `none` in the user-agent + * stylesheet. + * + * In order to easily add borders to elements by just setting the `border-width` + * property, we change the default border-style for all elements to `solid`, and + * use border-width to hide them instead. This way our `border` utilities only + * need to set the `border-width` property instead of the entire `border` + * shorthand, making our border utilities much more straightforward to compose. + * + * https://github.com/tailwindcss/tailwindcss/pull/116 + */ + +*, +::before, +::after { + box-sizing: border-box; /* 1 */ + border-width: 0; /* 2 */ + border-style: solid; /* 2 */ + border-color: #e5e7eb; /* 2 */ +} + +/* + * Ensure horizontal rules are visible by default + */ + +hr { + border-top-width: 1px; +} + +/** + * Undo the `border-style: none` reset that Normalize applies to images so that + * our `border-{width}` utilities have the expected effect. + * + * The Normalize reset is unnecessary for us since we default the border-width + * to 0 on all elements. + * + * https://github.com/tailwindcss/tailwindcss/issues/362 + */ + +img { + border-style: solid; +} + +textarea { + resize: vertical; +} + +input::placeholder, +textarea::placeholder { + opacity: 1; + color: #9ca3af; +} + +button, +[role="button"] { + cursor: pointer; +} + +table { + border-collapse: collapse; +} + +h1, +h2, +h3, +h4, +h5, +h6 { + font-size: inherit; + font-weight: inherit; +} + +/** + * Reset links to optimize for opt-in styling instead of + * opt-out. + */ + +a { + color: inherit; + text-decoration: inherit; +} + +/** + * Reset form element properties that are easy to forget to + * style explicitly so you don't inadvertently introduce + * styles that deviate from your design system. These styles + * supplement a partial reset that is already applied by + * normalize.css. + */ + +button, +input, +optgroup, +select, +textarea { + padding: 0; + line-height: inherit; + color: inherit; +} + +/** + * Use the configured 'mono' font family for elements that + * are expected to be rendered with a monospace font, falling + * back to the system monospace stack if there is no configured + * 'mono' font family. + */ + +pre, +code, +kbd, +samp { + font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; +} + +/** + * Make replaced elements `display: block` by default as that's + * the behavior you want almost all of the time. Inspired by + * CSS Remedy, with `svg` added as well. + * + * https://github.com/mozdevs/cssremedy/issues/14 + */ + +img, +svg, +video, +canvas, +audio, +iframe, +embed, +object { + display: block; + vertical-align: middle; +} + +/** + * Constrain images and videos to the parent width and preserve + * their intrinsic aspect ratio. + * + * https://github.com/mozdevs/cssremedy/issues/14 + */ + +img, +video { + max-width: 100%; + height: auto; +} + +* { + --tw-shadow: 0 0 #0000; + --tw-ring-inset: var(--tw-empty,/*!*/ /*!*/); + --tw-ring-offset-width: 0px; + --tw-ring-offset-color: #fff; + --tw-ring-color: rgba(59, 130, 246, 0.5); + --tw-ring-offset-shadow: 0 0 #0000; + --tw-ring-shadow: 0 0 #0000; +}.container { + width: 100%; + margin-right: auto; + margin-left: auto; +}@media (min-width: 640px) { + + .container { + max-width: 640px; + } +}@media (min-width: 768px) { + + .container { + max-width: 768px; + } +}@media (min-width: 1024px) { + + .container { + max-width: 1024px; + } +}@media (min-width: 1280px) { + + .container { + max-width: 1280px; + } +}@media (min-width: 1536px) { + + .container { + max-width: 1536px; + } +}.col-span-3 { + grid-column: span 3 / span 3; +}.col-span-9 { + grid-column: span 9 / span 9; +}.col-span-6 { + grid-column: span 6 / span 6; +}.col-span-12 { + grid-column: span 12 / span 12; +}.m-5 { + margin: 1.25rem; +}.my-3 { + margin-top: 0.75rem; + margin-bottom: 0.75rem; +}.my-2 { + margin-top: 0.5rem; + margin-bottom: 0.5rem; +}.mb-2 { + margin-bottom: 0.5rem; +}.mt-8 { + margin-top: 2rem; +}.mb-5 { + margin-bottom: 1.25rem; +}.block { + display: block; +}.inline-block { + display: inline-block; +}.flex { + display: flex; +}.grid { + display: grid; +}.grid-cols-12 { + grid-template-columns: repeat(12, minmax(0, 1fr)); +}.flex-col { + flex-direction: column; +}.gap-6 { + gap: 1.5rem; +}.space-y-6 > :not([hidden]) ~ :not([hidden]) { + --tw-space-y-reverse: 0; + margin-top: calc(1.5rem * calc(1 - var(--tw-space-y-reverse))); + margin-bottom: calc(1.5rem * var(--tw-space-y-reverse)); +}.overflow-hidden { + overflow: hidden; +}.rounded { + border-radius: 0.25rem; +}.rounded-lg { + border-radius: 0.5rem; +}.rounded-md { + border-radius: 0.375rem; +}.border { + border-width: 1px; +}.border-gray-200 { + --tw-border-opacity: 1; + border-color: rgba(229, 231, 235, var(--tw-border-opacity)); +}.bg-white { + --tw-bg-opacity: 1; + background-color: rgba(255, 255, 255, var(--tw-bg-opacity)); +}.bg-gray-200 { + --tw-bg-opacity: 1; + background-color: rgba(229, 231, 235, var(--tw-bg-opacity)); +}.p-3 { + padding: 0.75rem; +}.p-4 { + padding: 1rem; +}.p-5 { + padding: 1.25rem; +}.px-4 { + padding-left: 1rem; + padding-right: 1rem; +}.py-5 { + padding-top: 1.25rem; + padding-bottom: 1.25rem; +}.px-12 { + padding-left: 3rem; + padding-right: 3rem; +}.py-24 { + padding-top: 6rem; + padding-bottom: 6rem; +}.px-2 { + padding-left: 0.5rem; + padding-right: 0.5rem; +}.py-4 { + padding-top: 1rem; + padding-bottom: 1rem; +}.py-2 { + padding-top: 0.5rem; + padding-bottom: 0.5rem; +}.text-right { + text-align: right; +}.align-middle { + vertical-align: middle; +}.font-sans { + font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; +}.text-5xl { + font-size: 3rem; + line-height: 1; +}.text-lg { + font-size: 1.125rem; + line-height: 1.75rem; +}.font-light { + font-weight: 300; +}.text-gray-500 { + --tw-text-opacity: 1; + color: rgba(107, 114, 128, var(--tw-text-opacity)); +}body { + --tw-bg-opacity: 1; + background-color: rgba(255, 255, 255, var(--tw-bg-opacity)); + --tw-text-opacity: 1; + color: rgba(0, 0, 0, var(--tw-text-opacity));font-size:1rem;line-height:1.5; +}.icon{-webkit-font-feature-settings:"liga" off,"dlig";-moz-font-feature-settings:"liga=0, dlig=1";font-feature-settings:"liga","dlig";-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility;font-family:"Material Icons";vertical-align:middle;letter-spacing:normal;display:inline-block;text-decoration:none;text-transform:none;white-space:nowrap;font-weight:normal;position:relative;font-style:normal;word-wrap:normal;font-size:24px;line-height:1;direction:ltr;height:1em;width:1em}a { + --tw-text-opacity: 1; + color: rgba(59, 130, 246, var(--tw-text-opacity)); + text-decoration: underline; +}a:hover { + --tw-text-opacity: 1; + color: rgba(29, 78, 216, var(--tw-text-opacity)); +}button,a{transition:color .2s ease-out,box-shadow .2s ease-out}button:focus, a:focus { + --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); + --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color); + box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); + --tw-ring-opacity: 1; + --tw-ring-color: rgba(59, 130, 246, var(--tw-ring-opacity)); + --tw-ring-opacity: 0.5; + border-radius: 0.125rem; + outline: 2px solid transparent; + outline-offset: 2px; +}button,a{-webkit-tap-highlight-color:transparent}.navbar { + position: fixed; + top: 0px; + left: 0px; + z-index: 50; + width: 100%; +}.navbar .container { + border-bottom-width: 1px; + --tw-border-opacity: 1; + border-color: rgba(229, 231, 235, var(--tw-border-opacity)); + --tw-bg-opacity: 1; + background-color: rgba(255, 255, 255, var(--tw-bg-opacity)); + display: flex; + flex-wrap: wrap; + align-items: center; + justify-content: space-between; + padding-left: 1.25rem; + padding-right: 1.25rem; + padding-top: 0.5rem; + padding-bottom: 0.5rem; +}@media (min-width: 1024px) { + + .navbar .container { + max-width: 1280px; + } +}.navbar-offset { + margin-top: 4rem; +}.navbar-collapse { + align-items: center; +}@media (max-width: 639px){.navbar-collapse{--height: 100vh;transition:height ease-out .25s;overflow:hidden}.navbar-collapse { + flex-grow: 1; + }.navbar-collapse{flex-basis:100%}.navbar-collapse.show{height:100%;height:var(--height, 100vh)}.navbar-collapse.collapse{height:0}}.navbar-list { + display: flex; + flex-wrap: nowrap; +}@media (max-width: 639px) { + + .navbar-list { + flex-direction: column; + } +}.navbar-logo { + font-size: 1.25rem; + line-height: 1.75rem; + font-weight: 700; +}@media (min-width: 640px) { + + .navbar-list a { + margin-left: 0.25rem; + margin-right: 0.25rem; + } +}@media (max-width: 639px) { + + .navbar-list a { + margin-top: 0.25rem; + margin-bottom: 0.25rem; + } + + .navbar-list a { + width: 100%; + } +}.navbar-logo, .navbar-list a { + border-radius: 0.375rem; + padding-left: 0.75rem; + padding-right: 0.75rem; + padding-top: 0.5rem; + padding-bottom: 0.5rem; + text-decoration: none; +}.navbar-logo:hover, .navbar-list a:hover { + --tw-text-opacity: 1; + color: rgba(96, 165, 250, var(--tw-text-opacity)); +}.navbar-logo.active, .navbar-list a.active { + --tw-bg-opacity: 1; + background-color: rgba(37, 99, 235, var(--tw-bg-opacity)); + --tw-text-opacity: 1; + color: rgba(255, 255, 255, var(--tw-text-opacity)); +}.navbar-toggle,.navbar-logo,.navbar-list a{transition:background-color .15s ease-out,color .15s ease-out,border-color .2s ease-out,box-shadow .2s ease-out}.navbar-toggle { + border-radius: 0.375rem; + border-width: 1px; + border-style: solid; + --tw-border-opacity: 1; + border-color: rgba(209, 213, 219, var(--tw-border-opacity)); +}@media (min-width: 640px) { + + .navbar-toggle { + display: none; + } +}.navbar-toggle { + height: 2.5rem; + width: 2.5rem; + --tw-text-opacity: 1; + color: rgba(59, 130, 246, var(--tw-text-opacity)); +}.navbar-toggle:hover { + --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); + --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color); + box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); + --tw-ring-opacity: 1; + --tw-ring-color: rgba(59, 130, 246, var(--tw-ring-opacity)); + --tw-ring-opacity: 0.5; +}.navbar-toggle:focus { + border-radius: 0.375rem; + --tw-border-opacity: 1; + border-color: rgba(37, 99, 235, var(--tw-border-opacity)); + --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); + --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color); + box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); +}.btn { + border-radius: 0.375rem; + padding-left: 0.75rem; + padding-right: 0.75rem; + padding-top: 0.5rem; + padding-bottom: 0.5rem; + text-decoration: none; +}.btn.active { + --tw-bg-opacity: 1; + background-color: rgba(37, 99, 235, var(--tw-bg-opacity)); + --tw-text-opacity: 1; + color: rgba(255, 255, 255, var(--tw-text-opacity)); +}@media (min-width: 1024px) { + + .lg\:max-w-screen-xl { + max-width: 1280px; + } +} \ No newline at end of file diff --git a/demo/css/components/old.css b/demo/css/components/old.css new file mode 100644 index 0000000..e69de29 diff --git a/demo/index.html b/demo/index.html index 0a1e1ea..3e6ed95 100644 --- a/demo/index.html +++ b/demo/index.html @@ -1,56 +1,56 @@ -Homepage

Homepage.

Dynamic example.

Requires native Web Animation Support (latest Firefox, Chrome, Opera)

This is pretty cool right

0%

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis fringilla. +Homepage

Homepage

Dynamic example.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor iaculis arcu ac rutrum. Suspendisse vel odio -risus.

Normal img

Normal image.

Lazyloaded img

Lazyloaded picture with webp (for chrome).

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis +risus.

Normal img

Normal image.

Lazyloaded img

Lazyloaded picture.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor -iaculis arcu ac rutrum. Suspendisse vel odio risus.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis +iaculis arcu ac rutrum. Suspendisse vel odio risus.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor -iaculis arcu ac rutrum. Suspendisse vel odio risus.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis +iaculis arcu ac rutrum. Suspendisse vel odio risus.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor -iaculis arcu ac rutrum. Suspendisse vel odio risus.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis +iaculis arcu ac rutrum. Suspendisse vel odio risus.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor -iaculis arcu ac rutrum. Suspendisse vel odio risus.

Cras mattis consectetur purus sit amet fermentum. Nulla vitae elit libero, a pharetra augue. Sed +iaculis arcu ac rutrum. Suspendisse vel odio risus.

Cras mattis consectetur purus sit amet fermentum. Nulla vitae elit libero, a pharetra augue. Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Vestibulum id ligula porta felis euismod semper. Praesent commodo cursus -magna, vel scelerisque nisl consectetur et.

Etiam porta sem malesuada magna mollis euismod. Cum sociis natoque penatibus et magnis dis parturient +magna, vel scelerisque nisl consectetur et.

Etiam porta sem malesuada magna mollis euismod. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec ullamcorper nulla non metus auctor fringilla. Sed posuere consectetur est at lobortis. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. Donec id elit non mi porta gravida at -eget metus. Cras mattis consectetur purus sit amet fermentum.

Lazyloaded img

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis +eget metus. Cras mattis consectetur purus sit amet fermentum.

Lazyloaded img

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor -iaculis arcu ac rutrum. Suspendisse vel odio risus.

Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus +iaculis arcu ac rutrum. Suspendisse vel odio risus.

Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Curabitur blandit tempus porttitor. Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta felis euismod semper. @@ -59,14 +59,14 @@ pharetra augue. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, sem nec elit. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Nulla vitae elit libero, a pharetra augue. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Praesent commodo cursus magna, -vel scelerisque nisl consectetur et.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis +vel scelerisque nisl consectetur et.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor -iaculis arcu ac rutrum. Suspendisse vel odio risus.

Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus +iaculis arcu ac rutrum. Suspendisse vel odio risus.

Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Curabitur blandit tempus porttitor. Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta felis euismod semper. @@ -75,14 +75,14 @@ pharetra augue. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, sem nec elit. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Nulla vitae elit libero, a pharetra augue. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Praesent commodo cursus magna, -vel scelerisque nisl consectetur et.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis +vel scelerisque nisl consectetur et.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor -iaculis arcu ac rutrum. Suspendisse vel odio risus.

Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus +iaculis arcu ac rutrum. Suspendisse vel odio risus.

Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Curabitur blandit tempus porttitor. Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta felis euismod semper. @@ -91,6 +91,4 @@ pharetra augue. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, sem nec elit. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Nulla vitae elit libero, a pharetra augue. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Praesent commodo cursus magna, -vel scelerisque nisl consectetur et.

Lazyloaded img

Lazyloaded image.

Lazyloaded img

Lazyloaded image.

Lazyloaded img

Lazyloaded image.

\ No newline at end of file +vel scelerisque nisl consectetur et.

Lazyloaded img

Lazyloaded image.

Lazyloaded img

Lazyloaded image.

Lazyloaded img

Lazyloaded image.

\ No newline at end of file diff --git a/demo/other.html b/demo/other.html index 0479cfe..194d1f5 100644 --- a/demo/other.html +++ b/demo/other.html @@ -1,4 +1,4 @@ -Other page

Other Page

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ex est, maximus aliquam sagittis vel, +Other page

Other Page

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ex est, maximus aliquam sagittis vel, tempus vel odio. Praesent felis elit, blandit et laoreet nec, hendrerit et arcu. Aenean ligula sapien, sodales vel semper in, pulvinar id nulla. Donec pellentesque non tellus vel imperdiet. Pellentesque posuere, nisl sed rutrum tincidunt, augue augue vestibulum ex, vel ornare justo arcu eu magna. Praesent @@ -199,6 +199,4 @@ mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae el sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor -iaculis arcu ac rutrum. Suspendisse vel odio risus.

\ No newline at end of file +iaculis arcu ac rutrum. Suspendisse vel odio risus.

\ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index f3e43c1..cdfabc9 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -2,9 +2,7 @@ const mode = process.argv.includes("--watch") ? "watch" : "build"; // Gulp utilities -import { gulpSass as sass, watch, task, series, parallel, stream } from "./util.js"; -import { createRequire } from 'module'; -const require = createRequire(import.meta.url); +import { watch, task, series, parallel, stream } from "./util.js"; // Origin folders (source and destination folders) const srcFolder = `build`; @@ -44,22 +42,48 @@ task("html", async () => { task("css", async () => { const [ { default: postcss }, - { default: autoprefixer }, { default: tailwind }, - { default: csso } + { default: scss }, + { default: sass }, + { default: rename } ] = await Promise.all([ import("gulp-postcss"), - import("autoprefixer"), import("tailwindcss"), - import("postcss-csso") + import("postcss-scss"), + import("@csstools/postcss-sass"), + import("gulp-rename") ]); - const { logError } = sass; + return stream(`${sassFolder}/**/*.scss`, { pipes: [ // Minify scss to css - sass({ outputStyle: "compressed" }).on("error", logError), postcss([ + sass({ outputStyle: "compressed" }), tailwind("./tailwind.cjs"), + ], { syntax: scss }), + + rename({ extname: ".css" }), + ], + dest: cssFolder, + end: browserSync ? [browserSync.stream()] : null, + }); +}); + +task("minify-css", async () => { + const [ + { default: postcss }, + { default: autoprefixer }, + { default: csso }, + ] = await Promise.all([ + import("gulp-postcss"), + import("autoprefixer"), + import("postcss-csso"), + ]); + + return stream(`${cssFolder}/**/*.css`, { + pipes: [ + // Minify scss to css + postcss([ csso(), autoprefixer(), ]) @@ -105,7 +129,7 @@ task("js", async () => { }); // Build & Watch Tasks -task("build", parallel("html", "css", "js")); +task("build", parallel("html", series("css", "minify-css"), "js")); task("watch", async () => { const { default: bs } = await import("browser-sync"); browserSync = bs.create(); @@ -140,7 +164,7 @@ task("watch", async () => { ); watch(`${pugFolder}/**/*.pug`, series("html")); - watch(`${sassFolder}/**/*.scss`, series("css")); + watch([`${sassFolder}/**/*.scss`, `./tailwind.cjs`], series("css")); watch( [ `${tsFolder}/**/*.ts`, diff --git a/old.scss b/old.scss new file mode 100644 index 0000000..bc2ac03 --- /dev/null +++ b/old.scss @@ -0,0 +1,256 @@ + +/* +.div { + --size: 8vmin; + width: var(--size); + height: var(--size); + border-radius: 8%; + background: #616aff; +} + +.el, +.el-initial { + --size: 4vmin; + width: var(--size); + height: var(--size); + // border-radius: 8%; + margin: 5px; + background: #616aff; + position: relative; +} + +.svg { + margin: auto; + display: block; + width: 500px; + height: 300px; + max-height: 100vh; + max-width: 100%; + + & path { + stroke: #fff2b1; + stroke-dasharray: 400 400; + stroke-dashoffset: 0; + } +} + +.el-initial { + opacity: 0.6; + position: absolute; + display: block; + margin-top: 0; + top: 0; +} + +.animation-container { + transition: background-color 0.5s ease; + background-color: rgba(0, 0, 0, 0.085); + border-radius: 5px; + padding: 5px; + cursor: pointer; + + &:hover { + background-color: rgba(255, 255, 255, 0.25); + } +} + +.contain { + position: relative; +} + +.animation-container + .animation-container { + margin-top: 2em; +} + +input[type="range"] { + width: 100%; + padding: 0; + margin: 0; +} +html:not(.unsupported) .support { + display: none; +} + +p.fix { + line-height: 1; +} + +html { + // position: relative; + // min-height: 100%; +} + +.box-shadow { + box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.05); +} + +.text-white-50 { + color: rgba(255, 255, 255, 0.5); +} + +.spinner { + position: absolute; + z-index: 12; + top: 50%; + left: 50%; + width: 66px; + height: 66px; + margin-top: -33px; + margin-left: -33px; + animation: contanim 2s linear infinite; +} + +.spinner svg { + display: block; + margin: 0; + padding: 0; + width: 100%; + height: 100%; + left: 0; + top: 0; + position: absolute; + -webkit-transform: rotate(-90deg); + transform: rotate(-90deg); +} + +.spinner svg:nth-child(1) circle { + stroke: #84ebbd; + stroke-dasharray: 1, 300; + stroke-dashoffset: 0; + animation: strokeanim 3s calc(0.2s * (1)) ease infinite; + transform-origin: center center; +} + +.spinner svg:nth-child(2) circle { + stroke: #4977ec; + stroke-dasharray: 1, 300; + stroke-dashoffset: 0; + animation: strokeanim 3s calc(0.2s * (2)) ease infinite; + transform-origin: center center; +} + +.spinner svg:nth-child(3) circle { + stroke: #f6bb67; + stroke-dasharray: 1, 300; + stroke-dashoffset: 0; + animation: strokeanim 3s calc(0.2s * (3)) ease infinite; + transform-origin: center center; +} + +.spinner svg:nth-child(4) circle { + stroke: #ff5050; + stroke-dasharray: 1, 300; + stroke-dashoffset: 0; + animation: strokeanim 3s calc(0.2s * (4)) ease infinite; + transform-origin: center center; +} + +// @-webkit-keyframes strokeanim { +// 0% { +// stroke-dasharray: 1, 300; +// stroke-dashoffset: 0; +// } + +// 50% { +// stroke-dasharray: 120, 300; +// stroke-dashoffset: -58.548324585; +// } + +// 100% { +// stroke-dasharray: 120, 300; +// stroke-dashoffset: -175.6449737549; +// } +// } + +@keyframes strokeanim { + 0% { + stroke-dasharray: 1, 300; + stroke-dashoffset: 0; + } + + 50% { + stroke-dasharray: 120, 300; + stroke-dashoffset: -58.548324585; + } + + 100% { + stroke-dasharray: 120, 300; + stroke-dashoffset: -175.6449737549; + } +} + +// @-webkit-keyframes contanim { +// 100% { +// -webkit-transform: rotate(360deg); +// transform: rotate(360deg); +// } +// } + +@keyframes contanim { + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} + +#big-transition { + position: fixed; + z-index: 2000; + top: 0; + left: 0; + right: 0; + bottom: 0; + display: flex; + opacity: 0; + visibility: hidden; +} + +#big-transition .spinner { + opacity: 0; + visibility: hidden; +} + +#big-transition #big-transition-horizontal { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + display: flex; +} + +#big-transition #big-transition-horizontal { + flex-flow: column; +} + +#big-transition #big-transition-horizontal > div { + width: 100%; + flex: 1 1; + background: #fff; + transform-origin: 0 0; + transform: scaleX(0); +} + +.footer { + // position: absolute; + position: relative; + bottom: 0; + width: 100%; + height: 60px; + line-height: 60px; + background-color: #f5f5f5; +} + +main { + overflow: hidden; +} + +// [data-block="IntroBlock"] { +// transition: transform .5s ease, opacity .5s ease; + +// &.active { +// transform: translateX(0%) !important; +// opacity: 1 !important; +// } +// } +*/ diff --git a/package.json b/package.json index 9e8f4c2..3b7dfb3 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "build": "pnpm -r build", "watch": "pnpm -r watch --parallel", "demo": "gulp default --watch", - "demo-build": "gulp default --watch", + "demo-build": "gulp build", "dts": "ultra -r dts", "test": "ultra -r test", "test-dev": "ultra -r test-dev", @@ -41,6 +41,7 @@ "devDependencies": { "@commitlint/cli": "^12.1.1", "@commitlint/config-conventional": "^12.1.1", + "@csstools/postcss-sass": "^4.0.0", "autoprefixer": "^10.2.5", "browser-sync": "^2.26.14", "chalk": "^4.1.1", @@ -56,19 +57,15 @@ "gzip-size": "^6.0.0", "husky": "^6.0.0", "lerna-changelog": "^1.0.1", - "lodash-es": "^4.17.21", - "plugin-error": "^1.0.1", "pnpm": "^6.0.2", "postcss": "^8.2.12", + "postcss-cli": "^8.3.1", "postcss-csso": "^5.0.1", + "postcss-scss": "^3.0.5", "pretty-bytes": "^5.6.0", - "replace-ext": "^2.0.0", "sass": "^1.32.11", "standard-version": "^9.2.0", - "strip-ansi": "^7.0.0", - "tailwindcss": "^2.1.1", - "through2": "^4.0.2", - "ultra-runner": "^3.10.5", - "vinyl-sourcemaps-apply": "^0.2.1" + "tailwindcss": "^2.1.2", + "ultra-runner": "^3.10.5" } } \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4d020fc..8691e12 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,6 +6,7 @@ importers: specifiers: '@commitlint/cli': ^12.1.1 '@commitlint/config-conventional': ^12.1.1 + '@csstools/postcss-sass': ^4.0.0 '@okikio/native': workspace:* autoprefixer: ^10.2.5 browser-sync: ^2.26.14 @@ -22,25 +23,22 @@ importers: gzip-size: ^6.0.0 husky: ^6.0.0 lerna-changelog: ^1.0.1 - lodash-es: ^4.17.21 - plugin-error: ^1.0.1 pnpm: ^6.0.2 postcss: ^8.2.12 + postcss-cli: ^8.3.1 postcss-csso: ^5.0.1 + postcss-scss: ^3.0.5 pretty-bytes: ^5.6.0 - replace-ext: ^2.0.0 sass: ^1.32.11 standard-version: ^9.2.0 - strip-ansi: ^7.0.0 - tailwindcss: ^2.1.1 - through2: ^4.0.2 + tailwindcss: ^2.1.2 ultra-runner: ^3.10.5 - vinyl-sourcemaps-apply: ^0.2.1 dependencies: '@okikio/native': link:packages/native devDependencies: '@commitlint/cli': 12.1.1 '@commitlint/config-conventional': 12.1.1 + '@csstools/postcss-sass': 4.0.0 autoprefixer: 10.2.5_postcss@8.2.12 browser-sync: 2.26.14 chalk: 4.1.1 @@ -56,20 +54,16 @@ importers: gzip-size: 6.0.0 husky: 6.0.0 lerna-changelog: 1.0.1 - lodash-es: 4.17.21 - plugin-error: 1.0.1 pnpm: 6.0.2 postcss: 8.2.12 + postcss-cli: 8.3.1_postcss@8.2.12 postcss-csso: 5.0.1_postcss@8.2.12 + postcss-scss: 3.0.5 pretty-bytes: 5.6.0 - replace-ext: 2.0.0 sass: 1.32.11 standard-version: 9.2.0 - strip-ansi: 7.0.0 - tailwindcss: 2.1.1_d887a42ede92218908fd5c3cc0b71177 - through2: 4.0.2 + tailwindcss: 2.1.2_d887a42ede92218908fd5c3cc0b71177 ultra-runner: 3.10.5 - vinyl-sourcemaps-apply: 0.2.1 packages/animate: specifiers: @@ -621,6 +615,21 @@ packages: chalk: 4.1.1 dev: true + /@csstools/postcss-sass/4.0.0: + resolution: {integrity: sha512-yvm2aaODNJ8PBn43HjYiRvVJcYLEpz5BEKXxQ/7HryqcL+TnAceXZO+khadTEkjw90r8afR5wykTzvVpFeo4vw==} + engines: {node: '>=8.0.0'} + dependencies: + '@csstools/sass-import-resolve': 1.0.0 + postcss: 7.0.35 + sass: 1.32.11 + source-map: 0.7.3 + dev: true + + /@csstools/sass-import-resolve/1.0.0: + resolution: {integrity: sha512-pH4KCsbtBLLe7eqUrw8brcuFO8IZlN36JjdKlOublibVdAIPHCzEnpBWOVUXK5sCf+DpBi8ZtuWtjF0srybdeA==} + engines: {node: '>=4.0.0'} + dev: true + /@fullhuman/postcss-purgecss/3.1.3: resolution: {integrity: sha512-kwOXw8fZ0Lt1QmeOOrd+o4Ibvp4UTEBFQbzvWldjlKv5n+G9sXfIPn1hh63IQIL8K8vbvv1oYMJiIUbuy9bGaA==} dependencies: @@ -1156,11 +1165,6 @@ packages: engines: {node: '>=8'} dev: true - /ansi-regex/6.0.0: - resolution: {integrity: sha512-tAaOSrWCHF+1Ear1Z4wnJCXA9GGox4K6Ic85a5qalES2aeEwQGr7UC93mwef49536PkCYjzkp0zIxfFvexJ6zQ==} - engines: {node: '>=12'} - dev: true - /ansi-split/1.0.1: resolution: {integrity: sha512-RRxQym4DFtDNmHIkW6aeFVvrXURb11lGAEPXNiryjCe8bK8RsANjzJ0M2aGOkvBYwP4Bl/xZ8ijtr6D3j1x/eg==} dependencies: @@ -1321,6 +1325,11 @@ packages: kind-of: 5.1.0 dev: true + /array-union/2.1.0: + resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==} + engines: {node: '>=8'} + dev: true + /array-unique/0.3.2: resolution: {integrity: sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=} engines: {node: '>=0.10.0'} @@ -2751,6 +2760,11 @@ packages: engines: {node: '>= 0.6'} dev: true + /dependency-graph/0.9.0: + resolution: {integrity: sha512-9YLIBURXj4DJMFALxXw9K3Y3rwb5Fk0X5/8ipCzaN84+gKxoHK43tVKRNakCQbiEx07E8Uwhuq21BpUagFhZ8w==} + engines: {node: '>= 0.6.0'} + dev: true + /destroy/1.0.4: resolution: {integrity: sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=} dev: true @@ -2795,6 +2809,13 @@ packages: engines: {node: '>= 10.14.2'} dev: true + /dir-glob/3.0.1: + resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} + engines: {node: '>=8'} + dependencies: + path-type: 4.0.0 + dev: true + /dlv/1.1.3: resolution: {integrity: sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==} dev: true @@ -3758,6 +3779,18 @@ packages: engines: {node: '>=4'} dev: true + /globby/11.0.3: + resolution: {integrity: sha512-ffdmosjA807y7+lA1NM0jELARVmYul/715xiILEjo3hBLPTcirgQNnXECn5g3mtR8TOLCVbkfua1Hpen25/Xcg==} + engines: {node: '>=10'} + dependencies: + array-union: 2.1.0 + dir-glob: 3.0.1 + fast-glob: 3.2.5 + ignore: 5.1.8 + merge2: 1.4.1 + slash: 3.0.0 + dev: true + /globrex/0.1.2: resolution: {integrity: sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==} dev: true @@ -4028,7 +4061,7 @@ packages: depd: 1.1.2 inherits: 2.0.3 setprototypeof: 1.1.0 - statuses: 1.4.0 + statuses: 1.5.0 dev: true /http-errors/1.7.3: @@ -4134,6 +4167,13 @@ packages: import-from: 2.1.0 dev: true + /import-cwd/3.0.0: + resolution: {integrity: sha512-4pnzH16plW+hgvRECbDWpQl3cqtvSofHWh44met7ESfZ8UZOWWddm8hEyDTqREJ9RbYHY8gi8DqmaelApoOGMg==} + engines: {node: '>=8'} + dependencies: + import-from: 3.0.0 + dev: true + /import-fresh/2.0.0: resolution: {integrity: sha1-2BNVwVYS04bGH53dOSLUMEgipUY=} engines: {node: '>=4'} @@ -4157,6 +4197,13 @@ packages: resolve-from: 3.0.0 dev: true + /import-from/3.0.0: + resolution: {integrity: sha512-CiuXOFFSzkU5x/CR0+z7T91Iht4CXgfCxVOFRhh2Zyhg5wOpWvvDLQUsWl+gcN+QscYBjez8hDCt85O7RLDttQ==} + engines: {node: '>=8'} + dependencies: + resolve-from: 5.0.0 + dev: true + /import-local/3.0.2: resolution: {integrity: sha512-vjL3+w0oulAVZ0hBHnxa/Nm5TAurf9YLQJDhqRZyqb+VKGOB6LU8t9H1Nr5CIo16vh9XfJTOoHwU0B71S557gA==} engines: {node: '>=8'} @@ -5394,8 +5441,20 @@ packages: p-locate: 5.0.0 dev: true - /lodash-es/4.17.21: - resolution: {integrity: sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==} + /lodash.difference/4.5.0: + resolution: {integrity: sha1-nMtOUF1Ia5FlE0V3KIWi3yf9AXw=} + dev: true + + /lodash.forown/4.4.0: + resolution: {integrity: sha1-hRFc8E9z75ZuztUlEdOJPMRmg68=} + dev: true + + /lodash.get/4.4.2: + resolution: {integrity: sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=} + dev: true + + /lodash.groupby/4.6.0: + resolution: {integrity: sha1-Cwih3PaDl8OXhVwyOXg4Mt90A9E=} dev: true /lodash.isfinite/3.3.2: @@ -5410,6 +5469,10 @@ packages: resolution: {integrity: sha1-dx7Hg540c9nEzeKLGTlMNWL09tM=} dev: true + /lodash.sortby/4.7.0: + resolution: {integrity: sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=} + dev: true + /lodash.toarray/4.4.0: resolution: {integrity: sha1-JMS/zWsvuji/0FlNsRedjptlZWE=} dev: true @@ -6430,6 +6493,28 @@ packages: engines: {node: '>=0.10.0'} dev: true + /postcss-cli/8.3.1_postcss@8.2.12: + resolution: {integrity: sha512-leHXsQRq89S3JC9zw/tKyiVV2jAhnfQe0J8VI4eQQbUjwIe0XxVqLrR+7UsahF1s9wi4GlqP6SJ8ydf44cgF2Q==} + engines: {node: '>=10'} + hasBin: true + peerDependencies: + postcss: ^8.0.0 + dependencies: + chalk: 4.1.1 + chokidar: 3.5.1 + dependency-graph: 0.9.0 + fs-extra: 9.1.0 + get-stdin: 8.0.0 + globby: 11.0.3 + postcss: 8.2.12 + postcss-load-config: 3.0.1 + postcss-reporter: 7.0.2_postcss@8.2.12 + pretty-hrtime: 1.0.3 + read-cache: 1.0.0 + slash: 3.0.0 + yargs: 16.2.0 + dev: true + /postcss-csso/5.0.1_postcss@8.2.12: resolution: {integrity: sha512-TI99uhhJK2L5IQXPuyNcT3XV9bffSvDPmNpHi5f+tBq+R/01ucgLsUCcTDcVNqKMxO28klI6NwgjrHrM99x9KA==} engines: {node: '>=10.12.0'} @@ -6465,6 +6550,14 @@ packages: import-cwd: 2.1.0 dev: true + /postcss-load-config/3.0.1: + resolution: {integrity: sha512-/pDHe30UYZUD11IeG8GWx9lNtu1ToyTsZHnyy45B4Mrwr/Kb6NgYl7k753+05CJNKnjbwh4975amoPJ+TEjHNQ==} + engines: {node: '>= 10'} + dependencies: + cosmiconfig: 7.0.0 + import-cwd: 3.0.0 + dev: true + /postcss-nested/5.0.5_postcss@8.2.12: resolution: {integrity: sha512-GSRXYz5bccobpTzLQZXOnSOfKl6TwVr5CyAQJUPub4nuRJSOECK5AqurxVgmtxP48p0Kc/ndY/YyS1yqldX0Ew==} engines: {node: '>=10.0'} @@ -6475,6 +6568,28 @@ packages: postcss-selector-parser: 6.0.5 dev: true + /postcss-reporter/7.0.2_postcss@8.2.12: + resolution: {integrity: sha512-JyQ96NTQQsso42y6L1H1RqHfWH1C3Jr0pt91mVv5IdYddZAE9DUZxuferNgk6q0o6vBVOrfVJb10X1FgDzjmDw==} + engines: {node: '>=10'} + peerDependencies: + postcss: ^8.1.0 + dependencies: + colorette: 1.2.2 + lodash.difference: 4.5.0 + lodash.forown: 4.4.0 + lodash.get: 4.4.2 + lodash.groupby: 4.6.0 + lodash.sortby: 4.7.0 + postcss: 8.2.12 + dev: true + + /postcss-scss/3.0.5: + resolution: {integrity: sha512-3e0qYk87eczfzg5P73ZVuuxEGCBfatRhPze6KrSaIbEKVtmnFI1RYp1Fv+AyZi+w8kcNRSPeNX6ap4b65zEkiA==} + engines: {node: '>=10.0'} + dependencies: + postcss: 8.2.12 + dev: true + /postcss-selector-parser/6.0.5: resolution: {integrity: sha512-aFYPoYmXbZ1V6HZaSvat08M97A8HqO6Pjz+PiNpw/DhuRrC72XWAdp3hL6wusDCN31sSmcZyMGa2hZEuX+Xfhg==} engines: {node: '>=4'} @@ -6500,6 +6615,15 @@ packages: supports-color: 5.5.0 dev: true + /postcss/7.0.35: + resolution: {integrity: sha512-3QT8bBJeX/S5zKTTjTCIjRF3If4avAT6kqxcASlTWEtAFCb9NH0OUxNDfgZSWdP5fJnBYCMEWkIFfWeugjzYMg==} + engines: {node: '>=6.0.0'} + dependencies: + chalk: 2.4.2 + source-map: 0.6.1 + supports-color: 6.1.0 + dev: true + /postcss/8.2.12: resolution: {integrity: sha512-BJnGT5+0q2tzvs6oQfnY2NpEJ7rIXNfBnZtQOKCIsweeWXBXeDd5k31UgTdS3d/c02ouspufn37mTaHWkJyzMQ==} engines: {node: ^10 || ^12 || >=14} @@ -6756,6 +6880,12 @@ packages: resolution: {integrity: sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==} dev: true + /read-cache/1.0.0: + resolution: {integrity: sha1-5mTvMRYRZsl1HNvo28+GtftY93Q=} + dependencies: + pify: 2.3.0 + dev: true + /read-pkg-up/1.0.1: resolution: {integrity: sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=} engines: {node: '>=0.10.0'} @@ -6931,11 +7061,6 @@ packages: engines: {node: '>= 0.10'} dev: true - /replace-ext/2.0.0: - resolution: {integrity: sha512-UszKE5KVK6JvyD92nzMn9cDapSk6w/CaFZ96CnmDMUqH9oowfxF/ZjRITD25H4DnOQClLA4/j7jLGXXLVKxAug==} - engines: {node: '>= 10'} - dev: true - /replace-homedir/1.0.0: resolution: {integrity: sha1-6H9tUTuSjd6AgmDBK+f+xv9ueYw=} engines: {node: '>= 0.10'} @@ -7742,13 +7867,6 @@ packages: ansi-regex: 5.0.0 dev: true - /strip-ansi/7.0.0: - resolution: {integrity: sha512-UhDTSnGF1dc0DRbUqr1aXwNoY3RgVkSWG8BrpnuFIxhP57IqbS7IRta2Gfiavds4yCxc5+fEAVVOgBZWnYkvzg==} - engines: {node: '>=12'} - dependencies: - ansi-regex: 6.0.0 - dev: true - /strip-bom/2.0.0: resolution: {integrity: sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=} engines: {node: '>=0.10.0'} @@ -7808,6 +7926,13 @@ packages: has-flag: 3.0.0 dev: true + /supports-color/6.1.0: + resolution: {integrity: sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==} + engines: {node: '>=6'} + dependencies: + has-flag: 3.0.0 + dev: true + /supports-color/7.2.0: resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} engines: {node: '>=8'} @@ -7839,8 +7964,8 @@ packages: resolution: {integrity: sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==} dev: true - /tailwindcss/2.1.1_d887a42ede92218908fd5c3cc0b71177: - resolution: {integrity: sha512-zZ6axGqpSZOCBS7wITm/WNHkBzDt5CIZlDlx0eCVldwTxFPELCVGbgh7Xpb3/kZp3cUxOmK7bZUjqhuMrbN6xQ==} + /tailwindcss/2.1.2_d887a42ede92218908fd5c3cc0b71177: + resolution: {integrity: sha512-T5t+wwd+/hsOyRw2HJuFuv0LTUm3MUdHm2DJ94GPVgzqwPPFa9XxX0KlwLWupUuiOUj6uiKURCzYPHFcuPch/w==} engines: {node: '>=12.13.0'} hasBin: true peerDependencies: diff --git a/tailwind.cjs b/tailwind.cjs index f514a19..488e3bd 100644 --- a/tailwind.cjs +++ b/tailwind.cjs @@ -1,8 +1,32 @@ -const destFolder = `demo`; module.exports = { mode: "jit", - purge: { - enabled: false, - content: [`${destFolder}/**/*.html`] - } + purge: [ + './build/pug/**/*.pug' + ], + + theme: { + extend: { + screens: { + 'lt-2xl': { 'max': '1535px' }, + // => @media (max-width: 1535px) { ... } + + 'lt-xl': { 'max': '1279px' }, + // => @media (max-width: 1279px) { ... } + + 'lt-lg': { 'max': '1023px' }, + // => @media (max-width: 1023px) { ... } + + 'lt-md': { 'max': '767px' }, + // => @media (max-width: 767px) { ... } + + 'lt-sm': { 'max': '639px' }, + // => @media (max-width: 639px) { ... } + }, + container: { + center: 'true', + } + }, + }, + variants: {}, + plugins: [], }; \ No newline at end of file diff --git a/util.js b/util.js index 1de71f0..05bb190 100644 --- a/util.js +++ b/util.js @@ -1,17 +1,7 @@ -import chalk from "chalk"; -import PluginError from "plugin-error"; -import replaceExtension from "replace-ext"; -import { obj as _obj } from "through2"; -import stripAnsi from "strip-ansi"; -import { cloneDeep } from "lodash-es"; -import { basename, extname, dirname, join, relative } from "path"; -import applySourceMap from "vinyl-sourcemaps-apply"; -import sass from "sass"; import _gulp from "gulp"; export const { src, dest, parallel, task, series, watch } = _gulp; export const gulp = _gulp; -const { underline } = chalk; // Streamline Gulp Tasks export const stream = (_src, _opt = {}) => { @@ -79,173 +69,4 @@ export const seriesFn = (...args) => { return function seriesrun(done) { return series(...tasks)(done); }; -}; - -const PLUGIN_NAME = "gulp-sass"; -////////////////////////////// -// Main Gulp Sass function -////////////////////////////// -export const gulpSass = (options, sync) => - _obj((file, enc, cb) => { - // eslint-disable-line consistent-return - if (file.isNull()) { - return cb(null, file); - } - - if (file.isStream()) { - return cb(new PluginError(PLUGIN_NAME, "Streaming not supported")); - } - - if (basename(file.path).indexOf("_") === 0) { - return cb(); - } - - if (!file.contents.length) { - file.path = replaceExtension(file.path, ".css"); // eslint-disable-line no-param-reassign - return cb(null, file); - } - - const opts = cloneDeep(options || {}); - opts.data = file.contents.toString(); - - // we set the file path here so that libsass can correctly resolve import paths - opts.file = file.path; - - // Ensure `indentedSyntax` is true if a `.sass` file - if (extname(file.path) === ".sass") { - opts.indentedSyntax = true; - } - - // Ensure file's parent directory in the include path - if (opts.includePaths) { - if (typeof opts.includePaths === "string") { - opts.includePaths = [opts.includePaths]; - } - } else { - opts.includePaths = []; - } - - opts.includePaths.unshift(dirname(file.path)); - - // Generate Source Maps if plugin source-map present - if (file.sourceMap) { - opts.sourceMap = file.path; - opts.omitSourceMapUrl = true; - opts.sourceMapContents = true; - } - - ////////////////////////////// - // Handles returning the file to the stream - ////////////////////////////// - const filePush = (sassObj) => { - let sassMap; - let sassMapFile; - let sassFileSrc; - let sassFileSrcPath; - let sourceFileIndex; - - // Build Source Maps! - if (sassObj.map) { - // Transform map into JSON - sassMap = JSON.parse(sassObj.map.toString()); - // Grab the stdout and transform it into stdin - sassMapFile = sassMap.file.replace(/^stdout$/, "stdin"); - // Grab the base file name that's being worked on - sassFileSrc = file.relative; - // Grab the path portion of the file that's being worked on - sassFileSrcPath = dirname(sassFileSrc); - if (sassFileSrcPath) { - // Prepend the path to all files in the sources array except the file that's being worked on - sourceFileIndex = sassMap.sources.indexOf(sassMapFile); - sassMap.sources = sassMap.sources.map((source, index) => { - // eslint-disable-line arrow-body-style - return index === sourceFileIndex - ? source - : join(sassFileSrcPath, source); - }); - } - - // Remove 'stdin' from souces and replace with filenames! - sassMap.sources = sassMap.sources.filter( - (src) => src !== "stdin" && src - ); - - // Replace the map file with the original file name (but new extension) - sassMap.file = replaceExtension(sassFileSrc, ".css"); - // Apply the map - applySourceMap(file, sassMap); - } - - file.contents = sassObj.css; // eslint-disable-line no-param-reassign - file.path = replaceExtension(file.path, ".css"); // eslint-disable-line no-param-reassign - - if (file.stat) { - file.stat.atime = file.stat.mtime = file.stat.ctime = new Date(); // eslint-disable-line - } - - cb(null, file); - }; - - ////////////////////////////// - // Handles error message - ////////////////////////////// - const errorM = (error) => { - const filePath = - (error.file === "stdin" ? file.path : error.file) || file.path; - const relativePath = relative(process.cwd(), filePath); - const message = [ - underline(relativePath), - error.formatted, - ].join("\n"); - - error.messageFormatted = message; // eslint-disable-line no-param-reassign - error.messageOriginal = error.message; // eslint-disable-line no-param-reassign - error.message = stripAnsi(message); // eslint-disable-line no-param-reassign - error.relativePath = relativePath; // eslint-disable-line no-param-reassign - - return cb(new PluginError(PLUGIN_NAME, error)); - }; - - if (sync !== true) { - ////////////////////////////// - // Async Sass render - ////////////////////////////// - const callback = (error, obj) => { - // eslint-disable-line consistent-return - if (error) { - return errorM(error); - } - filePush(obj); - }; - - gulpSass.compiler.render(opts, callback); - } else { - ////////////////////////////// - // Sync Sass render - ////////////////////////////// - try { - filePush(gulpSass.compiler.renderSync(opts)); - } catch (error) { - return errorM(error); - } - } - }); - -////////////////////////////// -// Sync Sass render -////////////////////////////// -gulpSass.sync = (options) => gulpSass(options, true); - -////////////////////////////// -// Log errors nicely -////////////////////////////// -gulpSass.logError = function logError(error) { - const message = new PluginError("sass", error.messageFormatted).toString(); - process.stderr.write(`${message}\n`); - this.emit("end"); -}; - -////////////////////////////// -// Store compiler in a prop -////////////////////////////// -gulpSass.compiler = sass; \ No newline at end of file +}; \ No newline at end of file -- knotmirror 0.0.1 From 94dee5dcf4c2ecf0ac11d6995c4d4903053d15d7 Mon Sep 17 00:00:00 2001 From: Okiki Date: Sat, 24 Apr 2021 09:07:52 +0000 Subject: [PATCH 4/5] style: remove gray border around navbar-toggle --- build/sass/app.scss | 2 +- demo/css/app.css | 825 +------------------------------------------- 2 files changed, 4 insertions(+), 823 deletions(-) diff --git a/build/sass/app.scss b/build/sass/app.scss index 3ceb673..0fd9e68 100644 --- a/build/sass/app.scss +++ b/build/sass/app.scss @@ -111,7 +111,7 @@ button, a { } .navbar-toggle { - @apply sm:hidden border border-gray-300 border-solid rounded-md; + @apply sm:hidden rounded-md; @apply w-10 h-10 text-blue-500 hover:ring-4 hover:ring-blue-500 hover:ring-opacity-50; @apply focus:border-blue-600 focus:ring-4 focus:rounded-md; } diff --git a/demo/css/app.css b/demo/css/app.css index 4cada01..e8a1b3b 100644 --- a/demo/css/app.css +++ b/demo/css/app.css @@ -1,822 +1,3 @@ -/*! tailwindcss v2.1.2 | MIT License | https://tailwindcss.com *//*! modern-normalize v1.0.0 | MIT License | https://github.com/sindresorhus/modern-normalize */ - -/* -Document -======== -*/ - -/** -Use a better box model (opinionated). -*/ - -*, -*::before, -*::after { - box-sizing: border-box; -} - -/** -Use a more readable tab size (opinionated). -*/ - -:root { - -moz-tab-size: 4; - tab-size: 4; -} - -/** -1. Correct the line height in all browsers. -2. Prevent adjustments of font size after orientation changes in iOS. -*/ - -html { - line-height: 1.15; /* 1 */ - -webkit-text-size-adjust: 100%; /* 2 */ -} - -/* -Sections -======== -*/ - -/** -Remove the margin in all browsers. -*/ - -body { - margin: 0; -} - -/** -Improve consistency of default fonts in all browsers. (https://github.com/sindresorhus/modern-normalize/issues/3) -*/ - -body { - font-family: - system-ui, - -apple-system, /* Firefox supports this but not yet `system-ui` */ - 'Segoe UI', - Roboto, - Helvetica, - Arial, - sans-serif, - 'Apple Color Emoji', - 'Segoe UI Emoji'; -} - -/* -Grouping content -================ -*/ - -/** -1. Add the correct height in Firefox. -2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655) -*/ - -hr { - height: 0; /* 1 */ - color: inherit; /* 2 */ -} - -/* -Text-level semantics -==================== -*/ - -/** -Add the correct text decoration in Chrome, Edge, and Safari. -*/ - -abbr[title] { - text-decoration: underline dotted; -} - -/** -Add the correct font weight in Edge and Safari. -*/ - -b, -strong { - font-weight: bolder; -} - -/** -1. Improve consistency of default fonts in all browsers. (https://github.com/sindresorhus/modern-normalize/issues/3) -2. Correct the odd 'em' font sizing in all browsers. -*/ - -code, -kbd, -samp, -pre { - font-family: - ui-monospace, - SFMono-Regular, - Consolas, - 'Liberation Mono', - Menlo, - monospace; /* 1 */ - font-size: 1em; /* 2 */ -} - -/** -Add the correct font size in all browsers. -*/ - -small { - font-size: 80%; -} - -/** -Prevent 'sub' and 'sup' elements from affecting the line height in all browsers. -*/ - -sub, -sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; -} - -sub { - bottom: -0.25em; -} - -sup { - top: -0.5em; -} - -/* -Tabular data -============ -*/ - -/** -1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297) -2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016) -*/ - -table { - text-indent: 0; /* 1 */ - border-color: inherit; /* 2 */ -} - -/* -Forms -===== -*/ - -/** -1. Change the font styles in all browsers. -2. Remove the margin in Firefox and Safari. -*/ - -button, -input, -optgroup, -select, -textarea { - font-family: inherit; /* 1 */ - font-size: 100%; /* 1 */ - line-height: 1.15; /* 1 */ - margin: 0; /* 2 */ -} - -/** -Remove the inheritance of text transform in Edge and Firefox. -1. Remove the inheritance of text transform in Firefox. -*/ - -button, -select { /* 1 */ - text-transform: none; -} - -/** -Correct the inability to style clickable types in iOS and Safari. -*/ - -button, -[type='button'], -[type='reset'], -[type='submit'] { - -webkit-appearance: button; -} - -/** -Remove the inner border and padding in Firefox. -*/ - -::-moz-focus-inner { - border-style: none; - padding: 0; -} - -/** -Restore the focus styles unset by the previous rule. -*/ - -:-moz-focusring { - outline: 1px dotted ButtonText; -} - -/** -Remove the additional ':invalid' styles in Firefox. -See: https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737 -*/ - -:-moz-ui-invalid { - box-shadow: none; -} - -/** -Remove the padding so developers are not caught out when they zero out 'fieldset' elements in all browsers. -*/ - -legend { - padding: 0; -} - -/** -Add the correct vertical alignment in Chrome and Firefox. -*/ - -progress { - vertical-align: baseline; -} - -/** -Correct the cursor style of increment and decrement buttons in Safari. -*/ - -::-webkit-inner-spin-button, -::-webkit-outer-spin-button { - height: auto; -} - -/** -1. Correct the odd appearance in Chrome and Safari. -2. Correct the outline style in Safari. -*/ - -[type='search'] { - -webkit-appearance: textfield; /* 1 */ - outline-offset: -2px; /* 2 */ -} - -/** -Remove the inner padding in Chrome and Safari on macOS. -*/ - -::-webkit-search-decoration { - -webkit-appearance: none; -} - -/** -1. Correct the inability to style clickable types in iOS and Safari. -2. Change font properties to 'inherit' in Safari. -*/ - -::-webkit-file-upload-button { - -webkit-appearance: button; /* 1 */ - font: inherit; /* 2 */ -} - -/* -Interactive -=========== -*/ - -/* -Add the correct display in Chrome and Safari. -*/ - -summary { - display: list-item; -}/** - * Manually forked from SUIT CSS Base: https://github.com/suitcss/base - * A thin layer on top of normalize.css that provides a starting point more - * suitable for web applications. - */ - -/** - * Removes the default spacing and border for appropriate elements. - */ - -blockquote, -dl, -dd, -h1, -h2, -h3, -h4, -h5, -h6, -hr, -figure, -p, -pre { - margin: 0; -} - -button { - background-color: transparent; - background-image: none; -} - -/** - * Work around a Firefox/IE bug where the transparent `button` background - * results in a loss of the default `button` focus styles. - */ - -button:focus { - outline: 1px dotted; - outline: 5px auto -webkit-focus-ring-color; -} - -fieldset { - margin: 0; - padding: 0; -} - -ol, -ul { - list-style: none; - margin: 0; - padding: 0; -} - -/** - * Tailwind custom reset styles - */ - -/** - * 1. Use the user's configured `sans` font-family (with Tailwind's default - * sans-serif font stack as a fallback) as a sane default. - * 2. Use Tailwind's default "normal" line-height so the user isn't forced - * to override it to ensure consistency even when using the default theme. - */ - -html { - font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; /* 1 */ - line-height: 1.5; /* 2 */ -} - - -/** - * Inherit font-family and line-height from `html` so users can set them as - * a class directly on the `html` element. - */ - -body { - font-family: inherit; - line-height: inherit; -} - -/** - * 1. Prevent padding and border from affecting element width. - * - * We used to set this in the html element and inherit from - * the parent element for everything else. This caused issues - * in shadow-dom-enhanced elements like
where the content - * is wrapped by a div with box-sizing set to `content-box`. - * - * https://github.com/mozdevs/cssremedy/issues/4 - * - * - * 2. Allow adding a border to an element by just adding a border-width. - * - * By default, the way the browser specifies that an element should have no - * border is by setting it's border-style to `none` in the user-agent - * stylesheet. - * - * In order to easily add borders to elements by just setting the `border-width` - * property, we change the default border-style for all elements to `solid`, and - * use border-width to hide them instead. This way our `border` utilities only - * need to set the `border-width` property instead of the entire `border` - * shorthand, making our border utilities much more straightforward to compose. - * - * https://github.com/tailwindcss/tailwindcss/pull/116 - */ - -*, -::before, -::after { - box-sizing: border-box; /* 1 */ - border-width: 0; /* 2 */ - border-style: solid; /* 2 */ - border-color: #e5e7eb; /* 2 */ -} - -/* - * Ensure horizontal rules are visible by default - */ - -hr { - border-top-width: 1px; -} - -/** - * Undo the `border-style: none` reset that Normalize applies to images so that - * our `border-{width}` utilities have the expected effect. - * - * The Normalize reset is unnecessary for us since we default the border-width - * to 0 on all elements. - * - * https://github.com/tailwindcss/tailwindcss/issues/362 - */ - -img { - border-style: solid; -} - -textarea { - resize: vertical; -} - -input::placeholder, -textarea::placeholder { - opacity: 1; - color: #9ca3af; -} - -button, -[role="button"] { - cursor: pointer; -} - -table { - border-collapse: collapse; -} - -h1, -h2, -h3, -h4, -h5, -h6 { - font-size: inherit; - font-weight: inherit; -} - -/** - * Reset links to optimize for opt-in styling instead of - * opt-out. - */ - -a { - color: inherit; - text-decoration: inherit; -} - -/** - * Reset form element properties that are easy to forget to - * style explicitly so you don't inadvertently introduce - * styles that deviate from your design system. These styles - * supplement a partial reset that is already applied by - * normalize.css. - */ - -button, -input, -optgroup, -select, -textarea { - padding: 0; - line-height: inherit; - color: inherit; -} - -/** - * Use the configured 'mono' font family for elements that - * are expected to be rendered with a monospace font, falling - * back to the system monospace stack if there is no configured - * 'mono' font family. - */ - -pre, -code, -kbd, -samp { - font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; -} - -/** - * Make replaced elements `display: block` by default as that's - * the behavior you want almost all of the time. Inspired by - * CSS Remedy, with `svg` added as well. - * - * https://github.com/mozdevs/cssremedy/issues/14 - */ - -img, -svg, -video, -canvas, -audio, -iframe, -embed, -object { - display: block; - vertical-align: middle; -} - -/** - * Constrain images and videos to the parent width and preserve - * their intrinsic aspect ratio. - * - * https://github.com/mozdevs/cssremedy/issues/14 - */ - -img, -video { - max-width: 100%; - height: auto; -} - -* { - --tw-shadow: 0 0 #0000; - --tw-ring-inset: var(--tw-empty,/*!*/ /*!*/); - --tw-ring-offset-width: 0px; - --tw-ring-offset-color: #fff; - --tw-ring-color: rgba(59, 130, 246, 0.5); - --tw-ring-offset-shadow: 0 0 #0000; - --tw-ring-shadow: 0 0 #0000; -}.container { - width: 100%; - margin-right: auto; - margin-left: auto; -}@media (min-width: 640px) { - - .container { - max-width: 640px; - } -}@media (min-width: 768px) { - - .container { - max-width: 768px; - } -}@media (min-width: 1024px) { - - .container { - max-width: 1024px; - } -}@media (min-width: 1280px) { - - .container { - max-width: 1280px; - } -}@media (min-width: 1536px) { - - .container { - max-width: 1536px; - } -}.col-span-3 { - grid-column: span 3 / span 3; -}.col-span-9 { - grid-column: span 9 / span 9; -}.col-span-6 { - grid-column: span 6 / span 6; -}.col-span-12 { - grid-column: span 12 / span 12; -}.m-5 { - margin: 1.25rem; -}.my-3 { - margin-top: 0.75rem; - margin-bottom: 0.75rem; -}.my-2 { - margin-top: 0.5rem; - margin-bottom: 0.5rem; -}.mb-2 { - margin-bottom: 0.5rem; -}.mt-8 { - margin-top: 2rem; -}.mb-5 { - margin-bottom: 1.25rem; -}.block { - display: block; -}.inline-block { - display: inline-block; -}.flex { - display: flex; -}.grid { - display: grid; -}.grid-cols-12 { - grid-template-columns: repeat(12, minmax(0, 1fr)); -}.flex-col { - flex-direction: column; -}.gap-6 { - gap: 1.5rem; -}.space-y-6 > :not([hidden]) ~ :not([hidden]) { - --tw-space-y-reverse: 0; - margin-top: calc(1.5rem * calc(1 - var(--tw-space-y-reverse))); - margin-bottom: calc(1.5rem * var(--tw-space-y-reverse)); -}.overflow-hidden { - overflow: hidden; -}.rounded { - border-radius: 0.25rem; -}.rounded-lg { - border-radius: 0.5rem; -}.rounded-md { - border-radius: 0.375rem; -}.border { - border-width: 1px; -}.border-gray-200 { - --tw-border-opacity: 1; - border-color: rgba(229, 231, 235, var(--tw-border-opacity)); -}.bg-white { - --tw-bg-opacity: 1; - background-color: rgba(255, 255, 255, var(--tw-bg-opacity)); -}.bg-gray-200 { - --tw-bg-opacity: 1; - background-color: rgba(229, 231, 235, var(--tw-bg-opacity)); -}.p-3 { - padding: 0.75rem; -}.p-4 { - padding: 1rem; -}.p-5 { - padding: 1.25rem; -}.px-4 { - padding-left: 1rem; - padding-right: 1rem; -}.py-5 { - padding-top: 1.25rem; - padding-bottom: 1.25rem; -}.px-12 { - padding-left: 3rem; - padding-right: 3rem; -}.py-24 { - padding-top: 6rem; - padding-bottom: 6rem; -}.px-2 { - padding-left: 0.5rem; - padding-right: 0.5rem; -}.py-4 { - padding-top: 1rem; - padding-bottom: 1rem; -}.py-2 { - padding-top: 0.5rem; - padding-bottom: 0.5rem; -}.text-right { - text-align: right; -}.align-middle { - vertical-align: middle; -}.font-sans { - font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; -}.text-5xl { - font-size: 3rem; - line-height: 1; -}.text-lg { - font-size: 1.125rem; - line-height: 1.75rem; -}.font-light { - font-weight: 300; -}.text-gray-500 { - --tw-text-opacity: 1; - color: rgba(107, 114, 128, var(--tw-text-opacity)); -}body { - --tw-bg-opacity: 1; - background-color: rgba(255, 255, 255, var(--tw-bg-opacity)); - --tw-text-opacity: 1; - color: rgba(0, 0, 0, var(--tw-text-opacity));font-size:1rem;line-height:1.5; -}.icon{-webkit-font-feature-settings:"liga" off,"dlig";-moz-font-feature-settings:"liga=0, dlig=1";font-feature-settings:"liga","dlig";-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility;font-family:"Material Icons";vertical-align:middle;letter-spacing:normal;display:inline-block;text-decoration:none;text-transform:none;white-space:nowrap;font-weight:normal;position:relative;font-style:normal;word-wrap:normal;font-size:24px;line-height:1;direction:ltr;height:1em;width:1em}a { - --tw-text-opacity: 1; - color: rgba(59, 130, 246, var(--tw-text-opacity)); - text-decoration: underline; -}a:hover { - --tw-text-opacity: 1; - color: rgba(29, 78, 216, var(--tw-text-opacity)); -}button,a{transition:color .2s ease-out,box-shadow .2s ease-out}button:focus, a:focus { - --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); - --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color); - box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); - --tw-ring-opacity: 1; - --tw-ring-color: rgba(59, 130, 246, var(--tw-ring-opacity)); - --tw-ring-opacity: 0.5; - border-radius: 0.125rem; - outline: 2px solid transparent; - outline-offset: 2px; -}button,a{-webkit-tap-highlight-color:transparent}.navbar { - position: fixed; - top: 0px; - left: 0px; - z-index: 50; - width: 100%; -}.navbar .container { - border-bottom-width: 1px; - --tw-border-opacity: 1; - border-color: rgba(229, 231, 235, var(--tw-border-opacity)); - --tw-bg-opacity: 1; - background-color: rgba(255, 255, 255, var(--tw-bg-opacity)); - display: flex; - flex-wrap: wrap; - align-items: center; - justify-content: space-between; - padding-left: 1.25rem; - padding-right: 1.25rem; - padding-top: 0.5rem; - padding-bottom: 0.5rem; -}@media (min-width: 1024px) { - - .navbar .container { - max-width: 1280px; - } -}.navbar-offset { - margin-top: 4rem; -}.navbar-collapse { - align-items: center; -}@media (max-width: 639px){.navbar-collapse{--height: 100vh;transition:height ease-out .25s;overflow:hidden}.navbar-collapse { - flex-grow: 1; - }.navbar-collapse{flex-basis:100%}.navbar-collapse.show{height:100%;height:var(--height, 100vh)}.navbar-collapse.collapse{height:0}}.navbar-list { - display: flex; - flex-wrap: nowrap; -}@media (max-width: 639px) { - - .navbar-list { - flex-direction: column; - } -}.navbar-logo { - font-size: 1.25rem; - line-height: 1.75rem; - font-weight: 700; -}@media (min-width: 640px) { - - .navbar-list a { - margin-left: 0.25rem; - margin-right: 0.25rem; - } -}@media (max-width: 639px) { - - .navbar-list a { - margin-top: 0.25rem; - margin-bottom: 0.25rem; - } - - .navbar-list a { - width: 100%; - } -}.navbar-logo, .navbar-list a { - border-radius: 0.375rem; - padding-left: 0.75rem; - padding-right: 0.75rem; - padding-top: 0.5rem; - padding-bottom: 0.5rem; - text-decoration: none; -}.navbar-logo:hover, .navbar-list a:hover { - --tw-text-opacity: 1; - color: rgba(96, 165, 250, var(--tw-text-opacity)); -}.navbar-logo.active, .navbar-list a.active { - --tw-bg-opacity: 1; - background-color: rgba(37, 99, 235, var(--tw-bg-opacity)); - --tw-text-opacity: 1; - color: rgba(255, 255, 255, var(--tw-text-opacity)); -}.navbar-toggle,.navbar-logo,.navbar-list a{transition:background-color .15s ease-out,color .15s ease-out,border-color .2s ease-out,box-shadow .2s ease-out}.navbar-toggle { - border-radius: 0.375rem; - border-width: 1px; - border-style: solid; - --tw-border-opacity: 1; - border-color: rgba(209, 213, 219, var(--tw-border-opacity)); -}@media (min-width: 640px) { - - .navbar-toggle { - display: none; - } -}.navbar-toggle { - height: 2.5rem; - width: 2.5rem; - --tw-text-opacity: 1; - color: rgba(59, 130, 246, var(--tw-text-opacity)); -}.navbar-toggle:hover { - --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); - --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color); - box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); - --tw-ring-opacity: 1; - --tw-ring-color: rgba(59, 130, 246, var(--tw-ring-opacity)); - --tw-ring-opacity: 0.5; -}.navbar-toggle:focus { - border-radius: 0.375rem; - --tw-border-opacity: 1; - border-color: rgba(37, 99, 235, var(--tw-border-opacity)); - --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); - --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color); - box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); -}.btn { - border-radius: 0.375rem; - padding-left: 0.75rem; - padding-right: 0.75rem; - padding-top: 0.5rem; - padding-bottom: 0.5rem; - text-decoration: none; -}.btn.active { - --tw-bg-opacity: 1; - background-color: rgba(37, 99, 235, var(--tw-bg-opacity)); - --tw-text-opacity: 1; - color: rgba(255, 255, 255, var(--tw-text-opacity)); -}@media (min-width: 1024px) { - - .lg\:max-w-screen-xl { - max-width: 1280px; - } -} \ No newline at end of file +/*! tailwindcss v2.1.2 | MIT License | https://tailwindcss.com */ +/*! modern-normalize v1.0.0 | MIT License | https://github.com/sindresorhus/modern-normalize */ +:root{-moz-tab-size:4;-o-tab-size:4;tab-size:4}body,html{line-height:1.5}html{-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"}body{margin:0;font-family:system-ui,-apple-system,'Segoe UI',Roboto,Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji';font-family:inherit;--tw-bg-opacity:1;background-color:rgba(255,255,255,var(--tw-bg-opacity));--tw-text-opacity:1;color:rgba(0,0,0,var(--tw-text-opacity));font-size:1rem}hr{height:0;color:inherit}abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,pre,samp{font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;margin:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}::-moz-focus-inner{border-style:none;padding:0}:-moz-focusring{outline:1px dotted ButtonText}:-moz-ui-invalid{box-shadow:none}legend{padding:0}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}button{background-color:transparent;background-image:none}button:focus{outline:5px auto -webkit-focus-ring-color}fieldset,ol,ul{margin:0;padding:0}ol,ul{list-style:none}*,::after,::before{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}hr{border-top-width:1px}img{border-style:solid}textarea{resize:vertical}input::-moz-placeholder, textarea::-moz-placeholder{opacity:1;color:#9ca3af}input:-ms-input-placeholder, textarea:-ms-input-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;--tw-text-opacity:1;color:rgba(59,130,246,var(--tw-text-opacity));text-decoration:underline}button,input,optgroup,select,textarea{padding:0;line-height:inherit;color:inherit}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}*{--tw-shadow:0 0 #0000;--tw-ring-inset:var(--tw-empty,/*!*/ /*!*/);--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59, 130, 246, 0.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000}.container{width:100%;margin-right:auto;margin-left:auto}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.col-span-3{grid-column:span 3/span 3}.col-span-9{grid-column:span 9/span 9}.col-span-6{grid-column:span 6/span 6}.col-span-12{grid-column:span 12/span 12}.m-5{margin:1.25rem}.my-3{margin-top:.75rem;margin-bottom:.75rem}.my-2{margin-top:.5rem}.mb-2,.my-2{margin-bottom:.5rem}.mt-8{margin-top:2rem}.mb-5{margin-bottom:1.25rem}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.grid{display:grid}.grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.flex-col{flex-direction:column}.gap-6{gap:1.5rem}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1.5rem*calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem*var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.rounded{border-radius:.25rem}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.border{border-width:1px}.border-gray-200{--tw-border-opacity:1;border-color:rgba(229,231,235,var(--tw-border-opacity))}.bg-gray-200,.bg-white{--tw-bg-opacity:1;background-color:rgba(255,255,255,var(--tw-bg-opacity))}.bg-gray-200{background-color:rgba(229,231,235,var(--tw-bg-opacity))}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.px-4{padding-left:1rem;padding-right:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.px-12{padding-left:3rem;padding-right:3rem}.py-24{padding-top:6rem;padding-bottom:6rem}.px-2{padding-left:.5rem;padding-right:.5rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-sans{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"}.text-5xl{font-size:3rem;line-height:1}.text-lg{font-size:1.125rem;line-height:1.75rem}.font-light{font-weight:300}.text-gray-500,a:hover{--tw-text-opacity:1;color:rgba(107,114,128,var(--tw-text-opacity))}.icon{font-feature-settings:"liga","dlig";-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility;font-family:"Material Icons";vertical-align:middle;letter-spacing:normal;display:inline-block;text-decoration:none;text-transform:none;white-space:nowrap;font-weight:400;position:relative;font-style:normal;word-wrap:normal;font-size:24px;line-height:1;direction:ltr;height:1em;width:1em}a:hover{color:rgba(29,78,216,var(--tw-text-opacity))}a,button{transition:color .2s ease-out,box-shadow .2s ease-out;-webkit-tap-highlight-color:transparent}a:focus,button:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000);--tw-ring-opacity:1;--tw-ring-color:rgba(59, 130, 246, var(--tw-ring-opacity));--tw-ring-opacity:0.5;border-radius:.125rem;outline:2px solid transparent;outline-offset:2px}.navbar{position:fixed;top:0;left:0;z-index:50;width:100%}.navbar .container{border-bottom-width:1px;--tw-border-opacity:1;border-color:rgba(229,231,235,var(--tw-border-opacity));--tw-bg-opacity:1;background-color:rgba(255,255,255,var(--tw-bg-opacity));display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;padding:.5rem 1.25rem}@media (min-width:1024px){.navbar .container{max-width:1280px}}.navbar-offset{margin-top:4rem}.navbar-collapse{align-items:center}@media (max-width:639px){.navbar-collapse{--height:100vh;transition:height ease-out .25s;overflow:hidden;flex-grow:1;flex-basis:100%}.navbar-collapse.show{height:100%;height:var(--height, 100vh)}.navbar-collapse.collapse{height:0}}.navbar-list{display:flex;flex-wrap:nowrap}@media (max-width:639px){.navbar-list{flex-direction:column}}.navbar-logo{font-size:1.25rem;line-height:1.75rem;font-weight:700;border-radius:.375rem;padding:.5rem .75rem;text-decoration:none}@media (min-width:640px){.navbar-list a{margin-left:.25rem;margin-right:.25rem}}@media (max-width:639px){.navbar-list a{margin-top:.25rem;margin-bottom:.25rem;width:100%}}.navbar-list a{border-radius:.375rem;padding:.5rem .75rem;text-decoration:none}.navbar-list a:hover,.navbar-logo:hover{--tw-text-opacity:1;color:rgba(96,165,250,var(--tw-text-opacity))}.navbar-list a.active,.navbar-logo.active{--tw-bg-opacity:1;background-color:rgba(37,99,235,var(--tw-bg-opacity));--tw-text-opacity:1;color:rgba(255,255,255,var(--tw-text-opacity))}.navbar-list a,.navbar-logo,.navbar-toggle{transition:background-color .15s ease-out,color .15s ease-out,border-color .2s ease-out,box-shadow .2s ease-out}.navbar-toggle{border-radius:.375rem}@media (min-width:640px){.navbar-toggle{display:none}}.navbar-toggle{height:2.5rem;width:2.5rem;--tw-text-opacity:1;color:rgba(59,130,246,var(--tw-text-opacity))}.navbar-toggle:hover{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000);--tw-ring-opacity:1;--tw-ring-color:rgba(59, 130, 246, var(--tw-ring-opacity));--tw-ring-opacity:0.5}.navbar-toggle:focus{border-radius:.375rem;--tw-border-opacity:1;border-color:rgba(37,99,235,var(--tw-border-opacity));--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.btn{border-radius:.375rem;padding:.5rem .75rem;text-decoration:none}.btn.active{--tw-bg-opacity:1;background-color:rgba(37,99,235,var(--tw-bg-opacity));--tw-text-opacity:1;color:rgba(255,255,255,var(--tw-text-opacity))}@media (min-width:1024px){.lg\:max-w-screen-xl{max-width:1280px}} \ No newline at end of file -- knotmirror 0.0.1 From 3f989575869249b64ba1f8b237ff0c9b86e61b0f Mon Sep 17 00:00:00 2001 From: Okiki Date: Sun, 25 Apr 2021 08:37:02 +0000 Subject: [PATCH 5/5] style(demo): finalize demo redesign --- .gitpod.yml | 2 +- .npmrc | 2 +- build/pug/404.pug | 15 +- build/pug/about.pug | 491 +++++++++++------------- build/pug/components/big-transition.pug | 11 +- build/pug/components/navbar.pug | 27 +- build/pug/docs.pug | 97 +++++ build/pug/index.pug | 226 +++++------ build/pug/layouts/layout.pug | 2 +- build/pug/other.pug | 262 ------------- build/sass/app.scss | 130 ++++++- build/ts/services/IntroAnimation.ts | 21 +- build/ts/services/Navbar.ts | 10 +- build/ts/transitions/BigTransition.ts | 11 +- demo/404.html | 2 +- demo/about.html | 83 ++-- demo/animate.html | 2 +- demo/css/app.css | 2 +- demo/docs.html | 65 ++++ demo/index.html | 22 +- demo/js/animate.js | 2 +- demo/js/main.js | 4 +- demo/js/main.js.map | 6 +- demo/other.html | 175 +-------- gulpfile.js | 2 +- old.scss | 256 ------------ packages/animate/@types/api.d.ts | 10 +- packages/native/lib/api.cjs.js | 4 +- packages/native/lib/api.cjs.js.map | 4 +- packages/native/lib/api.es.js | 4 +- packages/native/lib/api.es.js.map | 4 +- packages/native/lib/api.js | 4 +- packages/native/lib/api.js.map | 4 +- packages/native/src/app.ts | 56 ++- packages/native/src/config.ts | 6 +- 35 files changed, 775 insertions(+), 1249 deletions(-) create mode 100644 build/pug/docs.pug delete mode 100644 build/pug/other.pug create mode 100644 demo/docs.html delete mode 100644 old.scss diff --git a/.gitpod.yml b/.gitpod.yml index 4ef71fd..08db3c7 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -15,6 +15,6 @@ tasks: nvm alias default 16 && npm install pnpm -g && pnpm install gulp ultra-runner commitizen -g && - pnpm install && + pnpm update && pnpm build && pnpm demo diff --git a/.npmrc b/.npmrc index 43f2a87..a16e897 100644 --- a/.npmrc +++ b/.npmrc @@ -1,2 +1,2 @@ -link-workspace-packages = true shared-workspace-lockfile = true +link-workspace-packages = true diff --git a/build/pug/404.pug b/build/pug/404.pug index b747a00..cf6d02f 100644 --- a/build/pug/404.pug +++ b/build/pug/404.pug @@ -4,13 +4,8 @@ block title title 404 Page block content - main#404-page(data-wrapper='' role='main') - #page-home-page.page-content.page-content-ajax(data-node-name='home-page' data-is-home='1' data-node-type='HomePage' data-meta-title='Home page') - .container - .row - .col - .jumbotron.jumbotron-fluid.my-3.px-4.bg-white.rounded.box-shadow.text-dark - .container - h1.display-4 - strong 404 Page - p.lead Dynamic blocks example. + .container.px-5.py-2(class="sm:max-w-screen-xl") + .my-5.px-12.py-24.bg-gray-200.rounded-lg + h1.text-5xl.mb-2 + strong 404 Page + p.font-light.text-lg Dynamic blocks example. diff --git a/build/pug/about.pug b/build/pug/about.pug index 98ce681..f8e5e61 100644 --- a/build/pug/about.pug +++ b/build/pug/about.pug @@ -1,278 +1,223 @@ extends /layouts/layout.pug block title - title About page + title About block content - main#about-page(data-wrapper='' role='main') - #page-page-1.page-content.page-content-ajax(data-node-name='page-1' data-node-type='page' data-meta-title='Page 1') - .container - h1.intro-animation About Page - p.intro-animation - | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ex est, maximus aliquam sagittis vel, - | tempus vel odio. Praesent felis elit, blandit et laoreet nec, hendrerit et arcu. Aenean ligula sapien, - | sodales vel semper in, pulvinar id nulla. Donec pellentesque non tellus vel imperdiet. Pellentesque - | posuere, nisl sed rutrum tincidunt, augue augue vestibulum ex, vel ornare justo arcu eu magna. Praesent - | vel nisl enim. Aenean a odio porttitor, fermentum est et, mattis sem. Suspendisse aliquam, risus a - | aliquam vestibulum, eros ipsum pulvinar sem, quis posuere tellus ex id velit. Quisque eu pellentesque - | nisl, sed volutpat purus. Sed auctor convallis sapien sed hendrerit. Vivamus et neque facilisis, - | ultrices ex non, faucibus velit. Aliquam laoreet sed turpis a blandit. Nulla fringilla massa non - | fermentum rutrum. - .intro-animation - #inview-01.card.my-3.border-light.rounded.box-shadow.page-block(data-direction='right') - picture - source(data-srcset='/img/test2.webp' type='image/webp') - img#snd-image1.card-img-top.img-fluid.lazyload(loading='eager' width='747' src='https://images.unsplash.com/photo-1570506020466-17c74d2f4590?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1500&q=80' alt='Lazyloaded img') - .card-body.text-dark - p.card-text Lazyloaded picture with webp (for chrome). - .row - .col - .my-3.p-3 - .row - .col-sm-6.my-3.p-3.rounded.box-shadow.bg-white.text-dark.intro-animation - p - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et - | ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam - | commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, - | nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae - | elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus - | maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis - | aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet - | tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. - .col-sm-6.my-3.p-3.intro-animation - p - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et - | ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam - | commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, - | nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae - | elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus - | maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis - | aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet - | tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. - .col-sm-12.intro-animation - p - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris - | et ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam - | commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, - | nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae - | elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis - | tellus maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis - | aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet - | tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. - p - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris - | et ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam - | commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, - | nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae - | elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis - | tellus maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis - | aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet - | tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. - p - | Cras mattis consectetur purus sit amet fermentum. Nulla vitae elit libero, a - | pharetra augue. Sed - | posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem - | lacinia quam - | venenatis vestibulum. Vestibulum id ligula porta felis euismod semper. Praesent - | commodo cursus - | magna, vel scelerisque nisl consectetur et. - p - | Etiam porta sem malesuada magna mollis euismod. Cum sociis natoque penatibus et - | magnis dis parturient - | montes, nascetur ridiculus mus. Vivamus sagittis lacus vel augue laoreet rutrum - | faucibus dolor - | auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget - | lacinia odio sem nec - | elit. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Cras - | justo odio, dapibus - | ac facilisis in, egestas eget quam. - | Donec ullamcorper nulla non metus auctor fringilla. Sed posuere consectetur est - | at lobortis. Etiam - | porta sem malesuada magna mollis euismod. Donec sed odio dui. Donec id elit non - | mi porta gravida at - | eget metus. Cras mattis consectetur purus sit amet fermentum. - p - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris - | et ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam - | commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, - | nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae - | elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis - | tellus maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis - | aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet - | tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. - p - | Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus - | mus. Vivamus - | sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Integer posuere - | erat a ante venenatis - | dapibus posuere velit aliquet. Curabitur blandit tempus porttitor. - | Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta - | felis euismod semper. - | Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Nulla vitae - | elit libero, a - | pharetra augue. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, - | eget lacinia odio - | sem nec elit. - | Cras justo odio, dapibus ac facilisis in, egestas eget quam. Nulla vitae elit - | libero, a pharetra - | augue. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Praesent - | commodo cursus magna, - | vel scelerisque nisl consectetur et. - p - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris - | et ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam - | commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, - | nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae - | elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis - | tellus maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis - | aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet - | tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. - p - | Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus - | mus. Vivamus - | sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Integer posuere - | erat a ante venenatis - | dapibus posuere velit aliquet. Curabitur blandit tempus porttitor. - | Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta - | felis euismod semper. - | Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Nulla vitae - | elit libero, a - | pharetra augue. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, - | eget lacinia odio - | sem nec elit. - | Cras justo odio, dapibus ac facilisis in, egestas eget quam. Nulla vitae elit - | libero, a pharetra - | augue. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Praesent - | commodo cursus magna, - | vel scelerisque nisl consectetur et. - p - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris - | et ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam - | commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, - | nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae - | elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis - | tellus maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis - | aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet - | tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. - p - | Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus - | mus. Vivamus - | sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Integer posuere - | erat a ante venenatis - | dapibus posuere velit aliquet. Curabitur blandit tempus porttitor. - | Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta - | felis euismod semper. - | Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Nulla vitae - | elit libero, a - | pharetra augue. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, - | eget lacinia odio - | sem nec elit. - | Cras justo odio, dapibus ac facilisis in, egestas eget quam. Nulla vitae elit - | libero, a pharetra - | augue. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Praesent - | commodo cursus magna, - | vel scelerisque nisl consectetur et. - #block-1.page-block(data-node-type='DefaultBlock') - .container - p - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. - p - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. - p - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. - p - img#4-image.lazyload.img-fluid(loading='eager' width='700' src='https://images.unsplash.com/photo-1590233183655-79cd23bd56db?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1534&q=80' data-src='/img/test1.jpg' alt='Lazyloaded img') - p - img#5-image.lazyload.img-fluid(loading='eager' width='700' src='https://images.unsplash.com/photo-1590305840667-d7b021e86fd6?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1502&q=80' data-src='/img/test2.jpg' alt='Lazyloaded img') - p - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. - #block-2.page-block(data-node-type='DefaultBlock') - .container - p - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. - p - img#snd-image.lazyload.img-fluid(loading='eager' width='700' src='https://images.unsplash.com/photo-1589979812000-4eab44f02c30?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1541&q=80' data-src='/img/test3.jpg' alt='Lazyloaded img') + .container.px-5.py-2(class="sm:px-10 sm:max-w-screen-xl") + h1.text-4xl.font-semibold.my-5.intro-animation About + p.intro-animation + | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ex est, maximus aliquam sagittis vel, + | tempus vel odio. Praesent felis elit, blandit et laoreet nec, hendrerit et arcu. Aenean ligula sapien, + | sodales vel semper in, pulvinar id nulla. Donec pellentesque non tellus vel imperdiet. Pellentesque + | posuere, nisl sed rutrum tincidunt, augue augue vestibulum ex, vel ornare justo arcu eu magna. Praesent + | vel nisl enim. Aenean a odio porttitor, fermentum est et, mattis sem. Suspendisse aliquam, risus a + | aliquam vestibulum, eros ipsum pulvinar sem, quis posuere tellus ex id velit. Quisque eu pellentesque + | nisl, sed volutpat purus. Sed auctor convallis sapien sed hendrerit. Vivamus et neque facilisis, + | ultrices ex non, faucibus velit. Aliquam laoreet sed turpis a blandit. Nulla fringilla massa non + | fermentum rutrum. + + .bg-white.my-5.rounded-lg.overflow-hidden.border.border-gray-200.intro-animation + img(loading='lazy' width='1500' src='https://images.unsplash.com/photo-1570506020466-17c74d2f4590?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1500&q=80' alt='Lazyloaded img') + p.p-5 Lazyloaded picture. + + div(class="md:grid-cols-12").grid.gap-6.my-3 + div(class="md:col-span-6").p-5.rounded-lg.border.border-gray-200.bg-white.col-span-12.intro-animation + p + | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis + | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed + | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus + | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, + | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, + | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum + | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor + | iaculis arcu ac rutrum. Suspendisse vel odio risus. + div(class="md:col-span-6 md:py-5").col-span-12.intro-animation + p + | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis + | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed + | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus + | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, + | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, + | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum + | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor + | iaculis arcu ac rutrum. Suspendisse vel odio risus. + + .space-y-5 + p.intro-animation + | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et + | ex mollis + | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam + | commodo. Donec sed + | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, + | nascetur ridiculus + | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae + | elementum pharetra, + | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus + | maximus, + | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis + | aliquet. Vestibulum + | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet + | tortor. Duis auctor + | iaculis arcu ac rutrum. Suspendisse vel odio risus. + p.intro-animation + | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et + | ex mollis + | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam + | commodo. Donec sed + | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, + | nascetur ridiculus + | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae + | elementum pharetra, + | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus + | maximus, + | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis + | aliquet. Vestibulum + | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet + | tortor. Duis auctor + | iaculis arcu ac rutrum. Suspendisse vel odio risus. + p.intro-animation + | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris + | et ex mollis + | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam + | commodo. Donec sed + | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, + | nascetur ridiculus + | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae + | elementum pharetra, + | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis + | tellus maximus, + | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis + | aliquet. Vestibulum + | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet + | tortor. Duis auctor + | iaculis arcu ac rutrum. Suspendisse vel odio risus. + p.intro-animation + | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris + | et ex mollis + | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam + | commodo. Donec sed + | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, + | nascetur ridiculus + | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae + | elementum pharetra, + | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis + | tellus maximus, + | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis + | aliquet. Vestibulum + | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet + | tortor. Duis auctor + | iaculis arcu ac rutrum. Suspendisse vel odio risus. + p.intro-animation + | Cras mattis consectetur purus sit amet fermentum. Nulla vitae elit libero, a + | pharetra augue. Sed + | posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem + | lacinia quam + | venenatis vestibulum. Vestibulum id ligula porta felis euismod semper. Praesent + | commodo cursus + | magna, vel scelerisque nisl consectetur et. + p.intro-animation + | Etiam porta sem malesuada magna mollis euismod. Cum sociis natoque penatibus et + | magnis dis parturient + | montes, nascetur ridiculus mus. Vivamus sagittis lacus vel augue laoreet rutrum + | faucibus dolor + | auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget + | lacinia odio sem nec + | elit. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Cras + | justo odio, dapibus + | ac facilisis in, egestas eget quam. + | Donec ullamcorper nulla non metus auctor fringilla. Sed posuere consectetur est + | at lobortis. Etiam + | porta sem malesuada magna mollis euismod. Donec sed odio dui. Donec id elit non + | mi porta gravida at + | eget metus. Cras mattis consectetur purus sit amet fermentum. + p + | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris + | et ex mollis + | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam + | commodo. Donec sed + | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, + | nascetur ridiculus + | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae + | elementum pharetra, + | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis + | tellus maximus, + | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis + | aliquet. Vestibulum + | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet + | tortor. Duis auctor + | iaculis arcu ac rutrum. Suspendisse vel odio risus. + p + | Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus + | mus. Vivamus + | sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Integer posuere + | erat a ante venenatis + | dapibus posuere velit aliquet. Curabitur blandit tempus porttitor. + | Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta + | felis euismod semper. + | Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Nulla vitae + | elit libero, a + | pharetra augue. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, + | eget lacinia odio + | sem nec elit. + | Cras justo odio, dapibus ac facilisis in, egestas eget quam. Nulla vitae elit + | libero, a pharetra + | augue. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Praesent + | commodo cursus magna, + | vel scelerisque nisl consectetur et. + p + | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris + | et ex mollis + | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam + | commodo. Donec sed + | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, + | nascetur ridiculus + | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae + | elementum pharetra, + | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis + | tellus maximus, + | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis + | aliquet. Vestibulum + | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet + | tortor. Duis auctor + | iaculis arcu ac rutrum. Suspendisse vel odio risus. + p + | Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus + | mus. Vivamus + | sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Integer posuere + | erat a ante venenatis + | dapibus posuere velit aliquet. Curabitur blandit tempus porttitor. + | Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta + | felis euismod semper. + | Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Nulla vitae + | elit libero, a + | pharetra augue. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, + | eget lacinia odio + | sem nec elit. + | Cras justo odio, dapibus ac facilisis in, egestas eget quam. Nulla vitae elit + | libero, a pharetra + | augue. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Praesent + | commodo cursus magna, + | vel scelerisque nisl consectetur et. + img#4-image(loading='lazy' width='1534' src='https://images.unsplash.com/photo-1590233183655-79cd23bd56db?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1534&q=80' alt='Lazyloaded img') + img#5-image(loading='lazy' width='1502' src='https://images.unsplash.com/photo-1590305840667-d7b021e86fd6?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1502&q=80' alt='Lazyloaded img') + p + | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis + | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed + | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus + | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, + | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, + | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum + | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor + | iaculis arcu ac rutrum. Suspendisse vel odio risus. + + p + | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis + | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed + | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus + | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, + | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, + | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum + | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor + | iaculis arcu ac rutrum. Suspendisse vel odio risus. + img#snd-image(loading='lazy' width='1541' src='https://images.unsplash.com/photo-1589979812000-4eab44f02c30?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1541&q=80' alt='Lazyloaded img') diff --git a/build/pug/components/big-transition.pug b/build/pug/components/big-transition.pug index 703ad28..9cd822a 100644 --- a/build/pug/components/big-transition.pug +++ b/build/pug/components/big-transition.pug @@ -1,14 +1,7 @@ mixin big-transition #big-transition - .spinner - svg(viewbox='0 0 66 66' xmlns='http://www.w3.org/2000/svg') - circle.length(fill='none' stroke-width='8' stroke-linecap='round' cx='33' cy='33' r='28') - svg(viewbox='0 0 66 66' xmlns='http://www.w3.org/2000/svg') - circle(fill='none' stroke-width='8' stroke-linecap='round' cx='33' cy='33' r='28') - svg(viewbox='0 0 66 66' xmlns='http://www.w3.org/2000/svg') - circle(fill='none' stroke-width='8' stroke-linecap='round' cx='33' cy='33' r='28') - svg(viewbox='0 0 66 66' xmlns='http://www.w3.org/2000/svg') - circle(fill='none' stroke-width='8' stroke-linecap='round' cx='33' cy='33' r='28') + .logo + h1.text-5xl.mb-2 @okikio/native #big-transition-horizontal div div diff --git a/build/pug/components/navbar.pug b/build/pug/components/navbar.pug index 4d20ec3..f4aecf6 100644 --- a/build/pug/components/navbar.pug +++ b/build/pug/components/navbar.pug @@ -1,11 +1,20 @@ -mixin navbar() +mixin nav-list + ul.navbar-list + a.active(href='./index.html' data-path='(index|\/$)(\.html)?' data-transition='default') Home + a(href='./about.html' data-path='/about(.html)?' data-transition='SlideLeft') About + a(href='./docs.html' data-path='/docs(.html)?' data-transition='BigTransition') Docs + +mixin navbar nav.navbar .container - a.navbar-logo(href='./index.html') @okikio/native - button.navbar-toggle(type='button') - span.icon menu - .navbar-collapse.collapse - ul.navbar-list - a.active(href='./index.html' data-path='(index|\/$)(\.html)?' data-transition='default') Home - a(href='./about.html' data-path='/about(.html)?' data-transition='SlideLeft') About - a(href='./other.html' data-path='/other(.html)?' data-transition='BigTransition' data-prevent="self") Docs (prevent-pjax) + .navbar-bg + .navbar-frame + .navbar-shadow + .navbar-border + a.navbar-logo(href='./index.html') @okikio/native + button.navbar-toggle(type='button') + span.icon menu + .navbar-collapse.collapse.mobile + +nav-list + .navbar-collapse.desktop + +nav-list diff --git a/build/pug/docs.pug b/build/pug/docs.pug new file mode 100644 index 0000000..438bf8f --- /dev/null +++ b/build/pug/docs.pug @@ -0,0 +1,97 @@ +extends /layouts/layout.pug + +block title + title Other page + +block content + .container.px-5.py-2(class="sm:max-w-screen-xl") + h1.text-4xl.font-semibold.my-5.intro-animation.px-5 Docs + ul.flex.intro-animation.space-x-4.mb-4.px-5 + a(href='./about.html' data-transition='big') Link to the about + a(href='./index.html' data-transition='slide-right') Link to homepage + p.intro-animation.px-5 + | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ex est, maximus aliquam sagittis vel, + | tempus vel odio. Praesent felis elit, blandit et laoreet nec, hendrerit et arcu. Aenean ligula sapien, + | sodales vel semper in, pulvinar id nulla. Donec pellentesque non tellus vel imperdiet. Pellentesque + | posuere, nisl sed rutrum tincidunt, augue augue vestibulum ex, vel ornare justo arcu eu magna. Praesent + | vel nisl enim. Aenean a odio porttitor, fermentum est et, mattis sem. Suspendisse aliquam, risus a + | aliquam vestibulum, eros ipsum pulvinar sem, quis posuere tellus ex id velit. Quisque eu pellentesque + | nisl, sed volutpat purus. Sed auctor convallis sapien sed hendrerit. Vivamus et neque facilisis, + | ultrices ex non, faucibus velit. Aliquam laoreet sed turpis a blandit. Nulla fringilla massa non + | fermentum rutrum. + + + div(class="md:grid-cols-12").grid.gap-6.my-5.p-5.rounded-lg.bg-gray-200.intro-animation + div(class="md:col-span-6").col-span-12 + p + | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis + | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed + | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus + | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, + | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, + | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum + | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor + | iaculis arcu ac rutrum. Suspendisse vel odio risus. + div(class="md:col-span-6").col-span-12 + p + | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis + | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed + | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus + | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, + | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, + | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum + | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor + | iaculis arcu ac rutrum. Suspendisse vel odio risus. + + .space-y-5.px-5 + p.intro-animation + | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et + | ex mollis + | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam + | commodo. Donec sed + | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, + | nascetur ridiculus + | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae + | elementum pharetra, + | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus + | maximus, + | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis + | aliquet. Vestibulum + | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet + | tortor. Duis auctor + | iaculis arcu ac rutrum. Suspendisse vel odio risus. + p.intro-animation + | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et + | ex mollis + | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam + | commodo. Donec sed + | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, + | nascetur ridiculus + | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae + | elementum pharetra, + | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus + | maximus, + | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis + | aliquet. Vestibulum + | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet + | tortor. Duis auctor + | iaculis arcu ac rutrum. Suspendisse vel odio risus. + p.intro-animation + | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris + | et ex mollis + | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam + | commodo. Donec sed + | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, + | nascetur ridiculus + | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae + | elementum pharetra, + | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis + | tellus maximus, + | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis + | aliquet. Vestibulum + | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet + | tortor. Duis auctor + | iaculis arcu ac rutrum. Suspendisse vel odio risus. + img#4-image(loading='lazy' width='1502' src='https://images.unsplash.com/photo-1589779677480-d5244f63c9ca?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1502&q=800' alt='Lazyloaded img') + img#5-image(loading='lazy' width='1402' src='https://images.unsplash.com/photo-1589894809408-fdca3d7d548d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1402&q=80' alt='Lazyloaded img') + \ No newline at end of file diff --git a/build/pug/index.pug b/build/pug/index.pug index bef8647..7dc58a1 100644 --- a/build/pug/index.pug +++ b/build/pug/index.pug @@ -1,18 +1,18 @@ extends /layouts/layout.pug block content - .container.py-5(class="lg:max-w-screen-xl") - .m-5.px-12.py-24.bg-white.rounded-lg.border.border-gray-200.intro-animation + .container.px-5.py-2(class="sm:max-w-screen-xl") + .my-5.px-12.py-24.bg-gray-200.rounded-lg.intro-animation h1.text-5xl.mb-2 Homepage p.font-light.text-lg Dynamic example. - .grid.grid-cols-12.gap-6.m-5.p-5.bg-white.rounded-lg.border.border-gray-200.intro-animation - .col-span-3 - ul.flex.flex-col(role='tablist' aria-orientation='vertical') + div(class="sm:grid-cols-12").grid.gap-6.my-5.p-5.bg-white.rounded-lg.border.border-gray-200.intro-animation + .col-span-12(class="sm:col-span-3") + ul.flex.flex-col.space-y-1(role='tablist' aria-orientation='vertical') a.btn.active(href='./index.html') Link to homepage a.btn(href='./about.html') Link to the about page a.btn(href='./about.html#5-image') Link to fifth image - .col-span-9 + .col-span-12(class="sm:col-span-9") p | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis fringilla. | Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed vestibulum orci. @@ -23,7 +23,7 @@ block content | magna dictum pulvinar vitae laoreet tortor. Duis auctor iaculis arcu ac rutrum. Suspendisse vel odio | risus. - .grid.grid-cols-12.gap-6.m-5 + div(class="sm:grid-cols-12").grid.gap-6.my-5 .col-span-6.bg-white.rounded-lg.overflow-hidden.border.border-gray-200.intro-animation img(loading='eager' width='747' src='https://images.unsplash.com/photo-1589646609975-cb53c8e5b37a?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=747&q=80' alt='Normal img') p.p-5 Normal image. @@ -34,123 +34,103 @@ block content img(loading='lazy' width='747' src='https://images.unsplash.com/photo-1570506020466-17c74d2f4590?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1500&q=80' alt='Lazyloaded img') p.p-5 Lazyloaded picture. - .grid.grid-cols-12.gap-6 - .col-span-6.intro-animation - p - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. - .col-span-6.intro-animation - p - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. - .col-span-12.space-y-6 - p.intro-animation - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. - p.intro-animation - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. - p.intro-animation - | Cras mattis consectetur purus sit amet fermentum. Nulla vitae elit libero, a pharetra augue. Sed - | posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam - | venenatis vestibulum. Vestibulum id ligula porta felis euismod semper. Praesent commodo cursus - | magna, vel scelerisque nisl consectetur et. - p.intro-animation - | Etiam porta sem malesuada magna mollis euismod. Cum sociis natoque penatibus et magnis dis parturient - | montes, nascetur ridiculus mus. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor - | auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec - | elit. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Cras justo odio, dapibus - | ac facilisis in, egestas eget quam. - | Donec ullamcorper nulla non metus auctor fringilla. Sed posuere consectetur est at lobortis. Etiam - | porta sem malesuada magna mollis euismod. Donec sed odio dui. Donec id elit non mi porta gravida at - | eget metus. Cras mattis consectetur purus sit amet fermentum. - img.m-5.intro-animation(loading='eager' width='700' src='https://images.unsplash.com/photo-1590510325281-54a9164cf0f4?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1502&q=80' alt='Lazyloaded img') - p.intro-animation - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. - p.intro-animation - | Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus - | sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Integer posuere erat a ante venenatis - | dapibus posuere velit aliquet. Curabitur blandit tempus porttitor. - | Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta felis euismod semper. - | Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Nulla vitae elit libero, a - | pharetra augue. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio - | sem nec elit. - | Cras justo odio, dapibus ac facilisis in, egestas eget quam. Nulla vitae elit libero, a pharetra - | augue. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Praesent commodo cursus magna, - | vel scelerisque nisl consectetur et. - p.intro-animation - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. - p.intro-animation - | Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus - | sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Integer posuere erat a ante venenatis - | dapibus posuere velit aliquet. Curabitur blandit tempus porttitor. - | Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta felis euismod semper. - | Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Nulla vitae elit libero, a - | pharetra augue. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio - | sem nec elit. - | Cras justo odio, dapibus ac facilisis in, egestas eget quam. Nulla vitae elit libero, a pharetra - | augue. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Praesent commodo cursus magna, - | vel scelerisque nisl consectetur et. - p.intro-animation - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. - p.intro-animation - | Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus - | sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Integer posuere erat a ante venenatis - | dapibus posuere velit aliquet. Curabitur blandit tempus porttitor. - | Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta felis euismod semper. - | Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Nulla vitae elit libero, a - | pharetra augue. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio - | sem nec elit. - | Cras justo odio, dapibus ac facilisis in, egestas eget quam. Nulla vitae elit libero, a pharetra - | augue. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Praesent commodo cursus magna, - | vel scelerisque nisl consectetur et. + + .space-y-6 + p.intro-animation + | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis + | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed + | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus + | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, + | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, + | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum + | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor + | iaculis arcu ac rutrum. Suspendisse vel odio risus. + p.intro-animation + | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis + | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed + | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus + | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, + | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, + | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum + | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor + | iaculis arcu ac rutrum. Suspendisse vel odio risus. + p.intro-animation + | Cras mattis consectetur purus sit amet fermentum. Nulla vitae elit libero, a pharetra augue. Sed + | posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam + | venenatis vestibulum. Vestibulum id ligula porta felis euismod semper. Praesent commodo cursus + | magna, vel scelerisque nisl consectetur et. + p.intro-animation + | Etiam porta sem malesuada magna mollis euismod. Cum sociis natoque penatibus et magnis dis parturient + | montes, nascetur ridiculus mus. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor + | auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec + | elit. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Cras justo odio, dapibus + | ac facilisis in, egestas eget quam. + | Donec ullamcorper nulla non metus auctor fringilla. Sed posuere consectetur est at lobortis. Etiam + | porta sem malesuada magna mollis euismod. Donec sed odio dui. Donec id elit non mi porta gravida at + | eget metus. Cras mattis consectetur purus sit amet fermentum. + img.my-5.intro-animation(loading='lazy' width='1502' src='https://images.unsplash.com/photo-1590510325281-54a9164cf0f4?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1502&q=80' alt='Lazyloaded img') + p.intro-animation + | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis + | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed + | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus + | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, + | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, + | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum + | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor + | iaculis arcu ac rutrum. Suspendisse vel odio risus. + p.intro-animation + | Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus + | sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Integer posuere erat a ante venenatis + | dapibus posuere velit aliquet. Curabitur blandit tempus porttitor. + | Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta felis euismod semper. + | Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Nulla vitae elit libero, a + | pharetra augue. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio + | sem nec elit. + | Cras justo odio, dapibus ac facilisis in, egestas eget quam. Nulla vitae elit libero, a pharetra + | augue. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Praesent commodo cursus magna, + | vel scelerisque nisl consectetur et. + p.intro-animation + | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis + | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed + | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus + | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, + | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, + | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum + | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor + | iaculis arcu ac rutrum. Suspendisse vel odio risus. + p.intro-animation + | Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus + | sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Integer posuere erat a ante venenatis + | dapibus posuere velit aliquet. Curabitur blandit tempus porttitor. + | Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta felis euismod semper. + | Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Nulla vitae elit libero, a + | pharetra augue. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio + | sem nec elit. + | Cras justo odio, dapibus ac facilisis in, egestas eget quam. Nulla vitae elit libero, a pharetra + | augue. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Praesent commodo cursus magna, + | vel scelerisque nisl consectetur et. + p.intro-animation + | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis + | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed + | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus + | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, + | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, + | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum + | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor + | iaculis arcu ac rutrum. Suspendisse vel odio risus. + p.intro-animation + | Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus + | sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Integer posuere erat a ante venenatis + | dapibus posuere velit aliquet. Curabitur blandit tempus porttitor. + | Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta felis euismod semper. + | Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Nulla vitae elit libero, a + | pharetra augue. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio + | sem nec elit. + | Cras justo odio, dapibus ac facilisis in, egestas eget quam. Nulla vitae elit libero, a pharetra + | augue. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Praesent commodo cursus magna, + | vel scelerisque nisl consectetur et. - .grid.grid-cols-12.gap-6.mt-8.mb-5 + div(class="sm:grid-cols-12").grid.gap-6.mt-8.mb-5 .col-span-6.bg-white.rounded-lg.overflow-hidden.border.border-gray-200.intro-animation img(loading='lazy' width='1510' src='https://images.unsplash.com/photo-1464553186862-680edae5b2bc?ixlib=rb-1.2.1&auto=format&fit=crop&w=1510&q=80' alt='Lazyloaded img') p.p-5 Lazyloaded image. diff --git a/build/pug/layouts/layout.pug b/build/pug/layouts/layout.pug index 976a865..76fd436 100644 --- a/build/pug/layouts/layout.pug +++ b/build/pug/layouts/layout.pug @@ -20,7 +20,7 @@ head body +navbar - //- +big-transition + +big-transition .navbar-offset main(data-wrapper) block content diff --git a/build/pug/other.pug b/build/pug/other.pug deleted file mode 100644 index 81ba41b..0000000 --- a/build/pug/other.pug +++ /dev/null @@ -1,262 +0,0 @@ -extends /layouts/layout.pug - -block title - title Other page - -block content - main#other-page(data-wrapper='' role='main') - #page-page-1.page-content.page-content-ajax(data-node-name='page-1' data-node-type='page' data-meta-title='Page 1') - .container - h1.intro-animation Other Page - nav#in-page-nav.nav.nav-pills.intro-animation - a.nav-link(href='./about.html' data-transition='big') Link to the about - a.nav-link(href='./index.html' data-transition='slide-right') Link to homepage - p.intro-animation - | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ex est, maximus aliquam sagittis vel, - | tempus vel odio. Praesent felis elit, blandit et laoreet nec, hendrerit et arcu. Aenean ligula sapien, - | sodales vel semper in, pulvinar id nulla. Donec pellentesque non tellus vel imperdiet. Pellentesque - | posuere, nisl sed rutrum tincidunt, augue augue vestibulum ex, vel ornare justo arcu eu magna. Praesent - | vel nisl enim. Aenean a odio porttitor, fermentum est et, mattis sem. Suspendisse aliquam, risus a - | aliquam vestibulum, eros ipsum pulvinar sem, quis posuere tellus ex id velit. Quisque eu pellentesque - | nisl, sed volutpat purus. Sed auctor convallis sapien sed hendrerit. Vivamus et neque facilisis, - | ultrices ex non, faucibus velit. Aliquam laoreet sed turpis a blandit. Nulla fringilla massa non - | fermentum rutrum. - .row - .col - .my-3.intro-animation - .row.my-3.px-2.py-4.bg-white.rounded.box-shadow.text-dark - .col-sm-6 - p - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et - | ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam - | commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, - | nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae - | elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus - | maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis - | aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet - | tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. - .col-sm-6 - p - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et - | ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam - | commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, - | nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae - | elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus - | maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis - | aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet - | tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. - .row - .col-sm-12 - p - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris - | et ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam - | commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, - | nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae - | elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis - | tellus maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis - | aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet - | tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. - p - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris - | et ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam - | commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, - | nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae - | elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis - | tellus maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis - | aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet - | tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. - p - | Cras mattis consectetur purus sit amet fermentum. Nulla vitae elit libero, a - | pharetra augue. Sed - | posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem - | lacinia quam - | venenatis vestibulum. Vestibulum id ligula porta felis euismod semper. Praesent - | commodo cursus - | magna, vel scelerisque nisl consectetur et. - p - | Etiam porta sem malesuada magna mollis euismod. Cum sociis natoque penatibus et - | magnis dis parturient - | montes, nascetur ridiculus mus. Vivamus sagittis lacus vel augue laoreet rutrum - | faucibus dolor - | auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget - | lacinia odio sem nec - | elit. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Cras - | justo odio, dapibus - | ac facilisis in, egestas eget quam. - | Donec ullamcorper nulla non metus auctor fringilla. Sed posuere consectetur est - | at lobortis. Etiam - | porta sem malesuada magna mollis euismod. Donec sed odio dui. Donec id elit non - | mi porta gravida at - | eget metus. Cras mattis consectetur purus sit amet fermentum. - p - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris - | et ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam - | commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, - | nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae - | elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis - | tellus maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis - | aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet - | tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. - p - | Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus - | mus. Vivamus - | sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Integer posuere - | erat a ante venenatis - | dapibus posuere velit aliquet. Curabitur blandit tempus porttitor. - | Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta - | felis euismod semper. - | Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Nulla vitae - | elit libero, a - | pharetra augue. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, - | eget lacinia odio - | sem nec elit. - | Cras justo odio, dapibus ac facilisis in, egestas eget quam. Nulla vitae elit - | libero, a pharetra - | augue. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Praesent - | commodo cursus magna, - | vel scelerisque nisl consectetur et. - p - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris - | et ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam - | commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, - | nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae - | elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis - | tellus maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis - | aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet - | tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. - p - | Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus - | mus. Vivamus - | sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Integer posuere - | erat a ante venenatis - | dapibus posuere velit aliquet. Curabitur blandit tempus porttitor. - | Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta - | felis euismod semper. - | Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Nulla vitae - | elit libero, a - | pharetra augue. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, - | eget lacinia odio - | sem nec elit. - | Cras justo odio, dapibus ac facilisis in, egestas eget quam. Nulla vitae elit - | libero, a pharetra - | augue. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Praesent - | commodo cursus magna, - | vel scelerisque nisl consectetur et. - p - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris - | et ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam - | commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, - | nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae - | elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis - | tellus maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis - | aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet - | tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. - p - | Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus - | mus. Vivamus - | sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Integer posuere - | erat a ante venenatis - | dapibus posuere velit aliquet. Curabitur blandit tempus porttitor. - | Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta - | felis euismod semper. - | Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Nulla vitae - | elit libero, a - | pharetra augue. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, - | eget lacinia odio - | sem nec elit. - | Cras justo odio, dapibus ac facilisis in, egestas eget quam. Nulla vitae elit - | libero, a pharetra - | augue. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Praesent - | commodo cursus magna, - | vel scelerisque nisl consectetur et. - #block-1.page-block.intro-animation - .container - p - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. - p - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. - p - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. - p - img#4-image.lazyload.img-fluid(loading='eager' width='700' src='https://images.unsplash.com/photo-1589779677480-d5244f63c9ca?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1502&q=80' data-src='/img/test1.jpg' alt='Lazyloaded img') - p - img#5-image.lazyload.img-fluid(loading='eager' width='700' src='https://images.unsplash.com/photo-1589894809408-fdca3d7d548d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1402&q=80' data-src='/img/test2.jpg' alt='Lazyloaded img') - p - | Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis - | fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed - | vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus - | mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, - | sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, - | pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum - | non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor - | iaculis arcu ac rutrum. Suspendisse vel odio risus. diff --git a/build/sass/app.scss b/build/sass/app.scss index 0fd9e68..8caae98 100644 --- a/build/sass/app.scss +++ b/build/sass/app.scss @@ -39,7 +39,7 @@ a { button, a { transition: color .2s ease-out, box-shadow .2s ease-out; - @apply focus:ring-4 focus:ring-blue-500 focus:ring-opacity-50; + @apply focus-visible:ring-4 focus-visible:ring-blue-500 focus-visible:ring-opacity-50; @apply focus:outline-none focus:rounded-sm; -webkit-tap-highlight-color: transparent; @@ -49,9 +49,37 @@ button, a { @apply fixed top-0 left-0 w-full z-50; .container { - @apply bg-white border-b border-gray-200; - @apply flex flex-wrap items-center justify-between; - @apply lg:max-w-screen-xl px-5 py-2; + @apply sm:max-w-screen-xl px-5; + } + + .navbar-bg { + @apply absolute top-0 left-0 w-full h-full bg-white z-10; + } + + .navbar-frame { + @apply flex flex-wrap items-center justify-between relative; + @apply w-full py-2; + } + + .navbar-shadow { + transition: opacity ease 0.25s; + @apply absolute top-0 left-0 w-full h-full bg-white; + @apply opacity-0; + } + + &.shadow .navbar-shadow { + box-shadow: 0 4px 15px rgb(0 0 50 / 8%); + @apply opacity-100; + } + + .navbar-border { + transition: border-color ease 0.25s; + @apply absolute top-0 left-0 w-full h-full z-10; + @apply border-b border-gray-200 border-opacity-0; + } + + &:not(.shadow) .navbar-border { + @apply border-opacity-100; } } @@ -62,12 +90,30 @@ button, a { .navbar-collapse { @apply items-center; + @screen sm { + &.desktop { + display: block; + } + + &.mobile { + display: none; + } + } + @screen lt-sm { --height: 100vh; transition: height ease-out 0.25s; - overflow: hidden; @apply flex-grow; flex-basis: 100%; + overflow-y: hidden; + + &.mobile { + display: block; + } + + &.desktop { + display: none; + } &.show { height: 100%; @@ -81,11 +127,11 @@ button, a { } .navbar-list { - @apply flex lt-sm:flex-col flex-nowrap; + @apply flex lt-sm:flex-col flex-nowrap px-1; } .navbar-logo { - @apply text-xl font-bold; + @apply text-xl font-semibold ml-1; } .navbar-list a { @@ -94,10 +140,14 @@ button, a { .navbar-logo, .navbar-list a { - @apply px-3 py-2 rounded-md no-underline hover:text-blue-400; + @apply px-3 py-2 rounded-md no-underline hover:bg-gray-200; &.active { - @apply bg-blue-600 text-white; + @apply bg-blue-600 text-white hover:bg-blue-700; + } + + &:hover { + @apply bg-opacity-60; } } @@ -107,19 +157,69 @@ button, a { transition: background-color .15s ease-out, color .15s ease-out, border-color .2s ease-out, box-shadow .2s ease-out; - + @apply z-20; } .navbar-toggle { @apply sm:hidden rounded-md; - @apply w-10 h-10 text-blue-500 hover:ring-4 hover:ring-blue-500 hover:ring-opacity-50; - @apply focus:border-blue-600 focus:ring-4 focus:rounded-md; + @apply mr-1 w-10 h-10 text-blue-500 hover:bg-gray-100; + @apply focus-visible:border-blue-600 focus-visible:ring-4 focus-visible:rounded-md; } .btn { - @apply px-3 py-2 rounded-md no-underline; + @apply px-3 py-2 rounded-md no-underline hover:bg-gray-200; &.active { - @apply bg-blue-600 text-white; + @apply bg-blue-600 text-white hover:bg-blue-700; + } + + &:hover { + @apply bg-opacity-60; } -} \ No newline at end of file +} + +#big-transition { + position: fixed; + z-index: 2000; + top: 0; + left: 0; + right: 0; + bottom: 0; + display: flex; + opacity: 0; + visibility: hidden; +} + +#big-transition .logo { + opacity: 0; + visibility: hidden; +} + +#big-transition #big-transition-horizontal { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + display: flex; +} + +#big-transition #big-transition-horizontal { + flex-flow: column; +} + +#big-transition #big-transition-horizontal > div { + width: 100%; + flex: 1 1; + @apply bg-gray-200; + transform-origin: 0 0; + transform: scaleX(0); +} + +.logo { + position: absolute; + z-index: 12; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); +} diff --git a/build/ts/services/IntroAnimation.ts b/build/ts/services/IntroAnimation.ts index 3cd31ee..ae57e7f 100644 --- a/build/ts/services/IntroAnimation.ts +++ b/build/ts/services/IntroAnimation.ts @@ -1,4 +1,5 @@ import { Service, animate } from "../../../packages/native/src/api"; +import toArr from "../toArr"; export class IntroAnimation extends Service { public elements: Array; @@ -8,7 +9,7 @@ export class IntroAnimation extends Service { super.init(); // Elements - this.elements = [...document.querySelectorAll('.intro-animation')]; + this.elements = toArr(document.querySelectorAll('.intro-animation')); } public newPage() { @@ -17,21 +18,18 @@ export class IntroAnimation extends Service { } public initEvents() { - this.emitter.on("BEFORE_SPLASHSCREEN_HIDE", this.prepareToShow, this); this.emitter.on("CONTENT_REPLACED", this.newPage, this); - this.emitter.on("START_SPLASHSCREEN_HIDE BEFORE_TRANSITION_IN", this.show, this); + this.emitter.on("BEFORE_TRANSITION_IN", this.show, this); } public stopEvents() { - this.emitter.off("BEFORE_SPLASHSCREEN_HIDE", this.prepareToShow, this); this.emitter.off("CONTENT_REPLACED", this.newPage, this); - this.emitter.off("START_SPLASHSCREEN_HIDE BEFORE_TRANSITION_IN", this.show, this); + this.emitter.off("BEFORE_TRANSITION_IN", this.show, this); } public stop() { requestAnimationFrame(() => { for (let el of this.elements) { - (el as HTMLElement).style.transform = "translateY(0px)"; (el as HTMLElement).style.opacity = '1'; } }); @@ -42,7 +40,6 @@ export class IntroAnimation extends Service { public prepareToShow() { requestAnimationFrame(() => { for (let el of this.elements) { - (el as HTMLElement).style.transform = "translateY(200px)"; (el as HTMLElement).style.opacity = '0'; } }); @@ -51,22 +48,18 @@ export class IntroAnimation extends Service { public async show() { let [anim] = await animate({ target: (this.elements as HTMLElement[]), - keyframes: [ - { transform: "translateY(200px)", opacity: 0 }, - { transform: "translateY(0px)", opacity: 1 }, - ], + opacity: [0, 1], // @ts-ignore delay(i: number) { return 300 * (i + 1); }, onfinish(el: { style: { transform: string; opacity: string; }; }) { requestAnimationFrame(() => { - el.style.transform = "translateY(0px)"; el.style.opacity = "1"; }); }, - easing: "out-cubic", - duration: 650 + easing: "ease", + duration: 850 }); anim.stop(); return anim; diff --git a/build/ts/services/Navbar.ts b/build/ts/services/Navbar.ts index b872414..c8be014 100644 --- a/build/ts/services/Navbar.ts +++ b/build/ts/services/Navbar.ts @@ -12,12 +12,12 @@ export class Navbar extends Service { public init() { // Elements this.navbar = document.querySelector(".navbar") as HTMLElement; - this.collapseSection = this.navbar.querySelector(".navbar-collapse") as HTMLElement; + this.collapseSection = this.navbar.querySelector(".navbar-collapse.mobile") as HTMLElement; this.navbarList = this.navbar.querySelector(".navbar-list") as HTMLElement; this.elements = toArr(this.navbar.querySelectorAll(".navbar-list a")); this.menu = this.navbar.querySelector(".navbar-toggle") as HTMLElement; - this.toggleStatus = false; + this.toggleClick = this.toggleClick.bind(this); } @@ -45,14 +45,20 @@ export class Navbar extends Service { this.collapseSection.classList.toggle("show", this.toggleStatus); } + public scroll() { + this.navbar.classList.toggle("shadow", window.scrollY >= 5); + } + public initEvents() { this.menu.addEventListener("click", this.toggleClick); + this.emitter.on("scroll", this.scroll, this); this.emitter.on("READY", this.activateLink, this); this.emitter.on("GO", this.activateLink, this); } public stopEvents() { this.navbar.removeEventListener("click", this.toggleClick); + this.emitter.off("scroll", this.scroll, this); this.emitter.off("READY", this.activateLink, this); this.emitter.off("GO", this.activateLink, this); } diff --git a/build/ts/transitions/BigTransition.ts b/build/ts/transitions/BigTransition.ts index f3de466..ef6700f 100644 --- a/build/ts/transitions/BigTransition.ts +++ b/build/ts/transitions/BigTransition.ts @@ -1,4 +1,5 @@ import { ITransition, ITransitionData, animate } from "../../../packages/native/src/api"; +import toArr from "../toArr"; //== Transitions export const BigTransition: ITransition = { @@ -9,8 +10,8 @@ export const BigTransition: ITransition = { init() { this.mainElement = document.getElementById('big-transition'); - this.spinnerElement = this.mainElement.querySelector('.spinner'); - this.horizontalElements = [...this.mainElement.querySelector('#big-transition-horizontal').querySelectorAll('div')]; + this.logoElement = this.mainElement.querySelector('.logo'); + this.horizontalElements = toArr(this.mainElement.querySelectorAll('#big-transition-horizontal div')); this.maxLength = this.horizontalElements.length; }, @@ -53,11 +54,11 @@ export const BigTransition: ITransition = { fromWrapper.style.opacity = '1'; Object.assign(fromWrapper.style, wrapperStyle); - this.spinnerElement.style.visibility = "visible"; + this.logoElement.style.visibility = "visible"; let loaderDuration = 500; let [anim3] = await animate({ - target: this.spinnerElement, + target: this.logoElement, opacity: [0, 1], duration: loaderDuration, onfinish(el: { style: { opacity: string; }; }) { @@ -73,7 +74,7 @@ export const BigTransition: ITransition = { }, delay: 1500 }); - this.spinnerElement.style.visibility = "hidden"; + this.logoElement.style.visibility = "hidden"; // anim2.stop() // -> anim2.stop() Breaks the Animation anim3.stop(); anim4.stop(); diff --git a/demo/404.html b/demo/404.html index 017a1d4..38f920b 100644 --- a/demo/404.html +++ b/demo/404.html @@ -1 +1 @@ -404 Page

404 Page

Dynamic blocks example.

\ No newline at end of file +404 Page

404 Page

Dynamic blocks example.

\ No newline at end of file diff --git a/demo/about.html b/demo/about.html index 4e3657d..f799069 100644 --- a/demo/about.html +++ b/demo/about.html @@ -1,4 +1,4 @@ -About page

About Page

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ex est, maximus aliquam sagittis vel, +About

About

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ex est, maximus aliquam sagittis vel, tempus vel odio. Praesent felis elit, blandit et laoreet nec, hendrerit et arcu. Aenean ligula sapien, sodales vel semper in, pulvinar id nulla. Donec pellentesque non tellus vel imperdiet. Pellentesque posuere, nisl sed rutrum tincidunt, augue augue vestibulum ex, vel ornare justo arcu eu magna. Praesent @@ -6,7 +6,21 @@ vel nisl enim. Aenean a odio porttitor, fermentum est et, mattis sem. Suspendiss aliquam vestibulum, eros ipsum pulvinar sem, quis posuere tellus ex id velit. Quisque eu pellentesque nisl, sed volutpat purus. Sed auctor convallis sapien sed hendrerit. Vivamus et neque facilisis, ultrices ex non, faucibus velit. Aliquam laoreet sed turpis a blandit. Nulla fringilla massa non -fermentum rutrum.

Lazyloaded img

Lazyloaded picture with webp (for chrome).

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et +fermentum rutrum.

Lazyloaded img

Lazyloaded picture.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis +fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed +vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus +mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, +sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, +pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum +non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor +iaculis arcu ac rutrum. Suspendisse vel odio risus.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis +fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed +vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus +mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, +sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, +pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum +non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor +iaculis arcu ac rutrum. Suspendisse vel odio risus.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed @@ -20,7 +34,7 @@ pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor -iaculis arcu ac rutrum. Suspendisse vel odio risus.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et +iaculis arcu ac rutrum. Suspendisse vel odio risus.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed @@ -34,7 +48,7 @@ pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor -iaculis arcu ac rutrum. Suspendisse vel odio risus.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris +iaculis arcu ac rutrum. Suspendisse vel odio risus.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed @@ -48,7 +62,7 @@ pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor -iaculis arcu ac rutrum. Suspendisse vel odio risus.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris +iaculis arcu ac rutrum. Suspendisse vel odio risus.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed @@ -62,13 +76,13 @@ pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor -iaculis arcu ac rutrum. Suspendisse vel odio risus.

Cras mattis consectetur purus sit amet fermentum. Nulla vitae elit libero, a +iaculis arcu ac rutrum. Suspendisse vel odio risus.

Cras mattis consectetur purus sit amet fermentum. Nulla vitae elit libero, a pharetra augue. Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Vestibulum id ligula porta felis euismod semper. Praesent commodo cursus -magna, vel scelerisque nisl consectetur et.

Etiam porta sem malesuada magna mollis euismod. Cum sociis natoque penatibus et +magna, vel scelerisque nisl consectetur et.

Etiam porta sem malesuada magna mollis euismod. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor @@ -141,44 +155,7 @@ Cras justo odio, dapibus ac facilisis in, egestas eget quam. Nulla vitae elit libero, a pharetra augue. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Praesent commodo cursus magna, -vel scelerisque nisl consectetur et.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris -et ex mollis -fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam -commodo. Donec sed -vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, -nascetur ridiculus -mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae -elementum pharetra, -sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis -tellus maximus, -pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis -aliquet. Vestibulum -non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet -tortor. Duis auctor -iaculis arcu ac rutrum. Suspendisse vel odio risus.

Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus -mus. Vivamus -sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Integer posuere -erat a ante venenatis -dapibus posuere velit aliquet. Curabitur blandit tempus porttitor. -Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta -felis euismod semper. -Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Nulla vitae -elit libero, a -pharetra augue. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, -eget lacinia odio -sem nec elit. -Cras justo odio, dapibus ac facilisis in, egestas eget quam. Nulla vitae elit -libero, a pharetra -augue. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Praesent -commodo cursus magna, -vel scelerisque nisl consectetur et.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis -fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed -vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus -mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, -sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, -pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum -non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor -iaculis arcu ac rutrum. Suspendisse vel odio risus.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis +vel scelerisque nisl consectetur et.

Lazyloaded imgLazyloaded img

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, @@ -192,18 +169,4 @@ mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae el sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor -iaculis arcu ac rutrum. Suspendisse vel odio risus.

Lazyloaded img

Lazyloaded img

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis -fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed -vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus -mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, -sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, -pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum -non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor -iaculis arcu ac rutrum. Suspendisse vel odio risus.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis -fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed -vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus -mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, -sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, -pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum -non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor -iaculis arcu ac rutrum. Suspendisse vel odio risus.

Lazyloaded img

\ No newline at end of file +iaculis arcu ac rutrum. Suspendisse vel odio risus.

Lazyloaded img
\ No newline at end of file diff --git a/demo/animate.html b/demo/animate.html index 5dcdd3a..fcad9fd 100644 --- a/demo/animate.html +++ b/demo/animate.html @@ -1 +1 @@ -Homepage

Requires native Web Animation Support (latest Firefox, Chrome, Opera)

This is pretty cool right

0%

@okikio/animate

Dynamic example's based off of animejs to get you started.

Target

CSS Selector

DOM Node / Nodelist

Array

Properties

CSS Properties

CSS Transforms

SVG Attributes

\ No newline at end of file +Homepage

Requires native Web Animation Support (latest Firefox, Chrome, Opera)

This is pretty cool right

0%

@okikio/animate

Dynamic example's based off of animejs to get you started.

Target

CSS Selector

DOM Node / Nodelist

Array

Properties

CSS Properties

CSS Transforms

SVG Attributes

\ No newline at end of file diff --git a/demo/css/app.css b/demo/css/app.css index e8a1b3b..2541d7a 100644 --- a/demo/css/app.css +++ b/demo/css/app.css @@ -1,3 +1,3 @@ /*! tailwindcss v2.1.2 | MIT License | https://tailwindcss.com */ /*! modern-normalize v1.0.0 | MIT License | https://github.com/sindresorhus/modern-normalize */ -:root{-moz-tab-size:4;-o-tab-size:4;tab-size:4}body,html{line-height:1.5}html{-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"}body{margin:0;font-family:system-ui,-apple-system,'Segoe UI',Roboto,Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji';font-family:inherit;--tw-bg-opacity:1;background-color:rgba(255,255,255,var(--tw-bg-opacity));--tw-text-opacity:1;color:rgba(0,0,0,var(--tw-text-opacity));font-size:1rem}hr{height:0;color:inherit}abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,pre,samp{font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;margin:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}::-moz-focus-inner{border-style:none;padding:0}:-moz-focusring{outline:1px dotted ButtonText}:-moz-ui-invalid{box-shadow:none}legend{padding:0}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}button{background-color:transparent;background-image:none}button:focus{outline:5px auto -webkit-focus-ring-color}fieldset,ol,ul{margin:0;padding:0}ol,ul{list-style:none}*,::after,::before{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}hr{border-top-width:1px}img{border-style:solid}textarea{resize:vertical}input::-moz-placeholder, textarea::-moz-placeholder{opacity:1;color:#9ca3af}input:-ms-input-placeholder, textarea:-ms-input-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;--tw-text-opacity:1;color:rgba(59,130,246,var(--tw-text-opacity));text-decoration:underline}button,input,optgroup,select,textarea{padding:0;line-height:inherit;color:inherit}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}*{--tw-shadow:0 0 #0000;--tw-ring-inset:var(--tw-empty,/*!*/ /*!*/);--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59, 130, 246, 0.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000}.container{width:100%;margin-right:auto;margin-left:auto}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.col-span-3{grid-column:span 3/span 3}.col-span-9{grid-column:span 9/span 9}.col-span-6{grid-column:span 6/span 6}.col-span-12{grid-column:span 12/span 12}.m-5{margin:1.25rem}.my-3{margin-top:.75rem;margin-bottom:.75rem}.my-2{margin-top:.5rem}.mb-2,.my-2{margin-bottom:.5rem}.mt-8{margin-top:2rem}.mb-5{margin-bottom:1.25rem}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.grid{display:grid}.grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.flex-col{flex-direction:column}.gap-6{gap:1.5rem}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1.5rem*calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem*var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.rounded{border-radius:.25rem}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.border{border-width:1px}.border-gray-200{--tw-border-opacity:1;border-color:rgba(229,231,235,var(--tw-border-opacity))}.bg-gray-200,.bg-white{--tw-bg-opacity:1;background-color:rgba(255,255,255,var(--tw-bg-opacity))}.bg-gray-200{background-color:rgba(229,231,235,var(--tw-bg-opacity))}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.px-4{padding-left:1rem;padding-right:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.px-12{padding-left:3rem;padding-right:3rem}.py-24{padding-top:6rem;padding-bottom:6rem}.px-2{padding-left:.5rem;padding-right:.5rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-sans{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"}.text-5xl{font-size:3rem;line-height:1}.text-lg{font-size:1.125rem;line-height:1.75rem}.font-light{font-weight:300}.text-gray-500,a:hover{--tw-text-opacity:1;color:rgba(107,114,128,var(--tw-text-opacity))}.icon{font-feature-settings:"liga","dlig";-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility;font-family:"Material Icons";vertical-align:middle;letter-spacing:normal;display:inline-block;text-decoration:none;text-transform:none;white-space:nowrap;font-weight:400;position:relative;font-style:normal;word-wrap:normal;font-size:24px;line-height:1;direction:ltr;height:1em;width:1em}a:hover{color:rgba(29,78,216,var(--tw-text-opacity))}a,button{transition:color .2s ease-out,box-shadow .2s ease-out;-webkit-tap-highlight-color:transparent}a:focus,button:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000);--tw-ring-opacity:1;--tw-ring-color:rgba(59, 130, 246, var(--tw-ring-opacity));--tw-ring-opacity:0.5;border-radius:.125rem;outline:2px solid transparent;outline-offset:2px}.navbar{position:fixed;top:0;left:0;z-index:50;width:100%}.navbar .container{border-bottom-width:1px;--tw-border-opacity:1;border-color:rgba(229,231,235,var(--tw-border-opacity));--tw-bg-opacity:1;background-color:rgba(255,255,255,var(--tw-bg-opacity));display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;padding:.5rem 1.25rem}@media (min-width:1024px){.navbar .container{max-width:1280px}}.navbar-offset{margin-top:4rem}.navbar-collapse{align-items:center}@media (max-width:639px){.navbar-collapse{--height:100vh;transition:height ease-out .25s;overflow:hidden;flex-grow:1;flex-basis:100%}.navbar-collapse.show{height:100%;height:var(--height, 100vh)}.navbar-collapse.collapse{height:0}}.navbar-list{display:flex;flex-wrap:nowrap}@media (max-width:639px){.navbar-list{flex-direction:column}}.navbar-logo{font-size:1.25rem;line-height:1.75rem;font-weight:700;border-radius:.375rem;padding:.5rem .75rem;text-decoration:none}@media (min-width:640px){.navbar-list a{margin-left:.25rem;margin-right:.25rem}}@media (max-width:639px){.navbar-list a{margin-top:.25rem;margin-bottom:.25rem;width:100%}}.navbar-list a{border-radius:.375rem;padding:.5rem .75rem;text-decoration:none}.navbar-list a:hover,.navbar-logo:hover{--tw-text-opacity:1;color:rgba(96,165,250,var(--tw-text-opacity))}.navbar-list a.active,.navbar-logo.active{--tw-bg-opacity:1;background-color:rgba(37,99,235,var(--tw-bg-opacity));--tw-text-opacity:1;color:rgba(255,255,255,var(--tw-text-opacity))}.navbar-list a,.navbar-logo,.navbar-toggle{transition:background-color .15s ease-out,color .15s ease-out,border-color .2s ease-out,box-shadow .2s ease-out}.navbar-toggle{border-radius:.375rem}@media (min-width:640px){.navbar-toggle{display:none}}.navbar-toggle{height:2.5rem;width:2.5rem;--tw-text-opacity:1;color:rgba(59,130,246,var(--tw-text-opacity))}.navbar-toggle:hover{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000);--tw-ring-opacity:1;--tw-ring-color:rgba(59, 130, 246, var(--tw-ring-opacity));--tw-ring-opacity:0.5}.navbar-toggle:focus{border-radius:.375rem;--tw-border-opacity:1;border-color:rgba(37,99,235,var(--tw-border-opacity));--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.btn{border-radius:.375rem;padding:.5rem .75rem;text-decoration:none}.btn.active{--tw-bg-opacity:1;background-color:rgba(37,99,235,var(--tw-bg-opacity));--tw-text-opacity:1;color:rgba(255,255,255,var(--tw-text-opacity))}@media (min-width:1024px){.lg\:max-w-screen-xl{max-width:1280px}} \ No newline at end of file +:root{-moz-tab-size:4;-o-tab-size:4;tab-size:4}body,html{line-height:1.5}html{-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"}body{margin:0;font-family:system-ui,-apple-system,'Segoe UI',Roboto,Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji';font-family:inherit;--tw-bg-opacity:1;background-color:rgba(255,255,255,var(--tw-bg-opacity));--tw-text-opacity:1;color:rgba(0,0,0,var(--tw-text-opacity));font-size:1rem}hr{height:0;color:inherit}abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,pre,samp{font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;margin:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}::-moz-focus-inner{border-style:none;padding:0}:-moz-focusring{outline:1px dotted ButtonText}:-moz-ui-invalid{box-shadow:none}legend{padding:0}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}button{background-color:transparent;background-image:none}button:focus{outline:5px auto -webkit-focus-ring-color}fieldset,ol,ul{margin:0;padding:0}ol,ul{list-style:none}*,::after,::before{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}hr{border-top-width:1px}img{border-style:solid}textarea{resize:vertical}input::-moz-placeholder, textarea::-moz-placeholder{opacity:1;color:#9ca3af}input:-ms-input-placeholder, textarea:-ms-input-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;--tw-text-opacity:1;color:rgba(59,130,246,var(--tw-text-opacity));text-decoration:underline}button,input,optgroup,select,textarea{padding:0;line-height:inherit;color:inherit}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}*{--tw-shadow:0 0 #0000;--tw-ring-inset:var(--tw-empty,/*!*/ /*!*/);--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59, 130, 246, 0.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000}.container{width:100%;margin-right:auto;margin-left:auto}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.col-span-12{grid-column:span 12/span 12}.col-span-6{grid-column:span 6/span 6}.my-5{margin-top:1.25rem;margin-bottom:1.25rem}.my-3{margin-top:.75rem;margin-bottom:.75rem}.my-2{margin-top:.5rem}.mb-2,.my-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.mt-8{margin-top:2rem}.mb-5{margin-bottom:1.25rem}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.grid{display:grid}.flex-col{flex-direction:column}.gap-6{gap:1.5rem}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1.25rem*calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem*var(--tw-space-y-reverse))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(1rem*var(--tw-space-x-reverse));margin-left:calc(1rem*calc(1 - var(--tw-space-x-reverse)))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.25rem*calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem*var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1.5rem*calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem*var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.border{border-width:1px}.border-gray-200{--tw-border-opacity:1;border-color:rgba(229,231,235,var(--tw-border-opacity))}.bg-gray-200,.bg-white{--tw-bg-opacity:1;background-color:rgba(229,231,235,var(--tw-bg-opacity))}.bg-white{background-color:rgba(255,255,255,var(--tw-bg-opacity))}.p-5{padding:1.25rem}.p-4{padding:1rem}.navbar .container,.px-5{padding-left:1.25rem;padding-right:1.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.px-12{padding-left:3rem;padding-right:3rem}.py-24{padding-top:6rem;padding-bottom:6rem}.px-4{padding-left:1rem;padding-right:1rem}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-sans{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"}.text-5xl{font-size:3rem;line-height:1}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.font-light{font-weight:300}.font-semibold{font-weight:600}.text-gray-500,a:hover{--tw-text-opacity:1;color:rgba(107,114,128,var(--tw-text-opacity))}.icon{font-feature-settings:"liga","dlig";-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility;font-family:"Material Icons";vertical-align:middle;letter-spacing:normal;display:inline-block;text-decoration:none;text-transform:none;white-space:nowrap;font-weight:400;position:relative;font-style:normal;word-wrap:normal;font-size:24px;line-height:1;direction:ltr;height:1em;width:1em}a:hover{color:rgba(29,78,216,var(--tw-text-opacity))}a,button{transition:color .2s ease-out,box-shadow .2s ease-out;-webkit-tap-highlight-color:transparent}a:focus-visible,button:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000);--tw-ring-opacity:1;--tw-ring-color:rgba(59, 130, 246, var(--tw-ring-opacity));--tw-ring-opacity:0.5}a:focus,button:focus{border-radius:.125rem;outline:2px solid transparent;outline-offset:2px}.navbar{position:fixed;top:0;left:0;z-index:50;width:100%}@media (min-width:640px){.navbar .container{max-width:1280px}}.navbar .navbar-bg{position:absolute;top:0;left:0;z-index:10;height:100%;width:100%;--tw-bg-opacity:1;background-color:rgba(255,255,255,var(--tw-bg-opacity))}.navbar .navbar-frame{position:relative;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;width:100%;padding-top:.5rem;padding-bottom:.5rem}.navbar .navbar-border,.navbar .navbar-shadow{position:absolute;top:0;left:0;height:100%;width:100%}.navbar .navbar-shadow{transition:opacity ease .25s;--tw-bg-opacity:1;background-color:rgba(255,255,255,var(--tw-bg-opacity));opacity:0}.navbar.shadow .navbar-shadow{box-shadow:0 4px 15px rgba(0,0,50,.08);opacity:1}.navbar .navbar-border{transition:border-color ease .25s;z-index:10;border-bottom-width:1px;--tw-border-opacity:1;border-color:rgba(229,231,235,var(--tw-border-opacity));--tw-border-opacity:0}.navbar:not(.shadow) .navbar-border{--tw-border-opacity:1}.navbar-offset{margin-top:4rem}.navbar-collapse{align-items:center}@media (min-width:640px){.navbar-collapse.desktop{display:block}.navbar-collapse.mobile{display:none}}@media (max-width:639px){.navbar-collapse{--height:100vh;transition:height ease-out .25s;flex-grow:1;flex-basis:100%;overflow-y:hidden}.navbar-collapse.mobile{display:block}.navbar-collapse.desktop{display:none}.navbar-collapse.show{height:100%;height:var(--height, 100vh)}.navbar-collapse.collapse{height:0}}.navbar-list{display:flex;flex-wrap:nowrap;padding-left:.25rem;padding-right:.25rem}@media (max-width:639px){.navbar-list{flex-direction:column}}.navbar-logo{margin-left:.25rem;font-size:1.25rem;line-height:1.75rem;font-weight:600;border-radius:.375rem;padding:.5rem .75rem;text-decoration:none}@media (min-width:640px){.navbar-list a{margin-left:.25rem;margin-right:.25rem}}@media (max-width:639px){.navbar-list a{margin-top:.25rem;margin-bottom:.25rem;width:100%}}.navbar-list a{border-radius:.375rem;padding:.5rem .75rem;text-decoration:none}.navbar-list a:hover,.navbar-logo:hover{--tw-bg-opacity:1;background-color:rgba(229,231,235,var(--tw-bg-opacity))}.navbar-list a.active,.navbar-logo.active{--tw-bg-opacity:1;background-color:rgba(37,99,235,var(--tw-bg-opacity));--tw-text-opacity:1;color:rgba(255,255,255,var(--tw-text-opacity))}.btn.active:hover,.navbar-list a.active:hover,.navbar-logo.active:hover{--tw-bg-opacity:1;background-color:rgba(29,78,216,var(--tw-bg-opacity))}.navbar-list a:hover,.navbar-logo:hover{--tw-bg-opacity:0.6}.navbar-list a,.navbar-logo,.navbar-toggle{transition:background-color .15s ease-out,color .15s ease-out,border-color .2s ease-out,box-shadow .2s ease-out;z-index:20}.navbar-toggle{border-radius:.375rem}@media (min-width:640px){.navbar-toggle{display:none}}.navbar-toggle{margin-right:.25rem;height:2.5rem;width:2.5rem;--tw-text-opacity:1;color:rgba(59,130,246,var(--tw-text-opacity))}.navbar-toggle:hover{--tw-bg-opacity:1;background-color:rgba(243,244,246,var(--tw-bg-opacity))}.navbar-toggle:focus-visible{border-radius:.375rem;--tw-border-opacity:1;border-color:rgba(37,99,235,var(--tw-border-opacity));--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.btn{border-radius:.375rem;padding:.5rem .75rem;text-decoration:none}#big-transition #big-transition-horizontal>div,.btn.active,.btn:hover{--tw-bg-opacity:1;background-color:rgba(229,231,235,var(--tw-bg-opacity))}.btn.active{background-color:rgba(37,99,235,var(--tw-bg-opacity));--tw-text-opacity:1;color:rgba(255,255,255,var(--tw-text-opacity))}.btn:hover{--tw-bg-opacity:0.6}#big-transition{position:fixed;z-index:2000;top:0;left:0;right:0;bottom:0;display:flex}#big-transition,#big-transition .logo{opacity:0;visibility:hidden}#big-transition #big-transition-horizontal{position:absolute;top:0;left:0;right:0;bottom:0;display:flex;flex-flow:column}#big-transition #big-transition-horizontal>div{width:100%;flex:1 1;transform-origin:0 0;transform:scaleX(0)}.logo{position:absolute;z-index:12;top:50%;left:50%;transform:translate(-50%,-50%)}@media (min-width:640px){.sm\:col-span-3{grid-column:span 3/span 3}.sm\:col-span-9{grid-column:span 9/span 9}.sm\:max-w-screen-xl{max-width:1280px}.sm\:grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.sm\:px-10{padding-left:2.5rem;padding-right:2.5rem}}@media (min-width:768px){.md\:col-span-6{grid-column:span 6/span 6}.md\:grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.md\:py-5{padding-top:1.25rem;padding-bottom:1.25rem}}@media (min-width:1024px){.lg\:max-w-screen-xl{max-width:1280px}} \ No newline at end of file diff --git a/demo/docs.html b/demo/docs.html new file mode 100644 index 0000000..dc0f2c0 --- /dev/null +++ b/demo/docs.html @@ -0,0 +1,65 @@ +Other page

Docs

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ex est, maximus aliquam sagittis vel, +tempus vel odio. Praesent felis elit, blandit et laoreet nec, hendrerit et arcu. Aenean ligula sapien, +sodales vel semper in, pulvinar id nulla. Donec pellentesque non tellus vel imperdiet. Pellentesque +posuere, nisl sed rutrum tincidunt, augue augue vestibulum ex, vel ornare justo arcu eu magna. Praesent +vel nisl enim. Aenean a odio porttitor, fermentum est et, mattis sem. Suspendisse aliquam, risus a +aliquam vestibulum, eros ipsum pulvinar sem, quis posuere tellus ex id velit. Quisque eu pellentesque +nisl, sed volutpat purus. Sed auctor convallis sapien sed hendrerit. Vivamus et neque facilisis, +ultrices ex non, faucibus velit. Aliquam laoreet sed turpis a blandit. Nulla fringilla massa non +fermentum rutrum.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis +fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed +vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus +mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, +sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, +pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum +non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor +iaculis arcu ac rutrum. Suspendisse vel odio risus.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis +fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed +vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus +mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, +sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, +pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum +non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor +iaculis arcu ac rutrum. Suspendisse vel odio risus.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et +ex mollis +fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam +commodo. Donec sed +vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, +nascetur ridiculus +mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae +elementum pharetra, +sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus +maximus, +pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis +aliquet. Vestibulum +non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet +tortor. Duis auctor +iaculis arcu ac rutrum. Suspendisse vel odio risus.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et +ex mollis +fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam +commodo. Donec sed +vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, +nascetur ridiculus +mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae +elementum pharetra, +sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus +maximus, +pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis +aliquet. Vestibulum +non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet +tortor. Duis auctor +iaculis arcu ac rutrum. Suspendisse vel odio risus.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris +et ex mollis +fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam +commodo. Donec sed +vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, +nascetur ridiculus +mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae +elementum pharetra, +sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis +tellus maximus, +pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis +aliquet. Vestibulum +non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet +tortor. Duis auctor +iaculis arcu ac rutrum. Suspendisse vel odio risus.

Lazyloaded imgLazyloaded img
\ No newline at end of file diff --git a/demo/index.html b/demo/index.html index 3e6ed95..ddf6c6f 100644 --- a/demo/index.html +++ b/demo/index.html @@ -1,25 +1,11 @@ -Homepage

Homepage

Dynamic example.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis fringilla. +Homepage

Homepage

Dynamic example.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor iaculis arcu ac rutrum. Suspendisse vel odio -risus.

Normal img

Normal image.

Lazyloaded img

Lazyloaded picture.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis -fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed -vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus -mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, -sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, -pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum -non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor -iaculis arcu ac rutrum. Suspendisse vel odio risus.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis -fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed -vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus -mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, -sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, -pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum -non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor -iaculis arcu ac rutrum. Suspendisse vel odio risus.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis +risus.

Normal img

Normal image.

Lazyloaded img

Lazyloaded picture.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, @@ -43,7 +29,7 @@ elit. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Cras ac facilisis in, egestas eget quam. Donec ullamcorper nulla non metus auctor fringilla. Sed posuere consectetur est at lobortis. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. Donec id elit non mi porta gravida at -eget metus. Cras mattis consectetur purus sit amet fermentum.

Lazyloaded img

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis +eget metus. Cras mattis consectetur purus sit amet fermentum.

Lazyloaded img

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, @@ -91,4 +77,4 @@ pharetra augue. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, sem nec elit. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Nulla vitae elit libero, a pharetra augue. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Praesent commodo cursus magna, -vel scelerisque nisl consectetur et.

Lazyloaded img

Lazyloaded image.

Lazyloaded img

Lazyloaded image.

Lazyloaded img

Lazyloaded image.

\ No newline at end of file +vel scelerisque nisl consectetur et.

Lazyloaded img

Lazyloaded image.

Lazyloaded img

Lazyloaded image.

Lazyloaded img

Lazyloaded image.

\ No newline at end of file diff --git a/demo/js/animate.js b/demo/js/animate.js index 776dcf6..c199d36 100644 --- a/demo/js/animate.js +++ b/demo/js/animate.js @@ -1,2 +1,2 @@ -var Q=Object.defineProperty;var O=Object.prototype.hasOwnProperty;var A=Object.getOwnPropertySymbols,R=Object.prototype.propertyIsEnumerable;var C=(i,t,e)=>t in i?Q(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,u=(i,t)=>{for(var e in t||(t={}))O.call(t,e)&&C(i,e,t[e]);if(A)for(var e of A(t))R.call(t,e)&&C(i,e,t[e]);return i};var S=(i,t)=>{var e={};for(var r in i)O.call(i,r)&&t.indexOf(r)<0&&(e[r]=i[r]);if(i!=null&&A)for(var r of A(i))t.indexOf(r)<0&&R.call(i,r)&&(e[r]=i[r]);return e};var p=class{constructor(t){this.map=new Map(t)}getMap(){return this.map}get(t){return this.map.get(t)}keys(){return Array.from(this.map.keys())}values(){return Array.from(this.map.values())}set(t,e){return this.map.set(t,e),this}add(t){let r=this.size;return this.set(r,t),this}get size(){return this.map.size}get length(){return this.map.size}last(t=1){let e=this.keys()[this.size-t];return this.get(e)}delete(t){return this.map.delete(t)}remove(t){return this.map.delete(t),this}clear(){return this.map.clear(),this}has(t){return this.map.has(t)}entries(){return this.map.entries()}forEach(t,e){return this.map.forEach(t,e),this}[Symbol.iterator](){return this.entries()}},E=(i,t,...e)=>{i.forEach(r=>{r[t](...e)})};var wt=new DOMParser;var D=({callback:i=()=>{},scope:t=null,name:e="event"})=>({callback:i,scope:t,name:e}),b=class extends p{constructor(t="event"){super();this.name=t}},v=class extends p{constructor(){super()}getEvent(t){let e=this.get(t);return e instanceof b?e:(this.set(t,new b(t)),this.get(t))}newListener(t,e,r){let n=this.getEvent(t);return n.add(D({name:t,callback:e,scope:r})),n}on(t,e,r){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let n,s,a=typeof t=="object"&&!Array.isArray(t),o=a?e:r;return a||(s=e),Object.keys(t).forEach(l=>{a?(n=l,s=t[l]):n=t[l],this.newListener(n,s,o)},this),this}removeListener(t,e,r){let n=this.get(t);if(n instanceof b&&e){let s=D({name:t,callback:e,scope:r});n.forEach((a,o)=>{if(a.callback===s.callback&&a.scope===s.scope)return n.remove(o)})}return n}off(t,e,r){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let n,s,a=typeof t=="object"&&!Array.isArray(t),o=a?e:r;return a||(s=e),Object.keys(t).forEach(l=>{a?(n=l,s=t[l]):n=t[l],typeof s=="function"?this.removeListener(n,s,o):this.remove(n)},this),this}emit(t,...e){return typeof t=="undefined"?this:(typeof t=="string"&&(t=t.trim().split(/\s/g)),t.forEach(r=>{let n=this.get(r);n instanceof b&&n.forEach(s=>{let{callback:a,scope:o}=s;a.apply(o,e)})},this),this)}clear(){return E(this,"clear"),super.clear(),this}};var rt=i=>typeof i=="string"?Array.from(document.querySelectorAll(i)):[i],nt=i=>[].concat(...i),K=i=>Array.isArray(i)?nt(i.map(K)):typeof i=="string"||i instanceof Node?rt(i):i instanceof NodeList||i instanceof HTMLCollection?Array.from(i):[],_=(i,t,e)=>typeof i=="function"?i.apply(e,t):i,U=(i,t,e)=>{let r,n,s={},a=Object.keys(i);for(let o=0,l=a.length;o/^(in|out)/.test(i)?st[i]:i,z={keyframes:[],loop:1,delay:0,speed:1,endDelay:0,easing:"ease",autoplay:!0,duration:1e3,fillMode:"auto",direction:"normal",extend:{}},w=class{constructor(t={}){this.options={};this.targets=[];this.properties={};this.animations=new p;this.totalDuration=0;this.minDelay=0;this.computedOptions=new p;this.emitter=new v;var r;try{let e=t,{options:s}=e,a=S(e,["options"]),o=s instanceof w?s.getOptions():Array.isArray(s)?(r=s==null?void 0:s[0])==null?void 0:r.getOptions():s;this.options=Object.assign({},z,o,a),this.loop=this.loop.bind(this);let n=this.options,{loop:l,delay:q,speed:F,easing:T,endDelay:V,duration:j,direction:G,fillMode:$,onfinish:P,target:X,keyframes:B,autoplay:Y,extend:W}=n,J=S(n,["loop","delay","speed","easing","endDelay","duration","direction","fillMode","onfinish","target","keyframes","autoplay","extend"]);this.mainElement=document.createElement("div"),this.targets=K(X),this.properties=J;let M=[],f=this.targets.length,y;for(let h=0;h0||(y=U(y,[h,f,m],this));let k=c.delay+c.duration*c.iterations+c.endDelay;this.totalDuration{typeof P=="function"&&P.call(this,m,h,f,d),this.emit("finish",m,h,f,d)},this.computedOptions.set(d,c),this.animations.set(m,d),M.push(c.delay)}this.mainAnimation=this.mainElement.animate([{opacity:"0"},{opacity:"1"}],{duration:this.totalDuration,easing:"linear"}),this.minDelay=Math.min(...M),this.setSpeed(F),Y?this.play():this.pause(),this.promise=this.newPromise(),this.mainAnimation.onfinish=()=>{this.emit("complete",this),this.stopLoop()}}catch(s){this.emit("error",s)}}newPromise(){return new Promise((t,e)=>{this.on("complete",()=>t([this])),this.on("error",r=>e(r))})}then(t,e){return t=t==null?void 0:t.bind(this),e=e==null?void 0:e.bind(this),this.promise.then(t,e),this}catch(t){return t=t==null?void 0:t.bind(this),this.promise.catch(t),this}finally(t){return t=t==null?void 0:t.bind(this),this.promise.finally(t),this}loop(){this.stopLoop(),this.emit("update",this.getProgress(),this),this.animationFrame=window.requestAnimationFrame(this.loop)}stopLoop(){window.cancelAnimationFrame(this.animationFrame)}all(t){return t(this.mainAnimation,this.mainElement),this.animations.forEach(t),this}beginEvent(){if(this.getProgress()==0){let t=window.setTimeout(()=>{this.emit("begin",this),t=window.clearTimeout(t)},this.minDelay)}}play(){let t=this.getPlayState();return this.beginEvent(),this.all(e=>e.play()),this.emit("play",t,this),this.loop(),this}pause(){let t=this.getPlayState();return this.all(e=>e.pause()),this.emit("pause",t,this),this.stopLoop(),this.animationFrame=void 0,this}reset(){return this.setProgress(0),this.beginEvent(),this.options.autoplay?this.play():this.pause(),this}cancel(){return this.all(t=>t.cancel()),this.stopLoop(),this}finish(){return this.all(t=>t.finish()),this.stopLoop(),this}stop(){for(this.cancel(),this.animations.clear();this.targets.length;)this.targets.pop();this.mainElement=void 0,this.emit("stop")}getTargets(){return this.targets}getAnimation(t){return this.animations.get(t)}getTiming(t){var a,o,l;let e=t instanceof Animation?t:this.getAnimation(t),r=(a=this.computedOptions.get(e))!=null?a:{},n=(l=(o=e.effect)==null?void 0:o.getTiming())!=null?l:{},s=this.getOptions();return u(u(u(u({},z),s),n),r)}getTotalDuration(){return this.totalDuration}getCurrentTime(){return this.mainAnimation.currentTime}getProgress(){return this.getCurrentTime()/this.totalDuration*100}getSpeed(){return this.mainAnimation.playbackRate}getPlayState(){return this.mainAnimation.playState}getOptions(){return this.options}setCurrentTime(t){return this.all(e=>{e.currentTime=t}),this.emit("update",this.getProgress()),this}setProgress(t){let e=t/100*this.totalDuration;return this.setCurrentTime(e),this}setSpeed(t=1){return this.all(e=>{e.playbackRate=t}),this}on(t,e,r){return this.emitter.on(t,e,r!=null?r:this),this}off(t,e,r){return this.emitter.off(t,e,r!=null?r:this),this}emit(t,...e){return this.emitter.emit(t,...e),this}toJSON(){return this.getOptions()}get[Symbol.toStringTag](){return"Animate"}},g=(i={})=>new w(i);(()=>{let i=".css-selector-demo",t=g({target:`${i} .el`,transform:["translateX(0px)","translateX(250px)"],onfinish(r){r.style.transform="translateX(250px)"},duration:500,autoplay:!1});document.querySelector(i).addEventListener("click",()=>{t.reset(),t.play()})})();(()=>{let i=".dom-node-demo",t=document.querySelectorAll(`${i} .el`),e=g({target:t,transform:["translateX(0px)","translateX(250px)"],onfinish(n){n.style.transform="translateX(250px)"},duration:500,autoplay:!1});document.querySelector(i).addEventListener("click",()=>{e.reset(),e.play()})})();(()=>{let i=".array-demo",t=n=>`${i} .el-0${n}`,e=g({target:[`${i} .el-01`,t(2),t(3),t(4),t(5)],transform:["translateX(0px)","translateX(250px)"],onfinish(n){n.style.transform="translateX(250px)"},autoplay:!1});document.querySelector(i).addEventListener("click",()=>{e.reset(),e.play()})})();(()=>{let i=".css-properties-demo",t=g({target:`${i} .el`,backgroundColor:["#616aff","#fff"],left:["0px","240px"],borderRadius:["0%","50%"],onfinish(r){let{style:n}=r;n.backgroundColor="#fff",n.left="240px",n.borderRadius="50%"},easing:"in-out-quad",autoplay:!1});document.querySelector(i).addEventListener("click",()=>{t.reset(),t.play()})})();(()=>{let i=".css-transform-demo",t=g({target:`${i} .el`,transform:["translateX(0) scale(1) rotate(0)","translateX(250px) scale(2) rotate(1turn)"],onfinish(r){r.style.transform="translateX(250px) scale(2) rotate(1turn)"},easing:"in-out-quad",autoplay:!1});document.querySelector(i).addEventListener("click",()=>{t.reset(),t.play()})})();(()=>{let i=".svg-attributes-demo";var t=document.querySelector(`${i} path`);let e=g({target:t,strokeDashoffset:[4e3,0],loop:!0,direction:"alternate",easing:"in-out-expo",autoplay:!1});document.querySelector(i).addEventListener("click",()=>{e.getPlayState()==="running"?e.pause():e.play()}),e.on("update",()=>{console.log("Go")})})(); +var Z=Object.defineProperty;var O=Object.prototype.hasOwnProperty;var A=Object.getOwnPropertySymbols,C=Object.prototype.propertyIsEnumerable;var H=(i,t,e)=>t in i?Z(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,u=(i,t)=>{for(var e in t||(t={}))O.call(t,e)&&H(i,e,t[e]);if(A)for(var e of A(t))C.call(t,e)&&H(i,e,t[e]);return i};var S=(i,t)=>{var e={};for(var r in i)O.call(i,r)&&t.indexOf(r)<0&&(e[r]=i[r]);if(i!=null&&A)for(var r of A(i))t.indexOf(r)<0&&C.call(i,r)&&(e[r]=i[r]);return e};var p=class{constructor(t){this.map=new Map(t)}getMap(){return this.map}get(t){return this.map.get(t)}keys(){return Array.from(this.map.keys())}values(){return Array.from(this.map.values())}set(t,e){return this.map.set(t,e),this}add(t){let r=this.size;return this.set(r,t),this}get size(){return this.map.size}get length(){return this.map.size}last(t=1){let e=this.keys()[this.size-t];return this.get(e)}delete(t){return this.map.delete(t)}remove(t){return this.map.delete(t),this}clear(){return this.map.clear(),this}has(t){return this.map.has(t)}entries(){return this.map.entries()}forEach(t,e){return this.map.forEach(t,e),this}[Symbol.iterator](){return this.entries()}},E=(i,t,...e)=>{i.forEach(r=>{r[t](...e)})};var xt=new DOMParser;var D=({callback:i=()=>{},scope:t=null,name:e="event"})=>({callback:i,scope:t,name:e}),b=class extends p{constructor(t="event"){super();this.name=t}},w=class extends p{constructor(){super()}getEvent(t){let e=this.get(t);return e instanceof b?e:(this.set(t,new b(t)),this.get(t))}newListener(t,e,r){let n=this.getEvent(t);return n.add(D({name:t,callback:e,scope:r})),n}on(t,e,r){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let n,s,a=typeof t=="object"&&!Array.isArray(t),o=a?e:r;return a||(s=e),Object.keys(t).forEach(l=>{a?(n=l,s=t[l]):n=t[l],this.newListener(n,s,o)},this),this}removeListener(t,e,r){let n=this.get(t);if(n instanceof b&&e){let s=D({name:t,callback:e,scope:r});n.forEach((a,o)=>{if(a.callback===s.callback&&a.scope===s.scope)return n.remove(o)})}return n}off(t,e,r){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let n,s,a=typeof t=="object"&&!Array.isArray(t),o=a?e:r;return a||(s=e),Object.keys(t).forEach(l=>{a?(n=l,s=t[l]):n=t[l],typeof s=="function"?this.removeListener(n,s,o):this.remove(n)},this),this}emit(t,...e){return typeof t=="undefined"?this:(typeof t=="string"&&(t=t.trim().split(/\s/g)),t.forEach(r=>{let n=this.get(r);n instanceof b&&n.forEach(s=>{let{callback:a,scope:o}=s;a.apply(o,e)})},this),this)}clear(){return E(this,"clear"),super.clear(),this}};var rt=i=>typeof i=="string"?Array.from(document.querySelectorAll(i)):[i],nt=i=>[].concat(...i),_=i=>Array.isArray(i)?nt(i.map(_)):typeof i=="string"||i instanceof Node?rt(i):i instanceof NodeList||i instanceof HTMLCollection?Array.from(i):[],K=(i,t,e)=>typeof i=="function"?i.apply(e,t):i,z=(i,t,e)=>{let r,n,s={},a=Object.keys(i);for(let o=0,l=a.length;o/^(in|out)/.test(i)?st[i]:i,U={keyframes:[],loop:1,delay:0,speed:1,endDelay:0,easing:"ease",autoplay:!0,duration:1e3,fillMode:"auto",direction:"normal",extend:{}},x=class{constructor(t={}){this.options={};this.targets=[];this.properties={};this.animations=new p;this.totalDuration=0;this.minDelay=0;this.computedOptions=new p;this.emitter=new w;var r;try{let e=t,{options:s}=e,a=S(e,["options"]),o=s instanceof x?s.getOptions():Array.isArray(s)?(r=s==null?void 0:s[0])==null?void 0:r.getOptions():s;this.options=Object.assign({},U,o,a),this.loop=this.loop.bind(this);let n=this.options,{loop:l,delay:q,speed:F,easing:T,endDelay:V,duration:G,direction:j,fillMode:$,onfinish:M,target:X,keyframes:B,autoplay:Y,extend:W}=n,J=S(n,["loop","delay","speed","easing","endDelay","duration","direction","fillMode","onfinish","target","keyframes","autoplay","extend"]);this.mainElement=document.createElement("div"),this.targets=_(X),this.properties=J;let k=[],f=this.targets.length,y;for(let h=0;h0||(y=z(y,[h,f,m],this));let R=c.delay+c.duration*c.iterations+c.endDelay;this.totalDuration{typeof M=="function"&&M.call(this,m,h,f,d),this.emit("finish",m,h,f,d)},this.computedOptions.set(d,c),this.animations.set(m,d),k.push(c.delay)}this.mainAnimation=this.mainElement.animate([{opacity:"0"},{opacity:"1"}],{duration:this.totalDuration,easing:"linear"}),this.minDelay=Math.min(...k),this.setSpeed(F),Y?this.play():this.pause(),this.promise=this.newPromise(),this.mainAnimation.onfinish=()=>{this.emit("complete",this),this.stopLoop()}}catch(s){this.emit("error",s)}}newPromise(){return new Promise((t,e)=>{this.on("complete",()=>t([this])),this.on("error",r=>e(r))})}then(t,e){return t=t==null?void 0:t.bind(this),e=e==null?void 0:e.bind(this),this.promise.then(t,e),this}catch(t){return t=t==null?void 0:t.bind(this),this.promise.catch(t),this}finally(t){return t=t==null?void 0:t.bind(this),this.promise.finally(t),this}loop(){this.stopLoop(),this.emit("update",this.getProgress(),this),this.animationFrame=window.requestAnimationFrame(this.loop)}stopLoop(){window.cancelAnimationFrame(this.animationFrame)}all(t){return t(this.mainAnimation,this.mainElement),this.animations.forEach(t),this}beginEvent(){if(this.getProgress()==0){let t=window.setTimeout(()=>{this.emit("begin",this),t=window.clearTimeout(t)},this.minDelay)}}play(){let t=this.getPlayState();return this.beginEvent(),this.all(e=>e.play()),this.emit("play",t,this),this.loop(),this}pause(){let t=this.getPlayState();return this.all(e=>e.pause()),this.emit("pause",t,this),this.stopLoop(),this.animationFrame=void 0,this}reset(){return this.setProgress(0),this.beginEvent(),this.options.autoplay?this.play():this.pause(),this}cancel(){return this.all(t=>t.cancel()),this.stopLoop(),this}finish(){return this.all(t=>t.finish()),this.stopLoop(),this}stop(){for(this.cancel(),this.animations.clear();this.targets.length;)this.targets.pop();this.mainElement=void 0,this.emit("stop")}getTargets(){return this.targets}getAnimation(t){return this.animations.get(t)}getTiming(t){var a,o,l;let e=t instanceof Animation?t:this.getAnimation(t),r=(a=this.computedOptions.get(e))!=null?a:{},n=(l=(o=e.effect)==null?void 0:o.getTiming())!=null?l:{},s=this.getOptions();return u(u(u(u({},U),s),n),r)}getTotalDuration(){return this.totalDuration}getCurrentTime(){return this.mainAnimation.currentTime}getProgress(){return this.getCurrentTime()/this.totalDuration*100}getSpeed(){return this.mainAnimation.playbackRate}getPlayState(){return this.mainAnimation.playState}getOptions(){return this.options}setCurrentTime(t){return this.all(e=>{e.currentTime=t}),this.emit("update",this.getProgress()),this}setProgress(t){let e=t/100*this.totalDuration;return this.setCurrentTime(e),this}setSpeed(t=1){return this.all(e=>{e.playbackRate=t}),this}on(t,e,r){return this.emitter.on(t,e,r!=null?r:this),this}off(t,e,r){return this.emitter.off(t,e,r!=null?r:this),this}emit(t,...e){return this.emitter.emit(t,...e),this}toJSON(){return this.getOptions()}get[Symbol.toStringTag](){return"Animate"}},g=(i={})=>new x(i);(()=>{let i=".css-selector-demo",t=g({target:`${i} .el`,transform:["translateX(0px)","translateX(250px)"],onfinish(r){r.style.transform="translateX(250px)"},duration:500,autoplay:!1});document.querySelector(i).addEventListener("click",()=>{t.reset(),t.play()})})();(()=>{let i=".dom-node-demo",t=document.querySelectorAll(`${i} .el`),e=g({target:t,transform:["translateX(0px)","translateX(250px)"],onfinish(n){n.style.transform="translateX(250px)"},duration:500,autoplay:!1});document.querySelector(i).addEventListener("click",()=>{e.reset(),e.play()})})();(()=>{let i=".array-demo",t=n=>`${i} .el-0${n}`,e=g({target:[`${i} .el-01`,t(2),t(3),t(4),t(5)],transform:["translateX(0px)","translateX(250px)"],onfinish(n){n.style.transform="translateX(250px)"},autoplay:!1});document.querySelector(i).addEventListener("click",()=>{e.reset(),e.play()})})();(()=>{let i=".css-properties-demo",t=g({target:`${i} .el`,backgroundColor:["#616aff","#fff"],left:["0px","240px"],borderRadius:["0%","50%"],onfinish(r){let{style:n}=r;n.backgroundColor="#fff",n.left="240px",n.borderRadius="50%"},easing:"in-out-quad",autoplay:!1});document.querySelector(i).addEventListener("click",()=>{t.reset(),t.play()})})();(()=>{let i=".css-transform-demo",t=g({target:`${i} .el`,transform:["translateX(0) scale(1) rotate(0)","translateX(250px) scale(2) rotate(1turn)"],onfinish(r){r.style.transform="translateX(250px) scale(2) rotate(1turn)"},easing:"in-out-quad",autoplay:!1});document.querySelector(i).addEventListener("click",()=>{t.reset(),t.play()})})();(()=>{let i=".svg-attributes-demo";var t=document.querySelector(`${i} path`);let e=g({target:t,strokeDashoffset:[4e3,0],loop:!0,direction:"alternate",easing:"in-out-expo",autoplay:!1});document.querySelector(i).addEventListener("click",()=>{e.getPlayState()==="running"?e.pause():e.play()}),e.on("update",()=>{console.log("Go")})})(); //# sourceMappingURL=animate.js.map diff --git a/demo/js/main.js b/demo/js/main.js index e91d8d8..786529e 100644 --- a/demo/js/main.js +++ b/demo/js/main.js @@ -1,3 +1,3 @@ -var Tt=Object.defineProperty;var rt=Object.prototype.hasOwnProperty;var H=Object.getOwnPropertySymbols,nt=Object.prototype.propertyIsEnumerable;var st=(r,t,e)=>t in r?Tt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,c=(r,t)=>{for(var e in t||(t={}))rt.call(t,e)&&st(r,e,t[e]);if(H)for(var e of H(t))nt.call(t,e)&&st(r,e,t[e]);return r};var F=(r,t)=>{var e={};for(var i in r)rt.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&H)for(var i of H(r))t.indexOf(i)<0&&nt.call(r,i)&&(e[i]=r[i]);return e};var xt={wrapperAttr:"wrapper",noAjaxLinkAttr:"no-ajax-link",noPrefetchAttr:"no-prefetch",headers:[["x-partial","true"]],preventSelfAttr:'prevent="self"',preventAllAttr:'prevent="all"',transitionAttr:"transition",blockAttr:"block",timeout:3e4,maxPages:5},at=r=>Object.assign(c({},xt),r),Lt=(r,t,e=!0)=>{let{prefix:i}=r,n=`data${i?"-"+i:""}-${t}`;return e?`[${n}]`:n},u=(r,t,e=!0)=>{if(typeof t!="string")return r;let i=r[t];return typeof i=="string"?Lt(r,i,e):i};var f=class{constructor(t){this.map=new Map(t)}getMap(){return this.map}get(t){return this.map.get(t)}keys(){return Array.from(this.map.keys())}values(){return Array.from(this.map.values())}set(t,e){return this.map.set(t,e),this}add(t){let i=this.size;return this.set(i,t),this}get size(){return this.map.size}get length(){return this.map.size}last(t=1){let e=this.keys()[this.size-t];return this.get(e)}delete(t){return this.map.delete(t)}remove(t){return this.map.delete(t),this}clear(){return this.map.clear(),this}has(t){return this.map.has(t)}entries(){return this.map.entries()}forEach(t,e){return this.map.forEach(t,e),this}[Symbol.iterator](){return this.entries()}},T=(r,t,...e)=>{r.forEach(i=>{i[t](...e)})};var S=class{constructor(){}install(){}register(t,e){return this.manager=t,this.app=t.app,this.config=t.config,this.emitter=t.emitter,this.key=e,this.install(),this}uninstall(){}unregister(){this.uninstall(),this.manager.remove(this.key),this.key=void 0,this.manager=void 0,this.app=void 0,this.config=void 0,this.emitter=void 0}},M=class extends f{constructor(t){super();this.app=t,this.config=t.config,this.emitter=t.emitter}set(t,e){return super.set(t,e),e.register(this,t),this}};var h=(r=window.location.href)=>r instanceof URL?r:new URL(r,window.location.origin),A=r=>{let t=h(r);return`${t.pathname}${t.hash}`};var ot=r=>h(r).toString().replace(/(\/#.*|\/|#.*)$/,""),C=(r,t)=>ot(r)===ot(t);var d=class extends S{init(){}boot(){this.initEvents()}initEvents(){}stopEvents(){}stop(){this.stopEvents(),this.unregister()}},q=class extends M{constructor(t){super(t)}init(){return T(this,"init"),this}boot(){return T(this,"boot"),this}stop(){return T(this,"stop"),this}};var I=(r=window.scrollX,t=window.scrollY)=>({x:r,y:t}),N=(r={url:A(h()),index:0,transition:"default",data:{scroll:I(),trigger:"HistoryManager"}})=>r,j=class extends d{constructor(){super(...arguments);this.pointer=-1}init(){this.states=[];let t=N();this.add(t,"replace")}get(t){return this.states[t]}add(t,e="push"){let i=N(t),n=this.length;this.states.push(c({},i)),this.pointer=n;let s={index:this.pointer,states:[...this.states]};return St(e,i,s),this}remove(t){return t?this.states.splice(t,1):this.states.pop(),this.pointer--,this}replace(t){return this.states=t,this}set(t,e){return this.states[t]=e}get current(){return this.get(this.pointer)}get last(){return this.get(this.length-1)}get previous(){return this.pointer<1?null:this.get(this.pointer-1)}get length(){return this.states.length}},St=(r,t,e)=>{let i=A(t.url),n=[e,"",i];if(window.history)switch(r){case"push":window.history.pushState.apply(window.history,n);break;case"replace":window.history.replaceState.apply(window.history,n);break}};var Mt=new DOMParser,V=class extends S{constructor(t=h(),e=document){super();this.url=t,typeof e=="string"?this.data=e:this.dom=e||document}build(){if(this.dom instanceof Node||(this.dom=Mt.parseFromString(this.data,"text/html")),!(this.body instanceof Node)){let{title:t,head:e,body:i}=this.dom;this.title=t,this.head=e,this.body=i,this.wrapper=this.body.querySelector(this.wrapperAttr)}}install(){this.wrapperAttr=u(this.config,"wrapperAttr")}uninstall(){this.url=void 0,this.title=void 0,this.head=void 0,this.body=void 0,this.dom=void 0,this.wrapper=void 0,this.data=void 0,this.wrapperAttr=void 0}},G=class extends d{constructor(){super(...arguments);this.loading=new f}install(){this.pages=new M(this.app);let t=h().pathname;this.set(t,new V),t=void 0}get(t){return this.pages.get(t)}add(t){return this.pages.add(t),this}set(t,e){return this.pages.set(t,e),this}remove(t){return this.pages.remove(t),this}has(t){return this.pages.has(t)}clear(){return this.pages.clear(),this}get size(){return this.pages.size}keys(){return this.pages.keys()}async load(t=h()){let e=h(t),i=e.pathname,n,s;if(this.has(i))return n=this.get(i),Promise.resolve(n);this.loading.has(i)?s=this.loading.get(i):(s=this.request(i),this.loading.set(i,s));let o=await s;if(this.loading.remove(i),n=new V(e,o),this.set(i,n),this.size>u(this.config,"maxPages")){let l=h(),a=this.keys(),p=C(l,a[0])?a[1]:a[0],m=this.get(p);m.unregister(),m=void 0,a=void 0,l=void 0,p=void 0}return n}async request(t){let e=new Headers(u(this.config,"headers")),i=window.setTimeout(()=>{throw window.clearTimeout(i),"Request Timed Out!"},u(this.config,"timeout"));try{let n=await fetch(t,{mode:"same-origin",method:"GET",headers:e,cache:"default",credentials:"same-origin"});if(window.clearTimeout(i),n.status>=200&&n.status<300)return await n.text();throw new Error(n.statusText||""+n.status)}catch(n){throw window.clearTimeout(i),n}}};var lt=({callback:r=()=>{},scope:t=null,name:e="event"})=>({callback:r,scope:t,name:e}),P=class extends f{constructor(t="event"){super();this.name=t}},k=class extends f{constructor(){super()}getEvent(t){let e=this.get(t);return e instanceof P?e:(this.set(t,new P(t)),this.get(t))}newListener(t,e,i){let n=this.getEvent(t);return n.add(lt({name:t,callback:e,scope:i})),n}on(t,e,i){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let n,s,o=typeof t=="object"&&!Array.isArray(t),l=o?e:i;return o||(s=e),Object.keys(t).forEach(a=>{o?(n=a,s=t[a]):n=t[a],this.newListener(n,s,l)},this),this}removeListener(t,e,i){let n=this.get(t);if(n instanceof P&&e){let s=lt({name:t,callback:e,scope:i});n.forEach((o,l)=>{if(o.callback===s.callback&&o.scope===s.scope)return n.remove(l)})}return n}off(t,e,i){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let n,s,o=typeof t=="object"&&!Array.isArray(t),l=o?e:i;return o||(s=e),Object.keys(t).forEach(a=>{o?(n=a,s=t[a]):n=t[a],typeof s=="function"?this.removeListener(n,s,l):this.remove(n)},this),this}emit(t,...e){return typeof t=="undefined"?this:(typeof t=="string"&&(t=t.trim().split(/\s/g)),t.forEach(i=>{let n=this.get(i);n instanceof P&&n.forEach(s=>{let{callback:o,scope:l}=s;o.apply(l,e)})},this),this)}clear(){return T(this,"clear"),super.clear(),this}};var X=(r,t=window.location.hash)=>{try{let e=t[0]=="#"?t:h(t).hash;if(e.length>1){let i=document.getElementById(e.slice(1));if(i){let{left:n,top:s}=i.getBoundingClientRect(),o=window.pageXOffset,l=window.pageYOffset,a=n+o,p=s+l;return console.log(a,p),I(a,p)}}}catch(e){console.warn("[hashAction] error",e)}return r!=null?r:I(0,0)},Pt={name:"default",scrollable:!0,out({done:r}){r()},in({scroll:r,done:t}){window.scroll(r.x,r.y),t()}},$=class extends d{constructor(t){super();this._arg=t}install(){var e;super.install();let t=this._arg&&this._arg.length?this._arg:(e=u(this.config,"transitions"))!=null?e:[];t=[["default",Pt]].concat(t),this.transitions=new f(t)}get(t){return this.transitions.get(t)}set(t,e){return this.transitions.set(t,e),this}add(t){return this.transitions.add(t),this}has(t){return this.transitions.has(t)}async animate(t,e){let i=this.transitions.get(t),n=e.scroll,s=e.ignoreHashAction;if(!("wrapper"in e.oldPage)||!("wrapper"in e.newPage))throw`[Page] either oldPage or newPage aren't instances of the Page Class. - ${{newPage:e.newPage,oldPage:e.oldPage}}`;document.title=""+e.newPage.title;let o=e.oldPage.wrapper,l=e.newPage.wrapper;if(!(o instanceof Node)||!(l instanceof Node))throw`[Wrapper] the wrapper from the ${l instanceof Node?"current":"next"} page cannot be found. The wrapper must be an element that has the attribute ${u(this.config,"wrapperAttr")}.`;return i.init&&(i==null||i.init(e)),this.emitter.emit("BEFORE_TRANSITION_OUT"),i.out&&await new Promise(a=>{let p=i.out.call(i,c(c({},e),{from:e.oldPage,trigger:e.trigger,done:a}));p==null||p.then(a)}),this.emitter.emit("AFTER_TRANSITION_OUT"),await new Promise(a=>{o.insertAdjacentElement("beforebegin",l),this.emitter.emit("CONTENT_INSERT"),!s&&!/back|popstate|forward/.test(e.trigger)&&(n=X(n)),a()}),await new Promise(a=>{o.remove(),o=void 0,l=void 0,this.emitter.emit("CONTENT_REPLACED"),a()}),this.emitter.emit("BEFORE_TRANSITION_IN"),i.in&&await new Promise(async a=>{let p=i.in.call(i,c(c({},e),{from:e.oldPage,to:e.newPage,trigger:e.trigger,scroll:n,done:a}));p==null||p.then(a)}),this.emitter.emit("AFTER_TRANSITION_IN"),i}};var B=class{constructor(t={}){this.register(t)}register(t={}){this.config=at(t),this.emitter=new k,this.services=new q(this);let e=(()=>{document.removeEventListener("DOMContentLoaded",e),window.removeEventListener("load",e),this.emitter.emit("READY ready")}).bind(this);return document.addEventListener("DOMContentLoaded",e),window.addEventListener("load",e),this}get(t){return this.services.get(t)}set(t,e){return this.services.set(t,e),this}add(t){return this.services.add(t),this}boot(){return this.services.init(),this.services.boot(),this}stop(){return this.services.stop(),this.emitter.clear(),this}on(t,e){return this.emitter.on(t,e,this),this}off(t,e){return this.emitter.off(t,e,this),this}emit(t,...e){return this.emitter.emit(t,...e),this}};var Y=class extends d{install(){var t,e,i,n,s,o;super.install(),this.ignoreURLs=(t=u(this.config,"ignoreURLs"))!=null?t:[],this.prefetchIgnore=(e=u(this.config,"prefetchIgnore"))!=null?e:!1,this.stopOnTransitioning=(i=u(this.config,"stopOnTransitioning"))!=null?i:!1,this.stickyScroll=(n=u(this.config,"stickyScroll"))!=null?n:!1,this.forceOnError=(s=u(this.config,"forceOnError"))!=null?s:!1,this.ignoreHashAction=(o=u(this.config,"ignoreHashAction"))!=null?o:!1}transitionStart(){this.isTransitioning=!0}transitionStop(){this.isTransitioning=!1}init(){this.onHover=this.onHover.bind(this),this.onClick=this.onClick.bind(this),this.onStateChange=this.onStateChange.bind(this)}boot(){"scrollRestoration"in window.history&&(window.history.scrollRestoration="manual"),super.boot()}getTransitionName(t){if(!t||!t.getAttribute)return null;let e=t.getAttribute(u(this.config,"transitionAttr",!1));return typeof e=="string"?e:null}validLink(t,e,i){let n=!window.history.pushState,s=!t||!i,o=e.metaKey||e.ctrlKey||e.shiftKey||e.altKey,l=t.hasAttribute("target")&&t.target==="_blank",a=t.protocol!==location.protocol||t.hostname!==location.hostname,p=typeof t.getAttribute("download")=="string",m=t.matches(u(this.config,"preventSelfAttr")),E=Boolean(t.closest(u(this.config,"preventAllAttr"))),g=A(h())===A(h(i));return!(s||n||o||l||a||p||m||E||g)}getHref(t){return t&&t.tagName&&t.tagName.toLowerCase()==="a"&&typeof t.href=="string"?t.href:null}getLink(t){let e=t.target,i=this.getHref(e);for(;e&&!i;)e=e.parentNode,i=this.getHref(e);if(!(!e||!this.validLink(e,t,i)))return e}onClick(t){let e=this.getLink(t);if(!e)return;if(this.isTransitioning&&this.stopOnTransitioning){t.preventDefault(),t.stopPropagation();return}let i=this.getHref(e);this.emitter.emit("ANCHOR_CLICK CLICK",t),this.go({href:i,trigger:e,event:t})}getDirection(t){return Math.abs(t)>1?t>0?"forward":"back":t===0?"popstate":t>0?"back":"forward"}force(t){window.location.assign(t)}go({href:t,trigger:e="HistoryManager",event:i}){if(this.isTransitioning&&this.stopOnTransitioning||!(this.manager.has("TransitionManager")&&this.manager.has("HistoryManager")&&this.manager.has("PageManager"))){this.force(t);return}let n=this.manager.get("HistoryManager"),s=I(0,0),o=n.current,l=o.url;if(C(l,t))return;let a;if(i&&i.state){this.emitter.emit("POPSTATE",i);let{state:p}=i,{index:m}=p,g=o.index-m;n.replace(p.states),n.pointer=m;let R=n.get(m);a=R.transition,s=R.data.scroll,e=this.getDirection(g),console.log(e=="forward"&&n),this.emitter.emit(e==="back"?"POPSTATE_BACK":"POPSTATE_FORWARD",i)}else{a=this.getTransitionName(e),s=I();let p=N({url:t,transition:a,data:{scroll:s}});!this.stickyScroll&&(s=I(0,0)),n.add(p),this.emitter.emit("HISTORY_NEW_ITEM",i)}return i&&(i.stopPropagation(),i.preventDefault()),this.emitter.emit("GO",i),this.load({oldHref:l,href:t,trigger:e,transitionName:a,scroll:s})}async load({oldHref:t,href:e,trigger:i,transitionName:n="default",scroll:s={x:0,y:0}}){try{let o=this.manager.get("PageManager"),l,a;this.emitter.emit("NAVIGATION_START",{oldHref:t,href:e,trigger:i,transitionName:n});try{this.transitionStart(),a=await o.load(t),!(a.dom instanceof Element)&&a.build(),this.emitter.emit("PAGE_LOADING",{href:e,oldPage:a,trigger:i}),l=await o.load(e),await l.build(),this.emitter.emit("PAGE_LOAD_COMPLETE",{newPage:l,oldPage:a,trigger:i})}catch(p){console.warn(`[PJAX] Page load error: ${p}`)}try{let p=this.manager.get("TransitionManager");this.emitter.emit("TRANSITION_START",n);let m=await p.animate(p.has(n)?n:"default",{oldPage:a,newPage:l,trigger:i,scroll:s,ignoreHashAction:this.ignoreHashAction});m.scrollable||(!this.ignoreHashAction&&!/back|popstate|forward/.test(i)&&(s=X(s)),window.scroll(s.x,s.y)),this.emitter.emit("TRANSITION_END",{transition:m})}catch(p){console.warn(`[PJAX] Transition error: ${p}`)}this.emitter.emit("NAVIGATION_END",{oldPage:a,newPage:l,trigger:i,transitionName:n})}catch(o){this.forceOnError?this.force(e):console.warn(o)}finally{this.transitionStop()}}ignoredURL({pathname:t}){return this.ignoreURLs.length&&this.ignoreURLs.some(e=>typeof e=="string"?e===t:e.exec(t)!==null)}onHover(t){let e=this.getLink(t);if(!e||!this.manager.has("PageManager"))return;let i=this.manager.get("PageManager"),n=h(this.getHref(e)),s=n.pathname;if(!(this.ignoredURL(n)||i.has(s))){this.emitter.emit("ANCHOR_HOVER HOVER",t);try{i.load(n)}catch(o){console.warn("[PJAX] prefetch error,",o)}}}onStateChange(t){this.go({href:window.location.href,trigger:"popstate",event:t})}initEvents(){this.prefetchIgnore!==!0&&(document.addEventListener("mouseover",this.onHover),document.addEventListener("touchstart",this.onHover)),document.addEventListener("click",this.onClick),window.addEventListener("popstate",this.onStateChange)}stopEvents(){this.prefetchIgnore!==!0&&(document.removeEventListener("mouseover",this.onHover),document.removeEventListener("touchstart",this.onHover)),document.removeEventListener("click",this.onClick),window.removeEventListener("popstate",this.onStateChange)}};var W=class extends d{constructor(t=[]){super();this.routes=new f;for(let e of t)this.add(e)}add({path:t,method:e}){let i=this.parse(t);return this.routes.set(i,e),this}parsePath(t){if(typeof t=="string")return new RegExp(t,"i");if(t instanceof RegExp||typeof t=="boolean")return t;throw"[Router] only regular expressions, strings and booleans are accepted as paths."}isPath(t){return typeof t=="string"||t instanceof RegExp||typeof t=="boolean"}parse(t){let e=t,i={from:/(.*)/g,to:/(.*)/g};if(this.isPath(t))i={from:!0,to:t};else if(this.isPath(e.from)&&this.isPath(e.to))i=e;else throw"[Router] path is neither a string, regular expression, or a { from, to } object.";let{from:n,to:s}=i;return{from:this.parsePath(n),to:this.parsePath(s)}}route(){if(this.manager.has("HistoryManager")){let t=this.manager.get("HistoryManager"),e=A(h((t.length>1?t.previous:t.current).url)),i=A(h());this.routes.forEach((n,s)=>{let o=s.from,l=s.to;if(typeof o=="boolean"&&typeof l=="boolean")throw`[Router] path ({ from: ${o}, to: ${l} }) is not valid, remember paths can only be strings, regular expressions, or a boolean; however, both the from and to paths cannot be both booleans.`;let a=o,p=l;o instanceof RegExp&&o.test(e)&&(a=o.exec(e)),l instanceof RegExp&&l.test(i)&&(p=l.exec(i)),(Array.isArray(p)&&Array.isArray(a)||Array.isArray(p)&&typeof a=="boolean"&&a||Array.isArray(a)&&typeof p=="boolean"&&p)&&n({from:a,to:p,path:{from:e,to:i}})})}else console.warn("[Route] HistoryManager is missing.")}initEvents(){this.emitter.on("READY",this.route,this),this.emitter.on("CONTENT_REPLACED",this.route,this)}stopEvents(){this.emitter.off("READY",this.route,this),this.emitter.off("CONTENT_REPLACED",this.route,this)}};var kt=r=>typeof r=="string"?Array.from(document.querySelectorAll(r)):[r],Rt=r=>[].concat(...r),pt=r=>Array.isArray(r)?Rt(r.map(pt)):typeof r=="string"||r instanceof Node?kt(r):r instanceof NodeList||r instanceof HTMLCollection?Array.from(r):[],ct=(r,t,e)=>typeof r=="function"?r.apply(e,t):r,ht=(r,t,e)=>{let i,n,s={},o=Object.keys(r);for(let l=0,a=o.length;l/^(in|out)/.test(r)?Ot[r]:r,ut={keyframes:[],loop:1,delay:0,speed:1,endDelay:0,easing:"ease",autoplay:!0,duration:1e3,fillMode:"auto",direction:"normal",extend:{}},D=class{constructor(t={}){this.options={};this.targets=[];this.properties={};this.animations=new f;this.totalDuration=0;this.minDelay=0;this.computedOptions=new f;this.emitter=new k;var i;try{let e=t,{options:s}=e,o=F(e,["options"]),l=s instanceof D?s.getOptions():Array.isArray(s)?(i=s==null?void 0:s[0])==null?void 0:i.getOptions():s;this.options=Object.assign({},ut,l,o),this.loop=this.loop.bind(this);let n=this.options,{loop:a,delay:p,speed:m,easing:E,endDelay:g,duration:R,direction:bt,fillMode:yt,onfinish:tt,target:At,keyframes:Et,autoplay:vt,extend:It}=n,wt=F(n,["loop","delay","speed","easing","endDelay","duration","direction","fillMode","onfinish","target","keyframes","autoplay","extend"]);this.mainElement=document.createElement("div"),this.targets=pt(At),this.properties=wt;let et=[],x=this.targets.length,O;for(let v=0;v0||(O=ht(O,[v,x,w],this));let it=y.delay+y.duration*y.iterations+y.endDelay;this.totalDuration{typeof tt=="function"&&tt.call(this,w,v,x,L),this.emit("finish",w,v,x,L)},this.computedOptions.set(L,y),this.animations.set(w,L),et.push(y.delay)}this.mainAnimation=this.mainElement.animate([{opacity:"0"},{opacity:"1"}],{duration:this.totalDuration,easing:"linear"}),this.minDelay=Math.min(...et),this.setSpeed(m),vt?this.play():this.pause(),this.promise=this.newPromise(),this.mainAnimation.onfinish=()=>{this.emit("complete",this),this.stopLoop()}}catch(s){this.emit("error",s)}}newPromise(){return new Promise((t,e)=>{this.on("complete",()=>t([this])),this.on("error",i=>e(i))})}then(t,e){return t=t==null?void 0:t.bind(this),e=e==null?void 0:e.bind(this),this.promise.then(t,e),this}catch(t){return t=t==null?void 0:t.bind(this),this.promise.catch(t),this}finally(t){return t=t==null?void 0:t.bind(this),this.promise.finally(t),this}loop(){this.stopLoop(),this.emit("update",this.getProgress(),this),this.animationFrame=window.requestAnimationFrame(this.loop)}stopLoop(){window.cancelAnimationFrame(this.animationFrame)}all(t){return t(this.mainAnimation,this.mainElement),this.animations.forEach(t),this}beginEvent(){if(this.getProgress()==0){let t=window.setTimeout(()=>{this.emit("begin",this),t=window.clearTimeout(t)},this.minDelay)}}play(){let t=this.getPlayState();return this.beginEvent(),this.all(e=>e.play()),this.emit("play",t,this),this.loop(),this}pause(){let t=this.getPlayState();return this.all(e=>e.pause()),this.emit("pause",t,this),this.stopLoop(),this.animationFrame=void 0,this}reset(){return this.setProgress(0),this.beginEvent(),this.options.autoplay?this.play():this.pause(),this}cancel(){return this.all(t=>t.cancel()),this.stopLoop(),this}finish(){return this.all(t=>t.finish()),this.stopLoop(),this}stop(){for(this.cancel(),this.animations.clear();this.targets.length;)this.targets.pop();this.mainElement=void 0,this.emit("stop")}getTargets(){return this.targets}getAnimation(t){return this.animations.get(t)}getTiming(t){var o,l,a;let e=t instanceof Animation?t:this.getAnimation(t),i=(o=this.computedOptions.get(e))!=null?o:{},n=(a=(l=e.effect)==null?void 0:l.getTiming())!=null?a:{},s=this.getOptions();return c(c(c(c({},ut),s),n),i)}getTotalDuration(){return this.totalDuration}getCurrentTime(){return this.mainAnimation.currentTime}getProgress(){return this.getCurrentTime()/this.totalDuration*100}getSpeed(){return this.mainAnimation.playbackRate}getPlayState(){return this.mainAnimation.playState}getOptions(){return this.options}setCurrentTime(t){return this.all(e=>{e.currentTime=t}),this.emit("update",this.getProgress()),this}setProgress(t){let e=t/100*this.totalDuration;return this.setCurrentTime(e),this}setSpeed(t=1){return this.all(e=>{e.playbackRate=t}),this}on(t,e,i){return this.emitter.on(t,e,i!=null?i:this),this}off(t,e,i){return this.emitter.off(t,e,i!=null?i:this),this}emit(t,...e){return this.emitter.emit(t,...e),this}toJSON(){return this.getOptions()}get[Symbol.toStringTag](){return"Animate"}},b=(r={})=>new D(r);var J=class extends d{init(){super.init(),this.elements=[...document.querySelectorAll(".intro-animation")]}newPage(){this.init(),this.prepareToShow()}initEvents(){this.emitter.on("BEFORE_SPLASHSCREEN_HIDE",this.prepareToShow,this),this.emitter.on("CONTENT_REPLACED",this.newPage,this),this.emitter.on("START_SPLASHSCREEN_HIDE BEFORE_TRANSITION_IN",this.show,this)}stopEvents(){this.emitter.off("BEFORE_SPLASHSCREEN_HIDE",this.prepareToShow,this),this.emitter.off("CONTENT_REPLACED",this.newPage,this),this.emitter.off("START_SPLASHSCREEN_HIDE BEFORE_TRANSITION_IN",this.show,this)}stop(){requestAnimationFrame(()=>{for(let t of this.elements)t.style.transform="translateY(0px)",t.style.opacity="1"}),super.stop()}prepareToShow(){requestAnimationFrame(()=>{for(let t of this.elements)t.style.transform="translateY(200px)",t.style.opacity="0"})}async show(){let[t]=await b({target:this.elements,keyframes:[{transform:"translateY(200px)",opacity:0},{transform:"translateY(0px)",opacity:1}],delay(e){return 300*(e+1)},onfinish(e){requestAnimationFrame(()=>{e.style.transform="translateY(0px)",e.style.opacity="1"})},easing:"out-cubic",duration:650});return t.stop(),t}};var mt={name:"default",duration:500,scrollable:!0,out({from:r}){let{duration:t}=this,e=r.wrapper;return b({target:e,opacity:[1,0],duration:t}).on("finish",function(){this.stop()})},in({to:r,scroll:t}){let{duration:e}=this,i=r.wrapper;return window.scroll(t.x,t.y),b({target:i,opacity:[0,1],duration:e}).then(function(){this.stop()})}};var gt={name:"big",delay:200,durationPerAnimation:700,scrollable:!0,init(){this.mainElement=document.getElementById("big-transition"),this.spinnerElement=this.mainElement.querySelector(".spinner"),this.horizontalElements=[...this.mainElement.querySelector("#big-transition-horizontal").querySelectorAll("div")],this.maxLength=this.horizontalElements.length},out({from:r,scroll:t}){let{durationPerAnimation:e,delay:i}=this,n=r.wrapper;window.scroll(t.x,t.y);let s=Object.assign({},n.style);return new Promise(async o=>{this.mainElement.style.opacity="1",this.mainElement.style.visibility="visible",b({target:n,opacity:[1,0],duration:e,onfinish(g){g.style.opacity="0"}}).then(function(){this.stop()});let[a]=await b({target:this.horizontalElements,keyframes:[{transform:"scaleX(0)"},{transform:"scaleX(1)"}],delay(g){return i*(g+1)},onfinish(g){g.style.transform="scaleX(1)"},easing:"out-cubic",duration:500});n.style.opacity="1",Object.assign(n.style,s),this.spinnerElement.style.visibility="visible";let p=500,[m]=await b({target:this.spinnerElement,opacity:[0,1],duration:p,onfinish(g){g.style.opacity="1"}}),[E]=await b({options:m,opacity:[1,0],onfinish(g){g.style.opacity="0"},delay:1500});this.spinnerElement.style.visibility="hidden",m.stop(),E.stop(),o()})},in({to:r,scroll:t}){let{durationPerAnimation:e,delay:i}=this,n=r.wrapper;return window.scroll(t.x,t.y),new Promise(async s=>{let o=b({target:n,opacity:[0,1],duration:e}).then(()=>{o.stop()}),[l]=await b({target:this.horizontalElements,keyframes:[{transform:"scaleX(1)"},{transform:"scaleX(0)"}],delay(a){return i*(a+1)},onfinish(a){a.style.transform="scaleX(0)"},easing:"out-cubic",duration:500});this.mainElement.style.opacity="0",this.mainElement.style.visibility="hidden",l.stop(),s()})}};var _={name:"slide",duration:500,direction:"right",scrollable:!0,init(r){let t=r.trigger;t instanceof Node&&t.hasAttribute("data-direction")?this.direction=t.getAttribute("data-direction"):this.direction="right"},out({from:r}){let{duration:t,direction:e}=this,i=r.wrapper;return b({target:i,keyframes:[{transform:"translateX(0%)",opacity:1},{transform:`translateX(${e==="left"?"-":""}25%)`,opacity:0}],duration:t,easing:"in-quint"}).then(function(){this.stop()})},in({to:r,scroll:t}){let{duration:e}=this,i=r.wrapper;return window.scroll(t.x,t.y),b({target:i,keyframes:[{transform:`translateX(${this.direction==="right"?"-":""}25%)`,opacity:0},{transform:"translateX(0%)",opacity:1}],duration:e,easing:"out-quint"}).then(function(){this.stop()})}},ft=c(c({},_),{name:"slide-left",direction:"left",init(r){}}),dt=c(c({},_),{name:"slide-right",direction:"right",init(r){}});var K=r=>Array.from(r);var Q=class extends d{init(){this.navbar=document.querySelector(".navbar"),this.collapseSection=this.navbar.querySelector(".navbar-collapse"),this.navbarList=this.navbar.querySelector(".navbar-list"),this.elements=K(this.navbar.querySelectorAll(".navbar-list a")),this.menu=this.navbar.querySelector(".navbar-toggle"),this.toggleStatus=!1,this.toggleClick=this.toggleClick.bind(this)}activateLink(){let{href:t}=window.location;for(let e of this.elements){let i=e.getAttribute("data-path")||e.href;if(!i||i.length<1)return;let n=new RegExp(i).test(t),s=e.classList.contains("active");n&&s||e.classList.toggle("active",n)}}toggleClick(){var t,e;(e=(t=this.collapseSection.style)==null?void 0:t.setProperty)==null||e.call(t,"--height",`${this.navbarList.clientHeight}px`),this.toggleStatus=!this.toggleStatus,this.collapseSection.classList.toggle("collapse",!this.toggleStatus),this.collapseSection.classList.toggle("show",this.toggleStatus)}initEvents(){this.menu.addEventListener("click",this.toggleClick),this.emitter.on("READY",this.activateLink,this),this.emitter.on("GO",this.activateLink,this)}stopEvents(){this.navbar.removeEventListener("click",this.toggleClick),this.emitter.off("READY",this.activateLink,this),this.emitter.off("GO",this.activateLink,this)}uninstall(){for(;this.elements.length;)this.elements.pop();this.elements=void 0,this.menu=void 0,this.navbar=void 0}};var z,Ct,Z=new B;Z.add(new J).set("HistoryManager",new j).set("PageManager",new G).set("TransitionManager",new $([["default",mt],["BigTransition",gt],["Slide",_],["SlideLeft",ft],["SlideRight",dt]])).add(new Q).set("router",z=new W).add(Ct=new Y);try{z=Z.get("router");let r=K(document.querySelectorAll(".navbar .nav-link"));for(let t of r){let e=t;z.add({path:e.getAttribute("data-path")||e.pathname,method(){e.classList.contains("active")||e.classList.add("active");for(let n of r)n!==e&&n.classList.remove("active")}})}z.add({path:/(index|\/$)(\.html)?/,method(){}}),Z.boot()}catch(r){console.warn("[App] boot failed,",r)} +var xt=Object.defineProperty;var nt=Object.prototype.hasOwnProperty;var H=Object.getOwnPropertySymbols,st=Object.prototype.propertyIsEnumerable;var at=(r,t,e)=>t in r?xt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,c=(r,t)=>{for(var e in t||(t={}))nt.call(t,e)&&at(r,e,t[e]);if(H)for(var e of H(t))st.call(t,e)&&at(r,e,t[e]);return r};var q=(r,t)=>{var e={};for(var i in r)nt.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&H)for(var i of H(r))t.indexOf(i)<0&&st.call(r,i)&&(e[i]=r[i]);return e};var Lt={wrapperAttr:"wrapper",noAjaxLinkAttr:"no-ajax-link",noPrefetchAttr:"no-prefetch",headers:[["x-partial","true"]],preventSelfAttr:'prevent="self"',preventAllAttr:'prevent="all"',transitionAttr:"transition",blockAttr:"block",timeout:3e4,maxPages:5,resizeDelay:100},ot=r=>Object.assign(c({},Lt),r),St=(r,t,e=!0)=>{let{prefix:i}=r,n=`data${i?"-"+i:""}-${t}`;return e?`[${n}]`:n},h=(r,t,e=!0)=>{if(typeof t!="string")return r;let i=r[t];return typeof i=="string"?St(r,i,e):i};var d=class{constructor(t){this.map=new Map(t)}getMap(){return this.map}get(t){return this.map.get(t)}keys(){return Array.from(this.map.keys())}values(){return Array.from(this.map.values())}set(t,e){return this.map.set(t,e),this}add(t){let i=this.size;return this.set(i,t),this}get size(){return this.map.size}get length(){return this.map.size}last(t=1){let e=this.keys()[this.size-t];return this.get(e)}delete(t){return this.map.delete(t)}remove(t){return this.map.delete(t),this}clear(){return this.map.clear(),this}has(t){return this.map.has(t)}entries(){return this.map.entries()}forEach(t,e){return this.map.forEach(t,e),this}[Symbol.iterator](){return this.entries()}},T=(r,t,...e)=>{r.forEach(i=>{i[t](...e)})};var S=class{constructor(){}install(){}register(t,e){return this.manager=t,this.app=t.app,this.config=t.config,this.emitter=t.emitter,this.key=e,this.install(),this}uninstall(){}unregister(){this.uninstall(),this.manager.remove(this.key),this.key=void 0,this.manager=void 0,this.app=void 0,this.config=void 0,this.emitter=void 0}},M=class extends d{constructor(t){super();this.app=t,this.config=t.config,this.emitter=t.emitter}set(t,e){return super.set(t,e),e.register(this,t),this}};var u=(r=window.location.href)=>r instanceof URL?r:new URL(r,window.location.origin),A=r=>{let t=u(r);return`${t.pathname}${t.hash}`};var lt=r=>u(r).toString().replace(/(\/#.*|\/|#.*)$/,""),N=(r,t)=>lt(r)===lt(t);var f=class extends S{init(){}boot(){this.initEvents()}initEvents(){}stopEvents(){}stop(){this.stopEvents(),this.unregister()}},j=class extends M{constructor(t){super(t)}init(){return T(this,"init"),this}boot(){return T(this,"boot"),this}stop(){return T(this,"stop"),this}};var w=(r=window.scrollX,t=window.scrollY)=>({x:r,y:t}),D=(r={url:A(u()),index:0,transition:"default",data:{scroll:w(),trigger:"HistoryManager"}})=>r,V=class extends f{constructor(){super(...arguments);this.pointer=-1}init(){this.states=[];let t=D();this.add(t,"replace")}get(t){return this.states[t]}add(t,e="push"){let i=D(t),n=this.length;this.states.push(c({},i)),this.pointer=n;let s={index:this.pointer,states:[...this.states]};return Mt(e,i,s),this}remove(t){return t?this.states.splice(t,1):this.states.pop(),this.pointer--,this}replace(t){return this.states=t,this}set(t,e){return this.states[t]=e}get current(){return this.get(this.pointer)}get last(){return this.get(this.length-1)}get previous(){return this.pointer<1?null:this.get(this.pointer-1)}get length(){return this.states.length}},Mt=(r,t,e)=>{let i=A(t.url),n=[e,"",i];if(window.history)switch(r){case"push":window.history.pushState.apply(window.history,n);break;case"replace":window.history.replaceState.apply(window.history,n);break}};var Pt=new DOMParser,G=class extends S{constructor(t=u(),e=document){super();this.url=t,typeof e=="string"?this.data=e:this.dom=e||document}build(){if(this.dom instanceof Node||(this.dom=Pt.parseFromString(this.data,"text/html")),!(this.body instanceof Node)){let{title:t,head:e,body:i}=this.dom;this.title=t,this.head=e,this.body=i,this.wrapper=this.body.querySelector(this.wrapperAttr)}}install(){this.wrapperAttr=h(this.config,"wrapperAttr")}uninstall(){this.url=void 0,this.title=void 0,this.head=void 0,this.body=void 0,this.dom=void 0,this.wrapper=void 0,this.data=void 0,this.wrapperAttr=void 0}},X=class extends f{constructor(){super(...arguments);this.loading=new d}install(){this.pages=new M(this.app);let t=u().pathname;this.set(t,new G),t=void 0}get(t){return this.pages.get(t)}add(t){return this.pages.add(t),this}set(t,e){return this.pages.set(t,e),this}remove(t){return this.pages.remove(t),this}has(t){return this.pages.has(t)}clear(){return this.pages.clear(),this}get size(){return this.pages.size}keys(){return this.pages.keys()}async load(t=u()){let e=u(t),i=e.pathname,n,s;if(this.has(i))return n=this.get(i),Promise.resolve(n);this.loading.has(i)?s=this.loading.get(i):(s=this.request(i),this.loading.set(i,s));let o=await s;if(this.loading.remove(i),n=new G(e,o),this.set(i,n),this.size>h(this.config,"maxPages")){let l=u(),a=this.keys(),p=N(l,a[0])?a[1]:a[0],m=this.get(p);m.unregister(),m=void 0,a=void 0,l=void 0,p=void 0}return n}async request(t){let e=new Headers(h(this.config,"headers")),i=window.setTimeout(()=>{throw window.clearTimeout(i),"Request Timed Out!"},h(this.config,"timeout"));try{let n=await fetch(t,{mode:"same-origin",method:"GET",headers:e,cache:"default",credentials:"same-origin"});if(window.clearTimeout(i),n.status>=200&&n.status<300)return await n.text();throw new Error(n.statusText||""+n.status)}catch(n){throw window.clearTimeout(i),n}}};var pt=({callback:r=()=>{},scope:t=null,name:e="event"})=>({callback:r,scope:t,name:e}),P=class extends d{constructor(t="event"){super();this.name=t}},k=class extends d{constructor(){super()}getEvent(t){let e=this.get(t);return e instanceof P?e:(this.set(t,new P(t)),this.get(t))}newListener(t,e,i){let n=this.getEvent(t);return n.add(pt({name:t,callback:e,scope:i})),n}on(t,e,i){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let n,s,o=typeof t=="object"&&!Array.isArray(t),l=o?e:i;return o||(s=e),Object.keys(t).forEach(a=>{o?(n=a,s=t[a]):n=t[a],this.newListener(n,s,l)},this),this}removeListener(t,e,i){let n=this.get(t);if(n instanceof P&&e){let s=pt({name:t,callback:e,scope:i});n.forEach((o,l)=>{if(o.callback===s.callback&&o.scope===s.scope)return n.remove(l)})}return n}off(t,e,i){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let n,s,o=typeof t=="object"&&!Array.isArray(t),l=o?e:i;return o||(s=e),Object.keys(t).forEach(a=>{o?(n=a,s=t[a]):n=t[a],typeof s=="function"?this.removeListener(n,s,l):this.remove(n)},this),this}emit(t,...e){return typeof t=="undefined"?this:(typeof t=="string"&&(t=t.trim().split(/\s/g)),t.forEach(i=>{let n=this.get(i);n instanceof P&&n.forEach(s=>{let{callback:o,scope:l}=s;o.apply(l,e)})},this),this)}clear(){return T(this,"clear"),super.clear(),this}};var $=(r,t=window.location.hash)=>{try{let e=t[0]=="#"?t:u(t).hash;if(e.length>1){let i=document.getElementById(e.slice(1));if(i){let{left:n,top:s}=i.getBoundingClientRect(),o=window.pageXOffset,l=window.pageYOffset,a=n+o,p=s+l;return console.log(a,p),w(a,p)}}}catch(e){console.warn("[hashAction] error",e)}return r!=null?r:w(0,0)},kt={name:"default",scrollable:!0,out({done:r}){r()},in({scroll:r,done:t}){window.scroll(r.x,r.y),t()}},B=class extends f{constructor(t){super();this._arg=t}install(){var e;super.install();let t=this._arg&&this._arg.length?this._arg:(e=h(this.config,"transitions"))!=null?e:[];t=[["default",kt]].concat(t),this.transitions=new d(t)}get(t){return this.transitions.get(t)}set(t,e){return this.transitions.set(t,e),this}add(t){return this.transitions.add(t),this}has(t){return this.transitions.has(t)}async animate(t,e){let i=this.transitions.get(t),n=e.scroll,s=e.ignoreHashAction;if(!("wrapper"in e.oldPage)||!("wrapper"in e.newPage))throw`[Page] either oldPage or newPage aren't instances of the Page Class. + ${{newPage:e.newPage,oldPage:e.oldPage}}`;document.title=""+e.newPage.title;let o=e.oldPage.wrapper,l=e.newPage.wrapper;if(!(o instanceof Node)||!(l instanceof Node))throw`[Wrapper] the wrapper from the ${l instanceof Node?"current":"next"} page cannot be found. The wrapper must be an element that has the attribute ${h(this.config,"wrapperAttr")}.`;return i.init&&(i==null||i.init(e)),this.emitter.emit("BEFORE_TRANSITION_OUT"),i.out&&await new Promise(a=>{let p=i.out.call(i,c(c({},e),{from:e.oldPage,trigger:e.trigger,done:a}));p==null||p.then(a)}),this.emitter.emit("AFTER_TRANSITION_OUT"),await new Promise(a=>{o.insertAdjacentElement("beforebegin",l),this.emitter.emit("CONTENT_INSERT"),!s&&!/back|popstate|forward/.test(e.trigger)&&(n=$(n)),a()}),await new Promise(a=>{o.remove(),o=void 0,l=void 0,this.emitter.emit("CONTENT_REPLACED"),a()}),this.emitter.emit("BEFORE_TRANSITION_IN"),i.in&&await new Promise(async a=>{let p=i.in.call(i,c(c({},e),{from:e.oldPage,to:e.newPage,trigger:e.trigger,scroll:n,done:a}));p==null||p.then(a)}),this.emitter.emit("AFTER_TRANSITION_IN"),i}};var W=class{constructor(t={}){this.canResize=!0;this.canScroll=!0;this._resize=this._resize.bind(this),this._scroll=this._scroll.bind(this),this._ready=this._ready.bind(this),this.register(t)}register(t={}){return this.config=ot(t),this.emitter=new k,this.services=new j(this),document.addEventListener("DOMContentLoaded",this._ready),window.addEventListener("load",this._ready),window.addEventListener("resize",this._resize,{passive:!0}),window.addEventListener("scroll",this._scroll,{passive:!0}),this}_ready(){document.removeEventListener("DOMContentLoaded",this._ready),window.removeEventListener("load",this._ready),this.emitter.emit("READY ready")}_resize(){if(this.canResize){let t,e;this.canResize=!1,e=window.requestAnimationFrame(()=>{this.emitter.emit("RESIZE resize"),t=window.setTimeout(()=>{this.canResize=!0,t=window.clearTimeout(t),e=window.cancelAnimationFrame(e)},h(this.config,"resizeDelay"))})}}_scroll(){if(this.canScroll){let t;this.canScroll=!1,t=requestAnimationFrame(()=>{this.emitter.emit("SCROLL scroll"),this.canScroll=!0,t=window.cancelAnimationFrame(t)})}}get(t){return this.services.get(t)}set(t,e){return this.services.set(t,e),this}add(t){return this.services.add(t),this}boot(){return this.services.init(),this.services.boot(),this}stop(){return this.services.stop(),this.emitter.clear(),this}on(t,e){return this.emitter.on(t,e,this),this}off(t,e){return this.emitter.off(t,e,this),this}emit(t,...e){return this.emitter.emit(t,...e),this}};var Y=class extends f{install(){var t,e,i,n,s,o;super.install(),this.ignoreURLs=(t=h(this.config,"ignoreURLs"))!=null?t:[],this.prefetchIgnore=(e=h(this.config,"prefetchIgnore"))!=null?e:!1,this.stopOnTransitioning=(i=h(this.config,"stopOnTransitioning"))!=null?i:!1,this.stickyScroll=(n=h(this.config,"stickyScroll"))!=null?n:!1,this.forceOnError=(s=h(this.config,"forceOnError"))!=null?s:!1,this.ignoreHashAction=(o=h(this.config,"ignoreHashAction"))!=null?o:!1}transitionStart(){this.isTransitioning=!0}transitionStop(){this.isTransitioning=!1}init(){this.onHover=this.onHover.bind(this),this.onClick=this.onClick.bind(this),this.onStateChange=this.onStateChange.bind(this)}boot(){"scrollRestoration"in window.history&&(window.history.scrollRestoration="manual"),super.boot()}getTransitionName(t){if(!t||!t.getAttribute)return null;let e=t.getAttribute(h(this.config,"transitionAttr",!1));return typeof e=="string"?e:null}validLink(t,e,i){let n=!window.history.pushState,s=!t||!i,o=e.metaKey||e.ctrlKey||e.shiftKey||e.altKey,l=t.hasAttribute("target")&&t.target==="_blank",a=t.protocol!==location.protocol||t.hostname!==location.hostname,p=typeof t.getAttribute("download")=="string",m=t.matches(h(this.config,"preventSelfAttr")),E=Boolean(t.closest(h(this.config,"preventAllAttr"))),g=A(u())===A(u(i));return!(s||n||o||l||a||p||m||E||g)}getHref(t){return t&&t.tagName&&t.tagName.toLowerCase()==="a"&&typeof t.href=="string"?t.href:null}getLink(t){let e=t.target,i=this.getHref(e);for(;e&&!i;)e=e.parentNode,i=this.getHref(e);if(!(!e||!this.validLink(e,t,i)))return e}onClick(t){let e=this.getLink(t);if(!e)return;if(this.isTransitioning&&this.stopOnTransitioning){t.preventDefault(),t.stopPropagation();return}let i=this.getHref(e);this.emitter.emit("ANCHOR_CLICK CLICK",t),this.go({href:i,trigger:e,event:t})}getDirection(t){return Math.abs(t)>1?t>0?"forward":"back":t===0?"popstate":t>0?"back":"forward"}force(t){window.location.assign(t)}go({href:t,trigger:e="HistoryManager",event:i}){if(this.isTransitioning&&this.stopOnTransitioning||!(this.manager.has("TransitionManager")&&this.manager.has("HistoryManager")&&this.manager.has("PageManager"))){this.force(t);return}let n=this.manager.get("HistoryManager"),s=w(0,0),o=n.current,l=o.url;if(N(l,t))return;let a;if(i&&i.state){this.emitter.emit("POPSTATE",i);let{state:p}=i,{index:m}=p,g=o.index-m;n.replace(p.states),n.pointer=m;let O=n.get(m);a=O.transition,s=O.data.scroll,e=this.getDirection(g),console.log(e=="forward"&&n),this.emitter.emit(e==="back"?"POPSTATE_BACK":"POPSTATE_FORWARD",i)}else{a=this.getTransitionName(e),s=w();let p=D({url:t,transition:a,data:{scroll:s}});!this.stickyScroll&&(s=w(0,0)),n.add(p),this.emitter.emit("HISTORY_NEW_ITEM",i)}return i&&(i.stopPropagation(),i.preventDefault()),this.emitter.emit("GO",i),this.load({oldHref:l,href:t,trigger:e,transitionName:a,scroll:s})}async load({oldHref:t,href:e,trigger:i,transitionName:n="default",scroll:s={x:0,y:0}}){try{let o=this.manager.get("PageManager"),l,a;this.emitter.emit("NAVIGATION_START",{oldHref:t,href:e,trigger:i,transitionName:n});try{this.transitionStart(),a=await o.load(t),!(a.dom instanceof Element)&&a.build(),this.emitter.emit("PAGE_LOADING",{href:e,oldPage:a,trigger:i}),l=await o.load(e),await l.build(),this.emitter.emit("PAGE_LOAD_COMPLETE",{newPage:l,oldPage:a,trigger:i})}catch(p){console.warn(`[PJAX] Page load error: ${p}`)}try{let p=this.manager.get("TransitionManager");this.emitter.emit("TRANSITION_START",n);let m=await p.animate(p.has(n)?n:"default",{oldPage:a,newPage:l,trigger:i,scroll:s,ignoreHashAction:this.ignoreHashAction});m.scrollable||(!this.ignoreHashAction&&!/back|popstate|forward/.test(i)&&(s=$(s)),window.scroll(s.x,s.y)),this.emitter.emit("TRANSITION_END",{transition:m})}catch(p){console.warn(`[PJAX] Transition error: ${p}`)}this.emitter.emit("NAVIGATION_END",{oldPage:a,newPage:l,trigger:i,transitionName:n})}catch(o){this.forceOnError?this.force(e):console.warn(o)}finally{this.transitionStop()}}ignoredURL({pathname:t}){return this.ignoreURLs.length&&this.ignoreURLs.some(e=>typeof e=="string"?e===t:e.exec(t)!==null)}onHover(t){let e=this.getLink(t);if(!e||!this.manager.has("PageManager"))return;let i=this.manager.get("PageManager"),n=u(this.getHref(e)),s=n.pathname;if(!(this.ignoredURL(n)||i.has(s))){this.emitter.emit("ANCHOR_HOVER HOVER",t);try{i.load(n)}catch(o){console.warn("[PJAX] prefetch error,",o)}}}onStateChange(t){this.go({href:window.location.href,trigger:"popstate",event:t})}initEvents(){this.prefetchIgnore!==!0&&(document.addEventListener("mouseover",this.onHover),document.addEventListener("touchstart",this.onHover)),document.addEventListener("click",this.onClick),window.addEventListener("popstate",this.onStateChange)}stopEvents(){this.prefetchIgnore!==!0&&(document.removeEventListener("mouseover",this.onHover),document.removeEventListener("touchstart",this.onHover)),document.removeEventListener("click",this.onClick),window.removeEventListener("popstate",this.onStateChange)}};var J=class extends f{constructor(t=[]){super();this.routes=new d;for(let e of t)this.add(e)}add({path:t,method:e}){let i=this.parse(t);return this.routes.set(i,e),this}parsePath(t){if(typeof t=="string")return new RegExp(t,"i");if(t instanceof RegExp||typeof t=="boolean")return t;throw"[Router] only regular expressions, strings and booleans are accepted as paths."}isPath(t){return typeof t=="string"||t instanceof RegExp||typeof t=="boolean"}parse(t){let e=t,i={from:/(.*)/g,to:/(.*)/g};if(this.isPath(t))i={from:!0,to:t};else if(this.isPath(e.from)&&this.isPath(e.to))i=e;else throw"[Router] path is neither a string, regular expression, or a { from, to } object.";let{from:n,to:s}=i;return{from:this.parsePath(n),to:this.parsePath(s)}}route(){if(this.manager.has("HistoryManager")){let t=this.manager.get("HistoryManager"),e=A(u((t.length>1?t.previous:t.current).url)),i=A(u());this.routes.forEach((n,s)=>{let o=s.from,l=s.to;if(typeof o=="boolean"&&typeof l=="boolean")throw`[Router] path ({ from: ${o}, to: ${l} }) is not valid, remember paths can only be strings, regular expressions, or a boolean; however, both the from and to paths cannot be both booleans.`;let a=o,p=l;o instanceof RegExp&&o.test(e)&&(a=o.exec(e)),l instanceof RegExp&&l.test(i)&&(p=l.exec(i)),(Array.isArray(p)&&Array.isArray(a)||Array.isArray(p)&&typeof a=="boolean"&&a||Array.isArray(a)&&typeof p=="boolean"&&p)&&n({from:a,to:p,path:{from:e,to:i}})})}else console.warn("[Route] HistoryManager is missing.")}initEvents(){this.emitter.on("READY",this.route,this),this.emitter.on("CONTENT_REPLACED",this.route,this)}stopEvents(){this.emitter.off("READY",this.route,this),this.emitter.off("CONTENT_REPLACED",this.route,this)}};var Rt=r=>typeof r=="string"?Array.from(document.querySelectorAll(r)):[r],Ot=r=>[].concat(...r),ct=r=>Array.isArray(r)?Ot(r.map(ct)):typeof r=="string"||r instanceof Node?Rt(r):r instanceof NodeList||r instanceof HTMLCollection?Array.from(r):[],ht=(r,t,e)=>typeof r=="function"?r.apply(e,t):r,ut=(r,t,e)=>{let i,n,s={},o=Object.keys(r);for(let l=0,a=o.length;l/^(in|out)/.test(r)?Ct[r]:r,mt={keyframes:[],loop:1,delay:0,speed:1,endDelay:0,easing:"ease",autoplay:!0,duration:1e3,fillMode:"auto",direction:"normal",extend:{}},_=class{constructor(t={}){this.options={};this.targets=[];this.properties={};this.animations=new d;this.totalDuration=0;this.minDelay=0;this.computedOptions=new d;this.emitter=new k;var i;try{let e=t,{options:s}=e,o=q(e,["options"]),l=s instanceof _?s.getOptions():Array.isArray(s)?(i=s==null?void 0:s[0])==null?void 0:i.getOptions():s;this.options=Object.assign({},mt,l,o),this.loop=this.loop.bind(this);let n=this.options,{loop:a,delay:p,speed:m,easing:E,endDelay:g,duration:O,direction:yt,fillMode:At,onfinish:et,target:Et,keyframes:vt,autoplay:wt,extend:It}=n,Tt=q(n,["loop","delay","speed","easing","endDelay","duration","direction","fillMode","onfinish","target","keyframes","autoplay","extend"]);this.mainElement=document.createElement("div"),this.targets=ct(Et),this.properties=Tt;let it=[],x=this.targets.length,C;for(let v=0;v0||(C=ut(C,[v,x,I],this));let rt=y.delay+y.duration*y.iterations+y.endDelay;this.totalDuration{typeof et=="function"&&et.call(this,I,v,x,L),this.emit("finish",I,v,x,L)},this.computedOptions.set(L,y),this.animations.set(I,L),it.push(y.delay)}this.mainAnimation=this.mainElement.animate([{opacity:"0"},{opacity:"1"}],{duration:this.totalDuration,easing:"linear"}),this.minDelay=Math.min(...it),this.setSpeed(m),wt?this.play():this.pause(),this.promise=this.newPromise(),this.mainAnimation.onfinish=()=>{this.emit("complete",this),this.stopLoop()}}catch(s){this.emit("error",s)}}newPromise(){return new Promise((t,e)=>{this.on("complete",()=>t([this])),this.on("error",i=>e(i))})}then(t,e){return t=t==null?void 0:t.bind(this),e=e==null?void 0:e.bind(this),this.promise.then(t,e),this}catch(t){return t=t==null?void 0:t.bind(this),this.promise.catch(t),this}finally(t){return t=t==null?void 0:t.bind(this),this.promise.finally(t),this}loop(){this.stopLoop(),this.emit("update",this.getProgress(),this),this.animationFrame=window.requestAnimationFrame(this.loop)}stopLoop(){window.cancelAnimationFrame(this.animationFrame)}all(t){return t(this.mainAnimation,this.mainElement),this.animations.forEach(t),this}beginEvent(){if(this.getProgress()==0){let t=window.setTimeout(()=>{this.emit("begin",this),t=window.clearTimeout(t)},this.minDelay)}}play(){let t=this.getPlayState();return this.beginEvent(),this.all(e=>e.play()),this.emit("play",t,this),this.loop(),this}pause(){let t=this.getPlayState();return this.all(e=>e.pause()),this.emit("pause",t,this),this.stopLoop(),this.animationFrame=void 0,this}reset(){return this.setProgress(0),this.beginEvent(),this.options.autoplay?this.play():this.pause(),this}cancel(){return this.all(t=>t.cancel()),this.stopLoop(),this}finish(){return this.all(t=>t.finish()),this.stopLoop(),this}stop(){for(this.cancel(),this.animations.clear();this.targets.length;)this.targets.pop();this.mainElement=void 0,this.emit("stop")}getTargets(){return this.targets}getAnimation(t){return this.animations.get(t)}getTiming(t){var o,l,a;let e=t instanceof Animation?t:this.getAnimation(t),i=(o=this.computedOptions.get(e))!=null?o:{},n=(a=(l=e.effect)==null?void 0:l.getTiming())!=null?a:{},s=this.getOptions();return c(c(c(c({},mt),s),n),i)}getTotalDuration(){return this.totalDuration}getCurrentTime(){return this.mainAnimation.currentTime}getProgress(){return this.getCurrentTime()/this.totalDuration*100}getSpeed(){return this.mainAnimation.playbackRate}getPlayState(){return this.mainAnimation.playState}getOptions(){return this.options}setCurrentTime(t){return this.all(e=>{e.currentTime=t}),this.emit("update",this.getProgress()),this}setProgress(t){let e=t/100*this.totalDuration;return this.setCurrentTime(e),this}setSpeed(t=1){return this.all(e=>{e.playbackRate=t}),this}on(t,e,i){return this.emitter.on(t,e,i!=null?i:this),this}off(t,e,i){return this.emitter.off(t,e,i!=null?i:this),this}emit(t,...e){return this.emitter.emit(t,...e),this}toJSON(){return this.getOptions()}get[Symbol.toStringTag](){return"Animate"}},b=(r={})=>new _(r);var R=r=>Array.from(r),z=R;var Z=class extends f{init(){super.init(),this.elements=z(document.querySelectorAll(".intro-animation"))}newPage(){this.init(),this.prepareToShow()}initEvents(){this.emitter.on("CONTENT_REPLACED",this.newPage,this),this.emitter.on("BEFORE_TRANSITION_IN",this.show,this)}stopEvents(){this.emitter.off("CONTENT_REPLACED",this.newPage,this),this.emitter.off("BEFORE_TRANSITION_IN",this.show,this)}stop(){requestAnimationFrame(()=>{for(let t of this.elements)t.style.opacity="1"}),super.stop()}prepareToShow(){requestAnimationFrame(()=>{for(let t of this.elements)t.style.opacity="0"})}async show(){let[t]=await b({target:this.elements,opacity:[0,1],delay(e){return 300*(e+1)},onfinish(e){requestAnimationFrame(()=>{e.style.opacity="1"})},easing:"ease",duration:850});return t.stop(),t}};var gt={name:"default",duration:500,scrollable:!0,out({from:r}){let{duration:t}=this,e=r.wrapper;return b({target:e,opacity:[1,0],duration:t}).on("finish",function(){this.stop()})},in({to:r,scroll:t}){let{duration:e}=this,i=r.wrapper;return window.scroll(t.x,t.y),b({target:i,opacity:[0,1],duration:e}).then(function(){this.stop()})}};var dt={name:"big",delay:200,durationPerAnimation:700,scrollable:!0,init(){this.mainElement=document.getElementById("big-transition"),this.logoElement=this.mainElement.querySelector(".logo"),this.horizontalElements=z(this.mainElement.querySelectorAll("#big-transition-horizontal div")),this.maxLength=this.horizontalElements.length},out({from:r,scroll:t}){let{durationPerAnimation:e,delay:i}=this,n=r.wrapper;window.scroll(t.x,t.y);let s=Object.assign({},n.style);return new Promise(async o=>{this.mainElement.style.opacity="1",this.mainElement.style.visibility="visible",b({target:n,opacity:[1,0],duration:e,onfinish(g){g.style.opacity="0"}}).then(function(){this.stop()});let[a]=await b({target:this.horizontalElements,keyframes:[{transform:"scaleX(0)"},{transform:"scaleX(1)"}],delay(g){return i*(g+1)},onfinish(g){g.style.transform="scaleX(1)"},easing:"out-cubic",duration:500});n.style.opacity="1",Object.assign(n.style,s),this.logoElement.style.visibility="visible";let p=500,[m]=await b({target:this.logoElement,opacity:[0,1],duration:p,onfinish(g){g.style.opacity="1"}}),[E]=await b({options:m,opacity:[1,0],onfinish(g){g.style.opacity="0"},delay:1500});this.logoElement.style.visibility="hidden",m.stop(),E.stop(),o()})},in({to:r,scroll:t}){let{durationPerAnimation:e,delay:i}=this,n=r.wrapper;return window.scroll(t.x,t.y),new Promise(async s=>{let o=b({target:n,opacity:[0,1],duration:e}).then(()=>{o.stop()}),[l]=await b({target:this.horizontalElements,keyframes:[{transform:"scaleX(1)"},{transform:"scaleX(0)"}],delay(a){return i*(a+1)},onfinish(a){a.style.transform="scaleX(0)"},easing:"out-cubic",duration:500});this.mainElement.style.opacity="0",this.mainElement.style.visibility="hidden",l.stop(),s()})}};var K={name:"slide",duration:500,direction:"right",scrollable:!0,init(r){let t=r.trigger;t instanceof Node&&t.hasAttribute("data-direction")?this.direction=t.getAttribute("data-direction"):this.direction="right"},out({from:r}){let{duration:t,direction:e}=this,i=r.wrapper;return b({target:i,keyframes:[{transform:"translateX(0%)",opacity:1},{transform:`translateX(${e==="left"?"-":""}25%)`,opacity:0}],duration:t,easing:"in-quint"}).then(function(){this.stop()})},in({to:r,scroll:t}){let{duration:e}=this,i=r.wrapper;return window.scroll(t.x,t.y),b({target:i,keyframes:[{transform:`translateX(${this.direction==="right"?"-":""}25%)`,opacity:0},{transform:"translateX(0%)",opacity:1}],duration:e,easing:"out-quint"}).then(function(){this.stop()})}},ft=c(c({},K),{name:"slide-left",direction:"left",init(r){}}),bt=c(c({},K),{name:"slide-right",direction:"right",init(r){}});var Q=class extends f{init(){this.navbar=document.querySelector(".navbar"),this.collapseSection=this.navbar.querySelector(".navbar-collapse.mobile"),this.navbarList=this.navbar.querySelector(".navbar-list"),this.elements=R(this.navbar.querySelectorAll(".navbar-list a")),this.menu=this.navbar.querySelector(".navbar-toggle"),this.toggleStatus=!1,this.toggleClick=this.toggleClick.bind(this)}activateLink(){let{href:t}=window.location;for(let e of this.elements){let i=e.getAttribute("data-path")||e.href;if(!i||i.length<1)return;let n=new RegExp(i).test(t),s=e.classList.contains("active");n&&s||e.classList.toggle("active",n)}}toggleClick(){var t,e;(e=(t=this.collapseSection.style)==null?void 0:t.setProperty)==null||e.call(t,"--height",`${this.navbarList.clientHeight}px`),this.toggleStatus=!this.toggleStatus,this.collapseSection.classList.toggle("collapse",!this.toggleStatus),this.collapseSection.classList.toggle("show",this.toggleStatus)}scroll(){this.navbar.classList.toggle("shadow",window.scrollY>=5)}initEvents(){this.menu.addEventListener("click",this.toggleClick),this.emitter.on("scroll",this.scroll,this),this.emitter.on("READY",this.activateLink,this),this.emitter.on("GO",this.activateLink,this)}stopEvents(){this.navbar.removeEventListener("click",this.toggleClick),this.emitter.off("scroll",this.scroll,this),this.emitter.off("READY",this.activateLink,this),this.emitter.off("GO",this.activateLink,this)}uninstall(){for(;this.elements.length;)this.elements.pop();this.elements=void 0,this.menu=void 0,this.navbar=void 0}};var F,Nt,tt=new W;tt.add(new Z).set("HistoryManager",new V).set("PageManager",new X).set("TransitionManager",new B([["default",gt],["BigTransition",dt],["Slide",K],["SlideLeft",ft],["SlideRight",bt]])).add(new Q).set("router",F=new J).add(Nt=new Y);try{F=tt.get("router");let r=R(document.querySelectorAll(".navbar .nav-link"));for(let t of r){let e=t;F.add({path:e.getAttribute("data-path")||e.pathname,method(){e.classList.contains("active")||e.classList.add("active");for(let n of r)n!==e&&n.classList.remove("active")}})}F.add({path:/(index|\/$)(\.html)?/,method(){}}),tt.boot()}catch(r){console.warn("[App] boot failed,",r)} //# sourceMappingURL=main.js.map diff --git a/demo/js/main.js.map b/demo/js/main.js.map index b994d4c..d05f20b 100644 --- a/demo/js/main.js.map +++ b/demo/js/main.js.map @@ -1,7 +1,7 @@ { "version": 3, - "sources": ["packages/native/src/config.ts", "packages/manager/src/api.ts", "packages/native/src/manager.ts", "packages/native/src/url.ts", "packages/native/src/service.ts", "packages/native/src/history.ts", "packages/native/src/page.ts", "packages/emitter/src/api.ts", "packages/native/src/transition.ts", "packages/native/src/app.ts", "packages/native/src/pjax.ts", "packages/native/src/router.ts", "packages/animate/src/api.ts", "build/ts/services/IntroAnimation.ts", "build/ts/transitions/Fade.ts", "build/ts/transitions/BigTransition.ts", "build/ts/transitions/Slide.ts", "build/ts/toArr.ts", "build/ts/services/Navbar.ts", "build/ts/main.ts"], - "sourcesContent": ["export interface ICONFIG {\n prefix?: string;\n wrapperAttr?: string;\n noAjaxLinkAttr?: string;\n noPrefetchAttr?: \"no-prefetch\";\n headers?: string[][];\n preventSelfAttr?: string;\n preventAllAttr?: string;\n transitionAttr?: string;\n blockAttr?: string;\n timeout?: number;\n maxPages?: number;\n [key: string]: any;\n}\n\nexport const CONFIG_DEFAULTS = {\n wrapperAttr: \"wrapper\",\n noAjaxLinkAttr: \"no-ajax-link\",\n noPrefetchAttr: \"no-prefetch\",\n headers: [\n [\"x-partial\", \"true\"]\n ],\n preventSelfAttr: `prevent=\"self\"`,\n preventAllAttr: `prevent=\"all\"`,\n transitionAttr: \"transition\",\n blockAttr: `block`,\n timeout: 30000,\n maxPages: 5\n};\n\nexport type ConfigKeys = keyof typeof CONFIG_DEFAULTS | string;\nexport const newConfig = (config: ICONFIG): ICONFIG => {\n return Object.assign({ ...CONFIG_DEFAULTS }, config);\n};\n\n/** Converts string into properly formatted data attributes */\nexport const toAttr = (config: ICONFIG, value: string, brackets: boolean = true): string => {\n let { prefix } = config;\n let attr = `data${prefix ? \"-\" + prefix : \"\"}-${value}`;\n return brackets ? `[${attr}]` : attr;\n};\n\n/** Selects config vars, and formats them for use, or simply returns the current configurations for the framework */\nexport const getConfig = (config: ICONFIG, value?: ConfigKeys, brackets: boolean = true): any => {\n if (typeof value !== \"string\")\n return config;\n\n let prop = config[value];\n if (typeof prop === \"string\")\n return toAttr(config, prop, brackets);\n return prop;\n};\n", "/** Manages complex lists of named data, eg. A page can be stored in a list by of other pages with the url being how the page is stored in the list. Managers use Maps to store data */\nexport class Manager {\n\t/** The complex list of named data, to which the Manager controls */\n\tpublic map: Map;\n\tconstructor(value?: Array<[K, V]>) {\n\t\tthis.map = new Map(value);\n\t}\n\n\t/** Returns the Manager classes base Map */\n\tpublic getMap(): Map {\n\t\treturn this.map;\n\t}\n\n\t/** Get a value stored in the Manager */\n\tpublic get(key: K): V {\n\t\treturn this.map.get(key);\n\t}\n\n\t/** Returns the keys of all items stored in the Manager as an Array */\n\tpublic keys(): Array {\n\t\treturn Array.from(this.map.keys());\n\t}\n\n\t/** Returns the values of all items stored in the Manager as an Array */\n\tpublic values(): Array {\n\t\treturn Array.from(this.map.values());\n\t}\n\n\t/** Set a value to the Manager using a key */\n\tpublic set(key: K, value: V): Manager {\n\t\tthis.map.set(key, value);\n\t\treturn this;\n\t}\n\n\t/** Adds a value to Manager, and uses the current size of the Manager as it's key, it works best when all the key in the Manager are numbers */\n\tpublic add(value: V): Manager {\n\t\tlet size = this.size;\n\t\t// @ts-ignore\n\t\tlet num: K = size as K;\n\t\tthis.set(num, value);\n\t\treturn this;\n\t}\n\n\t/** Returns the total number of items stored in the Manager */\n\tpublic get size(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** An alias for size */\n\tpublic get length(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** Returns the last item in the Manager who's index is a certain distance from the last item in the Manager */\n\tpublic last(distance: number = 1): V | undefined {\n\t\tlet key = this.keys()[this.size - distance];\n\t\treturn this.get(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns true if an element in the Map object existed and has been removed, or false if the element does not exist */\n\tpublic delete(key: K): boolean {\n\t\treturn this.map.delete(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns the Manager class, allowing for chains */\n\tpublic remove(key: K): Manager {\n\t\tthis.map.delete(key);\n\t\treturn this;\n\t}\n\n\t/** Clear the Manager of all its contents */\n\tpublic clear(): Manager {\n\t\tthis.map.clear();\n\t\treturn this;\n\t}\n\n\t/** Checks if the Manager contains a certain key */\n\tpublic has(key: K): boolean {\n\t\treturn this.map.has(key);\n\t}\n\n\t/** Returns a new Iterator object that contains an array of [key, value] for each element in the Map object in insertion order. */\n\tpublic entries(): IterableIterator<[K, V]> {\n\t\treturn this.map.entries();\n\t}\n\n\t/** Iterates through the Managers contents, calling a callback function every iteration */\n\tpublic forEach(\n\t\tcallback: (value?: V, key?: K, map?: Map) => void,\n\t\tcontext?: object\n\t): Manager {\n\t\tthis.map.forEach(callback, context);\n\t\treturn this;\n\t}\n\n\t/** Allows for iteration via for..of, learn more: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators] */\n\tpublic [Symbol.iterator](): IterableIterator<[K, V]> {\n\t\treturn this.entries();\n\t}\n}\n\n/**\n * Calls the method of a certain name for all items that are currently installed\n */\nexport const methodCall = (manager: Manager, method: string, ...args: any): void => {\n\tmanager.forEach((item) => {\n\t\t// @ts-ignore\n\t\titem[method](...args);\n\t});\n};\n\n/**\n * Asynchronously calls the method of a certain name for all items that are currently installed, similar to methodCall\n */\nexport const asyncMethodCall = async (manager: Manager, method: string, ...args: any): Promise => {\n\tfor (let [, item] of manager) {\n\t\t// @ts-ignore\n\t\tawait item[method](...args);\n\t}\n};\n\nexport default Manager;\n", "import { Manager, methodCall, asyncMethodCall } from \"@okikio/manager\";\nimport { ICONFIG } from \"./config\";\nimport { IApp } from \"./app\";\nimport { EventEmitter } from \"./emitter\";\n\nexport type IAdvancedManager = AdvancedManager;\n\n/** The base class for AdvancedManager items */\nexport class ManagerItem {\n /** The AdvancedManager the ManagerItem is attached to */\n public manager: IAdvancedManager;\n\n /** The App the ManagerItem is attached to */\n public app: IApp;\n\n /** The Config of the App the ManagerItem is attached to */\n public config: ICONFIG;\n\n /** The EventEmitter of the App the ManagerItem is attached to */\n public emitter: EventEmitter;\n\n /** The key to where ManagerItem is stored in an AdvancedManager */\n public key: any;\n\n constructor() { }\n\n /** Run after the Manager Item has been registered */\n public install(): any { }\n\n /** Register the current Manager Item's manager */\n public register(manager: IAdvancedManager, key: any): ManagerItem {\n this.manager = manager;\n this.app = manager.app;\n this.config = manager.config;\n this.emitter = manager.emitter;\n this.key = key;\n this.install();\n return this;\n }\n\n /** Run before the ManagerItem has been unregistered */\n public uninstall(): any { }\n\n /** Basically removes a ManagerItem, in order to recover the ManagerItem, it needs to be re-added to an AdvancedManager */\n public unregister() {\n this.uninstall();\n\n this.manager.remove(this.key);\n this.key = undefined;\n this.manager = undefined;\n this.app = undefined;\n this.config = undefined;\n this.emitter = undefined;\n }\n}\n\n/** A tweak to the Manager class that makes it self aware of the App class it's instantiated in */\nexport class AdvancedManager extends Manager {\n /** The App the AdvancedManager is attached to */\n public app: IApp;\n\n /** The Config of the App the AdvancedManager is attached to */\n public config: ICONFIG;\n\n /** The EventEmitter of the App the AdvancedManager is attached to */\n public emitter: EventEmitter;\n\n /** Register App details */\n constructor(app: IApp) {\n super();\n this.app = app;\n this.config = app.config;\n this.emitter = app.emitter;\n }\n\n /** Add a ManagerItem to AdvancedManager at a specified key */\n public set(key: K, value: V) {\n super.set(key, value);\n value.register(this, key);\n return this;\n }\n}\n\nexport { Manager, methodCall, asyncMethodCall };\n", "export const newURL = (url: string | URL | Location = window.location.href): URL => {\n return url instanceof URL ? url : new URL(url as unknown as string, window.location.origin);\n};\n\n/** Returns the pathname with the hash at the end */\nexport const getHashedPath = (url: URL | string): string => {\n let _url = newURL(url);\n return `${_url.pathname}${_url.hash}`;\n};\n\n/** Returns the actual hash without the hashtag */\nexport const getHash = (url: URL | string): string => newURL(url).hash.slice(1);\n\n/** Removes the hash from the full URL for a clean URL string */\nexport const clean = (url: URL | string): string => newURL(url).toString().replace(/(\\/#.*|\\/|#.*)$/, '');\n\n/** Compares two URLs to each other */\nexport const equal = (a: URL | string, b: URL | string): boolean => (clean(a) === clean(b));\n\n", "import { AdvancedManager, ManagerItem, methodCall } from \"./manager\";\nimport { IApp } from \"./app\";\n\n/** Controls specific kinds of actions that require JS */\nexport class Service extends ManagerItem {\n\t/** Called before the start of a Service, represents a constructor of sorts */\n\tpublic init(...args: any): any;\n\tpublic init(): any { }\n\n\t/** Called on start of Service */\n\tpublic boot(...args: any): any;\n\tpublic boot(): any {\n\t\tthis.initEvents();\n\t}\n\n\t/** Initialize events */\n\tpublic initEvents(): void { }\n\n\t/** Stop events */\n\tpublic stopEvents(): void { }\n\n\t/** Stop services */\n\tpublic stop(): void {\n\t\tthis.stopEvents();\n\t\tthis.unregister();\n\t}\n}\n\n/** The Service Manager controls the lifecycle of all Services in an App */\nexport class ServiceManager extends AdvancedManager {\n\tconstructor(app: IApp) {\n\t\tsuper(app);\n\t}\n\n\t/** Call the init method for all Services */\n\tpublic init(): ServiceManager {\n\t\tmethodCall(this, \"init\");\n\t\treturn this;\n\t}\n\n\t/** Call the boot method for all Services */\n\tpublic boot(): ServiceManager {\n\t\tmethodCall(this, \"boot\");\n\t\treturn this;\n\t}\n\n\t/** Call the stop method for all Services */\n\tpublic stop(): ServiceManager {\n\t\tmethodCall(this, \"stop\");\n\t\treturn this;\n\t}\n}\n", "import { Service } from \"./service\";\nimport { getHashedPath, newURL } from \"./url\";\n\nexport type Trigger = HTMLAnchorElement | \"HistoryManager\" | \"popstate\" | \"back\" | \"forward\";\nexport interface ICoords {\n\treadonly x: number;\n\treadonly y: number;\n}\n\nexport interface IStateData {\n\tscroll: ICoords;\n\t[key: string]: any;\n}\n\nexport interface IState {\n\turl: string;\n\tindex?: number;\n\ttransition: string;\n\tdata: IStateData;\n}\n\nexport interface IHistoryItem {\n\tindex: number;\n\tstates: IState[];\n}\n\nexport interface IHistoryManager extends Service {\n\tstates: IState[],\n\tpointer: number,\n\n\tinit(): any,\n\tget(index: number): IState,\n\tadd(value?: IState, historyAction?: \"replace\" | \"push\"): HistoryManager,\n\tremove(index?: number): HistoryManager,\n\treplace(newStates: IState[]): HistoryManager,\n\tset(i: number, state: IState): IState,\n\tcurrent: IState,\n\tlast: IState,\n\tprevious: IState | null,\n\tlength: number,\n}\n\n/** A quick snapshot of page scroll coordinates */\nexport const newCoords = (x: number = window.scrollX, y: number = window.scrollY): ICoords => ({ x, y });\n\n/** Creates a state; a state represents the current status of the page consisting of properties like: url, transition, and data */\nexport const newState = (state: IState = {\n\turl: getHashedPath(newURL()),\n\tindex: 0,\n\ttransition: \"default\",\n\tdata: {\n\t\tscroll: newCoords(),\n\t\ttrigger: \"HistoryManager\"\n\t}\n}): IState => (state);\n\n/** Keeps a record of the history of the App; it stores only the states of Pages */\nexport class HistoryManager extends Service implements IHistoryManager {\n\tpublic states: IState[];\n\tpublic pointer = -1;\n\n\t/** Initializes the states array, and replace the history pushState data with the states array */\n\tinit() {\n\t\tthis.states = [];\n\n\t\tlet state = newState();\n\t\tthis.add(state, \"replace\");\n\t}\n\n\t/** Get a state based on it's index */\n\tpublic get(index: number) {\n\t\treturn this.states[index];\n\t}\n\n\t/** Add a state to HistoryManager and change the history pushState data based on the historyAction specified */\n\tpublic add(value?: IState, historyAction: \"replace\" | \"push\" = \"push\"): HistoryManager {\n\t\tlet state = newState(value);\n\t\tlet len = this.length;\n\t\tthis.states.push({ ...state });\n\t\tthis.pointer = len;\n\n\t\tlet item: IHistoryItem = {\n\t\t\tindex: this.pointer,\n\t\t\tstates: [...this.states]\n\t\t};\n\t\tchangeState(historyAction, state, item);\n\t\treturn this;\n\t}\n\n\tpublic remove(index?: number) {\n\t\tif (index) {\n\t\t\tthis.states.splice(index, 1);\n\t\t} else {\n\t\t\tthis.states.pop();\n\t\t}\n\n\t\tthis.pointer--;\n\t\treturn this;\n\t}\n\n\t/** Replaces the states array with another states array, this is later used when going back and forward in page history */\n\tpublic replace(newStates: IState[]) {\n\t\tthis.states = newStates;\n\t\treturn this;\n\t}\n\n\t/** Set state by index. */\n\tpublic set(i: number, state: IState) {\n\t\treturn (this.states[i] = state);\n\t}\n\n\t/** Get the current state */\n\tget current(): IState {\n\t\treturn this.get(this.pointer);\n\t}\n\n\t/** Get the last state (top of the history stack). */\n\tget last(): IState {\n\t\treturn this.get(this.length - 1);\n\t}\n\n\t/** Get the previous state. */\n\tget previous(): IState | null {\n\t\treturn this.pointer < 1 ? null : this.get(this.pointer - 1);\n\t}\n\n\tget length() {\n\t\treturn this.states.length;\n\t}\n}\n\n/** Either push or replace history state */\nexport const changeState = (action: \"push\" | \"replace\", state: IState, item: object) => {\n\tlet href = getHashedPath(state.url);\n\tlet args = [item, \"\", href];\n\tif (window.history) {\n\t\tswitch (action) {\n\t\t\tcase \"push\":\n\t\t\t\twindow.history.pushState.apply(window.history, args);\n\t\t\t\tbreak;\n\t\t\tcase \"replace\":\n\t\t\t\twindow.history.replaceState.apply(window.history, args);\n\t\t\t\tbreak;\n\t\t}\n\t}\n};\n", "import { Manager, ManagerItem, AdvancedManager } from \"./manager\";\nimport { equal, newURL } from \"./url\";\nimport { getConfig } from \"./config\";\nimport { Service } from \"./service\";\n\nexport interface IPage extends ManagerItem {\n dom: Document,\n wrapper: HTMLElement,\n title: string,\n head: Element,\n body: Element,\n url: URL,\n data: string,\n wrapperAttr: string,\n\n build(): any,\n install(): void,\n uninstall(): any,\n}\n\n/**\n * Parses strings to DOM\n */\nexport const PARSER: DOMParser = new DOMParser();\n\n/** A page represents the DOM elements that create each page */\nexport class Page extends ManagerItem implements IPage {\n /** Holds the DOM of the current page */\n public dom: Document;\n\n /** Holds the wrapper element to be swapped out of each Page */\n public wrapper: HTMLElement;\n\n /** Holds the title of each page */\n public title: string;\n\n /** Holds the head element of each page */\n public head: Element;\n\n /** Holds the body element of each page */\n public body: Element;\n\n /** The URL of the current page */\n public url: URL;\n\n /** The payload of a page request */\n public data: string;\n\n /** Attr that identifies the wrapper */\n public wrapperAttr: string;\n\n constructor(url: URL = newURL(), dom: string | Document = document) {\n super();\n this.url = url;\n\n if (typeof dom === \"string\") {\n this.data = dom;\n } else this.dom = dom || document;\n }\n\n /** Builds the page's dom, and sets the title, head, body, and wrapper properties of the Page class */\n public build() {\n if (!(this.dom instanceof Node)) {\n this.dom = PARSER.parseFromString(this.data, \"text/html\");\n }\n\n if (!(this.body instanceof Node)) {\n let { title, head, body } = this.dom;\n this.title = title;\n this.head = head;\n this.body = body;\n this.wrapper = this.body.querySelector(this.wrapperAttr);\n }\n }\n\n public install() {\n this.wrapperAttr = getConfig(this.config, \"wrapperAttr\");\n }\n\n public uninstall() {\n this.url = undefined;\n this.title = undefined;\n this.head = undefined;\n this.body = undefined;\n this.dom = undefined;\n this.wrapper = undefined;\n this.data = undefined;\n this.wrapperAttr = undefined;\n }\n}\n\nexport interface IPageManager extends Service {\n loading: Manager>,\n pages: AdvancedManager;\n\n install(): any,\n\n get(key): Page,\n add(value): PageManager,\n set(key, value): PageManager,\n remove(key): PageManager,\n has(key): boolean,\n clear(): PageManager,\n size: number,\n keys(): any[],\n\n load(_url: URL | string): Promise,\n request(url: string): Promise,\n}\n\n/** Controls which page to load */\nexport class PageManager extends Service implements IPageManager {\n /** Stores all fetch requests that are currently loading */\n public loading: Manager> = new Manager();\n\n pages: AdvancedManager;\n\n /** Instantiate pages, and add the current page to pages */\n install() {\n this.pages = new AdvancedManager(this.app);\n\n let URLString = newURL().pathname;\n this.set(URLString, new Page());\n URLString = undefined;\n }\n\n get(key) { return this.pages.get(key); }\n add(value) { this.pages.add(value); return this; }\n set(key, value) { this.pages.set(key, value); return this; }\n remove(key) { this.pages.remove(key); return this; }\n has(key) { return this.pages.has(key); }\n clear() { this.pages.clear(); return this; }\n get size() { return this.pages.size; }\n keys() { return this.pages.keys(); }\n\n /** Load from cache or by requesting URL via a fetch request, avoid requesting for the same thing twice by storing the fetch request in \"this.loading\" */\n public async load(_url: URL | string = newURL()): Promise {\n let url: URL = newURL(_url);\n let urlString: string = url.pathname;\n let page: Page, request: Promise;\n\n if (this.has(urlString)) {\n page = this.get(urlString);\n return Promise.resolve(page);\n }\n\n if (!this.loading.has(urlString)) {\n request = this.request(urlString);\n this.loading.set(urlString, request);\n } else request = this.loading.get(urlString);\n\n let response = await request;\n this.loading.remove(urlString);\n\n page = new Page(url, response);\n this.set(urlString, page);\n\n if (this.size > getConfig(this.config, \"maxPages\")) {\n let currentUrl = newURL();\n let keys = this.keys();\n let first = equal(currentUrl, keys[0]) ? keys[1] : keys[0];\n let page = this.get(first);\n page.unregister();\n page = undefined;\n keys = undefined;\n currentUrl = undefined;\n first = undefined;\n }\n\n return page;\n }\n\n /** Starts a fetch request */\n public async request(url: string): Promise {\n const headers = new Headers(getConfig(this.config, \"headers\"));\n const timeout = window.setTimeout(() => {\n window.clearTimeout(timeout);\n throw \"Request Timed Out!\";\n }, getConfig(this.config, \"timeout\"));\n\n try {\n let response = await fetch(url, {\n mode: 'same-origin',\n method: \"GET\",\n headers,\n cache: \"default\",\n credentials: \"same-origin\",\n });\n\n window.clearTimeout(timeout);\n if (response.status >= 200 && response.status < 300) {\n return await response.text();\n }\n\n const err = new Error(response.statusText || \"\" + response.status);\n throw err;\n } catch (err) {\n window.clearTimeout(timeout);\n throw err;\n }\n }\n}\n", "import { Manager, methodCall } from \"@okikio/manager\";\n\nexport type ListenerCallback = ((...args: any) => void);\nexport interface IListener {\n readonly callback: ListenerCallback;\n readonly scope: object;\n readonly name: string;\n}\n\n/** Represents a new event listener consisting of properties like: callback, scope, name */\nexport const newListener = ({\n callback = () => { },\n scope = null,\n name = \"event\",\n}: IListener): IListener => ({ callback, scope, name });\n\n/** Represents a new event */\nexport class Event extends Manager {\n /** The name of the event */\n public name: string;\n constructor(name: string = \"event\") {\n super();\n this.name = name;\n }\n}\n\nexport type EventInput = string | object | Array;\n\n/**\n * An Event Emitter\n * */\nexport class EventEmitter extends Manager {\n constructor() {\n super();\n }\n\n /** Gets event, if event doesn't exist create a new one */\n public getEvent(name: string): Event {\n let event = this.get(name);\n if (!(event instanceof Event)) {\n this.set(name, new Event(name));\n return this.get(name);\n }\n\n return event;\n }\n\n /** Creates a listener and adds it to an event */\n public newListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event = this.getEvent(name);\n event.add(newListener({ name, callback, scope }));\n return event;\n }\n\n /** Adds a listener to a given event */\n public on(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n this.newListener(_name, _callback, _scope);\n }, this);\n return this;\n }\n\n /** Removes a listener from an event */\n public removeListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event: Event = this.get(name);\n if (event instanceof Event && callback) {\n let listener = newListener({ name, callback, scope });\n\n event.forEach((value: IListener, i: number) => {\n if (\n value.callback === listener.callback &&\n value.scope === listener.scope\n ) {\n return event.remove(i);\n }\n });\n }\n\n return event;\n }\n\n /** Remove a listener from a given event, or just completely remove an event */\n public off(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n if (typeof _callback === \"function\") {\n this.removeListener(_name, _callback, _scope);\n } else this.remove(_name);\n }, this);\n return this;\n }\n\n /** Call all listeners within an event */\n public emit(\n events: string | Array,\n ...args: any\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n // Loop through the list of events\n events.forEach((event: string) => {\n let _event: Event = this.get(event);\n\n if (_event instanceof Event) {\n _event.forEach((listener: IListener) => {\n let { callback, scope } = listener;\n callback.apply(scope, args);\n });\n }\n }, this);\n return this;\n }\n\n /** Clears events and event listeners */\n public clear() {\n methodCall(this, \"clear\");\n super.clear();\n return this;\n }\n}\n\nexport default EventEmitter;\n", "import { Manager } from \"./manager\";\nimport { ICoords, newCoords, Trigger } from \"./history\";\nimport { IPage } from \"./page\";\nimport { getConfig } from \"./config\";\nimport { Service } from \"./service\";\nimport { newURL } from \"./url\";\n\n/**\n * The async function type, allows for smooth transition between Promises\n */\nexport type asyncFn = (err?: any, value?: any) => void;\nexport interface ITransition {\n oldPage?: IPage;\n newPage?: IPage;\n trigger?: Trigger;\n scroll?: { x: number; y: number };\n scrollable?: boolean;\n in: (data: ITransitionData) => any;\n out: (data: ITransitionData) => any;\n [key: string]: any;\n}\nexport interface ITransitionData {\n from?: IPage;\n to?: IPage;\n trigger?: Trigger;\n scroll?: ICoords;\n done: asyncFn;\n}\nexport interface ITransitionManager extends Service {\n transitions: Manager,\n\n get(key: string): ITransition,\n set(key: string, value: ITransition): TransitionManager,\n add(value: ITransition): TransitionManager,\n has(key: string): boolean,\n\n boot(): any,\n animate(name: string, data: any): Promise,\n}\n\n/** Auto scrolls to an elements position if the element has an hash */\nexport const hashAction = (coords?: ICoords, hash: string = window.location.hash) => {\n try {\n let _hash = hash[0] == \"#\" ? hash : newURL(hash).hash;\n if (_hash.length > 1) {\n let el = document.getElementById(_hash.slice(1));\n if (el) {\n let { left, top } = el.getBoundingClientRect();\n let scrollLeft = window.pageXOffset;\n let scrollTop = window.pageYOffset;\n let x = left + scrollLeft;\n let y = top + scrollTop;\n\n console.log(x, y);\n return newCoords(x, y);\n }\n }\n } catch (e) {\n console.warn(\"[hashAction] error\", e);\n }\n\n return coords ?? newCoords(0, 0);\n};\n\n// The Default Transition\nconst Default: ITransition = {\n name: \"default\",\n scrollable: true,\n\n out({ done }: ITransitionData) {\n done();\n },\n in({ scroll, done }: ITransitionData) {\n window.scroll(scroll.x, scroll.y);\n done();\n }\n};\n\n/** Controls which Transition between pages to use */\nexport class TransitionManager extends Service implements ITransitionManager {\n transitions: Manager;\n private _arg: Array<[string, ITransition]>;\n constructor(transitions?: Array<[string, ITransition]>) {\n super();\n this._arg = transitions;\n }\n\n /** On Service install set Config */\n public install() {\n super.install();\n\n let transitions = this._arg && this._arg.length ? this._arg : (getConfig(this.config, \"transitions\") ?? []);\n\n // Manager like Maps use the most recent [key, value] Array it knows, replacing the default transition\n // With any other transitions called [\"default\", ...]\n transitions = [[\"default\", Default]].concat(transitions);\n this.transitions = new Manager(transitions);\n }\n\n get(key: string) { return this.transitions.get(key); }\n set(key: string, value: ITransition) { this.transitions.set(key, value); return this; }\n add(value: ITransition) { this.transitions.add(value); return this; }\n has(key: string) { return this.transitions.has(key); }\n\n /** Starts a transition */\n public async animate(name: string, data: any): Promise {\n let transition: ITransition = this.transitions.get(name);\n let scroll = data.scroll;\n let ignoreHashAction = data.ignoreHashAction;\n if (!(\"wrapper\" in data.oldPage) || !(\"wrapper\" in data.newPage))\n throw `[Page] either oldPage or newPage aren't instances of the Page Class.\\n ${{\n newPage: data.newPage,\n oldPage: data.oldPage,\n }}`;\n\n // Replace the title\n document.title = `` + data.newPage.title;\n\n let fromWrapper = data.oldPage.wrapper;\n let toWrapper = data.newPage.wrapper;\n\n if (!(fromWrapper instanceof Node) || !(toWrapper instanceof Node))\n throw `[Wrapper] the wrapper from the ${!(toWrapper instanceof Node) ? \"next\" : \"current\"\n } page cannot be found. The wrapper must be an element that has the attribute ${getConfig(this.config,\n \"wrapperAttr\"\n )}.`;\n\n // Give the Transition all the background data it may require\n transition.init && transition?.init(data);\n\n this.emitter.emit(\"BEFORE_TRANSITION_OUT\");\n\n // Start the out point of the Transition\n if (transition.out) {\n await new Promise((done) => {\n let outMethod: Promise = transition.out.call(transition, {\n ...data,\n from: data.oldPage,\n trigger: data.trigger,\n done,\n });\n\n outMethod?.then(done);\n });\n }\n\n this.emitter.emit(\"AFTER_TRANSITION_OUT\");\n\n // Add the new wrapper before the old one\n await new Promise((done) => {\n fromWrapper.insertAdjacentElement(\"beforebegin\", toWrapper);\n this.emitter.emit(\"CONTENT_INSERT\");\n\n if (!ignoreHashAction && !/back|popstate|forward/.test(data.trigger as string)) {\n scroll = hashAction(scroll);\n }\n done();\n });\n\n // Replace the old wrapper with the new one\n await new Promise((done) => {\n fromWrapper.remove();\n fromWrapper = undefined;\n toWrapper = undefined;\n this.emitter.emit(\"CONTENT_REPLACED\");\n done();\n });\n\n this.emitter.emit(\"BEFORE_TRANSITION_IN\");\n\n // Start the in point of the Transition (only the in method has access to the hashAction's scroll position)\n if (transition.in) {\n await new Promise(async (done) => {\n let inMethod: Promise = transition.in.call(transition, {\n ...data,\n from: data.oldPage,\n to: data.newPage,\n trigger: data.trigger,\n scroll,\n done,\n });\n\n inMethod?.then(done);\n });\n }\n\n this.emitter.emit(\"AFTER_TRANSITION_IN\");\n return transition;\n }\n}\n", "import { EventEmitter, ListenerCallback, EventInput } from \"./emitter\";\nimport { ServiceManager, Service } from \"./service\";\nimport { newConfig, ICONFIG } from \"./config\";\n\nexport interface IApp {\n services: ServiceManager,\n emitter: EventEmitter,\n config: ICONFIG,\n register(config: ICONFIG): App,\n get(key: string): Service,\n set(key: string, service: Service): App,\n add(value: Service): App,\n boot(): App,\n stop(): App,\n on(events: EventInput, callback?: ListenerCallback): App,\n off(events: EventInput, callback?: ListenerCallback): App,\n emit(events: string | any[], ...args: any): App,\n}\n\n/** The App class starts the entire process, it controls all managers and all services */\nexport class App implements IApp {\n /** An instance of the ServiceManager */\n public services: ServiceManager;\n\n /** An instance of an EventEmitter */\n public emitter: EventEmitter;\n\n /** The current Configuration's for the App */\n public config: ICONFIG;\n constructor(config: object = {}) {\n this.register(config);\n }\n\n /** Create new instances of the ServiceManager, EventEmitter and the configurations */\n public register(config: ICONFIG = {}): App {\n this.config = newConfig(config);\n this.emitter = new EventEmitter();\n this.services = new ServiceManager(this);\n\n let handler = (() => {\n document.removeEventListener(\"DOMContentLoaded\", handler);\n window.removeEventListener(\"load\", handler);\n this.emitter.emit(\"READY ready\");\n }).bind(this);\n\n document.addEventListener(\"DOMContentLoaded\", handler);\n window.addEventListener(\"load\", handler);\n return this;\n }\n\n /** Shortcuts to adding, setting, and getting Services */\n public get(key: string): Service {\n return this.services.get(key);\n }\n\n public set(key: string, value: Service): App {\n this.services.set(key, value);\n return this;\n }\n\n public add(value: Service): App {\n this.services.add(value);\n return this;\n }\n\n /** Initialize and boot all Services */\n public boot(): App {\n this.services.init();\n this.services.boot();\n return this;\n }\n\n /** Stops all Services and clears the even emitter of all events and listeners */\n public stop(): App {\n this.services.stop();\n this.emitter.clear();\n return this;\n }\n\n /** Shortcuts to the App EventEmitter on, off, and emit methods */\n public on(events: EventInput, callback?: ListenerCallback): App {\n this.emitter.on(events, callback, this);\n return this;\n }\n\n public off(events: EventInput, callback?: ListenerCallback): App {\n this.emitter.off(events, callback, this);\n return this;\n }\n\n public emit(events: string | any[], ...args: any): App {\n this.emitter.emit(events, ...args);\n return this;\n }\n}\n", "import { newState, Trigger, newCoords, IHistoryItem, IHistoryManager } from \"./history\";\nimport { Service } from \"./service\";\nimport { IPage, IPageManager } from \"./page\";\nimport { newURL, getHashedPath, equal } from \"./url\";\nimport { getConfig } from \"./config\";\nimport { hashAction, ITransitionManager } from \"./transition\";\n\nexport type LinkEvent = MouseEvent | TouchEvent;\nexport type StateEvent = LinkEvent | PopStateEvent;\nexport type IgnoreURLsList = Array;\n/**\n * Creates a barbajs like PJAX Service, for the native framework\n * Based on barbajs and StartingBlocks\n */\nexport class PJAX extends Service {\n /** URLs to ignore when prefetching */\n public ignoreURLs: IgnoreURLsList;\n\n /** Whether or not to disable prefetching */\n public prefetchIgnore: boolean;\n\n /** Current state of transitions */\n public isTransitioning: boolean;\n\n /** Ignore extra clicks of an anchor element if a transition has already started */\n public stopOnTransitioning: boolean;\n\n /** On page change (excluding popstate events) keep current scroll position */\n public stickyScroll: boolean;\n\n /** Force load a page if an error occurs */\n public forceOnError: boolean;\n\n /** Ignore hash action if set to true */\n public ignoreHashAction: boolean;\n\n public install() {\n super.install();\n\n this.ignoreURLs = getConfig(this.config, \"ignoreURLs\") ?? [];\n this.prefetchIgnore = getConfig(this.config, \"prefetchIgnore\") ?? false;\n this.stopOnTransitioning = getConfig(this.config, \"stopOnTransitioning\") ?? false;\n this.stickyScroll = getConfig(this.config, \"stickyScroll\") ?? false;\n this.forceOnError = getConfig(this.config, \"forceOnError\") ?? false;\n this.ignoreHashAction = getConfig(this.config, \"ignoreHashAction\") ?? false\n }\n\n /** Sets the transition state to either true or false */\n public transitionStart() {\n this.isTransitioning = true;\n }\n\n public transitionStop() {\n this.isTransitioning = false;\n }\n\n public init() {\n /**\n * Bind the event listeners to the PJAX class\n *\n * @memberof PJAX\n */\n this.onHover = this.onHover.bind(this);\n this.onClick = this.onClick.bind(this);\n this.onStateChange = this.onStateChange.bind(this);\n }\n\n /** Starts the PJAX Service */\n public boot() {\n if (\"scrollRestoration\" in window.history) {\n // Back off, browser, I got this...\n window.history.scrollRestoration = \"manual\";\n }\n\n super.boot();\n }\n\n /** Gets the transition to use for a certain anchor */\n public getTransitionName(el: HTMLAnchorElement): string | null {\n if (!el || !el.getAttribute) return null;\n let transitionAttr = el.getAttribute(\n getConfig(this.config, \"transitionAttr\", false)\n );\n\n if (typeof transitionAttr === \"string\") return transitionAttr;\n return null;\n }\n\n /** Checks to see if the anchor is valid */\n public validLink(\n el: HTMLAnchorElement,\n event: LinkEvent | KeyboardEvent,\n href: string\n ): boolean {\n let pushStateSupport = !window.history.pushState;\n let exists = !el || !href;\n let eventMutate =\n (event as KeyboardEvent).metaKey ||\n (event as KeyboardEvent).ctrlKey ||\n (event as KeyboardEvent).shiftKey ||\n (event as KeyboardEvent).altKey;\n let newTab =\n el.hasAttribute(\"target\") &&\n (el as HTMLAnchorElement).target === \"_blank\";\n let crossOrigin =\n (el as HTMLAnchorElement).protocol !== location.protocol ||\n (el as HTMLAnchorElement).hostname !== location.hostname;\n let download = typeof el.getAttribute(\"download\") === \"string\";\n let preventSelf = el.matches(getConfig(this.config, \"preventSelfAttr\"));\n let preventAll = Boolean(\n el.closest(getConfig(this.config, \"preventAllAttr\"))\n );\n let sameURL = getHashedPath(newURL()) === getHashedPath(newURL(href));\n return !(\n exists ||\n pushStateSupport ||\n eventMutate ||\n newTab ||\n crossOrigin ||\n download ||\n preventSelf ||\n preventAll ||\n sameURL\n );\n }\n\n /** Returns the href of an Anchor element */\n public getHref(el: HTMLAnchorElement): string | null {\n if (\n el &&\n el.tagName &&\n el.tagName.toLowerCase() === \"a\" &&\n typeof el.href === \"string\"\n )\n return el.href;\n return null;\n }\n\n /** Check if event target is a valid anchor with an href, if so, return the anchor */\n public getLink(event: LinkEvent): HTMLAnchorElement {\n let el = event.target as HTMLAnchorElement;\n let href: string = this.getHref(el);\n\n while (el && !href) {\n el = (el as HTMLElement).parentNode as HTMLAnchorElement;\n href = this.getHref(el);\n }\n\n // Check for a valid link\n if (!el || !this.validLink(el, event, href)) return;\n return el;\n }\n\n /** When an element is clicked, get valid anchor element, go for a transition */\n public onClick(event: LinkEvent) {\n let el = this.getLink(event);\n if (!el) return;\n\n if (this.isTransitioning && this.stopOnTransitioning) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n let href = this.getHref(el);\n this.emitter.emit(\"ANCHOR_CLICK CLICK\", event);\n this.go({ href, trigger: el, event });\n }\n\n /** Returns the direction of the State change as a String, either the Back button or the Forward button */\n public getDirection(value: number): Trigger {\n if (Math.abs(value) > 1) {\n // Ex 6-0 > 0 -> forward, 0-6 < 0 -> back\n return value > 0 ? \"forward\" : \"back\";\n } else {\n if (value === 0) {\n return \"popstate\";\n } else {\n // Ex 6-5 > 0 -> back, 5-6 < 0 -> forward\n return value > 0 ? \"back\" : \"forward\";\n }\n }\n }\n\n /** Force a page to go to a certain URL */\n public force(href: string): void {\n window.location.assign(href);\n }\n\n /**\n * If transition is running force load page.\n * Stop if currentURL is the same as new url.\n * On state change, change the current state history, to reflect the direction of said state change\n * Load page and page transition.\n */\n public go({\n href,\n trigger = \"HistoryManager\",\n event,\n }: {\n href: string;\n trigger?: Trigger;\n event?: StateEvent;\n }): Promise {\n // If transition is already running and the go method is called again, force load page\n if (this.isTransitioning && this.stopOnTransitioning ||\n !(this.manager.has(\"TransitionManager\") &&\n this.manager.has(\"HistoryManager\") &&\n this.manager.has(\"PageManager\"))) {\n this.force(href);\n return;\n }\n\n const history = this.manager.get(\"HistoryManager\") as IHistoryManager;\n let scroll = newCoords(0, 0);\n let currentState = history.current;\n let currentURL = currentState.url;\n if (equal(currentURL, href)) {\n return;\n }\n\n let transitionName: string;\n if (event && (event as PopStateEvent).state) {\n this.emitter.emit(\"POPSTATE\", event);\n\n // If popstate, get back/forward direction.\n let { state }: { state: IHistoryItem } = event as PopStateEvent;\n let { index } = state;\n let currentIndex = currentState.index;\n let difference = currentIndex - index;\n\n history.replace(state.states);\n history.pointer = index;\n\n let _state = history.get(index);\n transitionName = _state.transition;\n scroll = _state.data.scroll;\n\n trigger = this.getDirection(difference);\n console.log(trigger == \"forward\" && history)\n\n // Based on the direction of the state change either remove or add a state\n this.emitter.emit(trigger === \"back\" ? `POPSTATE_BACK` : `POPSTATE_FORWARD`, event);\n } else {\n // Add new state\n transitionName = this.getTransitionName(trigger as HTMLAnchorElement);\n\n scroll = newCoords();\n let state = newState({\n url: href,\n transition: transitionName,\n data: { scroll },\n });\n\n !this.stickyScroll && (scroll = newCoords(0, 0));\n\n history.add(state);\n this.emitter.emit(\"HISTORY_NEW_ITEM\", event);\n }\n\n if (event) {\n event.stopPropagation();\n event.preventDefault();\n }\n\n this.emitter.emit(\"GO\", event);\n return this.load({\n oldHref: currentURL,\n href,\n trigger,\n transitionName,\n scroll,\n });\n }\n\n /** Load the new Page as well as a Transition; starts the Transition */\n public async load({\n oldHref,\n href,\n trigger,\n transitionName = \"default\",\n scroll = { x: 0, y: 0 },\n }: {\n oldHref: string;\n href: string;\n trigger: Trigger;\n transitionName?: string;\n scroll: { x: number; y: number };\n }): Promise {\n try {\n const pages = this.manager.get(\"PageManager\") as IPageManager;\n let newPage: IPage, oldPage: IPage;\n this.emitter.emit(\"NAVIGATION_START\", {\n oldHref,\n href,\n trigger,\n transitionName,\n });\n\n // Load & Build both the old and new pages\n try {\n this.transitionStart();\n oldPage = await pages.load(oldHref);\n !(oldPage.dom instanceof Element) && oldPage.build();\n\n this.emitter.emit(\"PAGE_LOADING\", { href, oldPage, trigger });\n newPage = await pages.load(href);\n await newPage.build();\n this.emitter.emit(\"PAGE_LOAD_COMPLETE\", {\n newPage,\n oldPage,\n trigger,\n });\n } catch (err) {\n console.warn(`[PJAX] Page load error: ${err}`);\n }\n\n // Transition Between Pages\n try {\n const TransitionManager = this.manager.get(\"TransitionManager\") as ITransitionManager;\n this.emitter.emit(\"TRANSITION_START\", transitionName);\n\n let transition = await TransitionManager.animate(TransitionManager.has(transitionName) ? transitionName : \"default\", {\n oldPage,\n newPage,\n trigger,\n scroll,\n ignoreHashAction: this.ignoreHashAction\n });\n\n if (!transition.scrollable) {\n if (!this.ignoreHashAction && !/back|popstate|forward/.test(trigger as string)) scroll = hashAction(scroll);\n window.scroll(scroll.x, scroll.y);\n }\n\n this.emitter.emit(\"TRANSITION_END\", { transition });\n } catch (err) {\n console.warn(`[PJAX] Transition error: ${err}`);\n }\n\n // Navigation is over\n this.emitter.emit(\"NAVIGATION_END\", {\n oldPage,\n newPage,\n trigger,\n transitionName,\n });\n } catch (err) {\n if (this.forceOnError) this.force(href);\n else console.warn(err);\n } finally {\n this.transitionStop(); // Sets isTransitioning to false\n }\n }\n\n /** Check to see if the URL is to be ignored, uses either RegExp of Strings to check */\n public ignoredURL({ pathname }: URL): boolean {\n return (\n this.ignoreURLs.length &&\n this.ignoreURLs.some((url) => {\n return typeof url === \"string\"\n ? url === pathname\n : (url as RegExp).exec(pathname) !== null;\n })\n );\n }\n\n /** When you hover over an anchor, prefetch the event target's href */\n public onHover(event: LinkEvent): Promise {\n let el = this.getLink(event);\n if (!el || !this.manager.has(\"PageManager\")) return;\n\n const pages = this.manager.get(\"PageManager\") as IPageManager;\n let url = newURL(this.getHref(el));\n let urlString: string = url.pathname;\n\n // If Url is ignored or already in cache, don't do any think\n if (this.ignoredURL(url) || pages.has(urlString)) return;\n this.emitter.emit(\"ANCHOR_HOVER HOVER\", event);\n\n try {\n pages.load(url);\n } catch (err) {\n console.warn(\"[PJAX] prefetch error,\", err);\n }\n }\n\n /** When History state changes, get url from State, go for a Transition. */\n public onStateChange(event: PopStateEvent): void {\n this.go({ href: window.location.href, trigger: \"popstate\", event });\n }\n\n /** Initialize DOM Events */\n public initEvents() {\n if (this.prefetchIgnore !== true) {\n document.addEventListener(\"mouseover\", this.onHover);\n document.addEventListener(\"touchstart\", this.onHover);\n }\n\n document.addEventListener(\"click\", this.onClick);\n window.addEventListener(\"popstate\", this.onStateChange);\n }\n\n /** Stop DOM Events */\n public stopEvents() {\n if (this.prefetchIgnore !== true) {\n document.removeEventListener(\"mouseover\", this.onHover);\n document.removeEventListener(\"touchstart\", this.onHover);\n }\n\n document.removeEventListener(\"click\", this.onClick);\n window.removeEventListener(\"popstate\", this.onStateChange);\n }\n}\n", "import { Service } from \"./service\";\nimport { Manager } from \"./manager\";\nimport { newURL, getHashedPath } from \"./url\";\nimport { IHistoryManager } from \"./history\";\n\nexport type RouteMethod = (...args: any) => any;\nexport type RouteStyle = string | RegExp | boolean;\nexport interface IRouteToFrom {\n to: RouteStyle,\n from: RouteStyle\n}\nexport type RoutePath = IRouteToFrom | RouteStyle;\nexport interface IRoute {\n path: RoutePath,\n method: RouteMethod\n}\n\n/** Controls what happens when certain url paths match a set of criteria */\nexport class Router extends Service {\n /** List of routes */\n protected routes: Manager;\n constructor(routes: IRoute[] = []) {\n super();\n this.routes = new Manager();\n for (let route of routes) {\n this.add(route);\n }\n }\n\n /** Add a new route to watch for */\n public add({ path, method }: IRoute): Router {\n let key = this.parse(path);\n this.routes.set(key, method);\n return this;\n }\n\n /** Convert strings into path match functions */\n public parsePath(path: RouteStyle): RegExp | boolean {\n if (typeof path === \"string\") return new RegExp(path, \"i\");\n else if (path instanceof RegExp || typeof path === \"boolean\")\n return path;\n throw \"[Router] only regular expressions, strings and booleans are accepted as paths.\";\n }\n\n /** Determines if a strings counts has a path */\n public isPath(input: RouteStyle): boolean {\n return (\n typeof input === \"string\" ||\n input instanceof RegExp ||\n typeof input === \"boolean\"\n );\n }\n\n /** Parse the multiple different formats for paths, into a { from, to } object */\n public parse(input: RoutePath): IRouteToFrom {\n let route = input as IRouteToFrom;\n let toFromPath: IRouteToFrom = {\n from: /(.*)/g,\n to: /(.*)/g,\n };\n\n if (this.isPath(input as RouteStyle))\n toFromPath = {\n from: true,\n to: input as RouteStyle,\n };\n else if (this.isPath(route.from) && this.isPath(route.to as RouteStyle))\n toFromPath = route;\n else\n throw \"[Router] path is neither a string, regular expression, or a { from, to } object.\";\n\n let { from, to } = toFromPath;\n return {\n from: this.parsePath(from),\n to: this.parsePath(to),\n };\n }\n\n /** Test if route paths are true, if so run their methods */\n public route() {\n if (this.manager.has(\"HistoryManager\")) {\n let history = this.manager.get(\"HistoryManager\") as IHistoryManager;\n let from: string = getHashedPath(newURL((history.length > 1 ? history.previous : history.current).url));\n let to: string = getHashedPath(newURL());\n\n this.routes.forEach((method: RouteMethod, path: IRouteToFrom) => {\n let fromRegExp = path.from as RegExp | boolean;\n let toRegExp = path.to as RegExp | boolean;\n\n if (\n typeof fromRegExp === \"boolean\" &&\n typeof toRegExp === \"boolean\"\n ) {\n throw `[Router] path ({ from: ${fromRegExp}, to: ${toRegExp} }) is not valid, remember paths can only be strings, regular expressions, or a boolean; however, both the from and to paths cannot be both booleans.`;\n }\n\n let fromParam: RegExpExecArray | RegExp | boolean = fromRegExp;\n let toParam: RegExpExecArray | RegExp | boolean = toRegExp;\n\n if (fromRegExp instanceof RegExp && fromRegExp.test(from))\n fromParam = fromRegExp.exec(from);\n if (toRegExp instanceof RegExp && toRegExp.test(to))\n toParam = toRegExp.exec(to);\n\n if (\n (Array.isArray(toParam) && Array.isArray(fromParam)) ||\n (Array.isArray(toParam) &&\n typeof fromParam == \"boolean\" &&\n fromParam) ||\n (Array.isArray(fromParam) &&\n typeof toParam == \"boolean\" &&\n toParam)\n )\n method({ from: fromParam, to: toParam, path: { from, to } });\n });\n } else {\n console.warn(\"[Route] HistoryManager is missing.\");\n }\n }\n\n /** Add listeners for PJAX Events */\n public initEvents() {\n this.emitter.on(\"READY\", this.route, this);\n this.emitter.on(\"CONTENT_REPLACED\", this.route, this);\n }\n\n /** Remove listeners for PJAX Events */\n public stopEvents() {\n this.emitter.off(\"READY\", this.route, this);\n this.emitter.off(\"CONTENT_REPLACED\", this.route, this);\n }\n}\n", "import { EventEmitter, EventInput, ListenerCallback } from \"@okikio/emitter\";\nimport { Manager } from \"@okikio/manager\";\n\n// DOM\nexport type AnimationTarget = string | Node | NodeList | HTMLCollection | HTMLElement[] | AnimationTarget[];\nexport const getElements = (selector: string | Node): Node[] => {\n return typeof selector === \"string\" ? Array.from(document.querySelectorAll(selector as string)) : [selector];\n};\n\nconst flatten = (arr: AnimationTarget[]) => [].concat(...arr);\nexport const getTargets = (targets: AnimationTarget): Node[] => {\n if (Array.isArray(targets)) {\n return flatten((targets as AnimationTarget[]).map(getTargets));\n }\n if (typeof targets == \"string\" || targets instanceof Node)\n return getElements(targets);\n if (targets instanceof NodeList || targets instanceof HTMLCollection)\n return Array.from(targets);\n return [];\n};\n\n// VALUES\nexport type closureArgs = [number, number, HTMLElement];\nexport type closure = ((index?: number, total?: number, element?: HTMLElement) => (genericTypes[] | void)) | any;\nexport const computeValue = (value: closure, args: closureArgs, context: Animate) => {\n if (typeof value === \"function\") {\n return value.apply(context, args);\n } else { return value; }\n};\n\nexport const mapObject = (obj: object, args: closureArgs, options: Animate): any => {\n let key: string, value: any, result = {};\n let keys = Object.keys(obj);\n for (let i = 0, len = keys.length; i < len; i++) {\n key = keys[i];\n value = obj[key];\n result[key] = computeValue(value, args, options);\n }\n\n return result;\n};\n\n/** From: [https://easings.net] */\nexport const easings = {\n \"in\": \"ease-in\",\n \"out\": \"ease-out\",\n \"in-out\": \"ease-in-out\",\n\n // Sine\n \"in-sine\": \"cubic-bezier(0.47, 0, 0.745, 0.715)\",\n \"out-sine\": \"cubic-bezier(0.39, 0.575, 0.565, 1)\",\n \"in-out-sine\": \"cubic-bezier(0.445, 0.05, 0.55, 0.95)\",\n\n // Quad\n \"in-quad\": \"cubic-bezier(0.55, 0.085, 0.68, 0.53)\",\n \"out-quad\": \"cubic-bezier(0.25, 0.46, 0.45, 0.94)\",\n \"in-out-quad\": \"cubic-bezier(0.455, 0.03, 0.515, 0.955)\",\n\n // Cubic\n \"in-cubic\": \"cubic-bezier(0.55, 0.055, 0.675, 0.19)\",\n \"out-cubic\": \"cubic-bezier(0.215, 0.61, 0.355, 1)\",\n \"in-out-cubic\": \"cubic-bezier(0.645, 0.045, 0.355, 1)\",\n\n // Quart\n \"in-quart\": \"cubic-bezier(0.895, 0.03, 0.685, 0.22)\",\n \"out-quart\": \"cubic-bezier(0.165, 0.84, 0.44, 1)\",\n \"in-out-quart\": \"cubic-bezier(0.77, 0, 0.175, 1)\",\n\n // Quint\n \"in-quint\": \"cubic-bezier(0.755, 0.05, 0.855, 0.06)\",\n \"out-quint\": \"cubic-bezier(0.23, 1, 0.32, 1)\",\n \"in-out-quint\": \"cubic-bezier(0.86, 0, 0.07, 1)\",\n\n // Expo\n \"in-expo\": \"cubic-bezier(0.95, 0.05, 0.795, 0.035)\",\n \"out-expo\": \"cubic-bezier(0.19, 1, 0.22, 1)\",\n \"in-out-expo\": \"cubic-bezier(1, 0, 0, 1)\",\n\n // Circ\n \"in-circ\": \"cubic-bezier(0.6, 0.04, 0.98, 0.335)\",\n \"out-circ\": \"cubic-bezier(0.075, 0.82, 0.165, 1)\",\n \"in-out-circ\": \"cubic-bezier(0.785, 0.135, 0.15, 0.86)\",\n\n // Back\n \"in-back\": \"cubic-bezier(0.6, -0.28, 0.735, 0.045)\",\n \"out-back\": \"cubic-bezier(0.175, 0.885, 0.32, 1.275)\",\n \"in-out-back\": \"cubic-bezier(0.68, -0.55, 0.265, 1.55)\"\n};\n\nexport const getEase = (ease: string) => {\n return /^(in|out)/.test(ease) ? easings[ease] : ease;\n};\n\nexport type genericTypes = genericTypes[] | boolean | object | string | number | closure | null | undefined;\nexport interface AnimationOptions {\n target?: AnimationTarget,\n\n speed?: number,\n autoplay?: boolean,\n options?: AnimationOptions,\n delay?: number | closure,\n easing?: string | closure,\n endDelay?: number | closure,\n duration?: number | closure,\n keyframes?: Keyframe[] | object[] | closure,\n loop?: number | boolean | closure, // iterations: number,\n onfinish?: (element?: HTMLElement, index?: number, total?: number, animation?: Animation) => any,\n fillMode?: \"none\" | \"forwards\" | \"backwards\" | \"both\" | \"auto\" | closure,\n direction?: \"normal\" | \"reverse\" | \"alternate\" | \"alternate-reverse\" | closure,\n extend?: EffectTiming,\n [property: string]: genericTypes;\n};\n\nexport const DefaultAnimationOptions: AnimationOptions = {\n keyframes: [],\n\n loop: 1, // iterations: number,\n delay: 0,\n speed: 1,\n endDelay: 0,\n easing: \"ease\",\n autoplay: true,\n duration: 1000,\n fillMode: \"auto\",\n direction: \"normal\",\n extend: {}\n};\n\nexport type AnimationEvents = \"update\" | \"play\" | \"pause\" | \"start\" | \"begin\" | \"complete\" | \"finish\" | \"error\" | \"stop\";\n\n/** You can check it out here: https://codepen.io/okikio/pen/qBbdGaW?editors=0011 */\nexport class Animate {\n /**\n * Stores the options for the current animation\n */\n public options: AnimationOptions = {};\n\n /**\n * The Array of Elements to Animate\n */\n public targets: Node[] = [];\n\n /**\n * The properties to animate\n */\n public properties: object = {};\n\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n\n /**\n * The total duration of all Animation's\n */\n public totalDuration: number = 0;\n\n /**\n * The smallest delay out of all Animation's\n */\n public minDelay: number = 0;\n\n /**\n * The options for individual animations\n */\n public computedOptions: Manager = new Manager();\n\n /**\n * The Element the main animation uses\n */\n public mainElement: HTMLElement;\n\n /**\n * Stores an animation that runs on the total duration of the all other Animations, and as such it's the main Animation\n */\n public mainAnimation: Animation;\n\n /**\n * Stores request frame calls\n */\n public animationFrame: number;\n\n /**\n * An event emitter\n */\n public emitter: EventEmitter = new EventEmitter();\n\n /**\n * Returns a promise that is fulfilled when the mainAnimation is finished\n */\n public promise: Promise;\n constructor(options: AnimationOptions = {}) {\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n\n /**\n * Returns a new Promise that is resolve when this.finish is called\n */\n public newPromise(): Promise {\n return new Promise((resolve, reject) => {\n /*\n Note that the `this` keyword is in an Array when it is resolved,\n this is due to Promises not wanting to resolve references,\n so, you can't resolve `this` directly, so, I chose to resolve `this` in an\n Array\n */\n this.on(\"complete\", () => resolve([this]));\n this.on(\"error\", err => reject(err));\n });\n }\n\n /**\n * Fulfills the this.promise Promise\n */\n public then(\n onFulfilled?: (value?: any) => any,\n onRejected?: (reason?: any) => any\n ): Animate {\n onFulfilled = onFulfilled?.bind(this);\n onRejected = onRejected?.bind(this);\n this.promise.then(onFulfilled, onRejected);\n return this;\n }\n\n /**\n * Catches error that occur in the this.promise Promise\n */\n public catch(onRejected: (reason?: any) => any): Animate {\n onRejected = onRejected?.bind(this);\n this.promise.catch(onRejected);\n return this;\n }\n\n /**\n * If you don't care if the this.promise Promise has either been rejected or resolved\n */\n public finally(onFinally: () => any): Animate {\n onFinally = onFinally?.bind(this);\n this.promise.finally(onFinally);\n return this;\n }\n\n /**\n * Represents an Animation Frame Loop\n */\n public loop(): void {\n this.stopLoop();\n this.emit(\"update\", this.getProgress(), this);\n this.animationFrame = window.requestAnimationFrame(this.loop);\n }\n\n /**\n * Cancels animation frame\n */\n public stopLoop() {\n window.cancelAnimationFrame(this.animationFrame);\n }\n\n /**\n * Calls a method that affects all animations including the mainAnimation; the method only allows the animation parameter\n */\n public all(method: (animation?: Animation, target?: HTMLElement) => void) {\n method(this.mainAnimation, this.mainElement);\n this.animations.forEach(method);\n return this;\n }\n\n /**\n * Register the begin event\n */\n protected beginEvent() {\n if (this.getProgress() == 0) {\n let timer: number | void = window.setTimeout(() => {\n this.emit(\"begin\", this);\n timer = window.clearTimeout(timer as number);\n }, this.minDelay);\n }\n }\n\n /**\n * Play Animation\n */\n public play(): Animate {\n let playstate = this.getPlayState();\n this.beginEvent();\n this.all(anim => anim.play());\n this.emit(\"play\", playstate, this);\n this.loop();\n return this;\n }\n\n /**\n * Pause Animation\n */\n public pause(): Animate {\n let playstate = this.getPlayState();\n this.all(anim => anim.pause());\n this.emit(\"pause\", playstate, this);\n this.stopLoop();\n this.animationFrame = undefined;\n return this;\n }\n\n /**\n * Reset all Animations\n */\n public reset() {\n this.setProgress(0);\n this.beginEvent();\n\n if (this.options.autoplay) this.play();\n else this.pause();\n return this;\n }\n\n /**\n * Cancels all Animations\n */\n public cancel() {\n this.all(anim => anim.cancel());\n this.stopLoop();\n return this;\n }\n\n /**\n * Force complete all Animations\n */\n public finish() {\n this.all(anim => anim.finish());\n this.stopLoop();\n return this;\n }\n\n /**\n * Cancels & Clears all Animations\n */\n public stop() {\n this.cancel();\n this.animations.clear();\n while (this.targets.length) this.targets.pop();\n this.mainElement = undefined;\n this.emit(\"stop\");\n }\n\n /**\n * Returns an Array of targets\n */\n public getTargets(): Node[] {\n return this.targets;\n }\n\n /**\n * Get a specific Animation from an Animate instance\n */\n public getAnimation(element: HTMLElement): Animation {\n return this.animations.get(element);\n }\n\n /**\n * Returns the timings of an Animation, given a target\n * E.g. { duration, endDelay, delay, iterations, iterationStart, direction, easing, fill, etc... }\n */\n public getTiming(target: HTMLElement | Animation): AnimationOptions & EffectTiming {\n let animation = target instanceof Animation ? target : this.getAnimation(target);\n let keyframeOptions = this.computedOptions.get(animation) ?? {};\n let timings = animation.effect?.getTiming() ?? {};\n let options = this.getOptions();\n\n return { ...DefaultAnimationOptions, ...options, ...timings, ...keyframeOptions };\n }\n\n /**\n * Returns the total duration of Animation\n */\n public getTotalDuration(): number {\n return this.totalDuration;\n }\n\n /**\n * Returns the current time of the Main Animation\n */\n public getCurrentTime(): number {\n return this.mainAnimation.currentTime;\n }\n\n /**\n * Returns the Animation progress as a fraction of the current time / duration * 100\n */\n public getProgress() {\n return (this.getCurrentTime() / this.totalDuration) * 100;\n }\n\n /**\n * Return the playback speed of the animation\n */\n public getSpeed(): number {\n return this.mainAnimation.playbackRate;\n }\n\n /**\n * Returns the current playing state\n */\n public getPlayState(): \"idle\" | \"running\" | \"paused\" | \"finished\" {\n return this.mainAnimation.playState;\n }\n\n /**\n * Get the options of an Animate instance\n */\n public getOptions(): AnimationOptions {\n return this.options;\n }\n\n /**\n * Set the current time of the Main Animation\n */\n public setCurrentTime(time: number): Animate {\n this.all(anim => { anim.currentTime = time; });\n this.emit(\"update\", this.getProgress());\n return this;\n }\n\n /**\n * Set the Animation progress as a value from 0 to 100\n */\n public setProgress(percent: number): Animate {\n let time = (percent / 100) * this.totalDuration;\n this.setCurrentTime(time);\n return this;\n }\n\n /**\n * Set the playback speed of an Animation\n */\n public setSpeed(speed: number = 1): Animate {\n this.all(anim => { anim.playbackRate = speed; });\n return this;\n }\n\n /**\n * Adds a listener for a given event\n */\n public on(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.on(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Removes a listener from an event\n */\n public off(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.off(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Call all listeners within an event\n */\n public emit(events: AnimationEvents | string | any[], ...args: any): Animate {\n this.emitter.emit(events, ...args);\n return this;\n }\n\n\n /** Returns the Animate options, as JSON */\n public toJSON(): AnimationOptions {\n return this.getOptions();\n }\n\n /**\n * The Symbol.toStringTag well-known symbol is a string valued property that is used\n * in the creation of the default string description of an object.\n * It is accessed internally by the Object.prototype.toString() method.\n */\n get [Symbol.toStringTag]() {\n return `Animate`;\n }\n}\n\n/** Creates a new Animate instance */\nexport const animate = (options: AnimationOptions = {}): Animate => {\n return new Animate(options);\n};\n\nexport class Timeline extends Animate {\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n constructor(options: AnimationOptions = {}) {\n super();\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n public add(options: AnimationOptions) {\n return this;\n }\n}\n\nexport default animate;", "import { Service, animate } from \"../../../packages/native/src/api\";\n\nexport class IntroAnimation extends Service {\n public elements: Array;\n public rootElement: HTMLElement;\n\n public init() {\n super.init();\n\n // Elements\n this.elements = [...document.querySelectorAll('.intro-animation')];\n }\n\n public newPage() {\n this.init();\n this.prepareToShow();\n }\n\n public initEvents() {\n this.emitter.on(\"BEFORE_SPLASHSCREEN_HIDE\", this.prepareToShow, this);\n this.emitter.on(\"CONTENT_REPLACED\", this.newPage, this);\n this.emitter.on(\"START_SPLASHSCREEN_HIDE BEFORE_TRANSITION_IN\", this.show, this);\n }\n\n public stopEvents() {\n this.emitter.off(\"BEFORE_SPLASHSCREEN_HIDE\", this.prepareToShow, this);\n this.emitter.off(\"CONTENT_REPLACED\", this.newPage, this);\n this.emitter.off(\"START_SPLASHSCREEN_HIDE BEFORE_TRANSITION_IN\", this.show, this);\n }\n\n public stop() {\n requestAnimationFrame(() => {\n for (let el of this.elements) {\n (el as HTMLElement).style.transform = \"translateY(0px)\";\n (el as HTMLElement).style.opacity = '1';\n }\n });\n\n super.stop();\n }\n\n public prepareToShow() {\n requestAnimationFrame(() => {\n for (let el of this.elements) {\n (el as HTMLElement).style.transform = \"translateY(200px)\";\n (el as HTMLElement).style.opacity = '0';\n }\n });\n }\n\n public async show() {\n let [anim] = await animate({\n target: (this.elements as HTMLElement[]),\n keyframes: [\n { transform: \"translateY(200px)\", opacity: 0 },\n { transform: \"translateY(0px)\", opacity: 1 },\n ],\n // @ts-ignore\n delay(i: number) {\n return 300 * (i + 1);\n },\n onfinish(el: { style: { transform: string; opacity: string; }; }) {\n requestAnimationFrame(() => {\n el.style.transform = \"translateY(0px)\";\n el.style.opacity = \"1\";\n });\n },\n easing: \"out-cubic\",\n duration: 650\n });\n anim.stop();\n return anim;\n }\n}\n", "import { ITransition, ITransitionData, animate } from \"../../../packages/native/src/api\";\n\n//== Transition\nexport const Fade: ITransition = {\n name: \"default\",\n duration: 500,\n scrollable: true,\n\n out({ from }: ITransitionData) {\n let { duration } = this;\n let fromWrapper = from.wrapper;\n return animate({\n target: fromWrapper,\n opacity: [1, 0],\n duration,\n }).on(\"finish\", function () {\n this.stop();\n });\n },\n\n in({ to, scroll }: ITransitionData) {\n let { duration } = this;\n let toWrapper = to.wrapper;\n\n window.scroll(scroll.x, scroll.y);\n return animate({\n target: toWrapper,\n opacity: [0, 1],\n duration\n }).then(function () {\n this.stop();\n });\n }\n};\n", "import { ITransition, ITransitionData, animate } from \"../../../packages/native/src/api\";\n\n//== Transitions\nexport const BigTransition: ITransition = {\n name: \"big\",\n delay: 200,\n durationPerAnimation: 700,\n scrollable: true,\n\n init() {\n this.mainElement = document.getElementById('big-transition');\n this.spinnerElement = this.mainElement.querySelector('.spinner');\n this.horizontalElements = [...this.mainElement.querySelector('#big-transition-horizontal').querySelectorAll('div')];\n this.maxLength = this.horizontalElements.length;\n },\n\n out({ from, scroll }: ITransitionData) {\n let { durationPerAnimation: duration, delay } = this;\n let fromWrapper = from.wrapper;\n\n window.scroll(scroll.x, scroll.y);\n let wrapperStyle = Object.assign({}, fromWrapper.style);\n return new Promise(async resolve => {\n this.mainElement.style.opacity = \"1\";\n this.mainElement.style.visibility = \"visible\";\n let anim1 = animate({\n target: fromWrapper,\n opacity: [1, 0],\n duration,\n onfinish(el: { style: { opacity: string; }; }) {\n el.style.opacity = '0';\n }\n });\n\n anim1.then(function () { this.stop(); });\n\n let [anim2] = await animate({\n target: this.horizontalElements,\n keyframes: [\n { transform: \"scaleX(0)\" },\n { transform: \"scaleX(1)\" },\n ],\n // @ts-ignore\n delay(i: number) {\n return delay * (i + 1);\n },\n onfinish(el: { style: { transform: string; }; }) {\n el.style.transform = `scaleX(1)`;\n },\n easing: \"out-cubic\",\n duration: 500\n });\n\n fromWrapper.style.opacity = '1';\n Object.assign(fromWrapper.style, wrapperStyle);\n this.spinnerElement.style.visibility = \"visible\";\n\n let loaderDuration = 500;\n let [anim3] = await animate({\n target: this.spinnerElement,\n opacity: [0, 1],\n duration: loaderDuration,\n onfinish(el: { style: { opacity: string; }; }) {\n el.style.opacity = `1`;\n },\n });\n\n let [anim4] = await animate({\n options: anim3,\n opacity: [1, 0],\n onfinish(el: { style: { opacity: string; }; }) {\n el.style.opacity = `0`;\n },\n delay: 1500\n });\n this.spinnerElement.style.visibility = \"hidden\";\n // anim2.stop() // -> anim2.stop() Breaks the Animation\n anim3.stop();\n anim4.stop();\n resolve();\n });\n },\n\n in({ to, scroll }: ITransitionData) {\n let { durationPerAnimation: duration, delay } = this;\n let toWrapper = to.wrapper;\n\n window.scroll(scroll.x, scroll.y);\n return new Promise(async resolve => {\n let anim1 = animate({\n target: toWrapper,\n opacity: [0, 1],\n duration\n }).then(() => {\n anim1.stop();\n });\n\n let [anim2] = await animate({\n target: this.horizontalElements,\n keyframes: [\n { transform: \"scaleX(1)\" },\n { transform: \"scaleX(0)\" },\n ],\n // @ts-ignore\n delay(i: number) {\n return delay * (i + 1);\n },\n onfinish(el: { style: { transform: string; }; }) {\n el.style.transform = `scaleX(0)`;\n },\n easing: \"out-cubic\",\n duration: 500\n });\n\n this.mainElement.style.opacity = \"0\";\n this.mainElement.style.visibility = \"hidden\";\n anim2.stop();\n resolve();\n });\n }\n}\n", "import { ITransition, ITransitionData, animate } from \"../../../packages/native/src/api\";\n\n//== Transitions\nexport const Slide: ITransition = {\n name: \"slide\",\n duration: 500,\n direction: \"right\",\n scrollable: true,\n\n init(data: ITransition) {\n let trigger = (data.trigger as HTMLElement);\n if (trigger instanceof Node && trigger.hasAttribute(\"data-direction\")) {\n this.direction = trigger.getAttribute(\"data-direction\");\n } else {\n this.direction = \"right\";\n }\n },\n\n out({ from }: ITransitionData) {\n let { duration, direction } = this;\n let fromWrapper = from.wrapper;\n\n return animate({\n target: fromWrapper,\n keyframes: [\n { transform: \"translateX(0%)\", opacity: 1 },\n { transform: `translateX(${direction === \"left\" ? \"-\" : \"\"}25%)`, opacity: 0 },\n ],\n duration,\n easing: \"in-quint\"\n }).then(function () {\n this.stop();\n });\n },\n\n in({ to, scroll }: ITransitionData) {\n let { duration } = this;\n let toWrapper = to.wrapper;\n\n window.scroll(scroll.x, scroll.y);\n return animate({\n target: toWrapper,\n keyframes: [\n { transform: `translateX(${this.direction === \"right\" ? \"-\" : \"\"}25%)`, opacity: 0 },\n { transform: \"translateX(0%)\", opacity: 1 },\n ],\n duration,\n easing: \"out-quint\"\n }).then(function () {\n this.stop();\n });\n }\n};\n\nexport const SlideLeft: ITransition = {\n ...Slide,\n\n name: \"slide-left\",\n direction: \"left\",\n init(data: ITransition) { }\n};\n\nexport const SlideRight: ITransition = {\n ...Slide,\n\n name: \"slide-right\",\n direction: \"right\",\n init(data: ITransition) { }\n};\n", "export const toArr = (input: any): any[] => Array.from(input);\nexport default toArr;", "import { Service, animate } from \"../../../packages/native/src/api\";\nimport { toArr } from \"../toArr\";\n\nexport class Navbar extends Service {\n public navbar: HTMLElement;\n public elements: HTMLElement[];\n public menu: HTMLElement;\n public collapseSection: HTMLElement;\n public navbarList: HTMLElement;\n toggleStatus: boolean;\n\n public init() {\n // Elements\n this.navbar = document.querySelector(\".navbar\") as HTMLElement;\n this.collapseSection = this.navbar.querySelector(\".navbar-collapse\") as HTMLElement;\n this.navbarList = this.navbar.querySelector(\".navbar-list\") as HTMLElement;\n this.elements = toArr(this.navbar.querySelectorAll(\".navbar-list a\"));\n this.menu = this.navbar.querySelector(\".navbar-toggle\") as HTMLElement;\n\n this.toggleStatus = false;\n this.toggleClick = this.toggleClick.bind(this);\n }\n\n public activateLink() {\n let { href } = window.location;\n\n for (let el of this.elements) {\n let itemHref =\n el.getAttribute(\"data-path\") ||\n (el as HTMLAnchorElement).href;\n if (!itemHref || itemHref.length < 1) return;\n\n let URLmatch = new RegExp(itemHref).test(href);\n let isActive = el.classList.contains(\"active\");\n if (!(URLmatch && isActive)) {\n el.classList.toggle(\"active\", URLmatch);\n }\n }\n }\n\n public toggleClick() {\n this.collapseSection.style?.setProperty?.(\"--height\", `${this.navbarList.clientHeight}px`);\n this.toggleStatus = !this.toggleStatus;\n this.collapseSection.classList.toggle(\"collapse\", !this.toggleStatus);\n this.collapseSection.classList.toggle(\"show\", this.toggleStatus);\n }\n\n public initEvents() {\n this.menu.addEventListener(\"click\", this.toggleClick);\n this.emitter.on(\"READY\", this.activateLink, this);\n this.emitter.on(\"GO\", this.activateLink, this);\n }\n\n public stopEvents() {\n this.navbar.removeEventListener(\"click\", this.toggleClick);\n this.emitter.off(\"READY\", this.activateLink, this);\n this.emitter.off(\"GO\", this.activateLink, this);\n }\n\n public uninstall() {\n while (this.elements.length) this.elements.pop();\n this.elements = undefined;\n this.menu = undefined;\n this.navbar = undefined;\n }\n}", "import { PJAX, App, TransitionManager, Router, HistoryManager, PageManager, animate, Animate } from \"@okikio/native\";\nimport { IntroAnimation } from \"./services/IntroAnimation\";\n\nimport { Fade } from \"./transitions/Fade\";\nimport { BigTransition } from \"./transitions/BigTransition\";\nimport { Slide, SlideLeft, SlideRight } from \"./transitions/Slide\";\n\nimport { toArr } from \"./toArr\";\nimport { Navbar } from \"./services/Navbar\";\n\nlet router: Router, pjax: PJAX;\nconst app: App = new App();\napp\n .add(new IntroAnimation())\n .set(\"HistoryManager\", new HistoryManager())\n .set(\"PageManager\", new PageManager())\n .set(\"TransitionManager\", new TransitionManager([\n [\"default\", Fade],\n [\"BigTransition\", BigTransition],\n [\"Slide\", Slide],\n [\"SlideLeft\", SlideLeft],\n [\"SlideRight\", SlideRight]\n ]))\n .add(new Navbar())\n .set(\"router\", router = new Router())\n .add(pjax = new PJAX());\n\ntry {\n router = app.get(\"router\") as Router;\n\n // This isn't nessceary, but it changes the nav link in focus depending on the page\n let navLink: HTMLElement[] = toArr(document.querySelectorAll(\".navbar .nav-link\"));\n for (let item of navLink) {\n let navItem = (item as HTMLAnchorElement);\n router.add({\n path: navItem.getAttribute(\"data-path\") || navItem.pathname,\n method() {\n let isActive = navItem.classList.contains(\"active\");\n if (!isActive) navItem.classList.add(\"active\");\n for (let nav of navLink) {\n if (nav !== navItem)\n nav.classList.remove(\"active\");\n }\n }\n });\n }\n\n router.add({\n path: /(index|\\/$)(\\.html)?/,\n method() { }\n });\n\n // app.on(\"AFTER_SPLASHSCREEN_HIDE\", () => {\n // anim?.play();\n // });\n\n app.boot();\n} catch (err) {\n console.warn(\"[App] boot failed,\", err);\n}\n"], - "mappings": "sgBAeO,GAAM,IAAkB,CAC3B,YAAa,UACb,eAAgB,eAChB,eAAgB,cAChB,QAAS,CACL,CAAC,YAAa,SAElB,gBAAiB,iBACjB,eAAgB,gBAChB,eAAgB,aAChB,UAAW,QACX,QAAS,IACT,SAAU,GAID,GAAY,AAAC,GACf,OAAO,OAAO,KAAK,IAAmB,GAIpC,GAAS,CAAC,EAAiB,EAAe,EAAoB,KAAiB,CACxF,GAAI,CAAE,UAAW,EACb,EAAO,OAAO,EAAS,IAAM,EAAS,MAAM,IAChD,MAAO,GAAW,IAAI,KAAU,GAIvB,EAAY,CAAC,EAA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CAAC,YAAa,IACd,CAAC,aAAc,OAElB,IAAI,GAAI,IACR,IAAI,SAAU,EAAS,GAAI,IAC3B,IAAI,GAAO,GAAI,IAEpB,GAAI,CACA,EAAS,EAAI,IAAI,UAGjB,GAAI,GAAyB,EAAM,SAAS,iBAAiB,sBAC7D,OAAS,KAAQ,GAAS,CACtB,GAAI,GAAW,EACf,EAAO,IAAI,CACP,KAAM,EAAQ,aAAa,cAAgB,EAAQ,SACnD,QAAS,CAEL,AAAK,AADU,EAAQ,UAAU,SAAS,WAC3B,EAAQ,UAAU,IAAI,UACrC,OAAS,KAAO,GACZ,AAAI,IAAQ,GACR,EAAI,UAAU,OAAO,aAMzC,EAAO,IAAI,CACP,KAAM,uBACN,QAAS,KAOb,EAAI,aACC,EAAP,CACE,QAAQ,KAAK,qBAAsB", + "sources": ["packages/native/src/config.ts", "packages/manager/src/api.ts", "packages/native/src/manager.ts", "packages/native/src/url.ts", "packages/native/src/service.ts", "packages/native/src/history.ts", "packages/native/src/page.ts", "packages/emitter/src/api.ts", "packages/native/src/transition.ts", "packages/native/src/app.ts", "packages/native/src/pjax.ts", "packages/native/src/router.ts", "packages/animate/src/api.ts", "build/ts/toArr.ts", "build/ts/services/IntroAnimation.ts", "build/ts/transitions/Fade.ts", "build/ts/transitions/BigTransition.ts", "build/ts/transitions/Slide.ts", "build/ts/services/Navbar.ts", "build/ts/main.ts"], + "sourcesContent": ["export interface ICONFIG {\n prefix?: string;\n wrapperAttr?: string;\n noAjaxLinkAttr?: string;\n noPrefetchAttr?: \"no-prefetch\";\n headers?: string[][];\n preventSelfAttr?: string;\n preventAllAttr?: string;\n transitionAttr?: string;\n blockAttr?: string;\n timeout?: number;\n maxPages?: number;\n resizeDelay?: number;\n [key: string]: any;\n}\n\nexport const CONFIG_DEFAULTS: ICONFIG = {\n wrapperAttr: \"wrapper\",\n noAjaxLinkAttr: \"no-ajax-link\",\n noPrefetchAttr: \"no-prefetch\",\n headers: [\n [\"x-partial\", \"true\"]\n ],\n preventSelfAttr: `prevent=\"self\"`,\n preventAllAttr: `prevent=\"all\"`,\n transitionAttr: \"transition\",\n blockAttr: `block`,\n timeout: 30000,\n maxPages: 5,\n resizeDelay: 100\n};\n\nexport type ConfigKeys = keyof typeof CONFIG_DEFAULTS | string;\nexport const newConfig = (config: ICONFIG): ICONFIG => {\n return Object.assign({ ...CONFIG_DEFAULTS }, config);\n};\n\n/** Converts string into properly formatted data attributes */\nexport const toAttr = (config: ICONFIG, value: string, brackets: boolean = true): string => {\n let { prefix } = config;\n let attr = `data${prefix ? \"-\" + prefix : \"\"}-${value}`;\n return brackets ? `[${attr}]` : attr;\n};\n\n/** Selects config vars, and formats them for use, or simply returns the current configurations for the framework */\nexport const getConfig = (config: ICONFIG, value?: ConfigKeys, brackets: boolean = true): any => {\n if (typeof value !== \"string\")\n return config;\n\n let prop = config[value];\n if (typeof prop === \"string\")\n return toAttr(config, prop, brackets);\n return prop;\n};\n", "/** Manages complex lists of named data, eg. A page can be stored in a list by of other pages with the url being how the page is stored in the list. Managers use Maps to store data */\nexport class Manager {\n\t/** The complex list of named data, to which the Manager controls */\n\tpublic map: Map;\n\tconstructor(value?: Array<[K, V]>) {\n\t\tthis.map = new Map(value);\n\t}\n\n\t/** Returns the Manager classes base Map */\n\tpublic getMap(): Map {\n\t\treturn this.map;\n\t}\n\n\t/** Get a value stored in the Manager */\n\tpublic get(key: K): V {\n\t\treturn this.map.get(key);\n\t}\n\n\t/** Returns the keys of all items stored in the Manager as an Array */\n\tpublic keys(): Array {\n\t\treturn Array.from(this.map.keys());\n\t}\n\n\t/** Returns the values of all items stored in the Manager as an Array */\n\tpublic values(): Array {\n\t\treturn Array.from(this.map.values());\n\t}\n\n\t/** Set a value to the Manager using a key */\n\tpublic set(key: K, value: V): Manager {\n\t\tthis.map.set(key, value);\n\t\treturn this;\n\t}\n\n\t/** Adds a value to Manager, and uses the current size of the Manager as it's key, it works best when all the key in the Manager are numbers */\n\tpublic add(value: V): Manager {\n\t\tlet size = this.size;\n\t\t// @ts-ignore\n\t\tlet num: K = size as K;\n\t\tthis.set(num, value);\n\t\treturn this;\n\t}\n\n\t/** Returns the total number of items stored in the Manager */\n\tpublic get size(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** An alias for size */\n\tpublic get length(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** Returns the last item in the Manager who's index is a certain distance from the last item in the Manager */\n\tpublic last(distance: number = 1): V | undefined {\n\t\tlet key = this.keys()[this.size - distance];\n\t\treturn this.get(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns true if an element in the Map object existed and has been removed, or false if the element does not exist */\n\tpublic delete(key: K): boolean {\n\t\treturn this.map.delete(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns the Manager class, allowing for chains */\n\tpublic remove(key: K): Manager {\n\t\tthis.map.delete(key);\n\t\treturn this;\n\t}\n\n\t/** Clear the Manager of all its contents */\n\tpublic clear(): Manager {\n\t\tthis.map.clear();\n\t\treturn this;\n\t}\n\n\t/** Checks if the Manager contains a certain key */\n\tpublic has(key: K): boolean {\n\t\treturn this.map.has(key);\n\t}\n\n\t/** Returns a new Iterator object that contains an array of [key, value] for each element in the Map object in insertion order. */\n\tpublic entries(): IterableIterator<[K, V]> {\n\t\treturn this.map.entries();\n\t}\n\n\t/** Iterates through the Managers contents, calling a callback function every iteration */\n\tpublic forEach(\n\t\tcallback: (value?: V, key?: K, map?: Map) => void,\n\t\tcontext?: object\n\t): Manager {\n\t\tthis.map.forEach(callback, context);\n\t\treturn this;\n\t}\n\n\t/** Allows for iteration via for..of, learn more: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators] */\n\tpublic [Symbol.iterator](): IterableIterator<[K, V]> {\n\t\treturn this.entries();\n\t}\n}\n\n/**\n * Calls the method of a certain name for all items that are currently installed\n */\nexport const methodCall = (manager: Manager, method: string, ...args: any): void => {\n\tmanager.forEach((item) => {\n\t\t// @ts-ignore\n\t\titem[method](...args);\n\t});\n};\n\n/**\n * Asynchronously calls the method of a certain name for all items that are currently installed, similar to methodCall\n */\nexport const asyncMethodCall = async (manager: Manager, method: string, ...args: any): Promise => {\n\tfor (let [, item] of manager) {\n\t\t// @ts-ignore\n\t\tawait item[method](...args);\n\t}\n};\n\nexport default Manager;\n", "import { Manager, methodCall, asyncMethodCall } from \"@okikio/manager\";\nimport { ICONFIG } from \"./config\";\nimport { IApp } from \"./app\";\nimport { EventEmitter } from \"./emitter\";\n\nexport type IAdvancedManager = AdvancedManager;\n\n/** The base class for AdvancedManager items */\nexport class ManagerItem {\n /** The AdvancedManager the ManagerItem is attached to */\n public manager: IAdvancedManager;\n\n /** The App the ManagerItem is attached to */\n public app: IApp;\n\n /** The Config of the App the ManagerItem is attached to */\n public config: ICONFIG;\n\n /** The EventEmitter of the App the ManagerItem is attached to */\n public emitter: EventEmitter;\n\n /** The key to where ManagerItem is stored in an AdvancedManager */\n public key: any;\n\n constructor() { }\n\n /** Run after the Manager Item has been registered */\n public install(): any { }\n\n /** Register the current Manager Item's manager */\n public register(manager: IAdvancedManager, key: any): ManagerItem {\n this.manager = manager;\n this.app = manager.app;\n this.config = manager.config;\n this.emitter = manager.emitter;\n this.key = key;\n this.install();\n return this;\n }\n\n /** Run before the ManagerItem has been unregistered */\n public uninstall(): any { }\n\n /** Basically removes a ManagerItem, in order to recover the ManagerItem, it needs to be re-added to an AdvancedManager */\n public unregister() {\n this.uninstall();\n\n this.manager.remove(this.key);\n this.key = undefined;\n this.manager = undefined;\n this.app = undefined;\n this.config = undefined;\n this.emitter = undefined;\n }\n}\n\n/** A tweak to the Manager class that makes it self aware of the App class it's instantiated in */\nexport class AdvancedManager extends Manager {\n /** The App the AdvancedManager is attached to */\n public app: IApp;\n\n /** The Config of the App the AdvancedManager is attached to */\n public config: ICONFIG;\n\n /** The EventEmitter of the App the AdvancedManager is attached to */\n public emitter: EventEmitter;\n\n /** Register App details */\n constructor(app: IApp) {\n super();\n this.app = app;\n this.config = app.config;\n this.emitter = app.emitter;\n }\n\n /** Add a ManagerItem to AdvancedManager at a specified key */\n public set(key: K, value: V) {\n super.set(key, value);\n value.register(this, key);\n return this;\n }\n}\n\nexport { Manager, methodCall, asyncMethodCall };\n", "export const newURL = (url: string | URL | Location = window.location.href): URL => {\n return url instanceof URL ? url : new URL(url as unknown as string, window.location.origin);\n};\n\n/** Returns the pathname with the hash at the end */\nexport const getHashedPath = (url: URL | string): string => {\n let _url = newURL(url);\n return `${_url.pathname}${_url.hash}`;\n};\n\n/** Returns the actual hash without the hashtag */\nexport const getHash = (url: URL | string): string => newURL(url).hash.slice(1);\n\n/** Removes the hash from the full URL for a clean URL string */\nexport const clean = (url: URL | string): string => newURL(url).toString().replace(/(\\/#.*|\\/|#.*)$/, '');\n\n/** Compares two URLs to each other */\nexport const equal = (a: URL | string, b: URL | string): boolean => (clean(a) === clean(b));\n\n", "import { AdvancedManager, ManagerItem, methodCall } from \"./manager\";\nimport { IApp } from \"./app\";\n\n/** Controls specific kinds of actions that require JS */\nexport class Service extends ManagerItem {\n\t/** Called before the start of a Service, represents a constructor of sorts */\n\tpublic init(...args: any): any;\n\tpublic init(): any { }\n\n\t/** Called on start of Service */\n\tpublic boot(...args: any): any;\n\tpublic boot(): any {\n\t\tthis.initEvents();\n\t}\n\n\t/** Initialize events */\n\tpublic initEvents(): void { }\n\n\t/** Stop events */\n\tpublic stopEvents(): void { }\n\n\t/** Stop services */\n\tpublic stop(): void {\n\t\tthis.stopEvents();\n\t\tthis.unregister();\n\t}\n}\n\n/** The Service Manager controls the lifecycle of all Services in an App */\nexport class ServiceManager extends AdvancedManager {\n\tconstructor(app: IApp) {\n\t\tsuper(app);\n\t}\n\n\t/** Call the init method for all Services */\n\tpublic init(): ServiceManager {\n\t\tmethodCall(this, \"init\");\n\t\treturn this;\n\t}\n\n\t/** Call the boot method for all Services */\n\tpublic boot(): ServiceManager {\n\t\tmethodCall(this, \"boot\");\n\t\treturn this;\n\t}\n\n\t/** Call the stop method for all Services */\n\tpublic stop(): ServiceManager {\n\t\tmethodCall(this, \"stop\");\n\t\treturn this;\n\t}\n}\n", "import { Service } from \"./service\";\nimport { getHashedPath, newURL } from \"./url\";\n\nexport type Trigger = HTMLAnchorElement | \"HistoryManager\" | \"popstate\" | \"back\" | \"forward\";\nexport interface ICoords {\n\treadonly x: number;\n\treadonly y: number;\n}\n\nexport interface IStateData {\n\tscroll: ICoords;\n\t[key: string]: any;\n}\n\nexport interface IState {\n\turl: string;\n\tindex?: number;\n\ttransition: string;\n\tdata: IStateData;\n}\n\nexport interface IHistoryItem {\n\tindex: number;\n\tstates: IState[];\n}\n\nexport interface IHistoryManager extends Service {\n\tstates: IState[],\n\tpointer: number,\n\n\tinit(): any,\n\tget(index: number): IState,\n\tadd(value?: IState, historyAction?: \"replace\" | \"push\"): HistoryManager,\n\tremove(index?: number): HistoryManager,\n\treplace(newStates: IState[]): HistoryManager,\n\tset(i: number, state: IState): IState,\n\tcurrent: IState,\n\tlast: IState,\n\tprevious: IState | null,\n\tlength: number,\n}\n\n/** A quick snapshot of page scroll coordinates */\nexport const newCoords = (x: number = window.scrollX, y: number = window.scrollY): ICoords => ({ x, y });\n\n/** Creates a state; a state represents the current status of the page consisting of properties like: url, transition, and data */\nexport const newState = (state: IState = {\n\turl: getHashedPath(newURL()),\n\tindex: 0,\n\ttransition: \"default\",\n\tdata: {\n\t\tscroll: newCoords(),\n\t\ttrigger: \"HistoryManager\"\n\t}\n}): IState => (state);\n\n/** Keeps a record of the history of the App; it stores only the states of Pages */\nexport class HistoryManager extends Service implements IHistoryManager {\n\tpublic states: IState[];\n\tpublic pointer = -1;\n\n\t/** Initializes the states array, and replace the history pushState data with the states array */\n\tinit() {\n\t\tthis.states = [];\n\n\t\tlet state = newState();\n\t\tthis.add(state, \"replace\");\n\t}\n\n\t/** Get a state based on it's index */\n\tpublic get(index: number) {\n\t\treturn this.states[index];\n\t}\n\n\t/** Add a state to HistoryManager and change the history pushState data based on the historyAction specified */\n\tpublic add(value?: IState, historyAction: \"replace\" | \"push\" = \"push\"): HistoryManager {\n\t\tlet state = newState(value);\n\t\tlet len = this.length;\n\t\tthis.states.push({ ...state });\n\t\tthis.pointer = len;\n\n\t\tlet item: IHistoryItem = {\n\t\t\tindex: this.pointer,\n\t\t\tstates: [...this.states]\n\t\t};\n\t\tchangeState(historyAction, state, item);\n\t\treturn this;\n\t}\n\n\tpublic remove(index?: number) {\n\t\tif (index) {\n\t\t\tthis.states.splice(index, 1);\n\t\t} else {\n\t\t\tthis.states.pop();\n\t\t}\n\n\t\tthis.pointer--;\n\t\treturn this;\n\t}\n\n\t/** Replaces the states array with another states array, this is later used when going back and forward in page history */\n\tpublic replace(newStates: IState[]) {\n\t\tthis.states = newStates;\n\t\treturn this;\n\t}\n\n\t/** Set state by index. */\n\tpublic set(i: number, state: IState) {\n\t\treturn (this.states[i] = state);\n\t}\n\n\t/** Get the current state */\n\tget current(): IState {\n\t\treturn this.get(this.pointer);\n\t}\n\n\t/** Get the last state (top of the history stack). */\n\tget last(): IState {\n\t\treturn this.get(this.length - 1);\n\t}\n\n\t/** Get the previous state. */\n\tget previous(): IState | null {\n\t\treturn this.pointer < 1 ? null : this.get(this.pointer - 1);\n\t}\n\n\tget length() {\n\t\treturn this.states.length;\n\t}\n}\n\n/** Either push or replace history state */\nexport const changeState = (action: \"push\" | \"replace\", state: IState, item: object) => {\n\tlet href = getHashedPath(state.url);\n\tlet args = [item, \"\", href];\n\tif (window.history) {\n\t\tswitch (action) {\n\t\t\tcase \"push\":\n\t\t\t\twindow.history.pushState.apply(window.history, args);\n\t\t\t\tbreak;\n\t\t\tcase \"replace\":\n\t\t\t\twindow.history.replaceState.apply(window.history, args);\n\t\t\t\tbreak;\n\t\t}\n\t}\n};\n", "import { Manager, ManagerItem, AdvancedManager } from \"./manager\";\nimport { equal, newURL } from \"./url\";\nimport { getConfig } from \"./config\";\nimport { Service } from \"./service\";\n\nexport interface IPage extends ManagerItem {\n dom: Document,\n wrapper: HTMLElement,\n title: string,\n head: Element,\n body: Element,\n url: URL,\n data: string,\n wrapperAttr: string,\n\n build(): any,\n install(): void,\n uninstall(): any,\n}\n\n/**\n * Parses strings to DOM\n */\nexport const PARSER: DOMParser = new DOMParser();\n\n/** A page represents the DOM elements that create each page */\nexport class Page extends ManagerItem implements IPage {\n /** Holds the DOM of the current page */\n public dom: Document;\n\n /** Holds the wrapper element to be swapped out of each Page */\n public wrapper: HTMLElement;\n\n /** Holds the title of each page */\n public title: string;\n\n /** Holds the head element of each page */\n public head: Element;\n\n /** Holds the body element of each page */\n public body: Element;\n\n /** The URL of the current page */\n public url: URL;\n\n /** The payload of a page request */\n public data: string;\n\n /** Attr that identifies the wrapper */\n public wrapperAttr: string;\n\n constructor(url: URL = newURL(), dom: string | Document = document) {\n super();\n this.url = url;\n\n if (typeof dom === \"string\") {\n this.data = dom;\n } else this.dom = dom || document;\n }\n\n /** Builds the page's dom, and sets the title, head, body, and wrapper properties of the Page class */\n public build() {\n if (!(this.dom instanceof Node)) {\n this.dom = PARSER.parseFromString(this.data, \"text/html\");\n }\n\n if (!(this.body instanceof Node)) {\n let { title, head, body } = this.dom;\n this.title = title;\n this.head = head;\n this.body = body;\n this.wrapper = this.body.querySelector(this.wrapperAttr);\n }\n }\n\n public install() {\n this.wrapperAttr = getConfig(this.config, \"wrapperAttr\");\n }\n\n public uninstall() {\n this.url = undefined;\n this.title = undefined;\n this.head = undefined;\n this.body = undefined;\n this.dom = undefined;\n this.wrapper = undefined;\n this.data = undefined;\n this.wrapperAttr = undefined;\n }\n}\n\nexport interface IPageManager extends Service {\n loading: Manager>,\n pages: AdvancedManager;\n\n install(): any,\n\n get(key): Page,\n add(value): PageManager,\n set(key, value): PageManager,\n remove(key): PageManager,\n has(key): boolean,\n clear(): PageManager,\n size: number,\n keys(): any[],\n\n load(_url: URL | string): Promise,\n request(url: string): Promise,\n}\n\n/** Controls which page to load */\nexport class PageManager extends Service implements IPageManager {\n /** Stores all fetch requests that are currently loading */\n public loading: Manager> = new Manager();\n\n pages: AdvancedManager;\n\n /** Instantiate pages, and add the current page to pages */\n install() {\n this.pages = new AdvancedManager(this.app);\n\n let URLString = newURL().pathname;\n this.set(URLString, new Page());\n URLString = undefined;\n }\n\n get(key) { return this.pages.get(key); }\n add(value) { this.pages.add(value); return this; }\n set(key, value) { this.pages.set(key, value); return this; }\n remove(key) { this.pages.remove(key); return this; }\n has(key) { return this.pages.has(key); }\n clear() { this.pages.clear(); return this; }\n get size() { return this.pages.size; }\n keys() { return this.pages.keys(); }\n\n /** Load from cache or by requesting URL via a fetch request, avoid requesting for the same thing twice by storing the fetch request in \"this.loading\" */\n public async load(_url: URL | string = newURL()): Promise {\n let url: URL = newURL(_url);\n let urlString: string = url.pathname;\n let page: Page, request: Promise;\n\n if (this.has(urlString)) {\n page = this.get(urlString);\n return Promise.resolve(page);\n }\n\n if (!this.loading.has(urlString)) {\n request = this.request(urlString);\n this.loading.set(urlString, request);\n } else request = this.loading.get(urlString);\n\n let response = await request;\n this.loading.remove(urlString);\n\n page = new Page(url, response);\n this.set(urlString, page);\n\n if (this.size > getConfig(this.config, \"maxPages\")) {\n let currentUrl = newURL();\n let keys = this.keys();\n let first = equal(currentUrl, keys[0]) ? keys[1] : keys[0];\n let page = this.get(first);\n page.unregister();\n page = undefined;\n keys = undefined;\n currentUrl = undefined;\n first = undefined;\n }\n\n return page;\n }\n\n /** Starts a fetch request */\n public async request(url: string): Promise {\n const headers = new Headers(getConfig(this.config, \"headers\"));\n const timeout = window.setTimeout(() => {\n window.clearTimeout(timeout);\n throw \"Request Timed Out!\";\n }, getConfig(this.config, \"timeout\"));\n\n try {\n let response = await fetch(url, {\n mode: 'same-origin',\n method: \"GET\",\n headers,\n cache: \"default\",\n credentials: \"same-origin\",\n });\n\n window.clearTimeout(timeout);\n if (response.status >= 200 && response.status < 300) {\n return await response.text();\n }\n\n const err = new Error(response.statusText || \"\" + response.status);\n throw err;\n } catch (err) {\n window.clearTimeout(timeout);\n throw err;\n }\n }\n}\n", "import { Manager, methodCall } from \"@okikio/manager\";\n\nexport type ListenerCallback = ((...args: any) => void);\nexport interface IListener {\n readonly callback: ListenerCallback;\n readonly scope: object;\n readonly name: string;\n}\n\n/** Represents a new event listener consisting of properties like: callback, scope, name */\nexport const newListener = ({\n callback = () => { },\n scope = null,\n name = \"event\",\n}: IListener): IListener => ({ callback, scope, name });\n\n/** Represents a new event */\nexport class Event extends Manager {\n /** The name of the event */\n public name: string;\n constructor(name: string = \"event\") {\n super();\n this.name = name;\n }\n}\n\nexport type EventInput = string | object | Array;\n\n/**\n * An Event Emitter\n * */\nexport class EventEmitter extends Manager {\n constructor() {\n super();\n }\n\n /** Gets event, if event doesn't exist create a new one */\n public getEvent(name: string): Event {\n let event = this.get(name);\n if (!(event instanceof Event)) {\n this.set(name, new Event(name));\n return this.get(name);\n }\n\n return event;\n }\n\n /** Creates a listener and adds it to an event */\n public newListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event = this.getEvent(name);\n event.add(newListener({ name, callback, scope }));\n return event;\n }\n\n /** Adds a listener to a given event */\n public on(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n this.newListener(_name, _callback, _scope);\n }, this);\n return this;\n }\n\n /** Removes a listener from an event */\n public removeListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event: Event = this.get(name);\n if (event instanceof Event && callback) {\n let listener = newListener({ name, callback, scope });\n\n event.forEach((value: IListener, i: number) => {\n if (\n value.callback === listener.callback &&\n value.scope === listener.scope\n ) {\n return event.remove(i);\n }\n });\n }\n\n return event;\n }\n\n /** Remove a listener from a given event, or just completely remove an event */\n public off(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n if (typeof _callback === \"function\") {\n this.removeListener(_name, _callback, _scope);\n } else this.remove(_name);\n }, this);\n return this;\n }\n\n /** Call all listeners within an event */\n public emit(\n events: string | Array,\n ...args: any\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n // Loop through the list of events\n events.forEach((event: string) => {\n let _event: Event = this.get(event);\n\n if (_event instanceof Event) {\n _event.forEach((listener: IListener) => {\n let { callback, scope } = listener;\n callback.apply(scope, args);\n });\n }\n }, this);\n return this;\n }\n\n /** Clears events and event listeners */\n public clear() {\n methodCall(this, \"clear\");\n super.clear();\n return this;\n }\n}\n\nexport default EventEmitter;\n", "import { Manager } from \"./manager\";\nimport { ICoords, newCoords, Trigger } from \"./history\";\nimport { IPage } from \"./page\";\nimport { getConfig } from \"./config\";\nimport { Service } from \"./service\";\nimport { newURL } from \"./url\";\n\n/**\n * The async function type, allows for smooth transition between Promises\n */\nexport type asyncFn = (err?: any, value?: any) => void;\nexport interface ITransition {\n oldPage?: IPage;\n newPage?: IPage;\n trigger?: Trigger;\n scroll?: { x: number; y: number };\n scrollable?: boolean;\n in: (data: ITransitionData) => any;\n out: (data: ITransitionData) => any;\n [key: string]: any;\n}\nexport interface ITransitionData {\n from?: IPage;\n to?: IPage;\n trigger?: Trigger;\n scroll?: ICoords;\n done: asyncFn;\n}\nexport interface ITransitionManager extends Service {\n transitions: Manager,\n\n get(key: string): ITransition,\n set(key: string, value: ITransition): TransitionManager,\n add(value: ITransition): TransitionManager,\n has(key: string): boolean,\n\n boot(): any,\n animate(name: string, data: any): Promise,\n}\n\n/** Auto scrolls to an elements position if the element has an hash */\nexport const hashAction = (coords?: ICoords, hash: string = window.location.hash) => {\n try {\n let _hash = hash[0] == \"#\" ? hash : newURL(hash).hash;\n if (_hash.length > 1) {\n let el = document.getElementById(_hash.slice(1));\n if (el) {\n let { left, top } = el.getBoundingClientRect();\n let scrollLeft = window.pageXOffset;\n let scrollTop = window.pageYOffset;\n let x = left + scrollLeft;\n let y = top + scrollTop;\n\n console.log(x, y);\n return newCoords(x, y);\n }\n }\n } catch (e) {\n console.warn(\"[hashAction] error\", e);\n }\n\n return coords ?? newCoords(0, 0);\n};\n\n// The Default Transition\nconst Default: ITransition = {\n name: \"default\",\n scrollable: true,\n\n out({ done }: ITransitionData) {\n done();\n },\n in({ scroll, done }: ITransitionData) {\n window.scroll(scroll.x, scroll.y);\n done();\n }\n};\n\n/** Controls which Transition between pages to use */\nexport class TransitionManager extends Service implements ITransitionManager {\n transitions: Manager;\n private _arg: Array<[string, ITransition]>;\n constructor(transitions?: Array<[string, ITransition]>) {\n super();\n this._arg = transitions;\n }\n\n /** On Service install set Config */\n public install() {\n super.install();\n\n let transitions = this._arg && this._arg.length ? this._arg : (getConfig(this.config, \"transitions\") ?? []);\n\n // Manager like Maps use the most recent [key, value] Array it knows, replacing the default transition\n // With any other transitions called [\"default\", ...]\n transitions = [[\"default\", Default]].concat(transitions);\n this.transitions = new Manager(transitions);\n }\n\n get(key: string) { return this.transitions.get(key); }\n set(key: string, value: ITransition) { this.transitions.set(key, value); return this; }\n add(value: ITransition) { this.transitions.add(value); return this; }\n has(key: string) { return this.transitions.has(key); }\n\n /** Starts a transition */\n public async animate(name: string, data: any): Promise {\n let transition: ITransition = this.transitions.get(name);\n let scroll = data.scroll;\n let ignoreHashAction = data.ignoreHashAction;\n if (!(\"wrapper\" in data.oldPage) || !(\"wrapper\" in data.newPage))\n throw `[Page] either oldPage or newPage aren't instances of the Page Class.\\n ${{\n newPage: data.newPage,\n oldPage: data.oldPage,\n }}`;\n\n // Replace the title\n document.title = `` + data.newPage.title;\n\n let fromWrapper = data.oldPage.wrapper;\n let toWrapper = data.newPage.wrapper;\n\n if (!(fromWrapper instanceof Node) || !(toWrapper instanceof Node))\n throw `[Wrapper] the wrapper from the ${!(toWrapper instanceof Node) ? \"next\" : \"current\"\n } page cannot be found. The wrapper must be an element that has the attribute ${getConfig(this.config,\n \"wrapperAttr\"\n )}.`;\n\n // Give the Transition all the background data it may require\n transition.init && transition?.init(data);\n\n this.emitter.emit(\"BEFORE_TRANSITION_OUT\");\n\n // Start the out point of the Transition\n if (transition.out) {\n await new Promise((done) => {\n let outMethod: Promise = transition.out.call(transition, {\n ...data,\n from: data.oldPage,\n trigger: data.trigger,\n done,\n });\n\n outMethod?.then(done);\n });\n }\n\n this.emitter.emit(\"AFTER_TRANSITION_OUT\");\n\n // Add the new wrapper before the old one\n await new Promise((done) => {\n fromWrapper.insertAdjacentElement(\"beforebegin\", toWrapper);\n this.emitter.emit(\"CONTENT_INSERT\");\n\n if (!ignoreHashAction && !/back|popstate|forward/.test(data.trigger as string)) {\n scroll = hashAction(scroll);\n }\n done();\n });\n\n // Replace the old wrapper with the new one\n await new Promise((done) => {\n fromWrapper.remove();\n fromWrapper = undefined;\n toWrapper = undefined;\n this.emitter.emit(\"CONTENT_REPLACED\");\n done();\n });\n\n this.emitter.emit(\"BEFORE_TRANSITION_IN\");\n\n // Start the in point of the Transition (only the in method has access to the hashAction's scroll position)\n if (transition.in) {\n await new Promise(async (done) => {\n let inMethod: Promise = transition.in.call(transition, {\n ...data,\n from: data.oldPage,\n to: data.newPage,\n trigger: data.trigger,\n scroll,\n done,\n });\n\n inMethod?.then(done);\n });\n }\n\n this.emitter.emit(\"AFTER_TRANSITION_IN\");\n return transition;\n }\n}\n", "import { EventEmitter, ListenerCallback, EventInput } from \"./emitter\";\nimport { ServiceManager, Service } from \"./service\";\nimport { newConfig, ICONFIG, getConfig } from \"./config\";\n\nexport interface IApp {\n services: ServiceManager,\n emitter: EventEmitter,\n config: ICONFIG,\n register(config: ICONFIG): App,\n get(key: string): Service,\n set(key: string, service: Service): App,\n add(value: Service): App,\n boot(): App,\n stop(): App,\n on(events: EventInput, callback?: ListenerCallback): App,\n off(events: EventInput, callback?: ListenerCallback): App,\n emit(events: string | any[], ...args: any): App,\n}\n\n/** The App class starts the entire process, it controls all managers and all services */\nexport class App implements IApp {\n /** An instance of the ServiceManager */\n public services: ServiceManager;\n\n /** An instance of an EventEmitter */\n public emitter: EventEmitter;\n\n /** The current Configuration's for the App */\n public config: ICONFIG;\n\n private canResize = true;\n private canScroll = true;\n constructor(config: object = {}) {\n this._resize = this._resize.bind(this);\n this._scroll = this._scroll.bind(this);\n this._ready = this._ready.bind(this);\n this.register(config);\n }\n\n /** Create new instances of the ServiceManager, EventEmitter and the configurations */\n public register(config: ICONFIG = {}): App {\n this.config = newConfig(config);\n this.emitter = new EventEmitter();\n this.services = new ServiceManager(this);\n\n document.addEventListener(\"DOMContentLoaded\", this._ready);\n window.addEventListener(\"load\", this._ready);\n window.addEventListener(\"resize\", this._resize, { passive: true });\n window.addEventListener(\"scroll\", this._scroll, { passive: true });\n return this;\n }\n\n private _ready() {\n document.removeEventListener(\"DOMContentLoaded\", this._ready);\n window.removeEventListener(\"load\", this._ready);\n this.emitter.emit(\"READY ready\");\n }\n\n private _resize() {\n if (this.canResize) {\n let timer: number | void, raf: number | void;\n this.canResize = false;\n raf = window.requestAnimationFrame(() => {\n this.emitter.emit(\"RESIZE resize\");\n\n // set a timeout to un-throttle\n timer = window.setTimeout(() => {\n this.canResize = true;\n timer = window.clearTimeout(timer as number);\n raf = window.cancelAnimationFrame(raf as number);\n }, getConfig(this.config, \"resizeDelay\"));\n });\n }\n }\n\n private _scroll() {\n if (this.canScroll) {\n let raf: number | void;\n this.canScroll = false;\n raf = requestAnimationFrame(() => {\n this.emitter.emit(\"SCROLL scroll\");\n\n this.canScroll = true;\n raf = window.cancelAnimationFrame(raf as number);\n });\n }\n }\n\n /** Shortcuts to adding, setting, and getting Services */\n public get(key: string): Service {\n return this.services.get(key);\n }\n\n public set(key: string, value: Service): App {\n this.services.set(key, value);\n return this;\n }\n\n public add(value: Service): App {\n this.services.add(value);\n return this;\n }\n\n /** Initialize and boot all Services */\n public boot(): App {\n this.services.init();\n this.services.boot();\n return this;\n }\n\n /** Stops all Services and clears the even emitter of all events and listeners */\n public stop(): App {\n this.services.stop();\n this.emitter.clear();\n return this;\n }\n\n /** Shortcuts to the App EventEmitter on, off, and emit methods */\n public on(events: EventInput, callback?: ListenerCallback): App {\n this.emitter.on(events, callback, this);\n return this;\n }\n\n public off(events: EventInput, callback?: ListenerCallback): App {\n this.emitter.off(events, callback, this);\n return this;\n }\n\n public emit(events: string | any[], ...args: any): App {\n this.emitter.emit(events, ...args);\n return this;\n }\n}\n", "import { newState, Trigger, newCoords, IHistoryItem, IHistoryManager } from \"./history\";\nimport { Service } from \"./service\";\nimport { IPage, IPageManager } from \"./page\";\nimport { newURL, getHashedPath, equal } from \"./url\";\nimport { getConfig } from \"./config\";\nimport { hashAction, ITransitionManager } from \"./transition\";\n\nexport type LinkEvent = MouseEvent | TouchEvent;\nexport type StateEvent = LinkEvent | PopStateEvent;\nexport type IgnoreURLsList = Array;\n/**\n * Creates a barbajs like PJAX Service, for the native framework\n * Based on barbajs and StartingBlocks\n */\nexport class PJAX extends Service {\n /** URLs to ignore when prefetching */\n public ignoreURLs: IgnoreURLsList;\n\n /** Whether or not to disable prefetching */\n public prefetchIgnore: boolean;\n\n /** Current state of transitions */\n public isTransitioning: boolean;\n\n /** Ignore extra clicks of an anchor element if a transition has already started */\n public stopOnTransitioning: boolean;\n\n /** On page change (excluding popstate events) keep current scroll position */\n public stickyScroll: boolean;\n\n /** Force load a page if an error occurs */\n public forceOnError: boolean;\n\n /** Ignore hash action if set to true */\n public ignoreHashAction: boolean;\n\n public install() {\n super.install();\n\n this.ignoreURLs = getConfig(this.config, \"ignoreURLs\") ?? [];\n this.prefetchIgnore = getConfig(this.config, \"prefetchIgnore\") ?? false;\n this.stopOnTransitioning = getConfig(this.config, \"stopOnTransitioning\") ?? false;\n this.stickyScroll = getConfig(this.config, \"stickyScroll\") ?? false;\n this.forceOnError = getConfig(this.config, \"forceOnError\") ?? false;\n this.ignoreHashAction = getConfig(this.config, \"ignoreHashAction\") ?? false\n }\n\n /** Sets the transition state to either true or false */\n public transitionStart() {\n this.isTransitioning = true;\n }\n\n public transitionStop() {\n this.isTransitioning = false;\n }\n\n public init() {\n /**\n * Bind the event listeners to the PJAX class\n *\n * @memberof PJAX\n */\n this.onHover = this.onHover.bind(this);\n this.onClick = this.onClick.bind(this);\n this.onStateChange = this.onStateChange.bind(this);\n }\n\n /** Starts the PJAX Service */\n public boot() {\n if (\"scrollRestoration\" in window.history) {\n // Back off, browser, I got this...\n window.history.scrollRestoration = \"manual\";\n }\n\n super.boot();\n }\n\n /** Gets the transition to use for a certain anchor */\n public getTransitionName(el: HTMLAnchorElement): string | null {\n if (!el || !el.getAttribute) return null;\n let transitionAttr = el.getAttribute(\n getConfig(this.config, \"transitionAttr\", false)\n );\n\n if (typeof transitionAttr === \"string\") return transitionAttr;\n return null;\n }\n\n /** Checks to see if the anchor is valid */\n public validLink(\n el: HTMLAnchorElement,\n event: LinkEvent | KeyboardEvent,\n href: string\n ): boolean {\n let pushStateSupport = !window.history.pushState;\n let exists = !el || !href;\n let eventMutate =\n (event as KeyboardEvent).metaKey ||\n (event as KeyboardEvent).ctrlKey ||\n (event as KeyboardEvent).shiftKey ||\n (event as KeyboardEvent).altKey;\n let newTab =\n el.hasAttribute(\"target\") &&\n (el as HTMLAnchorElement).target === \"_blank\";\n let crossOrigin =\n (el as HTMLAnchorElement).protocol !== location.protocol ||\n (el as HTMLAnchorElement).hostname !== location.hostname;\n let download = typeof el.getAttribute(\"download\") === \"string\";\n let preventSelf = el.matches(getConfig(this.config, \"preventSelfAttr\"));\n let preventAll = Boolean(\n el.closest(getConfig(this.config, \"preventAllAttr\"))\n );\n let sameURL = getHashedPath(newURL()) === getHashedPath(newURL(href));\n return !(\n exists ||\n pushStateSupport ||\n eventMutate ||\n newTab ||\n crossOrigin ||\n download ||\n preventSelf ||\n preventAll ||\n sameURL\n );\n }\n\n /** Returns the href of an Anchor element */\n public getHref(el: HTMLAnchorElement): string | null {\n if (\n el &&\n el.tagName &&\n el.tagName.toLowerCase() === \"a\" &&\n typeof el.href === \"string\"\n )\n return el.href;\n return null;\n }\n\n /** Check if event target is a valid anchor with an href, if so, return the anchor */\n public getLink(event: LinkEvent): HTMLAnchorElement {\n let el = event.target as HTMLAnchorElement;\n let href: string = this.getHref(el);\n\n while (el && !href) {\n el = (el as HTMLElement).parentNode as HTMLAnchorElement;\n href = this.getHref(el);\n }\n\n // Check for a valid link\n if (!el || !this.validLink(el, event, href)) return;\n return el;\n }\n\n /** When an element is clicked, get valid anchor element, go for a transition */\n public onClick(event: LinkEvent) {\n let el = this.getLink(event);\n if (!el) return;\n\n if (this.isTransitioning && this.stopOnTransitioning) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n let href = this.getHref(el);\n this.emitter.emit(\"ANCHOR_CLICK CLICK\", event);\n this.go({ href, trigger: el, event });\n }\n\n /** Returns the direction of the State change as a String, either the Back button or the Forward button */\n public getDirection(value: number): Trigger {\n if (Math.abs(value) > 1) {\n // Ex 6-0 > 0 -> forward, 0-6 < 0 -> back\n return value > 0 ? \"forward\" : \"back\";\n } else {\n if (value === 0) {\n return \"popstate\";\n } else {\n // Ex 6-5 > 0 -> back, 5-6 < 0 -> forward\n return value > 0 ? \"back\" : \"forward\";\n }\n }\n }\n\n /** Force a page to go to a certain URL */\n public force(href: string): void {\n window.location.assign(href);\n }\n\n /**\n * If transition is running force load page.\n * Stop if currentURL is the same as new url.\n * On state change, change the current state history, to reflect the direction of said state change\n * Load page and page transition.\n */\n public go({\n href,\n trigger = \"HistoryManager\",\n event,\n }: {\n href: string;\n trigger?: Trigger;\n event?: StateEvent;\n }): Promise {\n // If transition is already running and the go method is called again, force load page\n if (this.isTransitioning && this.stopOnTransitioning ||\n !(this.manager.has(\"TransitionManager\") &&\n this.manager.has(\"HistoryManager\") &&\n this.manager.has(\"PageManager\"))) {\n this.force(href);\n return;\n }\n\n const history = this.manager.get(\"HistoryManager\") as IHistoryManager;\n let scroll = newCoords(0, 0);\n let currentState = history.current;\n let currentURL = currentState.url;\n if (equal(currentURL, href)) {\n return;\n }\n\n let transitionName: string;\n if (event && (event as PopStateEvent).state) {\n this.emitter.emit(\"POPSTATE\", event);\n\n // If popstate, get back/forward direction.\n let { state }: { state: IHistoryItem } = event as PopStateEvent;\n let { index } = state;\n let currentIndex = currentState.index;\n let difference = currentIndex - index;\n\n history.replace(state.states);\n history.pointer = index;\n\n let _state = history.get(index);\n transitionName = _state.transition;\n scroll = _state.data.scroll;\n\n trigger = this.getDirection(difference);\n console.log(trigger == \"forward\" && history)\n\n // Based on the direction of the state change either remove or add a state\n this.emitter.emit(trigger === \"back\" ? `POPSTATE_BACK` : `POPSTATE_FORWARD`, event);\n } else {\n // Add new state\n transitionName = this.getTransitionName(trigger as HTMLAnchorElement);\n\n scroll = newCoords();\n let state = newState({\n url: href,\n transition: transitionName,\n data: { scroll },\n });\n\n !this.stickyScroll && (scroll = newCoords(0, 0));\n\n history.add(state);\n this.emitter.emit(\"HISTORY_NEW_ITEM\", event);\n }\n\n if (event) {\n event.stopPropagation();\n event.preventDefault();\n }\n\n this.emitter.emit(\"GO\", event);\n return this.load({\n oldHref: currentURL,\n href,\n trigger,\n transitionName,\n scroll,\n });\n }\n\n /** Load the new Page as well as a Transition; starts the Transition */\n public async load({\n oldHref,\n href,\n trigger,\n transitionName = \"default\",\n scroll = { x: 0, y: 0 },\n }: {\n oldHref: string;\n href: string;\n trigger: Trigger;\n transitionName?: string;\n scroll: { x: number; y: number };\n }): Promise {\n try {\n const pages = this.manager.get(\"PageManager\") as IPageManager;\n let newPage: IPage, oldPage: IPage;\n this.emitter.emit(\"NAVIGATION_START\", {\n oldHref,\n href,\n trigger,\n transitionName,\n });\n\n // Load & Build both the old and new pages\n try {\n this.transitionStart();\n oldPage = await pages.load(oldHref);\n !(oldPage.dom instanceof Element) && oldPage.build();\n\n this.emitter.emit(\"PAGE_LOADING\", { href, oldPage, trigger });\n newPage = await pages.load(href);\n await newPage.build();\n this.emitter.emit(\"PAGE_LOAD_COMPLETE\", {\n newPage,\n oldPage,\n trigger,\n });\n } catch (err) {\n console.warn(`[PJAX] Page load error: ${err}`);\n }\n\n // Transition Between Pages\n try {\n const TransitionManager = this.manager.get(\"TransitionManager\") as ITransitionManager;\n this.emitter.emit(\"TRANSITION_START\", transitionName);\n\n let transition = await TransitionManager.animate(TransitionManager.has(transitionName) ? transitionName : \"default\", {\n oldPage,\n newPage,\n trigger,\n scroll,\n ignoreHashAction: this.ignoreHashAction\n });\n\n if (!transition.scrollable) {\n if (!this.ignoreHashAction && !/back|popstate|forward/.test(trigger as string)) scroll = hashAction(scroll);\n window.scroll(scroll.x, scroll.y);\n }\n\n this.emitter.emit(\"TRANSITION_END\", { transition });\n } catch (err) {\n console.warn(`[PJAX] Transition error: ${err}`);\n }\n\n // Navigation is over\n this.emitter.emit(\"NAVIGATION_END\", {\n oldPage,\n newPage,\n trigger,\n transitionName,\n });\n } catch (err) {\n if (this.forceOnError) this.force(href);\n else console.warn(err);\n } finally {\n this.transitionStop(); // Sets isTransitioning to false\n }\n }\n\n /** Check to see if the URL is to be ignored, uses either RegExp of Strings to check */\n public ignoredURL({ pathname }: URL): boolean {\n return (\n this.ignoreURLs.length &&\n this.ignoreURLs.some((url) => {\n return typeof url === \"string\"\n ? url === pathname\n : (url as RegExp).exec(pathname) !== null;\n })\n );\n }\n\n /** When you hover over an anchor, prefetch the event target's href */\n public onHover(event: LinkEvent): Promise {\n let el = this.getLink(event);\n if (!el || !this.manager.has(\"PageManager\")) return;\n\n const pages = this.manager.get(\"PageManager\") as IPageManager;\n let url = newURL(this.getHref(el));\n let urlString: string = url.pathname;\n\n // If Url is ignored or already in cache, don't do any think\n if (this.ignoredURL(url) || pages.has(urlString)) return;\n this.emitter.emit(\"ANCHOR_HOVER HOVER\", event);\n\n try {\n pages.load(url);\n } catch (err) {\n console.warn(\"[PJAX] prefetch error,\", err);\n }\n }\n\n /** When History state changes, get url from State, go for a Transition. */\n public onStateChange(event: PopStateEvent): void {\n this.go({ href: window.location.href, trigger: \"popstate\", event });\n }\n\n /** Initialize DOM Events */\n public initEvents() {\n if (this.prefetchIgnore !== true) {\n document.addEventListener(\"mouseover\", this.onHover);\n document.addEventListener(\"touchstart\", this.onHover);\n }\n\n document.addEventListener(\"click\", this.onClick);\n window.addEventListener(\"popstate\", this.onStateChange);\n }\n\n /** Stop DOM Events */\n public stopEvents() {\n if (this.prefetchIgnore !== true) {\n document.removeEventListener(\"mouseover\", this.onHover);\n document.removeEventListener(\"touchstart\", this.onHover);\n }\n\n document.removeEventListener(\"click\", this.onClick);\n window.removeEventListener(\"popstate\", this.onStateChange);\n }\n}\n", "import { Service } from \"./service\";\nimport { Manager } from \"./manager\";\nimport { newURL, getHashedPath } from \"./url\";\nimport { IHistoryManager } from \"./history\";\n\nexport type RouteMethod = (...args: any) => any;\nexport type RouteStyle = string | RegExp | boolean;\nexport interface IRouteToFrom {\n to: RouteStyle,\n from: RouteStyle\n}\nexport type RoutePath = IRouteToFrom | RouteStyle;\nexport interface IRoute {\n path: RoutePath,\n method: RouteMethod\n}\n\n/** Controls what happens when certain url paths match a set of criteria */\nexport class Router extends Service {\n /** List of routes */\n protected routes: Manager;\n constructor(routes: IRoute[] = []) {\n super();\n this.routes = new Manager();\n for (let route of routes) {\n this.add(route);\n }\n }\n\n /** Add a new route to watch for */\n public add({ path, method }: IRoute): Router {\n let key = this.parse(path);\n this.routes.set(key, method);\n return this;\n }\n\n /** Convert strings into path match functions */\n public parsePath(path: RouteStyle): RegExp | boolean {\n if (typeof path === \"string\") return new RegExp(path, \"i\");\n else if (path instanceof RegExp || typeof path === \"boolean\")\n return path;\n throw \"[Router] only regular expressions, strings and booleans are accepted as paths.\";\n }\n\n /** Determines if a strings counts has a path */\n public isPath(input: RouteStyle): boolean {\n return (\n typeof input === \"string\" ||\n input instanceof RegExp ||\n typeof input === \"boolean\"\n );\n }\n\n /** Parse the multiple different formats for paths, into a { from, to } object */\n public parse(input: RoutePath): IRouteToFrom {\n let route = input as IRouteToFrom;\n let toFromPath: IRouteToFrom = {\n from: /(.*)/g,\n to: /(.*)/g,\n };\n\n if (this.isPath(input as RouteStyle))\n toFromPath = {\n from: true,\n to: input as RouteStyle,\n };\n else if (this.isPath(route.from) && this.isPath(route.to as RouteStyle))\n toFromPath = route;\n else\n throw \"[Router] path is neither a string, regular expression, or a { from, to } object.\";\n\n let { from, to } = toFromPath;\n return {\n from: this.parsePath(from),\n to: this.parsePath(to),\n };\n }\n\n /** Test if route paths are true, if so run their methods */\n public route() {\n if (this.manager.has(\"HistoryManager\")) {\n let history = this.manager.get(\"HistoryManager\") as IHistoryManager;\n let from: string = getHashedPath(newURL((history.length > 1 ? history.previous : history.current).url));\n let to: string = getHashedPath(newURL());\n\n this.routes.forEach((method: RouteMethod, path: IRouteToFrom) => {\n let fromRegExp = path.from as RegExp | boolean;\n let toRegExp = path.to as RegExp | boolean;\n\n if (\n typeof fromRegExp === \"boolean\" &&\n typeof toRegExp === \"boolean\"\n ) {\n throw `[Router] path ({ from: ${fromRegExp}, to: ${toRegExp} }) is not valid, remember paths can only be strings, regular expressions, or a boolean; however, both the from and to paths cannot be both booleans.`;\n }\n\n let fromParam: RegExpExecArray | RegExp | boolean = fromRegExp;\n let toParam: RegExpExecArray | RegExp | boolean = toRegExp;\n\n if (fromRegExp instanceof RegExp && fromRegExp.test(from))\n fromParam = fromRegExp.exec(from);\n if (toRegExp instanceof RegExp && toRegExp.test(to))\n toParam = toRegExp.exec(to);\n\n if (\n (Array.isArray(toParam) && Array.isArray(fromParam)) ||\n (Array.isArray(toParam) &&\n typeof fromParam == \"boolean\" &&\n fromParam) ||\n (Array.isArray(fromParam) &&\n typeof toParam == \"boolean\" &&\n toParam)\n )\n method({ from: fromParam, to: toParam, path: { from, to } });\n });\n } else {\n console.warn(\"[Route] HistoryManager is missing.\");\n }\n }\n\n /** Add listeners for PJAX Events */\n public initEvents() {\n this.emitter.on(\"READY\", this.route, this);\n this.emitter.on(\"CONTENT_REPLACED\", this.route, this);\n }\n\n /** Remove listeners for PJAX Events */\n public stopEvents() {\n this.emitter.off(\"READY\", this.route, this);\n this.emitter.off(\"CONTENT_REPLACED\", this.route, this);\n }\n}\n", "import { EventEmitter, EventInput, ListenerCallback } from \"@okikio/emitter\";\nimport { Manager } from \"@okikio/manager\";\n\n// DOM\nexport type AnimationTarget = string | Node | NodeList | HTMLCollection | HTMLElement[] | AnimationTarget[];\nexport const getElements = (selector: string | Node): Node[] => {\n return typeof selector === \"string\" ? Array.from(document.querySelectorAll(selector as string)) : [selector];\n};\n\nconst flatten = (arr: AnimationTarget[]) => [].concat(...arr);\nexport const getTargets = (targets: AnimationTarget): Node[] => {\n if (Array.isArray(targets)) {\n return flatten((targets as AnimationTarget[]).map(getTargets));\n }\n if (typeof targets == \"string\" || targets instanceof Node)\n return getElements(targets);\n if (targets instanceof NodeList || targets instanceof HTMLCollection)\n return Array.from(targets);\n return [];\n};\n\n// VALUES\nexport type closureArgs = [number, number, HTMLElement];\nexport type closure = ((index?: number, total?: number, element?: HTMLElement) => (genericTypes[] | void)) | any;\nexport const computeValue = (value: closure, args: closureArgs, context: Animate) => {\n if (typeof value === \"function\") {\n return value.apply(context, args);\n } else { return value; }\n};\n\nexport const mapObject = (obj: object, args: closureArgs, options: Animate): any => {\n let key: string, value: any, result = {};\n let keys = Object.keys(obj);\n for (let i = 0, len = keys.length; i < len; i++) {\n key = keys[i];\n value = obj[key];\n result[key] = computeValue(value, args, options);\n }\n\n return result;\n};\n\n/** From: [https://easings.net] */\nexport const easings = {\n \"in\": \"ease-in\",\n \"out\": \"ease-out\",\n \"in-out\": \"ease-in-out\",\n\n // Sine\n \"in-sine\": \"cubic-bezier(0.47, 0, 0.745, 0.715)\",\n \"out-sine\": \"cubic-bezier(0.39, 0.575, 0.565, 1)\",\n \"in-out-sine\": \"cubic-bezier(0.445, 0.05, 0.55, 0.95)\",\n\n // Quad\n \"in-quad\": \"cubic-bezier(0.55, 0.085, 0.68, 0.53)\",\n \"out-quad\": \"cubic-bezier(0.25, 0.46, 0.45, 0.94)\",\n \"in-out-quad\": \"cubic-bezier(0.455, 0.03, 0.515, 0.955)\",\n\n // Cubic\n \"in-cubic\": \"cubic-bezier(0.55, 0.055, 0.675, 0.19)\",\n \"out-cubic\": \"cubic-bezier(0.215, 0.61, 0.355, 1)\",\n \"in-out-cubic\": \"cubic-bezier(0.645, 0.045, 0.355, 1)\",\n\n // Quart\n \"in-quart\": \"cubic-bezier(0.895, 0.03, 0.685, 0.22)\",\n \"out-quart\": \"cubic-bezier(0.165, 0.84, 0.44, 1)\",\n \"in-out-quart\": \"cubic-bezier(0.77, 0, 0.175, 1)\",\n\n // Quint\n \"in-quint\": \"cubic-bezier(0.755, 0.05, 0.855, 0.06)\",\n \"out-quint\": \"cubic-bezier(0.23, 1, 0.32, 1)\",\n \"in-out-quint\": \"cubic-bezier(0.86, 0, 0.07, 1)\",\n\n // Expo\n \"in-expo\": \"cubic-bezier(0.95, 0.05, 0.795, 0.035)\",\n \"out-expo\": \"cubic-bezier(0.19, 1, 0.22, 1)\",\n \"in-out-expo\": \"cubic-bezier(1, 0, 0, 1)\",\n\n // Circ\n \"in-circ\": \"cubic-bezier(0.6, 0.04, 0.98, 0.335)\",\n \"out-circ\": \"cubic-bezier(0.075, 0.82, 0.165, 1)\",\n \"in-out-circ\": \"cubic-bezier(0.785, 0.135, 0.15, 0.86)\",\n\n // Back\n \"in-back\": \"cubic-bezier(0.6, -0.28, 0.735, 0.045)\",\n \"out-back\": \"cubic-bezier(0.175, 0.885, 0.32, 1.275)\",\n \"in-out-back\": \"cubic-bezier(0.68, -0.55, 0.265, 1.55)\"\n};\n\nexport const getEase = (ease: string) => {\n return /^(in|out)/.test(ease) ? easings[ease] : ease;\n};\n\nexport type genericTypes = genericTypes[] | boolean | object | string | number | closure | null | undefined;\nexport interface AnimationOptions {\n target?: AnimationTarget,\n\n speed?: number,\n autoplay?: boolean,\n options?: AnimationOptions,\n delay?: number | closure,\n easing?: string | closure,\n endDelay?: number | closure,\n duration?: number | closure,\n keyframes?: Keyframe[] | object[] | closure,\n loop?: number | boolean | closure, // iterations: number,\n onfinish?: (element?: HTMLElement, index?: number, total?: number, animation?: Animation) => any,\n fillMode?: \"none\" | \"forwards\" | \"backwards\" | \"both\" | \"auto\" | closure,\n direction?: \"normal\" | \"reverse\" | \"alternate\" | \"alternate-reverse\" | closure,\n extend?: EffectTiming,\n [property: string]: genericTypes;\n};\n\nexport const DefaultAnimationOptions: AnimationOptions = {\n keyframes: [],\n\n loop: 1, // iterations: number,\n delay: 0,\n speed: 1,\n endDelay: 0,\n easing: \"ease\",\n autoplay: true,\n duration: 1000,\n fillMode: \"auto\",\n direction: \"normal\",\n extend: {}\n};\n\nexport type AnimationEvents = \"update\" | \"play\" | \"pause\" | \"start\" | \"begin\" | \"complete\" | \"finish\" | \"error\" | \"stop\";\n\n/** You can check it out here: https://codepen.io/okikio/pen/qBbdGaW?editors=0011 */\nexport class Animate {\n /**\n * Stores the options for the current animation\n */\n public options: AnimationOptions = {};\n\n /**\n * The Array of Elements to Animate\n */\n public targets: Node[] = [];\n\n /**\n * The properties to animate\n */\n public properties: object = {};\n\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n\n /**\n * The total duration of all Animation's\n */\n public totalDuration: number = 0;\n\n /**\n * The smallest delay out of all Animation's\n */\n public minDelay: number = 0;\n\n /**\n * The options for individual animations\n */\n public computedOptions: Manager = new Manager();\n\n /**\n * The Element the main animation uses\n */\n public mainElement: HTMLElement;\n\n /**\n * Stores an animation that runs on the total duration of the all other Animations, and as such it's the main Animation\n */\n public mainAnimation: Animation;\n\n /**\n * Stores request frame calls\n */\n public animationFrame: number;\n\n /**\n * An event emitter\n */\n public emitter: EventEmitter = new EventEmitter();\n\n /**\n * Returns a promise that is fulfilled when the mainAnimation is finished\n */\n public promise: Promise;\n constructor(options: AnimationOptions = {}) {\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n\n /**\n * Returns a new Promise that is resolve when this.finish is called\n */\n public newPromise(): Promise {\n return new Promise((resolve, reject) => {\n /*\n Note that the `this` keyword is in an Array when it is resolved,\n this is due to Promises not wanting to resolve references,\n so, you can't resolve `this` directly, so, I chose to resolve `this` in an\n Array\n */\n this.on(\"complete\", () => resolve([this]));\n this.on(\"error\", err => reject(err));\n });\n }\n\n /**\n * Fulfills the this.promise Promise\n */\n public then(\n onFulfilled?: (value?: any) => any,\n onRejected?: (reason?: any) => any\n ): Animate {\n onFulfilled = onFulfilled?.bind(this);\n onRejected = onRejected?.bind(this);\n this.promise.then(onFulfilled, onRejected);\n return this;\n }\n\n /**\n * Catches error that occur in the this.promise Promise\n */\n public catch(onRejected: (reason?: any) => any): Animate {\n onRejected = onRejected?.bind(this);\n this.promise.catch(onRejected);\n return this;\n }\n\n /**\n * If you don't care if the this.promise Promise has either been rejected or resolved\n */\n public finally(onFinally: () => any): Animate {\n onFinally = onFinally?.bind(this);\n this.promise.finally(onFinally);\n return this;\n }\n\n /**\n * Represents an Animation Frame Loop\n */\n public loop(): void {\n this.stopLoop();\n this.emit(\"update\", this.getProgress(), this);\n this.animationFrame = window.requestAnimationFrame(this.loop);\n }\n\n /**\n * Cancels animation frame\n */\n public stopLoop() {\n window.cancelAnimationFrame(this.animationFrame);\n }\n\n /**\n * Calls a method that affects all animations including the mainAnimation; the method only allows the animation parameter\n */\n public all(method: (animation?: Animation, target?: HTMLElement) => void) {\n method(this.mainAnimation, this.mainElement);\n this.animations.forEach(method);\n return this;\n }\n\n /**\n * Register the begin event\n */\n protected beginEvent() {\n if (this.getProgress() == 0) {\n let timer: number | void = window.setTimeout(() => {\n this.emit(\"begin\", this);\n timer = window.clearTimeout(timer as number);\n }, this.minDelay);\n }\n }\n\n /**\n * Play Animation\n */\n public play(): Animate {\n let playstate = this.getPlayState();\n this.beginEvent();\n this.all(anim => anim.play());\n this.emit(\"play\", playstate, this);\n this.loop();\n return this;\n }\n\n /**\n * Pause Animation\n */\n public pause(): Animate {\n let playstate = this.getPlayState();\n this.all(anim => anim.pause());\n this.emit(\"pause\", playstate, this);\n this.stopLoop();\n this.animationFrame = undefined;\n return this;\n }\n\n /**\n * Reset all Animations\n */\n public reset() {\n this.setProgress(0);\n this.beginEvent();\n\n if (this.options.autoplay) this.play();\n else this.pause();\n return this;\n }\n\n /**\n * Cancels all Animations\n */\n public cancel() {\n this.all(anim => anim.cancel());\n this.stopLoop();\n return this;\n }\n\n /**\n * Force complete all Animations\n */\n public finish() {\n this.all(anim => anim.finish());\n this.stopLoop();\n return this;\n }\n\n /**\n * Cancels & Clears all Animations\n */\n public stop() {\n this.cancel();\n this.animations.clear();\n while (this.targets.length) this.targets.pop();\n this.mainElement = undefined;\n this.emit(\"stop\");\n }\n\n /**\n * Returns an Array of targets\n */\n public getTargets(): Node[] {\n return this.targets;\n }\n\n /**\n * Get a specific Animation from an Animate instance\n */\n public getAnimation(element: HTMLElement): Animation {\n return this.animations.get(element);\n }\n\n /**\n * Returns the timings of an Animation, given a target\n * E.g. { duration, endDelay, delay, iterations, iterationStart, direction, easing, fill, etc... }\n */\n public getTiming(target: HTMLElement | Animation): AnimationOptions & EffectTiming {\n let animation = target instanceof Animation ? target : this.getAnimation(target);\n let keyframeOptions = this.computedOptions.get(animation) ?? {};\n let timings = animation.effect?.getTiming() ?? {};\n let options = this.getOptions();\n\n return { ...DefaultAnimationOptions, ...options, ...timings, ...keyframeOptions };\n }\n\n /**\n * Returns the total duration of Animation\n */\n public getTotalDuration(): number {\n return this.totalDuration;\n }\n\n /**\n * Returns the current time of the Main Animation\n */\n public getCurrentTime(): number {\n return this.mainAnimation.currentTime;\n }\n\n /**\n * Returns the Animation progress as a fraction of the current time / duration * 100\n */\n public getProgress() {\n return (this.getCurrentTime() / this.totalDuration) * 100;\n }\n\n /**\n * Return the playback speed of the animation\n */\n public getSpeed(): number {\n return this.mainAnimation.playbackRate;\n }\n\n /**\n * Returns the current playing state\n */\n public getPlayState(): \"idle\" | \"running\" | \"paused\" | \"finished\" {\n return this.mainAnimation.playState;\n }\n\n /**\n * Get the options of an Animate instance\n */\n public getOptions(): AnimationOptions {\n return this.options;\n }\n\n /**\n * Set the current time of the Main Animation\n */\n public setCurrentTime(time: number): Animate {\n this.all(anim => { anim.currentTime = time; });\n this.emit(\"update\", this.getProgress());\n return this;\n }\n\n /**\n * Set the Animation progress as a value from 0 to 100\n */\n public setProgress(percent: number): Animate {\n let time = (percent / 100) * this.totalDuration;\n this.setCurrentTime(time);\n return this;\n }\n\n /**\n * Set the playback speed of an Animation\n */\n public setSpeed(speed: number = 1): Animate {\n this.all(anim => { anim.playbackRate = speed; });\n return this;\n }\n\n /**\n * Adds a listener for a given event\n */\n public on(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.on(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Removes a listener from an event\n */\n public off(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.off(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Call all listeners within an event\n */\n public emit(events: AnimationEvents | string | any[], ...args: any): Animate {\n this.emitter.emit(events, ...args);\n return this;\n }\n\n\n /** Returns the Animate options, as JSON */\n public toJSON(): AnimationOptions {\n return this.getOptions();\n }\n\n /**\n * The Symbol.toStringTag well-known symbol is a string valued property that is used\n * in the creation of the default string description of an object.\n * It is accessed internally by the Object.prototype.toString() method.\n */\n get [Symbol.toStringTag]() {\n return `Animate`;\n }\n}\n\n/** Creates a new Animate instance */\nexport const animate = (options: AnimationOptions = {}): Animate => {\n return new Animate(options);\n};\n\nexport class Timeline extends Animate {\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n constructor(options: AnimationOptions = {}) {\n super();\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n public add(options: AnimationOptions) {\n return this;\n }\n}\n\nexport default animate;", "export const toArr = (input: any): any[] => Array.from(input);\nexport default toArr;", "import { Service, animate } from \"../../../packages/native/src/api\";\nimport toArr from \"../toArr\";\n\nexport class IntroAnimation extends Service {\n public elements: Array;\n public rootElement: HTMLElement;\n\n public init() {\n super.init();\n\n // Elements\n this.elements = toArr(document.querySelectorAll('.intro-animation'));\n }\n\n public newPage() {\n this.init();\n this.prepareToShow();\n }\n\n public initEvents() {\n this.emitter.on(\"CONTENT_REPLACED\", this.newPage, this);\n this.emitter.on(\"BEFORE_TRANSITION_IN\", this.show, this);\n }\n\n public stopEvents() {\n this.emitter.off(\"CONTENT_REPLACED\", this.newPage, this);\n this.emitter.off(\"BEFORE_TRANSITION_IN\", this.show, this);\n }\n\n public stop() {\n requestAnimationFrame(() => {\n for (let el of this.elements) {\n (el as HTMLElement).style.opacity = '1';\n }\n });\n\n super.stop();\n }\n\n public prepareToShow() {\n requestAnimationFrame(() => {\n for (let el of this.elements) {\n (el as HTMLElement).style.opacity = '0';\n }\n });\n }\n\n public async show() {\n let [anim] = await animate({\n target: (this.elements as HTMLElement[]),\n opacity: [0, 1],\n // @ts-ignore\n delay(i: number) {\n return 300 * (i + 1);\n },\n onfinish(el: { style: { transform: string; opacity: string; }; }) {\n requestAnimationFrame(() => {\n el.style.opacity = \"1\";\n });\n },\n easing: \"ease\",\n duration: 850\n });\n anim.stop();\n return anim;\n }\n}\n", "import { ITransition, ITransitionData, animate } from \"../../../packages/native/src/api\";\n\n//== Transition\nexport const Fade: ITransition = {\n name: \"default\",\n duration: 500,\n scrollable: true,\n\n out({ from }: ITransitionData) {\n let { duration } = this;\n let fromWrapper = from.wrapper;\n return animate({\n target: fromWrapper,\n opacity: [1, 0],\n duration,\n }).on(\"finish\", function () {\n this.stop();\n });\n },\n\n in({ to, scroll }: ITransitionData) {\n let { duration } = this;\n let toWrapper = to.wrapper;\n\n window.scroll(scroll.x, scroll.y);\n return animate({\n target: toWrapper,\n opacity: [0, 1],\n duration\n }).then(function () {\n this.stop();\n });\n }\n};\n", "import { ITransition, ITransitionData, animate } from \"../../../packages/native/src/api\";\nimport toArr from \"../toArr\";\n\n//== Transitions\nexport const BigTransition: ITransition = {\n name: \"big\",\n delay: 200,\n durationPerAnimation: 700,\n scrollable: true,\n\n init() {\n this.mainElement = document.getElementById('big-transition');\n this.logoElement = this.mainElement.querySelector('.logo');\n this.horizontalElements = toArr(this.mainElement.querySelectorAll('#big-transition-horizontal div'));\n this.maxLength = this.horizontalElements.length;\n },\n\n out({ from, scroll }: ITransitionData) {\n let { durationPerAnimation: duration, delay } = this;\n let fromWrapper = from.wrapper;\n\n window.scroll(scroll.x, scroll.y);\n let wrapperStyle = Object.assign({}, fromWrapper.style);\n return new Promise(async resolve => {\n this.mainElement.style.opacity = \"1\";\n this.mainElement.style.visibility = \"visible\";\n let anim1 = animate({\n target: fromWrapper,\n opacity: [1, 0],\n duration,\n onfinish(el: { style: { opacity: string; }; }) {\n el.style.opacity = '0';\n }\n });\n\n anim1.then(function () { this.stop(); });\n\n let [anim2] = await animate({\n target: this.horizontalElements,\n keyframes: [\n { transform: \"scaleX(0)\" },\n { transform: \"scaleX(1)\" },\n ],\n // @ts-ignore\n delay(i: number) {\n return delay * (i + 1);\n },\n onfinish(el: { style: { transform: string; }; }) {\n el.style.transform = `scaleX(1)`;\n },\n easing: \"out-cubic\",\n duration: 500\n });\n\n fromWrapper.style.opacity = '1';\n Object.assign(fromWrapper.style, wrapperStyle);\n this.logoElement.style.visibility = \"visible\";\n\n let loaderDuration = 500;\n let [anim3] = await animate({\n target: this.logoElement,\n opacity: [0, 1],\n duration: loaderDuration,\n onfinish(el: { style: { opacity: string; }; }) {\n el.style.opacity = `1`;\n },\n });\n\n let [anim4] = await animate({\n options: anim3,\n opacity: [1, 0],\n onfinish(el: { style: { opacity: string; }; }) {\n el.style.opacity = `0`;\n },\n delay: 1500\n });\n this.logoElement.style.visibility = \"hidden\";\n // anim2.stop() // -> anim2.stop() Breaks the Animation\n anim3.stop();\n anim4.stop();\n resolve();\n });\n },\n\n in({ to, scroll }: ITransitionData) {\n let { durationPerAnimation: duration, delay } = this;\n let toWrapper = to.wrapper;\n\n window.scroll(scroll.x, scroll.y);\n return new Promise(async resolve => {\n let anim1 = animate({\n target: toWrapper,\n opacity: [0, 1],\n duration\n }).then(() => {\n anim1.stop();\n });\n\n let [anim2] = await animate({\n target: this.horizontalElements,\n keyframes: [\n { transform: \"scaleX(1)\" },\n { transform: \"scaleX(0)\" },\n ],\n // @ts-ignore\n delay(i: number) {\n return delay * (i + 1);\n },\n onfinish(el: { style: { transform: string; }; }) {\n el.style.transform = `scaleX(0)`;\n },\n easing: \"out-cubic\",\n duration: 500\n });\n\n this.mainElement.style.opacity = \"0\";\n this.mainElement.style.visibility = \"hidden\";\n anim2.stop();\n resolve();\n });\n }\n}\n", "import { ITransition, ITransitionData, animate } from \"../../../packages/native/src/api\";\n\n//== Transitions\nexport const Slide: ITransition = {\n name: \"slide\",\n duration: 500,\n direction: \"right\",\n scrollable: true,\n\n init(data: ITransition) {\n let trigger = (data.trigger as HTMLElement);\n if (trigger instanceof Node && trigger.hasAttribute(\"data-direction\")) {\n this.direction = trigger.getAttribute(\"data-direction\");\n } else {\n this.direction = \"right\";\n }\n },\n\n out({ from }: ITransitionData) {\n let { duration, direction } = this;\n let fromWrapper = from.wrapper;\n\n return animate({\n target: fromWrapper,\n keyframes: [\n { transform: \"translateX(0%)\", opacity: 1 },\n { transform: `translateX(${direction === \"left\" ? \"-\" : \"\"}25%)`, opacity: 0 },\n ],\n duration,\n easing: \"in-quint\"\n }).then(function () {\n this.stop();\n });\n },\n\n in({ to, scroll }: ITransitionData) {\n let { duration } = this;\n let toWrapper = to.wrapper;\n\n window.scroll(scroll.x, scroll.y);\n return animate({\n target: toWrapper,\n keyframes: [\n { transform: `translateX(${this.direction === \"right\" ? \"-\" : \"\"}25%)`, opacity: 0 },\n { transform: \"translateX(0%)\", opacity: 1 },\n ],\n duration,\n easing: \"out-quint\"\n }).then(function () {\n this.stop();\n });\n }\n};\n\nexport const SlideLeft: ITransition = {\n ...Slide,\n\n name: \"slide-left\",\n direction: \"left\",\n init(data: ITransition) { }\n};\n\nexport const SlideRight: ITransition = {\n ...Slide,\n\n name: \"slide-right\",\n direction: \"right\",\n init(data: ITransition) { }\n};\n", "import { Service, animate } from \"../../../packages/native/src/api\";\nimport { toArr } from \"../toArr\";\n\nexport class Navbar extends Service {\n public navbar: HTMLElement;\n public elements: HTMLElement[];\n public menu: HTMLElement;\n public collapseSection: HTMLElement;\n public navbarList: HTMLElement;\n toggleStatus: boolean;\n\n public init() {\n // Elements\n this.navbar = document.querySelector(\".navbar\") as HTMLElement;\n this.collapseSection = this.navbar.querySelector(\".navbar-collapse.mobile\") as HTMLElement;\n this.navbarList = this.navbar.querySelector(\".navbar-list\") as HTMLElement;\n this.elements = toArr(this.navbar.querySelectorAll(\".navbar-list a\"));\n this.menu = this.navbar.querySelector(\".navbar-toggle\") as HTMLElement;\n this.toggleStatus = false;\n\n this.toggleClick = this.toggleClick.bind(this);\n }\n\n public activateLink() {\n let { href } = window.location;\n\n for (let el of this.elements) {\n let itemHref =\n el.getAttribute(\"data-path\") ||\n (el as HTMLAnchorElement).href;\n if (!itemHref || itemHref.length < 1) return;\n\n let URLmatch = new RegExp(itemHref).test(href);\n let isActive = el.classList.contains(\"active\");\n if (!(URLmatch && isActive)) {\n el.classList.toggle(\"active\", URLmatch);\n }\n }\n }\n\n public toggleClick() {\n this.collapseSection.style?.setProperty?.(\"--height\", `${this.navbarList.clientHeight}px`);\n this.toggleStatus = !this.toggleStatus;\n this.collapseSection.classList.toggle(\"collapse\", !this.toggleStatus);\n this.collapseSection.classList.toggle(\"show\", this.toggleStatus);\n }\n\n public scroll() {\n this.navbar.classList.toggle(\"shadow\", window.scrollY >= 5);\n }\n\n public initEvents() {\n this.menu.addEventListener(\"click\", this.toggleClick);\n this.emitter.on(\"scroll\", this.scroll, this);\n this.emitter.on(\"READY\", this.activateLink, this);\n this.emitter.on(\"GO\", this.activateLink, this);\n }\n\n public stopEvents() {\n this.navbar.removeEventListener(\"click\", this.toggleClick);\n this.emitter.off(\"scroll\", this.scroll, this);\n this.emitter.off(\"READY\", this.activateLink, this);\n this.emitter.off(\"GO\", this.activateLink, this);\n }\n\n public uninstall() {\n while (this.elements.length) this.elements.pop();\n this.elements = undefined;\n this.menu = undefined;\n this.navbar = undefined;\n }\n}", "import { PJAX, App, TransitionManager, Router, HistoryManager, PageManager, animate, Animate } from \"@okikio/native\";\nimport { IntroAnimation } from \"./services/IntroAnimation\";\n\nimport { Fade } from \"./transitions/Fade\";\nimport { BigTransition } from \"./transitions/BigTransition\";\nimport { Slide, SlideLeft, SlideRight } from \"./transitions/Slide\";\n\nimport { toArr } from \"./toArr\";\nimport { Navbar } from \"./services/Navbar\";\n\nlet router: Router, pjax: PJAX;\nconst app: App = new App();\napp\n .add(new IntroAnimation())\n .set(\"HistoryManager\", new HistoryManager())\n .set(\"PageManager\", new PageManager())\n .set(\"TransitionManager\", new TransitionManager([\n [\"default\", Fade],\n [\"BigTransition\", BigTransition],\n [\"Slide\", Slide],\n [\"SlideLeft\", SlideLeft],\n [\"SlideRight\", SlideRight]\n ]))\n .add(new Navbar())\n .set(\"router\", router = new Router())\n .add(pjax = new PJAX());\n\ntry {\n router = app.get(\"router\") as Router;\n\n // This isn't nessceary, but it changes the nav link in focus depending on the page\n let navLink: HTMLElement[] = toArr(document.querySelectorAll(\".navbar .nav-link\"));\n for (let item of navLink) {\n let navItem = (item as HTMLAnchorElement);\n router.add({\n path: navItem.getAttribute(\"data-path\") || navItem.pathname,\n method() {\n let isActive = navItem.classList.contains(\"active\");\n if (!isActive) navItem.classList.add(\"active\");\n for (let nav of navLink) {\n if (nav !== navItem)\n nav.classList.remove(\"active\");\n }\n }\n });\n }\n\n router.add({\n path: /(index|\\/$)(\\.html)?/,\n method() { }\n });\n\n // app.on(\"AFTER_SPLASHSCREEN_HIDE\", () => {\n // anim?.play();\n // });\n\n app.boot();\n} catch (err) {\n console.warn(\"[App] boot failed,\", err);\n}\n"], + "mappings": "sgBAgBO,GAAM,IAA2B,CACpC,YAAa,UACb,eAAgB,eAChB,eAAgB,cAChB,QAAS,CACL,CAAC,YAAa,SAElB,gB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S,KAAO,GACZ,AAAI,IAAQ,GACR,EAAI,UAAU,OAAO,aAMzC,EAAO,IAAI,CACP,KAAM,uBACN,QAAS,KAOb,GAAI,aACC,EAAP,CACE,QAAQ,KAAK,qBAAsB", "names": [] } diff --git a/demo/other.html b/demo/other.html index 194d1f5..73613e8 100644 --- a/demo/other.html +++ b/demo/other.html @@ -1,4 +1,4 @@ -Other page

Other Page

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ex est, maximus aliquam sagittis vel, +Other page

Docs

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ex est, maximus aliquam sagittis vel, tempus vel odio. Praesent felis elit, blandit et laoreet nec, hendrerit et arcu. Aenean ligula sapien, sodales vel semper in, pulvinar id nulla. Donec pellentesque non tellus vel imperdiet. Pellentesque posuere, nisl sed rutrum tincidunt, augue augue vestibulum ex, vel ornare justo arcu eu magna. Praesent @@ -6,7 +6,21 @@ vel nisl enim. Aenean a odio porttitor, fermentum est et, mattis sem. Suspendiss aliquam vestibulum, eros ipsum pulvinar sem, quis posuere tellus ex id velit. Quisque eu pellentesque nisl, sed volutpat purus. Sed auctor convallis sapien sed hendrerit. Vivamus et neque facilisis, ultrices ex non, faucibus velit. Aliquam laoreet sed turpis a blandit. Nulla fringilla massa non -fermentum rutrum.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et +fermentum rutrum.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis +fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed +vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus +mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, +sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, +pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum +non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor +iaculis arcu ac rutrum. Suspendisse vel odio risus.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis +fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed +vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus +mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, +sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, +pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum +non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor +iaculis arcu ac rutrum. Suspendisse vel odio risus.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed @@ -20,7 +34,7 @@ pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor -iaculis arcu ac rutrum. Suspendisse vel odio risus.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et +iaculis arcu ac rutrum. Suspendisse vel odio risus.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed @@ -34,114 +48,7 @@ pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor -iaculis arcu ac rutrum. Suspendisse vel odio risus.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris -et ex mollis -fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam -commodo. Donec sed -vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, -nascetur ridiculus -mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae -elementum pharetra, -sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis -tellus maximus, -pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis -aliquet. Vestibulum -non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet -tortor. Duis auctor -iaculis arcu ac rutrum. Suspendisse vel odio risus.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris -et ex mollis -fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam -commodo. Donec sed -vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, -nascetur ridiculus -mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae -elementum pharetra, -sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis -tellus maximus, -pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis -aliquet. Vestibulum -non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet -tortor. Duis auctor -iaculis arcu ac rutrum. Suspendisse vel odio risus.

Cras mattis consectetur purus sit amet fermentum. Nulla vitae elit libero, a -pharetra augue. Sed -posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem -lacinia quam -venenatis vestibulum. Vestibulum id ligula porta felis euismod semper. Praesent -commodo cursus -magna, vel scelerisque nisl consectetur et.

Etiam porta sem malesuada magna mollis euismod. Cum sociis natoque penatibus et -magnis dis parturient -montes, nascetur ridiculus mus. Vivamus sagittis lacus vel augue laoreet rutrum -faucibus dolor -auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget -lacinia odio sem nec -elit. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Cras -justo odio, dapibus -ac facilisis in, egestas eget quam. -Donec ullamcorper nulla non metus auctor fringilla. Sed posuere consectetur est -at lobortis. Etiam -porta sem malesuada magna mollis euismod. Donec sed odio dui. Donec id elit non -mi porta gravida at -eget metus. Cras mattis consectetur purus sit amet fermentum.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris -et ex mollis -fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam -commodo. Donec sed -vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, -nascetur ridiculus -mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae -elementum pharetra, -sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis -tellus maximus, -pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis -aliquet. Vestibulum -non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet -tortor. Duis auctor -iaculis arcu ac rutrum. Suspendisse vel odio risus.

Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus -mus. Vivamus -sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Integer posuere -erat a ante venenatis -dapibus posuere velit aliquet. Curabitur blandit tempus porttitor. -Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta -felis euismod semper. -Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Nulla vitae -elit libero, a -pharetra augue. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, -eget lacinia odio -sem nec elit. -Cras justo odio, dapibus ac facilisis in, egestas eget quam. Nulla vitae elit -libero, a pharetra -augue. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Praesent -commodo cursus magna, -vel scelerisque nisl consectetur et.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris -et ex mollis -fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam -commodo. Donec sed -vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, -nascetur ridiculus -mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae -elementum pharetra, -sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis -tellus maximus, -pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis -aliquet. Vestibulum -non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet -tortor. Duis auctor -iaculis arcu ac rutrum. Suspendisse vel odio risus.

Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus -mus. Vivamus -sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Integer posuere -erat a ante venenatis -dapibus posuere velit aliquet. Curabitur blandit tempus porttitor. -Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta -felis euismod semper. -Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Nulla vitae -elit libero, a -pharetra augue. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, -eget lacinia odio -sem nec elit. -Cras justo odio, dapibus ac facilisis in, egestas eget quam. Nulla vitae elit -libero, a pharetra -augue. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Praesent -commodo cursus magna, -vel scelerisque nisl consectetur et.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris +iaculis arcu ac rutrum. Suspendisse vel odio risus.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed @@ -155,48 +62,4 @@ pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor -iaculis arcu ac rutrum. Suspendisse vel odio risus.

Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus -mus. Vivamus -sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Integer posuere -erat a ante venenatis -dapibus posuere velit aliquet. Curabitur blandit tempus porttitor. -Cras mattis consectetur purus sit amet fermentum. Vestibulum id ligula porta -felis euismod semper. -Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Nulla vitae -elit libero, a -pharetra augue. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, -eget lacinia odio -sem nec elit. -Cras justo odio, dapibus ac facilisis in, egestas eget quam. Nulla vitae elit -libero, a pharetra -augue. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Praesent -commodo cursus magna, -vel scelerisque nisl consectetur et.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis -fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed -vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus -mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, -sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, -pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum -non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor -iaculis arcu ac rutrum. Suspendisse vel odio risus.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis -fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed -vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus -mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, -sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, -pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum -non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor -iaculis arcu ac rutrum. Suspendisse vel odio risus.

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis -fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed -vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus -mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, -sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, -pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum -non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor -iaculis arcu ac rutrum. Suspendisse vel odio risus.

Lazyloaded img

Lazyloaded img

Vivamus dolor massa, aliquet ut leo vel, sodales mattis tortor. Aenean at mauris et ex mollis -fringilla. Sed volutpat viverra vehicula. Nullam maximus ligula ac nisl aliquam commodo. Donec sed -vestibulum orci. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus -mus. Proin ut porttitor lorem, sit amet aliquet dui. Nunc dictum, lorem vitae elementum pharetra, -sapien orci dignissim ligula, aliquam interdum erat urna a nibh. Morbi quis tellus maximus, -pellentesque erat ac, porttitor nulla. Curabitur rhoncus urna non magna mattis aliquet. Vestibulum -non lobortis turpis. Nunc aliquet velit a magna dictum pulvinar vitae laoreet tortor. Duis auctor -iaculis arcu ac rutrum. Suspendisse vel odio risus.

\ No newline at end of file +iaculis arcu ac rutrum. Suspendisse vel odio risus.

Lazyloaded imgLazyloaded img
\ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index cdfabc9..06c1b60 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -163,7 +163,7 @@ task("watch", async () => { } ); - watch(`${pugFolder}/**/*.pug`, series("html")); + watch(`${pugFolder}/**/*.pug`, parallel("html", "css")); watch([`${sassFolder}/**/*.scss`, `./tailwind.cjs`], series("css")); watch( [ diff --git a/old.scss b/old.scss deleted file mode 100644 index bc2ac03..0000000 --- a/old.scss +++ /dev/null @@ -1,256 +0,0 @@ - -/* -.div { - --size: 8vmin; - width: var(--size); - height: var(--size); - border-radius: 8%; - background: #616aff; -} - -.el, -.el-initial { - --size: 4vmin; - width: var(--size); - height: var(--size); - // border-radius: 8%; - margin: 5px; - background: #616aff; - position: relative; -} - -.svg { - margin: auto; - display: block; - width: 500px; - height: 300px; - max-height: 100vh; - max-width: 100%; - - & path { - stroke: #fff2b1; - stroke-dasharray: 400 400; - stroke-dashoffset: 0; - } -} - -.el-initial { - opacity: 0.6; - position: absolute; - display: block; - margin-top: 0; - top: 0; -} - -.animation-container { - transition: background-color 0.5s ease; - background-color: rgba(0, 0, 0, 0.085); - border-radius: 5px; - padding: 5px; - cursor: pointer; - - &:hover { - background-color: rgba(255, 255, 255, 0.25); - } -} - -.contain { - position: relative; -} - -.animation-container + .animation-container { - margin-top: 2em; -} - -input[type="range"] { - width: 100%; - padding: 0; - margin: 0; -} -html:not(.unsupported) .support { - display: none; -} - -p.fix { - line-height: 1; -} - -html { - // position: relative; - // min-height: 100%; -} - -.box-shadow { - box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.05); -} - -.text-white-50 { - color: rgba(255, 255, 255, 0.5); -} - -.spinner { - position: absolute; - z-index: 12; - top: 50%; - left: 50%; - width: 66px; - height: 66px; - margin-top: -33px; - margin-left: -33px; - animation: contanim 2s linear infinite; -} - -.spinner svg { - display: block; - margin: 0; - padding: 0; - width: 100%; - height: 100%; - left: 0; - top: 0; - position: absolute; - -webkit-transform: rotate(-90deg); - transform: rotate(-90deg); -} - -.spinner svg:nth-child(1) circle { - stroke: #84ebbd; - stroke-dasharray: 1, 300; - stroke-dashoffset: 0; - animation: strokeanim 3s calc(0.2s * (1)) ease infinite; - transform-origin: center center; -} - -.spinner svg:nth-child(2) circle { - stroke: #4977ec; - stroke-dasharray: 1, 300; - stroke-dashoffset: 0; - animation: strokeanim 3s calc(0.2s * (2)) ease infinite; - transform-origin: center center; -} - -.spinner svg:nth-child(3) circle { - stroke: #f6bb67; - stroke-dasharray: 1, 300; - stroke-dashoffset: 0; - animation: strokeanim 3s calc(0.2s * (3)) ease infinite; - transform-origin: center center; -} - -.spinner svg:nth-child(4) circle { - stroke: #ff5050; - stroke-dasharray: 1, 300; - stroke-dashoffset: 0; - animation: strokeanim 3s calc(0.2s * (4)) ease infinite; - transform-origin: center center; -} - -// @-webkit-keyframes strokeanim { -// 0% { -// stroke-dasharray: 1, 300; -// stroke-dashoffset: 0; -// } - -// 50% { -// stroke-dasharray: 120, 300; -// stroke-dashoffset: -58.548324585; -// } - -// 100% { -// stroke-dasharray: 120, 300; -// stroke-dashoffset: -175.6449737549; -// } -// } - -@keyframes strokeanim { - 0% { - stroke-dasharray: 1, 300; - stroke-dashoffset: 0; - } - - 50% { - stroke-dasharray: 120, 300; - stroke-dashoffset: -58.548324585; - } - - 100% { - stroke-dasharray: 120, 300; - stroke-dashoffset: -175.6449737549; - } -} - -// @-webkit-keyframes contanim { -// 100% { -// -webkit-transform: rotate(360deg); -// transform: rotate(360deg); -// } -// } - -@keyframes contanim { - 100% { - -webkit-transform: rotate(360deg); - transform: rotate(360deg); - } -} - -#big-transition { - position: fixed; - z-index: 2000; - top: 0; - left: 0; - right: 0; - bottom: 0; - display: flex; - opacity: 0; - visibility: hidden; -} - -#big-transition .spinner { - opacity: 0; - visibility: hidden; -} - -#big-transition #big-transition-horizontal { - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - display: flex; -} - -#big-transition #big-transition-horizontal { - flex-flow: column; -} - -#big-transition #big-transition-horizontal > div { - width: 100%; - flex: 1 1; - background: #fff; - transform-origin: 0 0; - transform: scaleX(0); -} - -.footer { - // position: absolute; - position: relative; - bottom: 0; - width: 100%; - height: 60px; - line-height: 60px; - background-color: #f5f5f5; -} - -main { - overflow: hidden; -} - -// [data-block="IntroBlock"] { -// transition: transform .5s ease, opacity .5s ease; - -// &.active { -// transform: translateX(0%) !important; -// opacity: 1 !important; -// } -// } -*/ diff --git a/packages/animate/@types/api.d.ts b/packages/animate/@types/api.d.ts index c3f65f9..02eb5e6 100644 --- a/packages/animate/@types/api.d.ts +++ b/packages/animate/@types/api.d.ts @@ -136,7 +136,7 @@ export declare class Animate { /** * Calls a method that affects all animations including the mainAnimation; the method only allows the animation parameter */ - all(method: (animation: Animation) => void): this; + all(method: (animation?: Animation, target?: HTMLElement) => void): this; /** * Register the begin event */ @@ -237,4 +237,12 @@ export declare class Animate { } /** Creates a new Animate instance */ export declare const animate: (options?: AnimationOptions) => Animate; +export declare class Timeline extends Animate { + /** + * A Manager of Animations + */ + animations: Manager; + constructor(options?: AnimationOptions); + add(options: AnimationOptions): this; +} export default animate; diff --git a/packages/native/lib/api.cjs.js b/packages/native/lib/api.cjs.js index a6ddc65..dfd8c0f 100644 --- a/packages/native/lib/api.cjs.js +++ b/packages/native/lib/api.cjs.js @@ -1,3 +1,3 @@ -var Z=Object.defineProperty;var gt=r=>Z(r,"__esModule",{value:!0});var ft=(r,t)=>{for(var e in t)Z(r,e,{get:t[e],enumerable:!0})};gt(exports);ft(exports,{AdvancedManager:()=>k,Animate:()=>M,App:()=>lt,CONFIG_DEFAULTS:()=>tt,DefaultAnimationOptions:()=>V,Event:()=>R,EventEmitter:()=>O,HistoryManager:()=>rt,Manager:()=>g,ManagerItem:()=>S,PARSER:()=>st,PJAX:()=>pt,Page:()=>U,PageManager:()=>ot,Router:()=>ct,Service:()=>y,ServiceManager:()=>_,Timeline:()=>mt,TransitionManager:()=>at,animate:()=>At,asyncMethodCall:()=>it,changeState:()=>nt,clean:()=>X,computeValue:()=>j,easings:()=>ht,equal:()=>N,getConfig:()=>h,getEase:()=>Q,getElements:()=>ut,getHash:()=>bt,getHashedPath:()=>E,getTargets:()=>F,hashAction:()=>z,mapObject:()=>K,methodCall:()=>v,newConfig:()=>W,newCoords:()=>w,newListener:()=>J,newState:()=>D,newURL:()=>c,toAttr:()=>et});var tt={wrapperAttr:"wrapper",noAjaxLinkAttr:"no-ajax-link",noPrefetchAttr:"no-prefetch",headers:[["x-partial","true"]],preventSelfAttr:'prevent="self"',preventAllAttr:'prevent="all"',transitionAttr:"transition",blockAttr:"block",timeout:3e4,maxPages:5},W=r=>Object.assign({...tt},r),et=(r,t,e=!0)=>{let{prefix:i}=r,n=`data${i?"-"+i:""}-${t}`;return e?`[${n}]`:n},h=(r,t,e=!0)=>{if(typeof t!="string")return r;let i=r[t];return typeof i=="string"?et(r,i,e):i};var g=class{constructor(t){this.map=new Map(t)}getMap(){return this.map}get(t){return this.map.get(t)}keys(){return Array.from(this.map.keys())}values(){return Array.from(this.map.values())}set(t,e){return this.map.set(t,e),this}add(t){let i=this.size;return this.set(i,t),this}get size(){return this.map.size}get length(){return this.map.size}last(t=1){let e=this.keys()[this.size-t];return this.get(e)}delete(t){return this.map.delete(t)}remove(t){return this.map.delete(t),this}clear(){return this.map.clear(),this}has(t){return this.map.has(t)}entries(){return this.map.entries()}forEach(t,e){return this.map.forEach(t,e),this}[Symbol.iterator](){return this.entries()}},v=(r,t,...e)=>{r.forEach(i=>{i[t](...e)})},it=async(r,t,...e)=>{for(let[,i]of r)await i[t](...e)};var S=class{constructor(){}install(){}register(t,e){return this.manager=t,this.app=t.app,this.config=t.config,this.emitter=t.emitter,this.key=e,this.install(),this}uninstall(){}unregister(){this.uninstall(),this.manager.remove(this.key),this.key=void 0,this.manager=void 0,this.app=void 0,this.config=void 0,this.emitter=void 0}},k=class extends g{constructor(t){super();this.app=t,this.config=t.config,this.emitter=t.emitter}set(t,e){return super.set(t,e),e.register(this,t),this}};var c=(r=window.location.href)=>r instanceof URL?r:new URL(r,window.location.origin),E=r=>{let t=c(r);return`${t.pathname}${t.hash}`},bt=r=>c(r).hash.slice(1),X=r=>c(r).toString().replace(/(\/#.*|\/|#.*)$/,""),N=(r,t)=>X(r)===X(t);var y=class extends S{init(){}boot(){this.initEvents()}initEvents(){}stopEvents(){}stop(){this.stopEvents(),this.unregister()}},_=class extends k{constructor(t){super(t)}init(){return v(this,"init"),this}boot(){return v(this,"boot"),this}stop(){return v(this,"stop"),this}};var w=(r=window.scrollX,t=window.scrollY)=>({x:r,y:t}),D=(r={url:E(c()),index:0,transition:"default",data:{scroll:w(),trigger:"HistoryManager"}})=>r,rt=class extends y{constructor(){super(...arguments);this.pointer=-1}init(){this.states=[];let t=D();this.add(t,"replace")}get(t){return this.states[t]}add(t,e="push"){let i=D(t),n=this.length;this.states.push({...i}),this.pointer=n;let s={index:this.pointer,states:[...this.states]};return nt(e,i,s),this}remove(t){return t?this.states.splice(t,1):this.states.pop(),this.pointer--,this}replace(t){return this.states=t,this}set(t,e){return this.states[t]=e}get current(){return this.get(this.pointer)}get last(){return this.get(this.length-1)}get previous(){return this.pointer<1?null:this.get(this.pointer-1)}get length(){return this.states.length}},nt=(r,t,e)=>{let i=E(t.url),n=[e,"",i];if(window.history)switch(r){case"push":window.history.pushState.apply(window.history,n);break;case"replace":window.history.replaceState.apply(window.history,n);break}};var st=new DOMParser,U=class extends S{constructor(t=c(),e=document){super();this.url=t,typeof e=="string"?this.data=e:this.dom=e||document}build(){if(this.dom instanceof Node||(this.dom=st.parseFromString(this.data,"text/html")),!(this.body instanceof Node)){let{title:t,head:e,body:i}=this.dom;this.title=t,this.head=e,this.body=i,this.wrapper=this.body.querySelector(this.wrapperAttr)}}install(){this.wrapperAttr=h(this.config,"wrapperAttr")}uninstall(){this.url=void 0,this.title=void 0,this.head=void 0,this.body=void 0,this.dom=void 0,this.wrapper=void 0,this.data=void 0,this.wrapperAttr=void 0}},ot=class extends y{constructor(){super(...arguments);this.loading=new g}install(){this.pages=new k(this.app);let t=c().pathname;this.set(t,new U),t=void 0}get(t){return this.pages.get(t)}add(t){return this.pages.add(t),this}set(t,e){return this.pages.set(t,e),this}remove(t){return this.pages.remove(t),this}has(t){return this.pages.has(t)}clear(){return this.pages.clear(),this}get size(){return this.pages.size}keys(){return this.pages.keys()}async load(t=c()){let e=c(t),i=e.pathname,n,s;if(this.has(i))return n=this.get(i),Promise.resolve(n);this.loading.has(i)?s=this.loading.get(i):(s=this.request(i),this.loading.set(i,s));let a=await s;if(this.loading.remove(i),n=new U(e,a),this.set(i,n),this.size>h(this.config,"maxPages")){let l=c(),o=this.keys(),p=N(l,o[0])?o[1]:o[0],f=this.get(p);f.unregister(),f=void 0,o=void 0,l=void 0,p=void 0}return n}async request(t){let e=new Headers(h(this.config,"headers")),i=window.setTimeout(()=>{throw window.clearTimeout(i),"Request Timed Out!"},h(this.config,"timeout"));try{let n=await fetch(t,{mode:"same-origin",method:"GET",headers:e,cache:"default",credentials:"same-origin"});if(window.clearTimeout(i),n.status>=200&&n.status<300)return await n.text();throw new Error(n.statusText||""+n.status)}catch(n){throw window.clearTimeout(i),n}}};var J=({callback:r=()=>{},scope:t=null,name:e="event"})=>({callback:r,scope:t,name:e}),R=class extends g{constructor(t="event"){super();this.name=t}},O=class extends g{constructor(){super()}getEvent(t){let e=this.get(t);return e instanceof R?e:(this.set(t,new R(t)),this.get(t))}newListener(t,e,i){let n=this.getEvent(t);return n.add(J({name:t,callback:e,scope:i})),n}on(t,e,i){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let n,s,a=typeof t=="object"&&!Array.isArray(t),l=a?e:i;return a||(s=e),Object.keys(t).forEach(o=>{a?(n=o,s=t[o]):n=t[o],this.newListener(n,s,l)},this),this}removeListener(t,e,i){let n=this.get(t);if(n instanceof R&&e){let s=J({name:t,callback:e,scope:i});n.forEach((a,l)=>{if(a.callback===s.callback&&a.scope===s.scope)return n.remove(l)})}return n}off(t,e,i){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let n,s,a=typeof t=="object"&&!Array.isArray(t),l=a?e:i;return a||(s=e),Object.keys(t).forEach(o=>{a?(n=o,s=t[o]):n=t[o],typeof s=="function"?this.removeListener(n,s,l):this.remove(n)},this),this}emit(t,...e){return typeof t=="undefined"?this:(typeof t=="string"&&(t=t.trim().split(/\s/g)),t.forEach(i=>{let n=this.get(i);n instanceof R&&n.forEach(s=>{let{callback:a,scope:l}=s;a.apply(l,e)})},this),this)}clear(){return v(this,"clear"),super.clear(),this}};var z=(r,t=window.location.hash)=>{try{let e=t[0]=="#"?t:c(t).hash;if(e.length>1){let i=document.getElementById(e.slice(1));if(i){let{left:n,top:s}=i.getBoundingClientRect(),a=window.pageXOffset,l=window.pageYOffset,o=n+a,p=s+l;return console.log(o,p),w(o,p)}}}catch(e){console.warn("[hashAction] error",e)}return r??w(0,0)},dt={name:"default",scrollable:!0,out({done:r}){r()},in({scroll:r,done:t}){window.scroll(r.x,r.y),t()}},at=class extends y{constructor(t){super();this._arg=t}install(){super.install();let t=this._arg&&this._arg.length?this._arg:h(this.config,"transitions")??[];t=[["default",dt]].concat(t),this.transitions=new g(t)}get(t){return this.transitions.get(t)}set(t,e){return this.transitions.set(t,e),this}add(t){return this.transitions.add(t),this}has(t){return this.transitions.has(t)}async animate(t,e){let i=this.transitions.get(t),n=e.scroll,s=e.ignoreHashAction;if(!("wrapper"in e.oldPage)||!("wrapper"in e.newPage))throw`[Page] either oldPage or newPage aren't instances of the Page Class. - ${{newPage:e.newPage,oldPage:e.oldPage}}`;document.title=""+e.newPage.title;let a=e.oldPage.wrapper,l=e.newPage.wrapper;if(!(a instanceof Node)||!(l instanceof Node))throw`[Wrapper] the wrapper from the ${l instanceof Node?"current":"next"} page cannot be found. The wrapper must be an element that has the attribute ${h(this.config,"wrapperAttr")}.`;return i.init&&i?.init(e),this.emitter.emit("BEFORE_TRANSITION_OUT"),i.out&&await new Promise(o=>{i.out.call(i,{...e,from:e.oldPage,trigger:e.trigger,done:o})?.then(o)}),this.emitter.emit("AFTER_TRANSITION_OUT"),await new Promise(o=>{a.insertAdjacentElement("beforebegin",l),this.emitter.emit("CONTENT_INSERT"),!s&&!/back|popstate|forward/.test(e.trigger)&&(n=z(n)),o()}),await new Promise(o=>{a.remove(),a=void 0,l=void 0,this.emitter.emit("CONTENT_REPLACED"),o()}),this.emitter.emit("BEFORE_TRANSITION_IN"),i.in&&await new Promise(async o=>{i.in.call(i,{...e,from:e.oldPage,to:e.newPage,trigger:e.trigger,scroll:n,done:o})?.then(o)}),this.emitter.emit("AFTER_TRANSITION_IN"),i}};var lt=class{constructor(t={}){this.register(t)}register(t={}){this.config=W(t),this.emitter=new O,this.services=new _(this);let e=(()=>{document.removeEventListener("DOMContentLoaded",e),window.removeEventListener("load",e),this.emitter.emit("READY ready")}).bind(this);return document.addEventListener("DOMContentLoaded",e),window.addEventListener("load",e),this}get(t){return this.services.get(t)}set(t,e){return this.services.set(t,e),this}add(t){return this.services.add(t),this}boot(){return this.services.init(),this.services.boot(),this}stop(){return this.services.stop(),this.emitter.clear(),this}on(t,e){return this.emitter.on(t,e,this),this}off(t,e){return this.emitter.off(t,e,this),this}emit(t,...e){return this.emitter.emit(t,...e),this}};var pt=class extends y{install(){super.install(),this.ignoreURLs=h(this.config,"ignoreURLs")??[],this.prefetchIgnore=h(this.config,"prefetchIgnore")??!1,this.stopOnTransitioning=h(this.config,"stopOnTransitioning")??!1,this.stickyScroll=h(this.config,"stickyScroll")??!1,this.forceOnError=h(this.config,"forceOnError")??!1,this.ignoreHashAction=h(this.config,"ignoreHashAction")??!1}transitionStart(){this.isTransitioning=!0}transitionStop(){this.isTransitioning=!1}init(){this.onHover=this.onHover.bind(this),this.onClick=this.onClick.bind(this),this.onStateChange=this.onStateChange.bind(this)}boot(){"scrollRestoration"in window.history&&(window.history.scrollRestoration="manual"),super.boot()}getTransitionName(t){if(!t||!t.getAttribute)return null;let e=t.getAttribute(h(this.config,"transitionAttr",!1));return typeof e=="string"?e:null}validLink(t,e,i){let n=!window.history.pushState,s=!t||!i,a=e.metaKey||e.ctrlKey||e.shiftKey||e.altKey,l=t.hasAttribute("target")&&t.target==="_blank",o=t.protocol!==location.protocol||t.hostname!==location.hostname,p=typeof t.getAttribute("download")=="string",f=t.matches(h(this.config,"preventSelfAttr")),P=Boolean(t.closest(h(this.config,"preventAllAttr"))),T=E(c())===E(c(i));return!(s||n||a||l||o||p||f||P||T)}getHref(t){return t&&t.tagName&&t.tagName.toLowerCase()==="a"&&typeof t.href=="string"?t.href:null}getLink(t){let e=t.target,i=this.getHref(e);for(;e&&!i;)e=e.parentNode,i=this.getHref(e);if(!(!e||!this.validLink(e,t,i)))return e}onClick(t){let e=this.getLink(t);if(!e)return;if(this.isTransitioning&&this.stopOnTransitioning){t.preventDefault(),t.stopPropagation();return}let i=this.getHref(e);this.emitter.emit("ANCHOR_CLICK CLICK",t),this.go({href:i,trigger:e,event:t})}getDirection(t){return Math.abs(t)>1?t>0?"forward":"back":t===0?"popstate":t>0?"back":"forward"}force(t){window.location.assign(t)}go({href:t,trigger:e="HistoryManager",event:i}){if(this.isTransitioning&&this.stopOnTransitioning||!(this.manager.has("TransitionManager")&&this.manager.has("HistoryManager")&&this.manager.has("PageManager"))){this.force(t);return}let n=this.manager.get("HistoryManager"),s=w(0,0),a=n.current,l=a.url;if(N(l,t))return;let o;if(i&&i.state){this.emitter.emit("POPSTATE",i);let{state:p}=i,{index:f}=p,T=a.index-f;n.replace(p.states),n.pointer=f;let x=n.get(f);o=x.transition,s=x.data.scroll,e=this.getDirection(T),console.log(e=="forward"&&n),this.emitter.emit(e==="back"?"POPSTATE_BACK":"POPSTATE_FORWARD",i)}else{o=this.getTransitionName(e),s=w();let p=D({url:t,transition:o,data:{scroll:s}});!this.stickyScroll&&(s=w(0,0)),n.add(p),this.emitter.emit("HISTORY_NEW_ITEM",i)}return i&&(i.stopPropagation(),i.preventDefault()),this.emitter.emit("GO",i),this.load({oldHref:l,href:t,trigger:e,transitionName:o,scroll:s})}async load({oldHref:t,href:e,trigger:i,transitionName:n="default",scroll:s={x:0,y:0}}){try{let a=this.manager.get("PageManager"),l,o;this.emitter.emit("NAVIGATION_START",{oldHref:t,href:e,trigger:i,transitionName:n});try{this.transitionStart(),o=await a.load(t),!(o.dom instanceof Element)&&o.build(),this.emitter.emit("PAGE_LOADING",{href:e,oldPage:o,trigger:i}),l=await a.load(e),await l.build(),this.emitter.emit("PAGE_LOAD_COMPLETE",{newPage:l,oldPage:o,trigger:i})}catch(p){console.warn(`[PJAX] Page load error: ${p}`)}try{let p=this.manager.get("TransitionManager");this.emitter.emit("TRANSITION_START",n);let f=await p.animate(p.has(n)?n:"default",{oldPage:o,newPage:l,trigger:i,scroll:s,ignoreHashAction:this.ignoreHashAction});f.scrollable||(!this.ignoreHashAction&&!/back|popstate|forward/.test(i)&&(s=z(s)),window.scroll(s.x,s.y)),this.emitter.emit("TRANSITION_END",{transition:f})}catch(p){console.warn(`[PJAX] Transition error: ${p}`)}this.emitter.emit("NAVIGATION_END",{oldPage:o,newPage:l,trigger:i,transitionName:n})}catch(a){this.forceOnError?this.force(e):console.warn(a)}finally{this.transitionStop()}}ignoredURL({pathname:t}){return this.ignoreURLs.length&&this.ignoreURLs.some(e=>typeof e=="string"?e===t:e.exec(t)!==null)}onHover(t){let e=this.getLink(t);if(!e||!this.manager.has("PageManager"))return;let i=this.manager.get("PageManager"),n=c(this.getHref(e)),s=n.pathname;if(!(this.ignoredURL(n)||i.has(s))){this.emitter.emit("ANCHOR_HOVER HOVER",t);try{i.load(n)}catch(a){console.warn("[PJAX] prefetch error,",a)}}}onStateChange(t){this.go({href:window.location.href,trigger:"popstate",event:t})}initEvents(){this.prefetchIgnore!==!0&&(document.addEventListener("mouseover",this.onHover),document.addEventListener("touchstart",this.onHover)),document.addEventListener("click",this.onClick),window.addEventListener("popstate",this.onStateChange)}stopEvents(){this.prefetchIgnore!==!0&&(document.removeEventListener("mouseover",this.onHover),document.removeEventListener("touchstart",this.onHover)),document.removeEventListener("click",this.onClick),window.removeEventListener("popstate",this.onStateChange)}};var ct=class extends y{constructor(t=[]){super();this.routes=new g;for(let e of t)this.add(e)}add({path:t,method:e}){let i=this.parse(t);return this.routes.set(i,e),this}parsePath(t){if(typeof t=="string")return new RegExp(t,"i");if(t instanceof RegExp||typeof t=="boolean")return t;throw"[Router] only regular expressions, strings and booleans are accepted as paths."}isPath(t){return typeof t=="string"||t instanceof RegExp||typeof t=="boolean"}parse(t){let e=t,i={from:/(.*)/g,to:/(.*)/g};if(this.isPath(t))i={from:!0,to:t};else if(this.isPath(e.from)&&this.isPath(e.to))i=e;else throw"[Router] path is neither a string, regular expression, or a { from, to } object.";let{from:n,to:s}=i;return{from:this.parsePath(n),to:this.parsePath(s)}}route(){if(this.manager.has("HistoryManager")){let t=this.manager.get("HistoryManager"),e=E(c((t.length>1?t.previous:t.current).url)),i=E(c());this.routes.forEach((n,s)=>{let a=s.from,l=s.to;if(typeof a=="boolean"&&typeof l=="boolean")throw`[Router] path ({ from: ${a}, to: ${l} }) is not valid, remember paths can only be strings, regular expressions, or a boolean; however, both the from and to paths cannot be both booleans.`;let o=a,p=l;a instanceof RegExp&&a.test(e)&&(o=a.exec(e)),l instanceof RegExp&&l.test(i)&&(p=l.exec(i)),(Array.isArray(p)&&Array.isArray(o)||Array.isArray(p)&&typeof o=="boolean"&&o||Array.isArray(o)&&typeof p=="boolean"&&p)&&n({from:o,to:p,path:{from:e,to:i}})})}else console.warn("[Route] HistoryManager is missing.")}initEvents(){this.emitter.on("READY",this.route,this),this.emitter.on("CONTENT_REPLACED",this.route,this)}stopEvents(){this.emitter.off("READY",this.route,this),this.emitter.off("CONTENT_REPLACED",this.route,this)}};var ut=r=>typeof r=="string"?Array.from(document.querySelectorAll(r)):[r],yt=r=>[].concat(...r),F=r=>Array.isArray(r)?yt(r.map(F)):typeof r=="string"||r instanceof Node?ut(r):r instanceof NodeList||r instanceof HTMLCollection?Array.from(r):[],j=(r,t,e)=>typeof r=="function"?r.apply(e,t):r,K=(r,t,e)=>{let i,n,s={},a=Object.keys(r);for(let l=0,o=a.length;l/^(in|out)/.test(r)?ht[r]:r,V={keyframes:[],loop:1,delay:0,speed:1,endDelay:0,easing:"ease",autoplay:!0,duration:1e3,fillMode:"auto",direction:"normal",extend:{}},M=class{constructor(t={}){this.options={};this.targets=[];this.properties={};this.animations=new g;this.totalDuration=0;this.minDelay=0;this.computedOptions=new g;this.emitter=new O;try{let{options:e,...i}=t,n=e instanceof M?e.getOptions():Array.isArray(e)?e?.[0]?.getOptions():e;this.options=Object.assign({},V,n,i),this.loop=this.loop.bind(this);let{loop:s,delay:a,speed:l,easing:o,endDelay:p,duration:f,direction:P,fillMode:T,onfinish:x,target:G,keyframes:q,autoplay:$,extend:B,...Y}=this.options;this.mainElement=document.createElement("div"),this.targets=F(G),this.properties=Y;let C=[],d=this.targets.length,I;for(let m=0;m0||(I=K(I,[m,d,b],this));let H=u.delay+u.duration*u.iterations+u.endDelay;this.totalDuration{typeof x=="function"&&x.call(this,b,m,d,A),this.emit("finish",b,m,d,A)},this.computedOptions.set(A,u),this.animations.set(b,A),C.push(u.delay)}this.mainAnimation=this.mainElement.animate([{opacity:"0"},{opacity:"1"}],{duration:this.totalDuration,easing:"linear"}),this.minDelay=Math.min(...C),this.setSpeed(l),$?this.play():this.pause(),this.promise=this.newPromise(),this.mainAnimation.onfinish=()=>{this.emit("complete",this),this.stopLoop()}}catch(e){this.emit("error",e)}}newPromise(){return new Promise((t,e)=>{this.on("complete",()=>t([this])),this.on("error",i=>e(i))})}then(t,e){return t=t?.bind(this),e=e?.bind(this),this.promise.then(t,e),this}catch(t){return t=t?.bind(this),this.promise.catch(t),this}finally(t){return t=t?.bind(this),this.promise.finally(t),this}loop(){this.stopLoop(),this.emit("update",this.getProgress(),this),this.animationFrame=window.requestAnimationFrame(this.loop)}stopLoop(){window.cancelAnimationFrame(this.animationFrame)}all(t){return t(this.mainAnimation,this.mainElement),this.animations.forEach(t),this}beginEvent(){if(this.getProgress()==0){let t=window.setTimeout(()=>{this.emit("begin",this),t=window.clearTimeout(t)},this.minDelay)}}play(){let t=this.getPlayState();return this.beginEvent(),this.all(e=>e.play()),this.emit("play",t,this),this.loop(),this}pause(){let t=this.getPlayState();return this.all(e=>e.pause()),this.emit("pause",t,this),this.stopLoop(),this.animationFrame=void 0,this}reset(){return this.setProgress(0),this.beginEvent(),this.options.autoplay?this.play():this.pause(),this}cancel(){return this.all(t=>t.cancel()),this.stopLoop(),this}finish(){return this.all(t=>t.finish()),this.stopLoop(),this}stop(){for(this.cancel(),this.animations.clear();this.targets.length;)this.targets.pop();this.mainElement=void 0,this.emit("stop")}getTargets(){return this.targets}getAnimation(t){return this.animations.get(t)}getTiming(t){let e=t instanceof Animation?t:this.getAnimation(t),i=this.computedOptions.get(e)??{},n=e.effect?.getTiming()??{},s=this.getOptions();return{...V,...s,...n,...i}}getTotalDuration(){return this.totalDuration}getCurrentTime(){return this.mainAnimation.currentTime}getProgress(){return this.getCurrentTime()/this.totalDuration*100}getSpeed(){return this.mainAnimation.playbackRate}getPlayState(){return this.mainAnimation.playState}getOptions(){return this.options}setCurrentTime(t){return this.all(e=>{e.currentTime=t}),this.emit("update",this.getProgress()),this}setProgress(t){let e=t/100*this.totalDuration;return this.setCurrentTime(e),this}setSpeed(t=1){return this.all(e=>{e.playbackRate=t}),this}on(t,e,i){return this.emitter.on(t,e,i??this),this}off(t,e,i){return this.emitter.off(t,e,i??this),this}emit(t,...e){return this.emitter.emit(t,...e),this}toJSON(){return this.getOptions()}get[Symbol.toStringTag](){return"Animate"}},At=(r={})=>new M(r),mt=class extends M{constructor(t={}){super();this.animations=new g;try{let{options:e,...i}=t,n=e instanceof M?e.getOptions():Array.isArray(e)?e?.[0]?.getOptions():e;this.options=Object.assign({},V,n,i),this.loop=this.loop.bind(this);let{loop:s,delay:a,speed:l,easing:o,endDelay:p,duration:f,direction:P,fillMode:T,onfinish:x,target:G,keyframes:q,autoplay:$,extend:B,...Y}=this.options;this.mainElement=document.createElement("div"),this.targets=F(G),this.properties=Y;let C=[],d=this.targets.length,I;for(let m=0;m0||(I=K(I,[m,d,b],this));let H=u.delay+u.duration*u.iterations+u.endDelay;this.totalDuration{typeof x=="function"&&x.call(this,b,m,d,A),this.emit("finish",b,m,d,A)},this.computedOptions.set(A,u),this.animations.set(b,A),C.push(u.delay)}this.mainAnimation=this.mainElement.animate([{opacity:"0"},{opacity:"1"}],{duration:this.totalDuration,easing:"linear"}),this.minDelay=Math.min(...C),this.setSpeed(l),$?this.play():this.pause(),this.promise=this.newPromise(),this.mainAnimation.onfinish=()=>{this.emit("complete",this),this.stopLoop()}}catch(e){this.emit("error",e)}}add(t){return this}};0&&(module.exports={AdvancedManager,Animate,App,CONFIG_DEFAULTS,DefaultAnimationOptions,Event,EventEmitter,HistoryManager,Manager,ManagerItem,PARSER,PJAX,Page,PageManager,Router,Service,ServiceManager,Timeline,TransitionManager,animate,asyncMethodCall,changeState,clean,computeValue,easings,equal,getConfig,getEase,getElements,getHash,getHashedPath,getTargets,hashAction,mapObject,methodCall,newConfig,newCoords,newListener,newState,newURL,toAttr}); +var Q=Object.defineProperty;var gt=r=>Q(r,"__esModule",{value:!0});var dt=(r,t)=>{for(var e in t)Q(r,e,{get:t[e],enumerable:!0})};gt(exports);dt(exports,{AdvancedManager:()=>R,Animate:()=>M,App:()=>lt,CONFIG_DEFAULTS:()=>tt,DefaultAnimationOptions:()=>V,Event:()=>k,EventEmitter:()=>O,HistoryManager:()=>rt,Manager:()=>g,ManagerItem:()=>S,PARSER:()=>st,PJAX:()=>pt,Page:()=>z,PageManager:()=>at,Router:()=>ct,Service:()=>y,ServiceManager:()=>K,Timeline:()=>mt,TransitionManager:()=>ot,animate:()=>At,asyncMethodCall:()=>it,changeState:()=>nt,clean:()=>X,computeValue:()=>j,easings:()=>ht,equal:()=>N,getConfig:()=>c,getEase:()=>Z,getElements:()=>ut,getHash:()=>ft,getHashedPath:()=>E,getTargets:()=>U,hashAction:()=>F,mapObject:()=>_,methodCall:()=>x,newConfig:()=>W,newCoords:()=>w,newListener:()=>J,newState:()=>D,newURL:()=>u,toAttr:()=>et});var tt={wrapperAttr:"wrapper",noAjaxLinkAttr:"no-ajax-link",noPrefetchAttr:"no-prefetch",headers:[["x-partial","true"]],preventSelfAttr:'prevent="self"',preventAllAttr:'prevent="all"',transitionAttr:"transition",blockAttr:"block",timeout:3e4,maxPages:5,resizeDelay:100},W=r=>Object.assign({...tt},r),et=(r,t,e=!0)=>{let{prefix:i}=r,n=`data${i?"-"+i:""}-${t}`;return e?`[${n}]`:n},c=(r,t,e=!0)=>{if(typeof t!="string")return r;let i=r[t];return typeof i=="string"?et(r,i,e):i};var g=class{constructor(t){this.map=new Map(t)}getMap(){return this.map}get(t){return this.map.get(t)}keys(){return Array.from(this.map.keys())}values(){return Array.from(this.map.values())}set(t,e){return this.map.set(t,e),this}add(t){let i=this.size;return this.set(i,t),this}get size(){return this.map.size}get length(){return this.map.size}last(t=1){let e=this.keys()[this.size-t];return this.get(e)}delete(t){return this.map.delete(t)}remove(t){return this.map.delete(t),this}clear(){return this.map.clear(),this}has(t){return this.map.has(t)}entries(){return this.map.entries()}forEach(t,e){return this.map.forEach(t,e),this}[Symbol.iterator](){return this.entries()}},x=(r,t,...e)=>{r.forEach(i=>{i[t](...e)})},it=async(r,t,...e)=>{for(let[,i]of r)await i[t](...e)};var S=class{constructor(){}install(){}register(t,e){return this.manager=t,this.app=t.app,this.config=t.config,this.emitter=t.emitter,this.key=e,this.install(),this}uninstall(){}unregister(){this.uninstall(),this.manager.remove(this.key),this.key=void 0,this.manager=void 0,this.app=void 0,this.config=void 0,this.emitter=void 0}},R=class extends g{constructor(t){super();this.app=t,this.config=t.config,this.emitter=t.emitter}set(t,e){return super.set(t,e),e.register(this,t),this}};var u=(r=window.location.href)=>r instanceof URL?r:new URL(r,window.location.origin),E=r=>{let t=u(r);return`${t.pathname}${t.hash}`},ft=r=>u(r).hash.slice(1),X=r=>u(r).toString().replace(/(\/#.*|\/|#.*)$/,""),N=(r,t)=>X(r)===X(t);var y=class extends S{init(){}boot(){this.initEvents()}initEvents(){}stopEvents(){}stop(){this.stopEvents(),this.unregister()}},K=class extends R{constructor(t){super(t)}init(){return x(this,"init"),this}boot(){return x(this,"boot"),this}stop(){return x(this,"stop"),this}};var w=(r=window.scrollX,t=window.scrollY)=>({x:r,y:t}),D=(r={url:E(u()),index:0,transition:"default",data:{scroll:w(),trigger:"HistoryManager"}})=>r,rt=class extends y{constructor(){super(...arguments);this.pointer=-1}init(){this.states=[];let t=D();this.add(t,"replace")}get(t){return this.states[t]}add(t,e="push"){let i=D(t),n=this.length;this.states.push({...i}),this.pointer=n;let s={index:this.pointer,states:[...this.states]};return nt(e,i,s),this}remove(t){return t?this.states.splice(t,1):this.states.pop(),this.pointer--,this}replace(t){return this.states=t,this}set(t,e){return this.states[t]=e}get current(){return this.get(this.pointer)}get last(){return this.get(this.length-1)}get previous(){return this.pointer<1?null:this.get(this.pointer-1)}get length(){return this.states.length}},nt=(r,t,e)=>{let i=E(t.url),n=[e,"",i];if(window.history)switch(r){case"push":window.history.pushState.apply(window.history,n);break;case"replace":window.history.replaceState.apply(window.history,n);break}};var st=new DOMParser,z=class extends S{constructor(t=u(),e=document){super();this.url=t,typeof e=="string"?this.data=e:this.dom=e||document}build(){if(this.dom instanceof Node||(this.dom=st.parseFromString(this.data,"text/html")),!(this.body instanceof Node)){let{title:t,head:e,body:i}=this.dom;this.title=t,this.head=e,this.body=i,this.wrapper=this.body.querySelector(this.wrapperAttr)}}install(){this.wrapperAttr=c(this.config,"wrapperAttr")}uninstall(){this.url=void 0,this.title=void 0,this.head=void 0,this.body=void 0,this.dom=void 0,this.wrapper=void 0,this.data=void 0,this.wrapperAttr=void 0}},at=class extends y{constructor(){super(...arguments);this.loading=new g}install(){this.pages=new R(this.app);let t=u().pathname;this.set(t,new z),t=void 0}get(t){return this.pages.get(t)}add(t){return this.pages.add(t),this}set(t,e){return this.pages.set(t,e),this}remove(t){return this.pages.remove(t),this}has(t){return this.pages.has(t)}clear(){return this.pages.clear(),this}get size(){return this.pages.size}keys(){return this.pages.keys()}async load(t=u()){let e=u(t),i=e.pathname,n,s;if(this.has(i))return n=this.get(i),Promise.resolve(n);this.loading.has(i)?s=this.loading.get(i):(s=this.request(i),this.loading.set(i,s));let o=await s;if(this.loading.remove(i),n=new z(e,o),this.set(i,n),this.size>c(this.config,"maxPages")){let l=u(),a=this.keys(),p=N(l,a[0])?a[1]:a[0],d=this.get(p);d.unregister(),d=void 0,a=void 0,l=void 0,p=void 0}return n}async request(t){let e=new Headers(c(this.config,"headers")),i=window.setTimeout(()=>{throw window.clearTimeout(i),"Request Timed Out!"},c(this.config,"timeout"));try{let n=await fetch(t,{mode:"same-origin",method:"GET",headers:e,cache:"default",credentials:"same-origin"});if(window.clearTimeout(i),n.status>=200&&n.status<300)return await n.text();throw new Error(n.statusText||""+n.status)}catch(n){throw window.clearTimeout(i),n}}};var J=({callback:r=()=>{},scope:t=null,name:e="event"})=>({callback:r,scope:t,name:e}),k=class extends g{constructor(t="event"){super();this.name=t}},O=class extends g{constructor(){super()}getEvent(t){let e=this.get(t);return e instanceof k?e:(this.set(t,new k(t)),this.get(t))}newListener(t,e,i){let n=this.getEvent(t);return n.add(J({name:t,callback:e,scope:i})),n}on(t,e,i){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let n,s,o=typeof t=="object"&&!Array.isArray(t),l=o?e:i;return o||(s=e),Object.keys(t).forEach(a=>{o?(n=a,s=t[a]):n=t[a],this.newListener(n,s,l)},this),this}removeListener(t,e,i){let n=this.get(t);if(n instanceof k&&e){let s=J({name:t,callback:e,scope:i});n.forEach((o,l)=>{if(o.callback===s.callback&&o.scope===s.scope)return n.remove(l)})}return n}off(t,e,i){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let n,s,o=typeof t=="object"&&!Array.isArray(t),l=o?e:i;return o||(s=e),Object.keys(t).forEach(a=>{o?(n=a,s=t[a]):n=t[a],typeof s=="function"?this.removeListener(n,s,l):this.remove(n)},this),this}emit(t,...e){return typeof t=="undefined"?this:(typeof t=="string"&&(t=t.trim().split(/\s/g)),t.forEach(i=>{let n=this.get(i);n instanceof k&&n.forEach(s=>{let{callback:o,scope:l}=s;o.apply(l,e)})},this),this)}clear(){return x(this,"clear"),super.clear(),this}};var F=(r,t=window.location.hash)=>{try{let e=t[0]=="#"?t:u(t).hash;if(e.length>1){let i=document.getElementById(e.slice(1));if(i){let{left:n,top:s}=i.getBoundingClientRect(),o=window.pageXOffset,l=window.pageYOffset,a=n+o,p=s+l;return console.log(a,p),w(a,p)}}}catch(e){console.warn("[hashAction] error",e)}return r??w(0,0)},bt={name:"default",scrollable:!0,out({done:r}){r()},in({scroll:r,done:t}){window.scroll(r.x,r.y),t()}},ot=class extends y{constructor(t){super();this._arg=t}install(){super.install();let t=this._arg&&this._arg.length?this._arg:c(this.config,"transitions")??[];t=[["default",bt]].concat(t),this.transitions=new g(t)}get(t){return this.transitions.get(t)}set(t,e){return this.transitions.set(t,e),this}add(t){return this.transitions.add(t),this}has(t){return this.transitions.has(t)}async animate(t,e){let i=this.transitions.get(t),n=e.scroll,s=e.ignoreHashAction;if(!("wrapper"in e.oldPage)||!("wrapper"in e.newPage))throw`[Page] either oldPage or newPage aren't instances of the Page Class. + ${{newPage:e.newPage,oldPage:e.oldPage}}`;document.title=""+e.newPage.title;let o=e.oldPage.wrapper,l=e.newPage.wrapper;if(!(o instanceof Node)||!(l instanceof Node))throw`[Wrapper] the wrapper from the ${l instanceof Node?"current":"next"} page cannot be found. The wrapper must be an element that has the attribute ${c(this.config,"wrapperAttr")}.`;return i.init&&i?.init(e),this.emitter.emit("BEFORE_TRANSITION_OUT"),i.out&&await new Promise(a=>{i.out.call(i,{...e,from:e.oldPage,trigger:e.trigger,done:a})?.then(a)}),this.emitter.emit("AFTER_TRANSITION_OUT"),await new Promise(a=>{o.insertAdjacentElement("beforebegin",l),this.emitter.emit("CONTENT_INSERT"),!s&&!/back|popstate|forward/.test(e.trigger)&&(n=F(n)),a()}),await new Promise(a=>{o.remove(),o=void 0,l=void 0,this.emitter.emit("CONTENT_REPLACED"),a()}),this.emitter.emit("BEFORE_TRANSITION_IN"),i.in&&await new Promise(async a=>{i.in.call(i,{...e,from:e.oldPage,to:e.newPage,trigger:e.trigger,scroll:n,done:a})?.then(a)}),this.emitter.emit("AFTER_TRANSITION_IN"),i}};var lt=class{constructor(t={}){this.canResize=!0;this.canScroll=!0;this._resize=this._resize.bind(this),this._scroll=this._scroll.bind(this),this._ready=this._ready.bind(this),this.register(t)}register(t={}){return this.config=W(t),this.emitter=new O,this.services=new K(this),document.addEventListener("DOMContentLoaded",this._ready),window.addEventListener("load",this._ready),window.addEventListener("resize",this._resize,{passive:!0}),window.addEventListener("scroll",this._scroll,{passive:!0}),this}_ready(){document.removeEventListener("DOMContentLoaded",this._ready),window.removeEventListener("load",this._ready),this.emitter.emit("READY ready")}_resize(){if(this.canResize){let t,e;this.canResize=!1,e=window.requestAnimationFrame(()=>{this.emitter.emit("RESIZE resize"),t=window.setTimeout(()=>{this.canResize=!0,t=window.clearTimeout(t),e=window.cancelAnimationFrame(e)},c(this.config,"resizeDelay"))})}}_scroll(){if(this.canScroll){let t;this.canScroll=!1,t=requestAnimationFrame(()=>{this.emitter.emit("SCROLL scroll"),this.canScroll=!0,t=window.cancelAnimationFrame(t)})}}get(t){return this.services.get(t)}set(t,e){return this.services.set(t,e),this}add(t){return this.services.add(t),this}boot(){return this.services.init(),this.services.boot(),this}stop(){return this.services.stop(),this.emitter.clear(),this}on(t,e){return this.emitter.on(t,e,this),this}off(t,e){return this.emitter.off(t,e,this),this}emit(t,...e){return this.emitter.emit(t,...e),this}};var pt=class extends y{install(){super.install(),this.ignoreURLs=c(this.config,"ignoreURLs")??[],this.prefetchIgnore=c(this.config,"prefetchIgnore")??!1,this.stopOnTransitioning=c(this.config,"stopOnTransitioning")??!1,this.stickyScroll=c(this.config,"stickyScroll")??!1,this.forceOnError=c(this.config,"forceOnError")??!1,this.ignoreHashAction=c(this.config,"ignoreHashAction")??!1}transitionStart(){this.isTransitioning=!0}transitionStop(){this.isTransitioning=!1}init(){this.onHover=this.onHover.bind(this),this.onClick=this.onClick.bind(this),this.onStateChange=this.onStateChange.bind(this)}boot(){"scrollRestoration"in window.history&&(window.history.scrollRestoration="manual"),super.boot()}getTransitionName(t){if(!t||!t.getAttribute)return null;let e=t.getAttribute(c(this.config,"transitionAttr",!1));return typeof e=="string"?e:null}validLink(t,e,i){let n=!window.history.pushState,s=!t||!i,o=e.metaKey||e.ctrlKey||e.shiftKey||e.altKey,l=t.hasAttribute("target")&&t.target==="_blank",a=t.protocol!==location.protocol||t.hostname!==location.hostname,p=typeof t.getAttribute("download")=="string",d=t.matches(c(this.config,"preventSelfAttr")),P=Boolean(t.closest(c(this.config,"preventAllAttr"))),T=E(u())===E(u(i));return!(s||n||o||l||a||p||d||P||T)}getHref(t){return t&&t.tagName&&t.tagName.toLowerCase()==="a"&&typeof t.href=="string"?t.href:null}getLink(t){let e=t.target,i=this.getHref(e);for(;e&&!i;)e=e.parentNode,i=this.getHref(e);if(!(!e||!this.validLink(e,t,i)))return e}onClick(t){let e=this.getLink(t);if(!e)return;if(this.isTransitioning&&this.stopOnTransitioning){t.preventDefault(),t.stopPropagation();return}let i=this.getHref(e);this.emitter.emit("ANCHOR_CLICK CLICK",t),this.go({href:i,trigger:e,event:t})}getDirection(t){return Math.abs(t)>1?t>0?"forward":"back":t===0?"popstate":t>0?"back":"forward"}force(t){window.location.assign(t)}go({href:t,trigger:e="HistoryManager",event:i}){if(this.isTransitioning&&this.stopOnTransitioning||!(this.manager.has("TransitionManager")&&this.manager.has("HistoryManager")&&this.manager.has("PageManager"))){this.force(t);return}let n=this.manager.get("HistoryManager"),s=w(0,0),o=n.current,l=o.url;if(N(l,t))return;let a;if(i&&i.state){this.emitter.emit("POPSTATE",i);let{state:p}=i,{index:d}=p,T=o.index-d;n.replace(p.states),n.pointer=d;let v=n.get(d);a=v.transition,s=v.data.scroll,e=this.getDirection(T),console.log(e=="forward"&&n),this.emitter.emit(e==="back"?"POPSTATE_BACK":"POPSTATE_FORWARD",i)}else{a=this.getTransitionName(e),s=w();let p=D({url:t,transition:a,data:{scroll:s}});!this.stickyScroll&&(s=w(0,0)),n.add(p),this.emitter.emit("HISTORY_NEW_ITEM",i)}return i&&(i.stopPropagation(),i.preventDefault()),this.emitter.emit("GO",i),this.load({oldHref:l,href:t,trigger:e,transitionName:a,scroll:s})}async load({oldHref:t,href:e,trigger:i,transitionName:n="default",scroll:s={x:0,y:0}}){try{let o=this.manager.get("PageManager"),l,a;this.emitter.emit("NAVIGATION_START",{oldHref:t,href:e,trigger:i,transitionName:n});try{this.transitionStart(),a=await o.load(t),!(a.dom instanceof Element)&&a.build(),this.emitter.emit("PAGE_LOADING",{href:e,oldPage:a,trigger:i}),l=await o.load(e),await l.build(),this.emitter.emit("PAGE_LOAD_COMPLETE",{newPage:l,oldPage:a,trigger:i})}catch(p){console.warn(`[PJAX] Page load error: ${p}`)}try{let p=this.manager.get("TransitionManager");this.emitter.emit("TRANSITION_START",n);let d=await p.animate(p.has(n)?n:"default",{oldPage:a,newPage:l,trigger:i,scroll:s,ignoreHashAction:this.ignoreHashAction});d.scrollable||(!this.ignoreHashAction&&!/back|popstate|forward/.test(i)&&(s=F(s)),window.scroll(s.x,s.y)),this.emitter.emit("TRANSITION_END",{transition:d})}catch(p){console.warn(`[PJAX] Transition error: ${p}`)}this.emitter.emit("NAVIGATION_END",{oldPage:a,newPage:l,trigger:i,transitionName:n})}catch(o){this.forceOnError?this.force(e):console.warn(o)}finally{this.transitionStop()}}ignoredURL({pathname:t}){return this.ignoreURLs.length&&this.ignoreURLs.some(e=>typeof e=="string"?e===t:e.exec(t)!==null)}onHover(t){let e=this.getLink(t);if(!e||!this.manager.has("PageManager"))return;let i=this.manager.get("PageManager"),n=u(this.getHref(e)),s=n.pathname;if(!(this.ignoredURL(n)||i.has(s))){this.emitter.emit("ANCHOR_HOVER HOVER",t);try{i.load(n)}catch(o){console.warn("[PJAX] prefetch error,",o)}}}onStateChange(t){this.go({href:window.location.href,trigger:"popstate",event:t})}initEvents(){this.prefetchIgnore!==!0&&(document.addEventListener("mouseover",this.onHover),document.addEventListener("touchstart",this.onHover)),document.addEventListener("click",this.onClick),window.addEventListener("popstate",this.onStateChange)}stopEvents(){this.prefetchIgnore!==!0&&(document.removeEventListener("mouseover",this.onHover),document.removeEventListener("touchstart",this.onHover)),document.removeEventListener("click",this.onClick),window.removeEventListener("popstate",this.onStateChange)}};var ct=class extends y{constructor(t=[]){super();this.routes=new g;for(let e of t)this.add(e)}add({path:t,method:e}){let i=this.parse(t);return this.routes.set(i,e),this}parsePath(t){if(typeof t=="string")return new RegExp(t,"i");if(t instanceof RegExp||typeof t=="boolean")return t;throw"[Router] only regular expressions, strings and booleans are accepted as paths."}isPath(t){return typeof t=="string"||t instanceof RegExp||typeof t=="boolean"}parse(t){let e=t,i={from:/(.*)/g,to:/(.*)/g};if(this.isPath(t))i={from:!0,to:t};else if(this.isPath(e.from)&&this.isPath(e.to))i=e;else throw"[Router] path is neither a string, regular expression, or a { from, to } object.";let{from:n,to:s}=i;return{from:this.parsePath(n),to:this.parsePath(s)}}route(){if(this.manager.has("HistoryManager")){let t=this.manager.get("HistoryManager"),e=E(u((t.length>1?t.previous:t.current).url)),i=E(u());this.routes.forEach((n,s)=>{let o=s.from,l=s.to;if(typeof o=="boolean"&&typeof l=="boolean")throw`[Router] path ({ from: ${o}, to: ${l} }) is not valid, remember paths can only be strings, regular expressions, or a boolean; however, both the from and to paths cannot be both booleans.`;let a=o,p=l;o instanceof RegExp&&o.test(e)&&(a=o.exec(e)),l instanceof RegExp&&l.test(i)&&(p=l.exec(i)),(Array.isArray(p)&&Array.isArray(a)||Array.isArray(p)&&typeof a=="boolean"&&a||Array.isArray(a)&&typeof p=="boolean"&&p)&&n({from:a,to:p,path:{from:e,to:i}})})}else console.warn("[Route] HistoryManager is missing.")}initEvents(){this.emitter.on("READY",this.route,this),this.emitter.on("CONTENT_REPLACED",this.route,this)}stopEvents(){this.emitter.off("READY",this.route,this),this.emitter.off("CONTENT_REPLACED",this.route,this)}};var ut=r=>typeof r=="string"?Array.from(document.querySelectorAll(r)):[r],yt=r=>[].concat(...r),U=r=>Array.isArray(r)?yt(r.map(U)):typeof r=="string"||r instanceof Node?ut(r):r instanceof NodeList||r instanceof HTMLCollection?Array.from(r):[],j=(r,t,e)=>typeof r=="function"?r.apply(e,t):r,_=(r,t,e)=>{let i,n,s={},o=Object.keys(r);for(let l=0,a=o.length;l/^(in|out)/.test(r)?ht[r]:r,V={keyframes:[],loop:1,delay:0,speed:1,endDelay:0,easing:"ease",autoplay:!0,duration:1e3,fillMode:"auto",direction:"normal",extend:{}},M=class{constructor(t={}){this.options={};this.targets=[];this.properties={};this.animations=new g;this.totalDuration=0;this.minDelay=0;this.computedOptions=new g;this.emitter=new O;try{let{options:e,...i}=t,n=e instanceof M?e.getOptions():Array.isArray(e)?e?.[0]?.getOptions():e;this.options=Object.assign({},V,n,i),this.loop=this.loop.bind(this);let{loop:s,delay:o,speed:l,easing:a,endDelay:p,duration:d,direction:P,fillMode:T,onfinish:v,target:G,keyframes:q,autoplay:$,extend:B,...Y}=this.options;this.mainElement=document.createElement("div"),this.targets=U(G),this.properties=Y;let C=[],b=this.targets.length,I;for(let m=0;m0||(I=_(I,[m,b,f],this));let H=h.delay+h.duration*h.iterations+h.endDelay;this.totalDuration{typeof v=="function"&&v.call(this,f,m,b,A),this.emit("finish",f,m,b,A)},this.computedOptions.set(A,h),this.animations.set(f,A),C.push(h.delay)}this.mainAnimation=this.mainElement.animate([{opacity:"0"},{opacity:"1"}],{duration:this.totalDuration,easing:"linear"}),this.minDelay=Math.min(...C),this.setSpeed(l),$?this.play():this.pause(),this.promise=this.newPromise(),this.mainAnimation.onfinish=()=>{this.emit("complete",this),this.stopLoop()}}catch(e){this.emit("error",e)}}newPromise(){return new Promise((t,e)=>{this.on("complete",()=>t([this])),this.on("error",i=>e(i))})}then(t,e){return t=t?.bind(this),e=e?.bind(this),this.promise.then(t,e),this}catch(t){return t=t?.bind(this),this.promise.catch(t),this}finally(t){return t=t?.bind(this),this.promise.finally(t),this}loop(){this.stopLoop(),this.emit("update",this.getProgress(),this),this.animationFrame=window.requestAnimationFrame(this.loop)}stopLoop(){window.cancelAnimationFrame(this.animationFrame)}all(t){return t(this.mainAnimation,this.mainElement),this.animations.forEach(t),this}beginEvent(){if(this.getProgress()==0){let t=window.setTimeout(()=>{this.emit("begin",this),t=window.clearTimeout(t)},this.minDelay)}}play(){let t=this.getPlayState();return this.beginEvent(),this.all(e=>e.play()),this.emit("play",t,this),this.loop(),this}pause(){let t=this.getPlayState();return this.all(e=>e.pause()),this.emit("pause",t,this),this.stopLoop(),this.animationFrame=void 0,this}reset(){return this.setProgress(0),this.beginEvent(),this.options.autoplay?this.play():this.pause(),this}cancel(){return this.all(t=>t.cancel()),this.stopLoop(),this}finish(){return this.all(t=>t.finish()),this.stopLoop(),this}stop(){for(this.cancel(),this.animations.clear();this.targets.length;)this.targets.pop();this.mainElement=void 0,this.emit("stop")}getTargets(){return this.targets}getAnimation(t){return this.animations.get(t)}getTiming(t){let e=t instanceof Animation?t:this.getAnimation(t),i=this.computedOptions.get(e)??{},n=e.effect?.getTiming()??{},s=this.getOptions();return{...V,...s,...n,...i}}getTotalDuration(){return this.totalDuration}getCurrentTime(){return this.mainAnimation.currentTime}getProgress(){return this.getCurrentTime()/this.totalDuration*100}getSpeed(){return this.mainAnimation.playbackRate}getPlayState(){return this.mainAnimation.playState}getOptions(){return this.options}setCurrentTime(t){return this.all(e=>{e.currentTime=t}),this.emit("update",this.getProgress()),this}setProgress(t){let e=t/100*this.totalDuration;return this.setCurrentTime(e),this}setSpeed(t=1){return this.all(e=>{e.playbackRate=t}),this}on(t,e,i){return this.emitter.on(t,e,i??this),this}off(t,e,i){return this.emitter.off(t,e,i??this),this}emit(t,...e){return this.emitter.emit(t,...e),this}toJSON(){return this.getOptions()}get[Symbol.toStringTag](){return"Animate"}},At=(r={})=>new M(r),mt=class extends M{constructor(t={}){super();this.animations=new g;try{let{options:e,...i}=t,n=e instanceof M?e.getOptions():Array.isArray(e)?e?.[0]?.getOptions():e;this.options=Object.assign({},V,n,i),this.loop=this.loop.bind(this);let{loop:s,delay:o,speed:l,easing:a,endDelay:p,duration:d,direction:P,fillMode:T,onfinish:v,target:G,keyframes:q,autoplay:$,extend:B,...Y}=this.options;this.mainElement=document.createElement("div"),this.targets=U(G),this.properties=Y;let C=[],b=this.targets.length,I;for(let m=0;m0||(I=_(I,[m,b,f],this));let H=h.delay+h.duration*h.iterations+h.endDelay;this.totalDuration{typeof v=="function"&&v.call(this,f,m,b,A),this.emit("finish",f,m,b,A)},this.computedOptions.set(A,h),this.animations.set(f,A),C.push(h.delay)}this.mainAnimation=this.mainElement.animate([{opacity:"0"},{opacity:"1"}],{duration:this.totalDuration,easing:"linear"}),this.minDelay=Math.min(...C),this.setSpeed(l),$?this.play():this.pause(),this.promise=this.newPromise(),this.mainAnimation.onfinish=()=>{this.emit("complete",this),this.stopLoop()}}catch(e){this.emit("error",e)}}add(t){return this}};0&&(module.exports={AdvancedManager,Animate,App,CONFIG_DEFAULTS,DefaultAnimationOptions,Event,EventEmitter,HistoryManager,Manager,ManagerItem,PARSER,PJAX,Page,PageManager,Router,Service,ServiceManager,Timeline,TransitionManager,animate,asyncMethodCall,changeState,clean,computeValue,easings,equal,getConfig,getEase,getElements,getHash,getHashedPath,getTargets,hashAction,mapObject,methodCall,newConfig,newCoords,newListener,newState,newURL,toAttr}); //# sourceMappingURL=api.cjs.js.map diff --git a/packages/native/lib/api.cjs.js.map b/packages/native/lib/api.cjs.js.map index 35c4db9..f517830 100644 --- a/packages/native/lib/api.cjs.js.map +++ b/packages/native/lib/api.cjs.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../src/api.ts", "../src/config.ts", "../../manager/src/api.ts", "../src/manager.ts", "../src/url.ts", "../src/service.ts", "../src/history.ts", "../src/page.ts", "../../emitter/src/api.ts", "../src/transition.ts", "../src/app.ts", "../src/pjax.ts", "../src/router.ts", "../../animate/src/api.ts"], - "sourcesContent": ["export * from \"./config\";\nexport * from \"./manager\";\nexport * from \"./url\";\n\nexport * from \"./history\";\nexport * from \"./page\";\n\nexport * from \"./emitter\";\nexport * from \"./service\";\n\nexport * from \"./transition\";\n\nexport * from \"./app\";\nexport * from \"./pjax\";\nexport * from \"./router\";\n\nexport * from \"./animate\";\n", "export interface ICONFIG {\n prefix?: string;\n wrapperAttr?: string;\n noAjaxLinkAttr?: string;\n noPrefetchAttr?: \"no-prefetch\";\n headers?: string[][];\n preventSelfAttr?: string;\n preventAllAttr?: string;\n transitionAttr?: string;\n blockAttr?: string;\n timeout?: number;\n maxPages?: number;\n [key: string]: any;\n}\n\nexport const CONFIG_DEFAULTS = {\n wrapperAttr: \"wrapper\",\n noAjaxLinkAttr: \"no-ajax-link\",\n noPrefetchAttr: \"no-prefetch\",\n headers: [\n [\"x-partial\", \"true\"]\n ],\n preventSelfAttr: `prevent=\"self\"`,\n preventAllAttr: `prevent=\"all\"`,\n transitionAttr: \"transition\",\n blockAttr: `block`,\n timeout: 30000,\n maxPages: 5\n};\n\nexport type ConfigKeys = keyof typeof CONFIG_DEFAULTS | string;\nexport const newConfig = (config: ICONFIG): ICONFIG => {\n return Object.assign({ ...CONFIG_DEFAULTS }, config);\n};\n\n/** Converts string into properly formatted data attributes */\nexport const toAttr = (config: ICONFIG, value: string, brackets: boolean = true): string => {\n let { prefix } = config;\n let attr = `data${prefix ? \"-\" + prefix : \"\"}-${value}`;\n return brackets ? `[${attr}]` : attr;\n};\n\n/** Selects config vars, and formats them for use, or simply returns the current configurations for the framework */\nexport const getConfig = (config: ICONFIG, value?: ConfigKeys, brackets: boolean = true): any => {\n if (typeof value !== \"string\")\n return config;\n\n let prop = config[value];\n if (typeof prop === \"string\")\n return toAttr(config, prop, brackets);\n return prop;\n};\n", "/** Manages complex lists of named data, eg. A page can be stored in a list by of other pages with the url being how the page is stored in the list. Managers use Maps to store data */\nexport class Manager {\n\t/** The complex list of named data, to which the Manager controls */\n\tpublic map: Map;\n\tconstructor(value?: Array<[K, V]>) {\n\t\tthis.map = new Map(value);\n\t}\n\n\t/** Returns the Manager classes base Map */\n\tpublic getMap(): Map {\n\t\treturn this.map;\n\t}\n\n\t/** Get a value stored in the Manager */\n\tpublic get(key: K): V {\n\t\treturn this.map.get(key);\n\t}\n\n\t/** Returns the keys of all items stored in the Manager as an Array */\n\tpublic keys(): Array {\n\t\treturn Array.from(this.map.keys());\n\t}\n\n\t/** Returns the values of all items stored in the Manager as an Array */\n\tpublic values(): Array {\n\t\treturn Array.from(this.map.values());\n\t}\n\n\t/** Set a value to the Manager using a key */\n\tpublic set(key: K, value: V): Manager {\n\t\tthis.map.set(key, value);\n\t\treturn this;\n\t}\n\n\t/** Adds a value to Manager, and uses the current size of the Manager as it's key, it works best when all the key in the Manager are numbers */\n\tpublic add(value: V): Manager {\n\t\tlet size = this.size;\n\t\t// @ts-ignore\n\t\tlet num: K = size as K;\n\t\tthis.set(num, value);\n\t\treturn this;\n\t}\n\n\t/** Returns the total number of items stored in the Manager */\n\tpublic get size(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** An alias for size */\n\tpublic get length(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** Returns the last item in the Manager who's index is a certain distance from the last item in the Manager */\n\tpublic last(distance: number = 1): V | undefined {\n\t\tlet key = this.keys()[this.size - distance];\n\t\treturn this.get(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns true if an element in the Map object existed and has been removed, or false if the element does not exist */\n\tpublic delete(key: K): boolean {\n\t\treturn this.map.delete(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns the Manager class, allowing for chains */\n\tpublic remove(key: K): Manager {\n\t\tthis.map.delete(key);\n\t\treturn this;\n\t}\n\n\t/** Clear the Manager of all its contents */\n\tpublic clear(): Manager {\n\t\tthis.map.clear();\n\t\treturn this;\n\t}\n\n\t/** Checks if the Manager contains a certain key */\n\tpublic has(key: K): boolean {\n\t\treturn this.map.has(key);\n\t}\n\n\t/** Returns a new Iterator object that contains an array of [key, value] for each element in the Map object in insertion order. */\n\tpublic entries(): IterableIterator<[K, V]> {\n\t\treturn this.map.entries();\n\t}\n\n\t/** Iterates through the Managers contents, calling a callback function every iteration */\n\tpublic forEach(\n\t\tcallback: (value?: V, key?: K, map?: Map) => void,\n\t\tcontext?: object\n\t): Manager {\n\t\tthis.map.forEach(callback, context);\n\t\treturn this;\n\t}\n\n\t/** Allows for iteration via for..of, learn more: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators] */\n\tpublic [Symbol.iterator](): IterableIterator<[K, V]> {\n\t\treturn this.entries();\n\t}\n}\n\n/**\n * Calls the method of a certain name for all items that are currently installed\n */\nexport const methodCall = (manager: Manager, method: string, ...args: any): void => {\n\tmanager.forEach((item) => {\n\t\t// @ts-ignore\n\t\titem[method](...args);\n\t});\n};\n\n/**\n * Asynchronously calls the method of a certain name for all items that are currently installed, similar to methodCall\n */\nexport const asyncMethodCall = async (manager: Manager, method: string, ...args: any): Promise => {\n\tfor (let [, item] of manager) {\n\t\t// @ts-ignore\n\t\tawait item[method](...args);\n\t}\n};\n\nexport default Manager;\n", "import { Manager, methodCall, asyncMethodCall } from \"@okikio/manager\";\nimport { ICONFIG } from \"./config\";\nimport { IApp } from \"./app\";\nimport { EventEmitter } from \"./emitter\";\n\nexport type IAdvancedManager = AdvancedManager;\n\n/** The base class for AdvancedManager items */\nexport class ManagerItem {\n /** The AdvancedManager the ManagerItem is attached to */\n public manager: IAdvancedManager;\n\n /** The App the ManagerItem is attached to */\n public app: IApp;\n\n /** The Config of the App the ManagerItem is attached to */\n public config: ICONFIG;\n\n /** The EventEmitter of the App the ManagerItem is attached to */\n public emitter: EventEmitter;\n\n /** The key to where ManagerItem is stored in an AdvancedManager */\n public key: any;\n\n constructor() { }\n\n /** Run after the Manager Item has been registered */\n public install(): any { }\n\n /** Register the current Manager Item's manager */\n public register(manager: IAdvancedManager, key: any): ManagerItem {\n this.manager = manager;\n this.app = manager.app;\n this.config = manager.config;\n this.emitter = manager.emitter;\n this.key = key;\n this.install();\n return this;\n }\n\n /** Run before the ManagerItem has been unregistered */\n public uninstall(): any { }\n\n /** Basically removes a ManagerItem, in order to recover the ManagerItem, it needs to be re-added to an AdvancedManager */\n public unregister() {\n this.uninstall();\n\n this.manager.remove(this.key);\n this.key = undefined;\n this.manager = undefined;\n this.app = undefined;\n this.config = undefined;\n this.emitter = undefined;\n }\n}\n\n/** A tweak to the Manager class that makes it self aware of the App class it's instantiated in */\nexport class AdvancedManager extends Manager {\n /** The App the AdvancedManager is attached to */\n public app: IApp;\n\n /** The Config of the App the AdvancedManager is attached to */\n public config: ICONFIG;\n\n /** The EventEmitter of the App the AdvancedManager is attached to */\n public emitter: EventEmitter;\n\n /** Register App details */\n constructor(app: IApp) {\n super();\n this.app = app;\n this.config = app.config;\n this.emitter = app.emitter;\n }\n\n /** Add a ManagerItem to AdvancedManager at a specified key */\n public set(key: K, value: V) {\n super.set(key, value);\n value.register(this, key);\n return this;\n }\n}\n\nexport { Manager, methodCall, asyncMethodCall };\n", "export const newURL = (url: string | URL | Location = window.location.href): URL => {\n return url instanceof URL ? url : new URL(url as unknown as string, window.location.origin);\n};\n\n/** Returns the pathname with the hash at the end */\nexport const getHashedPath = (url: URL | string): string => {\n let _url = newURL(url);\n return `${_url.pathname}${_url.hash}`;\n};\n\n/** Returns the actual hash without the hashtag */\nexport const getHash = (url: URL | string): string => newURL(url).hash.slice(1);\n\n/** Removes the hash from the full URL for a clean URL string */\nexport const clean = (url: URL | string): string => newURL(url).toString().replace(/(\\/#.*|\\/|#.*)$/, '');\n\n/** Compares two URLs to each other */\nexport const equal = (a: URL | string, b: URL | string): boolean => (clean(a) === clean(b));\n\n", "import { AdvancedManager, ManagerItem, methodCall } from \"./manager\";\nimport { IApp } from \"./app\";\n\n/** Controls specific kinds of actions that require JS */\nexport class Service extends ManagerItem {\n\t/** Called before the start of a Service, represents a constructor of sorts */\n\tpublic init(...args: any): any;\n\tpublic init(): any { }\n\n\t/** Called on start of Service */\n\tpublic boot(...args: any): any;\n\tpublic boot(): any {\n\t\tthis.initEvents();\n\t}\n\n\t/** Initialize events */\n\tpublic initEvents(): void { }\n\n\t/** Stop events */\n\tpublic stopEvents(): void { }\n\n\t/** Stop services */\n\tpublic stop(): void {\n\t\tthis.stopEvents();\n\t\tthis.unregister();\n\t}\n}\n\n/** The Service Manager controls the lifecycle of all Services in an App */\nexport class ServiceManager extends AdvancedManager {\n\tconstructor(app: IApp) {\n\t\tsuper(app);\n\t}\n\n\t/** Call the init method for all Services */\n\tpublic init(): ServiceManager {\n\t\tmethodCall(this, \"init\");\n\t\treturn this;\n\t}\n\n\t/** Call the boot method for all Services */\n\tpublic boot(): ServiceManager {\n\t\tmethodCall(this, \"boot\");\n\t\treturn this;\n\t}\n\n\t/** Call the stop method for all Services */\n\tpublic stop(): ServiceManager {\n\t\tmethodCall(this, \"stop\");\n\t\treturn this;\n\t}\n}\n", "import { Service } from \"./service\";\nimport { getHashedPath, newURL } from \"./url\";\n\nexport type Trigger = HTMLAnchorElement | \"HistoryManager\" | \"popstate\" | \"back\" | \"forward\";\nexport interface ICoords {\n\treadonly x: number;\n\treadonly y: number;\n}\n\nexport interface IStateData {\n\tscroll: ICoords;\n\t[key: string]: any;\n}\n\nexport interface IState {\n\turl: string;\n\tindex?: number;\n\ttransition: string;\n\tdata: IStateData;\n}\n\nexport interface IHistoryItem {\n\tindex: number;\n\tstates: IState[];\n}\n\nexport interface IHistoryManager extends Service {\n\tstates: IState[],\n\tpointer: number,\n\n\tinit(): any,\n\tget(index: number): IState,\n\tadd(value?: IState, historyAction?: \"replace\" | \"push\"): HistoryManager,\n\tremove(index?: number): HistoryManager,\n\treplace(newStates: IState[]): HistoryManager,\n\tset(i: number, state: IState): IState,\n\tcurrent: IState,\n\tlast: IState,\n\tprevious: IState | null,\n\tlength: number,\n}\n\n/** A quick snapshot of page scroll coordinates */\nexport const newCoords = (x: number = window.scrollX, y: number = window.scrollY): ICoords => ({ x, y });\n\n/** Creates a state; a state represents the current status of the page consisting of properties like: url, transition, and data */\nexport const newState = (state: IState = {\n\turl: getHashedPath(newURL()),\n\tindex: 0,\n\ttransition: \"default\",\n\tdata: {\n\t\tscroll: newCoords(),\n\t\ttrigger: \"HistoryManager\"\n\t}\n}): IState => (state);\n\n/** Keeps a record of the history of the App; it stores only the states of Pages */\nexport class HistoryManager extends Service implements IHistoryManager {\n\tpublic states: IState[];\n\tpublic pointer = -1;\n\n\t/** Initializes the states array, and replace the history pushState data with the states array */\n\tinit() {\n\t\tthis.states = [];\n\n\t\tlet state = newState();\n\t\tthis.add(state, \"replace\");\n\t}\n\n\t/** Get a state based on it's index */\n\tpublic get(index: number) {\n\t\treturn this.states[index];\n\t}\n\n\t/** Add a state to HistoryManager and change the history pushState data based on the historyAction specified */\n\tpublic add(value?: IState, historyAction: \"replace\" | \"push\" = \"push\"): HistoryManager {\n\t\tlet state = newState(value);\n\t\tlet len = this.length;\n\t\tthis.states.push({ ...state });\n\t\tthis.pointer = len;\n\n\t\tlet item: IHistoryItem = {\n\t\t\tindex: this.pointer,\n\t\t\tstates: [...this.states]\n\t\t};\n\t\tchangeState(historyAction, state, item);\n\t\treturn this;\n\t}\n\n\tpublic remove(index?: number) {\n\t\tif (index) {\n\t\t\tthis.states.splice(index, 1);\n\t\t} else {\n\t\t\tthis.states.pop();\n\t\t}\n\n\t\tthis.pointer--;\n\t\treturn this;\n\t}\n\n\t/** Replaces the states array with another states array, this is later used when going back and forward in page history */\n\tpublic replace(newStates: IState[]) {\n\t\tthis.states = newStates;\n\t\treturn this;\n\t}\n\n\t/** Set state by index. */\n\tpublic set(i: number, state: IState) {\n\t\treturn (this.states[i] = state);\n\t}\n\n\t/** Get the current state */\n\tget current(): IState {\n\t\treturn this.get(this.pointer);\n\t}\n\n\t/** Get the last state (top of the history stack). */\n\tget last(): IState {\n\t\treturn this.get(this.length - 1);\n\t}\n\n\t/** Get the previous state. */\n\tget previous(): IState | null {\n\t\treturn this.pointer < 1 ? null : this.get(this.pointer - 1);\n\t}\n\n\tget length() {\n\t\treturn this.states.length;\n\t}\n}\n\n/** Either push or replace history state */\nexport const changeState = (action: \"push\" | \"replace\", state: IState, item: object) => {\n\tlet href = getHashedPath(state.url);\n\tlet args = [item, \"\", href];\n\tif (window.history) {\n\t\tswitch (action) {\n\t\t\tcase \"push\":\n\t\t\t\twindow.history.pushState.apply(window.history, args);\n\t\t\t\tbreak;\n\t\t\tcase \"replace\":\n\t\t\t\twindow.history.replaceState.apply(window.history, args);\n\t\t\t\tbreak;\n\t\t}\n\t}\n};\n", "import { Manager, ManagerItem, AdvancedManager } from \"./manager\";\nimport { equal, newURL } from \"./url\";\nimport { getConfig } from \"./config\";\nimport { Service } from \"./service\";\n\nexport interface IPage extends ManagerItem {\n dom: Document,\n wrapper: HTMLElement,\n title: string,\n head: Element,\n body: Element,\n url: URL,\n data: string,\n wrapperAttr: string,\n\n build(): any,\n install(): void,\n uninstall(): any,\n}\n\n/**\n * Parses strings to DOM\n */\nexport const PARSER: DOMParser = new DOMParser();\n\n/** A page represents the DOM elements that create each page */\nexport class Page extends ManagerItem implements IPage {\n /** Holds the DOM of the current page */\n public dom: Document;\n\n /** Holds the wrapper element to be swapped out of each Page */\n public wrapper: HTMLElement;\n\n /** Holds the title of each page */\n public title: string;\n\n /** Holds the head element of each page */\n public head: Element;\n\n /** Holds the body element of each page */\n public body: Element;\n\n /** The URL of the current page */\n public url: URL;\n\n /** The payload of a page request */\n public data: string;\n\n /** Attr that identifies the wrapper */\n public wrapperAttr: string;\n\n constructor(url: URL = newURL(), dom: string | Document = document) {\n super();\n this.url = url;\n\n if (typeof dom === \"string\") {\n this.data = dom;\n } else this.dom = dom || document;\n }\n\n /** Builds the page's dom, and sets the title, head, body, and wrapper properties of the Page class */\n public build() {\n if (!(this.dom instanceof Node)) {\n this.dom = PARSER.parseFromString(this.data, \"text/html\");\n }\n\n if (!(this.body instanceof Node)) {\n let { title, head, body } = this.dom;\n this.title = title;\n this.head = head;\n this.body = body;\n this.wrapper = this.body.querySelector(this.wrapperAttr);\n }\n }\n\n public install() {\n this.wrapperAttr = getConfig(this.config, \"wrapperAttr\");\n }\n\n public uninstall() {\n this.url = undefined;\n this.title = undefined;\n this.head = undefined;\n this.body = undefined;\n this.dom = undefined;\n this.wrapper = undefined;\n this.data = undefined;\n this.wrapperAttr = undefined;\n }\n}\n\nexport interface IPageManager extends Service {\n loading: Manager>,\n pages: AdvancedManager;\n\n install(): any,\n\n get(key): Page,\n add(value): PageManager,\n set(key, value): PageManager,\n remove(key): PageManager,\n has(key): boolean,\n clear(): PageManager,\n size: number,\n keys(): any[],\n\n load(_url: URL | string): Promise,\n request(url: string): Promise,\n}\n\n/** Controls which page to load */\nexport class PageManager extends Service implements IPageManager {\n /** Stores all fetch requests that are currently loading */\n public loading: Manager> = new Manager();\n\n pages: AdvancedManager;\n\n /** Instantiate pages, and add the current page to pages */\n install() {\n this.pages = new AdvancedManager(this.app);\n\n let URLString = newURL().pathname;\n this.set(URLString, new Page());\n URLString = undefined;\n }\n\n get(key) { return this.pages.get(key); }\n add(value) { this.pages.add(value); return this; }\n set(key, value) { this.pages.set(key, value); return this; }\n remove(key) { this.pages.remove(key); return this; }\n has(key) { return this.pages.has(key); }\n clear() { this.pages.clear(); return this; }\n get size() { return this.pages.size; }\n keys() { return this.pages.keys(); }\n\n /** Load from cache or by requesting URL via a fetch request, avoid requesting for the same thing twice by storing the fetch request in \"this.loading\" */\n public async load(_url: URL | string = newURL()): Promise {\n let url: URL = newURL(_url);\n let urlString: string = url.pathname;\n let page: Page, request: Promise;\n\n if (this.has(urlString)) {\n page = this.get(urlString);\n return Promise.resolve(page);\n }\n\n if (!this.loading.has(urlString)) {\n request = this.request(urlString);\n this.loading.set(urlString, request);\n } else request = this.loading.get(urlString);\n\n let response = await request;\n this.loading.remove(urlString);\n\n page = new Page(url, response);\n this.set(urlString, page);\n\n if (this.size > getConfig(this.config, \"maxPages\")) {\n let currentUrl = newURL();\n let keys = this.keys();\n let first = equal(currentUrl, keys[0]) ? keys[1] : keys[0];\n let page = this.get(first);\n page.unregister();\n page = undefined;\n keys = undefined;\n currentUrl = undefined;\n first = undefined;\n }\n\n return page;\n }\n\n /** Starts a fetch request */\n public async request(url: string): Promise {\n const headers = new Headers(getConfig(this.config, \"headers\"));\n const timeout = window.setTimeout(() => {\n window.clearTimeout(timeout);\n throw \"Request Timed Out!\";\n }, getConfig(this.config, \"timeout\"));\n\n try {\n let response = await fetch(url, {\n mode: 'same-origin',\n method: \"GET\",\n headers,\n cache: \"default\",\n credentials: \"same-origin\",\n });\n\n window.clearTimeout(timeout);\n if (response.status >= 200 && response.status < 300) {\n return await response.text();\n }\n\n const err = new Error(response.statusText || \"\" + response.status);\n throw err;\n } catch (err) {\n window.clearTimeout(timeout);\n throw err;\n }\n }\n}\n", "import { Manager, methodCall } from \"@okikio/manager\";\n\nexport type ListenerCallback = ((...args: any) => void);\nexport interface IListener {\n readonly callback: ListenerCallback;\n readonly scope: object;\n readonly name: string;\n}\n\n/** Represents a new event listener consisting of properties like: callback, scope, name */\nexport const newListener = ({\n callback = () => { },\n scope = null,\n name = \"event\",\n}: IListener): IListener => ({ callback, scope, name });\n\n/** Represents a new event */\nexport class Event extends Manager {\n /** The name of the event */\n public name: string;\n constructor(name: string = \"event\") {\n super();\n this.name = name;\n }\n}\n\nexport type EventInput = string | object | Array;\n\n/**\n * An Event Emitter\n * */\nexport class EventEmitter extends Manager {\n constructor() {\n super();\n }\n\n /** Gets event, if event doesn't exist create a new one */\n public getEvent(name: string): Event {\n let event = this.get(name);\n if (!(event instanceof Event)) {\n this.set(name, new Event(name));\n return this.get(name);\n }\n\n return event;\n }\n\n /** Creates a listener and adds it to an event */\n public newListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event = this.getEvent(name);\n event.add(newListener({ name, callback, scope }));\n return event;\n }\n\n /** Adds a listener to a given event */\n public on(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n this.newListener(_name, _callback, _scope);\n }, this);\n return this;\n }\n\n /** Removes a listener from an event */\n public removeListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event: Event = this.get(name);\n if (event instanceof Event && callback) {\n let listener = newListener({ name, callback, scope });\n\n event.forEach((value: IListener, i: number) => {\n if (\n value.callback === listener.callback &&\n value.scope === listener.scope\n ) {\n return event.remove(i);\n }\n });\n }\n\n return event;\n }\n\n /** Remove a listener from a given event, or just completely remove an event */\n public off(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n if (typeof _callback === \"function\") {\n this.removeListener(_name, _callback, _scope);\n } else this.remove(_name);\n }, this);\n return this;\n }\n\n /** Call all listeners within an event */\n public emit(\n events: string | Array,\n ...args: any\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n // Loop through the list of events\n events.forEach((event: string) => {\n let _event: Event = this.get(event);\n\n if (_event instanceof Event) {\n _event.forEach((listener: IListener) => {\n let { callback, scope } = listener;\n callback.apply(scope, args);\n });\n }\n }, this);\n return this;\n }\n\n /** Clears events and event listeners */\n public clear() {\n methodCall(this, \"clear\");\n super.clear();\n return this;\n }\n}\n\nexport default EventEmitter;\n", "import { Manager } from \"./manager\";\nimport { ICoords, newCoords, Trigger } from \"./history\";\nimport { IPage } from \"./page\";\nimport { getConfig } from \"./config\";\nimport { Service } from \"./service\";\nimport { newURL } from \"./url\";\n\n/**\n * The async function type, allows for smooth transition between Promises\n */\nexport type asyncFn = (err?: any, value?: any) => void;\nexport interface ITransition {\n oldPage?: IPage;\n newPage?: IPage;\n trigger?: Trigger;\n scroll?: { x: number; y: number };\n scrollable?: boolean;\n in: (data: ITransitionData) => any;\n out: (data: ITransitionData) => any;\n [key: string]: any;\n}\nexport interface ITransitionData {\n from?: IPage;\n to?: IPage;\n trigger?: Trigger;\n scroll?: ICoords;\n done: asyncFn;\n}\nexport interface ITransitionManager extends Service {\n transitions: Manager,\n\n get(key: string): ITransition,\n set(key: string, value: ITransition): TransitionManager,\n add(value: ITransition): TransitionManager,\n has(key: string): boolean,\n\n boot(): any,\n animate(name: string, data: any): Promise,\n}\n\n/** Auto scrolls to an elements position if the element has an hash */\nexport const hashAction = (coords?: ICoords, hash: string = window.location.hash) => {\n try {\n let _hash = hash[0] == \"#\" ? hash : newURL(hash).hash;\n if (_hash.length > 1) {\n let el = document.getElementById(_hash.slice(1));\n if (el) {\n let { left, top } = el.getBoundingClientRect();\n let scrollLeft = window.pageXOffset;\n let scrollTop = window.pageYOffset;\n let x = left + scrollLeft;\n let y = top + scrollTop;\n\n console.log(x, y);\n return newCoords(x, y);\n }\n }\n } catch (e) {\n console.warn(\"[hashAction] error\", e);\n }\n\n return coords ?? newCoords(0, 0);\n};\n\n// The Default Transition\nconst Default: ITransition = {\n name: \"default\",\n scrollable: true,\n\n out({ done }: ITransitionData) {\n done();\n },\n in({ scroll, done }: ITransitionData) {\n window.scroll(scroll.x, scroll.y);\n done();\n }\n};\n\n/** Controls which Transition between pages to use */\nexport class TransitionManager extends Service implements ITransitionManager {\n transitions: Manager;\n private _arg: Array<[string, ITransition]>;\n constructor(transitions?: Array<[string, ITransition]>) {\n super();\n this._arg = transitions;\n }\n\n /** On Service install set Config */\n public install() {\n super.install();\n\n let transitions = this._arg && this._arg.length ? this._arg : (getConfig(this.config, \"transitions\") ?? []);\n\n // Manager like Maps use the most recent [key, value] Array it knows, replacing the default transition\n // With any other transitions called [\"default\", ...]\n transitions = [[\"default\", Default]].concat(transitions);\n this.transitions = new Manager(transitions);\n }\n\n get(key: string) { return this.transitions.get(key); }\n set(key: string, value: ITransition) { this.transitions.set(key, value); return this; }\n add(value: ITransition) { this.transitions.add(value); return this; }\n has(key: string) { return this.transitions.has(key); }\n\n /** Starts a transition */\n public async animate(name: string, data: any): Promise {\n let transition: ITransition = this.transitions.get(name);\n let scroll = data.scroll;\n let ignoreHashAction = data.ignoreHashAction;\n if (!(\"wrapper\" in data.oldPage) || !(\"wrapper\" in data.newPage))\n throw `[Page] either oldPage or newPage aren't instances of the Page Class.\\n ${{\n newPage: data.newPage,\n oldPage: data.oldPage,\n }}`;\n\n // Replace the title\n document.title = `` + data.newPage.title;\n\n let fromWrapper = data.oldPage.wrapper;\n let toWrapper = data.newPage.wrapper;\n\n if (!(fromWrapper instanceof Node) || !(toWrapper instanceof Node))\n throw `[Wrapper] the wrapper from the ${!(toWrapper instanceof Node) ? \"next\" : \"current\"\n } page cannot be found. The wrapper must be an element that has the attribute ${getConfig(this.config,\n \"wrapperAttr\"\n )}.`;\n\n // Give the Transition all the background data it may require\n transition.init && transition?.init(data);\n\n this.emitter.emit(\"BEFORE_TRANSITION_OUT\");\n\n // Start the out point of the Transition\n if (transition.out) {\n await new Promise((done) => {\n let outMethod: Promise = transition.out.call(transition, {\n ...data,\n from: data.oldPage,\n trigger: data.trigger,\n done,\n });\n\n outMethod?.then(done);\n });\n }\n\n this.emitter.emit(\"AFTER_TRANSITION_OUT\");\n\n // Add the new wrapper before the old one\n await new Promise((done) => {\n fromWrapper.insertAdjacentElement(\"beforebegin\", toWrapper);\n this.emitter.emit(\"CONTENT_INSERT\");\n\n if (!ignoreHashAction && !/back|popstate|forward/.test(data.trigger as string)) {\n scroll = hashAction(scroll);\n }\n done();\n });\n\n // Replace the old wrapper with the new one\n await new Promise((done) => {\n fromWrapper.remove();\n fromWrapper = undefined;\n toWrapper = undefined;\n this.emitter.emit(\"CONTENT_REPLACED\");\n done();\n });\n\n this.emitter.emit(\"BEFORE_TRANSITION_IN\");\n\n // Start the in point of the Transition (only the in method has access to the hashAction's scroll position)\n if (transition.in) {\n await new Promise(async (done) => {\n let inMethod: Promise = transition.in.call(transition, {\n ...data,\n from: data.oldPage,\n to: data.newPage,\n trigger: data.trigger,\n scroll,\n done,\n });\n\n inMethod?.then(done);\n });\n }\n\n this.emitter.emit(\"AFTER_TRANSITION_IN\");\n return transition;\n }\n}\n", "import { EventEmitter, ListenerCallback, EventInput } from \"./emitter\";\nimport { ServiceManager, Service } from \"./service\";\nimport { newConfig, ICONFIG } from \"./config\";\n\nexport interface IApp {\n services: ServiceManager,\n emitter: EventEmitter,\n config: ICONFIG,\n register(config: ICONFIG): App,\n get(key: string): Service,\n set(key: string, service: Service): App,\n add(value: Service): App,\n boot(): App,\n stop(): App,\n on(events: EventInput, callback?: ListenerCallback): App,\n off(events: EventInput, callback?: ListenerCallback): App,\n emit(events: string | any[], ...args: any): App,\n}\n\n/** The App class starts the entire process, it controls all managers and all services */\nexport class App implements IApp {\n /** An instance of the ServiceManager */\n public services: ServiceManager;\n\n /** An instance of an EventEmitter */\n public emitter: EventEmitter;\n\n /** The current Configuration's for the App */\n public config: ICONFIG;\n constructor(config: object = {}) {\n this.register(config);\n }\n\n /** Create new instances of the ServiceManager, EventEmitter and the configurations */\n public register(config: ICONFIG = {}): App {\n this.config = newConfig(config);\n this.emitter = new EventEmitter();\n this.services = new ServiceManager(this);\n\n let handler = (() => {\n document.removeEventListener(\"DOMContentLoaded\", handler);\n window.removeEventListener(\"load\", handler);\n this.emitter.emit(\"READY ready\");\n }).bind(this);\n\n document.addEventListener(\"DOMContentLoaded\", handler);\n window.addEventListener(\"load\", handler);\n return this;\n }\n\n /** Shortcuts to adding, setting, and getting Services */\n public get(key: string): Service {\n return this.services.get(key);\n }\n\n public set(key: string, value: Service): App {\n this.services.set(key, value);\n return this;\n }\n\n public add(value: Service): App {\n this.services.add(value);\n return this;\n }\n\n /** Initialize and boot all Services */\n public boot(): App {\n this.services.init();\n this.services.boot();\n return this;\n }\n\n /** Stops all Services and clears the even emitter of all events and listeners */\n public stop(): App {\n this.services.stop();\n this.emitter.clear();\n return this;\n }\n\n /** Shortcuts to the App EventEmitter on, off, and emit methods */\n public on(events: EventInput, callback?: ListenerCallback): App {\n this.emitter.on(events, callback, this);\n return this;\n }\n\n public off(events: EventInput, callback?: ListenerCallback): App {\n this.emitter.off(events, callback, this);\n return this;\n }\n\n public emit(events: string | any[], ...args: any): App {\n this.emitter.emit(events, ...args);\n return this;\n }\n}\n", "import { newState, Trigger, newCoords, IHistoryItem, IHistoryManager } from \"./history\";\nimport { Service } from \"./service\";\nimport { IPage, IPageManager } from \"./page\";\nimport { newURL, getHashedPath, equal } from \"./url\";\nimport { getConfig } from \"./config\";\nimport { hashAction, ITransitionManager } from \"./transition\";\n\nexport type LinkEvent = MouseEvent | TouchEvent;\nexport type StateEvent = LinkEvent | PopStateEvent;\nexport type IgnoreURLsList = Array;\n/**\n * Creates a barbajs like PJAX Service, for the native framework\n * Based on barbajs and StartingBlocks\n */\nexport class PJAX extends Service {\n /** URLs to ignore when prefetching */\n public ignoreURLs: IgnoreURLsList;\n\n /** Whether or not to disable prefetching */\n public prefetchIgnore: boolean;\n\n /** Current state of transitions */\n public isTransitioning: boolean;\n\n /** Ignore extra clicks of an anchor element if a transition has already started */\n public stopOnTransitioning: boolean;\n\n /** On page change (excluding popstate events) keep current scroll position */\n public stickyScroll: boolean;\n\n /** Force load a page if an error occurs */\n public forceOnError: boolean;\n\n /** Ignore hash action if set to true */\n public ignoreHashAction: boolean;\n\n public install() {\n super.install();\n\n this.ignoreURLs = getConfig(this.config, \"ignoreURLs\") ?? [];\n this.prefetchIgnore = getConfig(this.config, \"prefetchIgnore\") ?? false;\n this.stopOnTransitioning = getConfig(this.config, \"stopOnTransitioning\") ?? false;\n this.stickyScroll = getConfig(this.config, \"stickyScroll\") ?? false;\n this.forceOnError = getConfig(this.config, \"forceOnError\") ?? false;\n this.ignoreHashAction = getConfig(this.config, \"ignoreHashAction\") ?? false\n }\n\n /** Sets the transition state to either true or false */\n public transitionStart() {\n this.isTransitioning = true;\n }\n\n public transitionStop() {\n this.isTransitioning = false;\n }\n\n public init() {\n /**\n * Bind the event listeners to the PJAX class\n *\n * @memberof PJAX\n */\n this.onHover = this.onHover.bind(this);\n this.onClick = this.onClick.bind(this);\n this.onStateChange = this.onStateChange.bind(this);\n }\n\n /** Starts the PJAX Service */\n public boot() {\n if (\"scrollRestoration\" in window.history) {\n // Back off, browser, I got this...\n window.history.scrollRestoration = \"manual\";\n }\n\n super.boot();\n }\n\n /** Gets the transition to use for a certain anchor */\n public getTransitionName(el: HTMLAnchorElement): string | null {\n if (!el || !el.getAttribute) return null;\n let transitionAttr = el.getAttribute(\n getConfig(this.config, \"transitionAttr\", false)\n );\n\n if (typeof transitionAttr === \"string\") return transitionAttr;\n return null;\n }\n\n /** Checks to see if the anchor is valid */\n public validLink(\n el: HTMLAnchorElement,\n event: LinkEvent | KeyboardEvent,\n href: string\n ): boolean {\n let pushStateSupport = !window.history.pushState;\n let exists = !el || !href;\n let eventMutate =\n (event as KeyboardEvent).metaKey ||\n (event as KeyboardEvent).ctrlKey ||\n (event as KeyboardEvent).shiftKey ||\n (event as KeyboardEvent).altKey;\n let newTab =\n el.hasAttribute(\"target\") &&\n (el as HTMLAnchorElement).target === \"_blank\";\n let crossOrigin =\n (el as HTMLAnchorElement).protocol !== location.protocol ||\n (el as HTMLAnchorElement).hostname !== location.hostname;\n let download = typeof el.getAttribute(\"download\") === \"string\";\n let preventSelf = el.matches(getConfig(this.config, \"preventSelfAttr\"));\n let preventAll = Boolean(\n el.closest(getConfig(this.config, \"preventAllAttr\"))\n );\n let sameURL = getHashedPath(newURL()) === getHashedPath(newURL(href));\n return !(\n exists ||\n pushStateSupport ||\n eventMutate ||\n newTab ||\n crossOrigin ||\n download ||\n preventSelf ||\n preventAll ||\n sameURL\n );\n }\n\n /** Returns the href of an Anchor element */\n public getHref(el: HTMLAnchorElement): string | null {\n if (\n el &&\n el.tagName &&\n el.tagName.toLowerCase() === \"a\" &&\n typeof el.href === \"string\"\n )\n return el.href;\n return null;\n }\n\n /** Check if event target is a valid anchor with an href, if so, return the anchor */\n public getLink(event: LinkEvent): HTMLAnchorElement {\n let el = event.target as HTMLAnchorElement;\n let href: string = this.getHref(el);\n\n while (el && !href) {\n el = (el as HTMLElement).parentNode as HTMLAnchorElement;\n href = this.getHref(el);\n }\n\n // Check for a valid link\n if (!el || !this.validLink(el, event, href)) return;\n return el;\n }\n\n /** When an element is clicked, get valid anchor element, go for a transition */\n public onClick(event: LinkEvent) {\n let el = this.getLink(event);\n if (!el) return;\n\n if (this.isTransitioning && this.stopOnTransitioning) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n let href = this.getHref(el);\n this.emitter.emit(\"ANCHOR_CLICK CLICK\", event);\n this.go({ href, trigger: el, event });\n }\n\n /** Returns the direction of the State change as a String, either the Back button or the Forward button */\n public getDirection(value: number): Trigger {\n if (Math.abs(value) > 1) {\n // Ex 6-0 > 0 -> forward, 0-6 < 0 -> back\n return value > 0 ? \"forward\" : \"back\";\n } else {\n if (value === 0) {\n return \"popstate\";\n } else {\n // Ex 6-5 > 0 -> back, 5-6 < 0 -> forward\n return value > 0 ? \"back\" : \"forward\";\n }\n }\n }\n\n /** Force a page to go to a certain URL */\n public force(href: string): void {\n window.location.assign(href);\n }\n\n /**\n * If transition is running force load page.\n * Stop if currentURL is the same as new url.\n * On state change, change the current state history, to reflect the direction of said state change\n * Load page and page transition.\n */\n public go({\n href,\n trigger = \"HistoryManager\",\n event,\n }: {\n href: string;\n trigger?: Trigger;\n event?: StateEvent;\n }): Promise {\n // If transition is already running and the go method is called again, force load page\n if (this.isTransitioning && this.stopOnTransitioning ||\n !(this.manager.has(\"TransitionManager\") &&\n this.manager.has(\"HistoryManager\") &&\n this.manager.has(\"PageManager\"))) {\n this.force(href);\n return;\n }\n\n const history = this.manager.get(\"HistoryManager\") as IHistoryManager;\n let scroll = newCoords(0, 0);\n let currentState = history.current;\n let currentURL = currentState.url;\n if (equal(currentURL, href)) {\n return;\n }\n\n let transitionName: string;\n if (event && (event as PopStateEvent).state) {\n this.emitter.emit(\"POPSTATE\", event);\n\n // If popstate, get back/forward direction.\n let { state }: { state: IHistoryItem } = event as PopStateEvent;\n let { index } = state;\n let currentIndex = currentState.index;\n let difference = currentIndex - index;\n\n history.replace(state.states);\n history.pointer = index;\n\n let _state = history.get(index);\n transitionName = _state.transition;\n scroll = _state.data.scroll;\n\n trigger = this.getDirection(difference);\n console.log(trigger == \"forward\" && history)\n\n // Based on the direction of the state change either remove or add a state\n this.emitter.emit(trigger === \"back\" ? `POPSTATE_BACK` : `POPSTATE_FORWARD`, event);\n } else {\n // Add new state\n transitionName = this.getTransitionName(trigger as HTMLAnchorElement);\n\n scroll = newCoords();\n let state = newState({\n url: href,\n transition: transitionName,\n data: { scroll },\n });\n\n !this.stickyScroll && (scroll = newCoords(0, 0));\n\n history.add(state);\n this.emitter.emit(\"HISTORY_NEW_ITEM\", event);\n }\n\n if (event) {\n event.stopPropagation();\n event.preventDefault();\n }\n\n this.emitter.emit(\"GO\", event);\n return this.load({\n oldHref: currentURL,\n href,\n trigger,\n transitionName,\n scroll,\n });\n }\n\n /** Load the new Page as well as a Transition; starts the Transition */\n public async load({\n oldHref,\n href,\n trigger,\n transitionName = \"default\",\n scroll = { x: 0, y: 0 },\n }: {\n oldHref: string;\n href: string;\n trigger: Trigger;\n transitionName?: string;\n scroll: { x: number; y: number };\n }): Promise {\n try {\n const pages = this.manager.get(\"PageManager\") as IPageManager;\n let newPage: IPage, oldPage: IPage;\n this.emitter.emit(\"NAVIGATION_START\", {\n oldHref,\n href,\n trigger,\n transitionName,\n });\n\n // Load & Build both the old and new pages\n try {\n this.transitionStart();\n oldPage = await pages.load(oldHref);\n !(oldPage.dom instanceof Element) && oldPage.build();\n\n this.emitter.emit(\"PAGE_LOADING\", { href, oldPage, trigger });\n newPage = await pages.load(href);\n await newPage.build();\n this.emitter.emit(\"PAGE_LOAD_COMPLETE\", {\n newPage,\n oldPage,\n trigger,\n });\n } catch (err) {\n console.warn(`[PJAX] Page load error: ${err}`);\n }\n\n // Transition Between Pages\n try {\n const TransitionManager = this.manager.get(\"TransitionManager\") as ITransitionManager;\n this.emitter.emit(\"TRANSITION_START\", transitionName);\n\n let transition = await TransitionManager.animate(TransitionManager.has(transitionName) ? transitionName : \"default\", {\n oldPage,\n newPage,\n trigger,\n scroll,\n ignoreHashAction: this.ignoreHashAction\n });\n\n if (!transition.scrollable) {\n if (!this.ignoreHashAction && !/back|popstate|forward/.test(trigger as string)) scroll = hashAction(scroll);\n window.scroll(scroll.x, scroll.y);\n }\n\n this.emitter.emit(\"TRANSITION_END\", { transition });\n } catch (err) {\n console.warn(`[PJAX] Transition error: ${err}`);\n }\n\n // Navigation is over\n this.emitter.emit(\"NAVIGATION_END\", {\n oldPage,\n newPage,\n trigger,\n transitionName,\n });\n } catch (err) {\n if (this.forceOnError) this.force(href);\n else console.warn(err);\n } finally {\n this.transitionStop(); // Sets isTransitioning to false\n }\n }\n\n /** Check to see if the URL is to be ignored, uses either RegExp of Strings to check */\n public ignoredURL({ pathname }: URL): boolean {\n return (\n this.ignoreURLs.length &&\n this.ignoreURLs.some((url) => {\n return typeof url === \"string\"\n ? url === pathname\n : (url as RegExp).exec(pathname) !== null;\n })\n );\n }\n\n /** When you hover over an anchor, prefetch the event target's href */\n public onHover(event: LinkEvent): Promise {\n let el = this.getLink(event);\n if (!el || !this.manager.has(\"PageManager\")) return;\n\n const pages = this.manager.get(\"PageManager\") as IPageManager;\n let url = newURL(this.getHref(el));\n let urlString: string = url.pathname;\n\n // If Url is ignored or already in cache, don't do any think\n if (this.ignoredURL(url) || pages.has(urlString)) return;\n this.emitter.emit(\"ANCHOR_HOVER HOVER\", event);\n\n try {\n pages.load(url);\n } catch (err) {\n console.warn(\"[PJAX] prefetch error,\", err);\n }\n }\n\n /** When History state changes, get url from State, go for a Transition. */\n public onStateChange(event: PopStateEvent): void {\n this.go({ href: window.location.href, trigger: \"popstate\", event });\n }\n\n /** Initialize DOM Events */\n public initEvents() {\n if (this.prefetchIgnore !== true) {\n document.addEventListener(\"mouseover\", this.onHover);\n document.addEventListener(\"touchstart\", this.onHover);\n }\n\n document.addEventListener(\"click\", this.onClick);\n window.addEventListener(\"popstate\", this.onStateChange);\n }\n\n /** Stop DOM Events */\n public stopEvents() {\n if (this.prefetchIgnore !== true) {\n document.removeEventListener(\"mouseover\", this.onHover);\n document.removeEventListener(\"touchstart\", this.onHover);\n }\n\n document.removeEventListener(\"click\", this.onClick);\n window.removeEventListener(\"popstate\", this.onStateChange);\n }\n}\n", "import { Service } from \"./service\";\nimport { Manager } from \"./manager\";\nimport { newURL, getHashedPath } from \"./url\";\nimport { IHistoryManager } from \"./history\";\n\nexport type RouteMethod = (...args: any) => any;\nexport type RouteStyle = string | RegExp | boolean;\nexport interface IRouteToFrom {\n to: RouteStyle,\n from: RouteStyle\n}\nexport type RoutePath = IRouteToFrom | RouteStyle;\nexport interface IRoute {\n path: RoutePath,\n method: RouteMethod\n}\n\n/** Controls what happens when certain url paths match a set of criteria */\nexport class Router extends Service {\n /** List of routes */\n protected routes: Manager;\n constructor(routes: IRoute[] = []) {\n super();\n this.routes = new Manager();\n for (let route of routes) {\n this.add(route);\n }\n }\n\n /** Add a new route to watch for */\n public add({ path, method }: IRoute): Router {\n let key = this.parse(path);\n this.routes.set(key, method);\n return this;\n }\n\n /** Convert strings into path match functions */\n public parsePath(path: RouteStyle): RegExp | boolean {\n if (typeof path === \"string\") return new RegExp(path, \"i\");\n else if (path instanceof RegExp || typeof path === \"boolean\")\n return path;\n throw \"[Router] only regular expressions, strings and booleans are accepted as paths.\";\n }\n\n /** Determines if a strings counts has a path */\n public isPath(input: RouteStyle): boolean {\n return (\n typeof input === \"string\" ||\n input instanceof RegExp ||\n typeof input === \"boolean\"\n );\n }\n\n /** Parse the multiple different formats for paths, into a { from, to } object */\n public parse(input: RoutePath): IRouteToFrom {\n let route = input as IRouteToFrom;\n let toFromPath: IRouteToFrom = {\n from: /(.*)/g,\n to: /(.*)/g,\n };\n\n if (this.isPath(input as RouteStyle))\n toFromPath = {\n from: true,\n to: input as RouteStyle,\n };\n else if (this.isPath(route.from) && this.isPath(route.to as RouteStyle))\n toFromPath = route;\n else\n throw \"[Router] path is neither a string, regular expression, or a { from, to } object.\";\n\n let { from, to } = toFromPath;\n return {\n from: this.parsePath(from),\n to: this.parsePath(to),\n };\n }\n\n /** Test if route paths are true, if so run their methods */\n public route() {\n if (this.manager.has(\"HistoryManager\")) {\n let history = this.manager.get(\"HistoryManager\") as IHistoryManager;\n let from: string = getHashedPath(newURL((history.length > 1 ? history.previous : history.current).url));\n let to: string = getHashedPath(newURL());\n\n this.routes.forEach((method: RouteMethod, path: IRouteToFrom) => {\n let fromRegExp = path.from as RegExp | boolean;\n let toRegExp = path.to as RegExp | boolean;\n\n if (\n typeof fromRegExp === \"boolean\" &&\n typeof toRegExp === \"boolean\"\n ) {\n throw `[Router] path ({ from: ${fromRegExp}, to: ${toRegExp} }) is not valid, remember paths can only be strings, regular expressions, or a boolean; however, both the from and to paths cannot be both booleans.`;\n }\n\n let fromParam: RegExpExecArray | RegExp | boolean = fromRegExp;\n let toParam: RegExpExecArray | RegExp | boolean = toRegExp;\n\n if (fromRegExp instanceof RegExp && fromRegExp.test(from))\n fromParam = fromRegExp.exec(from);\n if (toRegExp instanceof RegExp && toRegExp.test(to))\n toParam = toRegExp.exec(to);\n\n if (\n (Array.isArray(toParam) && Array.isArray(fromParam)) ||\n (Array.isArray(toParam) &&\n typeof fromParam == \"boolean\" &&\n fromParam) ||\n (Array.isArray(fromParam) &&\n typeof toParam == \"boolean\" &&\n toParam)\n )\n method({ from: fromParam, to: toParam, path: { from, to } });\n });\n } else {\n console.warn(\"[Route] HistoryManager is missing.\");\n }\n }\n\n /** Add listeners for PJAX Events */\n public initEvents() {\n this.emitter.on(\"READY\", this.route, this);\n this.emitter.on(\"CONTENT_REPLACED\", this.route, this);\n }\n\n /** Remove listeners for PJAX Events */\n public stopEvents() {\n this.emitter.off(\"READY\", this.route, this);\n this.emitter.off(\"CONTENT_REPLACED\", this.route, this);\n }\n}\n", "import { EventEmitter, EventInput, ListenerCallback } from \"@okikio/emitter\";\nimport { Manager } from \"@okikio/manager\";\n\n// DOM\nexport type AnimationTarget = string | Node | NodeList | HTMLCollection | HTMLElement[] | AnimationTarget[];\nexport const getElements = (selector: string | Node): Node[] => {\n return typeof selector === \"string\" ? Array.from(document.querySelectorAll(selector as string)) : [selector];\n};\n\nconst flatten = (arr: AnimationTarget[]) => [].concat(...arr);\nexport const getTargets = (targets: AnimationTarget): Node[] => {\n if (Array.isArray(targets)) {\n return flatten((targets as AnimationTarget[]).map(getTargets));\n }\n if (typeof targets == \"string\" || targets instanceof Node)\n return getElements(targets);\n if (targets instanceof NodeList || targets instanceof HTMLCollection)\n return Array.from(targets);\n return [];\n};\n\n// VALUES\nexport type closureArgs = [number, number, HTMLElement];\nexport type closure = ((index?: number, total?: number, element?: HTMLElement) => (genericTypes[] | void)) | any;\nexport const computeValue = (value: closure, args: closureArgs, context: Animate) => {\n if (typeof value === \"function\") {\n return value.apply(context, args);\n } else { return value; }\n};\n\nexport const mapObject = (obj: object, args: closureArgs, options: Animate): any => {\n let key: string, value: any, result = {};\n let keys = Object.keys(obj);\n for (let i = 0, len = keys.length; i < len; i++) {\n key = keys[i];\n value = obj[key];\n result[key] = computeValue(value, args, options);\n }\n\n return result;\n};\n\n/** From: [https://easings.net] */\nexport const easings = {\n \"in\": \"ease-in\",\n \"out\": \"ease-out\",\n \"in-out\": \"ease-in-out\",\n\n // Sine\n \"in-sine\": \"cubic-bezier(0.47, 0, 0.745, 0.715)\",\n \"out-sine\": \"cubic-bezier(0.39, 0.575, 0.565, 1)\",\n \"in-out-sine\": \"cubic-bezier(0.445, 0.05, 0.55, 0.95)\",\n\n // Quad\n \"in-quad\": \"cubic-bezier(0.55, 0.085, 0.68, 0.53)\",\n \"out-quad\": \"cubic-bezier(0.25, 0.46, 0.45, 0.94)\",\n \"in-out-quad\": \"cubic-bezier(0.455, 0.03, 0.515, 0.955)\",\n\n // Cubic\n \"in-cubic\": \"cubic-bezier(0.55, 0.055, 0.675, 0.19)\",\n \"out-cubic\": \"cubic-bezier(0.215, 0.61, 0.355, 1)\",\n \"in-out-cubic\": \"cubic-bezier(0.645, 0.045, 0.355, 1)\",\n\n // Quart\n \"in-quart\": \"cubic-bezier(0.895, 0.03, 0.685, 0.22)\",\n \"out-quart\": \"cubic-bezier(0.165, 0.84, 0.44, 1)\",\n \"in-out-quart\": \"cubic-bezier(0.77, 0, 0.175, 1)\",\n\n // Quint\n \"in-quint\": \"cubic-bezier(0.755, 0.05, 0.855, 0.06)\",\n \"out-quint\": \"cubic-bezier(0.23, 1, 0.32, 1)\",\n \"in-out-quint\": \"cubic-bezier(0.86, 0, 0.07, 1)\",\n\n // Expo\n \"in-expo\": \"cubic-bezier(0.95, 0.05, 0.795, 0.035)\",\n \"out-expo\": \"cubic-bezier(0.19, 1, 0.22, 1)\",\n \"in-out-expo\": \"cubic-bezier(1, 0, 0, 1)\",\n\n // Circ\n \"in-circ\": \"cubic-bezier(0.6, 0.04, 0.98, 0.335)\",\n \"out-circ\": \"cubic-bezier(0.075, 0.82, 0.165, 1)\",\n \"in-out-circ\": \"cubic-bezier(0.785, 0.135, 0.15, 0.86)\",\n\n // Back\n \"in-back\": \"cubic-bezier(0.6, -0.28, 0.735, 0.045)\",\n \"out-back\": \"cubic-bezier(0.175, 0.885, 0.32, 1.275)\",\n \"in-out-back\": \"cubic-bezier(0.68, -0.55, 0.265, 1.55)\"\n};\n\nexport const getEase = (ease: string) => {\n return /^(in|out)/.test(ease) ? easings[ease] : ease;\n};\n\nexport type genericTypes = genericTypes[] | boolean | object | string | number | closure | null | undefined;\nexport interface AnimationOptions {\n target?: AnimationTarget,\n\n speed?: number,\n autoplay?: boolean,\n options?: AnimationOptions,\n delay?: number | closure,\n easing?: string | closure,\n endDelay?: number | closure,\n duration?: number | closure,\n keyframes?: Keyframe[] | object[] | closure,\n loop?: number | boolean | closure, // iterations: number,\n onfinish?: (element?: HTMLElement, index?: number, total?: number, animation?: Animation) => any,\n fillMode?: \"none\" | \"forwards\" | \"backwards\" | \"both\" | \"auto\" | closure,\n direction?: \"normal\" | \"reverse\" | \"alternate\" | \"alternate-reverse\" | closure,\n extend?: EffectTiming,\n [property: string]: genericTypes;\n};\n\nexport const DefaultAnimationOptions: AnimationOptions = {\n keyframes: [],\n\n loop: 1, // iterations: number,\n delay: 0,\n speed: 1,\n endDelay: 0,\n easing: \"ease\",\n autoplay: true,\n duration: 1000,\n fillMode: \"auto\",\n direction: \"normal\",\n extend: {}\n};\n\nexport type AnimationEvents = \"update\" | \"play\" | \"pause\" | \"start\" | \"begin\" | \"complete\" | \"finish\" | \"error\" | \"stop\";\n\n/** You can check it out here: https://codepen.io/okikio/pen/qBbdGaW?editors=0011 */\nexport class Animate {\n /**\n * Stores the options for the current animation\n */\n public options: AnimationOptions = {};\n\n /**\n * The Array of Elements to Animate\n */\n public targets: Node[] = [];\n\n /**\n * The properties to animate\n */\n public properties: object = {};\n\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n\n /**\n * The total duration of all Animation's\n */\n public totalDuration: number = 0;\n\n /**\n * The smallest delay out of all Animation's\n */\n public minDelay: number = 0;\n\n /**\n * The options for individual animations\n */\n public computedOptions: Manager = new Manager();\n\n /**\n * The Element the main animation uses\n */\n public mainElement: HTMLElement;\n\n /**\n * Stores an animation that runs on the total duration of the all other Animations, and as such it's the main Animation\n */\n public mainAnimation: Animation;\n\n /**\n * Stores request frame calls\n */\n public animationFrame: number;\n\n /**\n * An event emitter\n */\n public emitter: EventEmitter = new EventEmitter();\n\n /**\n * Returns a promise that is fulfilled when the mainAnimation is finished\n */\n public promise: Promise;\n constructor(options: AnimationOptions = {}) {\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n\n /**\n * Returns a new Promise that is resolve when this.finish is called\n */\n public newPromise(): Promise {\n return new Promise((resolve, reject) => {\n /*\n Note that the `this` keyword is in an Array when it is resolved,\n this is due to Promises not wanting to resolve references,\n so, you can't resolve `this` directly, so, I chose to resolve `this` in an\n Array\n */\n this.on(\"complete\", () => resolve([this]));\n this.on(\"error\", err => reject(err));\n });\n }\n\n /**\n * Fulfills the this.promise Promise\n */\n public then(\n onFulfilled?: (value?: any) => any,\n onRejected?: (reason?: any) => any\n ): Animate {\n onFulfilled = onFulfilled?.bind(this);\n onRejected = onRejected?.bind(this);\n this.promise.then(onFulfilled, onRejected);\n return this;\n }\n\n /**\n * Catches error that occur in the this.promise Promise\n */\n public catch(onRejected: (reason?: any) => any): Animate {\n onRejected = onRejected?.bind(this);\n this.promise.catch(onRejected);\n return this;\n }\n\n /**\n * If you don't care if the this.promise Promise has either been rejected or resolved\n */\n public finally(onFinally: () => any): Animate {\n onFinally = onFinally?.bind(this);\n this.promise.finally(onFinally);\n return this;\n }\n\n /**\n * Represents an Animation Frame Loop\n */\n public loop(): void {\n this.stopLoop();\n this.emit(\"update\", this.getProgress(), this);\n this.animationFrame = window.requestAnimationFrame(this.loop);\n }\n\n /**\n * Cancels animation frame\n */\n public stopLoop() {\n window.cancelAnimationFrame(this.animationFrame);\n }\n\n /**\n * Calls a method that affects all animations including the mainAnimation; the method only allows the animation parameter\n */\n public all(method: (animation?: Animation, target?: HTMLElement) => void) {\n method(this.mainAnimation, this.mainElement);\n this.animations.forEach(method);\n return this;\n }\n\n /**\n * Register the begin event\n */\n protected beginEvent() {\n if (this.getProgress() == 0) {\n let timer: number | void = window.setTimeout(() => {\n this.emit(\"begin\", this);\n timer = window.clearTimeout(timer as number);\n }, this.minDelay);\n }\n }\n\n /**\n * Play Animation\n */\n public play(): Animate {\n let playstate = this.getPlayState();\n this.beginEvent();\n this.all(anim => anim.play());\n this.emit(\"play\", playstate, this);\n this.loop();\n return this;\n }\n\n /**\n * Pause Animation\n */\n public pause(): Animate {\n let playstate = this.getPlayState();\n this.all(anim => anim.pause());\n this.emit(\"pause\", playstate, this);\n this.stopLoop();\n this.animationFrame = undefined;\n return this;\n }\n\n /**\n * Reset all Animations\n */\n public reset() {\n this.setProgress(0);\n this.beginEvent();\n\n if (this.options.autoplay) this.play();\n else this.pause();\n return this;\n }\n\n /**\n * Cancels all Animations\n */\n public cancel() {\n this.all(anim => anim.cancel());\n this.stopLoop();\n return this;\n }\n\n /**\n * Force complete all Animations\n */\n public finish() {\n this.all(anim => anim.finish());\n this.stopLoop();\n return this;\n }\n\n /**\n * Cancels & Clears all Animations\n */\n public stop() {\n this.cancel();\n this.animations.clear();\n while (this.targets.length) this.targets.pop();\n this.mainElement = undefined;\n this.emit(\"stop\");\n }\n\n /**\n * Returns an Array of targets\n */\n public getTargets(): Node[] {\n return this.targets;\n }\n\n /**\n * Get a specific Animation from an Animate instance\n */\n public getAnimation(element: HTMLElement): Animation {\n return this.animations.get(element);\n }\n\n /**\n * Returns the timings of an Animation, given a target\n * E.g. { duration, endDelay, delay, iterations, iterationStart, direction, easing, fill, etc... }\n */\n public getTiming(target: HTMLElement | Animation): AnimationOptions & EffectTiming {\n let animation = target instanceof Animation ? target : this.getAnimation(target);\n let keyframeOptions = this.computedOptions.get(animation) ?? {};\n let timings = animation.effect?.getTiming() ?? {};\n let options = this.getOptions();\n\n return { ...DefaultAnimationOptions, ...options, ...timings, ...keyframeOptions };\n }\n\n /**\n * Returns the total duration of Animation\n */\n public getTotalDuration(): number {\n return this.totalDuration;\n }\n\n /**\n * Returns the current time of the Main Animation\n */\n public getCurrentTime(): number {\n return this.mainAnimation.currentTime;\n }\n\n /**\n * Returns the Animation progress as a fraction of the current time / duration * 100\n */\n public getProgress() {\n return (this.getCurrentTime() / this.totalDuration) * 100;\n }\n\n /**\n * Return the playback speed of the animation\n */\n public getSpeed(): number {\n return this.mainAnimation.playbackRate;\n }\n\n /**\n * Returns the current playing state\n */\n public getPlayState(): \"idle\" | \"running\" | \"paused\" | \"finished\" {\n return this.mainAnimation.playState;\n }\n\n /**\n * Get the options of an Animate instance\n */\n public getOptions(): AnimationOptions {\n return this.options;\n }\n\n /**\n * Set the current time of the Main Animation\n */\n public setCurrentTime(time: number): Animate {\n this.all(anim => { anim.currentTime = time; });\n this.emit(\"update\", this.getProgress());\n return this;\n }\n\n /**\n * Set the Animation progress as a value from 0 to 100\n */\n public setProgress(percent: number): Animate {\n let time = (percent / 100) * this.totalDuration;\n this.setCurrentTime(time);\n return this;\n }\n\n /**\n * Set the playback speed of an Animation\n */\n public setSpeed(speed: number = 1): Animate {\n this.all(anim => { anim.playbackRate = speed; });\n return this;\n }\n\n /**\n * Adds a listener for a given event\n */\n public on(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.on(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Removes a listener from an event\n */\n public off(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.off(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Call all listeners within an event\n */\n public emit(events: AnimationEvents | string | any[], ...args: any): Animate {\n this.emitter.emit(events, ...args);\n return this;\n }\n\n\n /** Returns the Animate options, as JSON */\n public toJSON(): AnimationOptions {\n return this.getOptions();\n }\n\n /**\n * The Symbol.toStringTag well-known symbol is a string valued property that is used\n * in the creation of the default string description of an object.\n * It is accessed internally by the Object.prototype.toString() method.\n */\n get [Symbol.toStringTag]() {\n return `Animate`;\n }\n}\n\n/** Creates a new Animate instance */\nexport const animate = (options: AnimationOptions = {}): Animate => {\n return new Animate(options);\n};\n\nexport class Timeline extends Animate {\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n constructor(options: AnimationOptions = {}) {\n super();\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n public add(options: AnimationOptions) {\n return this;\n }\n}\n\nexport default animate;"], - "mappings": "kIAAA,2sBCeO,GAAM,IAAkB,CAC3B,YAAa,UACb,eAAgB,eAChB,eAAgB,cAChB,QAAS,CACL,CAAC,YAAa,SAElB,gBAAiB,iBACjB,eAAgB,gBAChB,eAAgB,aAChB,UAAW,QACX,QAAS,IACT,SAAU,GAID,EAAY,AAAC,GACf,OAAO,OAAO,IAAK,IAAmB,GAIpC,GAAS,CAAC,EAAiB,EAAe,EAAoB,KAAiB,CACxF,GAAI,CAAE,UAAW,EACb,EAAO,OAAO,EAAS,IAAM,EAAS,MAAM,IAChD,MAAO,GAAW,IAAI,KAAU,GAIvB,EAAY,CAAC,EAAiB,EAAoB,EAAoB,KAAc,CAC7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,EAAa,OAAS,EACrC,KAAK,WAIV,EAAmB,EAAU,EAAkB,CAAC,EAAG,EAAK,GAAS,MAC3D,EAAa,OAAS,GACxB,GAAoB,EAAU,EAAmB,CAAC,EAAG,EAAK,GAAS,OAGvE,GAAI,GAAgB,EAAiB,MAChC,EAAiB,SAAW,EAAiB,WAC9C,EAAiB,SACrB,AAAI,KAAK,cAAgB,GAAe,MAAK,cAAgB,GAG7D,GAAI,GAAY,EAAO,QAAQ,EAAmB,GAGlD,EAAU,SAAW,IAAM,CACvB,MAAO,IAAY,YAAc,EAAS,KAAK,KAAM,EAAQ,EAAG,EAAK,GACrE,KAAK,KAAK,SAAU,EAAQ,EAAG,EAAK,IAIxC,KAAK,gBAAgB,IAAI,EAAW,GACpC,KAAK,WAAW,IAAI,EAAQ,GAC5B,EAAO,KAAK,EAAiB,OAGjC,KAAK,cAAgB,KAAK,YAAY,QAAQ,CAC1C,CAAE,QAAS,KACX,CAAE,QAAS,MACZ,CAEC,SAAU,KAAK,cACf,OAAQ,WAGZ,KAAK,SAAW,KAAK,IAAI,GAAG,GAC5B,KAAK,SAAS,GACd,AAAI,EAAU,KAAK,OACd,KAAK,QAEV,KAAK,QAAU,KAAK,aACpB,KAAK,cAAc,SAAW,IAAM,CAChC,KAAK,KAAK,WAAY,MACtB,KAAK,kBAEJ,EAAP,CACE,KAAK,KAAK,QAAS,IAGpB,IAAI,EAA2B,CAClC,MAAO", + "sourcesContent": ["export * from \"./config\";\nexport * from \"./manager\";\nexport * from \"./url\";\n\nexport * from \"./history\";\nexport * from \"./page\";\n\nexport * from \"./emitter\";\nexport * from \"./service\";\n\nexport * from \"./transition\";\n\nexport * from \"./app\";\nexport * from \"./pjax\";\nexport * from \"./router\";\n\nexport * from \"./animate\";\n", "export interface ICONFIG {\n prefix?: string;\n wrapperAttr?: string;\n noAjaxLinkAttr?: string;\n noPrefetchAttr?: \"no-prefetch\";\n headers?: string[][];\n preventSelfAttr?: string;\n preventAllAttr?: string;\n transitionAttr?: string;\n blockAttr?: string;\n timeout?: number;\n maxPages?: number;\n resizeDelay?: number;\n [key: string]: any;\n}\n\nexport const CONFIG_DEFAULTS: ICONFIG = {\n wrapperAttr: \"wrapper\",\n noAjaxLinkAttr: \"no-ajax-link\",\n noPrefetchAttr: \"no-prefetch\",\n headers: [\n [\"x-partial\", \"true\"]\n ],\n preventSelfAttr: `prevent=\"self\"`,\n preventAllAttr: `prevent=\"all\"`,\n transitionAttr: \"transition\",\n blockAttr: `block`,\n timeout: 30000,\n maxPages: 5,\n resizeDelay: 100\n};\n\nexport type ConfigKeys = keyof typeof CONFIG_DEFAULTS | string;\nexport const newConfig = (config: ICONFIG): ICONFIG => {\n return Object.assign({ ...CONFIG_DEFAULTS }, config);\n};\n\n/** Converts string into properly formatted data attributes */\nexport const toAttr = (config: ICONFIG, value: string, brackets: boolean = true): string => {\n let { prefix } = config;\n let attr = `data${prefix ? \"-\" + prefix : \"\"}-${value}`;\n return brackets ? `[${attr}]` : attr;\n};\n\n/** Selects config vars, and formats them for use, or simply returns the current configurations for the framework */\nexport const getConfig = (config: ICONFIG, value?: ConfigKeys, brackets: boolean = true): any => {\n if (typeof value !== \"string\")\n return config;\n\n let prop = config[value];\n if (typeof prop === \"string\")\n return toAttr(config, prop, brackets);\n return prop;\n};\n", "/** Manages complex lists of named data, eg. A page can be stored in a list by of other pages with the url being how the page is stored in the list. Managers use Maps to store data */\nexport class Manager {\n\t/** The complex list of named data, to which the Manager controls */\n\tpublic map: Map;\n\tconstructor(value?: Array<[K, V]>) {\n\t\tthis.map = new Map(value);\n\t}\n\n\t/** Returns the Manager classes base Map */\n\tpublic getMap(): Map {\n\t\treturn this.map;\n\t}\n\n\t/** Get a value stored in the Manager */\n\tpublic get(key: K): V {\n\t\treturn this.map.get(key);\n\t}\n\n\t/** Returns the keys of all items stored in the Manager as an Array */\n\tpublic keys(): Array {\n\t\treturn Array.from(this.map.keys());\n\t}\n\n\t/** Returns the values of all items stored in the Manager as an Array */\n\tpublic values(): Array {\n\t\treturn Array.from(this.map.values());\n\t}\n\n\t/** Set a value to the Manager using a key */\n\tpublic set(key: K, value: V): Manager {\n\t\tthis.map.set(key, value);\n\t\treturn this;\n\t}\n\n\t/** Adds a value to Manager, and uses the current size of the Manager as it's key, it works best when all the key in the Manager are numbers */\n\tpublic add(value: V): Manager {\n\t\tlet size = this.size;\n\t\t// @ts-ignore\n\t\tlet num: K = size as K;\n\t\tthis.set(num, value);\n\t\treturn this;\n\t}\n\n\t/** Returns the total number of items stored in the Manager */\n\tpublic get size(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** An alias for size */\n\tpublic get length(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** Returns the last item in the Manager who's index is a certain distance from the last item in the Manager */\n\tpublic last(distance: number = 1): V | undefined {\n\t\tlet key = this.keys()[this.size - distance];\n\t\treturn this.get(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns true if an element in the Map object existed and has been removed, or false if the element does not exist */\n\tpublic delete(key: K): boolean {\n\t\treturn this.map.delete(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns the Manager class, allowing for chains */\n\tpublic remove(key: K): Manager {\n\t\tthis.map.delete(key);\n\t\treturn this;\n\t}\n\n\t/** Clear the Manager of all its contents */\n\tpublic clear(): Manager {\n\t\tthis.map.clear();\n\t\treturn this;\n\t}\n\n\t/** Checks if the Manager contains a certain key */\n\tpublic has(key: K): boolean {\n\t\treturn this.map.has(key);\n\t}\n\n\t/** Returns a new Iterator object that contains an array of [key, value] for each element in the Map object in insertion order. */\n\tpublic entries(): IterableIterator<[K, V]> {\n\t\treturn this.map.entries();\n\t}\n\n\t/** Iterates through the Managers contents, calling a callback function every iteration */\n\tpublic forEach(\n\t\tcallback: (value?: V, key?: K, map?: Map) => void,\n\t\tcontext?: object\n\t): Manager {\n\t\tthis.map.forEach(callback, context);\n\t\treturn this;\n\t}\n\n\t/** Allows for iteration via for..of, learn more: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators] */\n\tpublic [Symbol.iterator](): IterableIterator<[K, V]> {\n\t\treturn this.entries();\n\t}\n}\n\n/**\n * Calls the method of a certain name for all items that are currently installed\n */\nexport const methodCall = (manager: Manager, method: string, ...args: any): void => {\n\tmanager.forEach((item) => {\n\t\t// @ts-ignore\n\t\titem[method](...args);\n\t});\n};\n\n/**\n * Asynchronously calls the method of a certain name for all items that are currently installed, similar to methodCall\n */\nexport const asyncMethodCall = async (manager: Manager, method: string, ...args: any): Promise => {\n\tfor (let [, item] of manager) {\n\t\t// @ts-ignore\n\t\tawait item[method](...args);\n\t}\n};\n\nexport default Manager;\n", "import { Manager, methodCall, asyncMethodCall } from \"@okikio/manager\";\nimport { ICONFIG } from \"./config\";\nimport { IApp } from \"./app\";\nimport { EventEmitter } from \"./emitter\";\n\nexport type IAdvancedManager = AdvancedManager;\n\n/** The base class for AdvancedManager items */\nexport class ManagerItem {\n /** The AdvancedManager the ManagerItem is attached to */\n public manager: IAdvancedManager;\n\n /** The App the ManagerItem is attached to */\n public app: IApp;\n\n /** The Config of the App the ManagerItem is attached to */\n public config: ICONFIG;\n\n /** The EventEmitter of the App the ManagerItem is attached to */\n public emitter: EventEmitter;\n\n /** The key to where ManagerItem is stored in an AdvancedManager */\n public key: any;\n\n constructor() { }\n\n /** Run after the Manager Item has been registered */\n public install(): any { }\n\n /** Register the current Manager Item's manager */\n public register(manager: IAdvancedManager, key: any): ManagerItem {\n this.manager = manager;\n this.app = manager.app;\n this.config = manager.config;\n this.emitter = manager.emitter;\n this.key = key;\n this.install();\n return this;\n }\n\n /** Run before the ManagerItem has been unregistered */\n public uninstall(): any { }\n\n /** Basically removes a ManagerItem, in order to recover the ManagerItem, it needs to be re-added to an AdvancedManager */\n public unregister() {\n this.uninstall();\n\n this.manager.remove(this.key);\n this.key = undefined;\n this.manager = undefined;\n this.app = undefined;\n this.config = undefined;\n this.emitter = undefined;\n }\n}\n\n/** A tweak to the Manager class that makes it self aware of the App class it's instantiated in */\nexport class AdvancedManager extends Manager {\n /** The App the AdvancedManager is attached to */\n public app: IApp;\n\n /** The Config of the App the AdvancedManager is attached to */\n public config: ICONFIG;\n\n /** The EventEmitter of the App the AdvancedManager is attached to */\n public emitter: EventEmitter;\n\n /** Register App details */\n constructor(app: IApp) {\n super();\n this.app = app;\n this.config = app.config;\n this.emitter = app.emitter;\n }\n\n /** Add a ManagerItem to AdvancedManager at a specified key */\n public set(key: K, value: V) {\n super.set(key, value);\n value.register(this, key);\n return this;\n }\n}\n\nexport { Manager, methodCall, asyncMethodCall };\n", "export const newURL = (url: string | URL | Location = window.location.href): URL => {\n return url instanceof URL ? url : new URL(url as unknown as string, window.location.origin);\n};\n\n/** Returns the pathname with the hash at the end */\nexport const getHashedPath = (url: URL | string): string => {\n let _url = newURL(url);\n return `${_url.pathname}${_url.hash}`;\n};\n\n/** Returns the actual hash without the hashtag */\nexport const getHash = (url: URL | string): string => newURL(url).hash.slice(1);\n\n/** Removes the hash from the full URL for a clean URL string */\nexport const clean = (url: URL | string): string => newURL(url).toString().replace(/(\\/#.*|\\/|#.*)$/, '');\n\n/** Compares two URLs to each other */\nexport const equal = (a: URL | string, b: URL | string): boolean => (clean(a) === clean(b));\n\n", "import { AdvancedManager, ManagerItem, methodCall } from \"./manager\";\nimport { IApp } from \"./app\";\n\n/** Controls specific kinds of actions that require JS */\nexport class Service extends ManagerItem {\n\t/** Called before the start of a Service, represents a constructor of sorts */\n\tpublic init(...args: any): any;\n\tpublic init(): any { }\n\n\t/** Called on start of Service */\n\tpublic boot(...args: any): any;\n\tpublic boot(): any {\n\t\tthis.initEvents();\n\t}\n\n\t/** Initialize events */\n\tpublic initEvents(): void { }\n\n\t/** Stop events */\n\tpublic stopEvents(): void { }\n\n\t/** Stop services */\n\tpublic stop(): void {\n\t\tthis.stopEvents();\n\t\tthis.unregister();\n\t}\n}\n\n/** The Service Manager controls the lifecycle of all Services in an App */\nexport class ServiceManager extends AdvancedManager {\n\tconstructor(app: IApp) {\n\t\tsuper(app);\n\t}\n\n\t/** Call the init method for all Services */\n\tpublic init(): ServiceManager {\n\t\tmethodCall(this, \"init\");\n\t\treturn this;\n\t}\n\n\t/** Call the boot method for all Services */\n\tpublic boot(): ServiceManager {\n\t\tmethodCall(this, \"boot\");\n\t\treturn this;\n\t}\n\n\t/** Call the stop method for all Services */\n\tpublic stop(): ServiceManager {\n\t\tmethodCall(this, \"stop\");\n\t\treturn this;\n\t}\n}\n", "import { Service } from \"./service\";\nimport { getHashedPath, newURL } from \"./url\";\n\nexport type Trigger = HTMLAnchorElement | \"HistoryManager\" | \"popstate\" | \"back\" | \"forward\";\nexport interface ICoords {\n\treadonly x: number;\n\treadonly y: number;\n}\n\nexport interface IStateData {\n\tscroll: ICoords;\n\t[key: string]: any;\n}\n\nexport interface IState {\n\turl: string;\n\tindex?: number;\n\ttransition: string;\n\tdata: IStateData;\n}\n\nexport interface IHistoryItem {\n\tindex: number;\n\tstates: IState[];\n}\n\nexport interface IHistoryManager extends Service {\n\tstates: IState[],\n\tpointer: number,\n\n\tinit(): any,\n\tget(index: number): IState,\n\tadd(value?: IState, historyAction?: \"replace\" | \"push\"): HistoryManager,\n\tremove(index?: number): HistoryManager,\n\treplace(newStates: IState[]): HistoryManager,\n\tset(i: number, state: IState): IState,\n\tcurrent: IState,\n\tlast: IState,\n\tprevious: IState | null,\n\tlength: number,\n}\n\n/** A quick snapshot of page scroll coordinates */\nexport const newCoords = (x: number = window.scrollX, y: number = window.scrollY): ICoords => ({ x, y });\n\n/** Creates a state; a state represents the current status of the page consisting of properties like: url, transition, and data */\nexport const newState = (state: IState = {\n\turl: getHashedPath(newURL()),\n\tindex: 0,\n\ttransition: \"default\",\n\tdata: {\n\t\tscroll: newCoords(),\n\t\ttrigger: \"HistoryManager\"\n\t}\n}): IState => (state);\n\n/** Keeps a record of the history of the App; it stores only the states of Pages */\nexport class HistoryManager extends Service implements IHistoryManager {\n\tpublic states: IState[];\n\tpublic pointer = -1;\n\n\t/** Initializes the states array, and replace the history pushState data with the states array */\n\tinit() {\n\t\tthis.states = [];\n\n\t\tlet state = newState();\n\t\tthis.add(state, \"replace\");\n\t}\n\n\t/** Get a state based on it's index */\n\tpublic get(index: number) {\n\t\treturn this.states[index];\n\t}\n\n\t/** Add a state to HistoryManager and change the history pushState data based on the historyAction specified */\n\tpublic add(value?: IState, historyAction: \"replace\" | \"push\" = \"push\"): HistoryManager {\n\t\tlet state = newState(value);\n\t\tlet len = this.length;\n\t\tthis.states.push({ ...state });\n\t\tthis.pointer = len;\n\n\t\tlet item: IHistoryItem = {\n\t\t\tindex: this.pointer,\n\t\t\tstates: [...this.states]\n\t\t};\n\t\tchangeState(historyAction, state, item);\n\t\treturn this;\n\t}\n\n\tpublic remove(index?: number) {\n\t\tif (index) {\n\t\t\tthis.states.splice(index, 1);\n\t\t} else {\n\t\t\tthis.states.pop();\n\t\t}\n\n\t\tthis.pointer--;\n\t\treturn this;\n\t}\n\n\t/** Replaces the states array with another states array, this is later used when going back and forward in page history */\n\tpublic replace(newStates: IState[]) {\n\t\tthis.states = newStates;\n\t\treturn this;\n\t}\n\n\t/** Set state by index. */\n\tpublic set(i: number, state: IState) {\n\t\treturn (this.states[i] = state);\n\t}\n\n\t/** Get the current state */\n\tget current(): IState {\n\t\treturn this.get(this.pointer);\n\t}\n\n\t/** Get the last state (top of the history stack). */\n\tget last(): IState {\n\t\treturn this.get(this.length - 1);\n\t}\n\n\t/** Get the previous state. */\n\tget previous(): IState | null {\n\t\treturn this.pointer < 1 ? null : this.get(this.pointer - 1);\n\t}\n\n\tget length() {\n\t\treturn this.states.length;\n\t}\n}\n\n/** Either push or replace history state */\nexport const changeState = (action: \"push\" | \"replace\", state: IState, item: object) => {\n\tlet href = getHashedPath(state.url);\n\tlet args = [item, \"\", href];\n\tif (window.history) {\n\t\tswitch (action) {\n\t\t\tcase \"push\":\n\t\t\t\twindow.history.pushState.apply(window.history, args);\n\t\t\t\tbreak;\n\t\t\tcase \"replace\":\n\t\t\t\twindow.history.replaceState.apply(window.history, args);\n\t\t\t\tbreak;\n\t\t}\n\t}\n};\n", "import { Manager, ManagerItem, AdvancedManager } from \"./manager\";\nimport { equal, newURL } from \"./url\";\nimport { getConfig } from \"./config\";\nimport { Service } from \"./service\";\n\nexport interface IPage extends ManagerItem {\n dom: Document,\n wrapper: HTMLElement,\n title: string,\n head: Element,\n body: Element,\n url: URL,\n data: string,\n wrapperAttr: string,\n\n build(): any,\n install(): void,\n uninstall(): any,\n}\n\n/**\n * Parses strings to DOM\n */\nexport const PARSER: DOMParser = new DOMParser();\n\n/** A page represents the DOM elements that create each page */\nexport class Page extends ManagerItem implements IPage {\n /** Holds the DOM of the current page */\n public dom: Document;\n\n /** Holds the wrapper element to be swapped out of each Page */\n public wrapper: HTMLElement;\n\n /** Holds the title of each page */\n public title: string;\n\n /** Holds the head element of each page */\n public head: Element;\n\n /** Holds the body element of each page */\n public body: Element;\n\n /** The URL of the current page */\n public url: URL;\n\n /** The payload of a page request */\n public data: string;\n\n /** Attr that identifies the wrapper */\n public wrapperAttr: string;\n\n constructor(url: URL = newURL(), dom: string | Document = document) {\n super();\n this.url = url;\n\n if (typeof dom === \"string\") {\n this.data = dom;\n } else this.dom = dom || document;\n }\n\n /** Builds the page's dom, and sets the title, head, body, and wrapper properties of the Page class */\n public build() {\n if (!(this.dom instanceof Node)) {\n this.dom = PARSER.parseFromString(this.data, \"text/html\");\n }\n\n if (!(this.body instanceof Node)) {\n let { title, head, body } = this.dom;\n this.title = title;\n this.head = head;\n this.body = body;\n this.wrapper = this.body.querySelector(this.wrapperAttr);\n }\n }\n\n public install() {\n this.wrapperAttr = getConfig(this.config, \"wrapperAttr\");\n }\n\n public uninstall() {\n this.url = undefined;\n this.title = undefined;\n this.head = undefined;\n this.body = undefined;\n this.dom = undefined;\n this.wrapper = undefined;\n this.data = undefined;\n this.wrapperAttr = undefined;\n }\n}\n\nexport interface IPageManager extends Service {\n loading: Manager>,\n pages: AdvancedManager;\n\n install(): any,\n\n get(key): Page,\n add(value): PageManager,\n set(key, value): PageManager,\n remove(key): PageManager,\n has(key): boolean,\n clear(): PageManager,\n size: number,\n keys(): any[],\n\n load(_url: URL | string): Promise,\n request(url: string): Promise,\n}\n\n/** Controls which page to load */\nexport class PageManager extends Service implements IPageManager {\n /** Stores all fetch requests that are currently loading */\n public loading: Manager> = new Manager();\n\n pages: AdvancedManager;\n\n /** Instantiate pages, and add the current page to pages */\n install() {\n this.pages = new AdvancedManager(this.app);\n\n let URLString = newURL().pathname;\n this.set(URLString, new Page());\n URLString = undefined;\n }\n\n get(key) { return this.pages.get(key); }\n add(value) { this.pages.add(value); return this; }\n set(key, value) { this.pages.set(key, value); return this; }\n remove(key) { this.pages.remove(key); return this; }\n has(key) { return this.pages.has(key); }\n clear() { this.pages.clear(); return this; }\n get size() { return this.pages.size; }\n keys() { return this.pages.keys(); }\n\n /** Load from cache or by requesting URL via a fetch request, avoid requesting for the same thing twice by storing the fetch request in \"this.loading\" */\n public async load(_url: URL | string = newURL()): Promise {\n let url: URL = newURL(_url);\n let urlString: string = url.pathname;\n let page: Page, request: Promise;\n\n if (this.has(urlString)) {\n page = this.get(urlString);\n return Promise.resolve(page);\n }\n\n if (!this.loading.has(urlString)) {\n request = this.request(urlString);\n this.loading.set(urlString, request);\n } else request = this.loading.get(urlString);\n\n let response = await request;\n this.loading.remove(urlString);\n\n page = new Page(url, response);\n this.set(urlString, page);\n\n if (this.size > getConfig(this.config, \"maxPages\")) {\n let currentUrl = newURL();\n let keys = this.keys();\n let first = equal(currentUrl, keys[0]) ? keys[1] : keys[0];\n let page = this.get(first);\n page.unregister();\n page = undefined;\n keys = undefined;\n currentUrl = undefined;\n first = undefined;\n }\n\n return page;\n }\n\n /** Starts a fetch request */\n public async request(url: string): Promise {\n const headers = new Headers(getConfig(this.config, \"headers\"));\n const timeout = window.setTimeout(() => {\n window.clearTimeout(timeout);\n throw \"Request Timed Out!\";\n }, getConfig(this.config, \"timeout\"));\n\n try {\n let response = await fetch(url, {\n mode: 'same-origin',\n method: \"GET\",\n headers,\n cache: \"default\",\n credentials: \"same-origin\",\n });\n\n window.clearTimeout(timeout);\n if (response.status >= 200 && response.status < 300) {\n return await response.text();\n }\n\n const err = new Error(response.statusText || \"\" + response.status);\n throw err;\n } catch (err) {\n window.clearTimeout(timeout);\n throw err;\n }\n }\n}\n", "import { Manager, methodCall } from \"@okikio/manager\";\n\nexport type ListenerCallback = ((...args: any) => void);\nexport interface IListener {\n readonly callback: ListenerCallback;\n readonly scope: object;\n readonly name: string;\n}\n\n/** Represents a new event listener consisting of properties like: callback, scope, name */\nexport const newListener = ({\n callback = () => { },\n scope = null,\n name = \"event\",\n}: IListener): IListener => ({ callback, scope, name });\n\n/** Represents a new event */\nexport class Event extends Manager {\n /** The name of the event */\n public name: string;\n constructor(name: string = \"event\") {\n super();\n this.name = name;\n }\n}\n\nexport type EventInput = string | object | Array;\n\n/**\n * An Event Emitter\n * */\nexport class EventEmitter extends Manager {\n constructor() {\n super();\n }\n\n /** Gets event, if event doesn't exist create a new one */\n public getEvent(name: string): Event {\n let event = this.get(name);\n if (!(event instanceof Event)) {\n this.set(name, new Event(name));\n return this.get(name);\n }\n\n return event;\n }\n\n /** Creates a listener and adds it to an event */\n public newListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event = this.getEvent(name);\n event.add(newListener({ name, callback, scope }));\n return event;\n }\n\n /** Adds a listener to a given event */\n public on(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n this.newListener(_name, _callback, _scope);\n }, this);\n return this;\n }\n\n /** Removes a listener from an event */\n public removeListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event: Event = this.get(name);\n if (event instanceof Event && callback) {\n let listener = newListener({ name, callback, scope });\n\n event.forEach((value: IListener, i: number) => {\n if (\n value.callback === listener.callback &&\n value.scope === listener.scope\n ) {\n return event.remove(i);\n }\n });\n }\n\n return event;\n }\n\n /** Remove a listener from a given event, or just completely remove an event */\n public off(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n if (typeof _callback === \"function\") {\n this.removeListener(_name, _callback, _scope);\n } else this.remove(_name);\n }, this);\n return this;\n }\n\n /** Call all listeners within an event */\n public emit(\n events: string | Array,\n ...args: any\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n // Loop through the list of events\n events.forEach((event: string) => {\n let _event: Event = this.get(event);\n\n if (_event instanceof Event) {\n _event.forEach((listener: IListener) => {\n let { callback, scope } = listener;\n callback.apply(scope, args);\n });\n }\n }, this);\n return this;\n }\n\n /** Clears events and event listeners */\n public clear() {\n methodCall(this, \"clear\");\n super.clear();\n return this;\n }\n}\n\nexport default EventEmitter;\n", "import { Manager } from \"./manager\";\nimport { ICoords, newCoords, Trigger } from \"./history\";\nimport { IPage } from \"./page\";\nimport { getConfig } from \"./config\";\nimport { Service } from \"./service\";\nimport { newURL } from \"./url\";\n\n/**\n * The async function type, allows for smooth transition between Promises\n */\nexport type asyncFn = (err?: any, value?: any) => void;\nexport interface ITransition {\n oldPage?: IPage;\n newPage?: IPage;\n trigger?: Trigger;\n scroll?: { x: number; y: number };\n scrollable?: boolean;\n in: (data: ITransitionData) => any;\n out: (data: ITransitionData) => any;\n [key: string]: any;\n}\nexport interface ITransitionData {\n from?: IPage;\n to?: IPage;\n trigger?: Trigger;\n scroll?: ICoords;\n done: asyncFn;\n}\nexport interface ITransitionManager extends Service {\n transitions: Manager,\n\n get(key: string): ITransition,\n set(key: string, value: ITransition): TransitionManager,\n add(value: ITransition): TransitionManager,\n has(key: string): boolean,\n\n boot(): any,\n animate(name: string, data: any): Promise,\n}\n\n/** Auto scrolls to an elements position if the element has an hash */\nexport const hashAction = (coords?: ICoords, hash: string = window.location.hash) => {\n try {\n let _hash = hash[0] == \"#\" ? hash : newURL(hash).hash;\n if (_hash.length > 1) {\n let el = document.getElementById(_hash.slice(1));\n if (el) {\n let { left, top } = el.getBoundingClientRect();\n let scrollLeft = window.pageXOffset;\n let scrollTop = window.pageYOffset;\n let x = left + scrollLeft;\n let y = top + scrollTop;\n\n console.log(x, y);\n return newCoords(x, y);\n }\n }\n } catch (e) {\n console.warn(\"[hashAction] error\", e);\n }\n\n return coords ?? newCoords(0, 0);\n};\n\n// The Default Transition\nconst Default: ITransition = {\n name: \"default\",\n scrollable: true,\n\n out({ done }: ITransitionData) {\n done();\n },\n in({ scroll, done }: ITransitionData) {\n window.scroll(scroll.x, scroll.y);\n done();\n }\n};\n\n/** Controls which Transition between pages to use */\nexport class TransitionManager extends Service implements ITransitionManager {\n transitions: Manager;\n private _arg: Array<[string, ITransition]>;\n constructor(transitions?: Array<[string, ITransition]>) {\n super();\n this._arg = transitions;\n }\n\n /** On Service install set Config */\n public install() {\n super.install();\n\n let transitions = this._arg && this._arg.length ? this._arg : (getConfig(this.config, \"transitions\") ?? []);\n\n // Manager like Maps use the most recent [key, value] Array it knows, replacing the default transition\n // With any other transitions called [\"default\", ...]\n transitions = [[\"default\", Default]].concat(transitions);\n this.transitions = new Manager(transitions);\n }\n\n get(key: string) { return this.transitions.get(key); }\n set(key: string, value: ITransition) { this.transitions.set(key, value); return this; }\n add(value: ITransition) { this.transitions.add(value); return this; }\n has(key: string) { return this.transitions.has(key); }\n\n /** Starts a transition */\n public async animate(name: string, data: any): Promise {\n let transition: ITransition = this.transitions.get(name);\n let scroll = data.scroll;\n let ignoreHashAction = data.ignoreHashAction;\n if (!(\"wrapper\" in data.oldPage) || !(\"wrapper\" in data.newPage))\n throw `[Page] either oldPage or newPage aren't instances of the Page Class.\\n ${{\n newPage: data.newPage,\n oldPage: data.oldPage,\n }}`;\n\n // Replace the title\n document.title = `` + data.newPage.title;\n\n let fromWrapper = data.oldPage.wrapper;\n let toWrapper = data.newPage.wrapper;\n\n if (!(fromWrapper instanceof Node) || !(toWrapper instanceof Node))\n throw `[Wrapper] the wrapper from the ${!(toWrapper instanceof Node) ? \"next\" : \"current\"\n } page cannot be found. The wrapper must be an element that has the attribute ${getConfig(this.config,\n \"wrapperAttr\"\n )}.`;\n\n // Give the Transition all the background data it may require\n transition.init && transition?.init(data);\n\n this.emitter.emit(\"BEFORE_TRANSITION_OUT\");\n\n // Start the out point of the Transition\n if (transition.out) {\n await new Promise((done) => {\n let outMethod: Promise = transition.out.call(transition, {\n ...data,\n from: data.oldPage,\n trigger: data.trigger,\n done,\n });\n\n outMethod?.then(done);\n });\n }\n\n this.emitter.emit(\"AFTER_TRANSITION_OUT\");\n\n // Add the new wrapper before the old one\n await new Promise((done) => {\n fromWrapper.insertAdjacentElement(\"beforebegin\", toWrapper);\n this.emitter.emit(\"CONTENT_INSERT\");\n\n if (!ignoreHashAction && !/back|popstate|forward/.test(data.trigger as string)) {\n scroll = hashAction(scroll);\n }\n done();\n });\n\n // Replace the old wrapper with the new one\n await new Promise((done) => {\n fromWrapper.remove();\n fromWrapper = undefined;\n toWrapper = undefined;\n this.emitter.emit(\"CONTENT_REPLACED\");\n done();\n });\n\n this.emitter.emit(\"BEFORE_TRANSITION_IN\");\n\n // Start the in point of the Transition (only the in method has access to the hashAction's scroll position)\n if (transition.in) {\n await new Promise(async (done) => {\n let inMethod: Promise = transition.in.call(transition, {\n ...data,\n from: data.oldPage,\n to: data.newPage,\n trigger: data.trigger,\n scroll,\n done,\n });\n\n inMethod?.then(done);\n });\n }\n\n this.emitter.emit(\"AFTER_TRANSITION_IN\");\n return transition;\n }\n}\n", "import { EventEmitter, ListenerCallback, EventInput } from \"./emitter\";\nimport { ServiceManager, Service } from \"./service\";\nimport { newConfig, ICONFIG, getConfig } from \"./config\";\n\nexport interface IApp {\n services: ServiceManager,\n emitter: EventEmitter,\n config: ICONFIG,\n register(config: ICONFIG): App,\n get(key: string): Service,\n set(key: string, service: Service): App,\n add(value: Service): App,\n boot(): App,\n stop(): App,\n on(events: EventInput, callback?: ListenerCallback): App,\n off(events: EventInput, callback?: ListenerCallback): App,\n emit(events: string | any[], ...args: any): App,\n}\n\n/** The App class starts the entire process, it controls all managers and all services */\nexport class App implements IApp {\n /** An instance of the ServiceManager */\n public services: ServiceManager;\n\n /** An instance of an EventEmitter */\n public emitter: EventEmitter;\n\n /** The current Configuration's for the App */\n public config: ICONFIG;\n\n private canResize = true;\n private canScroll = true;\n constructor(config: object = {}) {\n this._resize = this._resize.bind(this);\n this._scroll = this._scroll.bind(this);\n this._ready = this._ready.bind(this);\n this.register(config);\n }\n\n /** Create new instances of the ServiceManager, EventEmitter and the configurations */\n public register(config: ICONFIG = {}): App {\n this.config = newConfig(config);\n this.emitter = new EventEmitter();\n this.services = new ServiceManager(this);\n\n document.addEventListener(\"DOMContentLoaded\", this._ready);\n window.addEventListener(\"load\", this._ready);\n window.addEventListener(\"resize\", this._resize, { passive: true });\n window.addEventListener(\"scroll\", this._scroll, { passive: true });\n return this;\n }\n\n private _ready() {\n document.removeEventListener(\"DOMContentLoaded\", this._ready);\n window.removeEventListener(\"load\", this._ready);\n this.emitter.emit(\"READY ready\");\n }\n\n private _resize() {\n if (this.canResize) {\n let timer: number | void, raf: number | void;\n this.canResize = false;\n raf = window.requestAnimationFrame(() => {\n this.emitter.emit(\"RESIZE resize\");\n\n // set a timeout to un-throttle\n timer = window.setTimeout(() => {\n this.canResize = true;\n timer = window.clearTimeout(timer as number);\n raf = window.cancelAnimationFrame(raf as number);\n }, getConfig(this.config, \"resizeDelay\"));\n });\n }\n }\n\n private _scroll() {\n if (this.canScroll) {\n let raf: number | void;\n this.canScroll = false;\n raf = requestAnimationFrame(() => {\n this.emitter.emit(\"SCROLL scroll\");\n\n this.canScroll = true;\n raf = window.cancelAnimationFrame(raf as number);\n });\n }\n }\n\n /** Shortcuts to adding, setting, and getting Services */\n public get(key: string): Service {\n return this.services.get(key);\n }\n\n public set(key: string, value: Service): App {\n this.services.set(key, value);\n return this;\n }\n\n public add(value: Service): App {\n this.services.add(value);\n return this;\n }\n\n /** Initialize and boot all Services */\n public boot(): App {\n this.services.init();\n this.services.boot();\n return this;\n }\n\n /** Stops all Services and clears the even emitter of all events and listeners */\n public stop(): App {\n this.services.stop();\n this.emitter.clear();\n return this;\n }\n\n /** Shortcuts to the App EventEmitter on, off, and emit methods */\n public on(events: EventInput, callback?: ListenerCallback): App {\n this.emitter.on(events, callback, this);\n return this;\n }\n\n public off(events: EventInput, callback?: ListenerCallback): App {\n this.emitter.off(events, callback, this);\n return this;\n }\n\n public emit(events: string | any[], ...args: any): App {\n this.emitter.emit(events, ...args);\n return this;\n }\n}\n", "import { newState, Trigger, newCoords, IHistoryItem, IHistoryManager } from \"./history\";\nimport { Service } from \"./service\";\nimport { IPage, IPageManager } from \"./page\";\nimport { newURL, getHashedPath, equal } from \"./url\";\nimport { getConfig } from \"./config\";\nimport { hashAction, ITransitionManager } from \"./transition\";\n\nexport type LinkEvent = MouseEvent | TouchEvent;\nexport type StateEvent = LinkEvent | PopStateEvent;\nexport type IgnoreURLsList = Array;\n/**\n * Creates a barbajs like PJAX Service, for the native framework\n * Based on barbajs and StartingBlocks\n */\nexport class PJAX extends Service {\n /** URLs to ignore when prefetching */\n public ignoreURLs: IgnoreURLsList;\n\n /** Whether or not to disable prefetching */\n public prefetchIgnore: boolean;\n\n /** Current state of transitions */\n public isTransitioning: boolean;\n\n /** Ignore extra clicks of an anchor element if a transition has already started */\n public stopOnTransitioning: boolean;\n\n /** On page change (excluding popstate events) keep current scroll position */\n public stickyScroll: boolean;\n\n /** Force load a page if an error occurs */\n public forceOnError: boolean;\n\n /** Ignore hash action if set to true */\n public ignoreHashAction: boolean;\n\n public install() {\n super.install();\n\n this.ignoreURLs = getConfig(this.config, \"ignoreURLs\") ?? [];\n this.prefetchIgnore = getConfig(this.config, \"prefetchIgnore\") ?? false;\n this.stopOnTransitioning = getConfig(this.config, \"stopOnTransitioning\") ?? false;\n this.stickyScroll = getConfig(this.config, \"stickyScroll\") ?? false;\n this.forceOnError = getConfig(this.config, \"forceOnError\") ?? false;\n this.ignoreHashAction = getConfig(this.config, \"ignoreHashAction\") ?? false\n }\n\n /** Sets the transition state to either true or false */\n public transitionStart() {\n this.isTransitioning = true;\n }\n\n public transitionStop() {\n this.isTransitioning = false;\n }\n\n public init() {\n /**\n * Bind the event listeners to the PJAX class\n *\n * @memberof PJAX\n */\n this.onHover = this.onHover.bind(this);\n this.onClick = this.onClick.bind(this);\n this.onStateChange = this.onStateChange.bind(this);\n }\n\n /** Starts the PJAX Service */\n public boot() {\n if (\"scrollRestoration\" in window.history) {\n // Back off, browser, I got this...\n window.history.scrollRestoration = \"manual\";\n }\n\n super.boot();\n }\n\n /** Gets the transition to use for a certain anchor */\n public getTransitionName(el: HTMLAnchorElement): string | null {\n if (!el || !el.getAttribute) return null;\n let transitionAttr = el.getAttribute(\n getConfig(this.config, \"transitionAttr\", false)\n );\n\n if (typeof transitionAttr === \"string\") return transitionAttr;\n return null;\n }\n\n /** Checks to see if the anchor is valid */\n public validLink(\n el: HTMLAnchorElement,\n event: LinkEvent | KeyboardEvent,\n href: string\n ): boolean {\n let pushStateSupport = !window.history.pushState;\n let exists = !el || !href;\n let eventMutate =\n (event as KeyboardEvent).metaKey ||\n (event as KeyboardEvent).ctrlKey ||\n (event as KeyboardEvent).shiftKey ||\n (event as KeyboardEvent).altKey;\n let newTab =\n el.hasAttribute(\"target\") &&\n (el as HTMLAnchorElement).target === \"_blank\";\n let crossOrigin =\n (el as HTMLAnchorElement).protocol !== location.protocol ||\n (el as HTMLAnchorElement).hostname !== location.hostname;\n let download = typeof el.getAttribute(\"download\") === \"string\";\n let preventSelf = el.matches(getConfig(this.config, \"preventSelfAttr\"));\n let preventAll = Boolean(\n el.closest(getConfig(this.config, \"preventAllAttr\"))\n );\n let sameURL = getHashedPath(newURL()) === getHashedPath(newURL(href));\n return !(\n exists ||\n pushStateSupport ||\n eventMutate ||\n newTab ||\n crossOrigin ||\n download ||\n preventSelf ||\n preventAll ||\n sameURL\n );\n }\n\n /** Returns the href of an Anchor element */\n public getHref(el: HTMLAnchorElement): string | null {\n if (\n el &&\n el.tagName &&\n el.tagName.toLowerCase() === \"a\" &&\n typeof el.href === \"string\"\n )\n return el.href;\n return null;\n }\n\n /** Check if event target is a valid anchor with an href, if so, return the anchor */\n public getLink(event: LinkEvent): HTMLAnchorElement {\n let el = event.target as HTMLAnchorElement;\n let href: string = this.getHref(el);\n\n while (el && !href) {\n el = (el as HTMLElement).parentNode as HTMLAnchorElement;\n href = this.getHref(el);\n }\n\n // Check for a valid link\n if (!el || !this.validLink(el, event, href)) return;\n return el;\n }\n\n /** When an element is clicked, get valid anchor element, go for a transition */\n public onClick(event: LinkEvent) {\n let el = this.getLink(event);\n if (!el) return;\n\n if (this.isTransitioning && this.stopOnTransitioning) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n let href = this.getHref(el);\n this.emitter.emit(\"ANCHOR_CLICK CLICK\", event);\n this.go({ href, trigger: el, event });\n }\n\n /** Returns the direction of the State change as a String, either the Back button or the Forward button */\n public getDirection(value: number): Trigger {\n if (Math.abs(value) > 1) {\n // Ex 6-0 > 0 -> forward, 0-6 < 0 -> back\n return value > 0 ? \"forward\" : \"back\";\n } else {\n if (value === 0) {\n return \"popstate\";\n } else {\n // Ex 6-5 > 0 -> back, 5-6 < 0 -> forward\n return value > 0 ? \"back\" : \"forward\";\n }\n }\n }\n\n /** Force a page to go to a certain URL */\n public force(href: string): void {\n window.location.assign(href);\n }\n\n /**\n * If transition is running force load page.\n * Stop if currentURL is the same as new url.\n * On state change, change the current state history, to reflect the direction of said state change\n * Load page and page transition.\n */\n public go({\n href,\n trigger = \"HistoryManager\",\n event,\n }: {\n href: string;\n trigger?: Trigger;\n event?: StateEvent;\n }): Promise {\n // If transition is already running and the go method is called again, force load page\n if (this.isTransitioning && this.stopOnTransitioning ||\n !(this.manager.has(\"TransitionManager\") &&\n this.manager.has(\"HistoryManager\") &&\n this.manager.has(\"PageManager\"))) {\n this.force(href);\n return;\n }\n\n const history = this.manager.get(\"HistoryManager\") as IHistoryManager;\n let scroll = newCoords(0, 0);\n let currentState = history.current;\n let currentURL = currentState.url;\n if (equal(currentURL, href)) {\n return;\n }\n\n let transitionName: string;\n if (event && (event as PopStateEvent).state) {\n this.emitter.emit(\"POPSTATE\", event);\n\n // If popstate, get back/forward direction.\n let { state }: { state: IHistoryItem } = event as PopStateEvent;\n let { index } = state;\n let currentIndex = currentState.index;\n let difference = currentIndex - index;\n\n history.replace(state.states);\n history.pointer = index;\n\n let _state = history.get(index);\n transitionName = _state.transition;\n scroll = _state.data.scroll;\n\n trigger = this.getDirection(difference);\n console.log(trigger == \"forward\" && history)\n\n // Based on the direction of the state change either remove or add a state\n this.emitter.emit(trigger === \"back\" ? `POPSTATE_BACK` : `POPSTATE_FORWARD`, event);\n } else {\n // Add new state\n transitionName = this.getTransitionName(trigger as HTMLAnchorElement);\n\n scroll = newCoords();\n let state = newState({\n url: href,\n transition: transitionName,\n data: { scroll },\n });\n\n !this.stickyScroll && (scroll = newCoords(0, 0));\n\n history.add(state);\n this.emitter.emit(\"HISTORY_NEW_ITEM\", event);\n }\n\n if (event) {\n event.stopPropagation();\n event.preventDefault();\n }\n\n this.emitter.emit(\"GO\", event);\n return this.load({\n oldHref: currentURL,\n href,\n trigger,\n transitionName,\n scroll,\n });\n }\n\n /** Load the new Page as well as a Transition; starts the Transition */\n public async load({\n oldHref,\n href,\n trigger,\n transitionName = \"default\",\n scroll = { x: 0, y: 0 },\n }: {\n oldHref: string;\n href: string;\n trigger: Trigger;\n transitionName?: string;\n scroll: { x: number; y: number };\n }): Promise {\n try {\n const pages = this.manager.get(\"PageManager\") as IPageManager;\n let newPage: IPage, oldPage: IPage;\n this.emitter.emit(\"NAVIGATION_START\", {\n oldHref,\n href,\n trigger,\n transitionName,\n });\n\n // Load & Build both the old and new pages\n try {\n this.transitionStart();\n oldPage = await pages.load(oldHref);\n !(oldPage.dom instanceof Element) && oldPage.build();\n\n this.emitter.emit(\"PAGE_LOADING\", { href, oldPage, trigger });\n newPage = await pages.load(href);\n await newPage.build();\n this.emitter.emit(\"PAGE_LOAD_COMPLETE\", {\n newPage,\n oldPage,\n trigger,\n });\n } catch (err) {\n console.warn(`[PJAX] Page load error: ${err}`);\n }\n\n // Transition Between Pages\n try {\n const TransitionManager = this.manager.get(\"TransitionManager\") as ITransitionManager;\n this.emitter.emit(\"TRANSITION_START\", transitionName);\n\n let transition = await TransitionManager.animate(TransitionManager.has(transitionName) ? transitionName : \"default\", {\n oldPage,\n newPage,\n trigger,\n scroll,\n ignoreHashAction: this.ignoreHashAction\n });\n\n if (!transition.scrollable) {\n if (!this.ignoreHashAction && !/back|popstate|forward/.test(trigger as string)) scroll = hashAction(scroll);\n window.scroll(scroll.x, scroll.y);\n }\n\n this.emitter.emit(\"TRANSITION_END\", { transition });\n } catch (err) {\n console.warn(`[PJAX] Transition error: ${err}`);\n }\n\n // Navigation is over\n this.emitter.emit(\"NAVIGATION_END\", {\n oldPage,\n newPage,\n trigger,\n transitionName,\n });\n } catch (err) {\n if (this.forceOnError) this.force(href);\n else console.warn(err);\n } finally {\n this.transitionStop(); // Sets isTransitioning to false\n }\n }\n\n /** Check to see if the URL is to be ignored, uses either RegExp of Strings to check */\n public ignoredURL({ pathname }: URL): boolean {\n return (\n this.ignoreURLs.length &&\n this.ignoreURLs.some((url) => {\n return typeof url === \"string\"\n ? url === pathname\n : (url as RegExp).exec(pathname) !== null;\n })\n );\n }\n\n /** When you hover over an anchor, prefetch the event target's href */\n public onHover(event: LinkEvent): Promise {\n let el = this.getLink(event);\n if (!el || !this.manager.has(\"PageManager\")) return;\n\n const pages = this.manager.get(\"PageManager\") as IPageManager;\n let url = newURL(this.getHref(el));\n let urlString: string = url.pathname;\n\n // If Url is ignored or already in cache, don't do any think\n if (this.ignoredURL(url) || pages.has(urlString)) return;\n this.emitter.emit(\"ANCHOR_HOVER HOVER\", event);\n\n try {\n pages.load(url);\n } catch (err) {\n console.warn(\"[PJAX] prefetch error,\", err);\n }\n }\n\n /** When History state changes, get url from State, go for a Transition. */\n public onStateChange(event: PopStateEvent): void {\n this.go({ href: window.location.href, trigger: \"popstate\", event });\n }\n\n /** Initialize DOM Events */\n public initEvents() {\n if (this.prefetchIgnore !== true) {\n document.addEventListener(\"mouseover\", this.onHover);\n document.addEventListener(\"touchstart\", this.onHover);\n }\n\n document.addEventListener(\"click\", this.onClick);\n window.addEventListener(\"popstate\", this.onStateChange);\n }\n\n /** Stop DOM Events */\n public stopEvents() {\n if (this.prefetchIgnore !== true) {\n document.removeEventListener(\"mouseover\", this.onHover);\n document.removeEventListener(\"touchstart\", this.onHover);\n }\n\n document.removeEventListener(\"click\", this.onClick);\n window.removeEventListener(\"popstate\", this.onStateChange);\n }\n}\n", "import { Service } from \"./service\";\nimport { Manager } from \"./manager\";\nimport { newURL, getHashedPath } from \"./url\";\nimport { IHistoryManager } from \"./history\";\n\nexport type RouteMethod = (...args: any) => any;\nexport type RouteStyle = string | RegExp | boolean;\nexport interface IRouteToFrom {\n to: RouteStyle,\n from: RouteStyle\n}\nexport type RoutePath = IRouteToFrom | RouteStyle;\nexport interface IRoute {\n path: RoutePath,\n method: RouteMethod\n}\n\n/** Controls what happens when certain url paths match a set of criteria */\nexport class Router extends Service {\n /** List of routes */\n protected routes: Manager;\n constructor(routes: IRoute[] = []) {\n super();\n this.routes = new Manager();\n for (let route of routes) {\n this.add(route);\n }\n }\n\n /** Add a new route to watch for */\n public add({ path, method }: IRoute): Router {\n let key = this.parse(path);\n this.routes.set(key, method);\n return this;\n }\n\n /** Convert strings into path match functions */\n public parsePath(path: RouteStyle): RegExp | boolean {\n if (typeof path === \"string\") return new RegExp(path, \"i\");\n else if (path instanceof RegExp || typeof path === \"boolean\")\n return path;\n throw \"[Router] only regular expressions, strings and booleans are accepted as paths.\";\n }\n\n /** Determines if a strings counts has a path */\n public isPath(input: RouteStyle): boolean {\n return (\n typeof input === \"string\" ||\n input instanceof RegExp ||\n typeof input === \"boolean\"\n );\n }\n\n /** Parse the multiple different formats for paths, into a { from, to } object */\n public parse(input: RoutePath): IRouteToFrom {\n let route = input as IRouteToFrom;\n let toFromPath: IRouteToFrom = {\n from: /(.*)/g,\n to: /(.*)/g,\n };\n\n if (this.isPath(input as RouteStyle))\n toFromPath = {\n from: true,\n to: input as RouteStyle,\n };\n else if (this.isPath(route.from) && this.isPath(route.to as RouteStyle))\n toFromPath = route;\n else\n throw \"[Router] path is neither a string, regular expression, or a { from, to } object.\";\n\n let { from, to } = toFromPath;\n return {\n from: this.parsePath(from),\n to: this.parsePath(to),\n };\n }\n\n /** Test if route paths are true, if so run their methods */\n public route() {\n if (this.manager.has(\"HistoryManager\")) {\n let history = this.manager.get(\"HistoryManager\") as IHistoryManager;\n let from: string = getHashedPath(newURL((history.length > 1 ? history.previous : history.current).url));\n let to: string = getHashedPath(newURL());\n\n this.routes.forEach((method: RouteMethod, path: IRouteToFrom) => {\n let fromRegExp = path.from as RegExp | boolean;\n let toRegExp = path.to as RegExp | boolean;\n\n if (\n typeof fromRegExp === \"boolean\" &&\n typeof toRegExp === \"boolean\"\n ) {\n throw `[Router] path ({ from: ${fromRegExp}, to: ${toRegExp} }) is not valid, remember paths can only be strings, regular expressions, or a boolean; however, both the from and to paths cannot be both booleans.`;\n }\n\n let fromParam: RegExpExecArray | RegExp | boolean = fromRegExp;\n let toParam: RegExpExecArray | RegExp | boolean = toRegExp;\n\n if (fromRegExp instanceof RegExp && fromRegExp.test(from))\n fromParam = fromRegExp.exec(from);\n if (toRegExp instanceof RegExp && toRegExp.test(to))\n toParam = toRegExp.exec(to);\n\n if (\n (Array.isArray(toParam) && Array.isArray(fromParam)) ||\n (Array.isArray(toParam) &&\n typeof fromParam == \"boolean\" &&\n fromParam) ||\n (Array.isArray(fromParam) &&\n typeof toParam == \"boolean\" &&\n toParam)\n )\n method({ from: fromParam, to: toParam, path: { from, to } });\n });\n } else {\n console.warn(\"[Route] HistoryManager is missing.\");\n }\n }\n\n /** Add listeners for PJAX Events */\n public initEvents() {\n this.emitter.on(\"READY\", this.route, this);\n this.emitter.on(\"CONTENT_REPLACED\", this.route, this);\n }\n\n /** Remove listeners for PJAX Events */\n public stopEvents() {\n this.emitter.off(\"READY\", this.route, this);\n this.emitter.off(\"CONTENT_REPLACED\", this.route, this);\n }\n}\n", "import { EventEmitter, EventInput, ListenerCallback } from \"@okikio/emitter\";\nimport { Manager } from \"@okikio/manager\";\n\n// DOM\nexport type AnimationTarget = string | Node | NodeList | HTMLCollection | HTMLElement[] | AnimationTarget[];\nexport const getElements = (selector: string | Node): Node[] => {\n return typeof selector === \"string\" ? Array.from(document.querySelectorAll(selector as string)) : [selector];\n};\n\nconst flatten = (arr: AnimationTarget[]) => [].concat(...arr);\nexport const getTargets = (targets: AnimationTarget): Node[] => {\n if (Array.isArray(targets)) {\n return flatten((targets as AnimationTarget[]).map(getTargets));\n }\n if (typeof targets == \"string\" || targets instanceof Node)\n return getElements(targets);\n if (targets instanceof NodeList || targets instanceof HTMLCollection)\n return Array.from(targets);\n return [];\n};\n\n// VALUES\nexport type closureArgs = [number, number, HTMLElement];\nexport type closure = ((index?: number, total?: number, element?: HTMLElement) => (genericTypes[] | void)) | any;\nexport const computeValue = (value: closure, args: closureArgs, context: Animate) => {\n if (typeof value === \"function\") {\n return value.apply(context, args);\n } else { return value; }\n};\n\nexport const mapObject = (obj: object, args: closureArgs, options: Animate): any => {\n let key: string, value: any, result = {};\n let keys = Object.keys(obj);\n for (let i = 0, len = keys.length; i < len; i++) {\n key = keys[i];\n value = obj[key];\n result[key] = computeValue(value, args, options);\n }\n\n return result;\n};\n\n/** From: [https://easings.net] */\nexport const easings = {\n \"in\": \"ease-in\",\n \"out\": \"ease-out\",\n \"in-out\": \"ease-in-out\",\n\n // Sine\n \"in-sine\": \"cubic-bezier(0.47, 0, 0.745, 0.715)\",\n \"out-sine\": \"cubic-bezier(0.39, 0.575, 0.565, 1)\",\n \"in-out-sine\": \"cubic-bezier(0.445, 0.05, 0.55, 0.95)\",\n\n // Quad\n \"in-quad\": \"cubic-bezier(0.55, 0.085, 0.68, 0.53)\",\n \"out-quad\": \"cubic-bezier(0.25, 0.46, 0.45, 0.94)\",\n \"in-out-quad\": \"cubic-bezier(0.455, 0.03, 0.515, 0.955)\",\n\n // Cubic\n \"in-cubic\": \"cubic-bezier(0.55, 0.055, 0.675, 0.19)\",\n \"out-cubic\": \"cubic-bezier(0.215, 0.61, 0.355, 1)\",\n \"in-out-cubic\": \"cubic-bezier(0.645, 0.045, 0.355, 1)\",\n\n // Quart\n \"in-quart\": \"cubic-bezier(0.895, 0.03, 0.685, 0.22)\",\n \"out-quart\": \"cubic-bezier(0.165, 0.84, 0.44, 1)\",\n \"in-out-quart\": \"cubic-bezier(0.77, 0, 0.175, 1)\",\n\n // Quint\n \"in-quint\": \"cubic-bezier(0.755, 0.05, 0.855, 0.06)\",\n \"out-quint\": \"cubic-bezier(0.23, 1, 0.32, 1)\",\n \"in-out-quint\": \"cubic-bezier(0.86, 0, 0.07, 1)\",\n\n // Expo\n \"in-expo\": \"cubic-bezier(0.95, 0.05, 0.795, 0.035)\",\n \"out-expo\": \"cubic-bezier(0.19, 1, 0.22, 1)\",\n \"in-out-expo\": \"cubic-bezier(1, 0, 0, 1)\",\n\n // Circ\n \"in-circ\": \"cubic-bezier(0.6, 0.04, 0.98, 0.335)\",\n \"out-circ\": \"cubic-bezier(0.075, 0.82, 0.165, 1)\",\n \"in-out-circ\": \"cubic-bezier(0.785, 0.135, 0.15, 0.86)\",\n\n // Back\n \"in-back\": \"cubic-bezier(0.6, -0.28, 0.735, 0.045)\",\n \"out-back\": \"cubic-bezier(0.175, 0.885, 0.32, 1.275)\",\n \"in-out-back\": \"cubic-bezier(0.68, -0.55, 0.265, 1.55)\"\n};\n\nexport const getEase = (ease: string) => {\n return /^(in|out)/.test(ease) ? easings[ease] : ease;\n};\n\nexport type genericTypes = genericTypes[] | boolean | object | string | number | closure | null | undefined;\nexport interface AnimationOptions {\n target?: AnimationTarget,\n\n speed?: number,\n autoplay?: boolean,\n options?: AnimationOptions,\n delay?: number | closure,\n easing?: string | closure,\n endDelay?: number | closure,\n duration?: number | closure,\n keyframes?: Keyframe[] | object[] | closure,\n loop?: number | boolean | closure, // iterations: number,\n onfinish?: (element?: HTMLElement, index?: number, total?: number, animation?: Animation) => any,\n fillMode?: \"none\" | \"forwards\" | \"backwards\" | \"both\" | \"auto\" | closure,\n direction?: \"normal\" | \"reverse\" | \"alternate\" | \"alternate-reverse\" | closure,\n extend?: EffectTiming,\n [property: string]: genericTypes;\n};\n\nexport const DefaultAnimationOptions: AnimationOptions = {\n keyframes: [],\n\n loop: 1, // iterations: number,\n delay: 0,\n speed: 1,\n endDelay: 0,\n easing: \"ease\",\n autoplay: true,\n duration: 1000,\n fillMode: \"auto\",\n direction: \"normal\",\n extend: {}\n};\n\nexport type AnimationEvents = \"update\" | \"play\" | \"pause\" | \"start\" | \"begin\" | \"complete\" | \"finish\" | \"error\" | \"stop\";\n\n/** You can check it out here: https://codepen.io/okikio/pen/qBbdGaW?editors=0011 */\nexport class Animate {\n /**\n * Stores the options for the current animation\n */\n public options: AnimationOptions = {};\n\n /**\n * The Array of Elements to Animate\n */\n public targets: Node[] = [];\n\n /**\n * The properties to animate\n */\n public properties: object = {};\n\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n\n /**\n * The total duration of all Animation's\n */\n public totalDuration: number = 0;\n\n /**\n * The smallest delay out of all Animation's\n */\n public minDelay: number = 0;\n\n /**\n * The options for individual animations\n */\n public computedOptions: Manager = new Manager();\n\n /**\n * The Element the main animation uses\n */\n public mainElement: HTMLElement;\n\n /**\n * Stores an animation that runs on the total duration of the all other Animations, and as such it's the main Animation\n */\n public mainAnimation: Animation;\n\n /**\n * Stores request frame calls\n */\n public animationFrame: number;\n\n /**\n * An event emitter\n */\n public emitter: EventEmitter = new EventEmitter();\n\n /**\n * Returns a promise that is fulfilled when the mainAnimation is finished\n */\n public promise: Promise;\n constructor(options: AnimationOptions = {}) {\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n\n /**\n * Returns a new Promise that is resolve when this.finish is called\n */\n public newPromise(): Promise {\n return new Promise((resolve, reject) => {\n /*\n Note that the `this` keyword is in an Array when it is resolved,\n this is due to Promises not wanting to resolve references,\n so, you can't resolve `this` directly, so, I chose to resolve `this` in an\n Array\n */\n this.on(\"complete\", () => resolve([this]));\n this.on(\"error\", err => reject(err));\n });\n }\n\n /**\n * Fulfills the this.promise Promise\n */\n public then(\n onFulfilled?: (value?: any) => any,\n onRejected?: (reason?: any) => any\n ): Animate {\n onFulfilled = onFulfilled?.bind(this);\n onRejected = onRejected?.bind(this);\n this.promise.then(onFulfilled, onRejected);\n return this;\n }\n\n /**\n * Catches error that occur in the this.promise Promise\n */\n public catch(onRejected: (reason?: any) => any): Animate {\n onRejected = onRejected?.bind(this);\n this.promise.catch(onRejected);\n return this;\n }\n\n /**\n * If you don't care if the this.promise Promise has either been rejected or resolved\n */\n public finally(onFinally: () => any): Animate {\n onFinally = onFinally?.bind(this);\n this.promise.finally(onFinally);\n return this;\n }\n\n /**\n * Represents an Animation Frame Loop\n */\n public loop(): void {\n this.stopLoop();\n this.emit(\"update\", this.getProgress(), this);\n this.animationFrame = window.requestAnimationFrame(this.loop);\n }\n\n /**\n * Cancels animation frame\n */\n public stopLoop() {\n window.cancelAnimationFrame(this.animationFrame);\n }\n\n /**\n * Calls a method that affects all animations including the mainAnimation; the method only allows the animation parameter\n */\n public all(method: (animation?: Animation, target?: HTMLElement) => void) {\n method(this.mainAnimation, this.mainElement);\n this.animations.forEach(method);\n return this;\n }\n\n /**\n * Register the begin event\n */\n protected beginEvent() {\n if (this.getProgress() == 0) {\n let timer: number | void = window.setTimeout(() => {\n this.emit(\"begin\", this);\n timer = window.clearTimeout(timer as number);\n }, this.minDelay);\n }\n }\n\n /**\n * Play Animation\n */\n public play(): Animate {\n let playstate = this.getPlayState();\n this.beginEvent();\n this.all(anim => anim.play());\n this.emit(\"play\", playstate, this);\n this.loop();\n return this;\n }\n\n /**\n * Pause Animation\n */\n public pause(): Animate {\n let playstate = this.getPlayState();\n this.all(anim => anim.pause());\n this.emit(\"pause\", playstate, this);\n this.stopLoop();\n this.animationFrame = undefined;\n return this;\n }\n\n /**\n * Reset all Animations\n */\n public reset() {\n this.setProgress(0);\n this.beginEvent();\n\n if (this.options.autoplay) this.play();\n else this.pause();\n return this;\n }\n\n /**\n * Cancels all Animations\n */\n public cancel() {\n this.all(anim => anim.cancel());\n this.stopLoop();\n return this;\n }\n\n /**\n * Force complete all Animations\n */\n public finish() {\n this.all(anim => anim.finish());\n this.stopLoop();\n return this;\n }\n\n /**\n * Cancels & Clears all Animations\n */\n public stop() {\n this.cancel();\n this.animations.clear();\n while (this.targets.length) this.targets.pop();\n this.mainElement = undefined;\n this.emit(\"stop\");\n }\n\n /**\n * Returns an Array of targets\n */\n public getTargets(): Node[] {\n return this.targets;\n }\n\n /**\n * Get a specific Animation from an Animate instance\n */\n public getAnimation(element: HTMLElement): Animation {\n return this.animations.get(element);\n }\n\n /**\n * Returns the timings of an Animation, given a target\n * E.g. { duration, endDelay, delay, iterations, iterationStart, direction, easing, fill, etc... }\n */\n public getTiming(target: HTMLElement | Animation): AnimationOptions & EffectTiming {\n let animation = target instanceof Animation ? target : this.getAnimation(target);\n let keyframeOptions = this.computedOptions.get(animation) ?? {};\n let timings = animation.effect?.getTiming() ?? {};\n let options = this.getOptions();\n\n return { ...DefaultAnimationOptions, ...options, ...timings, ...keyframeOptions };\n }\n\n /**\n * Returns the total duration of Animation\n */\n public getTotalDuration(): number {\n return this.totalDuration;\n }\n\n /**\n * Returns the current time of the Main Animation\n */\n public getCurrentTime(): number {\n return this.mainAnimation.currentTime;\n }\n\n /**\n * Returns the Animation progress as a fraction of the current time / duration * 100\n */\n public getProgress() {\n return (this.getCurrentTime() / this.totalDuration) * 100;\n }\n\n /**\n * Return the playback speed of the animation\n */\n public getSpeed(): number {\n return this.mainAnimation.playbackRate;\n }\n\n /**\n * Returns the current playing state\n */\n public getPlayState(): \"idle\" | \"running\" | \"paused\" | \"finished\" {\n return this.mainAnimation.playState;\n }\n\n /**\n * Get the options of an Animate instance\n */\n public getOptions(): AnimationOptions {\n return this.options;\n }\n\n /**\n * Set the current time of the Main Animation\n */\n public setCurrentTime(time: number): Animate {\n this.all(anim => { anim.currentTime = time; });\n this.emit(\"update\", this.getProgress());\n return this;\n }\n\n /**\n * Set the Animation progress as a value from 0 to 100\n */\n public setProgress(percent: number): Animate {\n let time = (percent / 100) * this.totalDuration;\n this.setCurrentTime(time);\n return this;\n }\n\n /**\n * Set the playback speed of an Animation\n */\n public setSpeed(speed: number = 1): Animate {\n this.all(anim => { anim.playbackRate = speed; });\n return this;\n }\n\n /**\n * Adds a listener for a given event\n */\n public on(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.on(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Removes a listener from an event\n */\n public off(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.off(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Call all listeners within an event\n */\n public emit(events: AnimationEvents | string | any[], ...args: any): Animate {\n this.emitter.emit(events, ...args);\n return this;\n }\n\n\n /** Returns the Animate options, as JSON */\n public toJSON(): AnimationOptions {\n return this.getOptions();\n }\n\n /**\n * The Symbol.toStringTag well-known symbol is a string valued property that is used\n * in the creation of the default string description of an object.\n * It is accessed internally by the Object.prototype.toString() method.\n */\n get [Symbol.toStringTag]() {\n return `Animate`;\n }\n}\n\n/** Creates a new Animate instance */\nexport const animate = (options: AnimationOptions = {}): Animate => {\n return new Animate(options);\n};\n\nexport class Timeline extends Animate {\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n constructor(options: AnimationOptions = {}) {\n super();\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n public add(options: AnimationOptions) {\n return this;\n }\n}\n\nexport default animate;"], + "mappings": "kIAAA,2sBCgBO,GAAM,IAA2B,CACpC,YAAa,UACb,eAAgB,eAChB,eAAgB,cAChB,QAAS,CACL,CAAC,YAAa,SAElB,gBAAiB,iBACjB,eAAgB,gBAChB,eAAgB,aAChB,UAAW,QACX,QAAS,IACT,SAAU,EACV,YAAa,KAIJ,EAAY,AAAC,GACf,OAAO,OAAO,IAAK,IAAmB,GAIpC,GAAS,CAAC,EAAiB,EAAe,EAAoB,KAAiB,CACxF,GAAI,CAAE,UAAW,EACb,EAAO,OAAO,EAAS,IAAM,EAAS,MAAM,IAChD,MAAO,GAAW,IAAI,KAAU,GAIvB,EAAY,CAAC,EAAiB,EAAoB,EAAoB,KAAc,CAC7F,GAAI,MAAO,IAAU,SACjB,MAAO,GAEX,GAAI,GAAO,EAAO,GAClB,MAAI,OAAO,IAAS,SACT,GAAO,EAAQ,EAAM,GACzB,GCnDJ,WAAoB,CAG1B,YAAY,EAAuB,CAClC,KAAK,IAAM,GAAI,KAAI,GAIb,QAAoB,CAC1B,MAAO,MAAK,IAIN,IAAI,EAAW,CACrB,MAAO,MAAK,IAAI,IAAI,GAId,MAAiB,CACvB,MAAO,OAAM,KAAK,KAAK,IAAI,QAIrB,QAAmB,CACzB,MAAO,OAAM,KAAK,KAAK,IAAI,UAIrB,IAAI,EAAQ,EAAyB,CAC3C,YAAK,IAAI,IAAI,EAAK,GACX,KAID,IAAI,EAAyB,CAGnC,GAAI,GAFO,KAAK,KAGhB,YAAK,IAAI,EAAK,GACP,QAIG,OAAe,CACzB,MAAO,MAAK,IAAI,QAIN,SAAiB,CAC3B,MAAO,MAAK,IAAI,KAIV,KAAK,EAAmB,EAAkB,CAChD,GAAI,GAAM,KAAK,OAAO,KAAK,KAAO,GAClC,MAAO,MAAK,IAAI,GAIV,OAAO,EAAiB,CAC9B,MAAO,MAAK,IAAI,OAAO,GA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B,CAAC,EAAG,EAAK,GAAS,MAC3D,EAAa,OAAS,GACxB,GAAoB,EAAU,EAAmB,CAAC,EAAG,EAAK,GAAS,OAGvE,GAAI,GAAgB,EAAiB,MAChC,EAAiB,SAAW,EAAiB,WAC9C,EAAiB,SACrB,AAAI,KAAK,cAAgB,GAAe,MAAK,cAAgB,GAG7D,GAAI,GAAY,EAAO,QAAQ,EAAmB,GAGlD,EAAU,SAAW,IAAM,CACvB,MAAO,IAAY,YAAc,EAAS,KAAK,KAAM,EAAQ,EAAG,EAAK,GACrE,KAAK,KAAK,SAAU,EAAQ,EAAG,EAAK,IAIxC,KAAK,gBAAgB,IAAI,EAAW,GACpC,KAAK,WAAW,IAAI,EAAQ,GAC5B,EAAO,KAAK,EAAiB,OAGjC,KAAK,cAAgB,KAAK,YAAY,QAAQ,CAC1C,CAAE,QAAS,KACX,CAAE,QAAS,MACZ,CAEC,SAAU,KAAK,cACf,OAAQ,WAGZ,KAAK,SAAW,KAAK,IAAI,GAAG,GAC5B,KAAK,SAAS,GACd,AAAI,EAAU,KAAK,OACd,KAAK,QAEV,KAAK,QAAU,KAAK,aACpB,KAAK,cAAc,SAAW,IAAM,CAChC,KAAK,KAAK,WAAY,MACtB,KAAK,kBAEJ,EAAP,CACE,KAAK,KAAK,QAAS,IAGpB,IAAI,EAA2B,CAClC,MAAO", "names": [] } diff --git a/packages/native/lib/api.es.js b/packages/native/lib/api.es.js index 57978b9..c0a4e9a 100644 --- a/packages/native/lib/api.es.js +++ b/packages/native/lib/api.es.js @@ -1,3 +1,3 @@ -var Z={wrapperAttr:"wrapper",noAjaxLinkAttr:"no-ajax-link",noPrefetchAttr:"no-prefetch",headers:[["x-partial","true"]],preventSelfAttr:'prevent="self"',preventAllAttr:'prevent="all"',transitionAttr:"transition",blockAttr:"block",timeout:3e4,maxPages:5},W=r=>Object.assign({...Z},r),tt=(r,t,e=!0)=>{let{prefix:i}=r,n=`data${i?"-"+i:""}-${t}`;return e?`[${n}]`:n},h=(r,t,e=!0)=>{if(typeof t!="string")return r;let i=r[t];return typeof i=="string"?tt(r,i,e):i};var g=class{constructor(t){this.map=new Map(t)}getMap(){return this.map}get(t){return this.map.get(t)}keys(){return Array.from(this.map.keys())}values(){return Array.from(this.map.values())}set(t,e){return this.map.set(t,e),this}add(t){let i=this.size;return this.set(i,t),this}get size(){return this.map.size}get length(){return this.map.size}last(t=1){let e=this.keys()[this.size-t];return this.get(e)}delete(t){return this.map.delete(t)}remove(t){return this.map.delete(t),this}clear(){return this.map.clear(),this}has(t){return this.map.has(t)}entries(){return this.map.entries()}forEach(t,e){return this.map.forEach(t,e),this}[Symbol.iterator](){return this.entries()}},L=(r,t,...e)=>{r.forEach(i=>{i[t](...e)})},et=async(r,t,...e)=>{for(let[,i]of r)await i[t](...e)};var R=class{constructor(){}install(){}register(t,e){return this.manager=t,this.app=t.app,this.config=t.config,this.emitter=t.emitter,this.key=e,this.install(),this}uninstall(){}unregister(){this.uninstall(),this.manager.remove(this.key),this.key=void 0,this.manager=void 0,this.app=void 0,this.config=void 0,this.emitter=void 0}},O=class extends g{constructor(t){super();this.app=t,this.config=t.config,this.emitter=t.emitter}set(t,e){return super.set(t,e),e.register(this,t),this}};var c=(r=window.location.href)=>r instanceof URL?r:new URL(r,window.location.origin),I=r=>{let t=c(r);return`${t.pathname}${t.hash}`},Et=r=>c(r).hash.slice(1),X=r=>c(r).toString().replace(/(\/#.*|\/|#.*)$/,""),N=(r,t)=>X(r)===X(t);var A=class extends R{init(){}boot(){this.initEvents()}initEvents(){}stopEvents(){}stop(){this.stopEvents(),this.unregister()}},V=class extends O{constructor(t){super(t)}init(){return L(this,"init"),this}boot(){return L(this,"boot"),this}stop(){return L(this,"stop"),this}};var x=(r=window.scrollX,t=window.scrollY)=>({x:r,y:t}),D=(r={url:I(c()),index:0,transition:"default",data:{scroll:x(),trigger:"HistoryManager"}})=>r,it=class extends A{constructor(){super(...arguments);this.pointer=-1}init(){this.states=[];let t=D();this.add(t,"replace")}get(t){return this.states[t]}add(t,e="push"){let i=D(t),n=this.length;this.states.push({...i}),this.pointer=n;let s={index:this.pointer,states:[...this.states]};return rt(e,i,s),this}remove(t){return t?this.states.splice(t,1):this.states.pop(),this.pointer--,this}replace(t){return this.states=t,this}set(t,e){return this.states[t]=e}get current(){return this.get(this.pointer)}get last(){return this.get(this.length-1)}get previous(){return this.pointer<1?null:this.get(this.pointer-1)}get length(){return this.states.length}},rt=(r,t,e)=>{let i=I(t.url),n=[e,"",i];if(window.history)switch(r){case"push":window.history.pushState.apply(window.history,n);break;case"replace":window.history.replaceState.apply(window.history,n);break}};var nt=new DOMParser,G=class extends R{constructor(t=c(),e=document){super();this.url=t,typeof e=="string"?this.data=e:this.dom=e||document}build(){if(this.dom instanceof Node||(this.dom=nt.parseFromString(this.data,"text/html")),!(this.body instanceof Node)){let{title:t,head:e,body:i}=this.dom;this.title=t,this.head=e,this.body=i,this.wrapper=this.body.querySelector(this.wrapperAttr)}}install(){this.wrapperAttr=h(this.config,"wrapperAttr")}uninstall(){this.url=void 0,this.title=void 0,this.head=void 0,this.body=void 0,this.dom=void 0,this.wrapper=void 0,this.data=void 0,this.wrapperAttr=void 0}},st=class extends A{constructor(){super(...arguments);this.loading=new g}install(){this.pages=new O(this.app);let t=c().pathname;this.set(t,new G),t=void 0}get(t){return this.pages.get(t)}add(t){return this.pages.add(t),this}set(t,e){return this.pages.set(t,e),this}remove(t){return this.pages.remove(t),this}has(t){return this.pages.has(t)}clear(){return this.pages.clear(),this}get size(){return this.pages.size}keys(){return this.pages.keys()}async load(t=c()){let e=c(t),i=e.pathname,n,s;if(this.has(i))return n=this.get(i),Promise.resolve(n);this.loading.has(i)?s=this.loading.get(i):(s=this.request(i),this.loading.set(i,s));let a=await s;if(this.loading.remove(i),n=new G(e,a),this.set(i,n),this.size>h(this.config,"maxPages")){let l=c(),o=this.keys(),p=N(l,o[0])?o[1]:o[0],f=this.get(p);f.unregister(),f=void 0,o=void 0,l=void 0,p=void 0}return n}async request(t){let e=new Headers(h(this.config,"headers")),i=window.setTimeout(()=>{throw window.clearTimeout(i),"Request Timed Out!"},h(this.config,"timeout"));try{let n=await fetch(t,{mode:"same-origin",method:"GET",headers:e,cache:"default",credentials:"same-origin"});if(window.clearTimeout(i),n.status>=200&&n.status<300)return await n.text();throw new Error(n.statusText||""+n.status)}catch(n){throw window.clearTimeout(i),n}}};var J=({callback:r=()=>{},scope:t=null,name:e="event"})=>({callback:r,scope:t,name:e}),C=class extends g{constructor(t="event"){super();this.name=t}},H=class extends g{constructor(){super()}getEvent(t){let e=this.get(t);return e instanceof C?e:(this.set(t,new C(t)),this.get(t))}newListener(t,e,i){let n=this.getEvent(t);return n.add(J({name:t,callback:e,scope:i})),n}on(t,e,i){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let n,s,a=typeof t=="object"&&!Array.isArray(t),l=a?e:i;return a||(s=e),Object.keys(t).forEach(o=>{a?(n=o,s=t[o]):n=t[o],this.newListener(n,s,l)},this),this}removeListener(t,e,i){let n=this.get(t);if(n instanceof C&&e){let s=J({name:t,callback:e,scope:i});n.forEach((a,l)=>{if(a.callback===s.callback&&a.scope===s.scope)return n.remove(l)})}return n}off(t,e,i){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let n,s,a=typeof t=="object"&&!Array.isArray(t),l=a?e:i;return a||(s=e),Object.keys(t).forEach(o=>{a?(n=o,s=t[o]):n=t[o],typeof s=="function"?this.removeListener(n,s,l):this.remove(n)},this),this}emit(t,...e){return typeof t=="undefined"?this:(typeof t=="string"&&(t=t.trim().split(/\s/g)),t.forEach(i=>{let n=this.get(i);n instanceof C&&n.forEach(s=>{let{callback:a,scope:l}=s;a.apply(l,e)})},this),this)}clear(){return L(this,"clear"),super.clear(),this}};var q=(r,t=window.location.hash)=>{try{let e=t[0]=="#"?t:c(t).hash;if(e.length>1){let i=document.getElementById(e.slice(1));if(i){let{left:n,top:s}=i.getBoundingClientRect(),a=window.pageXOffset,l=window.pageYOffset,o=n+a,p=s+l;return console.log(o,p),x(o,p)}}}catch(e){console.warn("[hashAction] error",e)}return r??x(0,0)},ot={name:"default",scrollable:!0,out({done:r}){r()},in({scroll:r,done:t}){window.scroll(r.x,r.y),t()}},at=class extends A{constructor(t){super();this._arg=t}install(){super.install();let t=this._arg&&this._arg.length?this._arg:h(this.config,"transitions")??[];t=[["default",ot]].concat(t),this.transitions=new g(t)}get(t){return this.transitions.get(t)}set(t,e){return this.transitions.set(t,e),this}add(t){return this.transitions.add(t),this}has(t){return this.transitions.has(t)}async animate(t,e){let i=this.transitions.get(t),n=e.scroll,s=e.ignoreHashAction;if(!("wrapper"in e.oldPage)||!("wrapper"in e.newPage))throw`[Page] either oldPage or newPage aren't instances of the Page Class. - ${{newPage:e.newPage,oldPage:e.oldPage}}`;document.title=""+e.newPage.title;let a=e.oldPage.wrapper,l=e.newPage.wrapper;if(!(a instanceof Node)||!(l instanceof Node))throw`[Wrapper] the wrapper from the ${l instanceof Node?"current":"next"} page cannot be found. The wrapper must be an element that has the attribute ${h(this.config,"wrapperAttr")}.`;return i.init&&i?.init(e),this.emitter.emit("BEFORE_TRANSITION_OUT"),i.out&&await new Promise(o=>{i.out.call(i,{...e,from:e.oldPage,trigger:e.trigger,done:o})?.then(o)}),this.emitter.emit("AFTER_TRANSITION_OUT"),await new Promise(o=>{a.insertAdjacentElement("beforebegin",l),this.emitter.emit("CONTENT_INSERT"),!s&&!/back|popstate|forward/.test(e.trigger)&&(n=q(n)),o()}),await new Promise(o=>{a.remove(),a=void 0,l=void 0,this.emitter.emit("CONTENT_REPLACED"),o()}),this.emitter.emit("BEFORE_TRANSITION_IN"),i.in&&await new Promise(async o=>{i.in.call(i,{...e,from:e.oldPage,to:e.newPage,trigger:e.trigger,scroll:n,done:o})?.then(o)}),this.emitter.emit("AFTER_TRANSITION_IN"),i}};var lt=class{constructor(t={}){this.register(t)}register(t={}){this.config=W(t),this.emitter=new H,this.services=new V(this);let e=(()=>{document.removeEventListener("DOMContentLoaded",e),window.removeEventListener("load",e),this.emitter.emit("READY ready")}).bind(this);return document.addEventListener("DOMContentLoaded",e),window.addEventListener("load",e),this}get(t){return this.services.get(t)}set(t,e){return this.services.set(t,e),this}add(t){return this.services.add(t),this}boot(){return this.services.init(),this.services.boot(),this}stop(){return this.services.stop(),this.emitter.clear(),this}on(t,e){return this.emitter.on(t,e,this),this}off(t,e){return this.emitter.off(t,e,this),this}emit(t,...e){return this.emitter.emit(t,...e),this}};var pt=class extends A{install(){super.install(),this.ignoreURLs=h(this.config,"ignoreURLs")??[],this.prefetchIgnore=h(this.config,"prefetchIgnore")??!1,this.stopOnTransitioning=h(this.config,"stopOnTransitioning")??!1,this.stickyScroll=h(this.config,"stickyScroll")??!1,this.forceOnError=h(this.config,"forceOnError")??!1,this.ignoreHashAction=h(this.config,"ignoreHashAction")??!1}transitionStart(){this.isTransitioning=!0}transitionStop(){this.isTransitioning=!1}init(){this.onHover=this.onHover.bind(this),this.onClick=this.onClick.bind(this),this.onStateChange=this.onStateChange.bind(this)}boot(){"scrollRestoration"in window.history&&(window.history.scrollRestoration="manual"),super.boot()}getTransitionName(t){if(!t||!t.getAttribute)return null;let e=t.getAttribute(h(this.config,"transitionAttr",!1));return typeof e=="string"?e:null}validLink(t,e,i){let n=!window.history.pushState,s=!t||!i,a=e.metaKey||e.ctrlKey||e.shiftKey||e.altKey,l=t.hasAttribute("target")&&t.target==="_blank",o=t.protocol!==location.protocol||t.hostname!==location.hostname,p=typeof t.getAttribute("download")=="string",f=t.matches(h(this.config,"preventSelfAttr")),M=Boolean(t.closest(h(this.config,"preventAllAttr"))),v=I(c())===I(c(i));return!(s||n||a||l||o||p||f||M||v)}getHref(t){return t&&t.tagName&&t.tagName.toLowerCase()==="a"&&typeof t.href=="string"?t.href:null}getLink(t){let e=t.target,i=this.getHref(e);for(;e&&!i;)e=e.parentNode,i=this.getHref(e);if(!(!e||!this.validLink(e,t,i)))return e}onClick(t){let e=this.getLink(t);if(!e)return;if(this.isTransitioning&&this.stopOnTransitioning){t.preventDefault(),t.stopPropagation();return}let i=this.getHref(e);this.emitter.emit("ANCHOR_CLICK CLICK",t),this.go({href:i,trigger:e,event:t})}getDirection(t){return Math.abs(t)>1?t>0?"forward":"back":t===0?"popstate":t>0?"back":"forward"}force(t){window.location.assign(t)}go({href:t,trigger:e="HistoryManager",event:i}){if(this.isTransitioning&&this.stopOnTransitioning||!(this.manager.has("TransitionManager")&&this.manager.has("HistoryManager")&&this.manager.has("PageManager"))){this.force(t);return}let n=this.manager.get("HistoryManager"),s=x(0,0),a=n.current,l=a.url;if(N(l,t))return;let o;if(i&&i.state){this.emitter.emit("POPSTATE",i);let{state:p}=i,{index:f}=p,v=a.index-f;n.replace(p.states),n.pointer=f;let w=n.get(f);o=w.transition,s=w.data.scroll,e=this.getDirection(v),console.log(e=="forward"&&n),this.emitter.emit(e==="back"?"POPSTATE_BACK":"POPSTATE_FORWARD",i)}else{o=this.getTransitionName(e),s=x();let p=D({url:t,transition:o,data:{scroll:s}});!this.stickyScroll&&(s=x(0,0)),n.add(p),this.emitter.emit("HISTORY_NEW_ITEM",i)}return i&&(i.stopPropagation(),i.preventDefault()),this.emitter.emit("GO",i),this.load({oldHref:l,href:t,trigger:e,transitionName:o,scroll:s})}async load({oldHref:t,href:e,trigger:i,transitionName:n="default",scroll:s={x:0,y:0}}){try{let a=this.manager.get("PageManager"),l,o;this.emitter.emit("NAVIGATION_START",{oldHref:t,href:e,trigger:i,transitionName:n});try{this.transitionStart(),o=await a.load(t),!(o.dom instanceof Element)&&o.build(),this.emitter.emit("PAGE_LOADING",{href:e,oldPage:o,trigger:i}),l=await a.load(e),await l.build(),this.emitter.emit("PAGE_LOAD_COMPLETE",{newPage:l,oldPage:o,trigger:i})}catch(p){console.warn(`[PJAX] Page load error: ${p}`)}try{let p=this.manager.get("TransitionManager");this.emitter.emit("TRANSITION_START",n);let f=await p.animate(p.has(n)?n:"default",{oldPage:o,newPage:l,trigger:i,scroll:s,ignoreHashAction:this.ignoreHashAction});f.scrollable||(!this.ignoreHashAction&&!/back|popstate|forward/.test(i)&&(s=q(s)),window.scroll(s.x,s.y)),this.emitter.emit("TRANSITION_END",{transition:f})}catch(p){console.warn(`[PJAX] Transition error: ${p}`)}this.emitter.emit("NAVIGATION_END",{oldPage:o,newPage:l,trigger:i,transitionName:n})}catch(a){this.forceOnError?this.force(e):console.warn(a)}finally{this.transitionStop()}}ignoredURL({pathname:t}){return this.ignoreURLs.length&&this.ignoreURLs.some(e=>typeof e=="string"?e===t:e.exec(t)!==null)}onHover(t){let e=this.getLink(t);if(!e||!this.manager.has("PageManager"))return;let i=this.manager.get("PageManager"),n=c(this.getHref(e)),s=n.pathname;if(!(this.ignoredURL(n)||i.has(s))){this.emitter.emit("ANCHOR_HOVER HOVER",t);try{i.load(n)}catch(a){console.warn("[PJAX] prefetch error,",a)}}}onStateChange(t){this.go({href:window.location.href,trigger:"popstate",event:t})}initEvents(){this.prefetchIgnore!==!0&&(document.addEventListener("mouseover",this.onHover),document.addEventListener("touchstart",this.onHover)),document.addEventListener("click",this.onClick),window.addEventListener("popstate",this.onStateChange)}stopEvents(){this.prefetchIgnore!==!0&&(document.removeEventListener("mouseover",this.onHover),document.removeEventListener("touchstart",this.onHover)),document.removeEventListener("click",this.onClick),window.removeEventListener("popstate",this.onStateChange)}};var ct=class extends A{constructor(t=[]){super();this.routes=new g;for(let e of t)this.add(e)}add({path:t,method:e}){let i=this.parse(t);return this.routes.set(i,e),this}parsePath(t){if(typeof t=="string")return new RegExp(t,"i");if(t instanceof RegExp||typeof t=="boolean")return t;throw"[Router] only regular expressions, strings and booleans are accepted as paths."}isPath(t){return typeof t=="string"||t instanceof RegExp||typeof t=="boolean"}parse(t){let e=t,i={from:/(.*)/g,to:/(.*)/g};if(this.isPath(t))i={from:!0,to:t};else if(this.isPath(e.from)&&this.isPath(e.to))i=e;else throw"[Router] path is neither a string, regular expression, or a { from, to } object.";let{from:n,to:s}=i;return{from:this.parsePath(n),to:this.parsePath(s)}}route(){if(this.manager.has("HistoryManager")){let t=this.manager.get("HistoryManager"),e=I(c((t.length>1?t.previous:t.current).url)),i=I(c());this.routes.forEach((n,s)=>{let a=s.from,l=s.to;if(typeof a=="boolean"&&typeof l=="boolean")throw`[Router] path ({ from: ${a}, to: ${l} }) is not valid, remember paths can only be strings, regular expressions, or a boolean; however, both the from and to paths cannot be both booleans.`;let o=a,p=l;a instanceof RegExp&&a.test(e)&&(o=a.exec(e)),l instanceof RegExp&&l.test(i)&&(p=l.exec(i)),(Array.isArray(p)&&Array.isArray(o)||Array.isArray(p)&&typeof o=="boolean"&&o||Array.isArray(o)&&typeof p=="boolean"&&p)&&n({from:o,to:p,path:{from:e,to:i}})})}else console.warn("[Route] HistoryManager is missing.")}initEvents(){this.emitter.on("READY",this.route,this),this.emitter.on("CONTENT_REPLACED",this.route,this)}stopEvents(){this.emitter.off("READY",this.route,this),this.emitter.off("CONTENT_REPLACED",this.route,this)}};var ut=r=>typeof r=="string"?Array.from(document.querySelectorAll(r)):[r],ht=r=>[].concat(...r),$=r=>Array.isArray(r)?ht(r.map($)):typeof r=="string"||r instanceof Node?ut(r):r instanceof NodeList||r instanceof HTMLCollection?Array.from(r):[],B=(r,t,e)=>typeof r=="function"?r.apply(e,t):r,K=(r,t,e)=>{let i,n,s={},a=Object.keys(r);for(let l=0,o=a.length;l/^(in|out)/.test(r)?mt[r]:r,Y={keyframes:[],loop:1,delay:0,speed:1,endDelay:0,easing:"ease",autoplay:!0,duration:1e3,fillMode:"auto",direction:"normal",extend:{}},P=class{constructor(t={}){this.options={};this.targets=[];this.properties={};this.animations=new g;this.totalDuration=0;this.minDelay=0;this.computedOptions=new g;this.emitter=new H;try{let{options:e,...i}=t,n=e instanceof P?e.getOptions():Array.isArray(e)?e?.[0]?.getOptions():e;this.options=Object.assign({},Y,n,i),this.loop=this.loop.bind(this);let{loop:s,delay:a,speed:l,easing:o,endDelay:p,duration:f,direction:M,fillMode:v,onfinish:w,target:_,keyframes:U,autoplay:z,extend:F,...j}=this.options;this.mainElement=document.createElement("div"),this.targets=$(_),this.properties=j;let S=[],d=this.targets.length,E;for(let m=0;m0||(E=K(E,[m,d,b],this));let k=u.delay+u.duration*u.iterations+u.endDelay;this.totalDuration{typeof w=="function"&&w.call(this,b,m,d,y),this.emit("finish",b,m,d,y)},this.computedOptions.set(y,u),this.animations.set(b,y),S.push(u.delay)}this.mainAnimation=this.mainElement.animate([{opacity:"0"},{opacity:"1"}],{duration:this.totalDuration,easing:"linear"}),this.minDelay=Math.min(...S),this.setSpeed(l),z?this.play():this.pause(),this.promise=this.newPromise(),this.mainAnimation.onfinish=()=>{this.emit("complete",this),this.stopLoop()}}catch(e){this.emit("error",e)}}newPromise(){return new Promise((t,e)=>{this.on("complete",()=>t([this])),this.on("error",i=>e(i))})}then(t,e){return t=t?.bind(this),e=e?.bind(this),this.promise.then(t,e),this}catch(t){return t=t?.bind(this),this.promise.catch(t),this}finally(t){return t=t?.bind(this),this.promise.finally(t),this}loop(){this.stopLoop(),this.emit("update",this.getProgress(),this),this.animationFrame=window.requestAnimationFrame(this.loop)}stopLoop(){window.cancelAnimationFrame(this.animationFrame)}all(t){return t(this.mainAnimation,this.mainElement),this.animations.forEach(t),this}beginEvent(){if(this.getProgress()==0){let t=window.setTimeout(()=>{this.emit("begin",this),t=window.clearTimeout(t)},this.minDelay)}}play(){let t=this.getPlayState();return this.beginEvent(),this.all(e=>e.play()),this.emit("play",t,this),this.loop(),this}pause(){let t=this.getPlayState();return this.all(e=>e.pause()),this.emit("pause",t,this),this.stopLoop(),this.animationFrame=void 0,this}reset(){return this.setProgress(0),this.beginEvent(),this.options.autoplay?this.play():this.pause(),this}cancel(){return this.all(t=>t.cancel()),this.stopLoop(),this}finish(){return this.all(t=>t.finish()),this.stopLoop(),this}stop(){for(this.cancel(),this.animations.clear();this.targets.length;)this.targets.pop();this.mainElement=void 0,this.emit("stop")}getTargets(){return this.targets}getAnimation(t){return this.animations.get(t)}getTiming(t){let e=t instanceof Animation?t:this.getAnimation(t),i=this.computedOptions.get(e)??{},n=e.effect?.getTiming()??{},s=this.getOptions();return{...Y,...s,...n,...i}}getTotalDuration(){return this.totalDuration}getCurrentTime(){return this.mainAnimation.currentTime}getProgress(){return this.getCurrentTime()/this.totalDuration*100}getSpeed(){return this.mainAnimation.playbackRate}getPlayState(){return this.mainAnimation.playState}getOptions(){return this.options}setCurrentTime(t){return this.all(e=>{e.currentTime=t}),this.emit("update",this.getProgress()),this}setProgress(t){let e=t/100*this.totalDuration;return this.setCurrentTime(e),this}setSpeed(t=1){return this.all(e=>{e.playbackRate=t}),this}on(t,e,i){return this.emitter.on(t,e,i??this),this}off(t,e,i){return this.emitter.off(t,e,i??this),this}emit(t,...e){return this.emitter.emit(t,...e),this}toJSON(){return this.getOptions()}get[Symbol.toStringTag](){return"Animate"}},be=(r={})=>new P(r),gt=class extends P{constructor(t={}){super();this.animations=new g;try{let{options:e,...i}=t,n=e instanceof P?e.getOptions():Array.isArray(e)?e?.[0]?.getOptions():e;this.options=Object.assign({},Y,n,i),this.loop=this.loop.bind(this);let{loop:s,delay:a,speed:l,easing:o,endDelay:p,duration:f,direction:M,fillMode:v,onfinish:w,target:_,keyframes:U,autoplay:z,extend:F,...j}=this.options;this.mainElement=document.createElement("div"),this.targets=$(_),this.properties=j;let S=[],d=this.targets.length,E;for(let m=0;m0||(E=K(E,[m,d,b],this));let k=u.delay+u.duration*u.iterations+u.endDelay;this.totalDuration{typeof w=="function"&&w.call(this,b,m,d,y),this.emit("finish",b,m,d,y)},this.computedOptions.set(y,u),this.animations.set(b,y),S.push(u.delay)}this.mainAnimation=this.mainElement.animate([{opacity:"0"},{opacity:"1"}],{duration:this.totalDuration,easing:"linear"}),this.minDelay=Math.min(...S),this.setSpeed(l),z?this.play():this.pause(),this.promise=this.newPromise(),this.mainAnimation.onfinish=()=>{this.emit("complete",this),this.stopLoop()}}catch(e){this.emit("error",e)}}add(t){return this}};export{O as AdvancedManager,P as Animate,lt as App,Z as CONFIG_DEFAULTS,Y as DefaultAnimationOptions,C as Event,H as EventEmitter,it as HistoryManager,g as Manager,R as ManagerItem,nt as PARSER,pt as PJAX,G as Page,st as PageManager,ct as Router,A as Service,V as ServiceManager,gt as Timeline,at as TransitionManager,be as animate,et as asyncMethodCall,rt as changeState,X as clean,B as computeValue,mt as easings,N as equal,h as getConfig,Q as getEase,ut as getElements,Et as getHash,I as getHashedPath,$ as getTargets,q as hashAction,K as mapObject,L as methodCall,W as newConfig,x as newCoords,J as newListener,D as newState,c as newURL,tt as toAttr}; +var Q={wrapperAttr:"wrapper",noAjaxLinkAttr:"no-ajax-link",noPrefetchAttr:"no-prefetch",headers:[["x-partial","true"]],preventSelfAttr:'prevent="self"',preventAllAttr:'prevent="all"',transitionAttr:"transition",blockAttr:"block",timeout:3e4,maxPages:5,resizeDelay:100},W=r=>Object.assign({...Q},r),tt=(r,t,e=!0)=>{let{prefix:i}=r,n=`data${i?"-"+i:""}-${t}`;return e?`[${n}]`:n},c=(r,t,e=!0)=>{if(typeof t!="string")return r;let i=r[t];return typeof i=="string"?tt(r,i,e):i};var g=class{constructor(t){this.map=new Map(t)}getMap(){return this.map}get(t){return this.map.get(t)}keys(){return Array.from(this.map.keys())}values(){return Array.from(this.map.values())}set(t,e){return this.map.set(t,e),this}add(t){let i=this.size;return this.set(i,t),this}get size(){return this.map.size}get length(){return this.map.size}last(t=1){let e=this.keys()[this.size-t];return this.get(e)}delete(t){return this.map.delete(t)}remove(t){return this.map.delete(t),this}clear(){return this.map.clear(),this}has(t){return this.map.has(t)}entries(){return this.map.entries()}forEach(t,e){return this.map.forEach(t,e),this}[Symbol.iterator](){return this.entries()}},L=(r,t,...e)=>{r.forEach(i=>{i[t](...e)})},et=async(r,t,...e)=>{for(let[,i]of r)await i[t](...e)};var k=class{constructor(){}install(){}register(t,e){return this.manager=t,this.app=t.app,this.config=t.config,this.emitter=t.emitter,this.key=e,this.install(),this}uninstall(){}unregister(){this.uninstall(),this.manager.remove(this.key),this.key=void 0,this.manager=void 0,this.app=void 0,this.config=void 0,this.emitter=void 0}},O=class extends g{constructor(t){super();this.app=t,this.config=t.config,this.emitter=t.emitter}set(t,e){return super.set(t,e),e.register(this,t),this}};var u=(r=window.location.href)=>r instanceof URL?r:new URL(r,window.location.origin),I=r=>{let t=u(r);return`${t.pathname}${t.hash}`},Et=r=>u(r).hash.slice(1),X=r=>u(r).toString().replace(/(\/#.*|\/|#.*)$/,""),N=(r,t)=>X(r)===X(t);var A=class extends k{init(){}boot(){this.initEvents()}initEvents(){}stopEvents(){}stop(){this.stopEvents(),this.unregister()}},V=class extends O{constructor(t){super(t)}init(){return L(this,"init"),this}boot(){return L(this,"boot"),this}stop(){return L(this,"stop"),this}};var v=(r=window.scrollX,t=window.scrollY)=>({x:r,y:t}),D=(r={url:I(u()),index:0,transition:"default",data:{scroll:v(),trigger:"HistoryManager"}})=>r,it=class extends A{constructor(){super(...arguments);this.pointer=-1}init(){this.states=[];let t=D();this.add(t,"replace")}get(t){return this.states[t]}add(t,e="push"){let i=D(t),n=this.length;this.states.push({...i}),this.pointer=n;let s={index:this.pointer,states:[...this.states]};return rt(e,i,s),this}remove(t){return t?this.states.splice(t,1):this.states.pop(),this.pointer--,this}replace(t){return this.states=t,this}set(t,e){return this.states[t]=e}get current(){return this.get(this.pointer)}get last(){return this.get(this.length-1)}get previous(){return this.pointer<1?null:this.get(this.pointer-1)}get length(){return this.states.length}},rt=(r,t,e)=>{let i=I(t.url),n=[e,"",i];if(window.history)switch(r){case"push":window.history.pushState.apply(window.history,n);break;case"replace":window.history.replaceState.apply(window.history,n);break}};var nt=new DOMParser,G=class extends k{constructor(t=u(),e=document){super();this.url=t,typeof e=="string"?this.data=e:this.dom=e||document}build(){if(this.dom instanceof Node||(this.dom=nt.parseFromString(this.data,"text/html")),!(this.body instanceof Node)){let{title:t,head:e,body:i}=this.dom;this.title=t,this.head=e,this.body=i,this.wrapper=this.body.querySelector(this.wrapperAttr)}}install(){this.wrapperAttr=c(this.config,"wrapperAttr")}uninstall(){this.url=void 0,this.title=void 0,this.head=void 0,this.body=void 0,this.dom=void 0,this.wrapper=void 0,this.data=void 0,this.wrapperAttr=void 0}},st=class extends A{constructor(){super(...arguments);this.loading=new g}install(){this.pages=new O(this.app);let t=u().pathname;this.set(t,new G),t=void 0}get(t){return this.pages.get(t)}add(t){return this.pages.add(t),this}set(t,e){return this.pages.set(t,e),this}remove(t){return this.pages.remove(t),this}has(t){return this.pages.has(t)}clear(){return this.pages.clear(),this}get size(){return this.pages.size}keys(){return this.pages.keys()}async load(t=u()){let e=u(t),i=e.pathname,n,s;if(this.has(i))return n=this.get(i),Promise.resolve(n);this.loading.has(i)?s=this.loading.get(i):(s=this.request(i),this.loading.set(i,s));let o=await s;if(this.loading.remove(i),n=new G(e,o),this.set(i,n),this.size>c(this.config,"maxPages")){let l=u(),a=this.keys(),p=N(l,a[0])?a[1]:a[0],d=this.get(p);d.unregister(),d=void 0,a=void 0,l=void 0,p=void 0}return n}async request(t){let e=new Headers(c(this.config,"headers")),i=window.setTimeout(()=>{throw window.clearTimeout(i),"Request Timed Out!"},c(this.config,"timeout"));try{let n=await fetch(t,{mode:"same-origin",method:"GET",headers:e,cache:"default",credentials:"same-origin"});if(window.clearTimeout(i),n.status>=200&&n.status<300)return await n.text();throw new Error(n.statusText||""+n.status)}catch(n){throw window.clearTimeout(i),n}}};var J=({callback:r=()=>{},scope:t=null,name:e="event"})=>({callback:r,scope:t,name:e}),C=class extends g{constructor(t="event"){super();this.name=t}},H=class extends g{constructor(){super()}getEvent(t){let e=this.get(t);return e instanceof C?e:(this.set(t,new C(t)),this.get(t))}newListener(t,e,i){let n=this.getEvent(t);return n.add(J({name:t,callback:e,scope:i})),n}on(t,e,i){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let n,s,o=typeof t=="object"&&!Array.isArray(t),l=o?e:i;return o||(s=e),Object.keys(t).forEach(a=>{o?(n=a,s=t[a]):n=t[a],this.newListener(n,s,l)},this),this}removeListener(t,e,i){let n=this.get(t);if(n instanceof C&&e){let s=J({name:t,callback:e,scope:i});n.forEach((o,l)=>{if(o.callback===s.callback&&o.scope===s.scope)return n.remove(l)})}return n}off(t,e,i){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let n,s,o=typeof t=="object"&&!Array.isArray(t),l=o?e:i;return o||(s=e),Object.keys(t).forEach(a=>{o?(n=a,s=t[a]):n=t[a],typeof s=="function"?this.removeListener(n,s,l):this.remove(n)},this),this}emit(t,...e){return typeof t=="undefined"?this:(typeof t=="string"&&(t=t.trim().split(/\s/g)),t.forEach(i=>{let n=this.get(i);n instanceof C&&n.forEach(s=>{let{callback:o,scope:l}=s;o.apply(l,e)})},this),this)}clear(){return L(this,"clear"),super.clear(),this}};var q=(r,t=window.location.hash)=>{try{let e=t[0]=="#"?t:u(t).hash;if(e.length>1){let i=document.getElementById(e.slice(1));if(i){let{left:n,top:s}=i.getBoundingClientRect(),o=window.pageXOffset,l=window.pageYOffset,a=n+o,p=s+l;return console.log(a,p),v(a,p)}}}catch(e){console.warn("[hashAction] error",e)}return r??v(0,0)},at={name:"default",scrollable:!0,out({done:r}){r()},in({scroll:r,done:t}){window.scroll(r.x,r.y),t()}},ot=class extends A{constructor(t){super();this._arg=t}install(){super.install();let t=this._arg&&this._arg.length?this._arg:c(this.config,"transitions")??[];t=[["default",at]].concat(t),this.transitions=new g(t)}get(t){return this.transitions.get(t)}set(t,e){return this.transitions.set(t,e),this}add(t){return this.transitions.add(t),this}has(t){return this.transitions.has(t)}async animate(t,e){let i=this.transitions.get(t),n=e.scroll,s=e.ignoreHashAction;if(!("wrapper"in e.oldPage)||!("wrapper"in e.newPage))throw`[Page] either oldPage or newPage aren't instances of the Page Class. + ${{newPage:e.newPage,oldPage:e.oldPage}}`;document.title=""+e.newPage.title;let o=e.oldPage.wrapper,l=e.newPage.wrapper;if(!(o instanceof Node)||!(l instanceof Node))throw`[Wrapper] the wrapper from the ${l instanceof Node?"current":"next"} page cannot be found. The wrapper must be an element that has the attribute ${c(this.config,"wrapperAttr")}.`;return i.init&&i?.init(e),this.emitter.emit("BEFORE_TRANSITION_OUT"),i.out&&await new Promise(a=>{i.out.call(i,{...e,from:e.oldPage,trigger:e.trigger,done:a})?.then(a)}),this.emitter.emit("AFTER_TRANSITION_OUT"),await new Promise(a=>{o.insertAdjacentElement("beforebegin",l),this.emitter.emit("CONTENT_INSERT"),!s&&!/back|popstate|forward/.test(e.trigger)&&(n=q(n)),a()}),await new Promise(a=>{o.remove(),o=void 0,l=void 0,this.emitter.emit("CONTENT_REPLACED"),a()}),this.emitter.emit("BEFORE_TRANSITION_IN"),i.in&&await new Promise(async a=>{i.in.call(i,{...e,from:e.oldPage,to:e.newPage,trigger:e.trigger,scroll:n,done:a})?.then(a)}),this.emitter.emit("AFTER_TRANSITION_IN"),i}};var lt=class{constructor(t={}){this.canResize=!0;this.canScroll=!0;this._resize=this._resize.bind(this),this._scroll=this._scroll.bind(this),this._ready=this._ready.bind(this),this.register(t)}register(t={}){return this.config=W(t),this.emitter=new H,this.services=new V(this),document.addEventListener("DOMContentLoaded",this._ready),window.addEventListener("load",this._ready),window.addEventListener("resize",this._resize,{passive:!0}),window.addEventListener("scroll",this._scroll,{passive:!0}),this}_ready(){document.removeEventListener("DOMContentLoaded",this._ready),window.removeEventListener("load",this._ready),this.emitter.emit("READY ready")}_resize(){if(this.canResize){let t,e;this.canResize=!1,e=window.requestAnimationFrame(()=>{this.emitter.emit("RESIZE resize"),t=window.setTimeout(()=>{this.canResize=!0,t=window.clearTimeout(t),e=window.cancelAnimationFrame(e)},c(this.config,"resizeDelay"))})}}_scroll(){if(this.canScroll){let t;this.canScroll=!1,t=requestAnimationFrame(()=>{this.emitter.emit("SCROLL scroll"),this.canScroll=!0,t=window.cancelAnimationFrame(t)})}}get(t){return this.services.get(t)}set(t,e){return this.services.set(t,e),this}add(t){return this.services.add(t),this}boot(){return this.services.init(),this.services.boot(),this}stop(){return this.services.stop(),this.emitter.clear(),this}on(t,e){return this.emitter.on(t,e,this),this}off(t,e){return this.emitter.off(t,e,this),this}emit(t,...e){return this.emitter.emit(t,...e),this}};var pt=class extends A{install(){super.install(),this.ignoreURLs=c(this.config,"ignoreURLs")??[],this.prefetchIgnore=c(this.config,"prefetchIgnore")??!1,this.stopOnTransitioning=c(this.config,"stopOnTransitioning")??!1,this.stickyScroll=c(this.config,"stickyScroll")??!1,this.forceOnError=c(this.config,"forceOnError")??!1,this.ignoreHashAction=c(this.config,"ignoreHashAction")??!1}transitionStart(){this.isTransitioning=!0}transitionStop(){this.isTransitioning=!1}init(){this.onHover=this.onHover.bind(this),this.onClick=this.onClick.bind(this),this.onStateChange=this.onStateChange.bind(this)}boot(){"scrollRestoration"in window.history&&(window.history.scrollRestoration="manual"),super.boot()}getTransitionName(t){if(!t||!t.getAttribute)return null;let e=t.getAttribute(c(this.config,"transitionAttr",!1));return typeof e=="string"?e:null}validLink(t,e,i){let n=!window.history.pushState,s=!t||!i,o=e.metaKey||e.ctrlKey||e.shiftKey||e.altKey,l=t.hasAttribute("target")&&t.target==="_blank",a=t.protocol!==location.protocol||t.hostname!==location.hostname,p=typeof t.getAttribute("download")=="string",d=t.matches(c(this.config,"preventSelfAttr")),M=Boolean(t.closest(c(this.config,"preventAllAttr"))),x=I(u())===I(u(i));return!(s||n||o||l||a||p||d||M||x)}getHref(t){return t&&t.tagName&&t.tagName.toLowerCase()==="a"&&typeof t.href=="string"?t.href:null}getLink(t){let e=t.target,i=this.getHref(e);for(;e&&!i;)e=e.parentNode,i=this.getHref(e);if(!(!e||!this.validLink(e,t,i)))return e}onClick(t){let e=this.getLink(t);if(!e)return;if(this.isTransitioning&&this.stopOnTransitioning){t.preventDefault(),t.stopPropagation();return}let i=this.getHref(e);this.emitter.emit("ANCHOR_CLICK CLICK",t),this.go({href:i,trigger:e,event:t})}getDirection(t){return Math.abs(t)>1?t>0?"forward":"back":t===0?"popstate":t>0?"back":"forward"}force(t){window.location.assign(t)}go({href:t,trigger:e="HistoryManager",event:i}){if(this.isTransitioning&&this.stopOnTransitioning||!(this.manager.has("TransitionManager")&&this.manager.has("HistoryManager")&&this.manager.has("PageManager"))){this.force(t);return}let n=this.manager.get("HistoryManager"),s=v(0,0),o=n.current,l=o.url;if(N(l,t))return;let a;if(i&&i.state){this.emitter.emit("POPSTATE",i);let{state:p}=i,{index:d}=p,x=o.index-d;n.replace(p.states),n.pointer=d;let w=n.get(d);a=w.transition,s=w.data.scroll,e=this.getDirection(x),console.log(e=="forward"&&n),this.emitter.emit(e==="back"?"POPSTATE_BACK":"POPSTATE_FORWARD",i)}else{a=this.getTransitionName(e),s=v();let p=D({url:t,transition:a,data:{scroll:s}});!this.stickyScroll&&(s=v(0,0)),n.add(p),this.emitter.emit("HISTORY_NEW_ITEM",i)}return i&&(i.stopPropagation(),i.preventDefault()),this.emitter.emit("GO",i),this.load({oldHref:l,href:t,trigger:e,transitionName:a,scroll:s})}async load({oldHref:t,href:e,trigger:i,transitionName:n="default",scroll:s={x:0,y:0}}){try{let o=this.manager.get("PageManager"),l,a;this.emitter.emit("NAVIGATION_START",{oldHref:t,href:e,trigger:i,transitionName:n});try{this.transitionStart(),a=await o.load(t),!(a.dom instanceof Element)&&a.build(),this.emitter.emit("PAGE_LOADING",{href:e,oldPage:a,trigger:i}),l=await o.load(e),await l.build(),this.emitter.emit("PAGE_LOAD_COMPLETE",{newPage:l,oldPage:a,trigger:i})}catch(p){console.warn(`[PJAX] Page load error: ${p}`)}try{let p=this.manager.get("TransitionManager");this.emitter.emit("TRANSITION_START",n);let d=await p.animate(p.has(n)?n:"default",{oldPage:a,newPage:l,trigger:i,scroll:s,ignoreHashAction:this.ignoreHashAction});d.scrollable||(!this.ignoreHashAction&&!/back|popstate|forward/.test(i)&&(s=q(s)),window.scroll(s.x,s.y)),this.emitter.emit("TRANSITION_END",{transition:d})}catch(p){console.warn(`[PJAX] Transition error: ${p}`)}this.emitter.emit("NAVIGATION_END",{oldPage:a,newPage:l,trigger:i,transitionName:n})}catch(o){this.forceOnError?this.force(e):console.warn(o)}finally{this.transitionStop()}}ignoredURL({pathname:t}){return this.ignoreURLs.length&&this.ignoreURLs.some(e=>typeof e=="string"?e===t:e.exec(t)!==null)}onHover(t){let e=this.getLink(t);if(!e||!this.manager.has("PageManager"))return;let i=this.manager.get("PageManager"),n=u(this.getHref(e)),s=n.pathname;if(!(this.ignoredURL(n)||i.has(s))){this.emitter.emit("ANCHOR_HOVER HOVER",t);try{i.load(n)}catch(o){console.warn("[PJAX] prefetch error,",o)}}}onStateChange(t){this.go({href:window.location.href,trigger:"popstate",event:t})}initEvents(){this.prefetchIgnore!==!0&&(document.addEventListener("mouseover",this.onHover),document.addEventListener("touchstart",this.onHover)),document.addEventListener("click",this.onClick),window.addEventListener("popstate",this.onStateChange)}stopEvents(){this.prefetchIgnore!==!0&&(document.removeEventListener("mouseover",this.onHover),document.removeEventListener("touchstart",this.onHover)),document.removeEventListener("click",this.onClick),window.removeEventListener("popstate",this.onStateChange)}};var ct=class extends A{constructor(t=[]){super();this.routes=new g;for(let e of t)this.add(e)}add({path:t,method:e}){let i=this.parse(t);return this.routes.set(i,e),this}parsePath(t){if(typeof t=="string")return new RegExp(t,"i");if(t instanceof RegExp||typeof t=="boolean")return t;throw"[Router] only regular expressions, strings and booleans are accepted as paths."}isPath(t){return typeof t=="string"||t instanceof RegExp||typeof t=="boolean"}parse(t){let e=t,i={from:/(.*)/g,to:/(.*)/g};if(this.isPath(t))i={from:!0,to:t};else if(this.isPath(e.from)&&this.isPath(e.to))i=e;else throw"[Router] path is neither a string, regular expression, or a { from, to } object.";let{from:n,to:s}=i;return{from:this.parsePath(n),to:this.parsePath(s)}}route(){if(this.manager.has("HistoryManager")){let t=this.manager.get("HistoryManager"),e=I(u((t.length>1?t.previous:t.current).url)),i=I(u());this.routes.forEach((n,s)=>{let o=s.from,l=s.to;if(typeof o=="boolean"&&typeof l=="boolean")throw`[Router] path ({ from: ${o}, to: ${l} }) is not valid, remember paths can only be strings, regular expressions, or a boolean; however, both the from and to paths cannot be both booleans.`;let a=o,p=l;o instanceof RegExp&&o.test(e)&&(a=o.exec(e)),l instanceof RegExp&&l.test(i)&&(p=l.exec(i)),(Array.isArray(p)&&Array.isArray(a)||Array.isArray(p)&&typeof a=="boolean"&&a||Array.isArray(a)&&typeof p=="boolean"&&p)&&n({from:a,to:p,path:{from:e,to:i}})})}else console.warn("[Route] HistoryManager is missing.")}initEvents(){this.emitter.on("READY",this.route,this),this.emitter.on("CONTENT_REPLACED",this.route,this)}stopEvents(){this.emitter.off("READY",this.route,this),this.emitter.off("CONTENT_REPLACED",this.route,this)}};var ut=r=>typeof r=="string"?Array.from(document.querySelectorAll(r)):[r],ht=r=>[].concat(...r),$=r=>Array.isArray(r)?ht(r.map($)):typeof r=="string"||r instanceof Node?ut(r):r instanceof NodeList||r instanceof HTMLCollection?Array.from(r):[],B=(r,t,e)=>typeof r=="function"?r.apply(e,t):r,_=(r,t,e)=>{let i,n,s={},o=Object.keys(r);for(let l=0,a=o.length;l/^(in|out)/.test(r)?mt[r]:r,Y={keyframes:[],loop:1,delay:0,speed:1,endDelay:0,easing:"ease",autoplay:!0,duration:1e3,fillMode:"auto",direction:"normal",extend:{}},P=class{constructor(t={}){this.options={};this.targets=[];this.properties={};this.animations=new g;this.totalDuration=0;this.minDelay=0;this.computedOptions=new g;this.emitter=new H;try{let{options:e,...i}=t,n=e instanceof P?e.getOptions():Array.isArray(e)?e?.[0]?.getOptions():e;this.options=Object.assign({},Y,n,i),this.loop=this.loop.bind(this);let{loop:s,delay:o,speed:l,easing:a,endDelay:p,duration:d,direction:M,fillMode:x,onfinish:w,target:K,keyframes:z,autoplay:F,extend:U,...j}=this.options;this.mainElement=document.createElement("div"),this.targets=$(K),this.properties=j;let S=[],b=this.targets.length,E;for(let m=0;m0||(E=_(E,[m,b,f],this));let R=h.delay+h.duration*h.iterations+h.endDelay;this.totalDuration{typeof w=="function"&&w.call(this,f,m,b,y),this.emit("finish",f,m,b,y)},this.computedOptions.set(y,h),this.animations.set(f,y),S.push(h.delay)}this.mainAnimation=this.mainElement.animate([{opacity:"0"},{opacity:"1"}],{duration:this.totalDuration,easing:"linear"}),this.minDelay=Math.min(...S),this.setSpeed(l),F?this.play():this.pause(),this.promise=this.newPromise(),this.mainAnimation.onfinish=()=>{this.emit("complete",this),this.stopLoop()}}catch(e){this.emit("error",e)}}newPromise(){return new Promise((t,e)=>{this.on("complete",()=>t([this])),this.on("error",i=>e(i))})}then(t,e){return t=t?.bind(this),e=e?.bind(this),this.promise.then(t,e),this}catch(t){return t=t?.bind(this),this.promise.catch(t),this}finally(t){return t=t?.bind(this),this.promise.finally(t),this}loop(){this.stopLoop(),this.emit("update",this.getProgress(),this),this.animationFrame=window.requestAnimationFrame(this.loop)}stopLoop(){window.cancelAnimationFrame(this.animationFrame)}all(t){return t(this.mainAnimation,this.mainElement),this.animations.forEach(t),this}beginEvent(){if(this.getProgress()==0){let t=window.setTimeout(()=>{this.emit("begin",this),t=window.clearTimeout(t)},this.minDelay)}}play(){let t=this.getPlayState();return this.beginEvent(),this.all(e=>e.play()),this.emit("play",t,this),this.loop(),this}pause(){let t=this.getPlayState();return this.all(e=>e.pause()),this.emit("pause",t,this),this.stopLoop(),this.animationFrame=void 0,this}reset(){return this.setProgress(0),this.beginEvent(),this.options.autoplay?this.play():this.pause(),this}cancel(){return this.all(t=>t.cancel()),this.stopLoop(),this}finish(){return this.all(t=>t.finish()),this.stopLoop(),this}stop(){for(this.cancel(),this.animations.clear();this.targets.length;)this.targets.pop();this.mainElement=void 0,this.emit("stop")}getTargets(){return this.targets}getAnimation(t){return this.animations.get(t)}getTiming(t){let e=t instanceof Animation?t:this.getAnimation(t),i=this.computedOptions.get(e)??{},n=e.effect?.getTiming()??{},s=this.getOptions();return{...Y,...s,...n,...i}}getTotalDuration(){return this.totalDuration}getCurrentTime(){return this.mainAnimation.currentTime}getProgress(){return this.getCurrentTime()/this.totalDuration*100}getSpeed(){return this.mainAnimation.playbackRate}getPlayState(){return this.mainAnimation.playState}getOptions(){return this.options}setCurrentTime(t){return this.all(e=>{e.currentTime=t}),this.emit("update",this.getProgress()),this}setProgress(t){let e=t/100*this.totalDuration;return this.setCurrentTime(e),this}setSpeed(t=1){return this.all(e=>{e.playbackRate=t}),this}on(t,e,i){return this.emitter.on(t,e,i??this),this}off(t,e,i){return this.emitter.off(t,e,i??this),this}emit(t,...e){return this.emitter.emit(t,...e),this}toJSON(){return this.getOptions()}get[Symbol.toStringTag](){return"Animate"}},fe=(r={})=>new P(r),gt=class extends P{constructor(t={}){super();this.animations=new g;try{let{options:e,...i}=t,n=e instanceof P?e.getOptions():Array.isArray(e)?e?.[0]?.getOptions():e;this.options=Object.assign({},Y,n,i),this.loop=this.loop.bind(this);let{loop:s,delay:o,speed:l,easing:a,endDelay:p,duration:d,direction:M,fillMode:x,onfinish:w,target:K,keyframes:z,autoplay:F,extend:U,...j}=this.options;this.mainElement=document.createElement("div"),this.targets=$(K),this.properties=j;let S=[],b=this.targets.length,E;for(let m=0;m0||(E=_(E,[m,b,f],this));let R=h.delay+h.duration*h.iterations+h.endDelay;this.totalDuration{typeof w=="function"&&w.call(this,f,m,b,y),this.emit("finish",f,m,b,y)},this.computedOptions.set(y,h),this.animations.set(f,y),S.push(h.delay)}this.mainAnimation=this.mainElement.animate([{opacity:"0"},{opacity:"1"}],{duration:this.totalDuration,easing:"linear"}),this.minDelay=Math.min(...S),this.setSpeed(l),F?this.play():this.pause(),this.promise=this.newPromise(),this.mainAnimation.onfinish=()=>{this.emit("complete",this),this.stopLoop()}}catch(e){this.emit("error",e)}}add(t){return this}};export{O as AdvancedManager,P as Animate,lt as App,Q as CONFIG_DEFAULTS,Y as DefaultAnimationOptions,C as Event,H as EventEmitter,it as HistoryManager,g as Manager,k as ManagerItem,nt as PARSER,pt as PJAX,G as Page,st as PageManager,ct as Router,A as Service,V as ServiceManager,gt as Timeline,ot as TransitionManager,fe as animate,et as asyncMethodCall,rt as changeState,X as clean,B as computeValue,mt as easings,N as equal,c as getConfig,Z as getEase,ut as getElements,Et as getHash,I as getHashedPath,$ as getTargets,q as hashAction,_ as mapObject,L as methodCall,W as newConfig,v as newCoords,J as newListener,D as newState,u as newURL,tt as toAttr}; //# sourceMappingURL=api.es.js.map diff --git a/packages/native/lib/api.es.js.map b/packages/native/lib/api.es.js.map index 3b14d87..125ca44 100644 --- a/packages/native/lib/api.es.js.map +++ b/packages/native/lib/api.es.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../src/config.ts", "../../manager/src/api.ts", "../src/manager.ts", "../src/url.ts", "../src/service.ts", "../src/history.ts", "../src/page.ts", "../../emitter/src/api.ts", "../src/transition.ts", "../src/app.ts", "../src/pjax.ts", "../src/router.ts", "../../animate/src/api.ts"], - "sourcesContent": ["export interface ICONFIG {\n prefix?: string;\n wrapperAttr?: string;\n noAjaxLinkAttr?: string;\n noPrefetchAttr?: \"no-prefetch\";\n headers?: string[][];\n preventSelfAttr?: string;\n preventAllAttr?: string;\n transitionAttr?: string;\n blockAttr?: string;\n timeout?: number;\n maxPages?: number;\n [key: string]: any;\n}\n\nexport const CONFIG_DEFAULTS = {\n wrapperAttr: \"wrapper\",\n noAjaxLinkAttr: \"no-ajax-link\",\n noPrefetchAttr: \"no-prefetch\",\n headers: [\n [\"x-partial\", \"true\"]\n ],\n preventSelfAttr: `prevent=\"self\"`,\n preventAllAttr: `prevent=\"all\"`,\n transitionAttr: \"transition\",\n blockAttr: `block`,\n timeout: 30000,\n maxPages: 5\n};\n\nexport type ConfigKeys = keyof typeof CONFIG_DEFAULTS | string;\nexport const newConfig = (config: ICONFIG): ICONFIG => {\n return Object.assign({ ...CONFIG_DEFAULTS }, config);\n};\n\n/** Converts string into properly formatted data attributes */\nexport const toAttr = (config: ICONFIG, value: string, brackets: boolean = true): string => {\n let { prefix } = config;\n let attr = `data${prefix ? \"-\" + prefix : \"\"}-${value}`;\n return brackets ? `[${attr}]` : attr;\n};\n\n/** Selects config vars, and formats them for use, or simply returns the current configurations for the framework */\nexport const getConfig = (config: ICONFIG, value?: ConfigKeys, brackets: boolean = true): any => {\n if (typeof value !== \"string\")\n return config;\n\n let prop = config[value];\n if (typeof prop === \"string\")\n return toAttr(config, prop, brackets);\n return prop;\n};\n", "/** Manages complex lists of named data, eg. A page can be stored in a list by of other pages with the url being how the page is stored in the list. Managers use Maps to store data */\nexport class Manager {\n\t/** The complex list of named data, to which the Manager controls */\n\tpublic map: Map;\n\tconstructor(value?: Array<[K, V]>) {\n\t\tthis.map = new Map(value);\n\t}\n\n\t/** Returns the Manager classes base Map */\n\tpublic getMap(): Map {\n\t\treturn this.map;\n\t}\n\n\t/** Get a value stored in the Manager */\n\tpublic get(key: K): V {\n\t\treturn this.map.get(key);\n\t}\n\n\t/** Returns the keys of all items stored in the Manager as an Array */\n\tpublic keys(): Array {\n\t\treturn Array.from(this.map.keys());\n\t}\n\n\t/** Returns the values of all items stored in the Manager as an Array */\n\tpublic values(): Array {\n\t\treturn Array.from(this.map.values());\n\t}\n\n\t/** Set a value to the Manager using a key */\n\tpublic set(key: K, value: V): Manager {\n\t\tthis.map.set(key, value);\n\t\treturn this;\n\t}\n\n\t/** Adds a value to Manager, and uses the current size of the Manager as it's key, it works best when all the key in the Manager are numbers */\n\tpublic add(value: V): Manager {\n\t\tlet size = this.size;\n\t\t// @ts-ignore\n\t\tlet num: K = size as K;\n\t\tthis.set(num, value);\n\t\treturn this;\n\t}\n\n\t/** Returns the total number of items stored in the Manager */\n\tpublic get size(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** An alias for size */\n\tpublic get length(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** Returns the last item in the Manager who's index is a certain distance from the last item in the Manager */\n\tpublic last(distance: number = 1): V | undefined {\n\t\tlet key = this.keys()[this.size - distance];\n\t\treturn this.get(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns true if an element in the Map object existed and has been removed, or false if the element does not exist */\n\tpublic delete(key: K): boolean {\n\t\treturn this.map.delete(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns the Manager class, allowing for chains */\n\tpublic remove(key: K): Manager {\n\t\tthis.map.delete(key);\n\t\treturn this;\n\t}\n\n\t/** Clear the Manager of all its contents */\n\tpublic clear(): Manager {\n\t\tthis.map.clear();\n\t\treturn this;\n\t}\n\n\t/** Checks if the Manager contains a certain key */\n\tpublic has(key: K): boolean {\n\t\treturn this.map.has(key);\n\t}\n\n\t/** Returns a new Iterator object that contains an array of [key, value] for each element in the Map object in insertion order. */\n\tpublic entries(): IterableIterator<[K, V]> {\n\t\treturn this.map.entries();\n\t}\n\n\t/** Iterates through the Managers contents, calling a callback function every iteration */\n\tpublic forEach(\n\t\tcallback: (value?: V, key?: K, map?: Map) => void,\n\t\tcontext?: object\n\t): Manager {\n\t\tthis.map.forEach(callback, context);\n\t\treturn this;\n\t}\n\n\t/** Allows for iteration via for..of, learn more: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators] */\n\tpublic [Symbol.iterator](): IterableIterator<[K, V]> {\n\t\treturn this.entries();\n\t}\n}\n\n/**\n * Calls the method of a certain name for all items that are currently installed\n */\nexport const methodCall = (manager: Manager, method: string, ...args: any): void => {\n\tmanager.forEach((item) => {\n\t\t// @ts-ignore\n\t\titem[method](...args);\n\t});\n};\n\n/**\n * Asynchronously calls the method of a certain name for all items that are currently installed, similar to methodCall\n */\nexport const asyncMethodCall = async (manager: Manager, method: string, ...args: any): Promise => {\n\tfor (let [, item] of manager) {\n\t\t// @ts-ignore\n\t\tawait item[method](...args);\n\t}\n};\n\nexport default Manager;\n", "import { Manager, methodCall, asyncMethodCall } from \"@okikio/manager\";\nimport { ICONFIG } from \"./config\";\nimport { IApp } from \"./app\";\nimport { EventEmitter } from \"./emitter\";\n\nexport type IAdvancedManager = AdvancedManager;\n\n/** The base class for AdvancedManager items */\nexport class ManagerItem {\n /** The AdvancedManager the ManagerItem is attached to */\n public manager: IAdvancedManager;\n\n /** The App the ManagerItem is attached to */\n public app: IApp;\n\n /** The Config of the App the ManagerItem is attached to */\n public config: ICONFIG;\n\n /** The EventEmitter of the App the ManagerItem is attached to */\n public emitter: EventEmitter;\n\n /** The key to where ManagerItem is stored in an AdvancedManager */\n public key: any;\n\n constructor() { }\n\n /** Run after the Manager Item has been registered */\n public install(): any { }\n\n /** Register the current Manager Item's manager */\n public register(manager: IAdvancedManager, key: any): ManagerItem {\n this.manager = manager;\n this.app = manager.app;\n this.config = manager.config;\n this.emitter = manager.emitter;\n this.key = key;\n this.install();\n return this;\n }\n\n /** Run before the ManagerItem has been unregistered */\n public uninstall(): any { }\n\n /** Basically removes a ManagerItem, in order to recover the ManagerItem, it needs to be re-added to an AdvancedManager */\n public unregister() {\n this.uninstall();\n\n this.manager.remove(this.key);\n this.key = undefined;\n this.manager = undefined;\n this.app = undefined;\n this.config = undefined;\n this.emitter = undefined;\n }\n}\n\n/** A tweak to the Manager class that makes it self aware of the App class it's instantiated in */\nexport class AdvancedManager extends Manager {\n /** The App the AdvancedManager is attached to */\n public app: IApp;\n\n /** The Config of the App the AdvancedManager is attached to */\n public config: ICONFIG;\n\n /** The EventEmitter of the App the AdvancedManager is attached to */\n public emitter: EventEmitter;\n\n /** Register App details */\n constructor(app: IApp) {\n super();\n this.app = app;\n this.config = app.config;\n this.emitter = app.emitter;\n }\n\n /** Add a ManagerItem to AdvancedManager at a specified key */\n public set(key: K, value: V) {\n super.set(key, value);\n value.register(this, key);\n return this;\n }\n}\n\nexport { Manager, methodCall, asyncMethodCall };\n", "export const newURL = (url: string | URL | Location = window.location.href): URL => {\n return url instanceof URL ? url : new URL(url as unknown as string, window.location.origin);\n};\n\n/** Returns the pathname with the hash at the end */\nexport const getHashedPath = (url: URL | string): string => {\n let _url = newURL(url);\n return `${_url.pathname}${_url.hash}`;\n};\n\n/** Returns the actual hash without the hashtag */\nexport const getHash = (url: URL | string): string => newURL(url).hash.slice(1);\n\n/** Removes the hash from the full URL for a clean URL string */\nexport const clean = (url: URL | string): string => newURL(url).toString().replace(/(\\/#.*|\\/|#.*)$/, '');\n\n/** Compares two URLs to each other */\nexport const equal = (a: URL | string, b: URL | string): boolean => (clean(a) === clean(b));\n\n", "import { AdvancedManager, ManagerItem, methodCall } from \"./manager\";\nimport { IApp } from \"./app\";\n\n/** Controls specific kinds of actions that require JS */\nexport class Service extends ManagerItem {\n\t/** Called before the start of a Service, represents a constructor of sorts */\n\tpublic init(...args: any): any;\n\tpublic init(): any { }\n\n\t/** Called on start of Service */\n\tpublic boot(...args: any): any;\n\tpublic boot(): any {\n\t\tthis.initEvents();\n\t}\n\n\t/** Initialize events */\n\tpublic initEvents(): void { }\n\n\t/** Stop events */\n\tpublic stopEvents(): void { }\n\n\t/** Stop services */\n\tpublic stop(): void {\n\t\tthis.stopEvents();\n\t\tthis.unregister();\n\t}\n}\n\n/** The Service Manager controls the lifecycle of all Services in an App */\nexport class ServiceManager extends AdvancedManager {\n\tconstructor(app: IApp) {\n\t\tsuper(app);\n\t}\n\n\t/** Call the init method for all Services */\n\tpublic init(): ServiceManager {\n\t\tmethodCall(this, \"init\");\n\t\treturn this;\n\t}\n\n\t/** Call the boot method for all Services */\n\tpublic boot(): ServiceManager {\n\t\tmethodCall(this, \"boot\");\n\t\treturn this;\n\t}\n\n\t/** Call the stop method for all Services */\n\tpublic stop(): ServiceManager {\n\t\tmethodCall(this, \"stop\");\n\t\treturn this;\n\t}\n}\n", "import { Service } from \"./service\";\nimport { getHashedPath, newURL } from \"./url\";\n\nexport type Trigger = HTMLAnchorElement | \"HistoryManager\" | \"popstate\" | \"back\" | \"forward\";\nexport interface ICoords {\n\treadonly x: number;\n\treadonly y: number;\n}\n\nexport interface IStateData {\n\tscroll: ICoords;\n\t[key: string]: any;\n}\n\nexport interface IState {\n\turl: string;\n\tindex?: number;\n\ttransition: string;\n\tdata: IStateData;\n}\n\nexport interface IHistoryItem {\n\tindex: number;\n\tstates: IState[];\n}\n\nexport interface IHistoryManager extends Service {\n\tstates: IState[],\n\tpointer: number,\n\n\tinit(): any,\n\tget(index: number): IState,\n\tadd(value?: IState, historyAction?: \"replace\" | \"push\"): HistoryManager,\n\tremove(index?: number): HistoryManager,\n\treplace(newStates: IState[]): HistoryManager,\n\tset(i: number, state: IState): IState,\n\tcurrent: IState,\n\tlast: IState,\n\tprevious: IState | null,\n\tlength: number,\n}\n\n/** A quick snapshot of page scroll coordinates */\nexport const newCoords = (x: number = window.scrollX, y: number = window.scrollY): ICoords => ({ x, y });\n\n/** Creates a state; a state represents the current status of the page consisting of properties like: url, transition, and data */\nexport const newState = (state: IState = {\n\turl: getHashedPath(newURL()),\n\tindex: 0,\n\ttransition: \"default\",\n\tdata: {\n\t\tscroll: newCoords(),\n\t\ttrigger: \"HistoryManager\"\n\t}\n}): IState => (state);\n\n/** Keeps a record of the history of the App; it stores only the states of Pages */\nexport class HistoryManager extends Service implements IHistoryManager {\n\tpublic states: IState[];\n\tpublic pointer = -1;\n\n\t/** Initializes the states array, and replace the history pushState data with the states array */\n\tinit() {\n\t\tthis.states = [];\n\n\t\tlet state = newState();\n\t\tthis.add(state, \"replace\");\n\t}\n\n\t/** Get a state based on it's index */\n\tpublic get(index: number) {\n\t\treturn this.states[index];\n\t}\n\n\t/** Add a state to HistoryManager and change the history pushState data based on the historyAction specified */\n\tpublic add(value?: IState, historyAction: \"replace\" | \"push\" = \"push\"): HistoryManager {\n\t\tlet state = newState(value);\n\t\tlet len = this.length;\n\t\tthis.states.push({ ...state });\n\t\tthis.pointer = len;\n\n\t\tlet item: IHistoryItem = {\n\t\t\tindex: this.pointer,\n\t\t\tstates: [...this.states]\n\t\t};\n\t\tchangeState(historyAction, state, item);\n\t\treturn this;\n\t}\n\n\tpublic remove(index?: number) {\n\t\tif (index) {\n\t\t\tthis.states.splice(index, 1);\n\t\t} else {\n\t\t\tthis.states.pop();\n\t\t}\n\n\t\tthis.pointer--;\n\t\treturn this;\n\t}\n\n\t/** Replaces the states array with another states array, this is later used when going back and forward in page history */\n\tpublic replace(newStates: IState[]) {\n\t\tthis.states = newStates;\n\t\treturn this;\n\t}\n\n\t/** Set state by index. */\n\tpublic set(i: number, state: IState) {\n\t\treturn (this.states[i] = state);\n\t}\n\n\t/** Get the current state */\n\tget current(): IState {\n\t\treturn this.get(this.pointer);\n\t}\n\n\t/** Get the last state (top of the history stack). */\n\tget last(): IState {\n\t\treturn this.get(this.length - 1);\n\t}\n\n\t/** Get the previous state. */\n\tget previous(): IState | null {\n\t\treturn this.pointer < 1 ? null : this.get(this.pointer - 1);\n\t}\n\n\tget length() {\n\t\treturn this.states.length;\n\t}\n}\n\n/** Either push or replace history state */\nexport const changeState = (action: \"push\" | \"replace\", state: IState, item: object) => {\n\tlet href = getHashedPath(state.url);\n\tlet args = [item, \"\", href];\n\tif (window.history) {\n\t\tswitch (action) {\n\t\t\tcase \"push\":\n\t\t\t\twindow.history.pushState.apply(window.history, args);\n\t\t\t\tbreak;\n\t\t\tcase \"replace\":\n\t\t\t\twindow.history.replaceState.apply(window.history, args);\n\t\t\t\tbreak;\n\t\t}\n\t}\n};\n", "import { Manager, ManagerItem, AdvancedManager } from \"./manager\";\nimport { equal, newURL } from \"./url\";\nimport { getConfig } from \"./config\";\nimport { Service } from \"./service\";\n\nexport interface IPage extends ManagerItem {\n dom: Document,\n wrapper: HTMLElement,\n title: string,\n head: Element,\n body: Element,\n url: URL,\n data: string,\n wrapperAttr: string,\n\n build(): any,\n install(): void,\n uninstall(): any,\n}\n\n/**\n * Parses strings to DOM\n */\nexport const PARSER: DOMParser = new DOMParser();\n\n/** A page represents the DOM elements that create each page */\nexport class Page extends ManagerItem implements IPage {\n /** Holds the DOM of the current page */\n public dom: Document;\n\n /** Holds the wrapper element to be swapped out of each Page */\n public wrapper: HTMLElement;\n\n /** Holds the title of each page */\n public title: string;\n\n /** Holds the head element of each page */\n public head: Element;\n\n /** Holds the body element of each page */\n public body: Element;\n\n /** The URL of the current page */\n public url: URL;\n\n /** The payload of a page request */\n public data: string;\n\n /** Attr that identifies the wrapper */\n public wrapperAttr: string;\n\n constructor(url: URL = newURL(), dom: string | Document = document) {\n super();\n this.url = url;\n\n if (typeof dom === \"string\") {\n this.data = dom;\n } else this.dom = dom || document;\n }\n\n /** Builds the page's dom, and sets the title, head, body, and wrapper properties of the Page class */\n public build() {\n if (!(this.dom instanceof Node)) {\n this.dom = PARSER.parseFromString(this.data, \"text/html\");\n }\n\n if (!(this.body instanceof Node)) {\n let { title, head, body } = this.dom;\n this.title = title;\n this.head = head;\n this.body = body;\n this.wrapper = this.body.querySelector(this.wrapperAttr);\n }\n }\n\n public install() {\n this.wrapperAttr = getConfig(this.config, \"wrapperAttr\");\n }\n\n public uninstall() {\n this.url = undefined;\n this.title = undefined;\n this.head = undefined;\n this.body = undefined;\n this.dom = undefined;\n this.wrapper = undefined;\n this.data = undefined;\n this.wrapperAttr = undefined;\n }\n}\n\nexport interface IPageManager extends Service {\n loading: Manager>,\n pages: AdvancedManager;\n\n install(): any,\n\n get(key): Page,\n add(value): PageManager,\n set(key, value): PageManager,\n remove(key): PageManager,\n has(key): boolean,\n clear(): PageManager,\n size: number,\n keys(): any[],\n\n load(_url: URL | string): Promise,\n request(url: string): Promise,\n}\n\n/** Controls which page to load */\nexport class PageManager extends Service implements IPageManager {\n /** Stores all fetch requests that are currently loading */\n public loading: Manager> = new Manager();\n\n pages: AdvancedManager;\n\n /** Instantiate pages, and add the current page to pages */\n install() {\n this.pages = new AdvancedManager(this.app);\n\n let URLString = newURL().pathname;\n this.set(URLString, new Page());\n URLString = undefined;\n }\n\n get(key) { return this.pages.get(key); }\n add(value) { this.pages.add(value); return this; }\n set(key, value) { this.pages.set(key, value); return this; }\n remove(key) { this.pages.remove(key); return this; }\n has(key) { return this.pages.has(key); }\n clear() { this.pages.clear(); return this; }\n get size() { return this.pages.size; }\n keys() { return this.pages.keys(); }\n\n /** Load from cache or by requesting URL via a fetch request, avoid requesting for the same thing twice by storing the fetch request in \"this.loading\" */\n public async load(_url: URL | string = newURL()): Promise {\n let url: URL = newURL(_url);\n let urlString: string = url.pathname;\n let page: Page, request: Promise;\n\n if (this.has(urlString)) {\n page = this.get(urlString);\n return Promise.resolve(page);\n }\n\n if (!this.loading.has(urlString)) {\n request = this.request(urlString);\n this.loading.set(urlString, request);\n } else request = this.loading.get(urlString);\n\n let response = await request;\n this.loading.remove(urlString);\n\n page = new Page(url, response);\n this.set(urlString, page);\n\n if (this.size > getConfig(this.config, \"maxPages\")) {\n let currentUrl = newURL();\n let keys = this.keys();\n let first = equal(currentUrl, keys[0]) ? keys[1] : keys[0];\n let page = this.get(first);\n page.unregister();\n page = undefined;\n keys = undefined;\n currentUrl = undefined;\n first = undefined;\n }\n\n return page;\n }\n\n /** Starts a fetch request */\n public async request(url: string): Promise {\n const headers = new Headers(getConfig(this.config, \"headers\"));\n const timeout = window.setTimeout(() => {\n window.clearTimeout(timeout);\n throw \"Request Timed Out!\";\n }, getConfig(this.config, \"timeout\"));\n\n try {\n let response = await fetch(url, {\n mode: 'same-origin',\n method: \"GET\",\n headers,\n cache: \"default\",\n credentials: \"same-origin\",\n });\n\n window.clearTimeout(timeout);\n if (response.status >= 200 && response.status < 300) {\n return await response.text();\n }\n\n const err = new Error(response.statusText || \"\" + response.status);\n throw err;\n } catch (err) {\n window.clearTimeout(timeout);\n throw err;\n }\n }\n}\n", "import { Manager, methodCall } from \"@okikio/manager\";\n\nexport type ListenerCallback = ((...args: any) => void);\nexport interface IListener {\n readonly callback: ListenerCallback;\n readonly scope: object;\n readonly name: string;\n}\n\n/** Represents a new event listener consisting of properties like: callback, scope, name */\nexport const newListener = ({\n callback = () => { },\n scope = null,\n name = \"event\",\n}: IListener): IListener => ({ callback, scope, name });\n\n/** Represents a new event */\nexport class Event extends Manager {\n /** The name of the event */\n public name: string;\n constructor(name: string = \"event\") {\n super();\n this.name = name;\n }\n}\n\nexport type EventInput = string | object | Array;\n\n/**\n * An Event Emitter\n * */\nexport class EventEmitter extends Manager {\n constructor() {\n super();\n }\n\n /** Gets event, if event doesn't exist create a new one */\n public getEvent(name: string): Event {\n let event = this.get(name);\n if (!(event instanceof Event)) {\n this.set(name, new Event(name));\n return this.get(name);\n }\n\n return event;\n }\n\n /** Creates a listener and adds it to an event */\n public newListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event = this.getEvent(name);\n event.add(newListener({ name, callback, scope }));\n return event;\n }\n\n /** Adds a listener to a given event */\n public on(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n this.newListener(_name, _callback, _scope);\n }, this);\n return this;\n }\n\n /** Removes a listener from an event */\n public removeListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event: Event = this.get(name);\n if (event instanceof Event && callback) {\n let listener = newListener({ name, callback, scope });\n\n event.forEach((value: IListener, i: number) => {\n if (\n value.callback === listener.callback &&\n value.scope === listener.scope\n ) {\n return event.remove(i);\n }\n });\n }\n\n return event;\n }\n\n /** Remove a listener from a given event, or just completely remove an event */\n public off(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n if (typeof _callback === \"function\") {\n this.removeListener(_name, _callback, _scope);\n } else this.remove(_name);\n }, this);\n return this;\n }\n\n /** Call all listeners within an event */\n public emit(\n events: string | Array,\n ...args: any\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n // Loop through the list of events\n events.forEach((event: string) => {\n let _event: Event = this.get(event);\n\n if (_event instanceof Event) {\n _event.forEach((listener: IListener) => {\n let { callback, scope } = listener;\n callback.apply(scope, args);\n });\n }\n }, this);\n return this;\n }\n\n /** Clears events and event listeners */\n public clear() {\n methodCall(this, \"clear\");\n super.clear();\n return this;\n }\n}\n\nexport default EventEmitter;\n", "import { Manager } from \"./manager\";\nimport { ICoords, newCoords, Trigger } from \"./history\";\nimport { IPage } from \"./page\";\nimport { getConfig } from \"./config\";\nimport { Service } from \"./service\";\nimport { newURL } from \"./url\";\n\n/**\n * The async function type, allows for smooth transition between Promises\n */\nexport type asyncFn = (err?: any, value?: any) => void;\nexport interface ITransition {\n oldPage?: IPage;\n newPage?: IPage;\n trigger?: Trigger;\n scroll?: { x: number; y: number };\n scrollable?: boolean;\n in: (data: ITransitionData) => any;\n out: (data: ITransitionData) => any;\n [key: string]: any;\n}\nexport interface ITransitionData {\n from?: IPage;\n to?: IPage;\n trigger?: Trigger;\n scroll?: ICoords;\n done: asyncFn;\n}\nexport interface ITransitionManager extends Service {\n transitions: Manager,\n\n get(key: string): ITransition,\n set(key: string, value: ITransition): TransitionManager,\n add(value: ITransition): TransitionManager,\n has(key: string): boolean,\n\n boot(): any,\n animate(name: string, data: any): Promise,\n}\n\n/** Auto scrolls to an elements position if the element has an hash */\nexport const hashAction = (coords?: ICoords, hash: string = window.location.hash) => {\n try {\n let _hash = hash[0] == \"#\" ? hash : newURL(hash).hash;\n if (_hash.length > 1) {\n let el = document.getElementById(_hash.slice(1));\n if (el) {\n let { left, top } = el.getBoundingClientRect();\n let scrollLeft = window.pageXOffset;\n let scrollTop = window.pageYOffset;\n let x = left + scrollLeft;\n let y = top + scrollTop;\n\n console.log(x, y);\n return newCoords(x, y);\n }\n }\n } catch (e) {\n console.warn(\"[hashAction] error\", e);\n }\n\n return coords ?? newCoords(0, 0);\n};\n\n// The Default Transition\nconst Default: ITransition = {\n name: \"default\",\n scrollable: true,\n\n out({ done }: ITransitionData) {\n done();\n },\n in({ scroll, done }: ITransitionData) {\n window.scroll(scroll.x, scroll.y);\n done();\n }\n};\n\n/** Controls which Transition between pages to use */\nexport class TransitionManager extends Service implements ITransitionManager {\n transitions: Manager;\n private _arg: Array<[string, ITransition]>;\n constructor(transitions?: Array<[string, ITransition]>) {\n super();\n this._arg = transitions;\n }\n\n /** On Service install set Config */\n public install() {\n super.install();\n\n let transitions = this._arg && this._arg.length ? this._arg : (getConfig(this.config, \"transitions\") ?? []);\n\n // Manager like Maps use the most recent [key, value] Array it knows, replacing the default transition\n // With any other transitions called [\"default\", ...]\n transitions = [[\"default\", Default]].concat(transitions);\n this.transitions = new Manager(transitions);\n }\n\n get(key: string) { return this.transitions.get(key); }\n set(key: string, value: ITransition) { this.transitions.set(key, value); return this; }\n add(value: ITransition) { this.transitions.add(value); return this; }\n has(key: string) { return this.transitions.has(key); }\n\n /** Starts a transition */\n public async animate(name: string, data: any): Promise {\n let transition: ITransition = this.transitions.get(name);\n let scroll = data.scroll;\n let ignoreHashAction = data.ignoreHashAction;\n if (!(\"wrapper\" in data.oldPage) || !(\"wrapper\" in data.newPage))\n throw `[Page] either oldPage or newPage aren't instances of the Page Class.\\n ${{\n newPage: data.newPage,\n oldPage: data.oldPage,\n }}`;\n\n // Replace the title\n document.title = `` + data.newPage.title;\n\n let fromWrapper = data.oldPage.wrapper;\n let toWrapper = data.newPage.wrapper;\n\n if (!(fromWrapper instanceof Node) || !(toWrapper instanceof Node))\n throw `[Wrapper] the wrapper from the ${!(toWrapper instanceof Node) ? \"next\" : \"current\"\n } page cannot be found. The wrapper must be an element that has the attribute ${getConfig(this.config,\n \"wrapperAttr\"\n )}.`;\n\n // Give the Transition all the background data it may require\n transition.init && transition?.init(data);\n\n this.emitter.emit(\"BEFORE_TRANSITION_OUT\");\n\n // Start the out point of the Transition\n if (transition.out) {\n await new Promise((done) => {\n let outMethod: Promise = transition.out.call(transition, {\n ...data,\n from: data.oldPage,\n trigger: data.trigger,\n done,\n });\n\n outMethod?.then(done);\n });\n }\n\n this.emitter.emit(\"AFTER_TRANSITION_OUT\");\n\n // Add the new wrapper before the old one\n await new Promise((done) => {\n fromWrapper.insertAdjacentElement(\"beforebegin\", toWrapper);\n this.emitter.emit(\"CONTENT_INSERT\");\n\n if (!ignoreHashAction && !/back|popstate|forward/.test(data.trigger as string)) {\n scroll = hashAction(scroll);\n }\n done();\n });\n\n // Replace the old wrapper with the new one\n await new Promise((done) => {\n fromWrapper.remove();\n fromWrapper = undefined;\n toWrapper = undefined;\n this.emitter.emit(\"CONTENT_REPLACED\");\n done();\n });\n\n this.emitter.emit(\"BEFORE_TRANSITION_IN\");\n\n // Start the in point of the Transition (only the in method has access to the hashAction's scroll position)\n if (transition.in) {\n await new Promise(async (done) => {\n let inMethod: Promise = transition.in.call(transition, {\n ...data,\n from: data.oldPage,\n to: data.newPage,\n trigger: data.trigger,\n scroll,\n done,\n });\n\n inMethod?.then(done);\n });\n }\n\n this.emitter.emit(\"AFTER_TRANSITION_IN\");\n return transition;\n }\n}\n", "import { EventEmitter, ListenerCallback, EventInput } from \"./emitter\";\nimport { ServiceManager, Service } from \"./service\";\nimport { newConfig, ICONFIG } from \"./config\";\n\nexport interface IApp {\n services: ServiceManager,\n emitter: EventEmitter,\n config: ICONFIG,\n register(config: ICONFIG): App,\n get(key: string): Service,\n set(key: string, service: Service): App,\n add(value: Service): App,\n boot(): App,\n stop(): App,\n on(events: EventInput, callback?: ListenerCallback): App,\n off(events: EventInput, callback?: ListenerCallback): App,\n emit(events: string | any[], ...args: any): App,\n}\n\n/** The App class starts the entire process, it controls all managers and all services */\nexport class App implements IApp {\n /** An instance of the ServiceManager */\n public services: ServiceManager;\n\n /** An instance of an EventEmitter */\n public emitter: EventEmitter;\n\n /** The current Configuration's for the App */\n public config: ICONFIG;\n constructor(config: object = {}) {\n this.register(config);\n }\n\n /** Create new instances of the ServiceManager, EventEmitter and the configurations */\n public register(config: ICONFIG = {}): App {\n this.config = newConfig(config);\n this.emitter = new EventEmitter();\n this.services = new ServiceManager(this);\n\n let handler = (() => {\n document.removeEventListener(\"DOMContentLoaded\", handler);\n window.removeEventListener(\"load\", handler);\n this.emitter.emit(\"READY ready\");\n }).bind(this);\n\n document.addEventListener(\"DOMContentLoaded\", handler);\n window.addEventListener(\"load\", handler);\n return this;\n }\n\n /** Shortcuts to adding, setting, and getting Services */\n public get(key: string): Service {\n return this.services.get(key);\n }\n\n public set(key: string, value: Service): App {\n this.services.set(key, value);\n return this;\n }\n\n public add(value: Service): App {\n this.services.add(value);\n return this;\n }\n\n /** Initialize and boot all Services */\n public boot(): App {\n this.services.init();\n this.services.boot();\n return this;\n }\n\n /** Stops all Services and clears the even emitter of all events and listeners */\n public stop(): App {\n this.services.stop();\n this.emitter.clear();\n return this;\n }\n\n /** Shortcuts to the App EventEmitter on, off, and emit methods */\n public on(events: EventInput, callback?: ListenerCallback): App {\n this.emitter.on(events, callback, this);\n return this;\n }\n\n public off(events: EventInput, callback?: ListenerCallback): App {\n this.emitter.off(events, callback, this);\n return this;\n }\n\n public emit(events: string | any[], ...args: any): App {\n this.emitter.emit(events, ...args);\n return this;\n }\n}\n", "import { newState, Trigger, newCoords, IHistoryItem, IHistoryManager } from \"./history\";\nimport { Service } from \"./service\";\nimport { IPage, IPageManager } from \"./page\";\nimport { newURL, getHashedPath, equal } from \"./url\";\nimport { getConfig } from \"./config\";\nimport { hashAction, ITransitionManager } from \"./transition\";\n\nexport type LinkEvent = MouseEvent | TouchEvent;\nexport type StateEvent = LinkEvent | PopStateEvent;\nexport type IgnoreURLsList = Array;\n/**\n * Creates a barbajs like PJAX Service, for the native framework\n * Based on barbajs and StartingBlocks\n */\nexport class PJAX extends Service {\n /** URLs to ignore when prefetching */\n public ignoreURLs: IgnoreURLsList;\n\n /** Whether or not to disable prefetching */\n public prefetchIgnore: boolean;\n\n /** Current state of transitions */\n public isTransitioning: boolean;\n\n /** Ignore extra clicks of an anchor element if a transition has already started */\n public stopOnTransitioning: boolean;\n\n /** On page change (excluding popstate events) keep current scroll position */\n public stickyScroll: boolean;\n\n /** Force load a page if an error occurs */\n public forceOnError: boolean;\n\n /** Ignore hash action if set to true */\n public ignoreHashAction: boolean;\n\n public install() {\n super.install();\n\n this.ignoreURLs = getConfig(this.config, \"ignoreURLs\") ?? [];\n this.prefetchIgnore = getConfig(this.config, \"prefetchIgnore\") ?? false;\n this.stopOnTransitioning = getConfig(this.config, \"stopOnTransitioning\") ?? false;\n this.stickyScroll = getConfig(this.config, \"stickyScroll\") ?? false;\n this.forceOnError = getConfig(this.config, \"forceOnError\") ?? false;\n this.ignoreHashAction = getConfig(this.config, \"ignoreHashAction\") ?? false\n }\n\n /** Sets the transition state to either true or false */\n public transitionStart() {\n this.isTransitioning = true;\n }\n\n public transitionStop() {\n this.isTransitioning = false;\n }\n\n public init() {\n /**\n * Bind the event listeners to the PJAX class\n *\n * @memberof PJAX\n */\n this.onHover = this.onHover.bind(this);\n this.onClick = this.onClick.bind(this);\n this.onStateChange = this.onStateChange.bind(this);\n }\n\n /** Starts the PJAX Service */\n public boot() {\n if (\"scrollRestoration\" in window.history) {\n // Back off, browser, I got this...\n window.history.scrollRestoration = \"manual\";\n }\n\n super.boot();\n }\n\n /** Gets the transition to use for a certain anchor */\n public getTransitionName(el: HTMLAnchorElement): string | null {\n if (!el || !el.getAttribute) return null;\n let transitionAttr = el.getAttribute(\n getConfig(this.config, \"transitionAttr\", false)\n );\n\n if (typeof transitionAttr === \"string\") return transitionAttr;\n return null;\n }\n\n /** Checks to see if the anchor is valid */\n public validLink(\n el: HTMLAnchorElement,\n event: LinkEvent | KeyboardEvent,\n href: string\n ): boolean {\n let pushStateSupport = !window.history.pushState;\n let exists = !el || !href;\n let eventMutate =\n (event as KeyboardEvent).metaKey ||\n (event as KeyboardEvent).ctrlKey ||\n (event as KeyboardEvent).shiftKey ||\n (event as KeyboardEvent).altKey;\n let newTab =\n el.hasAttribute(\"target\") &&\n (el as HTMLAnchorElement).target === \"_blank\";\n let crossOrigin =\n (el as HTMLAnchorElement).protocol !== location.protocol ||\n (el as HTMLAnchorElement).hostname !== location.hostname;\n let download = typeof el.getAttribute(\"download\") === \"string\";\n let preventSelf = el.matches(getConfig(this.config, \"preventSelfAttr\"));\n let preventAll = Boolean(\n el.closest(getConfig(this.config, \"preventAllAttr\"))\n );\n let sameURL = getHashedPath(newURL()) === getHashedPath(newURL(href));\n return !(\n exists ||\n pushStateSupport ||\n eventMutate ||\n newTab ||\n crossOrigin ||\n download ||\n preventSelf ||\n preventAll ||\n sameURL\n );\n }\n\n /** Returns the href of an Anchor element */\n public getHref(el: HTMLAnchorElement): string | null {\n if (\n el &&\n el.tagName &&\n el.tagName.toLowerCase() === \"a\" &&\n typeof el.href === \"string\"\n )\n return el.href;\n return null;\n }\n\n /** Check if event target is a valid anchor with an href, if so, return the anchor */\n public getLink(event: LinkEvent): HTMLAnchorElement {\n let el = event.target as HTMLAnchorElement;\n let href: string = this.getHref(el);\n\n while (el && !href) {\n el = (el as HTMLElement).parentNode as HTMLAnchorElement;\n href = this.getHref(el);\n }\n\n // Check for a valid link\n if (!el || !this.validLink(el, event, href)) return;\n return el;\n }\n\n /** When an element is clicked, get valid anchor element, go for a transition */\n public onClick(event: LinkEvent) {\n let el = this.getLink(event);\n if (!el) return;\n\n if (this.isTransitioning && this.stopOnTransitioning) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n let href = this.getHref(el);\n this.emitter.emit(\"ANCHOR_CLICK CLICK\", event);\n this.go({ href, trigger: el, event });\n }\n\n /** Returns the direction of the State change as a String, either the Back button or the Forward button */\n public getDirection(value: number): Trigger {\n if (Math.abs(value) > 1) {\n // Ex 6-0 > 0 -> forward, 0-6 < 0 -> back\n return value > 0 ? \"forward\" : \"back\";\n } else {\n if (value === 0) {\n return \"popstate\";\n } else {\n // Ex 6-5 > 0 -> back, 5-6 < 0 -> forward\n return value > 0 ? \"back\" : \"forward\";\n }\n }\n }\n\n /** Force a page to go to a certain URL */\n public force(href: string): void {\n window.location.assign(href);\n }\n\n /**\n * If transition is running force load page.\n * Stop if currentURL is the same as new url.\n * On state change, change the current state history, to reflect the direction of said state change\n * Load page and page transition.\n */\n public go({\n href,\n trigger = \"HistoryManager\",\n event,\n }: {\n href: string;\n trigger?: Trigger;\n event?: StateEvent;\n }): Promise {\n // If transition is already running and the go method is called again, force load page\n if (this.isTransitioning && this.stopOnTransitioning ||\n !(this.manager.has(\"TransitionManager\") &&\n this.manager.has(\"HistoryManager\") &&\n this.manager.has(\"PageManager\"))) {\n this.force(href);\n return;\n }\n\n const history = this.manager.get(\"HistoryManager\") as IHistoryManager;\n let scroll = newCoords(0, 0);\n let currentState = history.current;\n let currentURL = currentState.url;\n if (equal(currentURL, href)) {\n return;\n }\n\n let transitionName: string;\n if (event && (event as PopStateEvent).state) {\n this.emitter.emit(\"POPSTATE\", event);\n\n // If popstate, get back/forward direction.\n let { state }: { state: IHistoryItem } = event as PopStateEvent;\n let { index } = state;\n let currentIndex = currentState.index;\n let difference = currentIndex - index;\n\n history.replace(state.states);\n history.pointer = index;\n\n let _state = history.get(index);\n transitionName = _state.transition;\n scroll = _state.data.scroll;\n\n trigger = this.getDirection(difference);\n console.log(trigger == \"forward\" && history)\n\n // Based on the direction of the state change either remove or add a state\n this.emitter.emit(trigger === \"back\" ? `POPSTATE_BACK` : `POPSTATE_FORWARD`, event);\n } else {\n // Add new state\n transitionName = this.getTransitionName(trigger as HTMLAnchorElement);\n\n scroll = newCoords();\n let state = newState({\n url: href,\n transition: transitionName,\n data: { scroll },\n });\n\n !this.stickyScroll && (scroll = newCoords(0, 0));\n\n history.add(state);\n this.emitter.emit(\"HISTORY_NEW_ITEM\", event);\n }\n\n if (event) {\n event.stopPropagation();\n event.preventDefault();\n }\n\n this.emitter.emit(\"GO\", event);\n return this.load({\n oldHref: currentURL,\n href,\n trigger,\n transitionName,\n scroll,\n });\n }\n\n /** Load the new Page as well as a Transition; starts the Transition */\n public async load({\n oldHref,\n href,\n trigger,\n transitionName = \"default\",\n scroll = { x: 0, y: 0 },\n }: {\n oldHref: string;\n href: string;\n trigger: Trigger;\n transitionName?: string;\n scroll: { x: number; y: number };\n }): Promise {\n try {\n const pages = this.manager.get(\"PageManager\") as IPageManager;\n let newPage: IPage, oldPage: IPage;\n this.emitter.emit(\"NAVIGATION_START\", {\n oldHref,\n href,\n trigger,\n transitionName,\n });\n\n // Load & Build both the old and new pages\n try {\n this.transitionStart();\n oldPage = await pages.load(oldHref);\n !(oldPage.dom instanceof Element) && oldPage.build();\n\n this.emitter.emit(\"PAGE_LOADING\", { href, oldPage, trigger });\n newPage = await pages.load(href);\n await newPage.build();\n this.emitter.emit(\"PAGE_LOAD_COMPLETE\", {\n newPage,\n oldPage,\n trigger,\n });\n } catch (err) {\n console.warn(`[PJAX] Page load error: ${err}`);\n }\n\n // Transition Between Pages\n try {\n const TransitionManager = this.manager.get(\"TransitionManager\") as ITransitionManager;\n this.emitter.emit(\"TRANSITION_START\", transitionName);\n\n let transition = await TransitionManager.animate(TransitionManager.has(transitionName) ? transitionName : \"default\", {\n oldPage,\n newPage,\n trigger,\n scroll,\n ignoreHashAction: this.ignoreHashAction\n });\n\n if (!transition.scrollable) {\n if (!this.ignoreHashAction && !/back|popstate|forward/.test(trigger as string)) scroll = hashAction(scroll);\n window.scroll(scroll.x, scroll.y);\n }\n\n this.emitter.emit(\"TRANSITION_END\", { transition });\n } catch (err) {\n console.warn(`[PJAX] Transition error: ${err}`);\n }\n\n // Navigation is over\n this.emitter.emit(\"NAVIGATION_END\", {\n oldPage,\n newPage,\n trigger,\n transitionName,\n });\n } catch (err) {\n if (this.forceOnError) this.force(href);\n else console.warn(err);\n } finally {\n this.transitionStop(); // Sets isTransitioning to false\n }\n }\n\n /** Check to see if the URL is to be ignored, uses either RegExp of Strings to check */\n public ignoredURL({ pathname }: URL): boolean {\n return (\n this.ignoreURLs.length &&\n this.ignoreURLs.some((url) => {\n return typeof url === \"string\"\n ? url === pathname\n : (url as RegExp).exec(pathname) !== null;\n })\n );\n }\n\n /** When you hover over an anchor, prefetch the event target's href */\n public onHover(event: LinkEvent): Promise {\n let el = this.getLink(event);\n if (!el || !this.manager.has(\"PageManager\")) return;\n\n const pages = this.manager.get(\"PageManager\") as IPageManager;\n let url = newURL(this.getHref(el));\n let urlString: string = url.pathname;\n\n // If Url is ignored or already in cache, don't do any think\n if (this.ignoredURL(url) || pages.has(urlString)) return;\n this.emitter.emit(\"ANCHOR_HOVER HOVER\", event);\n\n try {\n pages.load(url);\n } catch (err) {\n console.warn(\"[PJAX] prefetch error,\", err);\n }\n }\n\n /** When History state changes, get url from State, go for a Transition. */\n public onStateChange(event: PopStateEvent): void {\n this.go({ href: window.location.href, trigger: \"popstate\", event });\n }\n\n /** Initialize DOM Events */\n public initEvents() {\n if (this.prefetchIgnore !== true) {\n document.addEventListener(\"mouseover\", this.onHover);\n document.addEventListener(\"touchstart\", this.onHover);\n }\n\n document.addEventListener(\"click\", this.onClick);\n window.addEventListener(\"popstate\", this.onStateChange);\n }\n\n /** Stop DOM Events */\n public stopEvents() {\n if (this.prefetchIgnore !== true) {\n document.removeEventListener(\"mouseover\", this.onHover);\n document.removeEventListener(\"touchstart\", this.onHover);\n }\n\n document.removeEventListener(\"click\", this.onClick);\n window.removeEventListener(\"popstate\", this.onStateChange);\n }\n}\n", "import { Service } from \"./service\";\nimport { Manager } from \"./manager\";\nimport { newURL, getHashedPath } from \"./url\";\nimport { IHistoryManager } from \"./history\";\n\nexport type RouteMethod = (...args: any) => any;\nexport type RouteStyle = string | RegExp | boolean;\nexport interface IRouteToFrom {\n to: RouteStyle,\n from: RouteStyle\n}\nexport type RoutePath = IRouteToFrom | RouteStyle;\nexport interface IRoute {\n path: RoutePath,\n method: RouteMethod\n}\n\n/** Controls what happens when certain url paths match a set of criteria */\nexport class Router extends Service {\n /** List of routes */\n protected routes: Manager;\n constructor(routes: IRoute[] = []) {\n super();\n this.routes = new Manager();\n for (let route of routes) {\n this.add(route);\n }\n }\n\n /** Add a new route to watch for */\n public add({ path, method }: IRoute): Router {\n let key = this.parse(path);\n this.routes.set(key, method);\n return this;\n }\n\n /** Convert strings into path match functions */\n public parsePath(path: RouteStyle): RegExp | boolean {\n if (typeof path === \"string\") return new RegExp(path, \"i\");\n else if (path instanceof RegExp || typeof path === \"boolean\")\n return path;\n throw \"[Router] only regular expressions, strings and booleans are accepted as paths.\";\n }\n\n /** Determines if a strings counts has a path */\n public isPath(input: RouteStyle): boolean {\n return (\n typeof input === \"string\" ||\n input instanceof RegExp ||\n typeof input === \"boolean\"\n );\n }\n\n /** Parse the multiple different formats for paths, into a { from, to } object */\n public parse(input: RoutePath): IRouteToFrom {\n let route = input as IRouteToFrom;\n let toFromPath: IRouteToFrom = {\n from: /(.*)/g,\n to: /(.*)/g,\n };\n\n if (this.isPath(input as RouteStyle))\n toFromPath = {\n from: true,\n to: input as RouteStyle,\n };\n else if (this.isPath(route.from) && this.isPath(route.to as RouteStyle))\n toFromPath = route;\n else\n throw \"[Router] path is neither a string, regular expression, or a { from, to } object.\";\n\n let { from, to } = toFromPath;\n return {\n from: this.parsePath(from),\n to: this.parsePath(to),\n };\n }\n\n /** Test if route paths are true, if so run their methods */\n public route() {\n if (this.manager.has(\"HistoryManager\")) {\n let history = this.manager.get(\"HistoryManager\") as IHistoryManager;\n let from: string = getHashedPath(newURL((history.length > 1 ? history.previous : history.current).url));\n let to: string = getHashedPath(newURL());\n\n this.routes.forEach((method: RouteMethod, path: IRouteToFrom) => {\n let fromRegExp = path.from as RegExp | boolean;\n let toRegExp = path.to as RegExp | boolean;\n\n if (\n typeof fromRegExp === \"boolean\" &&\n typeof toRegExp === \"boolean\"\n ) {\n throw `[Router] path ({ from: ${fromRegExp}, to: ${toRegExp} }) is not valid, remember paths can only be strings, regular expressions, or a boolean; however, both the from and to paths cannot be both booleans.`;\n }\n\n let fromParam: RegExpExecArray | RegExp | boolean = fromRegExp;\n let toParam: RegExpExecArray | RegExp | boolean = toRegExp;\n\n if (fromRegExp instanceof RegExp && fromRegExp.test(from))\n fromParam = fromRegExp.exec(from);\n if (toRegExp instanceof RegExp && toRegExp.test(to))\n toParam = toRegExp.exec(to);\n\n if (\n (Array.isArray(toParam) && Array.isArray(fromParam)) ||\n (Array.isArray(toParam) &&\n typeof fromParam == \"boolean\" &&\n fromParam) ||\n (Array.isArray(fromParam) &&\n typeof toParam == \"boolean\" &&\n toParam)\n )\n method({ from: fromParam, to: toParam, path: { from, to } });\n });\n } else {\n console.warn(\"[Route] HistoryManager is missing.\");\n }\n }\n\n /** Add listeners for PJAX Events */\n public initEvents() {\n this.emitter.on(\"READY\", this.route, this);\n this.emitter.on(\"CONTENT_REPLACED\", this.route, this);\n }\n\n /** Remove listeners for PJAX Events */\n public stopEvents() {\n this.emitter.off(\"READY\", this.route, this);\n this.emitter.off(\"CONTENT_REPLACED\", this.route, this);\n }\n}\n", "import { EventEmitter, EventInput, ListenerCallback } from \"@okikio/emitter\";\nimport { Manager } from \"@okikio/manager\";\n\n// DOM\nexport type AnimationTarget = string | Node | NodeList | HTMLCollection | HTMLElement[] | AnimationTarget[];\nexport const getElements = (selector: string | Node): Node[] => {\n return typeof selector === \"string\" ? Array.from(document.querySelectorAll(selector as string)) : [selector];\n};\n\nconst flatten = (arr: AnimationTarget[]) => [].concat(...arr);\nexport const getTargets = (targets: AnimationTarget): Node[] => {\n if (Array.isArray(targets)) {\n return flatten((targets as AnimationTarget[]).map(getTargets));\n }\n if (typeof targets == \"string\" || targets instanceof Node)\n return getElements(targets);\n if (targets instanceof NodeList || targets instanceof HTMLCollection)\n return Array.from(targets);\n return [];\n};\n\n// VALUES\nexport type closureArgs = [number, number, HTMLElement];\nexport type closure = ((index?: number, total?: number, element?: HTMLElement) => (genericTypes[] | void)) | any;\nexport const computeValue = (value: closure, args: closureArgs, context: Animate) => {\n if (typeof value === \"function\") {\n return value.apply(context, args);\n } else { return value; }\n};\n\nexport const mapObject = (obj: object, args: closureArgs, options: Animate): any => {\n let key: string, value: any, result = {};\n let keys = Object.keys(obj);\n for (let i = 0, len = keys.length; i < len; i++) {\n key = keys[i];\n value = obj[key];\n result[key] = computeValue(value, args, options);\n }\n\n return result;\n};\n\n/** From: [https://easings.net] */\nexport const easings = {\n \"in\": \"ease-in\",\n \"out\": \"ease-out\",\n \"in-out\": \"ease-in-out\",\n\n // Sine\n \"in-sine\": \"cubic-bezier(0.47, 0, 0.745, 0.715)\",\n \"out-sine\": \"cubic-bezier(0.39, 0.575, 0.565, 1)\",\n \"in-out-sine\": \"cubic-bezier(0.445, 0.05, 0.55, 0.95)\",\n\n // Quad\n \"in-quad\": \"cubic-bezier(0.55, 0.085, 0.68, 0.53)\",\n \"out-quad\": \"cubic-bezier(0.25, 0.46, 0.45, 0.94)\",\n \"in-out-quad\": \"cubic-bezier(0.455, 0.03, 0.515, 0.955)\",\n\n // Cubic\n \"in-cubic\": \"cubic-bezier(0.55, 0.055, 0.675, 0.19)\",\n \"out-cubic\": \"cubic-bezier(0.215, 0.61, 0.355, 1)\",\n \"in-out-cubic\": \"cubic-bezier(0.645, 0.045, 0.355, 1)\",\n\n // Quart\n \"in-quart\": \"cubic-bezier(0.895, 0.03, 0.685, 0.22)\",\n \"out-quart\": \"cubic-bezier(0.165, 0.84, 0.44, 1)\",\n \"in-out-quart\": \"cubic-bezier(0.77, 0, 0.175, 1)\",\n\n // Quint\n \"in-quint\": \"cubic-bezier(0.755, 0.05, 0.855, 0.06)\",\n \"out-quint\": \"cubic-bezier(0.23, 1, 0.32, 1)\",\n \"in-out-quint\": \"cubic-bezier(0.86, 0, 0.07, 1)\",\n\n // Expo\n \"in-expo\": \"cubic-bezier(0.95, 0.05, 0.795, 0.035)\",\n \"out-expo\": \"cubic-bezier(0.19, 1, 0.22, 1)\",\n \"in-out-expo\": \"cubic-bezier(1, 0, 0, 1)\",\n\n // Circ\n \"in-circ\": \"cubic-bezier(0.6, 0.04, 0.98, 0.335)\",\n \"out-circ\": \"cubic-bezier(0.075, 0.82, 0.165, 1)\",\n \"in-out-circ\": \"cubic-bezier(0.785, 0.135, 0.15, 0.86)\",\n\n // Back\n \"in-back\": \"cubic-bezier(0.6, -0.28, 0.735, 0.045)\",\n \"out-back\": \"cubic-bezier(0.175, 0.885, 0.32, 1.275)\",\n \"in-out-back\": \"cubic-bezier(0.68, -0.55, 0.265, 1.55)\"\n};\n\nexport const getEase = (ease: string) => {\n return /^(in|out)/.test(ease) ? easings[ease] : ease;\n};\n\nexport type genericTypes = genericTypes[] | boolean | object | string | number | closure | null | undefined;\nexport interface AnimationOptions {\n target?: AnimationTarget,\n\n speed?: number,\n autoplay?: boolean,\n options?: AnimationOptions,\n delay?: number | closure,\n easing?: string | closure,\n endDelay?: number | closure,\n duration?: number | closure,\n keyframes?: Keyframe[] | object[] | closure,\n loop?: number | boolean | closure, // iterations: number,\n onfinish?: (element?: HTMLElement, index?: number, total?: number, animation?: Animation) => any,\n fillMode?: \"none\" | \"forwards\" | \"backwards\" | \"both\" | \"auto\" | closure,\n direction?: \"normal\" | \"reverse\" | \"alternate\" | \"alternate-reverse\" | closure,\n extend?: EffectTiming,\n [property: string]: genericTypes;\n};\n\nexport const DefaultAnimationOptions: AnimationOptions = {\n keyframes: [],\n\n loop: 1, // iterations: number,\n delay: 0,\n speed: 1,\n endDelay: 0,\n easing: \"ease\",\n autoplay: true,\n duration: 1000,\n fillMode: \"auto\",\n direction: \"normal\",\n extend: {}\n};\n\nexport type AnimationEvents = \"update\" | \"play\" | \"pause\" | \"start\" | \"begin\" | \"complete\" | \"finish\" | \"error\" | \"stop\";\n\n/** You can check it out here: https://codepen.io/okikio/pen/qBbdGaW?editors=0011 */\nexport class Animate {\n /**\n * Stores the options for the current animation\n */\n public options: AnimationOptions = {};\n\n /**\n * The Array of Elements to Animate\n */\n public targets: Node[] = [];\n\n /**\n * The properties to animate\n */\n public properties: object = {};\n\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n\n /**\n * The total duration of all Animation's\n */\n public totalDuration: number = 0;\n\n /**\n * The smallest delay out of all Animation's\n */\n public minDelay: number = 0;\n\n /**\n * The options for individual animations\n */\n public computedOptions: Manager = new Manager();\n\n /**\n * The Element the main animation uses\n */\n public mainElement: HTMLElement;\n\n /**\n * Stores an animation that runs on the total duration of the all other Animations, and as such it's the main Animation\n */\n public mainAnimation: Animation;\n\n /**\n * Stores request frame calls\n */\n public animationFrame: number;\n\n /**\n * An event emitter\n */\n public emitter: EventEmitter = new EventEmitter();\n\n /**\n * Returns a promise that is fulfilled when the mainAnimation is finished\n */\n public promise: Promise;\n constructor(options: AnimationOptions = {}) {\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n\n /**\n * Returns a new Promise that is resolve when this.finish is called\n */\n public newPromise(): Promise {\n return new Promise((resolve, reject) => {\n /*\n Note that the `this` keyword is in an Array when it is resolved,\n this is due to Promises not wanting to resolve references,\n so, you can't resolve `this` directly, so, I chose to resolve `this` in an\n Array\n */\n this.on(\"complete\", () => resolve([this]));\n this.on(\"error\", err => reject(err));\n });\n }\n\n /**\n * Fulfills the this.promise Promise\n */\n public then(\n onFulfilled?: (value?: any) => any,\n onRejected?: (reason?: any) => any\n ): Animate {\n onFulfilled = onFulfilled?.bind(this);\n onRejected = onRejected?.bind(this);\n this.promise.then(onFulfilled, onRejected);\n return this;\n }\n\n /**\n * Catches error that occur in the this.promise Promise\n */\n public catch(onRejected: (reason?: any) => any): Animate {\n onRejected = onRejected?.bind(this);\n this.promise.catch(onRejected);\n return this;\n }\n\n /**\n * If you don't care if the this.promise Promise has either been rejected or resolved\n */\n public finally(onFinally: () => any): Animate {\n onFinally = onFinally?.bind(this);\n this.promise.finally(onFinally);\n return this;\n }\n\n /**\n * Represents an Animation Frame Loop\n */\n public loop(): void {\n this.stopLoop();\n this.emit(\"update\", this.getProgress(), this);\n this.animationFrame = window.requestAnimationFrame(this.loop);\n }\n\n /**\n * Cancels animation frame\n */\n public stopLoop() {\n window.cancelAnimationFrame(this.animationFrame);\n }\n\n /**\n * Calls a method that affects all animations including the mainAnimation; the method only allows the animation parameter\n */\n public all(method: (animation?: Animation, target?: HTMLElement) => void) {\n method(this.mainAnimation, this.mainElement);\n this.animations.forEach(method);\n return this;\n }\n\n /**\n * Register the begin event\n */\n protected beginEvent() {\n if (this.getProgress() == 0) {\n let timer: number | void = window.setTimeout(() => {\n this.emit(\"begin\", this);\n timer = window.clearTimeout(timer as number);\n }, this.minDelay);\n }\n }\n\n /**\n * Play Animation\n */\n public play(): Animate {\n let playstate = this.getPlayState();\n this.beginEvent();\n this.all(anim => anim.play());\n this.emit(\"play\", playstate, this);\n this.loop();\n return this;\n }\n\n /**\n * Pause Animation\n */\n public pause(): Animate {\n let playstate = this.getPlayState();\n this.all(anim => anim.pause());\n this.emit(\"pause\", playstate, this);\n this.stopLoop();\n this.animationFrame = undefined;\n return this;\n }\n\n /**\n * Reset all Animations\n */\n public reset() {\n this.setProgress(0);\n this.beginEvent();\n\n if (this.options.autoplay) this.play();\n else this.pause();\n return this;\n }\n\n /**\n * Cancels all Animations\n */\n public cancel() {\n this.all(anim => anim.cancel());\n this.stopLoop();\n return this;\n }\n\n /**\n * Force complete all Animations\n */\n public finish() {\n this.all(anim => anim.finish());\n this.stopLoop();\n return this;\n }\n\n /**\n * Cancels & Clears all Animations\n */\n public stop() {\n this.cancel();\n this.animations.clear();\n while (this.targets.length) this.targets.pop();\n this.mainElement = undefined;\n this.emit(\"stop\");\n }\n\n /**\n * Returns an Array of targets\n */\n public getTargets(): Node[] {\n return this.targets;\n }\n\n /**\n * Get a specific Animation from an Animate instance\n */\n public getAnimation(element: HTMLElement): Animation {\n return this.animations.get(element);\n }\n\n /**\n * Returns the timings of an Animation, given a target\n * E.g. { duration, endDelay, delay, iterations, iterationStart, direction, easing, fill, etc... }\n */\n public getTiming(target: HTMLElement | Animation): AnimationOptions & EffectTiming {\n let animation = target instanceof Animation ? target : this.getAnimation(target);\n let keyframeOptions = this.computedOptions.get(animation) ?? {};\n let timings = animation.effect?.getTiming() ?? {};\n let options = this.getOptions();\n\n return { ...DefaultAnimationOptions, ...options, ...timings, ...keyframeOptions };\n }\n\n /**\n * Returns the total duration of Animation\n */\n public getTotalDuration(): number {\n return this.totalDuration;\n }\n\n /**\n * Returns the current time of the Main Animation\n */\n public getCurrentTime(): number {\n return this.mainAnimation.currentTime;\n }\n\n /**\n * Returns the Animation progress as a fraction of the current time / duration * 100\n */\n public getProgress() {\n return (this.getCurrentTime() / this.totalDuration) * 100;\n }\n\n /**\n * Return the playback speed of the animation\n */\n public getSpeed(): number {\n return this.mainAnimation.playbackRate;\n }\n\n /**\n * Returns the current playing state\n */\n public getPlayState(): \"idle\" | \"running\" | \"paused\" | \"finished\" {\n return this.mainAnimation.playState;\n }\n\n /**\n * Get the options of an Animate instance\n */\n public getOptions(): AnimationOptions {\n return this.options;\n }\n\n /**\n * Set the current time of the Main Animation\n */\n public setCurrentTime(time: number): Animate {\n this.all(anim => { anim.currentTime = time; });\n this.emit(\"update\", this.getProgress());\n return this;\n }\n\n /**\n * Set the Animation progress as a value from 0 to 100\n */\n public setProgress(percent: number): Animate {\n let time = (percent / 100) * this.totalDuration;\n this.setCurrentTime(time);\n return this;\n }\n\n /**\n * Set the playback speed of an Animation\n */\n public setSpeed(speed: number = 1): Animate {\n this.all(anim => { anim.playbackRate = speed; });\n return this;\n }\n\n /**\n * Adds a listener for a given event\n */\n public on(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.on(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Removes a listener from an event\n */\n public off(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.off(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Call all listeners within an event\n */\n public emit(events: AnimationEvents | string | any[], ...args: any): Animate {\n this.emitter.emit(events, ...args);\n return this;\n }\n\n\n /** Returns the Animate options, as JSON */\n public toJSON(): AnimationOptions {\n return this.getOptions();\n }\n\n /**\n * The Symbol.toStringTag well-known symbol is a string valued property that is used\n * in the creation of the default string description of an object.\n * It is accessed internally by the Object.prototype.toString() method.\n */\n get [Symbol.toStringTag]() {\n return `Animate`;\n }\n}\n\n/** Creates a new Animate instance */\nexport const animate = (options: AnimationOptions = {}): Animate => {\n return new Animate(options);\n};\n\nexport class Timeline extends Animate {\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n constructor(options: AnimationOptions = {}) {\n super();\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n public add(options: AnimationOptions) {\n return this;\n }\n}\n\nexport default animate;"], - "mappings": "AAeO,GAAM,GAAkB,CAC3B,YAAa,UACb,eAAgB,eAChB,eAAgB,cAChB,QAAS,CACL,CAAC,YAAa,SAElB,gBAAiB,iBACjB,eAAgB,gBAChB,eAAgB,aAChB,UAAW,QACX,QAAS,IACT,SAAU,GAID,EAAY,AAAC,GACf,OAAO,OAAO,IAAK,GAAmB,GAIpC,GAAS,CAAC,EAAiB,EAAe,EAAoB,KAAiB,CACxF,GAAI,CAAE,UAAW,EACb,EAAO,OAAO,EAAS,IAAM,EAAS,MAAM,IAChD,MAAO,GAAW,IAAI,KAAU,GAIvB,EAAY,CAAC,EAAiB,EAAoB,EAAoB,KAAc,CAC7F,GAAI,MAAO,IAAU,SACjB,MAAO,GAEX,GAAI,GAAO,EAAO,GAClB,MAAI,OAAO,IAAS,SACT,GAAO,EAAQ,EAAM,GACzB,GCjDJ,WAAoB,CAG1B,YAAY,EAAuB,CAClC,KAAK,IAAM,GAAI,KAAI,GAIb,QAAoB,CAC1B,MAAO,MAAK,IAIN,IAAI,EAAW,CACrB,MAAO,MAAK,IAAI,IAAI,GAId,MAAiB,CACvB,MAAO,OAAM,KAAK,KAAK,IAAI,QAIrB,QAAmB,CACzB,MAAO,OAAM,KAAK,KAAK,IAAI,UAIrB,IAAI,EAAQ,EAAyB,CAC3C,YAAK,IAAI,IAAI,EAAK,GACX,KAID,IAAI,EAAyB,CAGnC,GAAI,GAFO,KAAK,KAGhB,YAAK,IAAI,EAAK,GACP,QAIG,OAAe,CACzB,MAAO,MAAK,IAAI,QAIN,SAAiB,CAC3B,MAAO,MAAK,IAAI,KAIV,KAAK,EAAmB,EAAkB,CAChD,GAAI,GAAM,KAAK,OAAO,KAAK,KAAO,GAClC,MAAO,MAAK,IAAI,GAIV,OAAO,EAAiB,CAC9B,MAAO,MAAK,IAAI,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KAAK,OACd,KAAK,QAEV,KAAK,QAAU,KAAK,aACpB,KAAK,cAAc,SAAW,IAAM,CAChC,KAAK,KAAK,WAAY,MACtB,KAAK,kBAEJ,EAAP,CACE,KAAK,KAAK,QAAS,IAGpB,IAAI,EAA2B,CAClC,MAAO", + "sourcesContent": ["export interface ICONFIG {\n prefix?: string;\n wrapperAttr?: string;\n noAjaxLinkAttr?: string;\n noPrefetchAttr?: \"no-prefetch\";\n headers?: string[][];\n preventSelfAttr?: string;\n preventAllAttr?: string;\n transitionAttr?: string;\n blockAttr?: string;\n timeout?: number;\n maxPages?: number;\n resizeDelay?: number;\n [key: string]: any;\n}\n\nexport const CONFIG_DEFAULTS: ICONFIG = {\n wrapperAttr: \"wrapper\",\n noAjaxLinkAttr: \"no-ajax-link\",\n noPrefetchAttr: \"no-prefetch\",\n headers: [\n [\"x-partial\", \"true\"]\n ],\n preventSelfAttr: `prevent=\"self\"`,\n preventAllAttr: `prevent=\"all\"`,\n transitionAttr: \"transition\",\n blockAttr: `block`,\n timeout: 30000,\n maxPages: 5,\n resizeDelay: 100\n};\n\nexport type ConfigKeys = keyof typeof CONFIG_DEFAULTS | string;\nexport const newConfig = (config: ICONFIG): ICONFIG => {\n return Object.assign({ ...CONFIG_DEFAULTS }, config);\n};\n\n/** Converts string into properly formatted data attributes */\nexport const toAttr = (config: ICONFIG, value: string, brackets: boolean = true): string => {\n let { prefix } = config;\n let attr = `data${prefix ? \"-\" + prefix : \"\"}-${value}`;\n return brackets ? `[${attr}]` : attr;\n};\n\n/** Selects config vars, and formats them for use, or simply returns the current configurations for the framework */\nexport const getConfig = (config: ICONFIG, value?: ConfigKeys, brackets: boolean = true): any => {\n if (typeof value !== \"string\")\n return config;\n\n let prop = config[value];\n if (typeof prop === \"string\")\n return toAttr(config, prop, brackets);\n return prop;\n};\n", "/** Manages complex lists of named data, eg. A page can be stored in a list by of other pages with the url being how the page is stored in the list. Managers use Maps to store data */\nexport class Manager {\n\t/** The complex list of named data, to which the Manager controls */\n\tpublic map: Map;\n\tconstructor(value?: Array<[K, V]>) {\n\t\tthis.map = new Map(value);\n\t}\n\n\t/** Returns the Manager classes base Map */\n\tpublic getMap(): Map {\n\t\treturn this.map;\n\t}\n\n\t/** Get a value stored in the Manager */\n\tpublic get(key: K): V {\n\t\treturn this.map.get(key);\n\t}\n\n\t/** Returns the keys of all items stored in the Manager as an Array */\n\tpublic keys(): Array {\n\t\treturn Array.from(this.map.keys());\n\t}\n\n\t/** Returns the values of all items stored in the Manager as an Array */\n\tpublic values(): Array {\n\t\treturn Array.from(this.map.values());\n\t}\n\n\t/** Set a value to the Manager using a key */\n\tpublic set(key: K, value: V): Manager {\n\t\tthis.map.set(key, value);\n\t\treturn this;\n\t}\n\n\t/** Adds a value to Manager, and uses the current size of the Manager as it's key, it works best when all the key in the Manager are numbers */\n\tpublic add(value: V): Manager {\n\t\tlet size = this.size;\n\t\t// @ts-ignore\n\t\tlet num: K = size as K;\n\t\tthis.set(num, value);\n\t\treturn this;\n\t}\n\n\t/** Returns the total number of items stored in the Manager */\n\tpublic get size(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** An alias for size */\n\tpublic get length(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** Returns the last item in the Manager who's index is a certain distance from the last item in the Manager */\n\tpublic last(distance: number = 1): V | undefined {\n\t\tlet key = this.keys()[this.size - distance];\n\t\treturn this.get(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns true if an element in the Map object existed and has been removed, or false if the element does not exist */\n\tpublic delete(key: K): boolean {\n\t\treturn this.map.delete(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns the Manager class, allowing for chains */\n\tpublic remove(key: K): Manager {\n\t\tthis.map.delete(key);\n\t\treturn this;\n\t}\n\n\t/** Clear the Manager of all its contents */\n\tpublic clear(): Manager {\n\t\tthis.map.clear();\n\t\treturn this;\n\t}\n\n\t/** Checks if the Manager contains a certain key */\n\tpublic has(key: K): boolean {\n\t\treturn this.map.has(key);\n\t}\n\n\t/** Returns a new Iterator object that contains an array of [key, value] for each element in the Map object in insertion order. */\n\tpublic entries(): IterableIterator<[K, V]> {\n\t\treturn this.map.entries();\n\t}\n\n\t/** Iterates through the Managers contents, calling a callback function every iteration */\n\tpublic forEach(\n\t\tcallback: (value?: V, key?: K, map?: Map) => void,\n\t\tcontext?: object\n\t): Manager {\n\t\tthis.map.forEach(callback, context);\n\t\treturn this;\n\t}\n\n\t/** Allows for iteration via for..of, learn more: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators] */\n\tpublic [Symbol.iterator](): IterableIterator<[K, V]> {\n\t\treturn this.entries();\n\t}\n}\n\n/**\n * Calls the method of a certain name for all items that are currently installed\n */\nexport const methodCall = (manager: Manager, method: string, ...args: any): void => {\n\tmanager.forEach((item) => {\n\t\t// @ts-ignore\n\t\titem[method](...args);\n\t});\n};\n\n/**\n * Asynchronously calls the method of a certain name for all items that are currently installed, similar to methodCall\n */\nexport const asyncMethodCall = async (manager: Manager, method: string, ...args: any): Promise => {\n\tfor (let [, item] of manager) {\n\t\t// @ts-ignore\n\t\tawait item[method](...args);\n\t}\n};\n\nexport default Manager;\n", "import { Manager, methodCall, asyncMethodCall } from \"@okikio/manager\";\nimport { ICONFIG } from \"./config\";\nimport { IApp } from \"./app\";\nimport { EventEmitter } from \"./emitter\";\n\nexport type IAdvancedManager = AdvancedManager;\n\n/** The base class for AdvancedManager items */\nexport class ManagerItem {\n /** The AdvancedManager the ManagerItem is attached to */\n public manager: IAdvancedManager;\n\n /** The App the ManagerItem is attached to */\n public app: IApp;\n\n /** The Config of the App the ManagerItem is attached to */\n public config: ICONFIG;\n\n /** The EventEmitter of the App the ManagerItem is attached to */\n public emitter: EventEmitter;\n\n /** The key to where ManagerItem is stored in an AdvancedManager */\n public key: any;\n\n constructor() { }\n\n /** Run after the Manager Item has been registered */\n public install(): any { }\n\n /** Register the current Manager Item's manager */\n public register(manager: IAdvancedManager, key: any): ManagerItem {\n this.manager = manager;\n this.app = manager.app;\n this.config = manager.config;\n this.emitter = manager.emitter;\n this.key = key;\n this.install();\n return this;\n }\n\n /** Run before the ManagerItem has been unregistered */\n public uninstall(): any { }\n\n /** Basically removes a ManagerItem, in order to recover the ManagerItem, it needs to be re-added to an AdvancedManager */\n public unregister() {\n this.uninstall();\n\n this.manager.remove(this.key);\n this.key = undefined;\n this.manager = undefined;\n this.app = undefined;\n this.config = undefined;\n this.emitter = undefined;\n }\n}\n\n/** A tweak to the Manager class that makes it self aware of the App class it's instantiated in */\nexport class AdvancedManager extends Manager {\n /** The App the AdvancedManager is attached to */\n public app: IApp;\n\n /** The Config of the App the AdvancedManager is attached to */\n public config: ICONFIG;\n\n /** The EventEmitter of the App the AdvancedManager is attached to */\n public emitter: EventEmitter;\n\n /** Register App details */\n constructor(app: IApp) {\n super();\n this.app = app;\n this.config = app.config;\n this.emitter = app.emitter;\n }\n\n /** Add a ManagerItem to AdvancedManager at a specified key */\n public set(key: K, value: V) {\n super.set(key, value);\n value.register(this, key);\n return this;\n }\n}\n\nexport { Manager, methodCall, asyncMethodCall };\n", "export const newURL = (url: string | URL | Location = window.location.href): URL => {\n return url instanceof URL ? url : new URL(url as unknown as string, window.location.origin);\n};\n\n/** Returns the pathname with the hash at the end */\nexport const getHashedPath = (url: URL | string): string => {\n let _url = newURL(url);\n return `${_url.pathname}${_url.hash}`;\n};\n\n/** Returns the actual hash without the hashtag */\nexport const getHash = (url: URL | string): string => newURL(url).hash.slice(1);\n\n/** Removes the hash from the full URL for a clean URL string */\nexport const clean = (url: URL | string): string => newURL(url).toString().replace(/(\\/#.*|\\/|#.*)$/, '');\n\n/** Compares two URLs to each other */\nexport const equal = (a: URL | string, b: URL | string): boolean => (clean(a) === clean(b));\n\n", "import { AdvancedManager, ManagerItem, methodCall } from \"./manager\";\nimport { IApp } from \"./app\";\n\n/** Controls specific kinds of actions that require JS */\nexport class Service extends ManagerItem {\n\t/** Called before the start of a Service, represents a constructor of sorts */\n\tpublic init(...args: any): any;\n\tpublic init(): any { }\n\n\t/** Called on start of Service */\n\tpublic boot(...args: any): any;\n\tpublic boot(): any {\n\t\tthis.initEvents();\n\t}\n\n\t/** Initialize events */\n\tpublic initEvents(): void { }\n\n\t/** Stop events */\n\tpublic stopEvents(): void { }\n\n\t/** Stop services */\n\tpublic stop(): void {\n\t\tthis.stopEvents();\n\t\tthis.unregister();\n\t}\n}\n\n/** The Service Manager controls the lifecycle of all Services in an App */\nexport class ServiceManager extends AdvancedManager {\n\tconstructor(app: IApp) {\n\t\tsuper(app);\n\t}\n\n\t/** Call the init method for all Services */\n\tpublic init(): ServiceManager {\n\t\tmethodCall(this, \"init\");\n\t\treturn this;\n\t}\n\n\t/** Call the boot method for all Services */\n\tpublic boot(): ServiceManager {\n\t\tmethodCall(this, \"boot\");\n\t\treturn this;\n\t}\n\n\t/** Call the stop method for all Services */\n\tpublic stop(): ServiceManager {\n\t\tmethodCall(this, \"stop\");\n\t\treturn this;\n\t}\n}\n", "import { Service } from \"./service\";\nimport { getHashedPath, newURL } from \"./url\";\n\nexport type Trigger = HTMLAnchorElement | \"HistoryManager\" | \"popstate\" | \"back\" | \"forward\";\nexport interface ICoords {\n\treadonly x: number;\n\treadonly y: number;\n}\n\nexport interface IStateData {\n\tscroll: ICoords;\n\t[key: string]: any;\n}\n\nexport interface IState {\n\turl: string;\n\tindex?: number;\n\ttransition: string;\n\tdata: IStateData;\n}\n\nexport interface IHistoryItem {\n\tindex: number;\n\tstates: IState[];\n}\n\nexport interface IHistoryManager extends Service {\n\tstates: IState[],\n\tpointer: number,\n\n\tinit(): any,\n\tget(index: number): IState,\n\tadd(value?: IState, historyAction?: \"replace\" | \"push\"): HistoryManager,\n\tremove(index?: number): HistoryManager,\n\treplace(newStates: IState[]): HistoryManager,\n\tset(i: number, state: IState): IState,\n\tcurrent: IState,\n\tlast: IState,\n\tprevious: IState | null,\n\tlength: number,\n}\n\n/** A quick snapshot of page scroll coordinates */\nexport const newCoords = (x: number = window.scrollX, y: number = window.scrollY): ICoords => ({ x, y });\n\n/** Creates a state; a state represents the current status of the page consisting of properties like: url, transition, and data */\nexport const newState = (state: IState = {\n\turl: getHashedPath(newURL()),\n\tindex: 0,\n\ttransition: \"default\",\n\tdata: {\n\t\tscroll: newCoords(),\n\t\ttrigger: \"HistoryManager\"\n\t}\n}): IState => (state);\n\n/** Keeps a record of the history of the App; it stores only the states of Pages */\nexport class HistoryManager extends Service implements IHistoryManager {\n\tpublic states: IState[];\n\tpublic pointer = -1;\n\n\t/** Initializes the states array, and replace the history pushState data with the states array */\n\tinit() {\n\t\tthis.states = [];\n\n\t\tlet state = newState();\n\t\tthis.add(state, \"replace\");\n\t}\n\n\t/** Get a state based on it's index */\n\tpublic get(index: number) {\n\t\treturn this.states[index];\n\t}\n\n\t/** Add a state to HistoryManager and change the history pushState data based on the historyAction specified */\n\tpublic add(value?: IState, historyAction: \"replace\" | \"push\" = \"push\"): HistoryManager {\n\t\tlet state = newState(value);\n\t\tlet len = this.length;\n\t\tthis.states.push({ ...state });\n\t\tthis.pointer = len;\n\n\t\tlet item: IHistoryItem = {\n\t\t\tindex: this.pointer,\n\t\t\tstates: [...this.states]\n\t\t};\n\t\tchangeState(historyAction, state, item);\n\t\treturn this;\n\t}\n\n\tpublic remove(index?: number) {\n\t\tif (index) {\n\t\t\tthis.states.splice(index, 1);\n\t\t} else {\n\t\t\tthis.states.pop();\n\t\t}\n\n\t\tthis.pointer--;\n\t\treturn this;\n\t}\n\n\t/** Replaces the states array with another states array, this is later used when going back and forward in page history */\n\tpublic replace(newStates: IState[]) {\n\t\tthis.states = newStates;\n\t\treturn this;\n\t}\n\n\t/** Set state by index. */\n\tpublic set(i: number, state: IState) {\n\t\treturn (this.states[i] = state);\n\t}\n\n\t/** Get the current state */\n\tget current(): IState {\n\t\treturn this.get(this.pointer);\n\t}\n\n\t/** Get the last state (top of the history stack). */\n\tget last(): IState {\n\t\treturn this.get(this.length - 1);\n\t}\n\n\t/** Get the previous state. */\n\tget previous(): IState | null {\n\t\treturn this.pointer < 1 ? null : this.get(this.pointer - 1);\n\t}\n\n\tget length() {\n\t\treturn this.states.length;\n\t}\n}\n\n/** Either push or replace history state */\nexport const changeState = (action: \"push\" | \"replace\", state: IState, item: object) => {\n\tlet href = getHashedPath(state.url);\n\tlet args = [item, \"\", href];\n\tif (window.history) {\n\t\tswitch (action) {\n\t\t\tcase \"push\":\n\t\t\t\twindow.history.pushState.apply(window.history, args);\n\t\t\t\tbreak;\n\t\t\tcase \"replace\":\n\t\t\t\twindow.history.replaceState.apply(window.history, args);\n\t\t\t\tbreak;\n\t\t}\n\t}\n};\n", "import { Manager, ManagerItem, AdvancedManager } from \"./manager\";\nimport { equal, newURL } from \"./url\";\nimport { getConfig } from \"./config\";\nimport { Service } from \"./service\";\n\nexport interface IPage extends ManagerItem {\n dom: Document,\n wrapper: HTMLElement,\n title: string,\n head: Element,\n body: Element,\n url: URL,\n data: string,\n wrapperAttr: string,\n\n build(): any,\n install(): void,\n uninstall(): any,\n}\n\n/**\n * Parses strings to DOM\n */\nexport const PARSER: DOMParser = new DOMParser();\n\n/** A page represents the DOM elements that create each page */\nexport class Page extends ManagerItem implements IPage {\n /** Holds the DOM of the current page */\n public dom: Document;\n\n /** Holds the wrapper element to be swapped out of each Page */\n public wrapper: HTMLElement;\n\n /** Holds the title of each page */\n public title: string;\n\n /** Holds the head element of each page */\n public head: Element;\n\n /** Holds the body element of each page */\n public body: Element;\n\n /** The URL of the current page */\n public url: URL;\n\n /** The payload of a page request */\n public data: string;\n\n /** Attr that identifies the wrapper */\n public wrapperAttr: string;\n\n constructor(url: URL = newURL(), dom: string | Document = document) {\n super();\n this.url = url;\n\n if (typeof dom === \"string\") {\n this.data = dom;\n } else this.dom = dom || document;\n }\n\n /** Builds the page's dom, and sets the title, head, body, and wrapper properties of the Page class */\n public build() {\n if (!(this.dom instanceof Node)) {\n this.dom = PARSER.parseFromString(this.data, \"text/html\");\n }\n\n if (!(this.body instanceof Node)) {\n let { title, head, body } = this.dom;\n this.title = title;\n this.head = head;\n this.body = body;\n this.wrapper = this.body.querySelector(this.wrapperAttr);\n }\n }\n\n public install() {\n this.wrapperAttr = getConfig(this.config, \"wrapperAttr\");\n }\n\n public uninstall() {\n this.url = undefined;\n this.title = undefined;\n this.head = undefined;\n this.body = undefined;\n this.dom = undefined;\n this.wrapper = undefined;\n this.data = undefined;\n this.wrapperAttr = undefined;\n }\n}\n\nexport interface IPageManager extends Service {\n loading: Manager>,\n pages: AdvancedManager;\n\n install(): any,\n\n get(key): Page,\n add(value): PageManager,\n set(key, value): PageManager,\n remove(key): PageManager,\n has(key): boolean,\n clear(): PageManager,\n size: number,\n keys(): any[],\n\n load(_url: URL | string): Promise,\n request(url: string): Promise,\n}\n\n/** Controls which page to load */\nexport class PageManager extends Service implements IPageManager {\n /** Stores all fetch requests that are currently loading */\n public loading: Manager> = new Manager();\n\n pages: AdvancedManager;\n\n /** Instantiate pages, and add the current page to pages */\n install() {\n this.pages = new AdvancedManager(this.app);\n\n let URLString = newURL().pathname;\n this.set(URLString, new Page());\n URLString = undefined;\n }\n\n get(key) { return this.pages.get(key); }\n add(value) { this.pages.add(value); return this; }\n set(key, value) { this.pages.set(key, value); return this; }\n remove(key) { this.pages.remove(key); return this; }\n has(key) { return this.pages.has(key); }\n clear() { this.pages.clear(); return this; }\n get size() { return this.pages.size; }\n keys() { return this.pages.keys(); }\n\n /** Load from cache or by requesting URL via a fetch request, avoid requesting for the same thing twice by storing the fetch request in \"this.loading\" */\n public async load(_url: URL | string = newURL()): Promise {\n let url: URL = newURL(_url);\n let urlString: string = url.pathname;\n let page: Page, request: Promise;\n\n if (this.has(urlString)) {\n page = this.get(urlString);\n return Promise.resolve(page);\n }\n\n if (!this.loading.has(urlString)) {\n request = this.request(urlString);\n this.loading.set(urlString, request);\n } else request = this.loading.get(urlString);\n\n let response = await request;\n this.loading.remove(urlString);\n\n page = new Page(url, response);\n this.set(urlString, page);\n\n if (this.size > getConfig(this.config, \"maxPages\")) {\n let currentUrl = newURL();\n let keys = this.keys();\n let first = equal(currentUrl, keys[0]) ? keys[1] : keys[0];\n let page = this.get(first);\n page.unregister();\n page = undefined;\n keys = undefined;\n currentUrl = undefined;\n first = undefined;\n }\n\n return page;\n }\n\n /** Starts a fetch request */\n public async request(url: string): Promise {\n const headers = new Headers(getConfig(this.config, \"headers\"));\n const timeout = window.setTimeout(() => {\n window.clearTimeout(timeout);\n throw \"Request Timed Out!\";\n }, getConfig(this.config, \"timeout\"));\n\n try {\n let response = await fetch(url, {\n mode: 'same-origin',\n method: \"GET\",\n headers,\n cache: \"default\",\n credentials: \"same-origin\",\n });\n\n window.clearTimeout(timeout);\n if (response.status >= 200 && response.status < 300) {\n return await response.text();\n }\n\n const err = new Error(response.statusText || \"\" + response.status);\n throw err;\n } catch (err) {\n window.clearTimeout(timeout);\n throw err;\n }\n }\n}\n", "import { Manager, methodCall } from \"@okikio/manager\";\n\nexport type ListenerCallback = ((...args: any) => void);\nexport interface IListener {\n readonly callback: ListenerCallback;\n readonly scope: object;\n readonly name: string;\n}\n\n/** Represents a new event listener consisting of properties like: callback, scope, name */\nexport const newListener = ({\n callback = () => { },\n scope = null,\n name = \"event\",\n}: IListener): IListener => ({ callback, scope, name });\n\n/** Represents a new event */\nexport class Event extends Manager {\n /** The name of the event */\n public name: string;\n constructor(name: string = \"event\") {\n super();\n this.name = name;\n }\n}\n\nexport type EventInput = string | object | Array;\n\n/**\n * An Event Emitter\n * */\nexport class EventEmitter extends Manager {\n constructor() {\n super();\n }\n\n /** Gets event, if event doesn't exist create a new one */\n public getEvent(name: string): Event {\n let event = this.get(name);\n if (!(event instanceof Event)) {\n this.set(name, new Event(name));\n return this.get(name);\n }\n\n return event;\n }\n\n /** Creates a listener and adds it to an event */\n public newListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event = this.getEvent(name);\n event.add(newListener({ name, callback, scope }));\n return event;\n }\n\n /** Adds a listener to a given event */\n public on(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n this.newListener(_name, _callback, _scope);\n }, this);\n return this;\n }\n\n /** Removes a listener from an event */\n public removeListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event: Event = this.get(name);\n if (event instanceof Event && callback) {\n let listener = newListener({ name, callback, scope });\n\n event.forEach((value: IListener, i: number) => {\n if (\n value.callback === listener.callback &&\n value.scope === listener.scope\n ) {\n return event.remove(i);\n }\n });\n }\n\n return event;\n }\n\n /** Remove a listener from a given event, or just completely remove an event */\n public off(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n if (typeof _callback === \"function\") {\n this.removeListener(_name, _callback, _scope);\n } else this.remove(_name);\n }, this);\n return this;\n }\n\n /** Call all listeners within an event */\n public emit(\n events: string | Array,\n ...args: any\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n // Loop through the list of events\n events.forEach((event: string) => {\n let _event: Event = this.get(event);\n\n if (_event instanceof Event) {\n _event.forEach((listener: IListener) => {\n let { callback, scope } = listener;\n callback.apply(scope, args);\n });\n }\n }, this);\n return this;\n }\n\n /** Clears events and event listeners */\n public clear() {\n methodCall(this, \"clear\");\n super.clear();\n return this;\n }\n}\n\nexport default EventEmitter;\n", "import { Manager } from \"./manager\";\nimport { ICoords, newCoords, Trigger } from \"./history\";\nimport { IPage } from \"./page\";\nimport { getConfig } from \"./config\";\nimport { Service } from \"./service\";\nimport { newURL } from \"./url\";\n\n/**\n * The async function type, allows for smooth transition between Promises\n */\nexport type asyncFn = (err?: any, value?: any) => void;\nexport interface ITransition {\n oldPage?: IPage;\n newPage?: IPage;\n trigger?: Trigger;\n scroll?: { x: number; y: number };\n scrollable?: boolean;\n in: (data: ITransitionData) => any;\n out: (data: ITransitionData) => any;\n [key: string]: any;\n}\nexport interface ITransitionData {\n from?: IPage;\n to?: IPage;\n trigger?: Trigger;\n scroll?: ICoords;\n done: asyncFn;\n}\nexport interface ITransitionManager extends Service {\n transitions: Manager,\n\n get(key: string): ITransition,\n set(key: string, value: ITransition): TransitionManager,\n add(value: ITransition): TransitionManager,\n has(key: string): boolean,\n\n boot(): any,\n animate(name: string, data: any): Promise,\n}\n\n/** Auto scrolls to an elements position if the element has an hash */\nexport const hashAction = (coords?: ICoords, hash: string = window.location.hash) => {\n try {\n let _hash = hash[0] == \"#\" ? hash : newURL(hash).hash;\n if (_hash.length > 1) {\n let el = document.getElementById(_hash.slice(1));\n if (el) {\n let { left, top } = el.getBoundingClientRect();\n let scrollLeft = window.pageXOffset;\n let scrollTop = window.pageYOffset;\n let x = left + scrollLeft;\n let y = top + scrollTop;\n\n console.log(x, y);\n return newCoords(x, y);\n }\n }\n } catch (e) {\n console.warn(\"[hashAction] error\", e);\n }\n\n return coords ?? newCoords(0, 0);\n};\n\n// The Default Transition\nconst Default: ITransition = {\n name: \"default\",\n scrollable: true,\n\n out({ done }: ITransitionData) {\n done();\n },\n in({ scroll, done }: ITransitionData) {\n window.scroll(scroll.x, scroll.y);\n done();\n }\n};\n\n/** Controls which Transition between pages to use */\nexport class TransitionManager extends Service implements ITransitionManager {\n transitions: Manager;\n private _arg: Array<[string, ITransition]>;\n constructor(transitions?: Array<[string, ITransition]>) {\n super();\n this._arg = transitions;\n }\n\n /** On Service install set Config */\n public install() {\n super.install();\n\n let transitions = this._arg && this._arg.length ? this._arg : (getConfig(this.config, \"transitions\") ?? []);\n\n // Manager like Maps use the most recent [key, value] Array it knows, replacing the default transition\n // With any other transitions called [\"default\", ...]\n transitions = [[\"default\", Default]].concat(transitions);\n this.transitions = new Manager(transitions);\n }\n\n get(key: string) { return this.transitions.get(key); }\n set(key: string, value: ITransition) { this.transitions.set(key, value); return this; }\n add(value: ITransition) { this.transitions.add(value); return this; }\n has(key: string) { return this.transitions.has(key); }\n\n /** Starts a transition */\n public async animate(name: string, data: any): Promise {\n let transition: ITransition = this.transitions.get(name);\n let scroll = data.scroll;\n let ignoreHashAction = data.ignoreHashAction;\n if (!(\"wrapper\" in data.oldPage) || !(\"wrapper\" in data.newPage))\n throw `[Page] either oldPage or newPage aren't instances of the Page Class.\\n ${{\n newPage: data.newPage,\n oldPage: data.oldPage,\n }}`;\n\n // Replace the title\n document.title = `` + data.newPage.title;\n\n let fromWrapper = data.oldPage.wrapper;\n let toWrapper = data.newPage.wrapper;\n\n if (!(fromWrapper instanceof Node) || !(toWrapper instanceof Node))\n throw `[Wrapper] the wrapper from the ${!(toWrapper instanceof Node) ? \"next\" : \"current\"\n } page cannot be found. The wrapper must be an element that has the attribute ${getConfig(this.config,\n \"wrapperAttr\"\n )}.`;\n\n // Give the Transition all the background data it may require\n transition.init && transition?.init(data);\n\n this.emitter.emit(\"BEFORE_TRANSITION_OUT\");\n\n // Start the out point of the Transition\n if (transition.out) {\n await new Promise((done) => {\n let outMethod: Promise = transition.out.call(transition, {\n ...data,\n from: data.oldPage,\n trigger: data.trigger,\n done,\n });\n\n outMethod?.then(done);\n });\n }\n\n this.emitter.emit(\"AFTER_TRANSITION_OUT\");\n\n // Add the new wrapper before the old one\n await new Promise((done) => {\n fromWrapper.insertAdjacentElement(\"beforebegin\", toWrapper);\n this.emitter.emit(\"CONTENT_INSERT\");\n\n if (!ignoreHashAction && !/back|popstate|forward/.test(data.trigger as string)) {\n scroll = hashAction(scroll);\n }\n done();\n });\n\n // Replace the old wrapper with the new one\n await new Promise((done) => {\n fromWrapper.remove();\n fromWrapper = undefined;\n toWrapper = undefined;\n this.emitter.emit(\"CONTENT_REPLACED\");\n done();\n });\n\n this.emitter.emit(\"BEFORE_TRANSITION_IN\");\n\n // Start the in point of the Transition (only the in method has access to the hashAction's scroll position)\n if (transition.in) {\n await new Promise(async (done) => {\n let inMethod: Promise = transition.in.call(transition, {\n ...data,\n from: data.oldPage,\n to: data.newPage,\n trigger: data.trigger,\n scroll,\n done,\n });\n\n inMethod?.then(done);\n });\n }\n\n this.emitter.emit(\"AFTER_TRANSITION_IN\");\n return transition;\n }\n}\n", "import { EventEmitter, ListenerCallback, EventInput } from \"./emitter\";\nimport { ServiceManager, Service } from \"./service\";\nimport { newConfig, ICONFIG, getConfig } from \"./config\";\n\nexport interface IApp {\n services: ServiceManager,\n emitter: EventEmitter,\n config: ICONFIG,\n register(config: ICONFIG): App,\n get(key: string): Service,\n set(key: string, service: Service): App,\n add(value: Service): App,\n boot(): App,\n stop(): App,\n on(events: EventInput, callback?: ListenerCallback): App,\n off(events: EventInput, callback?: ListenerCallback): App,\n emit(events: string | any[], ...args: any): App,\n}\n\n/** The App class starts the entire process, it controls all managers and all services */\nexport class App implements IApp {\n /** An instance of the ServiceManager */\n public services: ServiceManager;\n\n /** An instance of an EventEmitter */\n public emitter: EventEmitter;\n\n /** The current Configuration's for the App */\n public config: ICONFIG;\n\n private canResize = true;\n private canScroll = true;\n constructor(config: object = {}) {\n this._resize = this._resize.bind(this);\n this._scroll = this._scroll.bind(this);\n this._ready = this._ready.bind(this);\n this.register(config);\n }\n\n /** Create new instances of the ServiceManager, EventEmitter and the configurations */\n public register(config: ICONFIG = {}): App {\n this.config = newConfig(config);\n this.emitter = new EventEmitter();\n this.services = new ServiceManager(this);\n\n document.addEventListener(\"DOMContentLoaded\", this._ready);\n window.addEventListener(\"load\", this._ready);\n window.addEventListener(\"resize\", this._resize, { passive: true });\n window.addEventListener(\"scroll\", this._scroll, { passive: true });\n return this;\n }\n\n private _ready() {\n document.removeEventListener(\"DOMContentLoaded\", this._ready);\n window.removeEventListener(\"load\", this._ready);\n this.emitter.emit(\"READY ready\");\n }\n\n private _resize() {\n if (this.canResize) {\n let timer: number | void, raf: number | void;\n this.canResize = false;\n raf = window.requestAnimationFrame(() => {\n this.emitter.emit(\"RESIZE resize\");\n\n // set a timeout to un-throttle\n timer = window.setTimeout(() => {\n this.canResize = true;\n timer = window.clearTimeout(timer as number);\n raf = window.cancelAnimationFrame(raf as number);\n }, getConfig(this.config, \"resizeDelay\"));\n });\n }\n }\n\n private _scroll() {\n if (this.canScroll) {\n let raf: number | void;\n this.canScroll = false;\n raf = requestAnimationFrame(() => {\n this.emitter.emit(\"SCROLL scroll\");\n\n this.canScroll = true;\n raf = window.cancelAnimationFrame(raf as number);\n });\n }\n }\n\n /** Shortcuts to adding, setting, and getting Services */\n public get(key: string): Service {\n return this.services.get(key);\n }\n\n public set(key: string, value: Service): App {\n this.services.set(key, value);\n return this;\n }\n\n public add(value: Service): App {\n this.services.add(value);\n return this;\n }\n\n /** Initialize and boot all Services */\n public boot(): App {\n this.services.init();\n this.services.boot();\n return this;\n }\n\n /** Stops all Services and clears the even emitter of all events and listeners */\n public stop(): App {\n this.services.stop();\n this.emitter.clear();\n return this;\n }\n\n /** Shortcuts to the App EventEmitter on, off, and emit methods */\n public on(events: EventInput, callback?: ListenerCallback): App {\n this.emitter.on(events, callback, this);\n return this;\n }\n\n public off(events: EventInput, callback?: ListenerCallback): App {\n this.emitter.off(events, callback, this);\n return this;\n }\n\n public emit(events: string | any[], ...args: any): App {\n this.emitter.emit(events, ...args);\n return this;\n }\n}\n", "import { newState, Trigger, newCoords, IHistoryItem, IHistoryManager } from \"./history\";\nimport { Service } from \"./service\";\nimport { IPage, IPageManager } from \"./page\";\nimport { newURL, getHashedPath, equal } from \"./url\";\nimport { getConfig } from \"./config\";\nimport { hashAction, ITransitionManager } from \"./transition\";\n\nexport type LinkEvent = MouseEvent | TouchEvent;\nexport type StateEvent = LinkEvent | PopStateEvent;\nexport type IgnoreURLsList = Array;\n/**\n * Creates a barbajs like PJAX Service, for the native framework\n * Based on barbajs and StartingBlocks\n */\nexport class PJAX extends Service {\n /** URLs to ignore when prefetching */\n public ignoreURLs: IgnoreURLsList;\n\n /** Whether or not to disable prefetching */\n public prefetchIgnore: boolean;\n\n /** Current state of transitions */\n public isTransitioning: boolean;\n\n /** Ignore extra clicks of an anchor element if a transition has already started */\n public stopOnTransitioning: boolean;\n\n /** On page change (excluding popstate events) keep current scroll position */\n public stickyScroll: boolean;\n\n /** Force load a page if an error occurs */\n public forceOnError: boolean;\n\n /** Ignore hash action if set to true */\n public ignoreHashAction: boolean;\n\n public install() {\n super.install();\n\n this.ignoreURLs = getConfig(this.config, \"ignoreURLs\") ?? [];\n this.prefetchIgnore = getConfig(this.config, \"prefetchIgnore\") ?? false;\n this.stopOnTransitioning = getConfig(this.config, \"stopOnTransitioning\") ?? false;\n this.stickyScroll = getConfig(this.config, \"stickyScroll\") ?? false;\n this.forceOnError = getConfig(this.config, \"forceOnError\") ?? false;\n this.ignoreHashAction = getConfig(this.config, \"ignoreHashAction\") ?? false\n }\n\n /** Sets the transition state to either true or false */\n public transitionStart() {\n this.isTransitioning = true;\n }\n\n public transitionStop() {\n this.isTransitioning = false;\n }\n\n public init() {\n /**\n * Bind the event listeners to the PJAX class\n *\n * @memberof PJAX\n */\n this.onHover = this.onHover.bind(this);\n this.onClick = this.onClick.bind(this);\n this.onStateChange = this.onStateChange.bind(this);\n }\n\n /** Starts the PJAX Service */\n public boot() {\n if (\"scrollRestoration\" in window.history) {\n // Back off, browser, I got this...\n window.history.scrollRestoration = \"manual\";\n }\n\n super.boot();\n }\n\n /** Gets the transition to use for a certain anchor */\n public getTransitionName(el: HTMLAnchorElement): string | null {\n if (!el || !el.getAttribute) return null;\n let transitionAttr = el.getAttribute(\n getConfig(this.config, \"transitionAttr\", false)\n );\n\n if (typeof transitionAttr === \"string\") return transitionAttr;\n return null;\n }\n\n /** Checks to see if the anchor is valid */\n public validLink(\n el: HTMLAnchorElement,\n event: LinkEvent | KeyboardEvent,\n href: string\n ): boolean {\n let pushStateSupport = !window.history.pushState;\n let exists = !el || !href;\n let eventMutate =\n (event as KeyboardEvent).metaKey ||\n (event as KeyboardEvent).ctrlKey ||\n (event as KeyboardEvent).shiftKey ||\n (event as KeyboardEvent).altKey;\n let newTab =\n el.hasAttribute(\"target\") &&\n (el as HTMLAnchorElement).target === \"_blank\";\n let crossOrigin =\n (el as HTMLAnchorElement).protocol !== location.protocol ||\n (el as HTMLAnchorElement).hostname !== location.hostname;\n let download = typeof el.getAttribute(\"download\") === \"string\";\n let preventSelf = el.matches(getConfig(this.config, \"preventSelfAttr\"));\n let preventAll = Boolean(\n el.closest(getConfig(this.config, \"preventAllAttr\"))\n );\n let sameURL = getHashedPath(newURL()) === getHashedPath(newURL(href));\n return !(\n exists ||\n pushStateSupport ||\n eventMutate ||\n newTab ||\n crossOrigin ||\n download ||\n preventSelf ||\n preventAll ||\n sameURL\n );\n }\n\n /** Returns the href of an Anchor element */\n public getHref(el: HTMLAnchorElement): string | null {\n if (\n el &&\n el.tagName &&\n el.tagName.toLowerCase() === \"a\" &&\n typeof el.href === \"string\"\n )\n return el.href;\n return null;\n }\n\n /** Check if event target is a valid anchor with an href, if so, return the anchor */\n public getLink(event: LinkEvent): HTMLAnchorElement {\n let el = event.target as HTMLAnchorElement;\n let href: string = this.getHref(el);\n\n while (el && !href) {\n el = (el as HTMLElement).parentNode as HTMLAnchorElement;\n href = this.getHref(el);\n }\n\n // Check for a valid link\n if (!el || !this.validLink(el, event, href)) return;\n return el;\n }\n\n /** When an element is clicked, get valid anchor element, go for a transition */\n public onClick(event: LinkEvent) {\n let el = this.getLink(event);\n if (!el) return;\n\n if (this.isTransitioning && this.stopOnTransitioning) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n let href = this.getHref(el);\n this.emitter.emit(\"ANCHOR_CLICK CLICK\", event);\n this.go({ href, trigger: el, event });\n }\n\n /** Returns the direction of the State change as a String, either the Back button or the Forward button */\n public getDirection(value: number): Trigger {\n if (Math.abs(value) > 1) {\n // Ex 6-0 > 0 -> forward, 0-6 < 0 -> back\n return value > 0 ? \"forward\" : \"back\";\n } else {\n if (value === 0) {\n return \"popstate\";\n } else {\n // Ex 6-5 > 0 -> back, 5-6 < 0 -> forward\n return value > 0 ? \"back\" : \"forward\";\n }\n }\n }\n\n /** Force a page to go to a certain URL */\n public force(href: string): void {\n window.location.assign(href);\n }\n\n /**\n * If transition is running force load page.\n * Stop if currentURL is the same as new url.\n * On state change, change the current state history, to reflect the direction of said state change\n * Load page and page transition.\n */\n public go({\n href,\n trigger = \"HistoryManager\",\n event,\n }: {\n href: string;\n trigger?: Trigger;\n event?: StateEvent;\n }): Promise {\n // If transition is already running and the go method is called again, force load page\n if (this.isTransitioning && this.stopOnTransitioning ||\n !(this.manager.has(\"TransitionManager\") &&\n this.manager.has(\"HistoryManager\") &&\n this.manager.has(\"PageManager\"))) {\n this.force(href);\n return;\n }\n\n const history = this.manager.get(\"HistoryManager\") as IHistoryManager;\n let scroll = newCoords(0, 0);\n let currentState = history.current;\n let currentURL = currentState.url;\n if (equal(currentURL, href)) {\n return;\n }\n\n let transitionName: string;\n if (event && (event as PopStateEvent).state) {\n this.emitter.emit(\"POPSTATE\", event);\n\n // If popstate, get back/forward direction.\n let { state }: { state: IHistoryItem } = event as PopStateEvent;\n let { index } = state;\n let currentIndex = currentState.index;\n let difference = currentIndex - index;\n\n history.replace(state.states);\n history.pointer = index;\n\n let _state = history.get(index);\n transitionName = _state.transition;\n scroll = _state.data.scroll;\n\n trigger = this.getDirection(difference);\n console.log(trigger == \"forward\" && history)\n\n // Based on the direction of the state change either remove or add a state\n this.emitter.emit(trigger === \"back\" ? `POPSTATE_BACK` : `POPSTATE_FORWARD`, event);\n } else {\n // Add new state\n transitionName = this.getTransitionName(trigger as HTMLAnchorElement);\n\n scroll = newCoords();\n let state = newState({\n url: href,\n transition: transitionName,\n data: { scroll },\n });\n\n !this.stickyScroll && (scroll = newCoords(0, 0));\n\n history.add(state);\n this.emitter.emit(\"HISTORY_NEW_ITEM\", event);\n }\n\n if (event) {\n event.stopPropagation();\n event.preventDefault();\n }\n\n this.emitter.emit(\"GO\", event);\n return this.load({\n oldHref: currentURL,\n href,\n trigger,\n transitionName,\n scroll,\n });\n }\n\n /** Load the new Page as well as a Transition; starts the Transition */\n public async load({\n oldHref,\n href,\n trigger,\n transitionName = \"default\",\n scroll = { x: 0, y: 0 },\n }: {\n oldHref: string;\n href: string;\n trigger: Trigger;\n transitionName?: string;\n scroll: { x: number; y: number };\n }): Promise {\n try {\n const pages = this.manager.get(\"PageManager\") as IPageManager;\n let newPage: IPage, oldPage: IPage;\n this.emitter.emit(\"NAVIGATION_START\", {\n oldHref,\n href,\n trigger,\n transitionName,\n });\n\n // Load & Build both the old and new pages\n try {\n this.transitionStart();\n oldPage = await pages.load(oldHref);\n !(oldPage.dom instanceof Element) && oldPage.build();\n\n this.emitter.emit(\"PAGE_LOADING\", { href, oldPage, trigger });\n newPage = await pages.load(href);\n await newPage.build();\n this.emitter.emit(\"PAGE_LOAD_COMPLETE\", {\n newPage,\n oldPage,\n trigger,\n });\n } catch (err) {\n console.warn(`[PJAX] Page load error: ${err}`);\n }\n\n // Transition Between Pages\n try {\n const TransitionManager = this.manager.get(\"TransitionManager\") as ITransitionManager;\n this.emitter.emit(\"TRANSITION_START\", transitionName);\n\n let transition = await TransitionManager.animate(TransitionManager.has(transitionName) ? transitionName : \"default\", {\n oldPage,\n newPage,\n trigger,\n scroll,\n ignoreHashAction: this.ignoreHashAction\n });\n\n if (!transition.scrollable) {\n if (!this.ignoreHashAction && !/back|popstate|forward/.test(trigger as string)) scroll = hashAction(scroll);\n window.scroll(scroll.x, scroll.y);\n }\n\n this.emitter.emit(\"TRANSITION_END\", { transition });\n } catch (err) {\n console.warn(`[PJAX] Transition error: ${err}`);\n }\n\n // Navigation is over\n this.emitter.emit(\"NAVIGATION_END\", {\n oldPage,\n newPage,\n trigger,\n transitionName,\n });\n } catch (err) {\n if (this.forceOnError) this.force(href);\n else console.warn(err);\n } finally {\n this.transitionStop(); // Sets isTransitioning to false\n }\n }\n\n /** Check to see if the URL is to be ignored, uses either RegExp of Strings to check */\n public ignoredURL({ pathname }: URL): boolean {\n return (\n this.ignoreURLs.length &&\n this.ignoreURLs.some((url) => {\n return typeof url === \"string\"\n ? url === pathname\n : (url as RegExp).exec(pathname) !== null;\n })\n );\n }\n\n /** When you hover over an anchor, prefetch the event target's href */\n public onHover(event: LinkEvent): Promise {\n let el = this.getLink(event);\n if (!el || !this.manager.has(\"PageManager\")) return;\n\n const pages = this.manager.get(\"PageManager\") as IPageManager;\n let url = newURL(this.getHref(el));\n let urlString: string = url.pathname;\n\n // If Url is ignored or already in cache, don't do any think\n if (this.ignoredURL(url) || pages.has(urlString)) return;\n this.emitter.emit(\"ANCHOR_HOVER HOVER\", event);\n\n try {\n pages.load(url);\n } catch (err) {\n console.warn(\"[PJAX] prefetch error,\", err);\n }\n }\n\n /** When History state changes, get url from State, go for a Transition. */\n public onStateChange(event: PopStateEvent): void {\n this.go({ href: window.location.href, trigger: \"popstate\", event });\n }\n\n /** Initialize DOM Events */\n public initEvents() {\n if (this.prefetchIgnore !== true) {\n document.addEventListener(\"mouseover\", this.onHover);\n document.addEventListener(\"touchstart\", this.onHover);\n }\n\n document.addEventListener(\"click\", this.onClick);\n window.addEventListener(\"popstate\", this.onStateChange);\n }\n\n /** Stop DOM Events */\n public stopEvents() {\n if (this.prefetchIgnore !== true) {\n document.removeEventListener(\"mouseover\", this.onHover);\n document.removeEventListener(\"touchstart\", this.onHover);\n }\n\n document.removeEventListener(\"click\", this.onClick);\n window.removeEventListener(\"popstate\", this.onStateChange);\n }\n}\n", "import { Service } from \"./service\";\nimport { Manager } from \"./manager\";\nimport { newURL, getHashedPath } from \"./url\";\nimport { IHistoryManager } from \"./history\";\n\nexport type RouteMethod = (...args: any) => any;\nexport type RouteStyle = string | RegExp | boolean;\nexport interface IRouteToFrom {\n to: RouteStyle,\n from: RouteStyle\n}\nexport type RoutePath = IRouteToFrom | RouteStyle;\nexport interface IRoute {\n path: RoutePath,\n method: RouteMethod\n}\n\n/** Controls what happens when certain url paths match a set of criteria */\nexport class Router extends Service {\n /** List of routes */\n protected routes: Manager;\n constructor(routes: IRoute[] = []) {\n super();\n this.routes = new Manager();\n for (let route of routes) {\n this.add(route);\n }\n }\n\n /** Add a new route to watch for */\n public add({ path, method }: IRoute): Router {\n let key = this.parse(path);\n this.routes.set(key, method);\n return this;\n }\n\n /** Convert strings into path match functions */\n public parsePath(path: RouteStyle): RegExp | boolean {\n if (typeof path === \"string\") return new RegExp(path, \"i\");\n else if (path instanceof RegExp || typeof path === \"boolean\")\n return path;\n throw \"[Router] only regular expressions, strings and booleans are accepted as paths.\";\n }\n\n /** Determines if a strings counts has a path */\n public isPath(input: RouteStyle): boolean {\n return (\n typeof input === \"string\" ||\n input instanceof RegExp ||\n typeof input === \"boolean\"\n );\n }\n\n /** Parse the multiple different formats for paths, into a { from, to } object */\n public parse(input: RoutePath): IRouteToFrom {\n let route = input as IRouteToFrom;\n let toFromPath: IRouteToFrom = {\n from: /(.*)/g,\n to: /(.*)/g,\n };\n\n if (this.isPath(input as RouteStyle))\n toFromPath = {\n from: true,\n to: input as RouteStyle,\n };\n else if (this.isPath(route.from) && this.isPath(route.to as RouteStyle))\n toFromPath = route;\n else\n throw \"[Router] path is neither a string, regular expression, or a { from, to } object.\";\n\n let { from, to } = toFromPath;\n return {\n from: this.parsePath(from),\n to: this.parsePath(to),\n };\n }\n\n /** Test if route paths are true, if so run their methods */\n public route() {\n if (this.manager.has(\"HistoryManager\")) {\n let history = this.manager.get(\"HistoryManager\") as IHistoryManager;\n let from: string = getHashedPath(newURL((history.length > 1 ? history.previous : history.current).url));\n let to: string = getHashedPath(newURL());\n\n this.routes.forEach((method: RouteMethod, path: IRouteToFrom) => {\n let fromRegExp = path.from as RegExp | boolean;\n let toRegExp = path.to as RegExp | boolean;\n\n if (\n typeof fromRegExp === \"boolean\" &&\n typeof toRegExp === \"boolean\"\n ) {\n throw `[Router] path ({ from: ${fromRegExp}, to: ${toRegExp} }) is not valid, remember paths can only be strings, regular expressions, or a boolean; however, both the from and to paths cannot be both booleans.`;\n }\n\n let fromParam: RegExpExecArray | RegExp | boolean = fromRegExp;\n let toParam: RegExpExecArray | RegExp | boolean = toRegExp;\n\n if (fromRegExp instanceof RegExp && fromRegExp.test(from))\n fromParam = fromRegExp.exec(from);\n if (toRegExp instanceof RegExp && toRegExp.test(to))\n toParam = toRegExp.exec(to);\n\n if (\n (Array.isArray(toParam) && Array.isArray(fromParam)) ||\n (Array.isArray(toParam) &&\n typeof fromParam == \"boolean\" &&\n fromParam) ||\n (Array.isArray(fromParam) &&\n typeof toParam == \"boolean\" &&\n toParam)\n )\n method({ from: fromParam, to: toParam, path: { from, to } });\n });\n } else {\n console.warn(\"[Route] HistoryManager is missing.\");\n }\n }\n\n /** Add listeners for PJAX Events */\n public initEvents() {\n this.emitter.on(\"READY\", this.route, this);\n this.emitter.on(\"CONTENT_REPLACED\", this.route, this);\n }\n\n /** Remove listeners for PJAX Events */\n public stopEvents() {\n this.emitter.off(\"READY\", this.route, this);\n this.emitter.off(\"CONTENT_REPLACED\", this.route, this);\n }\n}\n", "import { EventEmitter, EventInput, ListenerCallback } from \"@okikio/emitter\";\nimport { Manager } from \"@okikio/manager\";\n\n// DOM\nexport type AnimationTarget = string | Node | NodeList | HTMLCollection | HTMLElement[] | AnimationTarget[];\nexport const getElements = (selector: string | Node): Node[] => {\n return typeof selector === \"string\" ? Array.from(document.querySelectorAll(selector as string)) : [selector];\n};\n\nconst flatten = (arr: AnimationTarget[]) => [].concat(...arr);\nexport const getTargets = (targets: AnimationTarget): Node[] => {\n if (Array.isArray(targets)) {\n return flatten((targets as AnimationTarget[]).map(getTargets));\n }\n if (typeof targets == \"string\" || targets instanceof Node)\n return getElements(targets);\n if (targets instanceof NodeList || targets instanceof HTMLCollection)\n return Array.from(targets);\n return [];\n};\n\n// VALUES\nexport type closureArgs = [number, number, HTMLElement];\nexport type closure = ((index?: number, total?: number, element?: HTMLElement) => (genericTypes[] | void)) | any;\nexport const computeValue = (value: closure, args: closureArgs, context: Animate) => {\n if (typeof value === \"function\") {\n return value.apply(context, args);\n } else { return value; }\n};\n\nexport const mapObject = (obj: object, args: closureArgs, options: Animate): any => {\n let key: string, value: any, result = {};\n let keys = Object.keys(obj);\n for (let i = 0, len = keys.length; i < len; i++) {\n key = keys[i];\n value = obj[key];\n result[key] = computeValue(value, args, options);\n }\n\n return result;\n};\n\n/** From: [https://easings.net] */\nexport const easings = {\n \"in\": \"ease-in\",\n \"out\": \"ease-out\",\n \"in-out\": \"ease-in-out\",\n\n // Sine\n \"in-sine\": \"cubic-bezier(0.47, 0, 0.745, 0.715)\",\n \"out-sine\": \"cubic-bezier(0.39, 0.575, 0.565, 1)\",\n \"in-out-sine\": \"cubic-bezier(0.445, 0.05, 0.55, 0.95)\",\n\n // Quad\n \"in-quad\": \"cubic-bezier(0.55, 0.085, 0.68, 0.53)\",\n \"out-quad\": \"cubic-bezier(0.25, 0.46, 0.45, 0.94)\",\n \"in-out-quad\": \"cubic-bezier(0.455, 0.03, 0.515, 0.955)\",\n\n // Cubic\n \"in-cubic\": \"cubic-bezier(0.55, 0.055, 0.675, 0.19)\",\n \"out-cubic\": \"cubic-bezier(0.215, 0.61, 0.355, 1)\",\n \"in-out-cubic\": \"cubic-bezier(0.645, 0.045, 0.355, 1)\",\n\n // Quart\n \"in-quart\": \"cubic-bezier(0.895, 0.03, 0.685, 0.22)\",\n \"out-quart\": \"cubic-bezier(0.165, 0.84, 0.44, 1)\",\n \"in-out-quart\": \"cubic-bezier(0.77, 0, 0.175, 1)\",\n\n // Quint\n \"in-quint\": \"cubic-bezier(0.755, 0.05, 0.855, 0.06)\",\n \"out-quint\": \"cubic-bezier(0.23, 1, 0.32, 1)\",\n \"in-out-quint\": \"cubic-bezier(0.86, 0, 0.07, 1)\",\n\n // Expo\n \"in-expo\": \"cubic-bezier(0.95, 0.05, 0.795, 0.035)\",\n \"out-expo\": \"cubic-bezier(0.19, 1, 0.22, 1)\",\n \"in-out-expo\": \"cubic-bezier(1, 0, 0, 1)\",\n\n // Circ\n \"in-circ\": \"cubic-bezier(0.6, 0.04, 0.98, 0.335)\",\n \"out-circ\": \"cubic-bezier(0.075, 0.82, 0.165, 1)\",\n \"in-out-circ\": \"cubic-bezier(0.785, 0.135, 0.15, 0.86)\",\n\n // Back\n \"in-back\": \"cubic-bezier(0.6, -0.28, 0.735, 0.045)\",\n \"out-back\": \"cubic-bezier(0.175, 0.885, 0.32, 1.275)\",\n \"in-out-back\": \"cubic-bezier(0.68, -0.55, 0.265, 1.55)\"\n};\n\nexport const getEase = (ease: string) => {\n return /^(in|out)/.test(ease) ? easings[ease] : ease;\n};\n\nexport type genericTypes = genericTypes[] | boolean | object | string | number | closure | null | undefined;\nexport interface AnimationOptions {\n target?: AnimationTarget,\n\n speed?: number,\n autoplay?: boolean,\n options?: AnimationOptions,\n delay?: number | closure,\n easing?: string | closure,\n endDelay?: number | closure,\n duration?: number | closure,\n keyframes?: Keyframe[] | object[] | closure,\n loop?: number | boolean | closure, // iterations: number,\n onfinish?: (element?: HTMLElement, index?: number, total?: number, animation?: Animation) => any,\n fillMode?: \"none\" | \"forwards\" | \"backwards\" | \"both\" | \"auto\" | closure,\n direction?: \"normal\" | \"reverse\" | \"alternate\" | \"alternate-reverse\" | closure,\n extend?: EffectTiming,\n [property: string]: genericTypes;\n};\n\nexport const DefaultAnimationOptions: AnimationOptions = {\n keyframes: [],\n\n loop: 1, // iterations: number,\n delay: 0,\n speed: 1,\n endDelay: 0,\n easing: \"ease\",\n autoplay: true,\n duration: 1000,\n fillMode: \"auto\",\n direction: \"normal\",\n extend: {}\n};\n\nexport type AnimationEvents = \"update\" | \"play\" | \"pause\" | \"start\" | \"begin\" | \"complete\" | \"finish\" | \"error\" | \"stop\";\n\n/** You can check it out here: https://codepen.io/okikio/pen/qBbdGaW?editors=0011 */\nexport class Animate {\n /**\n * Stores the options for the current animation\n */\n public options: AnimationOptions = {};\n\n /**\n * The Array of Elements to Animate\n */\n public targets: Node[] = [];\n\n /**\n * The properties to animate\n */\n public properties: object = {};\n\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n\n /**\n * The total duration of all Animation's\n */\n public totalDuration: number = 0;\n\n /**\n * The smallest delay out of all Animation's\n */\n public minDelay: number = 0;\n\n /**\n * The options for individual animations\n */\n public computedOptions: Manager = new Manager();\n\n /**\n * The Element the main animation uses\n */\n public mainElement: HTMLElement;\n\n /**\n * Stores an animation that runs on the total duration of the all other Animations, and as such it's the main Animation\n */\n public mainAnimation: Animation;\n\n /**\n * Stores request frame calls\n */\n public animationFrame: number;\n\n /**\n * An event emitter\n */\n public emitter: EventEmitter = new EventEmitter();\n\n /**\n * Returns a promise that is fulfilled when the mainAnimation is finished\n */\n public promise: Promise;\n constructor(options: AnimationOptions = {}) {\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n\n /**\n * Returns a new Promise that is resolve when this.finish is called\n */\n public newPromise(): Promise {\n return new Promise((resolve, reject) => {\n /*\n Note that the `this` keyword is in an Array when it is resolved,\n this is due to Promises not wanting to resolve references,\n so, you can't resolve `this` directly, so, I chose to resolve `this` in an\n Array\n */\n this.on(\"complete\", () => resolve([this]));\n this.on(\"error\", err => reject(err));\n });\n }\n\n /**\n * Fulfills the this.promise Promise\n */\n public then(\n onFulfilled?: (value?: any) => any,\n onRejected?: (reason?: any) => any\n ): Animate {\n onFulfilled = onFulfilled?.bind(this);\n onRejected = onRejected?.bind(this);\n this.promise.then(onFulfilled, onRejected);\n return this;\n }\n\n /**\n * Catches error that occur in the this.promise Promise\n */\n public catch(onRejected: (reason?: any) => any): Animate {\n onRejected = onRejected?.bind(this);\n this.promise.catch(onRejected);\n return this;\n }\n\n /**\n * If you don't care if the this.promise Promise has either been rejected or resolved\n */\n public finally(onFinally: () => any): Animate {\n onFinally = onFinally?.bind(this);\n this.promise.finally(onFinally);\n return this;\n }\n\n /**\n * Represents an Animation Frame Loop\n */\n public loop(): void {\n this.stopLoop();\n this.emit(\"update\", this.getProgress(), this);\n this.animationFrame = window.requestAnimationFrame(this.loop);\n }\n\n /**\n * Cancels animation frame\n */\n public stopLoop() {\n window.cancelAnimationFrame(this.animationFrame);\n }\n\n /**\n * Calls a method that affects all animations including the mainAnimation; the method only allows the animation parameter\n */\n public all(method: (animation?: Animation, target?: HTMLElement) => void) {\n method(this.mainAnimation, this.mainElement);\n this.animations.forEach(method);\n return this;\n }\n\n /**\n * Register the begin event\n */\n protected beginEvent() {\n if (this.getProgress() == 0) {\n let timer: number | void = window.setTimeout(() => {\n this.emit(\"begin\", this);\n timer = window.clearTimeout(timer as number);\n }, this.minDelay);\n }\n }\n\n /**\n * Play Animation\n */\n public play(): Animate {\n let playstate = this.getPlayState();\n this.beginEvent();\n this.all(anim => anim.play());\n this.emit(\"play\", playstate, this);\n this.loop();\n return this;\n }\n\n /**\n * Pause Animation\n */\n public pause(): Animate {\n let playstate = this.getPlayState();\n this.all(anim => anim.pause());\n this.emit(\"pause\", playstate, this);\n this.stopLoop();\n this.animationFrame = undefined;\n return this;\n }\n\n /**\n * Reset all Animations\n */\n public reset() {\n this.setProgress(0);\n this.beginEvent();\n\n if (this.options.autoplay) this.play();\n else this.pause();\n return this;\n }\n\n /**\n * Cancels all Animations\n */\n public cancel() {\n this.all(anim => anim.cancel());\n this.stopLoop();\n return this;\n }\n\n /**\n * Force complete all Animations\n */\n public finish() {\n this.all(anim => anim.finish());\n this.stopLoop();\n return this;\n }\n\n /**\n * Cancels & Clears all Animations\n */\n public stop() {\n this.cancel();\n this.animations.clear();\n while (this.targets.length) this.targets.pop();\n this.mainElement = undefined;\n this.emit(\"stop\");\n }\n\n /**\n * Returns an Array of targets\n */\n public getTargets(): Node[] {\n return this.targets;\n }\n\n /**\n * Get a specific Animation from an Animate instance\n */\n public getAnimation(element: HTMLElement): Animation {\n return this.animations.get(element);\n }\n\n /**\n * Returns the timings of an Animation, given a target\n * E.g. { duration, endDelay, delay, iterations, iterationStart, direction, easing, fill, etc... }\n */\n public getTiming(target: HTMLElement | Animation): AnimationOptions & EffectTiming {\n let animation = target instanceof Animation ? target : this.getAnimation(target);\n let keyframeOptions = this.computedOptions.get(animation) ?? {};\n let timings = animation.effect?.getTiming() ?? {};\n let options = this.getOptions();\n\n return { ...DefaultAnimationOptions, ...options, ...timings, ...keyframeOptions };\n }\n\n /**\n * Returns the total duration of Animation\n */\n public getTotalDuration(): number {\n return this.totalDuration;\n }\n\n /**\n * Returns the current time of the Main Animation\n */\n public getCurrentTime(): number {\n return this.mainAnimation.currentTime;\n }\n\n /**\n * Returns the Animation progress as a fraction of the current time / duration * 100\n */\n public getProgress() {\n return (this.getCurrentTime() / this.totalDuration) * 100;\n }\n\n /**\n * Return the playback speed of the animation\n */\n public getSpeed(): number {\n return this.mainAnimation.playbackRate;\n }\n\n /**\n * Returns the current playing state\n */\n public getPlayState(): \"idle\" | \"running\" | \"paused\" | \"finished\" {\n return this.mainAnimation.playState;\n }\n\n /**\n * Get the options of an Animate instance\n */\n public getOptions(): AnimationOptions {\n return this.options;\n }\n\n /**\n * Set the current time of the Main Animation\n */\n public setCurrentTime(time: number): Animate {\n this.all(anim => { anim.currentTime = time; });\n this.emit(\"update\", this.getProgress());\n return this;\n }\n\n /**\n * Set the Animation progress as a value from 0 to 100\n */\n public setProgress(percent: number): Animate {\n let time = (percent / 100) * this.totalDuration;\n this.setCurrentTime(time);\n return this;\n }\n\n /**\n * Set the playback speed of an Animation\n */\n public setSpeed(speed: number = 1): Animate {\n this.all(anim => { anim.playbackRate = speed; });\n return this;\n }\n\n /**\n * Adds a listener for a given event\n */\n public on(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.on(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Removes a listener from an event\n */\n public off(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.off(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Call all listeners within an event\n */\n public emit(events: AnimationEvents | string | any[], ...args: any): Animate {\n this.emitter.emit(events, ...args);\n return this;\n }\n\n\n /** Returns the Animate options, as JSON */\n public toJSON(): AnimationOptions {\n return this.getOptions();\n }\n\n /**\n * The Symbol.toStringTag well-known symbol is a string valued property that is used\n * in the creation of the default string description of an object.\n * It is accessed internally by the Object.prototype.toString() method.\n */\n get [Symbol.toStringTag]() {\n return `Animate`;\n }\n}\n\n/** Creates a new Animate instance */\nexport const animate = (options: AnimationOptions = {}): Animate => {\n return new Animate(options);\n};\n\nexport class Timeline extends Animate {\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n constructor(options: AnimationOptions = {}) {\n super();\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n public add(options: AnimationOptions) {\n return this;\n }\n}\n\nexport default animate;"], + "mappings": "AAgBO,GAAM,GAA2B,CACpC,YAAa,UACb,eAAgB,eAChB,eAAgB,cAChB,QAAS,CACL,CAAC,YAAa,SAElB,gBAAiB,iBACjB,eAAgB,gBAChB,eAAgB,aAChB,UAAW,QACX,QAAS,IACT,SAAU,EACV,YAAa,KAIJ,EAAY,AAAC,GACf,OAAO,OAAO,IAAK,GAAmB,GAIpC,GAAS,CAAC,EAAiB,EAAe,EAAoB,KAAiB,CACxF,GAAI,CAAE,UAAW,EACb,EAAO,OAAO,EAAS,IAAM,EAAS,MAAM,IAChD,MAAO,GAAW,IAAI,KAAU,GAIvB,EAAY,CAAC,EAAiB,EAAoB,EAAoB,KAAc,CAC7F,GAAI,MAAO,IAAU,SACjB,MAAO,GAEX,GAAI,GAAO,EAAO,GAClB,MAAI,OAAO,IAAS,SACT,GAAO,EAAQ,EAAM,GACzB,GCnDJ,WAAoB,CAG1B,YAAY,EAAuB,CAClC,KAAK,IAAM,GAAI,KAAI,GAIb,QAAoB,CAC1B,MAAO,MAAK,IAIN,IAAI,EAAW,CACrB,MAAO,MAAK,IAAI,IAAI,GAId,MAAiB,CACvB,MAAO,OAAM,KAAK,KAAK,IAAI,QAIrB,QAAmB,CACzB,MAAO,OAAM,KAAK,KAAK,IAAI,UAIrB,IAAI,EAAQ,EAAyB,CAC3C,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/lib/api.js +++ b/packages/native/lib/api.js @@ -1,3 +1,3 @@ -var native=(()=>{var mt=Object.defineProperty;var gt=(r,t)=>{for(var e in t)mt(r,e,{get:t[e],enumerable:!0})};var At={};gt(At,{AdvancedManager:()=>k,Animate:()=>M,App:()=>at,CONFIG_DEFAULTS:()=>Z,DefaultAnimationOptions:()=>V,Event:()=>R,EventEmitter:()=>O,HistoryManager:()=>it,Manager:()=>g,ManagerItem:()=>S,PARSER:()=>nt,PJAX:()=>lt,Page:()=>U,PageManager:()=>st,Router:()=>pt,Service:()=>y,ServiceManager:()=>_,Timeline:()=>ht,TransitionManager:()=>ot,animate:()=>yt,asyncMethodCall:()=>et,changeState:()=>rt,clean:()=>X,computeValue:()=>j,easings:()=>ut,equal:()=>N,getConfig:()=>h,getEase:()=>Q,getElements:()=>ct,getHash:()=>ft,getHashedPath:()=>E,getTargets:()=>F,hashAction:()=>z,mapObject:()=>K,methodCall:()=>v,newConfig:()=>W,newCoords:()=>w,newListener:()=>J,newState:()=>D,newURL:()=>c,toAttr:()=>tt});var Z={wrapperAttr:"wrapper",noAjaxLinkAttr:"no-ajax-link",noPrefetchAttr:"no-prefetch",headers:[["x-partial","true"]],preventSelfAttr:'prevent="self"',preventAllAttr:'prevent="all"',transitionAttr:"transition",blockAttr:"block",timeout:3e4,maxPages:5},W=r=>Object.assign({...Z},r),tt=(r,t,e=!0)=>{let{prefix:i}=r,n=`data${i?"-"+i:""}-${t}`;return e?`[${n}]`:n},h=(r,t,e=!0)=>{if(typeof t!="string")return r;let i=r[t];return typeof i=="string"?tt(r,i,e):i};var g=class{constructor(t){this.map=new Map(t)}getMap(){return this.map}get(t){return this.map.get(t)}keys(){return Array.from(this.map.keys())}values(){return Array.from(this.map.values())}set(t,e){return this.map.set(t,e),this}add(t){let i=this.size;return this.set(i,t),this}get size(){return this.map.size}get length(){return this.map.size}last(t=1){let e=this.keys()[this.size-t];return this.get(e)}delete(t){return this.map.delete(t)}remove(t){return this.map.delete(t),this}clear(){return this.map.clear(),this}has(t){return this.map.has(t)}entries(){return this.map.entries()}forEach(t,e){return this.map.forEach(t,e),this}[Symbol.iterator](){return this.entries()}},v=(r,t,...e)=>{r.forEach(i=>{i[t](...e)})},et=async(r,t,...e)=>{for(let[,i]of r)await i[t](...e)};var S=class{constructor(){}install(){}register(t,e){return this.manager=t,this.app=t.app,this.config=t.config,this.emitter=t.emitter,this.key=e,this.install(),this}uninstall(){}unregister(){this.uninstall(),this.manager.remove(this.key),this.key=void 0,this.manager=void 0,this.app=void 0,this.config=void 0,this.emitter=void 0}},k=class extends g{constructor(t){super();this.app=t,this.config=t.config,this.emitter=t.emitter}set(t,e){return super.set(t,e),e.register(this,t),this}};var c=(r=window.location.href)=>r instanceof URL?r:new URL(r,window.location.origin),E=r=>{let t=c(r);return`${t.pathname}${t.hash}`},ft=r=>c(r).hash.slice(1),X=r=>c(r).toString().replace(/(\/#.*|\/|#.*)$/,""),N=(r,t)=>X(r)===X(t);var y=class extends S{init(){}boot(){this.initEvents()}initEvents(){}stopEvents(){}stop(){this.stopEvents(),this.unregister()}},_=class extends k{constructor(t){super(t)}init(){return v(this,"init"),this}boot(){return v(this,"boot"),this}stop(){return v(this,"stop"),this}};var w=(r=window.scrollX,t=window.scrollY)=>({x:r,y:t}),D=(r={url:E(c()),index:0,transition:"default",data:{scroll:w(),trigger:"HistoryManager"}})=>r,it=class extends y{constructor(){super(...arguments);this.pointer=-1}init(){this.states=[];let t=D();this.add(t,"replace")}get(t){return this.states[t]}add(t,e="push"){let i=D(t),n=this.length;this.states.push({...i}),this.pointer=n;let s={index:this.pointer,states:[...this.states]};return rt(e,i,s),this}remove(t){return t?this.states.splice(t,1):this.states.pop(),this.pointer--,this}replace(t){return this.states=t,this}set(t,e){return this.states[t]=e}get current(){return this.get(this.pointer)}get last(){return this.get(this.length-1)}get previous(){return this.pointer<1?null:this.get(this.pointer-1)}get length(){return this.states.length}},rt=(r,t,e)=>{let i=E(t.url),n=[e,"",i];if(window.history)switch(r){case"push":window.history.pushState.apply(window.history,n);break;case"replace":window.history.replaceState.apply(window.history,n);break}};var nt=new DOMParser,U=class extends S{constructor(t=c(),e=document){super();this.url=t,typeof e=="string"?this.data=e:this.dom=e||document}build(){if(this.dom instanceof Node||(this.dom=nt.parseFromString(this.data,"text/html")),!(this.body instanceof Node)){let{title:t,head:e,body:i}=this.dom;this.title=t,this.head=e,this.body=i,this.wrapper=this.body.querySelector(this.wrapperAttr)}}install(){this.wrapperAttr=h(this.config,"wrapperAttr")}uninstall(){this.url=void 0,this.title=void 0,this.head=void 0,this.body=void 0,this.dom=void 0,this.wrapper=void 0,this.data=void 0,this.wrapperAttr=void 0}},st=class extends y{constructor(){super(...arguments);this.loading=new g}install(){this.pages=new k(this.app);let t=c().pathname;this.set(t,new U),t=void 0}get(t){return this.pages.get(t)}add(t){return this.pages.add(t),this}set(t,e){return this.pages.set(t,e),this}remove(t){return this.pages.remove(t),this}has(t){return this.pages.has(t)}clear(){return this.pages.clear(),this}get size(){return this.pages.size}keys(){return this.pages.keys()}async load(t=c()){let e=c(t),i=e.pathname,n,s;if(this.has(i))return n=this.get(i),Promise.resolve(n);this.loading.has(i)?s=this.loading.get(i):(s=this.request(i),this.loading.set(i,s));let a=await s;if(this.loading.remove(i),n=new U(e,a),this.set(i,n),this.size>h(this.config,"maxPages")){let l=c(),o=this.keys(),p=N(l,o[0])?o[1]:o[0],f=this.get(p);f.unregister(),f=void 0,o=void 0,l=void 0,p=void 0}return n}async request(t){let e=new Headers(h(this.config,"headers")),i=window.setTimeout(()=>{throw window.clearTimeout(i),"Request Timed Out!"},h(this.config,"timeout"));try{let n=await fetch(t,{mode:"same-origin",method:"GET",headers:e,cache:"default",credentials:"same-origin"});if(window.clearTimeout(i),n.status>=200&&n.status<300)return await n.text();throw new Error(n.statusText||""+n.status)}catch(n){throw window.clearTimeout(i),n}}};var J=({callback:r=()=>{},scope:t=null,name:e="event"})=>({callback:r,scope:t,name:e}),R=class extends g{constructor(t="event"){super();this.name=t}},O=class extends g{constructor(){super()}getEvent(t){let e=this.get(t);return e instanceof R?e:(this.set(t,new R(t)),this.get(t))}newListener(t,e,i){let n=this.getEvent(t);return n.add(J({name:t,callback:e,scope:i})),n}on(t,e,i){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let n,s,a=typeof t=="object"&&!Array.isArray(t),l=a?e:i;return a||(s=e),Object.keys(t).forEach(o=>{a?(n=o,s=t[o]):n=t[o],this.newListener(n,s,l)},this),this}removeListener(t,e,i){let n=this.get(t);if(n instanceof R&&e){let s=J({name:t,callback:e,scope:i});n.forEach((a,l)=>{if(a.callback===s.callback&&a.scope===s.scope)return n.remove(l)})}return n}off(t,e,i){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let n,s,a=typeof t=="object"&&!Array.isArray(t),l=a?e:i;return a||(s=e),Object.keys(t).forEach(o=>{a?(n=o,s=t[o]):n=t[o],typeof s=="function"?this.removeListener(n,s,l):this.remove(n)},this),this}emit(t,...e){return typeof t=="undefined"?this:(typeof t=="string"&&(t=t.trim().split(/\s/g)),t.forEach(i=>{let n=this.get(i);n instanceof R&&n.forEach(s=>{let{callback:a,scope:l}=s;a.apply(l,e)})},this),this)}clear(){return v(this,"clear"),super.clear(),this}};var z=(r,t=window.location.hash)=>{try{let e=t[0]=="#"?t:c(t).hash;if(e.length>1){let i=document.getElementById(e.slice(1));if(i){let{left:n,top:s}=i.getBoundingClientRect(),a=window.pageXOffset,l=window.pageYOffset,o=n+a,p=s+l;return console.log(o,p),w(o,p)}}}catch(e){console.warn("[hashAction] error",e)}return r??w(0,0)},bt={name:"default",scrollable:!0,out({done:r}){r()},in({scroll:r,done:t}){window.scroll(r.x,r.y),t()}},ot=class extends y{constructor(t){super();this._arg=t}install(){super.install();let t=this._arg&&this._arg.length?this._arg:h(this.config,"transitions")??[];t=[["default",bt]].concat(t),this.transitions=new g(t)}get(t){return this.transitions.get(t)}set(t,e){return this.transitions.set(t,e),this}add(t){return this.transitions.add(t),this}has(t){return this.transitions.has(t)}async animate(t,e){let i=this.transitions.get(t),n=e.scroll,s=e.ignoreHashAction;if(!("wrapper"in e.oldPage)||!("wrapper"in e.newPage))throw`[Page] either oldPage or newPage aren't instances of the Page Class. - ${{newPage:e.newPage,oldPage:e.oldPage}}`;document.title=""+e.newPage.title;let a=e.oldPage.wrapper,l=e.newPage.wrapper;if(!(a instanceof Node)||!(l instanceof Node))throw`[Wrapper] the wrapper from the ${l instanceof Node?"current":"next"} page cannot be found. The wrapper must be an element that has the attribute ${h(this.config,"wrapperAttr")}.`;return i.init&&i?.init(e),this.emitter.emit("BEFORE_TRANSITION_OUT"),i.out&&await new Promise(o=>{i.out.call(i,{...e,from:e.oldPage,trigger:e.trigger,done:o})?.then(o)}),this.emitter.emit("AFTER_TRANSITION_OUT"),await new Promise(o=>{a.insertAdjacentElement("beforebegin",l),this.emitter.emit("CONTENT_INSERT"),!s&&!/back|popstate|forward/.test(e.trigger)&&(n=z(n)),o()}),await new Promise(o=>{a.remove(),a=void 0,l=void 0,this.emitter.emit("CONTENT_REPLACED"),o()}),this.emitter.emit("BEFORE_TRANSITION_IN"),i.in&&await new Promise(async o=>{i.in.call(i,{...e,from:e.oldPage,to:e.newPage,trigger:e.trigger,scroll:n,done:o})?.then(o)}),this.emitter.emit("AFTER_TRANSITION_IN"),i}};var at=class{constructor(t={}){this.register(t)}register(t={}){this.config=W(t),this.emitter=new O,this.services=new _(this);let e=(()=>{document.removeEventListener("DOMContentLoaded",e),window.removeEventListener("load",e),this.emitter.emit("READY ready")}).bind(this);return document.addEventListener("DOMContentLoaded",e),window.addEventListener("load",e),this}get(t){return this.services.get(t)}set(t,e){return this.services.set(t,e),this}add(t){return this.services.add(t),this}boot(){return this.services.init(),this.services.boot(),this}stop(){return this.services.stop(),this.emitter.clear(),this}on(t,e){return this.emitter.on(t,e,this),this}off(t,e){return this.emitter.off(t,e,this),this}emit(t,...e){return this.emitter.emit(t,...e),this}};var lt=class extends y{install(){super.install(),this.ignoreURLs=h(this.config,"ignoreURLs")??[],this.prefetchIgnore=h(this.config,"prefetchIgnore")??!1,this.stopOnTransitioning=h(this.config,"stopOnTransitioning")??!1,this.stickyScroll=h(this.config,"stickyScroll")??!1,this.forceOnError=h(this.config,"forceOnError")??!1,this.ignoreHashAction=h(this.config,"ignoreHashAction")??!1}transitionStart(){this.isTransitioning=!0}transitionStop(){this.isTransitioning=!1}init(){this.onHover=this.onHover.bind(this),this.onClick=this.onClick.bind(this),this.onStateChange=this.onStateChange.bind(this)}boot(){"scrollRestoration"in window.history&&(window.history.scrollRestoration="manual"),super.boot()}getTransitionName(t){if(!t||!t.getAttribute)return null;let e=t.getAttribute(h(this.config,"transitionAttr",!1));return typeof e=="string"?e:null}validLink(t,e,i){let n=!window.history.pushState,s=!t||!i,a=e.metaKey||e.ctrlKey||e.shiftKey||e.altKey,l=t.hasAttribute("target")&&t.target==="_blank",o=t.protocol!==location.protocol||t.hostname!==location.hostname,p=typeof t.getAttribute("download")=="string",f=t.matches(h(this.config,"preventSelfAttr")),P=Boolean(t.closest(h(this.config,"preventAllAttr"))),T=E(c())===E(c(i));return!(s||n||a||l||o||p||f||P||T)}getHref(t){return t&&t.tagName&&t.tagName.toLowerCase()==="a"&&typeof t.href=="string"?t.href:null}getLink(t){let e=t.target,i=this.getHref(e);for(;e&&!i;)e=e.parentNode,i=this.getHref(e);if(!(!e||!this.validLink(e,t,i)))return e}onClick(t){let e=this.getLink(t);if(!e)return;if(this.isTransitioning&&this.stopOnTransitioning){t.preventDefault(),t.stopPropagation();return}let i=this.getHref(e);this.emitter.emit("ANCHOR_CLICK CLICK",t),this.go({href:i,trigger:e,event:t})}getDirection(t){return Math.abs(t)>1?t>0?"forward":"back":t===0?"popstate":t>0?"back":"forward"}force(t){window.location.assign(t)}go({href:t,trigger:e="HistoryManager",event:i}){if(this.isTransitioning&&this.stopOnTransitioning||!(this.manager.has("TransitionManager")&&this.manager.has("HistoryManager")&&this.manager.has("PageManager"))){this.force(t);return}let n=this.manager.get("HistoryManager"),s=w(0,0),a=n.current,l=a.url;if(N(l,t))return;let o;if(i&&i.state){this.emitter.emit("POPSTATE",i);let{state:p}=i,{index:f}=p,T=a.index-f;n.replace(p.states),n.pointer=f;let x=n.get(f);o=x.transition,s=x.data.scroll,e=this.getDirection(T),console.log(e=="forward"&&n),this.emitter.emit(e==="back"?"POPSTATE_BACK":"POPSTATE_FORWARD",i)}else{o=this.getTransitionName(e),s=w();let p=D({url:t,transition:o,data:{scroll:s}});!this.stickyScroll&&(s=w(0,0)),n.add(p),this.emitter.emit("HISTORY_NEW_ITEM",i)}return i&&(i.stopPropagation(),i.preventDefault()),this.emitter.emit("GO",i),this.load({oldHref:l,href:t,trigger:e,transitionName:o,scroll:s})}async load({oldHref:t,href:e,trigger:i,transitionName:n="default",scroll:s={x:0,y:0}}){try{let a=this.manager.get("PageManager"),l,o;this.emitter.emit("NAVIGATION_START",{oldHref:t,href:e,trigger:i,transitionName:n});try{this.transitionStart(),o=await a.load(t),!(o.dom instanceof Element)&&o.build(),this.emitter.emit("PAGE_LOADING",{href:e,oldPage:o,trigger:i}),l=await a.load(e),await l.build(),this.emitter.emit("PAGE_LOAD_COMPLETE",{newPage:l,oldPage:o,trigger:i})}catch(p){console.warn(`[PJAX] Page load error: ${p}`)}try{let p=this.manager.get("TransitionManager");this.emitter.emit("TRANSITION_START",n);let f=await p.animate(p.has(n)?n:"default",{oldPage:o,newPage:l,trigger:i,scroll:s,ignoreHashAction:this.ignoreHashAction});f.scrollable||(!this.ignoreHashAction&&!/back|popstate|forward/.test(i)&&(s=z(s)),window.scroll(s.x,s.y)),this.emitter.emit("TRANSITION_END",{transition:f})}catch(p){console.warn(`[PJAX] Transition error: ${p}`)}this.emitter.emit("NAVIGATION_END",{oldPage:o,newPage:l,trigger:i,transitionName:n})}catch(a){this.forceOnError?this.force(e):console.warn(a)}finally{this.transitionStop()}}ignoredURL({pathname:t}){return this.ignoreURLs.length&&this.ignoreURLs.some(e=>typeof e=="string"?e===t:e.exec(t)!==null)}onHover(t){let e=this.getLink(t);if(!e||!this.manager.has("PageManager"))return;let i=this.manager.get("PageManager"),n=c(this.getHref(e)),s=n.pathname;if(!(this.ignoredURL(n)||i.has(s))){this.emitter.emit("ANCHOR_HOVER HOVER",t);try{i.load(n)}catch(a){console.warn("[PJAX] prefetch error,",a)}}}onStateChange(t){this.go({href:window.location.href,trigger:"popstate",event:t})}initEvents(){this.prefetchIgnore!==!0&&(document.addEventListener("mouseover",this.onHover),document.addEventListener("touchstart",this.onHover)),document.addEventListener("click",this.onClick),window.addEventListener("popstate",this.onStateChange)}stopEvents(){this.prefetchIgnore!==!0&&(document.removeEventListener("mouseover",this.onHover),document.removeEventListener("touchstart",this.onHover)),document.removeEventListener("click",this.onClick),window.removeEventListener("popstate",this.onStateChange)}};var pt=class extends y{constructor(t=[]){super();this.routes=new g;for(let e of t)this.add(e)}add({path:t,method:e}){let i=this.parse(t);return this.routes.set(i,e),this}parsePath(t){if(typeof t=="string")return new RegExp(t,"i");if(t instanceof RegExp||typeof t=="boolean")return t;throw"[Router] only regular expressions, strings and booleans are accepted as paths."}isPath(t){return typeof t=="string"||t instanceof RegExp||typeof t=="boolean"}parse(t){let e=t,i={from:/(.*)/g,to:/(.*)/g};if(this.isPath(t))i={from:!0,to:t};else if(this.isPath(e.from)&&this.isPath(e.to))i=e;else throw"[Router] path is neither a string, regular expression, or a { from, to } object.";let{from:n,to:s}=i;return{from:this.parsePath(n),to:this.parsePath(s)}}route(){if(this.manager.has("HistoryManager")){let t=this.manager.get("HistoryManager"),e=E(c((t.length>1?t.previous:t.current).url)),i=E(c());this.routes.forEach((n,s)=>{let a=s.from,l=s.to;if(typeof a=="boolean"&&typeof l=="boolean")throw`[Router] path ({ from: ${a}, to: ${l} }) is not valid, remember paths can only be strings, regular expressions, or a boolean; however, both the from and to paths cannot be both booleans.`;let o=a,p=l;a instanceof RegExp&&a.test(e)&&(o=a.exec(e)),l instanceof RegExp&&l.test(i)&&(p=l.exec(i)),(Array.isArray(p)&&Array.isArray(o)||Array.isArray(p)&&typeof o=="boolean"&&o||Array.isArray(o)&&typeof p=="boolean"&&p)&&n({from:o,to:p,path:{from:e,to:i}})})}else console.warn("[Route] HistoryManager is missing.")}initEvents(){this.emitter.on("READY",this.route,this),this.emitter.on("CONTENT_REPLACED",this.route,this)}stopEvents(){this.emitter.off("READY",this.route,this),this.emitter.off("CONTENT_REPLACED",this.route,this)}};var ct=r=>typeof r=="string"?Array.from(document.querySelectorAll(r)):[r],dt=r=>[].concat(...r),F=r=>Array.isArray(r)?dt(r.map(F)):typeof r=="string"||r instanceof Node?ct(r):r instanceof NodeList||r instanceof HTMLCollection?Array.from(r):[],j=(r,t,e)=>typeof r=="function"?r.apply(e,t):r,K=(r,t,e)=>{let i,n,s={},a=Object.keys(r);for(let l=0,o=a.length;l/^(in|out)/.test(r)?ut[r]:r,V={keyframes:[],loop:1,delay:0,speed:1,endDelay:0,easing:"ease",autoplay:!0,duration:1e3,fillMode:"auto",direction:"normal",extend:{}},M=class{constructor(t={}){this.options={};this.targets=[];this.properties={};this.animations=new g;this.totalDuration=0;this.minDelay=0;this.computedOptions=new g;this.emitter=new O;try{let{options:e,...i}=t,n=e instanceof M?e.getOptions():Array.isArray(e)?e?.[0]?.getOptions():e;this.options=Object.assign({},V,n,i),this.loop=this.loop.bind(this);let{loop:s,delay:a,speed:l,easing:o,endDelay:p,duration:f,direction:P,fillMode:T,onfinish:x,target:G,keyframes:q,autoplay:$,extend:B,...Y}=this.options;this.mainElement=document.createElement("div"),this.targets=F(G),this.properties=Y;let C=[],d=this.targets.length,I;for(let m=0;m0||(I=K(I,[m,d,b],this));let H=u.delay+u.duration*u.iterations+u.endDelay;this.totalDuration{typeof x=="function"&&x.call(this,b,m,d,A),this.emit("finish",b,m,d,A)},this.computedOptions.set(A,u),this.animations.set(b,A),C.push(u.delay)}this.mainAnimation=this.mainElement.animate([{opacity:"0"},{opacity:"1"}],{duration:this.totalDuration,easing:"linear"}),this.minDelay=Math.min(...C),this.setSpeed(l),$?this.play():this.pause(),this.promise=this.newPromise(),this.mainAnimation.onfinish=()=>{this.emit("complete",this),this.stopLoop()}}catch(e){this.emit("error",e)}}newPromise(){return new Promise((t,e)=>{this.on("complete",()=>t([this])),this.on("error",i=>e(i))})}then(t,e){return t=t?.bind(this),e=e?.bind(this),this.promise.then(t,e),this}catch(t){return t=t?.bind(this),this.promise.catch(t),this}finally(t){return t=t?.bind(this),this.promise.finally(t),this}loop(){this.stopLoop(),this.emit("update",this.getProgress(),this),this.animationFrame=window.requestAnimationFrame(this.loop)}stopLoop(){window.cancelAnimationFrame(this.animationFrame)}all(t){return t(this.mainAnimation,this.mainElement),this.animations.forEach(t),this}beginEvent(){if(this.getProgress()==0){let t=window.setTimeout(()=>{this.emit("begin",this),t=window.clearTimeout(t)},this.minDelay)}}play(){let t=this.getPlayState();return this.beginEvent(),this.all(e=>e.play()),this.emit("play",t,this),this.loop(),this}pause(){let t=this.getPlayState();return this.all(e=>e.pause()),this.emit("pause",t,this),this.stopLoop(),this.animationFrame=void 0,this}reset(){return this.setProgress(0),this.beginEvent(),this.options.autoplay?this.play():this.pause(),this}cancel(){return this.all(t=>t.cancel()),this.stopLoop(),this}finish(){return this.all(t=>t.finish()),this.stopLoop(),this}stop(){for(this.cancel(),this.animations.clear();this.targets.length;)this.targets.pop();this.mainElement=void 0,this.emit("stop")}getTargets(){return this.targets}getAnimation(t){return this.animations.get(t)}getTiming(t){let e=t instanceof Animation?t:this.getAnimation(t),i=this.computedOptions.get(e)??{},n=e.effect?.getTiming()??{},s=this.getOptions();return{...V,...s,...n,...i}}getTotalDuration(){return this.totalDuration}getCurrentTime(){return this.mainAnimation.currentTime}getProgress(){return this.getCurrentTime()/this.totalDuration*100}getSpeed(){return this.mainAnimation.playbackRate}getPlayState(){return this.mainAnimation.playState}getOptions(){return this.options}setCurrentTime(t){return this.all(e=>{e.currentTime=t}),this.emit("update",this.getProgress()),this}setProgress(t){let e=t/100*this.totalDuration;return this.setCurrentTime(e),this}setSpeed(t=1){return this.all(e=>{e.playbackRate=t}),this}on(t,e,i){return this.emitter.on(t,e,i??this),this}off(t,e,i){return this.emitter.off(t,e,i??this),this}emit(t,...e){return this.emitter.emit(t,...e),this}toJSON(){return this.getOptions()}get[Symbol.toStringTag](){return"Animate"}},yt=(r={})=>new M(r),ht=class extends M{constructor(t={}){super();this.animations=new g;try{let{options:e,...i}=t,n=e instanceof M?e.getOptions():Array.isArray(e)?e?.[0]?.getOptions():e;this.options=Object.assign({},V,n,i),this.loop=this.loop.bind(this);let{loop:s,delay:a,speed:l,easing:o,endDelay:p,duration:f,direction:P,fillMode:T,onfinish:x,target:G,keyframes:q,autoplay:$,extend:B,...Y}=this.options;this.mainElement=document.createElement("div"),this.targets=F(G),this.properties=Y;let C=[],d=this.targets.length,I;for(let m=0;m0||(I=K(I,[m,d,b],this));let H=u.delay+u.duration*u.iterations+u.endDelay;this.totalDuration{typeof x=="function"&&x.call(this,b,m,d,A),this.emit("finish",b,m,d,A)},this.computedOptions.set(A,u),this.animations.set(b,A),C.push(u.delay)}this.mainAnimation=this.mainElement.animate([{opacity:"0"},{opacity:"1"}],{duration:this.totalDuration,easing:"linear"}),this.minDelay=Math.min(...C),this.setSpeed(l),$?this.play():this.pause(),this.promise=this.newPromise(),this.mainAnimation.onfinish=()=>{this.emit("complete",this),this.stopLoop()}}catch(e){this.emit("error",e)}}add(t){return this}};return At;})(); +var native=(()=>{var mt=Object.defineProperty;var gt=(r,t)=>{for(var e in t)mt(r,e,{get:t[e],enumerable:!0})};var At={};gt(At,{AdvancedManager:()=>R,Animate:()=>M,App:()=>ot,CONFIG_DEFAULTS:()=>Q,DefaultAnimationOptions:()=>V,Event:()=>k,EventEmitter:()=>O,HistoryManager:()=>it,Manager:()=>g,ManagerItem:()=>S,PARSER:()=>nt,PJAX:()=>lt,Page:()=>z,PageManager:()=>st,Router:()=>pt,Service:()=>y,ServiceManager:()=>K,Timeline:()=>ht,TransitionManager:()=>at,animate:()=>yt,asyncMethodCall:()=>et,changeState:()=>rt,clean:()=>X,computeValue:()=>j,easings:()=>ut,equal:()=>N,getConfig:()=>c,getEase:()=>Z,getElements:()=>ct,getHash:()=>dt,getHashedPath:()=>E,getTargets:()=>U,hashAction:()=>F,mapObject:()=>_,methodCall:()=>x,newConfig:()=>W,newCoords:()=>w,newListener:()=>J,newState:()=>D,newURL:()=>u,toAttr:()=>tt});var Q={wrapperAttr:"wrapper",noAjaxLinkAttr:"no-ajax-link",noPrefetchAttr:"no-prefetch",headers:[["x-partial","true"]],preventSelfAttr:'prevent="self"',preventAllAttr:'prevent="all"',transitionAttr:"transition",blockAttr:"block",timeout:3e4,maxPages:5,resizeDelay:100},W=r=>Object.assign({...Q},r),tt=(r,t,e=!0)=>{let{prefix:i}=r,n=`data${i?"-"+i:""}-${t}`;return e?`[${n}]`:n},c=(r,t,e=!0)=>{if(typeof t!="string")return r;let i=r[t];return typeof i=="string"?tt(r,i,e):i};var g=class{constructor(t){this.map=new Map(t)}getMap(){return this.map}get(t){return this.map.get(t)}keys(){return Array.from(this.map.keys())}values(){return Array.from(this.map.values())}set(t,e){return this.map.set(t,e),this}add(t){let i=this.size;return this.set(i,t),this}get size(){return this.map.size}get length(){return this.map.size}last(t=1){let e=this.keys()[this.size-t];return this.get(e)}delete(t){return this.map.delete(t)}remove(t){return this.map.delete(t),this}clear(){return this.map.clear(),this}has(t){return this.map.has(t)}entries(){return this.map.entries()}forEach(t,e){return this.map.forEach(t,e),this}[Symbol.iterator](){return this.entries()}},x=(r,t,...e)=>{r.forEach(i=>{i[t](...e)})},et=async(r,t,...e)=>{for(let[,i]of r)await i[t](...e)};var S=class{constructor(){}install(){}register(t,e){return this.manager=t,this.app=t.app,this.config=t.config,this.emitter=t.emitter,this.key=e,this.install(),this}uninstall(){}unregister(){this.uninstall(),this.manager.remove(this.key),this.key=void 0,this.manager=void 0,this.app=void 0,this.config=void 0,this.emitter=void 0}},R=class extends g{constructor(t){super();this.app=t,this.config=t.config,this.emitter=t.emitter}set(t,e){return super.set(t,e),e.register(this,t),this}};var u=(r=window.location.href)=>r instanceof URL?r:new URL(r,window.location.origin),E=r=>{let t=u(r);return`${t.pathname}${t.hash}`},dt=r=>u(r).hash.slice(1),X=r=>u(r).toString().replace(/(\/#.*|\/|#.*)$/,""),N=(r,t)=>X(r)===X(t);var y=class extends S{init(){}boot(){this.initEvents()}initEvents(){}stopEvents(){}stop(){this.stopEvents(),this.unregister()}},K=class extends R{constructor(t){super(t)}init(){return x(this,"init"),this}boot(){return x(this,"boot"),this}stop(){return x(this,"stop"),this}};var w=(r=window.scrollX,t=window.scrollY)=>({x:r,y:t}),D=(r={url:E(u()),index:0,transition:"default",data:{scroll:w(),trigger:"HistoryManager"}})=>r,it=class extends y{constructor(){super(...arguments);this.pointer=-1}init(){this.states=[];let t=D();this.add(t,"replace")}get(t){return this.states[t]}add(t,e="push"){let i=D(t),n=this.length;this.states.push({...i}),this.pointer=n;let s={index:this.pointer,states:[...this.states]};return rt(e,i,s),this}remove(t){return t?this.states.splice(t,1):this.states.pop(),this.pointer--,this}replace(t){return this.states=t,this}set(t,e){return this.states[t]=e}get current(){return this.get(this.pointer)}get last(){return this.get(this.length-1)}get previous(){return this.pointer<1?null:this.get(this.pointer-1)}get length(){return this.states.length}},rt=(r,t,e)=>{let i=E(t.url),n=[e,"",i];if(window.history)switch(r){case"push":window.history.pushState.apply(window.history,n);break;case"replace":window.history.replaceState.apply(window.history,n);break}};var nt=new DOMParser,z=class extends S{constructor(t=u(),e=document){super();this.url=t,typeof e=="string"?this.data=e:this.dom=e||document}build(){if(this.dom instanceof Node||(this.dom=nt.parseFromString(this.data,"text/html")),!(this.body instanceof Node)){let{title:t,head:e,body:i}=this.dom;this.title=t,this.head=e,this.body=i,this.wrapper=this.body.querySelector(this.wrapperAttr)}}install(){this.wrapperAttr=c(this.config,"wrapperAttr")}uninstall(){this.url=void 0,this.title=void 0,this.head=void 0,this.body=void 0,this.dom=void 0,this.wrapper=void 0,this.data=void 0,this.wrapperAttr=void 0}},st=class extends y{constructor(){super(...arguments);this.loading=new g}install(){this.pages=new R(this.app);let t=u().pathname;this.set(t,new z),t=void 0}get(t){return this.pages.get(t)}add(t){return this.pages.add(t),this}set(t,e){return this.pages.set(t,e),this}remove(t){return this.pages.remove(t),this}has(t){return this.pages.has(t)}clear(){return this.pages.clear(),this}get size(){return this.pages.size}keys(){return this.pages.keys()}async load(t=u()){let e=u(t),i=e.pathname,n,s;if(this.has(i))return n=this.get(i),Promise.resolve(n);this.loading.has(i)?s=this.loading.get(i):(s=this.request(i),this.loading.set(i,s));let o=await s;if(this.loading.remove(i),n=new z(e,o),this.set(i,n),this.size>c(this.config,"maxPages")){let l=u(),a=this.keys(),p=N(l,a[0])?a[1]:a[0],d=this.get(p);d.unregister(),d=void 0,a=void 0,l=void 0,p=void 0}return n}async request(t){let e=new Headers(c(this.config,"headers")),i=window.setTimeout(()=>{throw window.clearTimeout(i),"Request Timed Out!"},c(this.config,"timeout"));try{let n=await fetch(t,{mode:"same-origin",method:"GET",headers:e,cache:"default",credentials:"same-origin"});if(window.clearTimeout(i),n.status>=200&&n.status<300)return await n.text();throw new Error(n.statusText||""+n.status)}catch(n){throw window.clearTimeout(i),n}}};var J=({callback:r=()=>{},scope:t=null,name:e="event"})=>({callback:r,scope:t,name:e}),k=class extends g{constructor(t="event"){super();this.name=t}},O=class extends g{constructor(){super()}getEvent(t){let e=this.get(t);return e instanceof k?e:(this.set(t,new k(t)),this.get(t))}newListener(t,e,i){let n=this.getEvent(t);return n.add(J({name:t,callback:e,scope:i})),n}on(t,e,i){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let n,s,o=typeof t=="object"&&!Array.isArray(t),l=o?e:i;return o||(s=e),Object.keys(t).forEach(a=>{o?(n=a,s=t[a]):n=t[a],this.newListener(n,s,l)},this),this}removeListener(t,e,i){let n=this.get(t);if(n instanceof k&&e){let s=J({name:t,callback:e,scope:i});n.forEach((o,l)=>{if(o.callback===s.callback&&o.scope===s.scope)return n.remove(l)})}return n}off(t,e,i){if(typeof t=="undefined")return this;typeof t=="string"&&(t=t.trim().split(/\s/g));let n,s,o=typeof t=="object"&&!Array.isArray(t),l=o?e:i;return o||(s=e),Object.keys(t).forEach(a=>{o?(n=a,s=t[a]):n=t[a],typeof s=="function"?this.removeListener(n,s,l):this.remove(n)},this),this}emit(t,...e){return typeof t=="undefined"?this:(typeof t=="string"&&(t=t.trim().split(/\s/g)),t.forEach(i=>{let n=this.get(i);n instanceof k&&n.forEach(s=>{let{callback:o,scope:l}=s;o.apply(l,e)})},this),this)}clear(){return x(this,"clear"),super.clear(),this}};var F=(r,t=window.location.hash)=>{try{let e=t[0]=="#"?t:u(t).hash;if(e.length>1){let i=document.getElementById(e.slice(1));if(i){let{left:n,top:s}=i.getBoundingClientRect(),o=window.pageXOffset,l=window.pageYOffset,a=n+o,p=s+l;return console.log(a,p),w(a,p)}}}catch(e){console.warn("[hashAction] error",e)}return r??w(0,0)},ft={name:"default",scrollable:!0,out({done:r}){r()},in({scroll:r,done:t}){window.scroll(r.x,r.y),t()}},at=class extends y{constructor(t){super();this._arg=t}install(){super.install();let t=this._arg&&this._arg.length?this._arg:c(this.config,"transitions")??[];t=[["default",ft]].concat(t),this.transitions=new g(t)}get(t){return this.transitions.get(t)}set(t,e){return this.transitions.set(t,e),this}add(t){return this.transitions.add(t),this}has(t){return this.transitions.has(t)}async animate(t,e){let i=this.transitions.get(t),n=e.scroll,s=e.ignoreHashAction;if(!("wrapper"in e.oldPage)||!("wrapper"in e.newPage))throw`[Page] either oldPage or newPage aren't instances of the Page Class. + ${{newPage:e.newPage,oldPage:e.oldPage}}`;document.title=""+e.newPage.title;let o=e.oldPage.wrapper,l=e.newPage.wrapper;if(!(o instanceof Node)||!(l instanceof Node))throw`[Wrapper] the wrapper from the ${l instanceof Node?"current":"next"} page cannot be found. The wrapper must be an element that has the attribute ${c(this.config,"wrapperAttr")}.`;return i.init&&i?.init(e),this.emitter.emit("BEFORE_TRANSITION_OUT"),i.out&&await new Promise(a=>{i.out.call(i,{...e,from:e.oldPage,trigger:e.trigger,done:a})?.then(a)}),this.emitter.emit("AFTER_TRANSITION_OUT"),await new Promise(a=>{o.insertAdjacentElement("beforebegin",l),this.emitter.emit("CONTENT_INSERT"),!s&&!/back|popstate|forward/.test(e.trigger)&&(n=F(n)),a()}),await new Promise(a=>{o.remove(),o=void 0,l=void 0,this.emitter.emit("CONTENT_REPLACED"),a()}),this.emitter.emit("BEFORE_TRANSITION_IN"),i.in&&await new Promise(async a=>{i.in.call(i,{...e,from:e.oldPage,to:e.newPage,trigger:e.trigger,scroll:n,done:a})?.then(a)}),this.emitter.emit("AFTER_TRANSITION_IN"),i}};var ot=class{constructor(t={}){this.canResize=!0;this.canScroll=!0;this._resize=this._resize.bind(this),this._scroll=this._scroll.bind(this),this._ready=this._ready.bind(this),this.register(t)}register(t={}){return this.config=W(t),this.emitter=new O,this.services=new K(this),document.addEventListener("DOMContentLoaded",this._ready),window.addEventListener("load",this._ready),window.addEventListener("resize",this._resize,{passive:!0}),window.addEventListener("scroll",this._scroll,{passive:!0}),this}_ready(){document.removeEventListener("DOMContentLoaded",this._ready),window.removeEventListener("load",this._ready),this.emitter.emit("READY ready")}_resize(){if(this.canResize){let t,e;this.canResize=!1,e=window.requestAnimationFrame(()=>{this.emitter.emit("RESIZE resize"),t=window.setTimeout(()=>{this.canResize=!0,t=window.clearTimeout(t),e=window.cancelAnimationFrame(e)},c(this.config,"resizeDelay"))})}}_scroll(){if(this.canScroll){let t;this.canScroll=!1,t=requestAnimationFrame(()=>{this.emitter.emit("SCROLL scroll"),this.canScroll=!0,t=window.cancelAnimationFrame(t)})}}get(t){return this.services.get(t)}set(t,e){return this.services.set(t,e),this}add(t){return this.services.add(t),this}boot(){return this.services.init(),this.services.boot(),this}stop(){return this.services.stop(),this.emitter.clear(),this}on(t,e){return this.emitter.on(t,e,this),this}off(t,e){return this.emitter.off(t,e,this),this}emit(t,...e){return this.emitter.emit(t,...e),this}};var lt=class extends y{install(){super.install(),this.ignoreURLs=c(this.config,"ignoreURLs")??[],this.prefetchIgnore=c(this.config,"prefetchIgnore")??!1,this.stopOnTransitioning=c(this.config,"stopOnTransitioning")??!1,this.stickyScroll=c(this.config,"stickyScroll")??!1,this.forceOnError=c(this.config,"forceOnError")??!1,this.ignoreHashAction=c(this.config,"ignoreHashAction")??!1}transitionStart(){this.isTransitioning=!0}transitionStop(){this.isTransitioning=!1}init(){this.onHover=this.onHover.bind(this),this.onClick=this.onClick.bind(this),this.onStateChange=this.onStateChange.bind(this)}boot(){"scrollRestoration"in window.history&&(window.history.scrollRestoration="manual"),super.boot()}getTransitionName(t){if(!t||!t.getAttribute)return null;let e=t.getAttribute(c(this.config,"transitionAttr",!1));return typeof e=="string"?e:null}validLink(t,e,i){let n=!window.history.pushState,s=!t||!i,o=e.metaKey||e.ctrlKey||e.shiftKey||e.altKey,l=t.hasAttribute("target")&&t.target==="_blank",a=t.protocol!==location.protocol||t.hostname!==location.hostname,p=typeof t.getAttribute("download")=="string",d=t.matches(c(this.config,"preventSelfAttr")),P=Boolean(t.closest(c(this.config,"preventAllAttr"))),T=E(u())===E(u(i));return!(s||n||o||l||a||p||d||P||T)}getHref(t){return t&&t.tagName&&t.tagName.toLowerCase()==="a"&&typeof t.href=="string"?t.href:null}getLink(t){let e=t.target,i=this.getHref(e);for(;e&&!i;)e=e.parentNode,i=this.getHref(e);if(!(!e||!this.validLink(e,t,i)))return e}onClick(t){let e=this.getLink(t);if(!e)return;if(this.isTransitioning&&this.stopOnTransitioning){t.preventDefault(),t.stopPropagation();return}let i=this.getHref(e);this.emitter.emit("ANCHOR_CLICK CLICK",t),this.go({href:i,trigger:e,event:t})}getDirection(t){return Math.abs(t)>1?t>0?"forward":"back":t===0?"popstate":t>0?"back":"forward"}force(t){window.location.assign(t)}go({href:t,trigger:e="HistoryManager",event:i}){if(this.isTransitioning&&this.stopOnTransitioning||!(this.manager.has("TransitionManager")&&this.manager.has("HistoryManager")&&this.manager.has("PageManager"))){this.force(t);return}let n=this.manager.get("HistoryManager"),s=w(0,0),o=n.current,l=o.url;if(N(l,t))return;let a;if(i&&i.state){this.emitter.emit("POPSTATE",i);let{state:p}=i,{index:d}=p,T=o.index-d;n.replace(p.states),n.pointer=d;let v=n.get(d);a=v.transition,s=v.data.scroll,e=this.getDirection(T),console.log(e=="forward"&&n),this.emitter.emit(e==="back"?"POPSTATE_BACK":"POPSTATE_FORWARD",i)}else{a=this.getTransitionName(e),s=w();let p=D({url:t,transition:a,data:{scroll:s}});!this.stickyScroll&&(s=w(0,0)),n.add(p),this.emitter.emit("HISTORY_NEW_ITEM",i)}return i&&(i.stopPropagation(),i.preventDefault()),this.emitter.emit("GO",i),this.load({oldHref:l,href:t,trigger:e,transitionName:a,scroll:s})}async load({oldHref:t,href:e,trigger:i,transitionName:n="default",scroll:s={x:0,y:0}}){try{let o=this.manager.get("PageManager"),l,a;this.emitter.emit("NAVIGATION_START",{oldHref:t,href:e,trigger:i,transitionName:n});try{this.transitionStart(),a=await o.load(t),!(a.dom instanceof Element)&&a.build(),this.emitter.emit("PAGE_LOADING",{href:e,oldPage:a,trigger:i}),l=await o.load(e),await l.build(),this.emitter.emit("PAGE_LOAD_COMPLETE",{newPage:l,oldPage:a,trigger:i})}catch(p){console.warn(`[PJAX] Page load error: ${p}`)}try{let p=this.manager.get("TransitionManager");this.emitter.emit("TRANSITION_START",n);let d=await p.animate(p.has(n)?n:"default",{oldPage:a,newPage:l,trigger:i,scroll:s,ignoreHashAction:this.ignoreHashAction});d.scrollable||(!this.ignoreHashAction&&!/back|popstate|forward/.test(i)&&(s=F(s)),window.scroll(s.x,s.y)),this.emitter.emit("TRANSITION_END",{transition:d})}catch(p){console.warn(`[PJAX] Transition error: ${p}`)}this.emitter.emit("NAVIGATION_END",{oldPage:a,newPage:l,trigger:i,transitionName:n})}catch(o){this.forceOnError?this.force(e):console.warn(o)}finally{this.transitionStop()}}ignoredURL({pathname:t}){return this.ignoreURLs.length&&this.ignoreURLs.some(e=>typeof e=="string"?e===t:e.exec(t)!==null)}onHover(t){let e=this.getLink(t);if(!e||!this.manager.has("PageManager"))return;let i=this.manager.get("PageManager"),n=u(this.getHref(e)),s=n.pathname;if(!(this.ignoredURL(n)||i.has(s))){this.emitter.emit("ANCHOR_HOVER HOVER",t);try{i.load(n)}catch(o){console.warn("[PJAX] prefetch error,",o)}}}onStateChange(t){this.go({href:window.location.href,trigger:"popstate",event:t})}initEvents(){this.prefetchIgnore!==!0&&(document.addEventListener("mouseover",this.onHover),document.addEventListener("touchstart",this.onHover)),document.addEventListener("click",this.onClick),window.addEventListener("popstate",this.onStateChange)}stopEvents(){this.prefetchIgnore!==!0&&(document.removeEventListener("mouseover",this.onHover),document.removeEventListener("touchstart",this.onHover)),document.removeEventListener("click",this.onClick),window.removeEventListener("popstate",this.onStateChange)}};var pt=class extends y{constructor(t=[]){super();this.routes=new g;for(let e of t)this.add(e)}add({path:t,method:e}){let i=this.parse(t);return this.routes.set(i,e),this}parsePath(t){if(typeof t=="string")return new RegExp(t,"i");if(t instanceof RegExp||typeof t=="boolean")return t;throw"[Router] only regular expressions, strings and booleans are accepted as paths."}isPath(t){return typeof t=="string"||t instanceof RegExp||typeof t=="boolean"}parse(t){let e=t,i={from:/(.*)/g,to:/(.*)/g};if(this.isPath(t))i={from:!0,to:t};else if(this.isPath(e.from)&&this.isPath(e.to))i=e;else throw"[Router] path is neither a string, regular expression, or a { from, to } object.";let{from:n,to:s}=i;return{from:this.parsePath(n),to:this.parsePath(s)}}route(){if(this.manager.has("HistoryManager")){let t=this.manager.get("HistoryManager"),e=E(u((t.length>1?t.previous:t.current).url)),i=E(u());this.routes.forEach((n,s)=>{let o=s.from,l=s.to;if(typeof o=="boolean"&&typeof l=="boolean")throw`[Router] path ({ from: ${o}, to: ${l} }) is not valid, remember paths can only be strings, regular expressions, or a boolean; however, both the from and to paths cannot be both booleans.`;let a=o,p=l;o instanceof RegExp&&o.test(e)&&(a=o.exec(e)),l instanceof RegExp&&l.test(i)&&(p=l.exec(i)),(Array.isArray(p)&&Array.isArray(a)||Array.isArray(p)&&typeof a=="boolean"&&a||Array.isArray(a)&&typeof p=="boolean"&&p)&&n({from:a,to:p,path:{from:e,to:i}})})}else console.warn("[Route] HistoryManager is missing.")}initEvents(){this.emitter.on("READY",this.route,this),this.emitter.on("CONTENT_REPLACED",this.route,this)}stopEvents(){this.emitter.off("READY",this.route,this),this.emitter.off("CONTENT_REPLACED",this.route,this)}};var ct=r=>typeof r=="string"?Array.from(document.querySelectorAll(r)):[r],bt=r=>[].concat(...r),U=r=>Array.isArray(r)?bt(r.map(U)):typeof r=="string"||r instanceof Node?ct(r):r instanceof NodeList||r instanceof HTMLCollection?Array.from(r):[],j=(r,t,e)=>typeof r=="function"?r.apply(e,t):r,_=(r,t,e)=>{let i,n,s={},o=Object.keys(r);for(let l=0,a=o.length;l/^(in|out)/.test(r)?ut[r]:r,V={keyframes:[],loop:1,delay:0,speed:1,endDelay:0,easing:"ease",autoplay:!0,duration:1e3,fillMode:"auto",direction:"normal",extend:{}},M=class{constructor(t={}){this.options={};this.targets=[];this.properties={};this.animations=new g;this.totalDuration=0;this.minDelay=0;this.computedOptions=new g;this.emitter=new O;try{let{options:e,...i}=t,n=e instanceof M?e.getOptions():Array.isArray(e)?e?.[0]?.getOptions():e;this.options=Object.assign({},V,n,i),this.loop=this.loop.bind(this);let{loop:s,delay:o,speed:l,easing:a,endDelay:p,duration:d,direction:P,fillMode:T,onfinish:v,target:G,keyframes:q,autoplay:$,extend:B,...Y}=this.options;this.mainElement=document.createElement("div"),this.targets=U(G),this.properties=Y;let C=[],b=this.targets.length,I;for(let m=0;m0||(I=_(I,[m,b,f],this));let H=h.delay+h.duration*h.iterations+h.endDelay;this.totalDuration{typeof v=="function"&&v.call(this,f,m,b,A),this.emit("finish",f,m,b,A)},this.computedOptions.set(A,h),this.animations.set(f,A),C.push(h.delay)}this.mainAnimation=this.mainElement.animate([{opacity:"0"},{opacity:"1"}],{duration:this.totalDuration,easing:"linear"}),this.minDelay=Math.min(...C),this.setSpeed(l),$?this.play():this.pause(),this.promise=this.newPromise(),this.mainAnimation.onfinish=()=>{this.emit("complete",this),this.stopLoop()}}catch(e){this.emit("error",e)}}newPromise(){return new Promise((t,e)=>{this.on("complete",()=>t([this])),this.on("error",i=>e(i))})}then(t,e){return t=t?.bind(this),e=e?.bind(this),this.promise.then(t,e),this}catch(t){return t=t?.bind(this),this.promise.catch(t),this}finally(t){return t=t?.bind(this),this.promise.finally(t),this}loop(){this.stopLoop(),this.emit("update",this.getProgress(),this),this.animationFrame=window.requestAnimationFrame(this.loop)}stopLoop(){window.cancelAnimationFrame(this.animationFrame)}all(t){return t(this.mainAnimation,this.mainElement),this.animations.forEach(t),this}beginEvent(){if(this.getProgress()==0){let t=window.setTimeout(()=>{this.emit("begin",this),t=window.clearTimeout(t)},this.minDelay)}}play(){let t=this.getPlayState();return this.beginEvent(),this.all(e=>e.play()),this.emit("play",t,this),this.loop(),this}pause(){let t=this.getPlayState();return this.all(e=>e.pause()),this.emit("pause",t,this),this.stopLoop(),this.animationFrame=void 0,this}reset(){return this.setProgress(0),this.beginEvent(),this.options.autoplay?this.play():this.pause(),this}cancel(){return this.all(t=>t.cancel()),this.stopLoop(),this}finish(){return this.all(t=>t.finish()),this.stopLoop(),this}stop(){for(this.cancel(),this.animations.clear();this.targets.length;)this.targets.pop();this.mainElement=void 0,this.emit("stop")}getTargets(){return this.targets}getAnimation(t){return this.animations.get(t)}getTiming(t){let e=t instanceof Animation?t:this.getAnimation(t),i=this.computedOptions.get(e)??{},n=e.effect?.getTiming()??{},s=this.getOptions();return{...V,...s,...n,...i}}getTotalDuration(){return this.totalDuration}getCurrentTime(){return this.mainAnimation.currentTime}getProgress(){return this.getCurrentTime()/this.totalDuration*100}getSpeed(){return this.mainAnimation.playbackRate}getPlayState(){return this.mainAnimation.playState}getOptions(){return this.options}setCurrentTime(t){return this.all(e=>{e.currentTime=t}),this.emit("update",this.getProgress()),this}setProgress(t){let e=t/100*this.totalDuration;return this.setCurrentTime(e),this}setSpeed(t=1){return this.all(e=>{e.playbackRate=t}),this}on(t,e,i){return this.emitter.on(t,e,i??this),this}off(t,e,i){return this.emitter.off(t,e,i??this),this}emit(t,...e){return this.emitter.emit(t,...e),this}toJSON(){return this.getOptions()}get[Symbol.toStringTag](){return"Animate"}},yt=(r={})=>new M(r),ht=class extends M{constructor(t={}){super();this.animations=new g;try{let{options:e,...i}=t,n=e instanceof M?e.getOptions():Array.isArray(e)?e?.[0]?.getOptions():e;this.options=Object.assign({},V,n,i),this.loop=this.loop.bind(this);let{loop:s,delay:o,speed:l,easing:a,endDelay:p,duration:d,direction:P,fillMode:T,onfinish:v,target:G,keyframes:q,autoplay:$,extend:B,...Y}=this.options;this.mainElement=document.createElement("div"),this.targets=U(G),this.properties=Y;let C=[],b=this.targets.length,I;for(let m=0;m0||(I=_(I,[m,b,f],this));let H=h.delay+h.duration*h.iterations+h.endDelay;this.totalDuration{typeof v=="function"&&v.call(this,f,m,b,A),this.emit("finish",f,m,b,A)},this.computedOptions.set(A,h),this.animations.set(f,A),C.push(h.delay)}this.mainAnimation=this.mainElement.animate([{opacity:"0"},{opacity:"1"}],{duration:this.totalDuration,easing:"linear"}),this.minDelay=Math.min(...C),this.setSpeed(l),$?this.play():this.pause(),this.promise=this.newPromise(),this.mainAnimation.onfinish=()=>{this.emit("complete",this),this.stopLoop()}}catch(e){this.emit("error",e)}}add(t){return this}};return At;})(); //# sourceMappingURL=api.js.map diff --git a/packages/native/lib/api.js.map b/packages/native/lib/api.js.map index f3d8f9e..35fa425 100644 --- a/packages/native/lib/api.js.map +++ b/packages/native/lib/api.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../src/api.ts", "../src/config.ts", "../../manager/src/api.ts", "../src/manager.ts", "../src/url.ts", "../src/service.ts", "../src/history.ts", "../src/page.ts", "../../emitter/src/api.ts", "../src/transition.ts", "../src/app.ts", "../src/pjax.ts", "../src/router.ts", "../../animate/src/api.ts"], - "sourcesContent": ["export * from \"./config\";\nexport * from \"./manager\";\nexport * from \"./url\";\n\nexport * from \"./history\";\nexport * from \"./page\";\n\nexport * from \"./emitter\";\nexport * from \"./service\";\n\nexport * from \"./transition\";\n\nexport * from \"./app\";\nexport * from \"./pjax\";\nexport * from \"./router\";\n\nexport * from \"./animate\";\n", "export interface ICONFIG {\n prefix?: string;\n wrapperAttr?: string;\n noAjaxLinkAttr?: string;\n noPrefetchAttr?: \"no-prefetch\";\n headers?: string[][];\n preventSelfAttr?: string;\n preventAllAttr?: string;\n transitionAttr?: string;\n blockAttr?: string;\n timeout?: number;\n maxPages?: number;\n [key: string]: any;\n}\n\nexport const CONFIG_DEFAULTS = {\n wrapperAttr: \"wrapper\",\n noAjaxLinkAttr: \"no-ajax-link\",\n noPrefetchAttr: \"no-prefetch\",\n headers: [\n [\"x-partial\", \"true\"]\n ],\n preventSelfAttr: `prevent=\"self\"`,\n preventAllAttr: `prevent=\"all\"`,\n transitionAttr: \"transition\",\n blockAttr: `block`,\n timeout: 30000,\n maxPages: 5\n};\n\nexport type ConfigKeys = keyof typeof CONFIG_DEFAULTS | string;\nexport const newConfig = (config: ICONFIG): ICONFIG => {\n return Object.assign({ ...CONFIG_DEFAULTS }, config);\n};\n\n/** Converts string into properly formatted data attributes */\nexport const toAttr = (config: ICONFIG, value: string, brackets: boolean = true): string => {\n let { prefix } = config;\n let attr = `data${prefix ? \"-\" + prefix : \"\"}-${value}`;\n return brackets ? `[${attr}]` : attr;\n};\n\n/** Selects config vars, and formats them for use, or simply returns the current configurations for the framework */\nexport const getConfig = (config: ICONFIG, value?: ConfigKeys, brackets: boolean = true): any => {\n if (typeof value !== \"string\")\n return config;\n\n let prop = config[value];\n if (typeof prop === \"string\")\n return toAttr(config, prop, brackets);\n return prop;\n};\n", "/** Manages complex lists of named data, eg. A page can be stored in a list by of other pages with the url being how the page is stored in the list. Managers use Maps to store data */\nexport class Manager {\n\t/** The complex list of named data, to which the Manager controls */\n\tpublic map: Map;\n\tconstructor(value?: Array<[K, V]>) {\n\t\tthis.map = new Map(value);\n\t}\n\n\t/** Returns the Manager classes base Map */\n\tpublic getMap(): Map {\n\t\treturn this.map;\n\t}\n\n\t/** Get a value stored in the Manager */\n\tpublic get(key: K): V {\n\t\treturn this.map.get(key);\n\t}\n\n\t/** Returns the keys of all items stored in the Manager as an Array */\n\tpublic keys(): Array {\n\t\treturn Array.from(this.map.keys());\n\t}\n\n\t/** Returns the values of all items stored in the Manager as an Array */\n\tpublic values(): Array {\n\t\treturn Array.from(this.map.values());\n\t}\n\n\t/** Set a value to the Manager using a key */\n\tpublic set(key: K, value: V): Manager {\n\t\tthis.map.set(key, value);\n\t\treturn this;\n\t}\n\n\t/** Adds a value to Manager, and uses the current size of the Manager as it's key, it works best when all the key in the Manager are numbers */\n\tpublic add(value: V): Manager {\n\t\tlet size = this.size;\n\t\t// @ts-ignore\n\t\tlet num: K = size as K;\n\t\tthis.set(num, value);\n\t\treturn this;\n\t}\n\n\t/** Returns the total number of items stored in the Manager */\n\tpublic get size(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** An alias for size */\n\tpublic get length(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** Returns the last item in the Manager who's index is a certain distance from the last item in the Manager */\n\tpublic last(distance: number = 1): V | undefined {\n\t\tlet key = this.keys()[this.size - distance];\n\t\treturn this.get(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns true if an element in the Map object existed and has been removed, or false if the element does not exist */\n\tpublic delete(key: K): boolean {\n\t\treturn this.map.delete(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns the Manager class, allowing for chains */\n\tpublic remove(key: K): Manager {\n\t\tthis.map.delete(key);\n\t\treturn this;\n\t}\n\n\t/** Clear the Manager of all its contents */\n\tpublic clear(): Manager {\n\t\tthis.map.clear();\n\t\treturn this;\n\t}\n\n\t/** Checks if the Manager contains a certain key */\n\tpublic has(key: K): boolean {\n\t\treturn this.map.has(key);\n\t}\n\n\t/** Returns a new Iterator object that contains an array of [key, value] for each element in the Map object in insertion order. */\n\tpublic entries(): IterableIterator<[K, V]> {\n\t\treturn this.map.entries();\n\t}\n\n\t/** Iterates through the Managers contents, calling a callback function every iteration */\n\tpublic forEach(\n\t\tcallback: (value?: V, key?: K, map?: Map) => void,\n\t\tcontext?: object\n\t): Manager {\n\t\tthis.map.forEach(callback, context);\n\t\treturn this;\n\t}\n\n\t/** Allows for iteration via for..of, learn more: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators] */\n\tpublic [Symbol.iterator](): IterableIterator<[K, V]> {\n\t\treturn this.entries();\n\t}\n}\n\n/**\n * Calls the method of a certain name for all items that are currently installed\n */\nexport const methodCall = (manager: Manager, method: string, ...args: any): void => {\n\tmanager.forEach((item) => {\n\t\t// @ts-ignore\n\t\titem[method](...args);\n\t});\n};\n\n/**\n * Asynchronously calls the method of a certain name for all items that are currently installed, similar to methodCall\n */\nexport const asyncMethodCall = async (manager: Manager, method: string, ...args: any): Promise => {\n\tfor (let [, item] of manager) {\n\t\t// @ts-ignore\n\t\tawait item[method](...args);\n\t}\n};\n\nexport default Manager;\n", "import { Manager, methodCall, asyncMethodCall } from \"@okikio/manager\";\nimport { ICONFIG } from \"./config\";\nimport { IApp } from \"./app\";\nimport { EventEmitter } from \"./emitter\";\n\nexport type IAdvancedManager = AdvancedManager;\n\n/** The base class for AdvancedManager items */\nexport class ManagerItem {\n /** The AdvancedManager the ManagerItem is attached to */\n public manager: IAdvancedManager;\n\n /** The App the ManagerItem is attached to */\n public app: IApp;\n\n /** The Config of the App the ManagerItem is attached to */\n public config: ICONFIG;\n\n /** The EventEmitter of the App the ManagerItem is attached to */\n public emitter: EventEmitter;\n\n /** The key to where ManagerItem is stored in an AdvancedManager */\n public key: any;\n\n constructor() { }\n\n /** Run after the Manager Item has been registered */\n public install(): any { }\n\n /** Register the current Manager Item's manager */\n public register(manager: IAdvancedManager, key: any): ManagerItem {\n this.manager = manager;\n this.app = manager.app;\n this.config = manager.config;\n this.emitter = manager.emitter;\n this.key = key;\n this.install();\n return this;\n }\n\n /** Run before the ManagerItem has been unregistered */\n public uninstall(): any { }\n\n /** Basically removes a ManagerItem, in order to recover the ManagerItem, it needs to be re-added to an AdvancedManager */\n public unregister() {\n this.uninstall();\n\n this.manager.remove(this.key);\n this.key = undefined;\n this.manager = undefined;\n this.app = undefined;\n this.config = undefined;\n this.emitter = undefined;\n }\n}\n\n/** A tweak to the Manager class that makes it self aware of the App class it's instantiated in */\nexport class AdvancedManager extends Manager {\n /** The App the AdvancedManager is attached to */\n public app: IApp;\n\n /** The Config of the App the AdvancedManager is attached to */\n public config: ICONFIG;\n\n /** The EventEmitter of the App the AdvancedManager is attached to */\n public emitter: EventEmitter;\n\n /** Register App details */\n constructor(app: IApp) {\n super();\n this.app = app;\n this.config = app.config;\n this.emitter = app.emitter;\n }\n\n /** Add a ManagerItem to AdvancedManager at a specified key */\n public set(key: K, value: V) {\n super.set(key, value);\n value.register(this, key);\n return this;\n }\n}\n\nexport { Manager, methodCall, asyncMethodCall };\n", "export const newURL = (url: string | URL | Location = window.location.href): URL => {\n return url instanceof URL ? url : new URL(url as unknown as string, window.location.origin);\n};\n\n/** Returns the pathname with the hash at the end */\nexport const getHashedPath = (url: URL | string): string => {\n let _url = newURL(url);\n return `${_url.pathname}${_url.hash}`;\n};\n\n/** Returns the actual hash without the hashtag */\nexport const getHash = (url: URL | string): string => newURL(url).hash.slice(1);\n\n/** Removes the hash from the full URL for a clean URL string */\nexport const clean = (url: URL | string): string => newURL(url).toString().replace(/(\\/#.*|\\/|#.*)$/, '');\n\n/** Compares two URLs to each other */\nexport const equal = (a: URL | string, b: URL | string): boolean => (clean(a) === clean(b));\n\n", "import { AdvancedManager, ManagerItem, methodCall } from \"./manager\";\nimport { IApp } from \"./app\";\n\n/** Controls specific kinds of actions that require JS */\nexport class Service extends ManagerItem {\n\t/** Called before the start of a Service, represents a constructor of sorts */\n\tpublic init(...args: any): any;\n\tpublic init(): any { }\n\n\t/** Called on start of Service */\n\tpublic boot(...args: any): any;\n\tpublic boot(): any {\n\t\tthis.initEvents();\n\t}\n\n\t/** Initialize events */\n\tpublic initEvents(): void { }\n\n\t/** Stop events */\n\tpublic stopEvents(): void { }\n\n\t/** Stop services */\n\tpublic stop(): void {\n\t\tthis.stopEvents();\n\t\tthis.unregister();\n\t}\n}\n\n/** The Service Manager controls the lifecycle of all Services in an App */\nexport class ServiceManager extends AdvancedManager {\n\tconstructor(app: IApp) {\n\t\tsuper(app);\n\t}\n\n\t/** Call the init method for all Services */\n\tpublic init(): ServiceManager {\n\t\tmethodCall(this, \"init\");\n\t\treturn this;\n\t}\n\n\t/** Call the boot method for all Services */\n\tpublic boot(): ServiceManager {\n\t\tmethodCall(this, \"boot\");\n\t\treturn this;\n\t}\n\n\t/** Call the stop method for all Services */\n\tpublic stop(): ServiceManager {\n\t\tmethodCall(this, \"stop\");\n\t\treturn this;\n\t}\n}\n", "import { Service } from \"./service\";\nimport { getHashedPath, newURL } from \"./url\";\n\nexport type Trigger = HTMLAnchorElement | \"HistoryManager\" | \"popstate\" | \"back\" | \"forward\";\nexport interface ICoords {\n\treadonly x: number;\n\treadonly y: number;\n}\n\nexport interface IStateData {\n\tscroll: ICoords;\n\t[key: string]: any;\n}\n\nexport interface IState {\n\turl: string;\n\tindex?: number;\n\ttransition: string;\n\tdata: IStateData;\n}\n\nexport interface IHistoryItem {\n\tindex: number;\n\tstates: IState[];\n}\n\nexport interface IHistoryManager extends Service {\n\tstates: IState[],\n\tpointer: number,\n\n\tinit(): any,\n\tget(index: number): IState,\n\tadd(value?: IState, historyAction?: \"replace\" | \"push\"): HistoryManager,\n\tremove(index?: number): HistoryManager,\n\treplace(newStates: IState[]): HistoryManager,\n\tset(i: number, state: IState): IState,\n\tcurrent: IState,\n\tlast: IState,\n\tprevious: IState | null,\n\tlength: number,\n}\n\n/** A quick snapshot of page scroll coordinates */\nexport const newCoords = (x: number = window.scrollX, y: number = window.scrollY): ICoords => ({ x, y });\n\n/** Creates a state; a state represents the current status of the page consisting of properties like: url, transition, and data */\nexport const newState = (state: IState = {\n\turl: getHashedPath(newURL()),\n\tindex: 0,\n\ttransition: \"default\",\n\tdata: {\n\t\tscroll: newCoords(),\n\t\ttrigger: \"HistoryManager\"\n\t}\n}): IState => (state);\n\n/** Keeps a record of the history of the App; it stores only the states of Pages */\nexport class HistoryManager extends Service implements IHistoryManager {\n\tpublic states: IState[];\n\tpublic pointer = -1;\n\n\t/** Initializes the states array, and replace the history pushState data with the states array */\n\tinit() {\n\t\tthis.states = [];\n\n\t\tlet state = newState();\n\t\tthis.add(state, \"replace\");\n\t}\n\n\t/** Get a state based on it's index */\n\tpublic get(index: number) {\n\t\treturn this.states[index];\n\t}\n\n\t/** Add a state to HistoryManager and change the history pushState data based on the historyAction specified */\n\tpublic add(value?: IState, historyAction: \"replace\" | \"push\" = \"push\"): HistoryManager {\n\t\tlet state = newState(value);\n\t\tlet len = this.length;\n\t\tthis.states.push({ ...state });\n\t\tthis.pointer = len;\n\n\t\tlet item: IHistoryItem = {\n\t\t\tindex: this.pointer,\n\t\t\tstates: [...this.states]\n\t\t};\n\t\tchangeState(historyAction, state, item);\n\t\treturn this;\n\t}\n\n\tpublic remove(index?: number) {\n\t\tif (index) {\n\t\t\tthis.states.splice(index, 1);\n\t\t} else {\n\t\t\tthis.states.pop();\n\t\t}\n\n\t\tthis.pointer--;\n\t\treturn this;\n\t}\n\n\t/** Replaces the states array with another states array, this is later used when going back and forward in page history */\n\tpublic replace(newStates: IState[]) {\n\t\tthis.states = newStates;\n\t\treturn this;\n\t}\n\n\t/** Set state by index. */\n\tpublic set(i: number, state: IState) {\n\t\treturn (this.states[i] = state);\n\t}\n\n\t/** Get the current state */\n\tget current(): IState {\n\t\treturn this.get(this.pointer);\n\t}\n\n\t/** Get the last state (top of the history stack). */\n\tget last(): IState {\n\t\treturn this.get(this.length - 1);\n\t}\n\n\t/** Get the previous state. */\n\tget previous(): IState | null {\n\t\treturn this.pointer < 1 ? null : this.get(this.pointer - 1);\n\t}\n\n\tget length() {\n\t\treturn this.states.length;\n\t}\n}\n\n/** Either push or replace history state */\nexport const changeState = (action: \"push\" | \"replace\", state: IState, item: object) => {\n\tlet href = getHashedPath(state.url);\n\tlet args = [item, \"\", href];\n\tif (window.history) {\n\t\tswitch (action) {\n\t\t\tcase \"push\":\n\t\t\t\twindow.history.pushState.apply(window.history, args);\n\t\t\t\tbreak;\n\t\t\tcase \"replace\":\n\t\t\t\twindow.history.replaceState.apply(window.history, args);\n\t\t\t\tbreak;\n\t\t}\n\t}\n};\n", "import { Manager, ManagerItem, AdvancedManager } from \"./manager\";\nimport { equal, newURL } from \"./url\";\nimport { getConfig } from \"./config\";\nimport { Service } from \"./service\";\n\nexport interface IPage extends ManagerItem {\n dom: Document,\n wrapper: HTMLElement,\n title: string,\n head: Element,\n body: Element,\n url: URL,\n data: string,\n wrapperAttr: string,\n\n build(): any,\n install(): void,\n uninstall(): any,\n}\n\n/**\n * Parses strings to DOM\n */\nexport const PARSER: DOMParser = new DOMParser();\n\n/** A page represents the DOM elements that create each page */\nexport class Page extends ManagerItem implements IPage {\n /** Holds the DOM of the current page */\n public dom: Document;\n\n /** Holds the wrapper element to be swapped out of each Page */\n public wrapper: HTMLElement;\n\n /** Holds the title of each page */\n public title: string;\n\n /** Holds the head element of each page */\n public head: Element;\n\n /** Holds the body element of each page */\n public body: Element;\n\n /** The URL of the current page */\n public url: URL;\n\n /** The payload of a page request */\n public data: string;\n\n /** Attr that identifies the wrapper */\n public wrapperAttr: string;\n\n constructor(url: URL = newURL(), dom: string | Document = document) {\n super();\n this.url = url;\n\n if (typeof dom === \"string\") {\n this.data = dom;\n } else this.dom = dom || document;\n }\n\n /** Builds the page's dom, and sets the title, head, body, and wrapper properties of the Page class */\n public build() {\n if (!(this.dom instanceof Node)) {\n this.dom = PARSER.parseFromString(this.data, \"text/html\");\n }\n\n if (!(this.body instanceof Node)) {\n let { title, head, body } = this.dom;\n this.title = title;\n this.head = head;\n this.body = body;\n this.wrapper = this.body.querySelector(this.wrapperAttr);\n }\n }\n\n public install() {\n this.wrapperAttr = getConfig(this.config, \"wrapperAttr\");\n }\n\n public uninstall() {\n this.url = undefined;\n this.title = undefined;\n this.head = undefined;\n this.body = undefined;\n this.dom = undefined;\n this.wrapper = undefined;\n this.data = undefined;\n this.wrapperAttr = undefined;\n }\n}\n\nexport interface IPageManager extends Service {\n loading: Manager>,\n pages: AdvancedManager;\n\n install(): any,\n\n get(key): Page,\n add(value): PageManager,\n set(key, value): PageManager,\n remove(key): PageManager,\n has(key): boolean,\n clear(): PageManager,\n size: number,\n keys(): any[],\n\n load(_url: URL | string): Promise,\n request(url: string): Promise,\n}\n\n/** Controls which page to load */\nexport class PageManager extends Service implements IPageManager {\n /** Stores all fetch requests that are currently loading */\n public loading: Manager> = new Manager();\n\n pages: AdvancedManager;\n\n /** Instantiate pages, and add the current page to pages */\n install() {\n this.pages = new AdvancedManager(this.app);\n\n let URLString = newURL().pathname;\n this.set(URLString, new Page());\n URLString = undefined;\n }\n\n get(key) { return this.pages.get(key); }\n add(value) { this.pages.add(value); return this; }\n set(key, value) { this.pages.set(key, value); return this; }\n remove(key) { this.pages.remove(key); return this; }\n has(key) { return this.pages.has(key); }\n clear() { this.pages.clear(); return this; }\n get size() { return this.pages.size; }\n keys() { return this.pages.keys(); }\n\n /** Load from cache or by requesting URL via a fetch request, avoid requesting for the same thing twice by storing the fetch request in \"this.loading\" */\n public async load(_url: URL | string = newURL()): Promise {\n let url: URL = newURL(_url);\n let urlString: string = url.pathname;\n let page: Page, request: Promise;\n\n if (this.has(urlString)) {\n page = this.get(urlString);\n return Promise.resolve(page);\n }\n\n if (!this.loading.has(urlString)) {\n request = this.request(urlString);\n this.loading.set(urlString, request);\n } else request = this.loading.get(urlString);\n\n let response = await request;\n this.loading.remove(urlString);\n\n page = new Page(url, response);\n this.set(urlString, page);\n\n if (this.size > getConfig(this.config, \"maxPages\")) {\n let currentUrl = newURL();\n let keys = this.keys();\n let first = equal(currentUrl, keys[0]) ? keys[1] : keys[0];\n let page = this.get(first);\n page.unregister();\n page = undefined;\n keys = undefined;\n currentUrl = undefined;\n first = undefined;\n }\n\n return page;\n }\n\n /** Starts a fetch request */\n public async request(url: string): Promise {\n const headers = new Headers(getConfig(this.config, \"headers\"));\n const timeout = window.setTimeout(() => {\n window.clearTimeout(timeout);\n throw \"Request Timed Out!\";\n }, getConfig(this.config, \"timeout\"));\n\n try {\n let response = await fetch(url, {\n mode: 'same-origin',\n method: \"GET\",\n headers,\n cache: \"default\",\n credentials: \"same-origin\",\n });\n\n window.clearTimeout(timeout);\n if (response.status >= 200 && response.status < 300) {\n return await response.text();\n }\n\n const err = new Error(response.statusText || \"\" + response.status);\n throw err;\n } catch (err) {\n window.clearTimeout(timeout);\n throw err;\n }\n }\n}\n", "import { Manager, methodCall } from \"@okikio/manager\";\n\nexport type ListenerCallback = ((...args: any) => void);\nexport interface IListener {\n readonly callback: ListenerCallback;\n readonly scope: object;\n readonly name: string;\n}\n\n/** Represents a new event listener consisting of properties like: callback, scope, name */\nexport const newListener = ({\n callback = () => { },\n scope = null,\n name = \"event\",\n}: IListener): IListener => ({ callback, scope, name });\n\n/** Represents a new event */\nexport class Event extends Manager {\n /** The name of the event */\n public name: string;\n constructor(name: string = \"event\") {\n super();\n this.name = name;\n }\n}\n\nexport type EventInput = string | object | Array;\n\n/**\n * An Event Emitter\n * */\nexport class EventEmitter extends Manager {\n constructor() {\n super();\n }\n\n /** Gets event, if event doesn't exist create a new one */\n public getEvent(name: string): Event {\n let event = this.get(name);\n if (!(event instanceof Event)) {\n this.set(name, new Event(name));\n return this.get(name);\n }\n\n return event;\n }\n\n /** Creates a listener and adds it to an event */\n public newListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event = this.getEvent(name);\n event.add(newListener({ name, callback, scope }));\n return event;\n }\n\n /** Adds a listener to a given event */\n public on(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n this.newListener(_name, _callback, _scope);\n }, this);\n return this;\n }\n\n /** Removes a listener from an event */\n public removeListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event: Event = this.get(name);\n if (event instanceof Event && callback) {\n let listener = newListener({ name, callback, scope });\n\n event.forEach((value: IListener, i: number) => {\n if (\n value.callback === listener.callback &&\n value.scope === listener.scope\n ) {\n return event.remove(i);\n }\n });\n }\n\n return event;\n }\n\n /** Remove a listener from a given event, or just completely remove an event */\n public off(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n if (typeof _callback === \"function\") {\n this.removeListener(_name, _callback, _scope);\n } else this.remove(_name);\n }, this);\n return this;\n }\n\n /** Call all listeners within an event */\n public emit(\n events: string | Array,\n ...args: any\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n // Loop through the list of events\n events.forEach((event: string) => {\n let _event: Event = this.get(event);\n\n if (_event instanceof Event) {\n _event.forEach((listener: IListener) => {\n let { callback, scope } = listener;\n callback.apply(scope, args);\n });\n }\n }, this);\n return this;\n }\n\n /** Clears events and event listeners */\n public clear() {\n methodCall(this, \"clear\");\n super.clear();\n return this;\n }\n}\n\nexport default EventEmitter;\n", "import { Manager } from \"./manager\";\nimport { ICoords, newCoords, Trigger } from \"./history\";\nimport { IPage } from \"./page\";\nimport { getConfig } from \"./config\";\nimport { Service } from \"./service\";\nimport { newURL } from \"./url\";\n\n/**\n * The async function type, allows for smooth transition between Promises\n */\nexport type asyncFn = (err?: any, value?: any) => void;\nexport interface ITransition {\n oldPage?: IPage;\n newPage?: IPage;\n trigger?: Trigger;\n scroll?: { x: number; y: number };\n scrollable?: boolean;\n in: (data: ITransitionData) => any;\n out: (data: ITransitionData) => any;\n [key: string]: any;\n}\nexport interface ITransitionData {\n from?: IPage;\n to?: IPage;\n trigger?: Trigger;\n scroll?: ICoords;\n done: asyncFn;\n}\nexport interface ITransitionManager extends Service {\n transitions: Manager,\n\n get(key: string): ITransition,\n set(key: string, value: ITransition): TransitionManager,\n add(value: ITransition): TransitionManager,\n has(key: string): boolean,\n\n boot(): any,\n animate(name: string, data: any): Promise,\n}\n\n/** Auto scrolls to an elements position if the element has an hash */\nexport const hashAction = (coords?: ICoords, hash: string = window.location.hash) => {\n try {\n let _hash = hash[0] == \"#\" ? hash : newURL(hash).hash;\n if (_hash.length > 1) {\n let el = document.getElementById(_hash.slice(1));\n if (el) {\n let { left, top } = el.getBoundingClientRect();\n let scrollLeft = window.pageXOffset;\n let scrollTop = window.pageYOffset;\n let x = left + scrollLeft;\n let y = top + scrollTop;\n\n console.log(x, y);\n return newCoords(x, y);\n }\n }\n } catch (e) {\n console.warn(\"[hashAction] error\", e);\n }\n\n return coords ?? newCoords(0, 0);\n};\n\n// The Default Transition\nconst Default: ITransition = {\n name: \"default\",\n scrollable: true,\n\n out({ done }: ITransitionData) {\n done();\n },\n in({ scroll, done }: ITransitionData) {\n window.scroll(scroll.x, scroll.y);\n done();\n }\n};\n\n/** Controls which Transition between pages to use */\nexport class TransitionManager extends Service implements ITransitionManager {\n transitions: Manager;\n private _arg: Array<[string, ITransition]>;\n constructor(transitions?: Array<[string, ITransition]>) {\n super();\n this._arg = transitions;\n }\n\n /** On Service install set Config */\n public install() {\n super.install();\n\n let transitions = this._arg && this._arg.length ? this._arg : (getConfig(this.config, \"transitions\") ?? []);\n\n // Manager like Maps use the most recent [key, value] Array it knows, replacing the default transition\n // With any other transitions called [\"default\", ...]\n transitions = [[\"default\", Default]].concat(transitions);\n this.transitions = new Manager(transitions);\n }\n\n get(key: string) { return this.transitions.get(key); }\n set(key: string, value: ITransition) { this.transitions.set(key, value); return this; }\n add(value: ITransition) { this.transitions.add(value); return this; }\n has(key: string) { return this.transitions.has(key); }\n\n /** Starts a transition */\n public async animate(name: string, data: any): Promise {\n let transition: ITransition = this.transitions.get(name);\n let scroll = data.scroll;\n let ignoreHashAction = data.ignoreHashAction;\n if (!(\"wrapper\" in data.oldPage) || !(\"wrapper\" in data.newPage))\n throw `[Page] either oldPage or newPage aren't instances of the Page Class.\\n ${{\n newPage: data.newPage,\n oldPage: data.oldPage,\n }}`;\n\n // Replace the title\n document.title = `` + data.newPage.title;\n\n let fromWrapper = data.oldPage.wrapper;\n let toWrapper = data.newPage.wrapper;\n\n if (!(fromWrapper instanceof Node) || !(toWrapper instanceof Node))\n throw `[Wrapper] the wrapper from the ${!(toWrapper instanceof Node) ? \"next\" : \"current\"\n } page cannot be found. The wrapper must be an element that has the attribute ${getConfig(this.config,\n \"wrapperAttr\"\n )}.`;\n\n // Give the Transition all the background data it may require\n transition.init && transition?.init(data);\n\n this.emitter.emit(\"BEFORE_TRANSITION_OUT\");\n\n // Start the out point of the Transition\n if (transition.out) {\n await new Promise((done) => {\n let outMethod: Promise = transition.out.call(transition, {\n ...data,\n from: data.oldPage,\n trigger: data.trigger,\n done,\n });\n\n outMethod?.then(done);\n });\n }\n\n this.emitter.emit(\"AFTER_TRANSITION_OUT\");\n\n // Add the new wrapper before the old one\n await new Promise((done) => {\n fromWrapper.insertAdjacentElement(\"beforebegin\", toWrapper);\n this.emitter.emit(\"CONTENT_INSERT\");\n\n if (!ignoreHashAction && !/back|popstate|forward/.test(data.trigger as string)) {\n scroll = hashAction(scroll);\n }\n done();\n });\n\n // Replace the old wrapper with the new one\n await new Promise((done) => {\n fromWrapper.remove();\n fromWrapper = undefined;\n toWrapper = undefined;\n this.emitter.emit(\"CONTENT_REPLACED\");\n done();\n });\n\n this.emitter.emit(\"BEFORE_TRANSITION_IN\");\n\n // Start the in point of the Transition (only the in method has access to the hashAction's scroll position)\n if (transition.in) {\n await new Promise(async (done) => {\n let inMethod: Promise = transition.in.call(transition, {\n ...data,\n from: data.oldPage,\n to: data.newPage,\n trigger: data.trigger,\n scroll,\n done,\n });\n\n inMethod?.then(done);\n });\n }\n\n this.emitter.emit(\"AFTER_TRANSITION_IN\");\n return transition;\n }\n}\n", "import { EventEmitter, ListenerCallback, EventInput } from \"./emitter\";\nimport { ServiceManager, Service } from \"./service\";\nimport { newConfig, ICONFIG } from \"./config\";\n\nexport interface IApp {\n services: ServiceManager,\n emitter: EventEmitter,\n config: ICONFIG,\n register(config: ICONFIG): App,\n get(key: string): Service,\n set(key: string, service: Service): App,\n add(value: Service): App,\n boot(): App,\n stop(): App,\n on(events: EventInput, callback?: ListenerCallback): App,\n off(events: EventInput, callback?: ListenerCallback): App,\n emit(events: string | any[], ...args: any): App,\n}\n\n/** The App class starts the entire process, it controls all managers and all services */\nexport class App implements IApp {\n /** An instance of the ServiceManager */\n public services: ServiceManager;\n\n /** An instance of an EventEmitter */\n public emitter: EventEmitter;\n\n /** The current Configuration's for the App */\n public config: ICONFIG;\n constructor(config: object = {}) {\n this.register(config);\n }\n\n /** Create new instances of the ServiceManager, EventEmitter and the configurations */\n public register(config: ICONFIG = {}): App {\n this.config = newConfig(config);\n this.emitter = new EventEmitter();\n this.services = new ServiceManager(this);\n\n let handler = (() => {\n document.removeEventListener(\"DOMContentLoaded\", handler);\n window.removeEventListener(\"load\", handler);\n this.emitter.emit(\"READY ready\");\n }).bind(this);\n\n document.addEventListener(\"DOMContentLoaded\", handler);\n window.addEventListener(\"load\", handler);\n return this;\n }\n\n /** Shortcuts to adding, setting, and getting Services */\n public get(key: string): Service {\n return this.services.get(key);\n }\n\n public set(key: string, value: Service): App {\n this.services.set(key, value);\n return this;\n }\n\n public add(value: Service): App {\n this.services.add(value);\n return this;\n }\n\n /** Initialize and boot all Services */\n public boot(): App {\n this.services.init();\n this.services.boot();\n return this;\n }\n\n /** Stops all Services and clears the even emitter of all events and listeners */\n public stop(): App {\n this.services.stop();\n this.emitter.clear();\n return this;\n }\n\n /** Shortcuts to the App EventEmitter on, off, and emit methods */\n public on(events: EventInput, callback?: ListenerCallback): App {\n this.emitter.on(events, callback, this);\n return this;\n }\n\n public off(events: EventInput, callback?: ListenerCallback): App {\n this.emitter.off(events, callback, this);\n return this;\n }\n\n public emit(events: string | any[], ...args: any): App {\n this.emitter.emit(events, ...args);\n return this;\n }\n}\n", "import { newState, Trigger, newCoords, IHistoryItem, IHistoryManager } from \"./history\";\nimport { Service } from \"./service\";\nimport { IPage, IPageManager } from \"./page\";\nimport { newURL, getHashedPath, equal } from \"./url\";\nimport { getConfig } from \"./config\";\nimport { hashAction, ITransitionManager } from \"./transition\";\n\nexport type LinkEvent = MouseEvent | TouchEvent;\nexport type StateEvent = LinkEvent | PopStateEvent;\nexport type IgnoreURLsList = Array;\n/**\n * Creates a barbajs like PJAX Service, for the native framework\n * Based on barbajs and StartingBlocks\n */\nexport class PJAX extends Service {\n /** URLs to ignore when prefetching */\n public ignoreURLs: IgnoreURLsList;\n\n /** Whether or not to disable prefetching */\n public prefetchIgnore: boolean;\n\n /** Current state of transitions */\n public isTransitioning: boolean;\n\n /** Ignore extra clicks of an anchor element if a transition has already started */\n public stopOnTransitioning: boolean;\n\n /** On page change (excluding popstate events) keep current scroll position */\n public stickyScroll: boolean;\n\n /** Force load a page if an error occurs */\n public forceOnError: boolean;\n\n /** Ignore hash action if set to true */\n public ignoreHashAction: boolean;\n\n public install() {\n super.install();\n\n this.ignoreURLs = getConfig(this.config, \"ignoreURLs\") ?? [];\n this.prefetchIgnore = getConfig(this.config, \"prefetchIgnore\") ?? false;\n this.stopOnTransitioning = getConfig(this.config, \"stopOnTransitioning\") ?? false;\n this.stickyScroll = getConfig(this.config, \"stickyScroll\") ?? false;\n this.forceOnError = getConfig(this.config, \"forceOnError\") ?? false;\n this.ignoreHashAction = getConfig(this.config, \"ignoreHashAction\") ?? false\n }\n\n /** Sets the transition state to either true or false */\n public transitionStart() {\n this.isTransitioning = true;\n }\n\n public transitionStop() {\n this.isTransitioning = false;\n }\n\n public init() {\n /**\n * Bind the event listeners to the PJAX class\n *\n * @memberof PJAX\n */\n this.onHover = this.onHover.bind(this);\n this.onClick = this.onClick.bind(this);\n this.onStateChange = this.onStateChange.bind(this);\n }\n\n /** Starts the PJAX Service */\n public boot() {\n if (\"scrollRestoration\" in window.history) {\n // Back off, browser, I got this...\n window.history.scrollRestoration = \"manual\";\n }\n\n super.boot();\n }\n\n /** Gets the transition to use for a certain anchor */\n public getTransitionName(el: HTMLAnchorElement): string | null {\n if (!el || !el.getAttribute) return null;\n let transitionAttr = el.getAttribute(\n getConfig(this.config, \"transitionAttr\", false)\n );\n\n if (typeof transitionAttr === \"string\") return transitionAttr;\n return null;\n }\n\n /** Checks to see if the anchor is valid */\n public validLink(\n el: HTMLAnchorElement,\n event: LinkEvent | KeyboardEvent,\n href: string\n ): boolean {\n let pushStateSupport = !window.history.pushState;\n let exists = !el || !href;\n let eventMutate =\n (event as KeyboardEvent).metaKey ||\n (event as KeyboardEvent).ctrlKey ||\n (event as KeyboardEvent).shiftKey ||\n (event as KeyboardEvent).altKey;\n let newTab =\n el.hasAttribute(\"target\") &&\n (el as HTMLAnchorElement).target === \"_blank\";\n let crossOrigin =\n (el as HTMLAnchorElement).protocol !== location.protocol ||\n (el as HTMLAnchorElement).hostname !== location.hostname;\n let download = typeof el.getAttribute(\"download\") === \"string\";\n let preventSelf = el.matches(getConfig(this.config, \"preventSelfAttr\"));\n let preventAll = Boolean(\n el.closest(getConfig(this.config, \"preventAllAttr\"))\n );\n let sameURL = getHashedPath(newURL()) === getHashedPath(newURL(href));\n return !(\n exists ||\n pushStateSupport ||\n eventMutate ||\n newTab ||\n crossOrigin ||\n download ||\n preventSelf ||\n preventAll ||\n sameURL\n );\n }\n\n /** Returns the href of an Anchor element */\n public getHref(el: HTMLAnchorElement): string | null {\n if (\n el &&\n el.tagName &&\n el.tagName.toLowerCase() === \"a\" &&\n typeof el.href === \"string\"\n )\n return el.href;\n return null;\n }\n\n /** Check if event target is a valid anchor with an href, if so, return the anchor */\n public getLink(event: LinkEvent): HTMLAnchorElement {\n let el = event.target as HTMLAnchorElement;\n let href: string = this.getHref(el);\n\n while (el && !href) {\n el = (el as HTMLElement).parentNode as HTMLAnchorElement;\n href = this.getHref(el);\n }\n\n // Check for a valid link\n if (!el || !this.validLink(el, event, href)) return;\n return el;\n }\n\n /** When an element is clicked, get valid anchor element, go for a transition */\n public onClick(event: LinkEvent) {\n let el = this.getLink(event);\n if (!el) return;\n\n if (this.isTransitioning && this.stopOnTransitioning) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n let href = this.getHref(el);\n this.emitter.emit(\"ANCHOR_CLICK CLICK\", event);\n this.go({ href, trigger: el, event });\n }\n\n /** Returns the direction of the State change as a String, either the Back button or the Forward button */\n public getDirection(value: number): Trigger {\n if (Math.abs(value) > 1) {\n // Ex 6-0 > 0 -> forward, 0-6 < 0 -> back\n return value > 0 ? \"forward\" : \"back\";\n } else {\n if (value === 0) {\n return \"popstate\";\n } else {\n // Ex 6-5 > 0 -> back, 5-6 < 0 -> forward\n return value > 0 ? \"back\" : \"forward\";\n }\n }\n }\n\n /** Force a page to go to a certain URL */\n public force(href: string): void {\n window.location.assign(href);\n }\n\n /**\n * If transition is running force load page.\n * Stop if currentURL is the same as new url.\n * On state change, change the current state history, to reflect the direction of said state change\n * Load page and page transition.\n */\n public go({\n href,\n trigger = \"HistoryManager\",\n event,\n }: {\n href: string;\n trigger?: Trigger;\n event?: StateEvent;\n }): Promise {\n // If transition is already running and the go method is called again, force load page\n if (this.isTransitioning && this.stopOnTransitioning ||\n !(this.manager.has(\"TransitionManager\") &&\n this.manager.has(\"HistoryManager\") &&\n this.manager.has(\"PageManager\"))) {\n this.force(href);\n return;\n }\n\n const history = this.manager.get(\"HistoryManager\") as IHistoryManager;\n let scroll = newCoords(0, 0);\n let currentState = history.current;\n let currentURL = currentState.url;\n if (equal(currentURL, href)) {\n return;\n }\n\n let transitionName: string;\n if (event && (event as PopStateEvent).state) {\n this.emitter.emit(\"POPSTATE\", event);\n\n // If popstate, get back/forward direction.\n let { state }: { state: IHistoryItem } = event as PopStateEvent;\n let { index } = state;\n let currentIndex = currentState.index;\n let difference = currentIndex - index;\n\n history.replace(state.states);\n history.pointer = index;\n\n let _state = history.get(index);\n transitionName = _state.transition;\n scroll = _state.data.scroll;\n\n trigger = this.getDirection(difference);\n console.log(trigger == \"forward\" && history)\n\n // Based on the direction of the state change either remove or add a state\n this.emitter.emit(trigger === \"back\" ? `POPSTATE_BACK` : `POPSTATE_FORWARD`, event);\n } else {\n // Add new state\n transitionName = this.getTransitionName(trigger as HTMLAnchorElement);\n\n scroll = newCoords();\n let state = newState({\n url: href,\n transition: transitionName,\n data: { scroll },\n });\n\n !this.stickyScroll && (scroll = newCoords(0, 0));\n\n history.add(state);\n this.emitter.emit(\"HISTORY_NEW_ITEM\", event);\n }\n\n if (event) {\n event.stopPropagation();\n event.preventDefault();\n }\n\n this.emitter.emit(\"GO\", event);\n return this.load({\n oldHref: currentURL,\n href,\n trigger,\n transitionName,\n scroll,\n });\n }\n\n /** Load the new Page as well as a Transition; starts the Transition */\n public async load({\n oldHref,\n href,\n trigger,\n transitionName = \"default\",\n scroll = { x: 0, y: 0 },\n }: {\n oldHref: string;\n href: string;\n trigger: Trigger;\n transitionName?: string;\n scroll: { x: number; y: number };\n }): Promise {\n try {\n const pages = this.manager.get(\"PageManager\") as IPageManager;\n let newPage: IPage, oldPage: IPage;\n this.emitter.emit(\"NAVIGATION_START\", {\n oldHref,\n href,\n trigger,\n transitionName,\n });\n\n // Load & Build both the old and new pages\n try {\n this.transitionStart();\n oldPage = await pages.load(oldHref);\n !(oldPage.dom instanceof Element) && oldPage.build();\n\n this.emitter.emit(\"PAGE_LOADING\", { href, oldPage, trigger });\n newPage = await pages.load(href);\n await newPage.build();\n this.emitter.emit(\"PAGE_LOAD_COMPLETE\", {\n newPage,\n oldPage,\n trigger,\n });\n } catch (err) {\n console.warn(`[PJAX] Page load error: ${err}`);\n }\n\n // Transition Between Pages\n try {\n const TransitionManager = this.manager.get(\"TransitionManager\") as ITransitionManager;\n this.emitter.emit(\"TRANSITION_START\", transitionName);\n\n let transition = await TransitionManager.animate(TransitionManager.has(transitionName) ? transitionName : \"default\", {\n oldPage,\n newPage,\n trigger,\n scroll,\n ignoreHashAction: this.ignoreHashAction\n });\n\n if (!transition.scrollable) {\n if (!this.ignoreHashAction && !/back|popstate|forward/.test(trigger as string)) scroll = hashAction(scroll);\n window.scroll(scroll.x, scroll.y);\n }\n\n this.emitter.emit(\"TRANSITION_END\", { transition });\n } catch (err) {\n console.warn(`[PJAX] Transition error: ${err}`);\n }\n\n // Navigation is over\n this.emitter.emit(\"NAVIGATION_END\", {\n oldPage,\n newPage,\n trigger,\n transitionName,\n });\n } catch (err) {\n if (this.forceOnError) this.force(href);\n else console.warn(err);\n } finally {\n this.transitionStop(); // Sets isTransitioning to false\n }\n }\n\n /** Check to see if the URL is to be ignored, uses either RegExp of Strings to check */\n public ignoredURL({ pathname }: URL): boolean {\n return (\n this.ignoreURLs.length &&\n this.ignoreURLs.some((url) => {\n return typeof url === \"string\"\n ? url === pathname\n : (url as RegExp).exec(pathname) !== null;\n })\n );\n }\n\n /** When you hover over an anchor, prefetch the event target's href */\n public onHover(event: LinkEvent): Promise {\n let el = this.getLink(event);\n if (!el || !this.manager.has(\"PageManager\")) return;\n\n const pages = this.manager.get(\"PageManager\") as IPageManager;\n let url = newURL(this.getHref(el));\n let urlString: string = url.pathname;\n\n // If Url is ignored or already in cache, don't do any think\n if (this.ignoredURL(url) || pages.has(urlString)) return;\n this.emitter.emit(\"ANCHOR_HOVER HOVER\", event);\n\n try {\n pages.load(url);\n } catch (err) {\n console.warn(\"[PJAX] prefetch error,\", err);\n }\n }\n\n /** When History state changes, get url from State, go for a Transition. */\n public onStateChange(event: PopStateEvent): void {\n this.go({ href: window.location.href, trigger: \"popstate\", event });\n }\n\n /** Initialize DOM Events */\n public initEvents() {\n if (this.prefetchIgnore !== true) {\n document.addEventListener(\"mouseover\", this.onHover);\n document.addEventListener(\"touchstart\", this.onHover);\n }\n\n document.addEventListener(\"click\", this.onClick);\n window.addEventListener(\"popstate\", this.onStateChange);\n }\n\n /** Stop DOM Events */\n public stopEvents() {\n if (this.prefetchIgnore !== true) {\n document.removeEventListener(\"mouseover\", this.onHover);\n document.removeEventListener(\"touchstart\", this.onHover);\n }\n\n document.removeEventListener(\"click\", this.onClick);\n window.removeEventListener(\"popstate\", this.onStateChange);\n }\n}\n", "import { Service } from \"./service\";\nimport { Manager } from \"./manager\";\nimport { newURL, getHashedPath } from \"./url\";\nimport { IHistoryManager } from \"./history\";\n\nexport type RouteMethod = (...args: any) => any;\nexport type RouteStyle = string | RegExp | boolean;\nexport interface IRouteToFrom {\n to: RouteStyle,\n from: RouteStyle\n}\nexport type RoutePath = IRouteToFrom | RouteStyle;\nexport interface IRoute {\n path: RoutePath,\n method: RouteMethod\n}\n\n/** Controls what happens when certain url paths match a set of criteria */\nexport class Router extends Service {\n /** List of routes */\n protected routes: Manager;\n constructor(routes: IRoute[] = []) {\n super();\n this.routes = new Manager();\n for (let route of routes) {\n this.add(route);\n }\n }\n\n /** Add a new route to watch for */\n public add({ path, method }: IRoute): Router {\n let key = this.parse(path);\n this.routes.set(key, method);\n return this;\n }\n\n /** Convert strings into path match functions */\n public parsePath(path: RouteStyle): RegExp | boolean {\n if (typeof path === \"string\") return new RegExp(path, \"i\");\n else if (path instanceof RegExp || typeof path === \"boolean\")\n return path;\n throw \"[Router] only regular expressions, strings and booleans are accepted as paths.\";\n }\n\n /** Determines if a strings counts has a path */\n public isPath(input: RouteStyle): boolean {\n return (\n typeof input === \"string\" ||\n input instanceof RegExp ||\n typeof input === \"boolean\"\n );\n }\n\n /** Parse the multiple different formats for paths, into a { from, to } object */\n public parse(input: RoutePath): IRouteToFrom {\n let route = input as IRouteToFrom;\n let toFromPath: IRouteToFrom = {\n from: /(.*)/g,\n to: /(.*)/g,\n };\n\n if (this.isPath(input as RouteStyle))\n toFromPath = {\n from: true,\n to: input as RouteStyle,\n };\n else if (this.isPath(route.from) && this.isPath(route.to as RouteStyle))\n toFromPath = route;\n else\n throw \"[Router] path is neither a string, regular expression, or a { from, to } object.\";\n\n let { from, to } = toFromPath;\n return {\n from: this.parsePath(from),\n to: this.parsePath(to),\n };\n }\n\n /** Test if route paths are true, if so run their methods */\n public route() {\n if (this.manager.has(\"HistoryManager\")) {\n let history = this.manager.get(\"HistoryManager\") as IHistoryManager;\n let from: string = getHashedPath(newURL((history.length > 1 ? history.previous : history.current).url));\n let to: string = getHashedPath(newURL());\n\n this.routes.forEach((method: RouteMethod, path: IRouteToFrom) => {\n let fromRegExp = path.from as RegExp | boolean;\n let toRegExp = path.to as RegExp | boolean;\n\n if (\n typeof fromRegExp === \"boolean\" &&\n typeof toRegExp === \"boolean\"\n ) {\n throw `[Router] path ({ from: ${fromRegExp}, to: ${toRegExp} }) is not valid, remember paths can only be strings, regular expressions, or a boolean; however, both the from and to paths cannot be both booleans.`;\n }\n\n let fromParam: RegExpExecArray | RegExp | boolean = fromRegExp;\n let toParam: RegExpExecArray | RegExp | boolean = toRegExp;\n\n if (fromRegExp instanceof RegExp && fromRegExp.test(from))\n fromParam = fromRegExp.exec(from);\n if (toRegExp instanceof RegExp && toRegExp.test(to))\n toParam = toRegExp.exec(to);\n\n if (\n (Array.isArray(toParam) && Array.isArray(fromParam)) ||\n (Array.isArray(toParam) &&\n typeof fromParam == \"boolean\" &&\n fromParam) ||\n (Array.isArray(fromParam) &&\n typeof toParam == \"boolean\" &&\n toParam)\n )\n method({ from: fromParam, to: toParam, path: { from, to } });\n });\n } else {\n console.warn(\"[Route] HistoryManager is missing.\");\n }\n }\n\n /** Add listeners for PJAX Events */\n public initEvents() {\n this.emitter.on(\"READY\", this.route, this);\n this.emitter.on(\"CONTENT_REPLACED\", this.route, this);\n }\n\n /** Remove listeners for PJAX Events */\n public stopEvents() {\n this.emitter.off(\"READY\", this.route, this);\n this.emitter.off(\"CONTENT_REPLACED\", this.route, this);\n }\n}\n", "import { EventEmitter, EventInput, ListenerCallback } from \"@okikio/emitter\";\nimport { Manager } from \"@okikio/manager\";\n\n// DOM\nexport type AnimationTarget = string | Node | NodeList | HTMLCollection | HTMLElement[] | AnimationTarget[];\nexport const getElements = (selector: string | Node): Node[] => {\n return typeof selector === \"string\" ? Array.from(document.querySelectorAll(selector as string)) : [selector];\n};\n\nconst flatten = (arr: AnimationTarget[]) => [].concat(...arr);\nexport const getTargets = (targets: AnimationTarget): Node[] => {\n if (Array.isArray(targets)) {\n return flatten((targets as AnimationTarget[]).map(getTargets));\n }\n if (typeof targets == \"string\" || targets instanceof Node)\n return getElements(targets);\n if (targets instanceof NodeList || targets instanceof HTMLCollection)\n return Array.from(targets);\n return [];\n};\n\n// VALUES\nexport type closureArgs = [number, number, HTMLElement];\nexport type closure = ((index?: number, total?: number, element?: HTMLElement) => (genericTypes[] | void)) | any;\nexport const computeValue = (value: closure, args: closureArgs, context: Animate) => {\n if (typeof value === \"function\") {\n return value.apply(context, args);\n } else { return value; }\n};\n\nexport const mapObject = (obj: object, args: closureArgs, options: Animate): any => {\n let key: string, value: any, result = {};\n let keys = Object.keys(obj);\n for (let i = 0, len = keys.length; i < len; i++) {\n key = keys[i];\n value = obj[key];\n result[key] = computeValue(value, args, options);\n }\n\n return result;\n};\n\n/** From: [https://easings.net] */\nexport const easings = {\n \"in\": \"ease-in\",\n \"out\": \"ease-out\",\n \"in-out\": \"ease-in-out\",\n\n // Sine\n \"in-sine\": \"cubic-bezier(0.47, 0, 0.745, 0.715)\",\n \"out-sine\": \"cubic-bezier(0.39, 0.575, 0.565, 1)\",\n \"in-out-sine\": \"cubic-bezier(0.445, 0.05, 0.55, 0.95)\",\n\n // Quad\n \"in-quad\": \"cubic-bezier(0.55, 0.085, 0.68, 0.53)\",\n \"out-quad\": \"cubic-bezier(0.25, 0.46, 0.45, 0.94)\",\n \"in-out-quad\": \"cubic-bezier(0.455, 0.03, 0.515, 0.955)\",\n\n // Cubic\n \"in-cubic\": \"cubic-bezier(0.55, 0.055, 0.675, 0.19)\",\n \"out-cubic\": \"cubic-bezier(0.215, 0.61, 0.355, 1)\",\n \"in-out-cubic\": \"cubic-bezier(0.645, 0.045, 0.355, 1)\",\n\n // Quart\n \"in-quart\": \"cubic-bezier(0.895, 0.03, 0.685, 0.22)\",\n \"out-quart\": \"cubic-bezier(0.165, 0.84, 0.44, 1)\",\n \"in-out-quart\": \"cubic-bezier(0.77, 0, 0.175, 1)\",\n\n // Quint\n \"in-quint\": \"cubic-bezier(0.755, 0.05, 0.855, 0.06)\",\n \"out-quint\": \"cubic-bezier(0.23, 1, 0.32, 1)\",\n \"in-out-quint\": \"cubic-bezier(0.86, 0, 0.07, 1)\",\n\n // Expo\n \"in-expo\": \"cubic-bezier(0.95, 0.05, 0.795, 0.035)\",\n \"out-expo\": \"cubic-bezier(0.19, 1, 0.22, 1)\",\n \"in-out-expo\": \"cubic-bezier(1, 0, 0, 1)\",\n\n // Circ\n \"in-circ\": \"cubic-bezier(0.6, 0.04, 0.98, 0.335)\",\n \"out-circ\": \"cubic-bezier(0.075, 0.82, 0.165, 1)\",\n \"in-out-circ\": \"cubic-bezier(0.785, 0.135, 0.15, 0.86)\",\n\n // Back\n \"in-back\": \"cubic-bezier(0.6, -0.28, 0.735, 0.045)\",\n \"out-back\": \"cubic-bezier(0.175, 0.885, 0.32, 1.275)\",\n \"in-out-back\": \"cubic-bezier(0.68, -0.55, 0.265, 1.55)\"\n};\n\nexport const getEase = (ease: string) => {\n return /^(in|out)/.test(ease) ? easings[ease] : ease;\n};\n\nexport type genericTypes = genericTypes[] | boolean | object | string | number | closure | null | undefined;\nexport interface AnimationOptions {\n target?: AnimationTarget,\n\n speed?: number,\n autoplay?: boolean,\n options?: AnimationOptions,\n delay?: number | closure,\n easing?: string | closure,\n endDelay?: number | closure,\n duration?: number | closure,\n keyframes?: Keyframe[] | object[] | closure,\n loop?: number | boolean | closure, // iterations: number,\n onfinish?: (element?: HTMLElement, index?: number, total?: number, animation?: Animation) => any,\n fillMode?: \"none\" | \"forwards\" | \"backwards\" | \"both\" | \"auto\" | closure,\n direction?: \"normal\" | \"reverse\" | \"alternate\" | \"alternate-reverse\" | closure,\n extend?: EffectTiming,\n [property: string]: genericTypes;\n};\n\nexport const DefaultAnimationOptions: AnimationOptions = {\n keyframes: [],\n\n loop: 1, // iterations: number,\n delay: 0,\n speed: 1,\n endDelay: 0,\n easing: \"ease\",\n autoplay: true,\n duration: 1000,\n fillMode: \"auto\",\n direction: \"normal\",\n extend: {}\n};\n\nexport type AnimationEvents = \"update\" | \"play\" | \"pause\" | \"start\" | \"begin\" | \"complete\" | \"finish\" | \"error\" | \"stop\";\n\n/** You can check it out here: https://codepen.io/okikio/pen/qBbdGaW?editors=0011 */\nexport class Animate {\n /**\n * Stores the options for the current animation\n */\n public options: AnimationOptions = {};\n\n /**\n * The Array of Elements to Animate\n */\n public targets: Node[] = [];\n\n /**\n * The properties to animate\n */\n public properties: object = {};\n\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n\n /**\n * The total duration of all Animation's\n */\n public totalDuration: number = 0;\n\n /**\n * The smallest delay out of all Animation's\n */\n public minDelay: number = 0;\n\n /**\n * The options for individual animations\n */\n public computedOptions: Manager = new Manager();\n\n /**\n * The Element the main animation uses\n */\n public mainElement: HTMLElement;\n\n /**\n * Stores an animation that runs on the total duration of the all other Animations, and as such it's the main Animation\n */\n public mainAnimation: Animation;\n\n /**\n * Stores request frame calls\n */\n public animationFrame: number;\n\n /**\n * An event emitter\n */\n public emitter: EventEmitter = new EventEmitter();\n\n /**\n * Returns a promise that is fulfilled when the mainAnimation is finished\n */\n public promise: Promise;\n constructor(options: AnimationOptions = {}) {\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n\n /**\n * Returns a new Promise that is resolve when this.finish is called\n */\n public newPromise(): Promise {\n return new Promise((resolve, reject) => {\n /*\n Note that the `this` keyword is in an Array when it is resolved,\n this is due to Promises not wanting to resolve references,\n so, you can't resolve `this` directly, so, I chose to resolve `this` in an\n Array\n */\n this.on(\"complete\", () => resolve([this]));\n this.on(\"error\", err => reject(err));\n });\n }\n\n /**\n * Fulfills the this.promise Promise\n */\n public then(\n onFulfilled?: (value?: any) => any,\n onRejected?: (reason?: any) => any\n ): Animate {\n onFulfilled = onFulfilled?.bind(this);\n onRejected = onRejected?.bind(this);\n this.promise.then(onFulfilled, onRejected);\n return this;\n }\n\n /**\n * Catches error that occur in the this.promise Promise\n */\n public catch(onRejected: (reason?: any) => any): Animate {\n onRejected = onRejected?.bind(this);\n this.promise.catch(onRejected);\n return this;\n }\n\n /**\n * If you don't care if the this.promise Promise has either been rejected or resolved\n */\n public finally(onFinally: () => any): Animate {\n onFinally = onFinally?.bind(this);\n this.promise.finally(onFinally);\n return this;\n }\n\n /**\n * Represents an Animation Frame Loop\n */\n public loop(): void {\n this.stopLoop();\n this.emit(\"update\", this.getProgress(), this);\n this.animationFrame = window.requestAnimationFrame(this.loop);\n }\n\n /**\n * Cancels animation frame\n */\n public stopLoop() {\n window.cancelAnimationFrame(this.animationFrame);\n }\n\n /**\n * Calls a method that affects all animations including the mainAnimation; the method only allows the animation parameter\n */\n public all(method: (animation?: Animation, target?: HTMLElement) => void) {\n method(this.mainAnimation, this.mainElement);\n this.animations.forEach(method);\n return this;\n }\n\n /**\n * Register the begin event\n */\n protected beginEvent() {\n if (this.getProgress() == 0) {\n let timer: number | void = window.setTimeout(() => {\n this.emit(\"begin\", this);\n timer = window.clearTimeout(timer as number);\n }, this.minDelay);\n }\n }\n\n /**\n * Play Animation\n */\n public play(): Animate {\n let playstate = this.getPlayState();\n this.beginEvent();\n this.all(anim => anim.play());\n this.emit(\"play\", playstate, this);\n this.loop();\n return this;\n }\n\n /**\n * Pause Animation\n */\n public pause(): Animate {\n let playstate = this.getPlayState();\n this.all(anim => anim.pause());\n this.emit(\"pause\", playstate, this);\n this.stopLoop();\n this.animationFrame = undefined;\n return this;\n }\n\n /**\n * Reset all Animations\n */\n public reset() {\n this.setProgress(0);\n this.beginEvent();\n\n if (this.options.autoplay) this.play();\n else this.pause();\n return this;\n }\n\n /**\n * Cancels all Animations\n */\n public cancel() {\n this.all(anim => anim.cancel());\n this.stopLoop();\n return this;\n }\n\n /**\n * Force complete all Animations\n */\n public finish() {\n this.all(anim => anim.finish());\n this.stopLoop();\n return this;\n }\n\n /**\n * Cancels & Clears all Animations\n */\n public stop() {\n this.cancel();\n this.animations.clear();\n while (this.targets.length) this.targets.pop();\n this.mainElement = undefined;\n this.emit(\"stop\");\n }\n\n /**\n * Returns an Array of targets\n */\n public getTargets(): Node[] {\n return this.targets;\n }\n\n /**\n * Get a specific Animation from an Animate instance\n */\n public getAnimation(element: HTMLElement): Animation {\n return this.animations.get(element);\n }\n\n /**\n * Returns the timings of an Animation, given a target\n * E.g. { duration, endDelay, delay, iterations, iterationStart, direction, easing, fill, etc... }\n */\n public getTiming(target: HTMLElement | Animation): AnimationOptions & EffectTiming {\n let animation = target instanceof Animation ? target : this.getAnimation(target);\n let keyframeOptions = this.computedOptions.get(animation) ?? {};\n let timings = animation.effect?.getTiming() ?? {};\n let options = this.getOptions();\n\n return { ...DefaultAnimationOptions, ...options, ...timings, ...keyframeOptions };\n }\n\n /**\n * Returns the total duration of Animation\n */\n public getTotalDuration(): number {\n return this.totalDuration;\n }\n\n /**\n * Returns the current time of the Main Animation\n */\n public getCurrentTime(): number {\n return this.mainAnimation.currentTime;\n }\n\n /**\n * Returns the Animation progress as a fraction of the current time / duration * 100\n */\n public getProgress() {\n return (this.getCurrentTime() / this.totalDuration) * 100;\n }\n\n /**\n * Return the playback speed of the animation\n */\n public getSpeed(): number {\n return this.mainAnimation.playbackRate;\n }\n\n /**\n * Returns the current playing state\n */\n public getPlayState(): \"idle\" | \"running\" | \"paused\" | \"finished\" {\n return this.mainAnimation.playState;\n }\n\n /**\n * Get the options of an Animate instance\n */\n public getOptions(): AnimationOptions {\n return this.options;\n }\n\n /**\n * Set the current time of the Main Animation\n */\n public setCurrentTime(time: number): Animate {\n this.all(anim => { anim.currentTime = time; });\n this.emit(\"update\", this.getProgress());\n return this;\n }\n\n /**\n * Set the Animation progress as a value from 0 to 100\n */\n public setProgress(percent: number): Animate {\n let time = (percent / 100) * this.totalDuration;\n this.setCurrentTime(time);\n return this;\n }\n\n /**\n * Set the playback speed of an Animation\n */\n public setSpeed(speed: number = 1): Animate {\n this.all(anim => { anim.playbackRate = speed; });\n return this;\n }\n\n /**\n * Adds a listener for a given event\n */\n public on(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.on(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Removes a listener from an event\n */\n public off(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.off(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Call all listeners within an event\n */\n public emit(events: AnimationEvents | string | any[], ...args: any): Animate {\n this.emitter.emit(events, ...args);\n return this;\n }\n\n\n /** Returns the Animate options, as JSON */\n public toJSON(): AnimationOptions {\n return this.getOptions();\n }\n\n /**\n * The Symbol.toStringTag well-known symbol is a string valued property that is used\n * in the creation of the default string description of an object.\n * It is accessed internally by the Object.prototype.toString() method.\n */\n get [Symbol.toStringTag]() {\n return `Animate`;\n }\n}\n\n/** Creates a new Animate instance */\nexport const animate = (options: AnimationOptions = {}): Animate => {\n return new Animate(options);\n};\n\nexport class Timeline extends Animate {\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n constructor(options: AnimationOptions = {}) {\n super();\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n public add(options: AnimationOptions) {\n return this;\n }\n}\n\nexport default animate;"], - "mappings": "8GAAA,msBCeO,GAAM,GAAkB,CAC3B,YAAa,UACb,eAAgB,eAChB,eAAgB,cAChB,QAAS,CACL,CAAC,YAAa,SAElB,gBAAiB,iBACjB,eAAg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export * from \"./history\";\nexport * from \"./page\";\n\nexport * from \"./emitter\";\nexport * from \"./service\";\n\nexport * from \"./transition\";\n\nexport * from \"./app\";\nexport * from \"./pjax\";\nexport * from \"./router\";\n\nexport * from \"./animate\";\n", "export interface ICONFIG {\n prefix?: string;\n wrapperAttr?: string;\n noAjaxLinkAttr?: string;\n noPrefetchAttr?: \"no-prefetch\";\n headers?: string[][];\n preventSelfAttr?: string;\n preventAllAttr?: string;\n transitionAttr?: string;\n blockAttr?: string;\n timeout?: number;\n maxPages?: number;\n resizeDelay?: number;\n [key: string]: any;\n}\n\nexport const CONFIG_DEFAULTS: ICONFIG = {\n wrapperAttr: \"wrapper\",\n noAjaxLinkAttr: \"no-ajax-link\",\n noPrefetchAttr: \"no-prefetch\",\n headers: [\n [\"x-partial\", \"true\"]\n ],\n preventSelfAttr: `prevent=\"self\"`,\n preventAllAttr: `prevent=\"all\"`,\n transitionAttr: \"transition\",\n blockAttr: `block`,\n timeout: 30000,\n maxPages: 5,\n resizeDelay: 100\n};\n\nexport type ConfigKeys = keyof typeof CONFIG_DEFAULTS | string;\nexport const newConfig = (config: ICONFIG): ICONFIG => {\n return Object.assign({ ...CONFIG_DEFAULTS }, config);\n};\n\n/** Converts string into properly formatted data attributes */\nexport const toAttr = (config: ICONFIG, value: string, brackets: boolean = true): string => {\n let { prefix } = config;\n let attr = `data${prefix ? \"-\" + prefix : \"\"}-${value}`;\n return brackets ? `[${attr}]` : attr;\n};\n\n/** Selects config vars, and formats them for use, or simply returns the current configurations for the framework */\nexport const getConfig = (config: ICONFIG, value?: ConfigKeys, brackets: boolean = true): any => {\n if (typeof value !== \"string\")\n return config;\n\n let prop = config[value];\n if (typeof prop === \"string\")\n return toAttr(config, prop, brackets);\n return prop;\n};\n", "/** Manages complex lists of named data, eg. A page can be stored in a list by of other pages with the url being how the page is stored in the list. Managers use Maps to store data */\nexport class Manager {\n\t/** The complex list of named data, to which the Manager controls */\n\tpublic map: Map;\n\tconstructor(value?: Array<[K, V]>) {\n\t\tthis.map = new Map(value);\n\t}\n\n\t/** Returns the Manager classes base Map */\n\tpublic getMap(): Map {\n\t\treturn this.map;\n\t}\n\n\t/** Get a value stored in the Manager */\n\tpublic get(key: K): V {\n\t\treturn this.map.get(key);\n\t}\n\n\t/** Returns the keys of all items stored in the Manager as an Array */\n\tpublic keys(): Array {\n\t\treturn Array.from(this.map.keys());\n\t}\n\n\t/** Returns the values of all items stored in the Manager as an Array */\n\tpublic values(): Array {\n\t\treturn Array.from(this.map.values());\n\t}\n\n\t/** Set a value to the Manager using a key */\n\tpublic set(key: K, value: V): Manager {\n\t\tthis.map.set(key, value);\n\t\treturn this;\n\t}\n\n\t/** Adds a value to Manager, and uses the current size of the Manager as it's key, it works best when all the key in the Manager are numbers */\n\tpublic add(value: V): Manager {\n\t\tlet size = this.size;\n\t\t// @ts-ignore\n\t\tlet num: K = size as K;\n\t\tthis.set(num, value);\n\t\treturn this;\n\t}\n\n\t/** Returns the total number of items stored in the Manager */\n\tpublic get size(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** An alias for size */\n\tpublic get length(): number {\n\t\treturn this.map.size;\n\t}\n\n\t/** Returns the last item in the Manager who's index is a certain distance from the last item in the Manager */\n\tpublic last(distance: number = 1): V | undefined {\n\t\tlet key = this.keys()[this.size - distance];\n\t\treturn this.get(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns true if an element in the Map object existed and has been removed, or false if the element does not exist */\n\tpublic delete(key: K): boolean {\n\t\treturn this.map.delete(key);\n\t}\n\n\t/** Removes a value stored in the Manager via a key, returns the Manager class, allowing for chains */\n\tpublic remove(key: K): Manager {\n\t\tthis.map.delete(key);\n\t\treturn this;\n\t}\n\n\t/** Clear the Manager of all its contents */\n\tpublic clear(): Manager {\n\t\tthis.map.clear();\n\t\treturn this;\n\t}\n\n\t/** Checks if the Manager contains a certain key */\n\tpublic has(key: K): boolean {\n\t\treturn this.map.has(key);\n\t}\n\n\t/** Returns a new Iterator object that contains an array of [key, value] for each element in the Map object in insertion order. */\n\tpublic entries(): IterableIterator<[K, V]> {\n\t\treturn this.map.entries();\n\t}\n\n\t/** Iterates through the Managers contents, calling a callback function every iteration */\n\tpublic forEach(\n\t\tcallback: (value?: V, key?: K, map?: Map) => void,\n\t\tcontext?: object\n\t): Manager {\n\t\tthis.map.forEach(callback, context);\n\t\treturn this;\n\t}\n\n\t/** Allows for iteration via for..of, learn more: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators] */\n\tpublic [Symbol.iterator](): IterableIterator<[K, V]> {\n\t\treturn this.entries();\n\t}\n}\n\n/**\n * Calls the method of a certain name for all items that are currently installed\n */\nexport const methodCall = (manager: Manager, method: string, ...args: any): void => {\n\tmanager.forEach((item) => {\n\t\t// @ts-ignore\n\t\titem[method](...args);\n\t});\n};\n\n/**\n * Asynchronously calls the method of a certain name for all items that are currently installed, similar to methodCall\n */\nexport const asyncMethodCall = async (manager: Manager, method: string, ...args: any): Promise => {\n\tfor (let [, item] of manager) {\n\t\t// @ts-ignore\n\t\tawait item[method](...args);\n\t}\n};\n\nexport default Manager;\n", "import { Manager, methodCall, asyncMethodCall } from \"@okikio/manager\";\nimport { ICONFIG } from \"./config\";\nimport { IApp } from \"./app\";\nimport { EventEmitter } from \"./emitter\";\n\nexport type IAdvancedManager = AdvancedManager;\n\n/** The base class for AdvancedManager items */\nexport class ManagerItem {\n /** The AdvancedManager the ManagerItem is attached to */\n public manager: IAdvancedManager;\n\n /** The App the ManagerItem is attached to */\n public app: IApp;\n\n /** The Config of the App the ManagerItem is attached to */\n public config: ICONFIG;\n\n /** The EventEmitter of the App the ManagerItem is attached to */\n public emitter: EventEmitter;\n\n /** The key to where ManagerItem is stored in an AdvancedManager */\n public key: any;\n\n constructor() { }\n\n /** Run after the Manager Item has been registered */\n public install(): any { }\n\n /** Register the current Manager Item's manager */\n public register(manager: IAdvancedManager, key: any): ManagerItem {\n this.manager = manager;\n this.app = manager.app;\n this.config = manager.config;\n this.emitter = manager.emitter;\n this.key = key;\n this.install();\n return this;\n }\n\n /** Run before the ManagerItem has been unregistered */\n public uninstall(): any { }\n\n /** Basically removes a ManagerItem, in order to recover the ManagerItem, it needs to be re-added to an AdvancedManager */\n public unregister() {\n this.uninstall();\n\n this.manager.remove(this.key);\n this.key = undefined;\n this.manager = undefined;\n this.app = undefined;\n this.config = undefined;\n this.emitter = undefined;\n }\n}\n\n/** A tweak to the Manager class that makes it self aware of the App class it's instantiated in */\nexport class AdvancedManager extends Manager {\n /** The App the AdvancedManager is attached to */\n public app: IApp;\n\n /** The Config of the App the AdvancedManager is attached to */\n public config: ICONFIG;\n\n /** The EventEmitter of the App the AdvancedManager is attached to */\n public emitter: EventEmitter;\n\n /** Register App details */\n constructor(app: IApp) {\n super();\n this.app = app;\n this.config = app.config;\n this.emitter = app.emitter;\n }\n\n /** Add a ManagerItem to AdvancedManager at a specified key */\n public set(key: K, value: V) {\n super.set(key, value);\n value.register(this, key);\n return this;\n }\n}\n\nexport { Manager, methodCall, asyncMethodCall };\n", "export const newURL = (url: string | URL | Location = window.location.href): URL => {\n return url instanceof URL ? url : new URL(url as unknown as string, window.location.origin);\n};\n\n/** Returns the pathname with the hash at the end */\nexport const getHashedPath = (url: URL | string): string => {\n let _url = newURL(url);\n return `${_url.pathname}${_url.hash}`;\n};\n\n/** Returns the actual hash without the hashtag */\nexport const getHash = (url: URL | string): string => newURL(url).hash.slice(1);\n\n/** Removes the hash from the full URL for a clean URL string */\nexport const clean = (url: URL | string): string => newURL(url).toString().replace(/(\\/#.*|\\/|#.*)$/, '');\n\n/** Compares two URLs to each other */\nexport const equal = (a: URL | string, b: URL | string): boolean => (clean(a) === clean(b));\n\n", "import { AdvancedManager, ManagerItem, methodCall } from \"./manager\";\nimport { IApp } from \"./app\";\n\n/** Controls specific kinds of actions that require JS */\nexport class Service extends ManagerItem {\n\t/** Called before the start of a Service, represents a constructor of sorts */\n\tpublic init(...args: any): any;\n\tpublic init(): any { }\n\n\t/** Called on start of Service */\n\tpublic boot(...args: any): any;\n\tpublic boot(): any {\n\t\tthis.initEvents();\n\t}\n\n\t/** Initialize events */\n\tpublic initEvents(): void { }\n\n\t/** Stop events */\n\tpublic stopEvents(): void { }\n\n\t/** Stop services */\n\tpublic stop(): void {\n\t\tthis.stopEvents();\n\t\tthis.unregister();\n\t}\n}\n\n/** The Service Manager controls the lifecycle of all Services in an App */\nexport class ServiceManager extends AdvancedManager {\n\tconstructor(app: IApp) {\n\t\tsuper(app);\n\t}\n\n\t/** Call the init method for all Services */\n\tpublic init(): ServiceManager {\n\t\tmethodCall(this, \"init\");\n\t\treturn this;\n\t}\n\n\t/** Call the boot method for all Services */\n\tpublic boot(): ServiceManager {\n\t\tmethodCall(this, \"boot\");\n\t\treturn this;\n\t}\n\n\t/** Call the stop method for all Services */\n\tpublic stop(): ServiceManager {\n\t\tmethodCall(this, \"stop\");\n\t\treturn this;\n\t}\n}\n", "import { Service } from \"./service\";\nimport { getHashedPath, newURL } from \"./url\";\n\nexport type Trigger = HTMLAnchorElement | \"HistoryManager\" | \"popstate\" | \"back\" | \"forward\";\nexport interface ICoords {\n\treadonly x: number;\n\treadonly y: number;\n}\n\nexport interface IStateData {\n\tscroll: ICoords;\n\t[key: string]: any;\n}\n\nexport interface IState {\n\turl: string;\n\tindex?: number;\n\ttransition: string;\n\tdata: IStateData;\n}\n\nexport interface IHistoryItem {\n\tindex: number;\n\tstates: IState[];\n}\n\nexport interface IHistoryManager extends Service {\n\tstates: IState[],\n\tpointer: number,\n\n\tinit(): any,\n\tget(index: number): IState,\n\tadd(value?: IState, historyAction?: \"replace\" | \"push\"): HistoryManager,\n\tremove(index?: number): HistoryManager,\n\treplace(newStates: IState[]): HistoryManager,\n\tset(i: number, state: IState): IState,\n\tcurrent: IState,\n\tlast: IState,\n\tprevious: IState | null,\n\tlength: number,\n}\n\n/** A quick snapshot of page scroll coordinates */\nexport const newCoords = (x: number = window.scrollX, y: number = window.scrollY): ICoords => ({ x, y });\n\n/** Creates a state; a state represents the current status of the page consisting of properties like: url, transition, and data */\nexport const newState = (state: IState = {\n\turl: getHashedPath(newURL()),\n\tindex: 0,\n\ttransition: \"default\",\n\tdata: {\n\t\tscroll: newCoords(),\n\t\ttrigger: \"HistoryManager\"\n\t}\n}): IState => (state);\n\n/** Keeps a record of the history of the App; it stores only the states of Pages */\nexport class HistoryManager extends Service implements IHistoryManager {\n\tpublic states: IState[];\n\tpublic pointer = -1;\n\n\t/** Initializes the states array, and replace the history pushState data with the states array */\n\tinit() {\n\t\tthis.states = [];\n\n\t\tlet state = newState();\n\t\tthis.add(state, \"replace\");\n\t}\n\n\t/** Get a state based on it's index */\n\tpublic get(index: number) {\n\t\treturn this.states[index];\n\t}\n\n\t/** Add a state to HistoryManager and change the history pushState data based on the historyAction specified */\n\tpublic add(value?: IState, historyAction: \"replace\" | \"push\" = \"push\"): HistoryManager {\n\t\tlet state = newState(value);\n\t\tlet len = this.length;\n\t\tthis.states.push({ ...state });\n\t\tthis.pointer = len;\n\n\t\tlet item: IHistoryItem = {\n\t\t\tindex: this.pointer,\n\t\t\tstates: [...this.states]\n\t\t};\n\t\tchangeState(historyAction, state, item);\n\t\treturn this;\n\t}\n\n\tpublic remove(index?: number) {\n\t\tif (index) {\n\t\t\tthis.states.splice(index, 1);\n\t\t} else {\n\t\t\tthis.states.pop();\n\t\t}\n\n\t\tthis.pointer--;\n\t\treturn this;\n\t}\n\n\t/** Replaces the states array with another states array, this is later used when going back and forward in page history */\n\tpublic replace(newStates: IState[]) {\n\t\tthis.states = newStates;\n\t\treturn this;\n\t}\n\n\t/** Set state by index. */\n\tpublic set(i: number, state: IState) {\n\t\treturn (this.states[i] = state);\n\t}\n\n\t/** Get the current state */\n\tget current(): IState {\n\t\treturn this.get(this.pointer);\n\t}\n\n\t/** Get the last state (top of the history stack). */\n\tget last(): IState {\n\t\treturn this.get(this.length - 1);\n\t}\n\n\t/** Get the previous state. */\n\tget previous(): IState | null {\n\t\treturn this.pointer < 1 ? null : this.get(this.pointer - 1);\n\t}\n\n\tget length() {\n\t\treturn this.states.length;\n\t}\n}\n\n/** Either push or replace history state */\nexport const changeState = (action: \"push\" | \"replace\", state: IState, item: object) => {\n\tlet href = getHashedPath(state.url);\n\tlet args = [item, \"\", href];\n\tif (window.history) {\n\t\tswitch (action) {\n\t\t\tcase \"push\":\n\t\t\t\twindow.history.pushState.apply(window.history, args);\n\t\t\t\tbreak;\n\t\t\tcase \"replace\":\n\t\t\t\twindow.history.replaceState.apply(window.history, args);\n\t\t\t\tbreak;\n\t\t}\n\t}\n};\n", "import { Manager, ManagerItem, AdvancedManager } from \"./manager\";\nimport { equal, newURL } from \"./url\";\nimport { getConfig } from \"./config\";\nimport { Service } from \"./service\";\n\nexport interface IPage extends ManagerItem {\n dom: Document,\n wrapper: HTMLElement,\n title: string,\n head: Element,\n body: Element,\n url: URL,\n data: string,\n wrapperAttr: string,\n\n build(): any,\n install(): void,\n uninstall(): any,\n}\n\n/**\n * Parses strings to DOM\n */\nexport const PARSER: DOMParser = new DOMParser();\n\n/** A page represents the DOM elements that create each page */\nexport class Page extends ManagerItem implements IPage {\n /** Holds the DOM of the current page */\n public dom: Document;\n\n /** Holds the wrapper element to be swapped out of each Page */\n public wrapper: HTMLElement;\n\n /** Holds the title of each page */\n public title: string;\n\n /** Holds the head element of each page */\n public head: Element;\n\n /** Holds the body element of each page */\n public body: Element;\n\n /** The URL of the current page */\n public url: URL;\n\n /** The payload of a page request */\n public data: string;\n\n /** Attr that identifies the wrapper */\n public wrapperAttr: string;\n\n constructor(url: URL = newURL(), dom: string | Document = document) {\n super();\n this.url = url;\n\n if (typeof dom === \"string\") {\n this.data = dom;\n } else this.dom = dom || document;\n }\n\n /** Builds the page's dom, and sets the title, head, body, and wrapper properties of the Page class */\n public build() {\n if (!(this.dom instanceof Node)) {\n this.dom = PARSER.parseFromString(this.data, \"text/html\");\n }\n\n if (!(this.body instanceof Node)) {\n let { title, head, body } = this.dom;\n this.title = title;\n this.head = head;\n this.body = body;\n this.wrapper = this.body.querySelector(this.wrapperAttr);\n }\n }\n\n public install() {\n this.wrapperAttr = getConfig(this.config, \"wrapperAttr\");\n }\n\n public uninstall() {\n this.url = undefined;\n this.title = undefined;\n this.head = undefined;\n this.body = undefined;\n this.dom = undefined;\n this.wrapper = undefined;\n this.data = undefined;\n this.wrapperAttr = undefined;\n }\n}\n\nexport interface IPageManager extends Service {\n loading: Manager>,\n pages: AdvancedManager;\n\n install(): any,\n\n get(key): Page,\n add(value): PageManager,\n set(key, value): PageManager,\n remove(key): PageManager,\n has(key): boolean,\n clear(): PageManager,\n size: number,\n keys(): any[],\n\n load(_url: URL | string): Promise,\n request(url: string): Promise,\n}\n\n/** Controls which page to load */\nexport class PageManager extends Service implements IPageManager {\n /** Stores all fetch requests that are currently loading */\n public loading: Manager> = new Manager();\n\n pages: AdvancedManager;\n\n /** Instantiate pages, and add the current page to pages */\n install() {\n this.pages = new AdvancedManager(this.app);\n\n let URLString = newURL().pathname;\n this.set(URLString, new Page());\n URLString = undefined;\n }\n\n get(key) { return this.pages.get(key); }\n add(value) { this.pages.add(value); return this; }\n set(key, value) { this.pages.set(key, value); return this; }\n remove(key) { this.pages.remove(key); return this; }\n has(key) { return this.pages.has(key); }\n clear() { this.pages.clear(); return this; }\n get size() { return this.pages.size; }\n keys() { return this.pages.keys(); }\n\n /** Load from cache or by requesting URL via a fetch request, avoid requesting for the same thing twice by storing the fetch request in \"this.loading\" */\n public async load(_url: URL | string = newURL()): Promise {\n let url: URL = newURL(_url);\n let urlString: string = url.pathname;\n let page: Page, request: Promise;\n\n if (this.has(urlString)) {\n page = this.get(urlString);\n return Promise.resolve(page);\n }\n\n if (!this.loading.has(urlString)) {\n request = this.request(urlString);\n this.loading.set(urlString, request);\n } else request = this.loading.get(urlString);\n\n let response = await request;\n this.loading.remove(urlString);\n\n page = new Page(url, response);\n this.set(urlString, page);\n\n if (this.size > getConfig(this.config, \"maxPages\")) {\n let currentUrl = newURL();\n let keys = this.keys();\n let first = equal(currentUrl, keys[0]) ? keys[1] : keys[0];\n let page = this.get(first);\n page.unregister();\n page = undefined;\n keys = undefined;\n currentUrl = undefined;\n first = undefined;\n }\n\n return page;\n }\n\n /** Starts a fetch request */\n public async request(url: string): Promise {\n const headers = new Headers(getConfig(this.config, \"headers\"));\n const timeout = window.setTimeout(() => {\n window.clearTimeout(timeout);\n throw \"Request Timed Out!\";\n }, getConfig(this.config, \"timeout\"));\n\n try {\n let response = await fetch(url, {\n mode: 'same-origin',\n method: \"GET\",\n headers,\n cache: \"default\",\n credentials: \"same-origin\",\n });\n\n window.clearTimeout(timeout);\n if (response.status >= 200 && response.status < 300) {\n return await response.text();\n }\n\n const err = new Error(response.statusText || \"\" + response.status);\n throw err;\n } catch (err) {\n window.clearTimeout(timeout);\n throw err;\n }\n }\n}\n", "import { Manager, methodCall } from \"@okikio/manager\";\n\nexport type ListenerCallback = ((...args: any) => void);\nexport interface IListener {\n readonly callback: ListenerCallback;\n readonly scope: object;\n readonly name: string;\n}\n\n/** Represents a new event listener consisting of properties like: callback, scope, name */\nexport const newListener = ({\n callback = () => { },\n scope = null,\n name = \"event\",\n}: IListener): IListener => ({ callback, scope, name });\n\n/** Represents a new event */\nexport class Event extends Manager {\n /** The name of the event */\n public name: string;\n constructor(name: string = \"event\") {\n super();\n this.name = name;\n }\n}\n\nexport type EventInput = string | object | Array;\n\n/**\n * An Event Emitter\n * */\nexport class EventEmitter extends Manager {\n constructor() {\n super();\n }\n\n /** Gets event, if event doesn't exist create a new one */\n public getEvent(name: string): Event {\n let event = this.get(name);\n if (!(event instanceof Event)) {\n this.set(name, new Event(name));\n return this.get(name);\n }\n\n return event;\n }\n\n /** Creates a listener and adds it to an event */\n public newListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event = this.getEvent(name);\n event.add(newListener({ name, callback, scope }));\n return event;\n }\n\n /** Adds a listener to a given event */\n public on(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n this.newListener(_name, _callback, _scope);\n }, this);\n return this;\n }\n\n /** Removes a listener from an event */\n public removeListener(\n name: string,\n callback: ListenerCallback,\n scope: object\n ): Event {\n let event: Event = this.get(name);\n if (event instanceof Event && callback) {\n let listener = newListener({ name, callback, scope });\n\n event.forEach((value: IListener, i: number) => {\n if (\n value.callback === listener.callback &&\n value.scope === listener.scope\n ) {\n return event.remove(i);\n }\n });\n }\n\n return event;\n }\n\n /** Remove a listener from a given event, or just completely remove an event */\n public off(\n events: EventInput,\n callback?: ListenerCallback | object,\n scope?: object\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n let _name: string;\n let _callback: ListenerCallback;\n let isObject = typeof events == \"object\" && !Array.isArray(events);\n\n let _scope: object = isObject ? callback : scope;\n if (!isObject) _callback = (callback as ListenerCallback);\n\n // Loop through the list of events\n Object.keys(events).forEach(key => {\n // Select the name of the event from the list\n // Remember events can be {String | Object | Array}\n\n // Check If events is an Object (JSON like Object, and not an Array)\n if (isObject) {\n _name = key;\n _callback = events[key];\n } else {\n _name = events[key];\n }\n\n if (typeof _callback === \"function\") {\n this.removeListener(_name, _callback, _scope);\n } else this.remove(_name);\n }, this);\n return this;\n }\n\n /** Call all listeners within an event */\n public emit(\n events: string | Array,\n ...args: any\n ): EventEmitter {\n // If there is no event break\n if (typeof events == \"undefined\") return this;\n\n // Create a new event every space\n if (typeof events == \"string\") events = events.trim().split(/\\s/g);\n\n // Loop through the list of events\n events.forEach((event: string) => {\n let _event: Event = this.get(event);\n\n if (_event instanceof Event) {\n _event.forEach((listener: IListener) => {\n let { callback, scope } = listener;\n callback.apply(scope, args);\n });\n }\n }, this);\n return this;\n }\n\n /** Clears events and event listeners */\n public clear() {\n methodCall(this, \"clear\");\n super.clear();\n return this;\n }\n}\n\nexport default EventEmitter;\n", "import { Manager } from \"./manager\";\nimport { ICoords, newCoords, Trigger } from \"./history\";\nimport { IPage } from \"./page\";\nimport { getConfig } from \"./config\";\nimport { Service } from \"./service\";\nimport { newURL } from \"./url\";\n\n/**\n * The async function type, allows for smooth transition between Promises\n */\nexport type asyncFn = (err?: any, value?: any) => void;\nexport interface ITransition {\n oldPage?: IPage;\n newPage?: IPage;\n trigger?: Trigger;\n scroll?: { x: number; y: number };\n scrollable?: boolean;\n in: (data: ITransitionData) => any;\n out: (data: ITransitionData) => any;\n [key: string]: any;\n}\nexport interface ITransitionData {\n from?: IPage;\n to?: IPage;\n trigger?: Trigger;\n scroll?: ICoords;\n done: asyncFn;\n}\nexport interface ITransitionManager extends Service {\n transitions: Manager,\n\n get(key: string): ITransition,\n set(key: string, value: ITransition): TransitionManager,\n add(value: ITransition): TransitionManager,\n has(key: string): boolean,\n\n boot(): any,\n animate(name: string, data: any): Promise,\n}\n\n/** Auto scrolls to an elements position if the element has an hash */\nexport const hashAction = (coords?: ICoords, hash: string = window.location.hash) => {\n try {\n let _hash = hash[0] == \"#\" ? hash : newURL(hash).hash;\n if (_hash.length > 1) {\n let el = document.getElementById(_hash.slice(1));\n if (el) {\n let { left, top } = el.getBoundingClientRect();\n let scrollLeft = window.pageXOffset;\n let scrollTop = window.pageYOffset;\n let x = left + scrollLeft;\n let y = top + scrollTop;\n\n console.log(x, y);\n return newCoords(x, y);\n }\n }\n } catch (e) {\n console.warn(\"[hashAction] error\", e);\n }\n\n return coords ?? newCoords(0, 0);\n};\n\n// The Default Transition\nconst Default: ITransition = {\n name: \"default\",\n scrollable: true,\n\n out({ done }: ITransitionData) {\n done();\n },\n in({ scroll, done }: ITransitionData) {\n window.scroll(scroll.x, scroll.y);\n done();\n }\n};\n\n/** Controls which Transition between pages to use */\nexport class TransitionManager extends Service implements ITransitionManager {\n transitions: Manager;\n private _arg: Array<[string, ITransition]>;\n constructor(transitions?: Array<[string, ITransition]>) {\n super();\n this._arg = transitions;\n }\n\n /** On Service install set Config */\n public install() {\n super.install();\n\n let transitions = this._arg && this._arg.length ? this._arg : (getConfig(this.config, \"transitions\") ?? []);\n\n // Manager like Maps use the most recent [key, value] Array it knows, replacing the default transition\n // With any other transitions called [\"default\", ...]\n transitions = [[\"default\", Default]].concat(transitions);\n this.transitions = new Manager(transitions);\n }\n\n get(key: string) { return this.transitions.get(key); }\n set(key: string, value: ITransition) { this.transitions.set(key, value); return this; }\n add(value: ITransition) { this.transitions.add(value); return this; }\n has(key: string) { return this.transitions.has(key); }\n\n /** Starts a transition */\n public async animate(name: string, data: any): Promise {\n let transition: ITransition = this.transitions.get(name);\n let scroll = data.scroll;\n let ignoreHashAction = data.ignoreHashAction;\n if (!(\"wrapper\" in data.oldPage) || !(\"wrapper\" in data.newPage))\n throw `[Page] either oldPage or newPage aren't instances of the Page Class.\\n ${{\n newPage: data.newPage,\n oldPage: data.oldPage,\n }}`;\n\n // Replace the title\n document.title = `` + data.newPage.title;\n\n let fromWrapper = data.oldPage.wrapper;\n let toWrapper = data.newPage.wrapper;\n\n if (!(fromWrapper instanceof Node) || !(toWrapper instanceof Node))\n throw `[Wrapper] the wrapper from the ${!(toWrapper instanceof Node) ? \"next\" : \"current\"\n } page cannot be found. The wrapper must be an element that has the attribute ${getConfig(this.config,\n \"wrapperAttr\"\n )}.`;\n\n // Give the Transition all the background data it may require\n transition.init && transition?.init(data);\n\n this.emitter.emit(\"BEFORE_TRANSITION_OUT\");\n\n // Start the out point of the Transition\n if (transition.out) {\n await new Promise((done) => {\n let outMethod: Promise = transition.out.call(transition, {\n ...data,\n from: data.oldPage,\n trigger: data.trigger,\n done,\n });\n\n outMethod?.then(done);\n });\n }\n\n this.emitter.emit(\"AFTER_TRANSITION_OUT\");\n\n // Add the new wrapper before the old one\n await new Promise((done) => {\n fromWrapper.insertAdjacentElement(\"beforebegin\", toWrapper);\n this.emitter.emit(\"CONTENT_INSERT\");\n\n if (!ignoreHashAction && !/back|popstate|forward/.test(data.trigger as string)) {\n scroll = hashAction(scroll);\n }\n done();\n });\n\n // Replace the old wrapper with the new one\n await new Promise((done) => {\n fromWrapper.remove();\n fromWrapper = undefined;\n toWrapper = undefined;\n this.emitter.emit(\"CONTENT_REPLACED\");\n done();\n });\n\n this.emitter.emit(\"BEFORE_TRANSITION_IN\");\n\n // Start the in point of the Transition (only the in method has access to the hashAction's scroll position)\n if (transition.in) {\n await new Promise(async (done) => {\n let inMethod: Promise = transition.in.call(transition, {\n ...data,\n from: data.oldPage,\n to: data.newPage,\n trigger: data.trigger,\n scroll,\n done,\n });\n\n inMethod?.then(done);\n });\n }\n\n this.emitter.emit(\"AFTER_TRANSITION_IN\");\n return transition;\n }\n}\n", "import { EventEmitter, ListenerCallback, EventInput } from \"./emitter\";\nimport { ServiceManager, Service } from \"./service\";\nimport { newConfig, ICONFIG, getConfig } from \"./config\";\n\nexport interface IApp {\n services: ServiceManager,\n emitter: EventEmitter,\n config: ICONFIG,\n register(config: ICONFIG): App,\n get(key: string): Service,\n set(key: string, service: Service): App,\n add(value: Service): App,\n boot(): App,\n stop(): App,\n on(events: EventInput, callback?: ListenerCallback): App,\n off(events: EventInput, callback?: ListenerCallback): App,\n emit(events: string | any[], ...args: any): App,\n}\n\n/** The App class starts the entire process, it controls all managers and all services */\nexport class App implements IApp {\n /** An instance of the ServiceManager */\n public services: ServiceManager;\n\n /** An instance of an EventEmitter */\n public emitter: EventEmitter;\n\n /** The current Configuration's for the App */\n public config: ICONFIG;\n\n private canResize = true;\n private canScroll = true;\n constructor(config: object = {}) {\n this._resize = this._resize.bind(this);\n this._scroll = this._scroll.bind(this);\n this._ready = this._ready.bind(this);\n this.register(config);\n }\n\n /** Create new instances of the ServiceManager, EventEmitter and the configurations */\n public register(config: ICONFIG = {}): App {\n this.config = newConfig(config);\n this.emitter = new EventEmitter();\n this.services = new ServiceManager(this);\n\n document.addEventListener(\"DOMContentLoaded\", this._ready);\n window.addEventListener(\"load\", this._ready);\n window.addEventListener(\"resize\", this._resize, { passive: true });\n window.addEventListener(\"scroll\", this._scroll, { passive: true });\n return this;\n }\n\n private _ready() {\n document.removeEventListener(\"DOMContentLoaded\", this._ready);\n window.removeEventListener(\"load\", this._ready);\n this.emitter.emit(\"READY ready\");\n }\n\n private _resize() {\n if (this.canResize) {\n let timer: number | void, raf: number | void;\n this.canResize = false;\n raf = window.requestAnimationFrame(() => {\n this.emitter.emit(\"RESIZE resize\");\n\n // set a timeout to un-throttle\n timer = window.setTimeout(() => {\n this.canResize = true;\n timer = window.clearTimeout(timer as number);\n raf = window.cancelAnimationFrame(raf as number);\n }, getConfig(this.config, \"resizeDelay\"));\n });\n }\n }\n\n private _scroll() {\n if (this.canScroll) {\n let raf: number | void;\n this.canScroll = false;\n raf = requestAnimationFrame(() => {\n this.emitter.emit(\"SCROLL scroll\");\n\n this.canScroll = true;\n raf = window.cancelAnimationFrame(raf as number);\n });\n }\n }\n\n /** Shortcuts to adding, setting, and getting Services */\n public get(key: string): Service {\n return this.services.get(key);\n }\n\n public set(key: string, value: Service): App {\n this.services.set(key, value);\n return this;\n }\n\n public add(value: Service): App {\n this.services.add(value);\n return this;\n }\n\n /** Initialize and boot all Services */\n public boot(): App {\n this.services.init();\n this.services.boot();\n return this;\n }\n\n /** Stops all Services and clears the even emitter of all events and listeners */\n public stop(): App {\n this.services.stop();\n this.emitter.clear();\n return this;\n }\n\n /** Shortcuts to the App EventEmitter on, off, and emit methods */\n public on(events: EventInput, callback?: ListenerCallback): App {\n this.emitter.on(events, callback, this);\n return this;\n }\n\n public off(events: EventInput, callback?: ListenerCallback): App {\n this.emitter.off(events, callback, this);\n return this;\n }\n\n public emit(events: string | any[], ...args: any): App {\n this.emitter.emit(events, ...args);\n return this;\n }\n}\n", "import { newState, Trigger, newCoords, IHistoryItem, IHistoryManager } from \"./history\";\nimport { Service } from \"./service\";\nimport { IPage, IPageManager } from \"./page\";\nimport { newURL, getHashedPath, equal } from \"./url\";\nimport { getConfig } from \"./config\";\nimport { hashAction, ITransitionManager } from \"./transition\";\n\nexport type LinkEvent = MouseEvent | TouchEvent;\nexport type StateEvent = LinkEvent | PopStateEvent;\nexport type IgnoreURLsList = Array;\n/**\n * Creates a barbajs like PJAX Service, for the native framework\n * Based on barbajs and StartingBlocks\n */\nexport class PJAX extends Service {\n /** URLs to ignore when prefetching */\n public ignoreURLs: IgnoreURLsList;\n\n /** Whether or not to disable prefetching */\n public prefetchIgnore: boolean;\n\n /** Current state of transitions */\n public isTransitioning: boolean;\n\n /** Ignore extra clicks of an anchor element if a transition has already started */\n public stopOnTransitioning: boolean;\n\n /** On page change (excluding popstate events) keep current scroll position */\n public stickyScroll: boolean;\n\n /** Force load a page if an error occurs */\n public forceOnError: boolean;\n\n /** Ignore hash action if set to true */\n public ignoreHashAction: boolean;\n\n public install() {\n super.install();\n\n this.ignoreURLs = getConfig(this.config, \"ignoreURLs\") ?? [];\n this.prefetchIgnore = getConfig(this.config, \"prefetchIgnore\") ?? false;\n this.stopOnTransitioning = getConfig(this.config, \"stopOnTransitioning\") ?? false;\n this.stickyScroll = getConfig(this.config, \"stickyScroll\") ?? false;\n this.forceOnError = getConfig(this.config, \"forceOnError\") ?? false;\n this.ignoreHashAction = getConfig(this.config, \"ignoreHashAction\") ?? false\n }\n\n /** Sets the transition state to either true or false */\n public transitionStart() {\n this.isTransitioning = true;\n }\n\n public transitionStop() {\n this.isTransitioning = false;\n }\n\n public init() {\n /**\n * Bind the event listeners to the PJAX class\n *\n * @memberof PJAX\n */\n this.onHover = this.onHover.bind(this);\n this.onClick = this.onClick.bind(this);\n this.onStateChange = this.onStateChange.bind(this);\n }\n\n /** Starts the PJAX Service */\n public boot() {\n if (\"scrollRestoration\" in window.history) {\n // Back off, browser, I got this...\n window.history.scrollRestoration = \"manual\";\n }\n\n super.boot();\n }\n\n /** Gets the transition to use for a certain anchor */\n public getTransitionName(el: HTMLAnchorElement): string | null {\n if (!el || !el.getAttribute) return null;\n let transitionAttr = el.getAttribute(\n getConfig(this.config, \"transitionAttr\", false)\n );\n\n if (typeof transitionAttr === \"string\") return transitionAttr;\n return null;\n }\n\n /** Checks to see if the anchor is valid */\n public validLink(\n el: HTMLAnchorElement,\n event: LinkEvent | KeyboardEvent,\n href: string\n ): boolean {\n let pushStateSupport = !window.history.pushState;\n let exists = !el || !href;\n let eventMutate =\n (event as KeyboardEvent).metaKey ||\n (event as KeyboardEvent).ctrlKey ||\n (event as KeyboardEvent).shiftKey ||\n (event as KeyboardEvent).altKey;\n let newTab =\n el.hasAttribute(\"target\") &&\n (el as HTMLAnchorElement).target === \"_blank\";\n let crossOrigin =\n (el as HTMLAnchorElement).protocol !== location.protocol ||\n (el as HTMLAnchorElement).hostname !== location.hostname;\n let download = typeof el.getAttribute(\"download\") === \"string\";\n let preventSelf = el.matches(getConfig(this.config, \"preventSelfAttr\"));\n let preventAll = Boolean(\n el.closest(getConfig(this.config, \"preventAllAttr\"))\n );\n let sameURL = getHashedPath(newURL()) === getHashedPath(newURL(href));\n return !(\n exists ||\n pushStateSupport ||\n eventMutate ||\n newTab ||\n crossOrigin ||\n download ||\n preventSelf ||\n preventAll ||\n sameURL\n );\n }\n\n /** Returns the href of an Anchor element */\n public getHref(el: HTMLAnchorElement): string | null {\n if (\n el &&\n el.tagName &&\n el.tagName.toLowerCase() === \"a\" &&\n typeof el.href === \"string\"\n )\n return el.href;\n return null;\n }\n\n /** Check if event target is a valid anchor with an href, if so, return the anchor */\n public getLink(event: LinkEvent): HTMLAnchorElement {\n let el = event.target as HTMLAnchorElement;\n let href: string = this.getHref(el);\n\n while (el && !href) {\n el = (el as HTMLElement).parentNode as HTMLAnchorElement;\n href = this.getHref(el);\n }\n\n // Check for a valid link\n if (!el || !this.validLink(el, event, href)) return;\n return el;\n }\n\n /** When an element is clicked, get valid anchor element, go for a transition */\n public onClick(event: LinkEvent) {\n let el = this.getLink(event);\n if (!el) return;\n\n if (this.isTransitioning && this.stopOnTransitioning) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n let href = this.getHref(el);\n this.emitter.emit(\"ANCHOR_CLICK CLICK\", event);\n this.go({ href, trigger: el, event });\n }\n\n /** Returns the direction of the State change as a String, either the Back button or the Forward button */\n public getDirection(value: number): Trigger {\n if (Math.abs(value) > 1) {\n // Ex 6-0 > 0 -> forward, 0-6 < 0 -> back\n return value > 0 ? \"forward\" : \"back\";\n } else {\n if (value === 0) {\n return \"popstate\";\n } else {\n // Ex 6-5 > 0 -> back, 5-6 < 0 -> forward\n return value > 0 ? \"back\" : \"forward\";\n }\n }\n }\n\n /** Force a page to go to a certain URL */\n public force(href: string): void {\n window.location.assign(href);\n }\n\n /**\n * If transition is running force load page.\n * Stop if currentURL is the same as new url.\n * On state change, change the current state history, to reflect the direction of said state change\n * Load page and page transition.\n */\n public go({\n href,\n trigger = \"HistoryManager\",\n event,\n }: {\n href: string;\n trigger?: Trigger;\n event?: StateEvent;\n }): Promise {\n // If transition is already running and the go method is called again, force load page\n if (this.isTransitioning && this.stopOnTransitioning ||\n !(this.manager.has(\"TransitionManager\") &&\n this.manager.has(\"HistoryManager\") &&\n this.manager.has(\"PageManager\"))) {\n this.force(href);\n return;\n }\n\n const history = this.manager.get(\"HistoryManager\") as IHistoryManager;\n let scroll = newCoords(0, 0);\n let currentState = history.current;\n let currentURL = currentState.url;\n if (equal(currentURL, href)) {\n return;\n }\n\n let transitionName: string;\n if (event && (event as PopStateEvent).state) {\n this.emitter.emit(\"POPSTATE\", event);\n\n // If popstate, get back/forward direction.\n let { state }: { state: IHistoryItem } = event as PopStateEvent;\n let { index } = state;\n let currentIndex = currentState.index;\n let difference = currentIndex - index;\n\n history.replace(state.states);\n history.pointer = index;\n\n let _state = history.get(index);\n transitionName = _state.transition;\n scroll = _state.data.scroll;\n\n trigger = this.getDirection(difference);\n console.log(trigger == \"forward\" && history)\n\n // Based on the direction of the state change either remove or add a state\n this.emitter.emit(trigger === \"back\" ? `POPSTATE_BACK` : `POPSTATE_FORWARD`, event);\n } else {\n // Add new state\n transitionName = this.getTransitionName(trigger as HTMLAnchorElement);\n\n scroll = newCoords();\n let state = newState({\n url: href,\n transition: transitionName,\n data: { scroll },\n });\n\n !this.stickyScroll && (scroll = newCoords(0, 0));\n\n history.add(state);\n this.emitter.emit(\"HISTORY_NEW_ITEM\", event);\n }\n\n if (event) {\n event.stopPropagation();\n event.preventDefault();\n }\n\n this.emitter.emit(\"GO\", event);\n return this.load({\n oldHref: currentURL,\n href,\n trigger,\n transitionName,\n scroll,\n });\n }\n\n /** Load the new Page as well as a Transition; starts the Transition */\n public async load({\n oldHref,\n href,\n trigger,\n transitionName = \"default\",\n scroll = { x: 0, y: 0 },\n }: {\n oldHref: string;\n href: string;\n trigger: Trigger;\n transitionName?: string;\n scroll: { x: number; y: number };\n }): Promise {\n try {\n const pages = this.manager.get(\"PageManager\") as IPageManager;\n let newPage: IPage, oldPage: IPage;\n this.emitter.emit(\"NAVIGATION_START\", {\n oldHref,\n href,\n trigger,\n transitionName,\n });\n\n // Load & Build both the old and new pages\n try {\n this.transitionStart();\n oldPage = await pages.load(oldHref);\n !(oldPage.dom instanceof Element) && oldPage.build();\n\n this.emitter.emit(\"PAGE_LOADING\", { href, oldPage, trigger });\n newPage = await pages.load(href);\n await newPage.build();\n this.emitter.emit(\"PAGE_LOAD_COMPLETE\", {\n newPage,\n oldPage,\n trigger,\n });\n } catch (err) {\n console.warn(`[PJAX] Page load error: ${err}`);\n }\n\n // Transition Between Pages\n try {\n const TransitionManager = this.manager.get(\"TransitionManager\") as ITransitionManager;\n this.emitter.emit(\"TRANSITION_START\", transitionName);\n\n let transition = await TransitionManager.animate(TransitionManager.has(transitionName) ? transitionName : \"default\", {\n oldPage,\n newPage,\n trigger,\n scroll,\n ignoreHashAction: this.ignoreHashAction\n });\n\n if (!transition.scrollable) {\n if (!this.ignoreHashAction && !/back|popstate|forward/.test(trigger as string)) scroll = hashAction(scroll);\n window.scroll(scroll.x, scroll.y);\n }\n\n this.emitter.emit(\"TRANSITION_END\", { transition });\n } catch (err) {\n console.warn(`[PJAX] Transition error: ${err}`);\n }\n\n // Navigation is over\n this.emitter.emit(\"NAVIGATION_END\", {\n oldPage,\n newPage,\n trigger,\n transitionName,\n });\n } catch (err) {\n if (this.forceOnError) this.force(href);\n else console.warn(err);\n } finally {\n this.transitionStop(); // Sets isTransitioning to false\n }\n }\n\n /** Check to see if the URL is to be ignored, uses either RegExp of Strings to check */\n public ignoredURL({ pathname }: URL): boolean {\n return (\n this.ignoreURLs.length &&\n this.ignoreURLs.some((url) => {\n return typeof url === \"string\"\n ? url === pathname\n : (url as RegExp).exec(pathname) !== null;\n })\n );\n }\n\n /** When you hover over an anchor, prefetch the event target's href */\n public onHover(event: LinkEvent): Promise {\n let el = this.getLink(event);\n if (!el || !this.manager.has(\"PageManager\")) return;\n\n const pages = this.manager.get(\"PageManager\") as IPageManager;\n let url = newURL(this.getHref(el));\n let urlString: string = url.pathname;\n\n // If Url is ignored or already in cache, don't do any think\n if (this.ignoredURL(url) || pages.has(urlString)) return;\n this.emitter.emit(\"ANCHOR_HOVER HOVER\", event);\n\n try {\n pages.load(url);\n } catch (err) {\n console.warn(\"[PJAX] prefetch error,\", err);\n }\n }\n\n /** When History state changes, get url from State, go for a Transition. */\n public onStateChange(event: PopStateEvent): void {\n this.go({ href: window.location.href, trigger: \"popstate\", event });\n }\n\n /** Initialize DOM Events */\n public initEvents() {\n if (this.prefetchIgnore !== true) {\n document.addEventListener(\"mouseover\", this.onHover);\n document.addEventListener(\"touchstart\", this.onHover);\n }\n\n document.addEventListener(\"click\", this.onClick);\n window.addEventListener(\"popstate\", this.onStateChange);\n }\n\n /** Stop DOM Events */\n public stopEvents() {\n if (this.prefetchIgnore !== true) {\n document.removeEventListener(\"mouseover\", this.onHover);\n document.removeEventListener(\"touchstart\", this.onHover);\n }\n\n document.removeEventListener(\"click\", this.onClick);\n window.removeEventListener(\"popstate\", this.onStateChange);\n }\n}\n", "import { Service } from \"./service\";\nimport { Manager } from \"./manager\";\nimport { newURL, getHashedPath } from \"./url\";\nimport { IHistoryManager } from \"./history\";\n\nexport type RouteMethod = (...args: any) => any;\nexport type RouteStyle = string | RegExp | boolean;\nexport interface IRouteToFrom {\n to: RouteStyle,\n from: RouteStyle\n}\nexport type RoutePath = IRouteToFrom | RouteStyle;\nexport interface IRoute {\n path: RoutePath,\n method: RouteMethod\n}\n\n/** Controls what happens when certain url paths match a set of criteria */\nexport class Router extends Service {\n /** List of routes */\n protected routes: Manager;\n constructor(routes: IRoute[] = []) {\n super();\n this.routes = new Manager();\n for (let route of routes) {\n this.add(route);\n }\n }\n\n /** Add a new route to watch for */\n public add({ path, method }: IRoute): Router {\n let key = this.parse(path);\n this.routes.set(key, method);\n return this;\n }\n\n /** Convert strings into path match functions */\n public parsePath(path: RouteStyle): RegExp | boolean {\n if (typeof path === \"string\") return new RegExp(path, \"i\");\n else if (path instanceof RegExp || typeof path === \"boolean\")\n return path;\n throw \"[Router] only regular expressions, strings and booleans are accepted as paths.\";\n }\n\n /** Determines if a strings counts has a path */\n public isPath(input: RouteStyle): boolean {\n return (\n typeof input === \"string\" ||\n input instanceof RegExp ||\n typeof input === \"boolean\"\n );\n }\n\n /** Parse the multiple different formats for paths, into a { from, to } object */\n public parse(input: RoutePath): IRouteToFrom {\n let route = input as IRouteToFrom;\n let toFromPath: IRouteToFrom = {\n from: /(.*)/g,\n to: /(.*)/g,\n };\n\n if (this.isPath(input as RouteStyle))\n toFromPath = {\n from: true,\n to: input as RouteStyle,\n };\n else if (this.isPath(route.from) && this.isPath(route.to as RouteStyle))\n toFromPath = route;\n else\n throw \"[Router] path is neither a string, regular expression, or a { from, to } object.\";\n\n let { from, to } = toFromPath;\n return {\n from: this.parsePath(from),\n to: this.parsePath(to),\n };\n }\n\n /** Test if route paths are true, if so run their methods */\n public route() {\n if (this.manager.has(\"HistoryManager\")) {\n let history = this.manager.get(\"HistoryManager\") as IHistoryManager;\n let from: string = getHashedPath(newURL((history.length > 1 ? history.previous : history.current).url));\n let to: string = getHashedPath(newURL());\n\n this.routes.forEach((method: RouteMethod, path: IRouteToFrom) => {\n let fromRegExp = path.from as RegExp | boolean;\n let toRegExp = path.to as RegExp | boolean;\n\n if (\n typeof fromRegExp === \"boolean\" &&\n typeof toRegExp === \"boolean\"\n ) {\n throw `[Router] path ({ from: ${fromRegExp}, to: ${toRegExp} }) is not valid, remember paths can only be strings, regular expressions, or a boolean; however, both the from and to paths cannot be both booleans.`;\n }\n\n let fromParam: RegExpExecArray | RegExp | boolean = fromRegExp;\n let toParam: RegExpExecArray | RegExp | boolean = toRegExp;\n\n if (fromRegExp instanceof RegExp && fromRegExp.test(from))\n fromParam = fromRegExp.exec(from);\n if (toRegExp instanceof RegExp && toRegExp.test(to))\n toParam = toRegExp.exec(to);\n\n if (\n (Array.isArray(toParam) && Array.isArray(fromParam)) ||\n (Array.isArray(toParam) &&\n typeof fromParam == \"boolean\" &&\n fromParam) ||\n (Array.isArray(fromParam) &&\n typeof toParam == \"boolean\" &&\n toParam)\n )\n method({ from: fromParam, to: toParam, path: { from, to } });\n });\n } else {\n console.warn(\"[Route] HistoryManager is missing.\");\n }\n }\n\n /** Add listeners for PJAX Events */\n public initEvents() {\n this.emitter.on(\"READY\", this.route, this);\n this.emitter.on(\"CONTENT_REPLACED\", this.route, this);\n }\n\n /** Remove listeners for PJAX Events */\n public stopEvents() {\n this.emitter.off(\"READY\", this.route, this);\n this.emitter.off(\"CONTENT_REPLACED\", this.route, this);\n }\n}\n", "import { EventEmitter, EventInput, ListenerCallback } from \"@okikio/emitter\";\nimport { Manager } from \"@okikio/manager\";\n\n// DOM\nexport type AnimationTarget = string | Node | NodeList | HTMLCollection | HTMLElement[] | AnimationTarget[];\nexport const getElements = (selector: string | Node): Node[] => {\n return typeof selector === \"string\" ? Array.from(document.querySelectorAll(selector as string)) : [selector];\n};\n\nconst flatten = (arr: AnimationTarget[]) => [].concat(...arr);\nexport const getTargets = (targets: AnimationTarget): Node[] => {\n if (Array.isArray(targets)) {\n return flatten((targets as AnimationTarget[]).map(getTargets));\n }\n if (typeof targets == \"string\" || targets instanceof Node)\n return getElements(targets);\n if (targets instanceof NodeList || targets instanceof HTMLCollection)\n return Array.from(targets);\n return [];\n};\n\n// VALUES\nexport type closureArgs = [number, number, HTMLElement];\nexport type closure = ((index?: number, total?: number, element?: HTMLElement) => (genericTypes[] | void)) | any;\nexport const computeValue = (value: closure, args: closureArgs, context: Animate) => {\n if (typeof value === \"function\") {\n return value.apply(context, args);\n } else { return value; }\n};\n\nexport const mapObject = (obj: object, args: closureArgs, options: Animate): any => {\n let key: string, value: any, result = {};\n let keys = Object.keys(obj);\n for (let i = 0, len = keys.length; i < len; i++) {\n key = keys[i];\n value = obj[key];\n result[key] = computeValue(value, args, options);\n }\n\n return result;\n};\n\n/** From: [https://easings.net] */\nexport const easings = {\n \"in\": \"ease-in\",\n \"out\": \"ease-out\",\n \"in-out\": \"ease-in-out\",\n\n // Sine\n \"in-sine\": \"cubic-bezier(0.47, 0, 0.745, 0.715)\",\n \"out-sine\": \"cubic-bezier(0.39, 0.575, 0.565, 1)\",\n \"in-out-sine\": \"cubic-bezier(0.445, 0.05, 0.55, 0.95)\",\n\n // Quad\n \"in-quad\": \"cubic-bezier(0.55, 0.085, 0.68, 0.53)\",\n \"out-quad\": \"cubic-bezier(0.25, 0.46, 0.45, 0.94)\",\n \"in-out-quad\": \"cubic-bezier(0.455, 0.03, 0.515, 0.955)\",\n\n // Cubic\n \"in-cubic\": \"cubic-bezier(0.55, 0.055, 0.675, 0.19)\",\n \"out-cubic\": \"cubic-bezier(0.215, 0.61, 0.355, 1)\",\n \"in-out-cubic\": \"cubic-bezier(0.645, 0.045, 0.355, 1)\",\n\n // Quart\n \"in-quart\": \"cubic-bezier(0.895, 0.03, 0.685, 0.22)\",\n \"out-quart\": \"cubic-bezier(0.165, 0.84, 0.44, 1)\",\n \"in-out-quart\": \"cubic-bezier(0.77, 0, 0.175, 1)\",\n\n // Quint\n \"in-quint\": \"cubic-bezier(0.755, 0.05, 0.855, 0.06)\",\n \"out-quint\": \"cubic-bezier(0.23, 1, 0.32, 1)\",\n \"in-out-quint\": \"cubic-bezier(0.86, 0, 0.07, 1)\",\n\n // Expo\n \"in-expo\": \"cubic-bezier(0.95, 0.05, 0.795, 0.035)\",\n \"out-expo\": \"cubic-bezier(0.19, 1, 0.22, 1)\",\n \"in-out-expo\": \"cubic-bezier(1, 0, 0, 1)\",\n\n // Circ\n \"in-circ\": \"cubic-bezier(0.6, 0.04, 0.98, 0.335)\",\n \"out-circ\": \"cubic-bezier(0.075, 0.82, 0.165, 1)\",\n \"in-out-circ\": \"cubic-bezier(0.785, 0.135, 0.15, 0.86)\",\n\n // Back\n \"in-back\": \"cubic-bezier(0.6, -0.28, 0.735, 0.045)\",\n \"out-back\": \"cubic-bezier(0.175, 0.885, 0.32, 1.275)\",\n \"in-out-back\": \"cubic-bezier(0.68, -0.55, 0.265, 1.55)\"\n};\n\nexport const getEase = (ease: string) => {\n return /^(in|out)/.test(ease) ? easings[ease] : ease;\n};\n\nexport type genericTypes = genericTypes[] | boolean | object | string | number | closure | null | undefined;\nexport interface AnimationOptions {\n target?: AnimationTarget,\n\n speed?: number,\n autoplay?: boolean,\n options?: AnimationOptions,\n delay?: number | closure,\n easing?: string | closure,\n endDelay?: number | closure,\n duration?: number | closure,\n keyframes?: Keyframe[] | object[] | closure,\n loop?: number | boolean | closure, // iterations: number,\n onfinish?: (element?: HTMLElement, index?: number, total?: number, animation?: Animation) => any,\n fillMode?: \"none\" | \"forwards\" | \"backwards\" | \"both\" | \"auto\" | closure,\n direction?: \"normal\" | \"reverse\" | \"alternate\" | \"alternate-reverse\" | closure,\n extend?: EffectTiming,\n [property: string]: genericTypes;\n};\n\nexport const DefaultAnimationOptions: AnimationOptions = {\n keyframes: [],\n\n loop: 1, // iterations: number,\n delay: 0,\n speed: 1,\n endDelay: 0,\n easing: \"ease\",\n autoplay: true,\n duration: 1000,\n fillMode: \"auto\",\n direction: \"normal\",\n extend: {}\n};\n\nexport type AnimationEvents = \"update\" | \"play\" | \"pause\" | \"start\" | \"begin\" | \"complete\" | \"finish\" | \"error\" | \"stop\";\n\n/** You can check it out here: https://codepen.io/okikio/pen/qBbdGaW?editors=0011 */\nexport class Animate {\n /**\n * Stores the options for the current animation\n */\n public options: AnimationOptions = {};\n\n /**\n * The Array of Elements to Animate\n */\n public targets: Node[] = [];\n\n /**\n * The properties to animate\n */\n public properties: object = {};\n\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n\n /**\n * The total duration of all Animation's\n */\n public totalDuration: number = 0;\n\n /**\n * The smallest delay out of all Animation's\n */\n public minDelay: number = 0;\n\n /**\n * The options for individual animations\n */\n public computedOptions: Manager = new Manager();\n\n /**\n * The Element the main animation uses\n */\n public mainElement: HTMLElement;\n\n /**\n * Stores an animation that runs on the total duration of the all other Animations, and as such it's the main Animation\n */\n public mainAnimation: Animation;\n\n /**\n * Stores request frame calls\n */\n public animationFrame: number;\n\n /**\n * An event emitter\n */\n public emitter: EventEmitter = new EventEmitter();\n\n /**\n * Returns a promise that is fulfilled when the mainAnimation is finished\n */\n public promise: Promise;\n constructor(options: AnimationOptions = {}) {\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n\n /**\n * Returns a new Promise that is resolve when this.finish is called\n */\n public newPromise(): Promise {\n return new Promise((resolve, reject) => {\n /*\n Note that the `this` keyword is in an Array when it is resolved,\n this is due to Promises not wanting to resolve references,\n so, you can't resolve `this` directly, so, I chose to resolve `this` in an\n Array\n */\n this.on(\"complete\", () => resolve([this]));\n this.on(\"error\", err => reject(err));\n });\n }\n\n /**\n * Fulfills the this.promise Promise\n */\n public then(\n onFulfilled?: (value?: any) => any,\n onRejected?: (reason?: any) => any\n ): Animate {\n onFulfilled = onFulfilled?.bind(this);\n onRejected = onRejected?.bind(this);\n this.promise.then(onFulfilled, onRejected);\n return this;\n }\n\n /**\n * Catches error that occur in the this.promise Promise\n */\n public catch(onRejected: (reason?: any) => any): Animate {\n onRejected = onRejected?.bind(this);\n this.promise.catch(onRejected);\n return this;\n }\n\n /**\n * If you don't care if the this.promise Promise has either been rejected or resolved\n */\n public finally(onFinally: () => any): Animate {\n onFinally = onFinally?.bind(this);\n this.promise.finally(onFinally);\n return this;\n }\n\n /**\n * Represents an Animation Frame Loop\n */\n public loop(): void {\n this.stopLoop();\n this.emit(\"update\", this.getProgress(), this);\n this.animationFrame = window.requestAnimationFrame(this.loop);\n }\n\n /**\n * Cancels animation frame\n */\n public stopLoop() {\n window.cancelAnimationFrame(this.animationFrame);\n }\n\n /**\n * Calls a method that affects all animations including the mainAnimation; the method only allows the animation parameter\n */\n public all(method: (animation?: Animation, target?: HTMLElement) => void) {\n method(this.mainAnimation, this.mainElement);\n this.animations.forEach(method);\n return this;\n }\n\n /**\n * Register the begin event\n */\n protected beginEvent() {\n if (this.getProgress() == 0) {\n let timer: number | void = window.setTimeout(() => {\n this.emit(\"begin\", this);\n timer = window.clearTimeout(timer as number);\n }, this.minDelay);\n }\n }\n\n /**\n * Play Animation\n */\n public play(): Animate {\n let playstate = this.getPlayState();\n this.beginEvent();\n this.all(anim => anim.play());\n this.emit(\"play\", playstate, this);\n this.loop();\n return this;\n }\n\n /**\n * Pause Animation\n */\n public pause(): Animate {\n let playstate = this.getPlayState();\n this.all(anim => anim.pause());\n this.emit(\"pause\", playstate, this);\n this.stopLoop();\n this.animationFrame = undefined;\n return this;\n }\n\n /**\n * Reset all Animations\n */\n public reset() {\n this.setProgress(0);\n this.beginEvent();\n\n if (this.options.autoplay) this.play();\n else this.pause();\n return this;\n }\n\n /**\n * Cancels all Animations\n */\n public cancel() {\n this.all(anim => anim.cancel());\n this.stopLoop();\n return this;\n }\n\n /**\n * Force complete all Animations\n */\n public finish() {\n this.all(anim => anim.finish());\n this.stopLoop();\n return this;\n }\n\n /**\n * Cancels & Clears all Animations\n */\n public stop() {\n this.cancel();\n this.animations.clear();\n while (this.targets.length) this.targets.pop();\n this.mainElement = undefined;\n this.emit(\"stop\");\n }\n\n /**\n * Returns an Array of targets\n */\n public getTargets(): Node[] {\n return this.targets;\n }\n\n /**\n * Get a specific Animation from an Animate instance\n */\n public getAnimation(element: HTMLElement): Animation {\n return this.animations.get(element);\n }\n\n /**\n * Returns the timings of an Animation, given a target\n * E.g. { duration, endDelay, delay, iterations, iterationStart, direction, easing, fill, etc... }\n */\n public getTiming(target: HTMLElement | Animation): AnimationOptions & EffectTiming {\n let animation = target instanceof Animation ? target : this.getAnimation(target);\n let keyframeOptions = this.computedOptions.get(animation) ?? {};\n let timings = animation.effect?.getTiming() ?? {};\n let options = this.getOptions();\n\n return { ...DefaultAnimationOptions, ...options, ...timings, ...keyframeOptions };\n }\n\n /**\n * Returns the total duration of Animation\n */\n public getTotalDuration(): number {\n return this.totalDuration;\n }\n\n /**\n * Returns the current time of the Main Animation\n */\n public getCurrentTime(): number {\n return this.mainAnimation.currentTime;\n }\n\n /**\n * Returns the Animation progress as a fraction of the current time / duration * 100\n */\n public getProgress() {\n return (this.getCurrentTime() / this.totalDuration) * 100;\n }\n\n /**\n * Return the playback speed of the animation\n */\n public getSpeed(): number {\n return this.mainAnimation.playbackRate;\n }\n\n /**\n * Returns the current playing state\n */\n public getPlayState(): \"idle\" | \"running\" | \"paused\" | \"finished\" {\n return this.mainAnimation.playState;\n }\n\n /**\n * Get the options of an Animate instance\n */\n public getOptions(): AnimationOptions {\n return this.options;\n }\n\n /**\n * Set the current time of the Main Animation\n */\n public setCurrentTime(time: number): Animate {\n this.all(anim => { anim.currentTime = time; });\n this.emit(\"update\", this.getProgress());\n return this;\n }\n\n /**\n * Set the Animation progress as a value from 0 to 100\n */\n public setProgress(percent: number): Animate {\n let time = (percent / 100) * this.totalDuration;\n this.setCurrentTime(time);\n return this;\n }\n\n /**\n * Set the playback speed of an Animation\n */\n public setSpeed(speed: number = 1): Animate {\n this.all(anim => { anim.playbackRate = speed; });\n return this;\n }\n\n /**\n * Adds a listener for a given event\n */\n public on(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.on(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Removes a listener from an event\n */\n public off(events: AnimationEvents | EventInput, callback?: ListenerCallback, scope?: object): Animate {\n this.emitter.off(events, callback, scope ?? this);\n return this;\n }\n\n /**\n * Call all listeners within an event\n */\n public emit(events: AnimationEvents | string | any[], ...args: any): Animate {\n this.emitter.emit(events, ...args);\n return this;\n }\n\n\n /** Returns the Animate options, as JSON */\n public toJSON(): AnimationOptions {\n return this.getOptions();\n }\n\n /**\n * The Symbol.toStringTag well-known symbol is a string valued property that is used\n * in the creation of the default string description of an object.\n * It is accessed internally by the Object.prototype.toString() method.\n */\n get [Symbol.toStringTag]() {\n return `Animate`;\n }\n}\n\n/** Creates a new Animate instance */\nexport const animate = (options: AnimationOptions = {}): Animate => {\n return new Animate(options);\n};\n\nexport class Timeline extends Animate {\n /**\n * A Manager of Animations\n */\n public animations: Manager = new Manager();\n constructor(options: AnimationOptions = {}) {\n super();\n try {\n let { options: animation, ...rest } = options;\n let oldOptions = animation instanceof Animate ? animation.getOptions() : (Array.isArray(animation) ? animation?.[0]?.getOptions() : animation);\n this.options = Object.assign({}, DefaultAnimationOptions, oldOptions, rest);\n this.loop = this.loop.bind(this);\n\n let {\n loop,\n delay,\n speed,\n easing,\n endDelay,\n duration,\n direction,\n fillMode,\n onfinish,\n target,\n keyframes,\n autoplay,\n extend,\n ...properties\n } = this.options;\n\n this.mainElement = document.createElement(\"div\");\n this.targets = getTargets(target);\n this.properties = properties;\n\n let delays = [];\n let len = this.targets.length;\n let animationKeyframe: Keyframe[] | PropertyIndexedKeyframes;\n for (let i = 0; i < len; i++) {\n let target = this.targets[i] as HTMLElement;\n let animationOptions: AnimationOptions = {\n easing: typeof easing == \"string\" ? getEase(easing) : easing,\n iterations: loop === true ? Infinity : (loop as number),\n direction,\n endDelay,\n duration,\n delay,\n fill: fillMode,\n ...extend\n };\n\n // Accept keyframes as a keyframes Object, or a method,\n // if there are no animations in the keyframes array,\n // uses css properties from the options object\n let arrKeyframes = computeValue((keyframes as Keyframe[]), [i, len, target], this);\n animationKeyframe = arrKeyframes.length ? arrKeyframes :\n (this.properties as PropertyIndexedKeyframes);\n\n // Allows the use of functions as the values, for both the keyframes and the animation object\n // It adds the capability of advanced stagger animation, similar to the anime js stagger functions\n animationOptions = mapObject(animationOptions, [i, len, target], this);\n if (!(arrKeyframes.length > 0))\n animationKeyframe = mapObject(animationKeyframe, [i, len, target], this);\n\n // Set the Animate classes duration to be the Animation with the largest totalDuration\n let tempDurations = animationOptions.delay +\n (animationOptions.duration * animationOptions.iterations) +\n animationOptions.endDelay;\n if (this.totalDuration < tempDurations) this.totalDuration = tempDurations;\n\n // Add animation to the Animations Set\n let animation = target.animate(animationKeyframe, animationOptions as KeyframeAnimationOptions);\n\n // Support for on finish\n animation.onfinish = () => {\n typeof onfinish == \"function\" && onfinish.call(this, target, i, len, animation);\n this.emit(\"finish\", target, i, len, animation);\n };\n\n // The calculated options for each individual option\n this.computedOptions.set(animation, animationOptions);\n this.animations.set(target, animation);\n delays.push(animationOptions.delay);\n }\n\n this.mainAnimation = this.mainElement.animate([\n { opacity: \"0\" },\n { opacity: \"1\" }\n ], {\n // Why waste performance on an animation no one can see?\n duration: this.totalDuration,\n easing: \"linear\"\n });\n\n this.minDelay = Math.min(...delays);\n this.setSpeed(speed);\n if (autoplay) this.play();\n else this.pause();\n\n this.promise = this.newPromise();\n this.mainAnimation.onfinish = () => {\n this.emit(\"complete\", this);\n this.stopLoop();\n };\n } catch (err) {\n this.emit(\"error\", err);\n }\n }\n public add(options: AnimationOptions) {\n return this;\n }\n}\n\nexport default animate;"], + "mappings": "8GAAA,msBCgBO,GAAM,GAA2B,CACpC,YAAa,UACb,eAAgB,eAChB,eAAgB,cAChB,QAAS,CACL,CAAC,YAAa,SAElB,gBAAiB,iBACjB,eAAgB,gBAChB,eAAgB,aAChB,UAAW,QACX,QAAS,IACT,SAAU,EACV,YAAa,KAIJ,EAAY,AAAC,GACf,OAAO,OAAO,IAAK,GAAmB,GAIpC,GAAS,CAAC,EAAiB,EAAe,EAAoB,KAAiB,CACxF,GAAI,CAAE,UAAW,EACb,EAAO,OAAO,EAAS,IAAM,EAAS,MAAM,IAChD,MAAO,GAAW,IAAI,KAAU,GAIvB,EAAY,CAAC,EAAiB,EAAoB,EAAoB,KAAc,CAC7F,GAAI,MAAO,IAAU,SACjB,MAAO,GAEX,GAAI,GAAO,EAAO,GAClB,MAAI,OAAO,IAAS,SACT,GAAO,EAAQ,EAAM,GACzB,GCnDJ,WAAoB,CAG1B,YAAY,EAAuB,CAClC,KAAK,IAAM,GAAI,KAAI,GAIb,QAAoB,CAC1B,MAAO,MAAK,IAIN,IAAI,EAAW,CACrB,MAAO,MAAK,IAAI,IAAI,GAId,MAAiB,CACvB,MAAO,OAAM,KAAK,KAAK,IAAI,QAIrB,QAAmB,CACzB,MAAO,OAAM,KAAK,KAAK,IAAI,UAIrB,IAAI,EAAQ,EAAyB,CAC3C,YAAK,IAAI,IAAI,EAAK,GACX,KAID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AG,EAAI,EAAK,IAAK,CAC1B,GAAI,GAAS,KAAK,QAAQ,GACtB,EAAqC,CACrC,OAAQ,MAAO,IAAU,SAAW,EAAQ,GAAU,EACtD,WAAY,IAAS,GAAO,SAAY,EACxC,YACA,WACA,WACA,QACA,KAAM,KACH,GAMH,EAAe,EAAc,EAA0B,CAAC,EAAG,EAAK,GAAS,MAC7E,EAAoB,EAAa,OAAS,EACrC,KAAK,WAIV,EAAmB,EAAU,EAAkB,CAAC,EAAG,EAAK,GAAS,MAC3D,EAAa,OAAS,GACxB,GAAoB,EAAU,EAAmB,CAAC,EAAG,EAAK,GAAS,OAGvE,GAAI,GAAgB,EAAiB,MAChC,EAAiB,SAAW,EAAiB,WAC9C,EAAiB,SACrB,AAAI,KAAK,cAAgB,GAAe,MAAK,cAAgB,GAG7D,GAAI,GAAY,EAAO,QAAQ,EAAmB,GAGlD,EAAU,SAAW,IAAM,CACvB,MAAO,IAAY,YAAc,EAAS,KAAK,KAAM,EAAQ,EAAG,EAAK,GACrE,KAAK,KAAK,SAAU,EAAQ,EAAG,EAAK,IAIxC,KAAK,gBAAgB,IAAI,EAAW,GACpC,KAAK,WAAW,IAAI,EAAQ,GAC5B,EAAO,KAAK,EAAiB,OAGjC,KAAK,cAAgB,KAAK,YAAY,QAAQ,CAC1C,CAAE,QAAS,KACX,CAAE,QAAS,MACZ,CAEC,SAAU,KAAK,cACf,OAAQ,WAGZ,KAAK,SAAW,KAAK,IAAI,GAAG,GAC5B,KAAK,SAAS,GACd,AAAI,EAAU,KAAK,OACd,KAAK,QAEV,KAAK,QAAU,KAAK,aACpB,KAAK,cAAc,SAAW,IAAM,CAChC,KAAK,KAAK,WAAY,MACtB,KAAK,kBAEJ,EAAP,CACE,KAAK,KAAK,QAAS,IAGpB,IAAI,EAA2B,CAClC,MAAO", "names": [] } diff --git a/packages/native/src/app.ts b/packages/native/src/app.ts index 8f9ea7c..28c3b88 100644 --- a/packages/native/src/app.ts +++ b/packages/native/src/app.ts @@ -1,6 +1,6 @@ import { EventEmitter, ListenerCallback, EventInput } from "./emitter"; import { ServiceManager, Service } from "./service"; -import { newConfig, ICONFIG } from "./config"; +import { newConfig, ICONFIG, getConfig } from "./config"; export interface IApp { services: ServiceManager, @@ -27,7 +27,13 @@ export class App implements IApp { /** The current Configuration's for the App */ public config: ICONFIG; + + private canResize = true; + private canScroll = true; constructor(config: object = {}) { + this._resize = this._resize.bind(this); + this._scroll = this._scroll.bind(this); + this._ready = this._ready.bind(this); this.register(config); } @@ -37,17 +43,49 @@ export class App implements IApp { this.emitter = new EventEmitter(); this.services = new ServiceManager(this); - let handler = (() => { - document.removeEventListener("DOMContentLoaded", handler); - window.removeEventListener("load", handler); - this.emitter.emit("READY ready"); - }).bind(this); - - document.addEventListener("DOMContentLoaded", handler); - window.addEventListener("load", handler); + document.addEventListener("DOMContentLoaded", this._ready); + window.addEventListener("load", this._ready); + window.addEventListener("resize", this._resize, { passive: true }); + window.addEventListener("scroll", this._scroll, { passive: true }); return this; } + private _ready() { + document.removeEventListener("DOMContentLoaded", this._ready); + window.removeEventListener("load", this._ready); + this.emitter.emit("READY ready"); + } + + private _resize() { + if (this.canResize) { + let timer: number | void, raf: number | void; + this.canResize = false; + raf = window.requestAnimationFrame(() => { + this.emitter.emit("RESIZE resize"); + + // set a timeout to un-throttle + timer = window.setTimeout(() => { + this.canResize = true; + timer = window.clearTimeout(timer as number); + raf = window.cancelAnimationFrame(raf as number); + }, getConfig(this.config, "resizeDelay")); + }); + } + } + + private _scroll() { + if (this.canScroll) { + let raf: number | void; + this.canScroll = false; + raf = requestAnimationFrame(() => { + this.emitter.emit("SCROLL scroll"); + + this.canScroll = true; + raf = window.cancelAnimationFrame(raf as number); + }); + } + } + /** Shortcuts to adding, setting, and getting Services */ public get(key: string): Service { return this.services.get(key); diff --git a/packages/native/src/config.ts b/packages/native/src/config.ts index 3c239ad..1c15f50 100644 --- a/packages/native/src/config.ts +++ b/packages/native/src/config.ts @@ -10,10 +10,11 @@ export interface ICONFIG { blockAttr?: string; timeout?: number; maxPages?: number; + resizeDelay?: number; [key: string]: any; } -export const CONFIG_DEFAULTS = { +export const CONFIG_DEFAULTS: ICONFIG = { wrapperAttr: "wrapper", noAjaxLinkAttr: "no-ajax-link", noPrefetchAttr: "no-prefetch", @@ -25,7 +26,8 @@ export const CONFIG_DEFAULTS = { transitionAttr: "transition", blockAttr: `block`, timeout: 30000, - maxPages: 5 + maxPages: 5, + resizeDelay: 100 }; export type ConfigKeys = keyof typeof CONFIG_DEFAULTS | string; -- knotmirror 0.0.1