bard-legends-framework 0.6.1 → 0.6.2

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.
@@ -8,9 +8,7 @@ class GlowEffect {
8
8
  }
9
9
  add(partialOptions) {
10
10
  this.remove();
11
- let { glowAlpha, ...partialOptionsWithoutAlpha } = partialOptions;
12
- this.glowSprite = glow_sprite_generator_1.GlowSpriteGenerator.createGlowSprite(this.pixiSprite, partialOptionsWithoutAlpha);
13
- this.glowSprite.alpha = glowAlpha ?? 1;
11
+ this.glowSprite = glow_sprite_generator_1.GlowSpriteGenerator.createGlowSprite(this.pixiSprite, partialOptions);
14
12
  this.pixiSprite.addChild(this.glowSprite);
15
13
  return this;
16
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"glow-effect.js","sourceRoot":"","sources":["../../../../src/pixi/display-object/components/glow-effect.ts"],"names":[],"mappings":";;;AAEA,+EAA0E;AAG1E,MAAa,UAAU;IAGrB,YAAoB,UAAuB;QAAvB,eAAU,GAAV,UAAU,CAAa;IAAG,CAAC;IAE/C,GAAG,CAAC,cAAiC;QACnC,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,IAAI,EAAE,SAAS,EAAE,GAAG,0BAA0B,EAAE,GAAG,cAAc,CAAC;QAClE,IAAI,CAAC,UAAU,GAAG,2CAAmB,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,0BAA0B,CAAC,CAAC;QACpG,IAAI,CAAC,UAAU,CAAC,KAAK,GAAG,SAAS,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC1C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,QAAQ,CAAC,KAAa;QACpB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,KAAK;QACP,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACpB,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;QAC/B,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,2EAA2E,CAAC,CAAC;QAC/F,CAAC;IACH,CAAC;IACD,IAAI,KAAK,CAAC,KAAa;QACrB,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACpB,IAAI,CAAC,UAAU,CAAC,KAAK,GAAG,KAAK,CAAC;QAChC,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,2EAA2E,CAAC,CAAC;QAC/F,CAAC;IACH,CAAC;IAED,MAAM;QACJ,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACpB,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;YAC1B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC9B,CAAC;IACH,CAAC;CACF;AAvCD,gCAuCC"}
1
+ {"version":3,"file":"glow-effect.js","sourceRoot":"","sources":["../../../../src/pixi/display-object/components/glow-effect.ts"],"names":[],"mappings":";;;AAEA,+EAA0E;AAG1E,MAAa,UAAU;IAGrB,YAAoB,UAAuB;QAAvB,eAAU,GAAV,UAAU,CAAa;IAAG,CAAC;IAE/C,GAAG,CAAC,cAAiC;QACnC,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,IAAI,CAAC,UAAU,GAAG,2CAAmB,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;QACxF,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC1C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,QAAQ,CAAC,KAAa;QACpB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,KAAK;QACP,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACpB,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;QAC/B,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,2EAA2E,CAAC,CAAC;QAC/F,CAAC;IACH,CAAC;IACD,IAAI,KAAK,CAAC,KAAa;QACrB,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACpB,IAAI,CAAC,UAAU,CAAC,KAAK,GAAG,KAAK,CAAC;QAChC,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,2EAA2E,CAAC,CAAC;QAC/F,CAAC;IACH,CAAC;IAED,MAAM;QACJ,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACpB,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;YAC1B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC9B,CAAC;IACH,CAAC;CACF;AArCD,gCAqCC"}
@@ -0,0 +1,9 @@
1
+ import * as PIXI from 'pixi.js';
2
+ import { RGBColor } from 'helpers-lib';
3
+ export declare class ExpandWithAlphaColorFilter extends PIXI.Filter {
4
+ private expand;
5
+ private static vertexShader;
6
+ private static getFragmentShader;
7
+ constructor(expand: number, color: RGBColor);
8
+ apply(filterManager: PIXI.FilterSystem, input: PIXI.RenderTexture, output: PIXI.RenderTexture, clearMode: PIXI.CLEAR_MODES): void;
9
+ }
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.ExpandWithAlphaColorFilter = void 0;
27
+ const PIXI = __importStar(require("pixi.js"));
28
+ const helpers_lib_1 = require("helpers-lib");
29
+ class ExpandWithAlphaColorFilter extends PIXI.Filter {
30
+ static { this.vertexShader = `
31
+ attribute vec2 aVertexPosition;
32
+ attribute vec2 aTextureCoord;
33
+
34
+ uniform mat3 projectionMatrix;
35
+
36
+ varying vec2 vTextureCoord;
37
+
38
+ void main(void) {
39
+ gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
40
+ vTextureCoord = aTextureCoord;
41
+ }
42
+ `; }
43
+ static getFragmentShader(expand, color) {
44
+ let shader = `
45
+ uniform sampler2D uSampler;
46
+ uniform vec2 pixelSize;
47
+ uniform float expandSquared;
48
+
49
+ varying vec2 vTextureCoord;
50
+
51
+ void main(void) {
52
+ float highestAlpha = 0.0;`;
53
+ if (expand > 0) {
54
+ shader += `\n
55
+ for (float x = -${helpers_lib_1.NumberHelper.toFloatString(expand)}; x <= ${helpers_lib_1.NumberHelper.toFloatString(expand)}; x++) {
56
+ for (float y = -${helpers_lib_1.NumberHelper.toFloatString(expand)}; y <= ${helpers_lib_1.NumberHelper.toFloatString(expand)}; y++) {
57
+ vec4 color = texture2D(uSampler, vTextureCoord + vec2(x * pixelSize.x, y * pixelSize.y));
58
+ float distance = x * x + y * y;
59
+ highestAlpha = max(highestAlpha, color.a * step(distance, expandSquared));
60
+ }
61
+ }`;
62
+ }
63
+ else {
64
+ shader += `\n
65
+ vec4 color = texture2D(uSampler, vTextureCoord);
66
+ highestAlpha = color.a;`;
67
+ }
68
+ // prettier-ignore
69
+ shader += `\n
70
+ gl_FragColor = vec4(${helpers_lib_1.NumberHelper.toFloatString(color.red)}, ${helpers_lib_1.NumberHelper.toFloatString(color.green)}, ${helpers_lib_1.NumberHelper.toFloatString(color.blue)}, 1.0) * highestAlpha;
71
+ }`;
72
+ return shader;
73
+ }
74
+ constructor(expand, color) {
75
+ super(ExpandWithAlphaColorFilter.vertexShader, ExpandWithAlphaColorFilter.getFragmentShader(expand, helpers_lib_1.ColorHelper.normalize(color)));
76
+ this.expand = expand;
77
+ if (expand < 0) {
78
+ throw new Error('BlurFilterLinearSampling: Expand cannot be smaller than 0');
79
+ }
80
+ else if (expand > 10) {
81
+ throw new Error('BlurFilterLinearSampling: Expand cannot be higher than 10');
82
+ }
83
+ if (!helpers_lib_1.Comparator.isInteger(expand)) {
84
+ expand = Math.floor(expand);
85
+ }
86
+ this.padding = expand;
87
+ }
88
+ apply(filterManager, input, output, clearMode) {
89
+ this.uniforms.pixelSize = new Float32Array([1 / input.width, 1 / input.height]);
90
+ this.uniforms.expandSquared = this.expand * this.expand;
91
+ filterManager.applyFilter(this, input, output, clearMode);
92
+ }
93
+ }
94
+ exports.ExpandWithAlphaColorFilter = ExpandWithAlphaColorFilter;
95
+ //# sourceMappingURL=expand-with-alpha-color.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expand-with-alpha-color.js","sourceRoot":"","sources":["../../../../../src/pixi/display-object/filters/base-filters/expand-with-alpha-color.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAgC;AAChC,6CAA+F;AAE/F,MAAa,0BAA2B,SAAQ,IAAI,CAAC,MAAM;aAC1C,iBAAY,GAAG;;;;;;;;;;;;GAY7B,CAAC;IAEM,MAAM,CAAC,iBAAiB,CAAC,MAAc,EAAE,KAAsB;QACrE,IAAI,MAAM,GAAG;;;;;;;;kCAQiB,CAAC;QAE/B,IAAI,MAAM,GAAG,CAAC,EA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AC,SAAS,GAAG,IAAI,YAAY,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;QAChF,IAAI,CAAC,QAAQ,CAAC,aAAa,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QACxD,aAAa,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IAC5D,CAAC;;AAlFH,gEAmFC"}
@@ -25,14 +25,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.GlowFilter = void 0;
27
27
  const PIXI = __importStar(require("pixi.js"));
28
+ const helpers_lib_1 = require("helpers-lib");
28
29
  const blur_filter_1 = require("../base-filters/blur.filter");
29
- const alpha_primer_color_filter_1 = require("../base-filters/alpha-primer-color.filter");
30
+ const expand_with_alpha_color_1 = require("../base-filters/expand-with-alpha-color");
30
31
  const __1 = require("../../..");
31
32
  class GlowFilter extends PIXI.Filter {
32
33
  constructor(partialOptions) {
33
34
  super();
34
35
  let options = this.completeOptions(partialOptions);
35
- this.alphaPrimerColorFilter = new alpha_primer_color_filter_1.AlphaPrimerColorFilter(options.expand, options.color);
36
+ this.alphaPrimerColorFilter = new expand_with_alpha_color_1.ExpandWithAlphaColorFilter(options.expand, options.color);
36
37
  this.blurFilter = new blur_filter_1.BlurFilter(options.blurRadius);
37
38
  this.padding = options.blurRadius + options.expand;
38
39
  this.blurFilter.blendMode = PIXI.BLEND_MODES.SCREEN;
@@ -47,7 +48,7 @@ class GlowFilter extends PIXI.Filter {
47
48
  let options = {
48
49
  blurRadius: 1,
49
50
  expand: 0,
50
- color: { r: 0, g: 0, b: 0 },
51
+ color: helpers_lib_1.ColorHelper.white,
51
52
  blendMode: __1.BlendMode.screen
52
53
  };
53
54
  if (partialOptions) {
@@ -1 +1 @@
1
- {"version":3,"file":"glow-fil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EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;YAC3B,SAAS,EAAE,aAAS,CAAC,MAAM;SAC5B,CAAC;QAEF,IAAI,cAAc,EAAE,CAAC;YACnB,OAAO,GAAG,EAAE,GAAG,OAAO,EAAE,GAAG,cAAc,EAAE,CAAC;QAC9C,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AA5CD,gCA4CC"}
1
+ {"version":3,"file":"glow-filter.js","sourceRoot":"","sources":["../../../../../src/pixi/display-object/filters/composite-filters/glow-filter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAgC;AAChC,6CAA0C;AAE1C,6DAAyD;AACzD,qFAAqF;AACrF,gCAAkD;AAElD,MAAa,UAAW,SAAQ,IAAI,CAAC,MAAM;IAIzC,YAAY,cAAqC;QAC/C,KAAK,EAAE,CAAC;QAER,IAAI,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;QAEnD,IAAI,CAAC,sBAAsB,GAAG,IAAI,oDAA0B,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;QAC5F,IAAI,CAAC,UAAU,GAAG,IAAI,wBAAU,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAErD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;QACnD,IAAI,CAAC,UAAU,CAAC,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC;IACtD,CAAC;IAED,KAAK,CACH,aAAgC,EAChC,KAAyB,EACzB,MAA0B,EAC1B,SAA2B;QAE3B,IAAI,YAAY,GAAG,aAAa,CAAC,gBAAgB,EAAE,CAAC;QAEpD,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,aAAa,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAC9F,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,aAAa,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;QAEtE,aAAa,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC;IAClD,CAAC;IAEO,eAAe,CAAC,cAAqC;QAC3D,IAAI,OAAO,GAAgB;YACzB,UAAU,EAAE,CAAC;YACb,MAAM,EAAE,CAAC;YACT,KAAK,EAAE,yBAAW,CAAC,KAAK;YACxB,SAAS,EAAE,aAAS,CAAC,MAAM;SAC5B,CAAC;QAEF,IAAI,cAAc,EAAE,CAAC;YACnB,OAAO,GAAG,EAAE,GAAG,OAAO,EAAE,GAAG,cAAc,EAAE,CAAC;QAC9C,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AA5CD,gCA4CC"}
@@ -1,9 +1,10 @@
1
1
  import * as PIXI from 'pixi.js';
2
- import { GlowOptions } from '..';
2
+ import { GlowEffectOptions } from '..';
3
3
  export declare class GlowSpriteGenerator {
4
4
  private static glowTextureCache;
5
- static createGlowSprite(pixiSprite: PIXI.Sprite, options: Partial<GlowOptions>): PIXI.Sprite;
5
+ static createGlowSprite(pixiSprite: PIXI.Sprite, partialOptions: GlowEffectOptions): PIXI.Sprite;
6
6
  private static getGlowTexture;
7
7
  private static setEquavelentAnchorByExtendedBounds;
8
8
  private static extendBounds;
9
+ private static completeOptions;
9
10
  }
@@ -31,29 +31,28 @@ const update_cycle_1 = require("../../game-entities/update-cycle");
31
31
  const glow_filter_1 = require("../display-object/filters/composite-filters/glow-filter");
32
32
  class GlowSpriteGenerator {
33
33
  static { this.glowTextureCache = new Map(); }
34
- static createGlowSprite(pixiSprite, options) {
35
- let blurRadius = options.blurRadius ?? 5;
36
- let blendMode = options.blendMode ?? __1.BlendMode.add;
37
- let color = options.color ?? helpers_lib_1.ColorHelper.white;
38
- let glowBaseTexture = this.getGlowTexture(pixiSprite.texture, blurRadius, color);
34
+ static createGlowSprite(pixiSprite, partialOptions) {
35
+ let options = this.completeOptions(partialOptions);
36
+ let glowBaseTexture = this.getGlowTexture(pixiSprite.texture, options.blurRadius, options.expand, options.color);
39
37
  let glowSprite = new PIXI.Sprite(glowBaseTexture);
40
38
  let anchor = new helpers_lib_1.Vector(pixiSprite.anchor.x, pixiSprite.anchor.y);
41
- this.setEquavelentAnchorByExtendedBounds(glowSprite, anchor, blurRadius);
42
- glowSprite.blendMode = blendMode;
39
+ this.setEquavelentAnchorByExtendedBounds(glowSprite, anchor, options.blurRadius + options.expand);
40
+ glowSprite.alpha = options.glowAlpha;
41
+ glowSprite.blendMode = options.blendMode;
43
42
  return glowSprite;
44
43
  }
45
- static getGlowTexture(baseTexture, blurRadius, color) {
44
+ static getGlowTexture(baseTexture, blurRadius, expand, color) {
46
45
  if (!baseTexture.id) {
47
46
  throw new Error('GlowSpriteGenerator: baseTexture should have an id');
48
47
  }
49
- let cacheName = `${baseTexture.id}-${blurRadius}-${color.r}-${color.g}-${color.b}`;
48
+ let cacheName = `${baseTexture.id}-${expand}-${blurRadius}-${color.r}-${color.g}-${color.b}`;
50
49
  if (GlowSpriteGenerator.glowTextureCache.has(cacheName)) {
51
50
  return GlowSpriteGenerator.glowTextureCache.get(cacheName);
52
51
  }
53
52
  else {
54
53
  let glowBaseSprite = new PIXI.Sprite(baseTexture);
55
- this.extendBounds(glowBaseSprite, blurRadius);
56
- glowBaseSprite.filters = [new glow_filter_1.GlowFilter({ blurRadius: blurRadius, color })];
54
+ this.extendBounds(glowBaseSprite, blurRadius + expand);
55
+ glowBaseSprite.filters = [new glow_filter_1.GlowFilter({ blurRadius, expand, color })];
57
56
  let texture = __1.Game.instance.renderer.generateTexture(glowBaseSprite);
58
57
  texture.id = cacheName;
59
58
  glowBaseSprite.destroy();
@@ -61,9 +60,9 @@ class GlowSpriteGenerator {
61
60
  return texture;
62
61
  }
63
62
  }
64
- static setEquavelentAnchorByExtendedBounds(sprite, anchor, blurRadius) {
65
- let x = (blurRadius + (sprite.width - blurRadius * 2) * anchor.x) / sprite.width;
66
- let y = (blurRadius + (sprite.height - blurRadius * 2) * anchor.y) / sprite.height;
63
+ static setEquavelentAnchorByExtendedBounds(sprite, anchor, amount) {
64
+ let x = (amount + (sprite.width - amount * 2) * anchor.x) / sprite.width;
65
+ let y = (amount + (sprite.height - amount * 2) * anchor.y) / sprite.height;
67
66
  sprite.anchor.set(x, y);
68
67
  }
69
68
  static extendBounds(container, amount) {
@@ -78,6 +77,19 @@ class GlowSpriteGenerator {
78
77
  this._bounds.addFrame(this.transform, -amount, -amount, width + amount, height + amount);
79
78
  };
80
79
  }
80
+ static completeOptions(partialOptions) {
81
+ let options = {
82
+ glowAlpha: 1,
83
+ blurRadius: 5,
84
+ expand: 0,
85
+ color: helpers_lib_1.ColorHelper.white,
86
+ blendMode: __1.BlendMode.add
87
+ };
88
+ if (partialOptions) {
89
+ options = { ...options, ...partialOptions };
90
+ }
91
+ return options;
92
+ }
81
93
  }
82
94
  exports.GlowSpriteGenerator = GlowSpriteGenerator;
83
95
  update_cycle_1.UpdateCycle.hardResetAction.subscribe(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"glow-sprite-generator.js","sourceRoot":"","sources":["../../../src/pixi/helpers/glow-sprite-generator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAgC;AAChC,6CAA4D;AAE5D,0BAAkD;AAClD,mEAA+D;AAC/D,yFAAqF;AAErF,MAAa,mBAAmB;aACf,qBAAgB,GAAG,IAAI,GAAG,EAAwB,CAAC;IAElE,MAAM,CAAC,gBAAgB,CAAC,UAAuB,EAAE,OAA6B;QAC5E,IAAI,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,CAAC,CAAC;QACzC,IAAI,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,aAAS,CAAC,GAAG,CAAC;QACnD,IAAI,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,yBAAW,CAAC,KAAK,CAAC;QAE/C,IAAI,eAAe,GAAG,IAAI,CAAC,cA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AC,eAAe,CAAC,SAAS,CAAC,GAAG,EAAE;IACzC,mBAAmB,CAAC,kBAAkB,CAAC,CAAC,KAAK,EAAE,CAAC;AAClD,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bard-legends-framework",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "Bard Legends Framework",
5
5
  "main": "dist/index.js",
6
6
  "publishConfig": {
package/package.json.bak CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bard-legends-framework",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "Bard Legends Framework",
5
5
  "main": "src/index.ts",
6
6
  "publishConfig": {