lezzo.org/clippy/dist/index.js.map

1 line
54 KiB
Plaintext
Raw Permalink Normal View History

2023-07-06 10:04:37 +01:00
{"version":3,"file":"index.js","sources":["../src/queue.ts","../src/animator.ts","../src/utils.ts","../src/balloon.ts","../src/agent.ts","../src/agents/index.ts","../node_modules/rollup-plugin-styles/dist/runtime/inject-css.js","../src/index.ts","../src/load.ts"],"sourcesContent":["export default class Queue {\n private _queue: Function[];\n private _onEmptyCallback: any;\n private _active: any;\n\n constructor(onEmptyCallback: Function) {\n this._queue = [];\n this._onEmptyCallback = onEmptyCallback;\n }\n\n /***\n *\n * @param {function(Function)} func\n * @returns {jQuery.Deferred}\n */\n public queue(func: Function) {\n this._queue.push(func);\n\n if (this._queue.length === 1 && !this._active) {\n this._progressQueue();\n }\n }\n\n private _progressQueue() {\n\n // stop if nothing left in queue\n if (!this._queue.length) {\n this._onEmptyCallback();\n return;\n }\n\n let f = this._queue.shift();\n this._active = true;\n\n // execute function\n let completeFunction = this.next.bind(this);\n if (f) f(completeFunction);\n }\n\n public clear() {\n this._queue = [];\n }\n\n public next() {\n this._active = false;\n this._progressQueue();\n }\n}\n\n\n\n","import { AgentConfig, AgentWrapper, ClippyAnimation, ClippyFrame } from './types';\n\n\nexport default class Animator {\n public static States = { WAITING: 1, EXITED: 0 };\n\n private _el: HTMLElement;\n private _data: AgentConfig;\n private _currentFrameIndex: number;\n private _path: string;\n private _exiting: boolean;\n private _currentFrame?: ClippyFrame;\n private _started: boolean;\n private _sounds: Record<string, HTMLAudioElement>;\n private _overlays: HTMLElement[];\n private _endCallback?: Function;\n private _currentAnimation?: ClippyAnimation;\n private _loop?: number;\n\n public currentAnimationName: string | undefined;\n\n constructor (el: HTMLElement, config: AgentWrapper, sounds: Array<string>) {\n this._el = el;\n this._data = config.config;\n this._path = config.image;\n this._currentFrameIndex = 0;\n this._currentFrame = undefined;\n this._exiting = false;\n this._currentAnimation = undefined;\n this._endCallback = undefined;\n this._started = false;\n this._sounds = {};\n this.currentAnimationName = undefined;\n this.preloadSounds(sounds);\n this._overlays = [this._el];\n let curr = this._el;\n\n this._setupElement(this._el);\n for (let i = 1; i < this._data.overlayCount; i++) {\n const divEl = document.createElement('div');\n let inner = this._setupElement(divEl);\n curr.append(inner);\n this._overlays.push(inner);\n curr = inner;\n }\n }\n\n private _setupElement (el: HTMLElement) {\n let frameSize = this._data.framesize;\n el.style.display = \"none\";\n el.style.width = frameSize[0] + \"px\";\n el.style.height = frameSize[1] + \"px\";\n el.style.background = \"url('\" + this._path + \"') no-repeat\";\n \n return el;\n }\n\n animations () {\n let r = [];\n let d = this._data.animations;\n for (let n in d) {\n r.push(n);\n }\n return r;\n }\n\n preloadSounds (sounds: Array<string>) {\n\n // for (let i = 0; i < this._data.sounds.length; i++) {\n // let snd: string = this._data.sounds[i];\n // let uri = sounds[snd];\n // if (!uri) continue;\n // this._sounds[snd] = new Audio(uri);\n\n // }\n }\n\n hasAnimation (name: string) {\n return !!this._data.animations[name];\n }\n\n exitAnimation () {\n this._exiting = true;\n }\n\n showAnimation (animationName: string, stateChangeCallback: Function) {\n this._exiting = false;\n\n if