@eva/plugin-renderer-text 1.2.7-editor.5 → 1.2.7-editor.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -309,6 +309,14 @@ var _EVA_IIFE_text = function (exports, pixi_js, eva_js, pluginRenderer, rendere
309
309
  };
310
310
  }
311
311
 
312
+ var ExecuteMode;
313
+
314
+ (function (ExecuteMode) {
315
+ ExecuteMode[ExecuteMode["Edit"] = 2] = "Edit";
316
+ ExecuteMode[ExecuteMode["Game"] = 4] = "Game";
317
+ ExecuteMode[ExecuteMode["All"] = 6] = "All";
318
+ })(ExecuteMode || (ExecuteMode = {}));
319
+
312
320
  var Color = function () {
313
321
  function Color() {}
314
322
 
@@ -1 +1 @@
1
- function _extends(){return _extends=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},_extends.apply(this,arguments)}window.EVA=window.EVA||{},window.EVA.plugin=window.EVA.plugin||{},window.EVA.plugin.renderer=window.EVA.plugin.renderer||{};var _EVA_IIFE_text=function(t,e,n,o,r){"use strict";var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},i(t,e)};function p(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var a=function(){return a=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},a.apply(this,arguments)};function s(t,e,n,o){var r,i=arguments.length,p=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)p=Reflect.decorate(t,e,n,o);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(p=(i<3?r(p):i>3?r(e,n,p):r(e,n))||p);return i>3&&p&&Object.defineProperty(e,n,p),p}function u(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function l(t,e,n,o){return new(n||(n=Promise))((function(r,i){function p(t){try{s(o.next(t))}catch(t){i(t)}}function a(t){try{s(o.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(p,a)}s((o=o.apply(t,e||[])).next())}))}function c(t,e){var n,o,r,i,p={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;p;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return p.label++,{value:i[1],done:!1};case 5:p.label++,o=i[1],i=[0];continue;case 7:i=p.ops.pop(),p.trys.pop();continue;default:if(!(r=p.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){p=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){p.label=i[1];break}if(6===i[0]&&p.label<r[1]){p.label=r[1],r=i;break}if(r&&p.label<r[2]){p.label=r[2],p.ops.push(i);break}r[2]&&p.ops.pop(),p.trys.pop();continue}i=e.call(t,p)}catch(t){i=[6,t],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var d=function(t){function e(){var e=this.constructor,n=t.call(this,"Symbol keys are not supported yet!")||this;return Object.setPrototypeOf(n,e.prototype),n}return p(e,t),e}(Error);!function(t){function e(){var e=this.constructor,n=t.call(this,"getProperties is not a function!")||this;return Object.setPrototypeOf(n,e.prototype),n}p(e,t)}(Error);var y="IDE_PROPERTY_METADATA";function f(t,e,n,o){var r=Reflect.getMetadata("design:type",t,e),i=r===Array,p=function(t){return t===String?"string":t===Number?"number":t===Boolean?"boolean":"unknown"}(r);if("unknown"!==p&&(r=p),o){var s=o();Array.isArray(s)?(i=!0,r=s[0]):r=s}var u=Reflect.getMetadata(y,t.constructor)||{};u[e]=a({type:r,isArray:i},n),Reflect.defineMetadata(y,u,t.constructor)}function g(t,e){return function(n,o){if("symbol"==typeof o)throw new d;var r=function(t,e){return"function"==typeof t?{returnTypeFunc:t,options:e||{}}:{options:t||{}}}(t,e);f(n,o,r.options,r.returnTypeFunc)}}var h=function(){function t(){}return t.getProperties=function(){return"color"},t}(),m=function(){function t(){}return s([g({type:"selector",isArray:!1,options:["center","left","right"],default:"left"}),u("design:type",String)],t.prototype,"align",void 0),s([g(),u("design:type",Boolean)],t.prototype,"breakWords",void 0),s([g(),u("design:type",Boolean)],t.prototype,"dropShadow",void 0),s([g({default:1}),u("design:type",Number)],t.prototype,"dropShadowAlpha",void 0),s([g({default:Math.PI/6}),u("design:type",Number)],t.prototype,"dropShadowAngle",void 0),s([g({default:0}),u("design:type",Number)],t.prototype,"dropShadowBlur",void 0),s([g((function(){return h}),{default:"#000000"}),u("design:type",Object)],t.prototype,"dropShadowColor",void 0),s([g({default:5}),u("design:type",Number)],t.prototype,"dropShadowDistance",void 0),s([g((function(){return[h]}),{default:["#000000"]}),u("design:type",Object)],t.prototype,"fill",void 0),s([g({type:"selector",options:{vertical:1,horizontal:0},default:1,filter:function(t){return Number(t)},isArray:!1}),u("design:type",Number)],t.prototype,"fillGradientType",void 0),s([g((function(){return Number}),{step:.1,min:0,max:1}),u("design:type",Array)],t.prototype,"fillGradientStops",void 0),s([g((function(){return String}),{default:"Arial"}),u("design:type",Object)],t.prototype,"fontFamily",void 0),s([g((function(){return Number}),{min:5,default:26}),u("design:type",Object)],t.prototype,"fontSize",void 0),s([g({type:"selector",options:["normal","italic","oblique"],default:"normal"}),u("design:type",String)],t.prototype,"fontStyle",void 0),s([g({type:"selector",options:["normal","small-caps"],default:"normal"}),u("design:type",String)],t.prototype,"fontVariant",void 0),s([g({type:"selector",options:["normal","bold","bolder","lighter","100","200","300","400","500","600","700","800","900"],default:"normal"}),u("design:type",String)],t.prototype,"fontWeight",void 0),s([g({default:0}),u("design:type",Number)],t.prototype,"letterSpacing",void 0),s([g({default:0}),u("design:type",Number)],t.prototype,"lineHeight",void 0),s([g({type:"selector",options:["miter","round","bevel"],default:"miter"}),u("design:type",String)],t.prototype,"lineJoin",void 0),s([g({default:10}),u("design:type",Number)],t.prototype,"miterLimit",void 0),s([g({default:0}),u("design:type",Number)],t.prototype,"padding",void 0),s([g((function(){return h}),{default:"#000000"}),u("design:type",Object)],t.prototype,"stroke",void 0),s([g({default:0,min:0}),u("design:type",Number)],t.prototype,"strokeThickness",void 0),s([g({default:"alphabetic"}),u("design:type",String)],t.prototype,"textBaseline",void 0),s([g(),u("design:type",Boolean)],t.prototype,"trim",void 0),s([g({default:"pre",type:"selector",options:["normal","pre","pre-line"]}),u("design:type",String)],t.prototype,"whiteSpace",void 0),s([g(),u("design:type",Boolean)],t.prototype,"wordWrap",void 0),s([g({default:100}),u("design:type",Number)],t.prototype,"wordWrapWidth",void 0),s([g(),u("design:type",Number)],t.prototype,"leading",void 0),t}(),v=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.text="",e.style={},e}return p(n,t),n.prototype.init=function(t){var n=new e.TextStyle({fontSize:20}),o={};for(var r in n)0===r.indexOf("_")&&(o[r.substring(1)]=n[r]);this.style=o,t&&(this.text=t.text,_extends(this.style,t.style))},n.componentName="Text",s([g({type:"textarea",filter:function(t){return"string"!=typeof t?"":t.length>100?t.slice(0,100):t}}),u("design:type",String)],n.prototype,"text",void 0),s([g(),u("design:type",m)],n.prototype,"style",void 0),n}(n.Component),b=v,x=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="Text",e.texts={},e}return p(e,t),e.prototype.init=function(){this.renderSystem=this.game.getSystem(o.RendererSystem),this.renderSystem.rendererManager.register(this)},e.prototype.componentChanged=function(t){return l(this,void 0,void 0,(function(){var e,o;return c(this,(function(i){return"Text"!==t.componentName||(t.type===n.OBSERVER_TYPE.ADD?(e=t.component,o=new r.Text(e.text,e.style),this.containerManager.getContainer(t.gameObject.id).addChildAt(o,0),this.texts[t.gameObject.id]={text:o,component:t.component},this.setSize(t)):t.type===n.OBSERVER_TYPE.REMOVE?(this.containerManager.getContainer(t.gameObject.id).removeChild(this.texts[t.gameObject.id].text),this.texts[t.gameObject.id].text.destroy({children:!0}),delete this.texts[t.gameObject.id]):(this.change(t),this.setSize(t))),[2]}))}))},e.prototype.change=function(t){var e=this.texts[t.gameObject.id],n=e.text,o=e.component;"text"===t.prop.prop[0]?n.text=o.text:"style"===t.prop.prop[0]&&_extends(n.style,t.component.style)},e.prototype.setSize=function(t){var e=t.gameObject.transform;e&&(e.size.width=this.texts[t.gameObject.id].text.width,e.size.height=this.texts[t.gameObject.id].text.height)},e.systemName="Text",e=s([n.decorators.componentObserver({Text:["text",{prop:["style"],deep:!0}]})],e)}(o.Renderer),w=x;return t.Text=b,t.TextSystem=w,Object.defineProperty(t,"__esModule",{value:!0}),t}({},PIXI,EVA,EVA.plugin.renderer,EVA.rendererAdapter);window.EVA.plugin.renderer.text=window.EVA.plugin.renderer.text||_EVA_IIFE_text;
1
+ function _extends(){return _extends=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},_extends.apply(this,arguments)}window.EVA=window.EVA||{},window.EVA.plugin=window.EVA.plugin||{},window.EVA.plugin.renderer=window.EVA.plugin.renderer||{};var _EVA_IIFE_text=function(t,e,n,o,r){"use strict";var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},i(t,e)};function p(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var a=function(){return a=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},a.apply(this,arguments)};function s(t,e,n,o){var r,i=arguments.length,p=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)p=Reflect.decorate(t,e,n,o);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(p=(i<3?r(p):i>3?r(e,n,p):r(e,n))||p);return i>3&&p&&Object.defineProperty(e,n,p),p}function u(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function l(t,e,n,o){return new(n||(n=Promise))((function(r,i){function p(t){try{s(o.next(t))}catch(t){i(t)}}function a(t){try{s(o.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(p,a)}s((o=o.apply(t,e||[])).next())}))}function c(t,e){var n,o,r,i,p={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;p;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return p.label++,{value:i[1],done:!1};case 5:p.label++,o=i[1],i=[0];continue;case 7:i=p.ops.pop(),p.trys.pop();continue;default:if(!(r=p.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){p=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){p.label=i[1];break}if(6===i[0]&&p.label<r[1]){p.label=r[1],r=i;break}if(r&&p.label<r[2]){p.label=r[2],p.ops.push(i);break}r[2]&&p.ops.pop(),p.trys.pop();continue}i=e.call(t,p)}catch(t){i=[6,t],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var d=function(t){function e(){var e=this.constructor,n=t.call(this,"Symbol keys are not supported yet!")||this;return Object.setPrototypeOf(n,e.prototype),n}return p(e,t),e}(Error);!function(t){function e(){var e=this.constructor,n=t.call(this,"getProperties is not a function!")||this;return Object.setPrototypeOf(n,e.prototype),n}p(e,t)}(Error);var y,f="IDE_PROPERTY_METADATA";function g(t,e,n,o){var r=Reflect.getMetadata("design:type",t,e),i=r===Array,p=function(t){return t===String?"string":t===Number?"number":t===Boolean?"boolean":"unknown"}(r);if("unknown"!==p&&(r=p),o){var s=o();Array.isArray(s)?(i=!0,r=s[0]):r=s}var u=Reflect.getMetadata(f,t.constructor)||{};u[e]=a({type:r,isArray:i},n),Reflect.defineMetadata(f,u,t.constructor)}function h(t,e){return function(n,o){if("symbol"==typeof o)throw new d;var r=function(t,e){return"function"==typeof t?{returnTypeFunc:t,options:e||{}}:{options:t||{}}}(t,e);g(n,o,r.options,r.returnTypeFunc)}}!function(t){t[t.Edit=2]="Edit",t[t.Game=4]="Game",t[t.All=6]="All"}(y||(y={}));var m=function(){function t(){}return t.getProperties=function(){return"color"},t}(),v=function(){function t(){}return s([h({type:"selector",isArray:!1,options:["center","left","right"],default:"left"}),u("design:type",String)],t.prototype,"align",void 0),s([h(),u("design:type",Boolean)],t.prototype,"breakWords",void 0),s([h(),u("design:type",Boolean)],t.prototype,"dropShadow",void 0),s([h({default:1}),u("design:type",Number)],t.prototype,"dropShadowAlpha",void 0),s([h({default:Math.PI/6}),u("design:type",Number)],t.prototype,"dropShadowAngle",void 0),s([h({default:0}),u("design:type",Number)],t.prototype,"dropShadowBlur",void 0),s([h((function(){return m}),{default:"#000000"}),u("design:type",Object)],t.prototype,"dropShadowColor",void 0),s([h({default:5}),u("design:type",Number)],t.prototype,"dropShadowDistance",void 0),s([h((function(){return[m]}),{default:["#000000"]}),u("design:type",Object)],t.prototype,"fill",void 0),s([h({type:"selector",options:{vertical:1,horizontal:0},default:1,filter:function(t){return Number(t)},isArray:!1}),u("design:type",Number)],t.prototype,"fillGradientType",void 0),s([h((function(){return Number}),{step:.1,min:0,max:1}),u("design:type",Array)],t.prototype,"fillGradientStops",void 0),s([h((function(){return String}),{default:"Arial"}),u("design:type",Object)],t.prototype,"fontFamily",void 0),s([h((function(){return Number}),{min:5,default:26}),u("design:type",Object)],t.prototype,"fontSize",void 0),s([h({type:"selector",options:["normal","italic","oblique"],default:"normal"}),u("design:type",String)],t.prototype,"fontStyle",void 0),s([h({type:"selector",options:["normal","small-caps"],default:"normal"}),u("design:type",String)],t.prototype,"fontVariant",void 0),s([h({type:"selector",options:["normal","bold","bolder","lighter","100","200","300","400","500","600","700","800","900"],default:"normal"}),u("design:type",String)],t.prototype,"fontWeight",void 0),s([h({default:0}),u("design:type",Number)],t.prototype,"letterSpacing",void 0),s([h({default:0}),u("design:type",Number)],t.prototype,"lineHeight",void 0),s([h({type:"selector",options:["miter","round","bevel"],default:"miter"}),u("design:type",String)],t.prototype,"lineJoin",void 0),s([h({default:10}),u("design:type",Number)],t.prototype,"miterLimit",void 0),s([h({default:0}),u("design:type",Number)],t.prototype,"padding",void 0),s([h((function(){return m}),{default:"#000000"}),u("design:type",Object)],t.prototype,"stroke",void 0),s([h({default:0,min:0}),u("design:type",Number)],t.prototype,"strokeThickness",void 0),s([h({default:"alphabetic"}),u("design:type",String)],t.prototype,"textBaseline",void 0),s([h(),u("design:type",Boolean)],t.prototype,"trim",void 0),s([h({default:"pre",type:"selector",options:["normal","pre","pre-line"]}),u("design:type",String)],t.prototype,"whiteSpace",void 0),s([h(),u("design:type",Boolean)],t.prototype,"wordWrap",void 0),s([h({default:100}),u("design:type",Number)],t.prototype,"wordWrapWidth",void 0),s([h(),u("design:type",Number)],t.prototype,"leading",void 0),t}(),b=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.text="",e.style={},e}return p(n,t),n.prototype.init=function(t){var n=new e.TextStyle({fontSize:20}),o={};for(var r in n)0===r.indexOf("_")&&(o[r.substring(1)]=n[r]);this.style=o,t&&(this.text=t.text,_extends(this.style,t.style))},n.componentName="Text",s([h({type:"textarea",filter:function(t){return"string"!=typeof t?"":t.length>100?t.slice(0,100):t}}),u("design:type",String)],n.prototype,"text",void 0),s([h(),u("design:type",v)],n.prototype,"style",void 0),n}(n.Component),x=b,w=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="Text",e.texts={},e}return p(e,t),e.prototype.init=function(){this.renderSystem=this.game.getSystem(o.RendererSystem),this.renderSystem.rendererManager.register(this)},e.prototype.componentChanged=function(t){return l(this,void 0,void 0,(function(){var e,o;return c(this,(function(i){return"Text"!==t.componentName||(t.type===n.OBSERVER_TYPE.ADD?(e=t.component,o=new r.Text(e.text,e.style),this.containerManager.getContainer(t.gameObject.id).addChildAt(o,0),this.texts[t.gameObject.id]={text:o,component:t.component},this.setSize(t)):t.type===n.OBSERVER_TYPE.REMOVE?(this.containerManager.getContainer(t.gameObject.id).removeChild(this.texts[t.gameObject.id].text),this.texts[t.gameObject.id].text.destroy({children:!0}),delete this.texts[t.gameObject.id]):(this.change(t),this.setSize(t))),[2]}))}))},e.prototype.change=function(t){var e=this.texts[t.gameObject.id],n=e.text,o=e.component;"text"===t.prop.prop[0]?n.text=o.text:"style"===t.prop.prop[0]&&_extends(n.style,t.component.style)},e.prototype.setSize=function(t){var e=t.gameObject.transform;e&&(e.size.width=this.texts[t.gameObject.id].text.width,e.size.height=this.texts[t.gameObject.id].text.height)},e.systemName="Text",e=s([n.decorators.componentObserver({Text:["text",{prop:["style"],deep:!0}]})],e)}(o.Renderer),O=w;return t.Text=x,t.TextSystem=O,Object.defineProperty(t,"__esModule",{value:!0}),t}({},PIXI,EVA,EVA.plugin.renderer,EVA.rendererAdapter);window.EVA.plugin.renderer.text=window.EVA.plugin.renderer.text||_EVA_IIFE_text;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eva/plugin-renderer-text",
3
- "version": "1.2.7-editor.5",
3
+ "version": "1.2.7-editor.8",
4
4
  "description": "@eva/plugin-renderer-text",
5
5
  "main": "index.js",
6
6
  "module": "dist/plugin-renderer-text.esm.js",
@@ -18,10 +18,10 @@
18
18
  "license": "MIT",
19
19
  "homepage": "https://eva.js.org",
20
20
  "dependencies": {
21
- "@eva/inspector-decorator": "0.1.0-alpha.1",
22
- "@eva/plugin-renderer": "1.2.7-editor.5",
23
- "@eva/renderer-adapter": "1.2.7-editor.5",
24
- "@eva/eva.js": "1.2.7-editor.5",
21
+ "@eva/inspector-decorator": "0.1.0-alpha.2",
22
+ "@eva/plugin-renderer": "1.2.7-editor.8",
23
+ "@eva/renderer-adapter": "1.2.7-editor.8",
24
+ "@eva/eva.js": "1.2.7-editor.8",
25
25
  "pixi.js": "^4.8.7"
26
26
  }
27
27
  }
@@ -1,303 +0,0 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
3
- import { __decorate, __metadata, __extends, __awaiter, __generator } from 'tslib';
4
- import { TextStyle } from '@eva/miniprogram-pixi';
5
- import { Component, OBSERVER_TYPE, decorators } from '@eva/eva.js/dist/miniprogram';
6
- import { Field } from '@eva/inspector-decorator';
7
- import { RendererSystem, Renderer } from '@eva/plugin-renderer/dist/miniprogram';
8
- import { Text as Text$4 } from '@eva/renderer-adapter/dist/miniprogram';
9
-
10
- var Color = function () {
11
- function Color() {}
12
-
13
- Color.getProperties = function () {
14
- return 'color';
15
- };
16
-
17
- return Color;
18
- }();
19
-
20
- var Style = function () {
21
- function Style() {}
22
-
23
- __decorate([Field({
24
- type: 'selector',
25
- isArray: false,
26
- options: ['center', 'left', 'right'],
27
- default: 'left'
28
- }), __metadata("design:type", String)], Style.prototype, "align", void 0);
29
-
30
- __decorate([Field(), __metadata("design:type", Boolean)], Style.prototype, "breakWords", void 0);
31
-
32
- __decorate([Field(), __metadata("design:type", Boolean)], Style.prototype, "dropShadow", void 0);
33
-
34
- __decorate([Field({
35
- default: 1
36
- }), __metadata("design:type", Number)], Style.prototype, "dropShadowAlpha", void 0);
37
-
38
- __decorate([Field({
39
- default: Math.PI / 6
40
- }), __metadata("design:type", Number)], Style.prototype, "dropShadowAngle", void 0);
41
-
42
- __decorate([Field({
43
- default: 0
44
- }), __metadata("design:type", Number)], Style.prototype, "dropShadowBlur", void 0);
45
-
46
- __decorate([Field(function () {
47
- return Color;
48
- }, {
49
- default: '#000000'
50
- }), __metadata("design:type", Object)], Style.prototype, "dropShadowColor", void 0);
51
-
52
- __decorate([Field({
53
- default: 5
54
- }), __metadata("design:type", Number)], Style.prototype, "dropShadowDistance", void 0);
55
-
56
- __decorate([Field(function () {
57
- return [Color];
58
- }, {
59
- default: ['#000000']
60
- }), __metadata("design:type", Object)], Style.prototype, "fill", void 0);
61
-
62
- __decorate([Field({
63
- type: 'selector',
64
- options: {
65
- vertical: 1,
66
- horizontal: 0
67
- },
68
- default: 1,
69
- filter: function filter(val) {
70
- return Number(val);
71
- },
72
- isArray: false
73
- }), __metadata("design:type", Number)], Style.prototype, "fillGradientType", void 0);
74
-
75
- __decorate([Field(function () {
76
- return Number;
77
- }, {
78
- step: 0.1,
79
- min: 0,
80
- max: 1
81
- }), __metadata("design:type", Array)], Style.prototype, "fillGradientStops", void 0);
82
-
83
- __decorate([Field(function () {
84
- return String;
85
- }, {
86
- default: 'Arial'
87
- }), __metadata("design:type", Object)], Style.prototype, "fontFamily", void 0);
88
-
89
- __decorate([Field(function () {
90
- return Number;
91
- }, {
92
- min: 5,
93
- default: 26
94
- }), __metadata("design:type", Object)], Style.prototype, "fontSize", void 0);
95
-
96
- __decorate([Field({
97
- type: 'selector',
98
- options: ['normal', 'italic', 'oblique'],
99
- default: 'normal'
100
- }), __metadata("design:type", String)], Style.prototype, "fontStyle", void 0);
101
-
102
- __decorate([Field({
103
- type: 'selector',
104
- options: ['normal', 'small-caps'],
105
- default: 'normal'
106
- }), __metadata("design:type", String)], Style.prototype, "fontVariant", void 0);
107
-
108
- __decorate([Field({
109
- type: 'selector',
110
- options: ['normal', 'bold', 'bolder', 'lighter', '100', '200', '300', '400', '500', '600', '700', '800', '900'],
111
- default: 'normal'
112
- }), __metadata("design:type", String)], Style.prototype, "fontWeight", void 0);
113
-
114
- __decorate([Field({
115
- default: 0
116
- }), __metadata("design:type", Number)], Style.prototype, "letterSpacing", void 0);
117
-
118
- __decorate([Field({
119
- default: 0
120
- }), __metadata("design:type", Number)], Style.prototype, "lineHeight", void 0);
121
-
122
- __decorate([Field({
123
- type: 'selector',
124
- options: ['miter', 'round', 'bevel'],
125
- default: 'miter'
126
- }), __metadata("design:type", String)], Style.prototype, "lineJoin", void 0);
127
-
128
- __decorate([Field({
129
- default: 10
130
- }), __metadata("design:type", Number)], Style.prototype, "miterLimit", void 0);
131
-
132
- __decorate([Field({
133
- default: 0
134
- }), __metadata("design:type", Number)], Style.prototype, "padding", void 0);
135
-
136
- __decorate([Field(function () {
137
- return Color;
138
- }, {
139
- default: '#000000'
140
- }), __metadata("design:type", Object)], Style.prototype, "stroke", void 0);
141
-
142
- __decorate([Field({
143
- default: 0,
144
- min: 0
145
- }), __metadata("design:type", Number)], Style.prototype, "strokeThickness", void 0);
146
-
147
- __decorate([Field({
148
- default: 'alphabetic'
149
- }), __metadata("design:type", String)], Style.prototype, "textBaseline", void 0);
150
-
151
- __decorate([Field(), __metadata("design:type", Boolean)], Style.prototype, "trim", void 0);
152
-
153
- __decorate([Field({
154
- default: 'pre',
155
- type: 'selector',
156
- options: ['normal', 'pre', 'pre-line']
157
- }), __metadata("design:type", String)], Style.prototype, "whiteSpace", void 0);
158
-
159
- __decorate([Field(), __metadata("design:type", Boolean)], Style.prototype, "wordWrap", void 0);
160
-
161
- __decorate([Field({
162
- default: 100
163
- }), __metadata("design:type", Number)], Style.prototype, "wordWrapWidth", void 0);
164
-
165
- __decorate([Field(), __metadata("design:type", Number)], Style.prototype, "leading", void 0);
166
-
167
- return Style;
168
- }();
169
-
170
- var Text$2 = function (_super) {
171
- __extends(Text, _super);
172
-
173
- function Text() {
174
- var _this = _super !== null && _super.apply(this, arguments) || this;
175
-
176
- _this.text = '';
177
- _this.style = {};
178
- return _this;
179
- }
180
-
181
- Text.prototype.init = function (obj) {
182
- var style = new TextStyle({
183
- fontSize: 20
184
- });
185
- var newStyle = {};
186
-
187
- for (var key in style) {
188
- if (key.indexOf('_') === 0) {
189
- newStyle[key.substring(1)] = style[key];
190
- }
191
- }
192
-
193
- this.style = newStyle;
194
-
195
- if (obj) {
196
- this.text = obj.text;
197
-
198
- _extends(this.style, obj.style);
199
- }
200
- };
201
-
202
- Text.componentName = 'Text';
203
-
204
- __decorate([Field({
205
- type: 'textarea',
206
- filter: function filter(text) {
207
- if (typeof text !== 'string') {
208
- return '';
209
- }
210
-
211
- if (text.length > 100) {
212
- return text.slice(0, 100);
213
- }
214
-
215
- return text;
216
- }
217
- }), __metadata("design:type", String)], Text.prototype, "text", void 0);
218
-
219
- __decorate([Field(), __metadata("design:type", Style)], Text.prototype, "style", void 0);
220
-
221
- return Text;
222
- }(Component);
223
-
224
- var Text$3 = Text$2;
225
-
226
- var Text = function (_super) {
227
- __extends(Text, _super);
228
-
229
- function Text() {
230
- var _this = _super !== null && _super.apply(this, arguments) || this;
231
-
232
- _this.name = 'Text';
233
- _this.texts = {};
234
- return _this;
235
- }
236
-
237
- Text.prototype.init = function () {
238
- this.renderSystem = this.game.getSystem(RendererSystem);
239
- this.renderSystem.rendererManager.register(this);
240
- };
241
-
242
- Text.prototype.componentChanged = function (changed) {
243
- return __awaiter(this, void 0, void 0, function () {
244
- var component, text;
245
- return __generator(this, function (_a) {
246
- if (changed.componentName !== 'Text') return [2];
247
-
248
- if (changed.type === OBSERVER_TYPE.ADD) {
249
- component = changed.component;
250
- text = new Text$4(component.text, component.style);
251
- this.containerManager.getContainer(changed.gameObject.id).addChildAt(text, 0);
252
- this.texts[changed.gameObject.id] = {
253
- text: text,
254
- component: changed.component
255
- };
256
- this.setSize(changed);
257
- } else if (changed.type === OBSERVER_TYPE.REMOVE) {
258
- this.containerManager.getContainer(changed.gameObject.id).removeChild(this.texts[changed.gameObject.id].text);
259
- this.texts[changed.gameObject.id].text.destroy({
260
- children: true
261
- });
262
- delete this.texts[changed.gameObject.id];
263
- } else {
264
- this.change(changed);
265
- this.setSize(changed);
266
- }
267
-
268
- return [2];
269
- });
270
- });
271
- };
272
-
273
- Text.prototype.change = function (changed) {
274
- var _a = this.texts[changed.gameObject.id],
275
- text = _a.text,
276
- component = _a.component;
277
-
278
- if (changed.prop.prop[0] === 'text') {
279
- text.text = component.text;
280
- } else if (changed.prop.prop[0] === 'style') {
281
- _extends(text.style, changed.component.style);
282
- }
283
- };
284
-
285
- Text.prototype.setSize = function (changed) {
286
- var transform = changed.gameObject.transform;
287
- if (!transform) return;
288
- transform.size.width = this.texts[changed.gameObject.id].text.width;
289
- transform.size.height = this.texts[changed.gameObject.id].text.height;
290
- };
291
-
292
- Text.systemName = 'Text';
293
- Text = __decorate([decorators.componentObserver({
294
- Text: ['text', {
295
- prop: ['style'],
296
- deep: true
297
- }]
298
- })], Text);
299
- return Text;
300
- }(Renderer);
301
-
302
- var Text$1 = Text;
303
- export { Text$3 as Text, Text$1 as TextSystem };