@ion-phaser/core
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -5,3 +5,3 @@ 'use strict'; | ||
const __chunk_2 = require('./chunk-0bbfb2a5.js'); | ||
const phaser = require('./phaser-b01f5fd5.js'); | ||
@@ -22,3 +22,3 @@ class IonPhaser { | ||
this.game.parent = this.game.parent || this.el; | ||
this.game.instance = new __chunk_2.Phaser.Game(this.game); | ||
this.game.instance = new phaser.phaser_1(this.game); | ||
}; | ||
@@ -101,3 +101,3 @@ } | ||
"complexType": { | ||
"signature": "() => Promise<Phaser.Game>", | ||
"signature": "() => Promise<Game>", | ||
"parameters": [], | ||
@@ -109,3 +109,4 @@ "references": { | ||
"Game": { | ||
"location": "global" | ||
"location": "import", | ||
"path": "phaser" | ||
} | ||
@@ -112,0 +113,0 @@ }, |
@@ -5,8 +5,8 @@ 'use strict'; | ||
const __chunk_1 = require('./ionphaser-bbc58660.js'); | ||
const __chunk_2 = require('./chunk-0bbfb2a5.js'); | ||
const core = require('./core-5fab33b5.js'); | ||
const phaser = require('./phaser-b01f5fd5.js'); | ||
class IonPhaser { | ||
const IonPhaser = class { | ||
constructor(hostRef) { | ||
__chunk_1.registerInstance(this, hostRef); | ||
core.registerInstance(this, hostRef); | ||
/** | ||
@@ -24,3 +24,3 @@ * To initialize the plugin manually | ||
this.game.parent = this.game.parent || this.el; | ||
this.game.instance = new __chunk_2.Phaser.Game(this.game); | ||
this.game.instance = new phaser.phaser_1(this.game); | ||
}; | ||
@@ -59,8 +59,8 @@ } | ||
} | ||
get el() { return __chunk_1.getElement(this); } | ||
get el() { return core.getElement(this); } | ||
static get watchers() { return { | ||
"initialize": ["onInitialize"] | ||
}; } | ||
} | ||
}; | ||
exports.ion_phaser = IonPhaser; |
'use strict'; | ||
const __chunk_1 = require('./ionphaser-bbc58660.js'); | ||
const core = require('./core-5fab33b5.js'); | ||
__chunk_1.patchBrowser().then(resourcesUrl => { | ||
return __chunk_1.bootstrapLazy([["ion-phaser.cjs",[[0,"ion-phaser",{"game":[1040],"initialize":[4],"getInstance":[64],"destroy":[64]}]]]], { resourcesUrl }); | ||
core.patchBrowser().then(options => { | ||
return core.bootstrapLazy([["ion-phaser.cjs",[[0,"ion-phaser",{"game":[1040],"initialize":[4],"getInstance":[64],"destroy":[64]}]]]], options); | ||
}); |
@@ -5,7 +5,7 @@ 'use strict'; | ||
const __chunk_1 = require('./ionphaser-bbc58660.js'); | ||
const core = require('./core-5fab33b5.js'); | ||
const defineCustomElements = (win, options) => { | ||
return __chunk_1.patchEsm().then(() => { | ||
__chunk_1.bootstrapLazy([["ion-phaser.cjs",[[0,"ion-phaser",{"game":[1040],"initialize":[4],"getInstance":[64],"destroy":[64]}]]]], options); | ||
return core.patchEsm().then(() => { | ||
core.bootstrapLazy([["ion-phaser.cjs",[[0,"ion-phaser",{"game":[1040],"initialize":[4],"getInstance":[64],"destroy":[64]}]]]], options); | ||
}); | ||
@@ -12,0 +12,0 @@ }; |
@@ -7,4 +7,4 @@ { | ||
"name": "@stencil/core", | ||
"version": "1.0.0", | ||
"typescriptVersion": "3.5.1" | ||
"version": "1.3.2", | ||
"typescriptVersion": "3.5.3" | ||
}, | ||
@@ -11,0 +11,0 @@ "collections": [], |
@@ -1,2 +0,2 @@ | ||
import Phaser from 'phaser'; | ||
import { Game } from 'phaser'; | ||
export class IonPhaser { | ||
@@ -16,3 +16,3 @@ constructor() { | ||
this.game.parent = this.game.parent || this.el; | ||
this.game.instance = new Phaser.Game(this.game); | ||
this.game.instance = new Game(this.game); | ||
}; | ||
@@ -95,3 +95,3 @@ } | ||
"complexType": { | ||
"signature": "() => Promise<Phaser.Game>", | ||
"signature": "() => Promise<Game>", | ||
"parameters": [], | ||
@@ -103,3 +103,4 @@ "references": { | ||
"Game": { | ||
"location": "global" | ||
"location": "import", | ||
"path": "phaser" | ||
} | ||
@@ -106,0 +107,0 @@ }, |
@@ -1,5 +0,5 @@ | ||
import { d as registerInstance, e as getElement } from './ionphaser-c6124867.js'; | ||
import { a as Phaser } from './chunk-790dc535.js'; | ||
import { r as registerInstance, g as getElement } from './core-bfada9ad.js'; | ||
import { p as phaser_1 } from './phaser-98231392.js'; | ||
class IonPhaser { | ||
const IonPhaser = class { | ||
constructor(hostRef) { | ||
@@ -19,3 +19,3 @@ registerInstance(this, hostRef); | ||
this.game.parent = this.game.parent || this.el; | ||
this.game.instance = new Phaser.Game(this.game); | ||
this.game.instance = new phaser_1(this.game); | ||
}; | ||
@@ -58,4 +58,4 @@ } | ||
}; } | ||
} | ||
}; | ||
export { IonPhaser as ion_phaser }; |
@@ -338,3 +338,3 @@ /* | ||
declarations: declarations, | ||
specificity: computeSpecificity(selector), | ||
specificity: computeSpecificity(), | ||
nu: index | ||
@@ -380,3 +380,9 @@ }); | ||
// computes the css scopes that might affect this particular element | ||
var scopes = globalScopes.concat(getScopesForElement(hostScopeMap, hostEl)); | ||
// avoiding using spread arrays to avoid ts helper fns when in es5 | ||
var scopes = []; | ||
var scopesForElement = getScopesForElement(hostScopeMap, hostEl); | ||
// globalScopes are always took into account | ||
globalScopes.forEach(function (s) { return scopes.push(s); }); | ||
// the parent scopes are computed by walking parent dom until <html> is reached | ||
scopesForElement.forEach(function (s) { return scopes.push(s); }); | ||
// each scope might have an array of associated selectors | ||
@@ -418,3 +424,3 @@ // let's flatten the complete array of selectors from all the scopes | ||
function matches(el, selector) { | ||
return el.matches(selector); | ||
return selector === ':root' || selector === 'html' || el.matches(selector); | ||
} | ||
@@ -429,3 +435,3 @@ function parseCSS(original) { | ||
selectors: selectors, | ||
isDynamic: template.length > 1 | ||
usesCssVars: template.length > 1 | ||
}; | ||
@@ -442,3 +448,3 @@ } | ||
scopes.forEach(function (scope) { | ||
if (scope.isDynamic) { | ||
if (scope.usesCssVars) { | ||
scope.styleEl.innerHTML = executeTemplate(scope.template, props); | ||
@@ -448,14 +454,14 @@ } | ||
} | ||
function reScope(scope, cssScopeId) { | ||
function reScope(scope, scopeId) { | ||
var template = scope.template.map(function (segment) { | ||
return (typeof segment === 'string') | ||
? replaceScope(segment, scope.cssScopeId, cssScopeId) | ||
? replaceScope(segment, scope.scopeId, scopeId) | ||
: segment; | ||
}); | ||
var selectors = scope.selectors.map(function (sel) { | ||
return Object.assign({}, sel, { selector: replaceScope(sel.selector, scope.cssScopeId, cssScopeId) }); | ||
return Object.assign({}, sel, { selector: replaceScope(sel.selector, scope.scopeId, scopeId) }); | ||
}); | ||
return Object.assign({}, scope, { template: template, | ||
selectors: selectors, | ||
cssScopeId: cssScopeId }); | ||
scopeId: scopeId }); | ||
} | ||
@@ -470,5 +476,4 @@ function replaceScope(original, oldScopeId, newScopeId) { | ||
function loadDocument(doc, globalScopes) { | ||
return loadDocumentLinks(doc, globalScopes).then(function () { | ||
loadDocumentStyles(doc, globalScopes); | ||
}); | ||
loadDocumentStyles(doc, globalScopes); | ||
return loadDocumentLinks(doc, globalScopes); | ||
} | ||
@@ -484,3 +489,3 @@ function loadDocumentLinks(doc, globalScopes) { | ||
function loadDocumentStyles(doc, globalScopes) { | ||
var styleElms = doc.querySelectorAll('style'); | ||
var styleElms = doc.querySelectorAll('style:not([data-styles])'); | ||
for (var i = 0; i < styleElms.length; i++) { | ||
@@ -498,2 +503,3 @@ addGlobalStyle(globalScopes, styleElms[i]); | ||
var styleEl = doc.createElement('style'); | ||
styleEl.setAttribute('data-styles', ''); | ||
styleEl.innerHTML = text; | ||
@@ -567,30 +573,29 @@ addGlobalStyle(globalScopes, styleEl); | ||
}; | ||
CustomStyle.prototype.createHostStyle = function (hostEl, cssScopeId, cssText) { | ||
CustomStyle.prototype.createHostStyle = function (hostEl, cssScopeId, cssText, isScoped) { | ||
if (this.hostScopeMap.has(hostEl)) { | ||
throw new Error('host style already created'); | ||
} | ||
var baseScope = this.registerHostTemplate(cssText, cssScopeId); | ||
var isDynamicScoped = !!(baseScope.isDynamic && baseScope.cssScopeId); | ||
var needStyleEl = isDynamicScoped || !baseScope.styleEl; | ||
var baseScope = this.registerHostTemplate(cssText, cssScopeId, isScoped); | ||
var styleEl = this.doc.createElement('style'); | ||
if (!needStyleEl) { | ||
if (!baseScope.usesCssVars) { | ||
// This component does not use (read) css variables | ||
styleEl.innerHTML = cssText; | ||
} | ||
else if (isScoped) { | ||
// This component is dynamic: uses css var and is scoped | ||
styleEl['s-sc'] = cssScopeId = baseScope.scopeId + "-" + this.count; | ||
styleEl.innerHTML = '/*needs update*/'; | ||
this.hostStyleMap.set(hostEl, styleEl); | ||
this.hostScopeMap.set(hostEl, reScope(baseScope, cssScopeId)); | ||
this.count++; | ||
} | ||
else { | ||
if (isDynamicScoped) { | ||
styleEl['s-sc'] = cssScopeId = baseScope.cssScopeId + "-" + this.count; | ||
styleEl.innerHTML = '/*needs update*/'; | ||
this.hostStyleMap.set(hostEl, styleEl); | ||
this.hostScopeMap.set(hostEl, reScope(baseScope, cssScopeId)); | ||
this.count++; | ||
// This component uses css vars, but it's no-encapsulation (global static) | ||
baseScope.styleEl = styleEl; | ||
if (!baseScope.usesCssVars) { | ||
styleEl.innerHTML = executeTemplate(baseScope.template, {}); | ||
} | ||
else { | ||
baseScope.styleEl = styleEl; | ||
if (!baseScope.isDynamic) { | ||
styleEl.innerHTML = executeTemplate(baseScope.template, {}); | ||
} | ||
this.globalScopes.push(baseScope); | ||
this.updateGlobal(); | ||
this.hostScopeMap.set(hostEl, baseScope); | ||
} | ||
this.globalScopes.push(baseScope); | ||
this.updateGlobal(); | ||
this.hostScopeMap.set(hostEl, baseScope); | ||
} | ||
@@ -609,3 +614,3 @@ return styleEl; | ||
var scope = this.hostScopeMap.get(hostEl); | ||
if (scope && scope.isDynamic && scope.cssScopeId) { | ||
if (scope && scope.usesCssVars && scope.isScoped) { | ||
var styleEl = this.hostStyleMap.get(hostEl); | ||
@@ -622,7 +627,8 @@ if (styleEl) { | ||
}; | ||
CustomStyle.prototype.registerHostTemplate = function (cssText, scopeId) { | ||
CustomStyle.prototype.registerHostTemplate = function (cssText, scopeId, isScoped) { | ||
var scope = this.scopesMap.get(scopeId); | ||
if (!scope) { | ||
scope = parseCSS(cssText); | ||
scope.cssScopeId = scopeId; | ||
scope.scopeId = scopeId; | ||
scope.isScoped = isScoped; | ||
this.scopesMap.set(scopeId, scope); | ||
@@ -629,0 +635,0 @@ } |
@@ -41,5 +41,20 @@ (function(){ | ||
// Polyfill document.baseURI | ||
if (typeof document.baseURI !== 'string') { | ||
Object.defineProperty(Document.prototype, 'baseURI', { | ||
enumerable: true, | ||
configurable: true, | ||
get: function () { | ||
var base = document.querySelector('base'); | ||
if (base) { | ||
return base.href; | ||
} | ||
return document.URL; | ||
} | ||
}); | ||
} | ||
// Polyfill CustomEvent | ||
if (typeof window.CustomEvent !== 'function') { | ||
function CustomEvent(event, params) { | ||
window.CustomEvent = function CustomEvent(event, params) { | ||
params = params || { bubbles: false, cancelable: false, detail: undefined }; | ||
@@ -50,6 +65,3 @@ var evt = document.createEvent( 'CustomEvent' ); | ||
} | ||
CustomEvent.prototype = window.Event.prototype; | ||
window.CustomEvent = CustomEvent; | ||
window.CustomEvent.prototype = window.Event.prototype; | ||
} | ||
@@ -83,2 +95,3 @@ | ||
(function(a){"function"!==typeof a.matches&&(a.matches=a.msMatchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||function(a){a=(this.document||this.ownerDocument).querySelectorAll(a);for(var b=0;a[b]&&a[b]!==this;)++b;return!!a[b]});"function"!==typeof a.closest&&(a.closest=function(a){for(var b=this;b&&1===b.nodeType;){if(b.matches(a))return b;b=b.parentNode}return null})})(window.Element.prototype); | ||
/*! | ||
@@ -88,2 +101,3 @@ Element.getRootNode() | ||
(function(c){function d(a){a=b(a);return 11===a.nodeType?d(a.host):a}function b(a){return a.parentNode?b(a.parentNode):a}"function"!==typeof c.getRootNode&&(c.getRootNode=function(a){return a&&a.composed?d(this):b(this)})})(Element.prototype); | ||
/*! | ||
@@ -98,2 +112,1 @@ Element.remove() | ||
!function(e){'classList'in e||Object.defineProperty(e,"classList",{get:function(){var e=this,t=(e.getAttribute("class")||"").replace(/^\s+|\s$/g,"").split(/\s+/g);function n(){t.length>0?e.setAttribute("class",t.join(" ")):e.removeAttribute("class")}return""===t[0]&&t.splice(0,1),t.toggle=function(e,i){void 0!==i?i?t.add(e):t.remove(e):-1!==t.indexOf(e)?t.splice(t.indexOf(e),1):t.push(e),n()},t.add=function(){for(var e=[].slice.call(arguments),i=0,s=e.length;i<s;i++)-1===t.indexOf(e[i])&&t.push(e[i]);n()},t.remove=function(){for(var e=[].slice.call(arguments),i=0,s=e.length;i<s;i++)-1!==t.indexOf(e[i])&&t.splice(t.indexOf(e[i]),1);n()},t.item=function(e){return t[e]},t.contains=function(e){return-1!==t.indexOf(e)},t.replace=function(e,i){-1!==t.indexOf(e)&&t.splice(t.indexOf(e),1,i),n()},t.value=e.getAttribute("class")||"",t}})}(Element.prototype); | ||
@@ -10,3 +10,3 @@ (function() { | ||
} | ||
const BuiltInHTMLElement = HTMLElement; | ||
var BuiltInHTMLElement = HTMLElement; | ||
window.HTMLElement = /** @this {!Object} */ function HTMLElement() { | ||
@@ -13,0 +13,0 @@ return Reflect.construct( |
export function applyPolyfills() { | ||
var win = window; | ||
/*! | ||
es6-promise - a tiny implementation of Promises/A+. | ||
Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) | ||
Licensed under MIT license | ||
See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE | ||
v4.2.4+314e4831 | ||
*/ | ||
(win.ES6Promise=function(){function t(){var t=setTimeout;return function(){return t(r,1)}}function r(){for(var t=0;t<y;t+=2)(0,C[t])(C[t+1]),C[t]=void 0,C[t+1]=void 0;y=0}function e(t,r){var e=this,n=new this.constructor(o);void 0===n[O]&&_(n);var i=e._state;if(i){var s=arguments[i-1];g(function(){return v(i,n,s,e._result)})}else l(e,n,t,r);return n}function n(t){if(t&&"object"==typeof t&&t.constructor===this)return t;var r=new this(o);return u(r,t),r}function o(){}function i(t){try{return t.then}catch(t){return q.error=t,q}}function s(t,r,o){r.constructor===t.constructor&&o===e&&r.constructor.resolve===n?function(t,r){r._state===x?a(t,r._result):r._state===F?f(t,r._result):l(r,void 0,function(r){return u(t,r)},function(r){return f(t,r)})}(t,r):o===q?(f(t,q.error),q.error=null):void 0===o?a(t,r):"function"==typeof o?function(t,r,e){g(function(t){var n=!1,o=function(t,r,e,n){try{t.call(r,e,n)}catch(t){return t}}(e,r,function(e){n||(n=!0,r!==e?u(t,e):a(t,e))},function(r){n||(n=!0,f(t,r))},t._label);!n&&o&&(n=!0,f(t,o))},t)}(t,r,o):a(t,r)}function u(t,r){if(t===r)f(t,new TypeError("cannot resolve promise w/ itself"));else{var e=typeof r;null===r||"object"!==e&&"function"!==e?a(t,r):s(t,r,i(r))}}function c(t){t._onerror&&t._onerror(t._result),h(t)}function a(t,r){t._state===P&&(t._result=r,t._state=x,0!==t._subscribers.length&&g(h,t))}function f(t,r){t._state===P&&(t._state=F,t._result=r,g(c,t))}function l(t,r,e,n){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=r,o[i+x]=e,o[i+F]=n,0===i&&t._state&&g(h,t)}function h(t){var r=t._subscribers,e=t._state;if(0!==r.length){for(var n,o,i=t._result,s=0;s<r.length;s+=3)n=r[s],o=r[s+e],n?v(e,n,o,i):o(i);t._subscribers.length=0}}function v(t,r,e,n){var o="function"==typeof e,i=void 0,s=void 0,c=void 0,l=void 0;if(o){try{i=e(n)}catch(t){q.error=t,i=q}if(i===q?(l=!0,s=i.error,i.error=null):c=!0,r===i)return void f(r,new TypeError("Cannot return same promise"))}else i=n,c=!0;r._state===P&&(o&&c?u(r,i):l?f(r,s):t===x?a(r,i):t===F&&f(r,i))}function _(t){t[O]=U++,t._state=void 0,t._result=void 0,t._subscribers=[]}var p,d=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},y=0,w=void 0,m=void 0,g=function(t,e){C[y]=t,C[y+1]=e,2===(y+=2)&&(m?m(r):T())},b=(p="undefined"!=typeof window?window:void 0)||{},A=b.MutationObserver||b.WebKitMutationObserver;b="undefined"==typeof self;var E,S,M,j="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,C=Array(1e3),T=void 0;T=A?(E=0,S=new A(r),M=document.createTextNode(""),S.observe(M,{characterData:!0}),function(){M.data=E=++E%2}):j?function(){var t=new MessageChannel;return t.port1.onmessage=r,function(){return t.port2.postMessage(0)}}():void 0===p&&"function"==typeof require?function(){try{var e=Function("return this")().require("vertx");return void 0!==(w=e.runOnLoop||e.runOnContext)?function(){w(r)}:t()}catch(r){return t()}}():t();var O=Math.random().toString(36).substring(2),P=void 0,x=1,F=2,q={error:null},U=0,D=function(){function t(t,r){this._instanceConstructor=t,this.promise=new t(o),this.promise[O]||_(this.promise),d(r)?(this._remaining=this.length=r.length,this._result=Array(this.length),0===this.length?a(this.promise,this._result):(this.length=this.length||0,this._enumerate(r),0===this._remaining&&a(this.promise,this._result))):f(this.promise,Error("Array Methods must be provided an Array"))}return t.prototype._enumerate=function(t){for(var r=0;this._state===P&&r<t.length;r++)this._eachEntry(t[r],r)},t.prototype._eachEntry=function(t,r){var u=this._instanceConstructor,c=u.resolve;c===n?(c=i(t))===e&&t._state!==P?this._settledAt(t._state,r,t._result):"function"!=typeof c?(this._remaining--,this._result[r]=t):u===K?(s(u=new u(o),t,c),this._willSettleAt(u,r)):this._willSettleAt(new u(function(r){return r(t)}),r):this._willSettleAt(c(t),r)},t.prototype._settledAt=function(t,r,e){var n=this.promise;n._state===P&&(this._remaining--,t===F?f(n,e):this._result[r]=e),0===this._remaining&&a(n,this._result)},t.prototype._willSettleAt=function(t,r){var e=this;l(t,void 0,function(t){return e._settledAt(x,r,t)},function(t){return e._settledAt(F,r,t)})},t}(),K=function(){function t(r){if(this[O]=U++,this._result=this._state=void 0,this._subscribers=[],o!==r){if("function"!=typeof r)throw new TypeError("Must pass a resolver fn as 1st arg");if(!(this instanceof t))throw new TypeError("Failed to construct 'Promise': Use the 'new' operator.");!function(t,r){try{r(function(r){u(t,r)},function(r){f(t,r)})}catch(r){f(t,r)}}(this,r)}}return t.prototype.catch=function(t){return this.then(null,t)},t.prototype.finally=function(t){var r=this.constructor;return this.then(function(e){return r.resolve(t()).then(function(){return e})},function(e){return r.resolve(t()).then(function(){throw e})})},t}();return K.prototype.then=e,K.all=function(t){return new D(this,t).promise},K.race=function(t){var r=this;return d(t)?new r(function(e,n){for(var o=t.length,i=0;i<o;i++)r.resolve(t[i]).then(e,n)}):new r(function(t,r){return r(new TypeError("Must pass array to race"))})},K.resolve=n,K.reject=function(t){var r=new this(o);return f(r,t),r},K._setScheduler=function(t){m=t},K._setAsap=function(t){g=t},K._asap=g,K.polyfill=function(){var t=void 0;if("undefined"!=typeof global)t=global;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw Error("polyfill failed")}var r=t.Promise;if(r){var e=null;try{e=Object.prototype.toString.call(r.resolve())}catch(t){}if("[object Promise]"===e&&!r.cast)return}t.Promise=K},K.Promise=K,K.polyfill(),K}()); | ||
@@ -32,2 +24,3 @@ var promises = []; | ||
!String.prototype.startsWith || !String.prototype.endsWith || | ||
(win.NodeList && !win.NodeList.prototype.forEach) || | ||
!win.fetch || | ||
@@ -34,0 +27,0 @@ !checkIfURLIsSupported() || |
@@ -1,4 +0,5 @@ | ||
/* | ||
* SystemJS 3.1.3 | ||
*/ | ||
!function(){const e="undefined"!=typeof self,n=e?self:global;let t;if("undefined"!=typeof location){const e=(t=location.href.split("#")[0].split("?")[0]).lastIndexOf("/");-1!==e&&(t=t.slice(0,e+1))}const r=/\\/g,i="undefined"!=typeof Symbol,o=i&&Symbol.toStringTag,c=i?Symbol():"@";function l(){this[c]={}}const s=l.prototype;let u;s.import=function(e,n){const t=this;return Promise.resolve(t.resolve(e,n)).then(function(e){const n=function e(n,t,r){let i=n[c][t];if(i)return i;const l=[],s=Object.create(null);o&&Object.defineProperty(s,o,{value:"Module"});let u=Promise.resolve().then(function(){return n.instantiate(t,r)}).then(function(e){if(!e)throw new Error("Module "+t+" did not instantiate");const r=e[1](function(e,n){i.h=!0;let t=!1;if("object"!=typeof e)e in s&&s[e]===n||(s[e]=n,t=!0);else for(let n in e){let r=e[n];n in s&&s[n]===r||(s[n]=r,t=!0)}if(t)for(let e=0;e<l.length;e++)l[e](s);return n},2===e[1].length?{import:function(e){return n.import(e,t)},meta:n.createContext(t)}:void 0);return i.e=r.execute||function(){},[e[0],r.setters||[]]});const f=u.then(function(r){return Promise.all(r[0].map(function(i,o){const c=r[1][o];return Promise.resolve(n.resolve(i,t)).then(function(r){const i=e(n,r,t);return Promise.resolve(i.I).then(function(){return c&&(i.i.push(c),!i.h&&i.I||c(i.n)),i})})})).then(function(e){i.d=e})});return f.catch(function(e){i.e=null,i.er=e}),i=n[c][t]={id:t,i:l,n:s,I:u,L:f,h:!1,d:void 0,e:void 0,er:void 0,E:void 0,C:void 0}}(t,e);return n.C||function(e,n){return n.C=function e(n,t,r){if(!r[t.id])return r[t.id]=!0,Promise.resolve(t.L).then(function(){return Promise.all(t.d.map(function(t){return e(n,t,r)}))})}(e,n,{}).then(function(){return function e(n,t,r){if(r[t.id])return;if(r[t.id]=!0,!t.e){if(t.er)throw t.er;return t.E?t.E:void 0}let i;return t.d.forEach(function(t){{const o=e(n,t,r);o&&(i=i||[]).push(o)}}),i?Promise.all(i).then(o):o();function o(){try{let e=t.e.call(f);if(e)return e=e.then(function(){t.C=t.n,t.E=null}),t.E=t.E||e;t.C=t.n}catch(e){throw t.er=e,e}finally{t.L=t.I=void 0,t.e=null}}}(e,n,{})}).then(function(){return n.n})}(t,n)})},s.createContext=function(e){return{url:e}},s.register=function(e,n){u=[e,n]},s.getRegister=function(){const e=u;return u=void 0,e};const f=Object.freeze(Object.create(null));let d;n.System=new l,"undefined"!=typeof window&&window.addEventListener("error",function(e){d=e.error});const h=s.register;s.register=function(e,n){d=void 0,h.call(this,e,n)},s.instantiate=function(e,n){const t=this;return new Promise(function(r,i){const o=document.createElement("script");o.charset="utf-8",o.async=!0,o.crossOrigin="anonymous",o.addEventListener("error",function(){i(new Error("Error loading "+e+(n?" from "+n:"")))}),o.addEventListener("load",function(){if(document.head.removeChild(o),d)return i(d),d=void 0;r(t.getRegister())}),o.src=e,document.head.appendChild(o)})},e&&"function"==typeof importScripts&&(s.instantiate=function(e){const n=this;return new Promise(function(t,r){try{importScripts(e)}catch(e){r(e)}t(n.getRegister())})}),s.resolve=function(e,n){const i=function(e,n){if(-1!==e.indexOf("\\")&&(e=e.replace(r,"/")),"/"===e[0]&&"/"===e[1])return n.slice(0,n.indexOf(":")+1)+e;if("."===e[0]&&("/"===e[1]||"."===e[1]&&("/"===e[2]||2===e.length&&(e+="/"))||1===e.length&&(e+="/"))||"/"===e[0]){const t=n.slice(0,n.indexOf(":")+1);let r;if(r="/"===n[t.length+1]?"file:"!==t?(r=n.slice(t.length+2)).slice(r.indexOf("/")+1):n.slice(8):n.slice(t.length+("/"===n[t.length])),"/"===e[0])return n.slice(0,n.length-r.length-1)+e;const i=r.slice(0,r.lastIndexOf("/")+1)+e,o=[];let c=-1;for(let e=0;e<i.length;e++)-1!==c?"/"===i[e]&&(o.push(i.slice(c,e+1)),c=-1):"."===i[e]?"."!==i[e+1]||"/"!==i[e+2]&&e+2!==i.length?"/"===i[e+1]||e+1===i.length?e+=1:c=e:(o.pop(),e+=2):c=e;return-1!==c&&o.push(i.slice(c)),n.slice(0,n.length-r.length)+o.join("")}}(e,n||t);if(!i){if(-1!==e.indexOf(":"))return Promise.resolve(e);throw new Error('Cannot resolve "'+e+(n?'" from '+n:'"'))}return Promise.resolve(i)}}(); | ||
/** | ||
* SystemJS 4.0.2 | ||
* MANUAL PATCH: remove script.crossOrigin = "anonymous" | ||
*/ | ||
!function(){var e="undefined"!=typeof self,n=e?self:global;var t;if("undefined"!=typeof document){var e=document.querySelector("base[href]");e&&(t=e.href)}if(!t&&"undefined"!=typeof location){var e=(t=location.href.split("#")[0].split("?")[0]).lastIndexOf("/");-1!==e&&(t=t.slice(0,e+1))}var r=/\\/g,o="undefined"!=typeof Symbol,i=o&&Symbol.toStringTag,c=o?Symbol():"@";function u(){this[c]={}}var s=u.prototype;var l;s.import=function(e,n){var t=this;return Promise.resolve(t.resolve(e,n)).then(function(e){var n=function e(n,t,r){var o=n[c][t];if(o)return o;var u=[],s=Object.create(null);i&&Object.defineProperty(s,i,{value:"Module"});var l=Promise.resolve().then(function(){return n.instantiate(t,r)}).then(function(e){if(!e)throw Error("Module "+t+" did not instantiate");var r=e[1](function(e,n){o.h=!0;var t=!1;if("object"!=typeof e)e in s&&s[e]===n||(s[e]=n,t=!0);else for(var n in e){var r=e[n];n in s&&s[n]===r||(s[n]=r,t=!0)}if(t)for(var e=0;e<u.length;e++)u[e](s);return n},2===e[1].length?{import:function(e){return n.import(e,t)},meta:n.createContext(t)}:void 0);return o.e=r.execute||function(){},[e[0],r.setters||[]]});var f=l.then(function(r){return Promise.all(r[0].map(function(o,i){var c=r[1][i];return Promise.resolve(n.resolve(o,t)).then(function(r){var o=e(n,r,t);return Promise.resolve(o.I).then(function(){return c&&(o.i.push(c),!o.h&&o.I||c(o.n)),o})})})).then(function(e){o.d=e})});return f.catch(function(e){o.e=null,o.er=e}),o=n[c][t]={id:t,i:u,n:s,I:l,L:f,h:!1,d:void 0,e:void 0,er:void 0,E:void 0,C:void 0}}(t,e);return n.C||function(e,n){return n.C=function e(n,t,r){if(!r[t.id])return r[t.id]=!0,Promise.resolve(t.L).then(function(){return Promise.all(t.d.map(function(t){return e(n,t,r)}))})}(e,n,{}).then(function(){return function e(n,t,r){if(r[t.id])return;if(r[t.id]=!0,!t.e){if(t.er)throw t.er;return t.E?t.E:void 0}var o;return t.d.forEach(function(t){{var i=e(n,t,r);i&&(o=o||[]).push(i)}}),o?Promise.all(o).then(i):i();function i(){try{var e=t.e.call(f);if(e)return e=e.then(function(){t.C=t.n,t.E=null}),t.E=t.E||e;t.C=t.n}catch(e){throw t.er=e,e}finally{t.L=t.I=void 0,t.e=null}}}(e,n,{})}).then(function(){return n.n})}(t,n)})},s.createContext=function(e){return{url:e}},s.register=function(e,n){l=[e,n]},s.getRegister=function(){var e=l;return l=void 0,e};var f=Object.freeze(Object.create(null));n.System=new u;var d=s.register;s.register=function(e,n){d.call(this,e,n)},s.instantiate=function(e,n){var t=this;return".json"===e.substr(-5)?fetch(e).then(function(e){return e.text()}).then(function(e){return[[],function(n){return{execute:function(){n("default",JSON.parse(e))}}}]}):new Promise(function(r,o){var i;function c(n){n.filename===e&&(i=n.error)}window.addEventListener("error",c);var u=document.createElement("script");u.charset="utf-8",u.async=!0,u.addEventListener("error",function(){window.removeEventListener("error",c),o(Error("Error loading "+e+(n?" from "+n:"")))}),u.addEventListener("load",function(){window.removeEventListener("error",c),document.head.removeChild(u),i?o(i):r(t.getRegister())}),u.src=e,document.head.appendChild(u)})},e&&"function"==typeof importScripts&&(s.instantiate=function(e){var n=this;return new Promise(function(t,r){try{importScripts(e)}catch(e){r(e)}t(n.getRegister())})}),s.resolve=function(e,n){var o=function(e,n){if(-1!==e.indexOf("\\")&&(e=e.replace(r,"/")),"/"===e[0]&&"/"===e[1])return n.slice(0,n.indexOf(":")+1)+e;if("."===e[0]&&("/"===e[1]||"."===e[1]&&("/"===e[2]||2===e.length&&(e+="/"))||1===e.length&&(e+="/"))||"/"===e[0]){var t=n.slice(0,n.indexOf(":")+1);var r;if(r="/"===n[t.length+1]?"file:"!==t?(r=n.slice(t.length+2)).slice(r.indexOf("/")+1):n.slice(8):n.slice(t.length+("/"===n[t.length])),"/"===e[0])return n.slice(0,n.length-r.length-1)+e;var o=r.slice(0,r.lastIndexOf("/")+1)+e,i=[];var c=-1;for(var e=0;e<o.length;e++)-1!==c?"/"===o[e]&&(i.push(o.slice(c,e+1)),c=-1):"."===o[e]?"."!==o[e+1]||"/"!==o[e+2]&&e+2!==o.length?"/"===o[e+1]||e+1===o.length?e+=1:c=e:(i.pop(),e+=2):c=e;return-1!==c&&i.push(o.slice(c)),n.slice(0,n.length-r.length)+i.join("")}}(e,n||t);if(!o){if(-1!==e.indexOf(":"))return Promise.resolve(e);throw Error('Cannot resolve "'+e+(n?'" from '+n:'"'))}return Promise.resolve(o)}}(); |
@@ -1,1 +0,1 @@ | ||
import{a as e,b as a}from"./p-65b1a7f0.js";e().then(e=>a([["p-fvnrdeua",[[0,"ion-phaser",{game:[1040],initialize:[4],getInstance:[64],destroy:[64]}]]]],{resourcesUrl:e})); | ||
import{p as a,b as e}from"./p-8ccac5d4.js";a().then(a=>e([["p-wkoyep4j",[[0,"ion-phaser",{game:[1040],initialize:[4],getInstance:[64],destroy:[64]}]]]],a)); |
@@ -12,4 +12,6 @@ /* tslint:disable */ | ||
} from './components/models'; | ||
import { | ||
Game, | ||
} from 'phaser'; | ||
export namespace Components { | ||
@@ -28,3 +30,3 @@ interface IonPhaser { | ||
*/ | ||
'getInstance': () => Promise<Phaser.Game>; | ||
'getInstance': () => Promise<Game>; | ||
/** | ||
@@ -31,0 +33,0 @@ * To initialize the plugin manually |
@@ -1,2 +0,3 @@ | ||
import Phaser from 'phaser'; | ||
/// <reference types="Phaser" /> | ||
import { Game } from 'phaser'; | ||
import { GameInstance } from '../models'; | ||
@@ -16,3 +17,3 @@ export declare class IonPhaser { | ||
*/ | ||
getInstance(): Promise<Phaser.Game>; | ||
getInstance(): Promise<Game>; | ||
/** | ||
@@ -26,3 +27,3 @@ * Destroy the Phaser game instance | ||
componentDidUnload(): void; | ||
getGameInstance(): Phaser.Game; | ||
getGameInstance(): Game; | ||
} |
@@ -1,6 +0,7 @@ | ||
import * as Phaser from 'phaser'; | ||
/// <reference types="Phaser" /> | ||
import { Game, Types } from 'phaser'; | ||
declare type ObjectAlias = Object; | ||
export interface GameInstance extends Phaser.Types.Core.GameConfig, ObjectAlias { | ||
instance: Phaser.Game; | ||
export interface GameInstance extends Types.Core.GameConfig, ObjectAlias { | ||
instance: Game; | ||
} | ||
export {}; |
@@ -64,6 +64,9 @@ /** | ||
export interface ComponentInstance { | ||
export interface ComponentInterface { | ||
connectedCallback?: () => void; | ||
disconnectedCallback?: () => void; | ||
componentWillRender?: () => Promise<void> | void; | ||
componentDidRender?: () => void; | ||
/** | ||
@@ -111,20 +114,4 @@ * The component is about to load and it has not | ||
/** | ||
* The component did unload and the element | ||
* will be destroyed. | ||
*/ | ||
componentDidUnload?: () => void; | ||
render?: () => any; | ||
/** | ||
* Used to dynamically set host element attributes. | ||
* Should be placed directly above render() | ||
*/ | ||
hostData?: () => { | ||
class?: {[className: string]: boolean}; | ||
style?: any; | ||
[attrName: string]: any; | ||
}; | ||
[memberName: string]: any; | ||
@@ -811,6 +798,5 @@ } | ||
export interface HTMLAttributes<T = HTMLElement> extends DOMAttributes { | ||
export interface HTMLAttributes<T = HTMLElement> extends DOMAttributes<T> { | ||
// vdom specific | ||
innerHTML?: string; | ||
ref?: (elm?: T) => void; | ||
key?: string | number; | ||
@@ -830,3 +816,2 @@ | ||
lang?: string; | ||
slot?: string; | ||
spellCheck?: boolean; | ||
@@ -883,3 +868,3 @@ spellcheck?: boolean | string; | ||
export interface SVGAttributes extends DOMAttributes { | ||
export interface SVGAttributes<T = SVGElement> extends DOMAttributes<T> { | ||
// Attributes which also defined in HTMLAttributes | ||
@@ -1149,3 +1134,6 @@ // See comment in SVGDOMPropertyConfig.js | ||
export interface DOMAttributes { | ||
export interface DOMAttributes<T = Element> { | ||
ref?: (elm?: T) => void; | ||
slot?: string; | ||
// Clipboard Events | ||
@@ -1152,0 +1140,0 @@ onCopy?: (event: ClipboardEvent) => void; |
module.exports = require('../dist/cjs/loader.cjs.js'); | ||
module.exports.applyPolyfills = function() { return Promise.resolve() }; | ||
module.exports = require('../dist/cjs/loader.cjs.js'); | ||
module.exports.applyPolyfills = function() { return Promise.resolve() }; |
@@ -7,2 +7,3 @@ | ||
syncQueue?: boolean; | ||
jmp?: (c: Function) => any; | ||
raf?: (c: FrameRequestCallback) => number; | ||
@@ -9,0 +10,0 @@ ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void; |
@@ -6,5 +6,7 @@ { | ||
"main": "./index.cjs.js", | ||
"node:main": "./node-main.js", | ||
"jsnext:main": "./index.es2017.mjs", | ||
"es2015": "./index.es2017.mjs", | ||
"es2017": "./index.es2017.mjs" | ||
"es2017": "./index.es2017.mjs", | ||
"unpkg": "./cdn.js" | ||
} |
{ | ||
"name": "@ion-phaser/core", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "A web component to integrate Phaser Framework with Angular, React, Vue, etc", | ||
@@ -12,4 +12,5 @@ "keywords": [ | ||
"vue", | ||
"app", | ||
"vanillajs", | ||
"webcomponent", | ||
"app", | ||
"web component", | ||
@@ -23,5 +24,5 @@ "web components" | ||
"types": "dist/types/components.d.ts", | ||
"unpkg": "dist/ionphaser/ionphaser.js", | ||
"collection:main": "dist/collection/index.js", | ||
"collection": "dist/collection/collection-manifest.json", | ||
"collection:main": "dist/collection/index.js", | ||
"unpkg": "dist/ionphaser/ionphaser.js", | ||
"files": [ | ||
@@ -37,12 +38,13 @@ "dist/", | ||
}, | ||
"dependencies": { | ||
"phaser": "^3.17.0" | ||
"peerDependencies": { | ||
"phaser": "^3.19.0" | ||
}, | ||
"devDependencies": { | ||
"@stencil/core": "~1.0.0", | ||
"@types/jest": "23.3.14", | ||
"@types/puppeteer": "1.12.4", | ||
"jest": "23.6.0", | ||
"jest-cli": "23.6.0", | ||
"puppeteer": "1.14.0" | ||
"phaser": "^3.19.0", | ||
"@stencil/core": "~1.3.2", | ||
"@types/jest": "24.0.18", | ||
"@types/puppeteer": "1.19.1", | ||
"jest": "24.9.0", | ||
"jest-cli": "24.9.0", | ||
"puppeteer": "1.19.0" | ||
}, | ||
@@ -49,0 +51,0 @@ "license": "MIT", |
![Built With Stencil](https://img.shields.io/badge/-Built%20With%20Stencil-16161d.svg?logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMSwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCA1MTIgNTEyIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA1MTIgNTEyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI%2BCjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI%2BCgkuc3Qwe2ZpbGw6I0ZGRkZGRjt9Cjwvc3R5bGU%2BCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik00MjQuNywzNzMuOWMwLDM3LjYtNTUuMSw2OC42LTkyLjcsNjguNkgxODAuNGMtMzcuOSwwLTkyLjctMzAuNy05Mi43LTY4LjZ2LTMuNmgzMzYuOVYzNzMuOXoiLz4KPHBhdGggY2xhc3M9InN0MCIgZD0iTTQyNC43LDI5Mi4xSDE4MC40Yy0zNy42LDAtOTIuNy0zMS05Mi43LTY4LjZ2LTMuNkgzMzJjMzcuNiwwLDkyLjcsMzEsOTIuNyw2OC42VjI5Mi4xeiIvPgo8cGF0aCBjbGFzcz0ic3QwIiBkPSJNNDI0LjcsMTQxLjdIODcuN3YtMy42YzAtMzcuNiw1NC44LTY4LjYsOTIuNy02OC42SDMzMmMzNy45LDAsOTIuNywzMC43LDkyLjcsNjguNlYxNDEuN3oiLz4KPC9zdmc%2BCg%3D%3D&colorA=16161d&style=flat-square) | ||
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-brightgreen.svg)](https://github.com/proyecto26/ion-phaser/graphs/commit-activity) | ||
[![NPM version][npm-image]][npm-url] | ||
[![Downloads][downloads-image]][npm-url] | ||
[![TotalDownloads][total-downloads-image]][npm-url] | ||
[![Twitter Follow][twitter-image]][twitter-url] | ||
[npm-image]:http://img.shields.io/npm/v/@ion-phaser/core.svg | ||
[npm-url]:https://npmjs.org/package/@ion-phaser/core | ||
[downloads-image]:http://img.shields.io/npm/dm/@ion-phaser/core.svg | ||
[total-downloads-image]:http://img.shields.io/npm/dt/@ion-phaser/core.svg?label=total%20downloads | ||
[twitter-image]:https://img.shields.io/twitter/follow/jdnichollsc.svg?style=social&label=Follow%20me | ||
[twitter-url]:https://twitter.com/jdnichollsc | ||
# IonPhaser | ||
@@ -10,2 +23,8 @@ Web Component built with **[Stencil.js](https://github.com/ionic-team/stencil)** to integrate **[Phaser](https://github.com/photonstorm/phaser)** with any other framework. | ||
## Demo | ||
Do you want to see this web component in action? Visit https://codepen.io/jdnichollsc/full/oRrwKM yay! 🎉 | ||
## Getting Started | ||
### Packages | ||
@@ -18,7 +37,5 @@ | ||
## Getting Started | ||
### Script tag | ||
- Put a script tag similar to this `<script src='https://unpkg.com/@ion-phaser/core@1.0.0/dist/ionphaser.js'></script>` in the head of your index.html | ||
- Put a script tag similar to this `<script src='https://unpkg.com/@ion-phaser/core@1.2.0/dist/ionphaser.js'></script>` in the head of your index.html | ||
- Then you can use the element anywhere in your template, JSX, html etc | ||
@@ -132,3 +149,3 @@ | ||
scale?: ScaleConfig;, | ||
initialize: Game // It's created internally when the game is initialized | ||
instance: Game // It's created internally when the game is initialized | ||
}; | ||
@@ -160,3 +177,3 @@ | ||
### Specific Wrapper | ||
When using a wrapper component, It's not necessary to access the reference directly to initialize the game. More details [here](./react/README.md). | ||
When using a wrapper component, It's not necessary to access the reference directly to configure the game. More details [here](./react/README.md). | ||
```tsx | ||
@@ -251,3 +268,21 @@ import React, { Component } from 'react' | ||
type: Phaser.AUTO, | ||
scene: {} | ||
scene: { | ||
init: function() { | ||
this.cameras.main.setBackgroundColor('#24252A') | ||
}, | ||
create: function() { | ||
this.helloWorld = this.add.text( | ||
this.cameras.main.centerX, | ||
this.cameras.main.centerY, | ||
"Hello World", { | ||
font: "40px Arial", | ||
fill: "#ffffff" | ||
} | ||
); | ||
this.helloWorld.setOrigin(0.5); | ||
}, | ||
update: function() { | ||
this.helloWorld.angle += 1; | ||
} | ||
} | ||
} | ||
@@ -266,2 +301,5 @@ } | ||
## Security contact information 🚨 | ||
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure. | ||
## Happy coding 💯 | ||
@@ -268,0 +306,0 @@ Made with ❤️ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
20043366
66
303
7
12254
11
- Removedphaser@^3.17.0