@knotx/plugins-background 0.0.5 → 0.0.7

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.
package/dist/index.cjs CHANGED
@@ -72,31 +72,35 @@ var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError('Cannot use
72
72
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
73
73
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
74
74
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
75
- var _render_dec, _transform_dec, _container_dec, _a, _init;
75
+ var _render_dec, _init_dec, _transform_dec, _container_dec, _a, _init;
76
76
  var BackgroundVariant = /* @__PURE__ */ ((BackgroundVariant2) => {
77
77
  BackgroundVariant2["Lines"] = "lines";
78
78
  BackgroundVariant2["Dots"] = "dots";
79
79
  BackgroundVariant2["Cross"] = "cross";
80
80
  return BackgroundVariant2;
81
81
  })(BackgroundVariant || {});
82
- class Background extends (_a = core.BasePlugin, _container_dec = [decorators.inject.container()], _transform_dec = [decorators.inject.canvas.transform()], _render_dec = [decorators.layer(core.Layer.Background)], _a) {
83
- constructor(props = {}) {
84
- super();
85
- this.props = props;
82
+ class Background extends (_a = core.BasePlugin, _container_dec = [decorators.inject.container()], _transform_dec = [decorators.inject.canvas.transform()], _init_dec = [decorators.OnInit], _render_dec = [decorators.layer(core.Layer.Background)], _a) {
83
+ constructor() {
84
+ super(...arguments);
86
85
  __runInitializers(_init, 5, this);
87
86
  __publicField(this, "name", "background");
87
+ __publicField(this, "config");
88
88
  __publicField(this, "container", __runInitializers(_init, 8, this)), __runInitializers(_init, 11, this);
89
89
  __publicField(this, "transform", __runInitializers(_init, 12, this)), __runInitializers(_init, 15, this);
90
90
  }
91
+ init(config) {
92
+ this.config = config;
93
+ }
91
94
  render() {
92
95
  const { container, transform } = core.use(() => ({
93
96
  container: this.container,
94
97
  transform: this.transform
95
98
  }));
96
- return /* @__PURE__ */ jsxRuntime.jsx(BackgroundComponent, __spreadProps(__spreadValues({}, this.props), { id: this.pluginId, container, transform }));
99
+ return /* @__PURE__ */ jsxRuntime.jsx(BackgroundComponent, __spreadProps(__spreadValues({}, this.config), { id: this.pluginId, container, transform }));
97
100
  }
98
101
  }
99
102
  _init = __decoratorStart(_a);
103
+ __decorateElement(_init, 1, "init", _init_dec, Background);
100
104
  __decorateElement(_init, 1, "render", _render_dec, Background);
101
105
  __decorateElement(_init, 5, "container", _container_dec, Background);
102
106
  __decorateElement(_init, 5, "transform", _transform_dec, Background);
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { BasePlugin, Container } from '@knotx/core';
1
+ import { Container, BasePlugin } from '@knotx/core';
2
2
  import { CanvasTransformState } from '@knotx/plugins-canvas';
3
3
 
4
4
  /**
@@ -11,12 +11,13 @@ declare enum BackgroundVariant {
11
11
  Dots = "dots",
12
12
  Cross = "cross"
13
13
  }
14
- declare class Background extends BasePlugin<'background'> {
15
- private props;
14
+ type BackgroundConfig = Omit<BackgroundProps, 'id'>;
15
+ declare class Background extends BasePlugin<'background', BackgroundConfig> {
16
16
  name: "background";
17
- constructor(props?: Omit<BackgroundProps, 'id'>);
17
+ private config;
18
18
  container: Container;
19
19
  transform: CanvasTransformState;
20
+ init(config: BackgroundConfig): void;
20
21
  render(): JSX.Element;
21
22
  }
22
23
  interface BackgroundProps {
@@ -47,4 +48,4 @@ interface BackgroundProps {
47
48
  transform?: CanvasTransformState;
48
49
  }
49
50
 
50
- export { Background, type BackgroundProps, BackgroundVariant };
51
+ export { Background, type BackgroundConfig, type BackgroundProps, BackgroundVariant };
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { BasePlugin, Container } from '@knotx/core';
1
+ import { Container, BasePlugin } from '@knotx/core';
2
2
  import { CanvasTransformState } from '@knotx/plugins-canvas';
3
3
 
4
4
  /**
@@ -11,12 +11,13 @@ declare enum BackgroundVariant {
11
11
  Dots = "dots",
12
12
  Cross = "cross"
13
13
  }
14
- declare class Background extends BasePlugin<'background'> {
15
- private props;
14
+ type BackgroundConfig = Omit<BackgroundProps, 'id'>;
15
+ declare class Background extends BasePlugin<'background', BackgroundConfig> {
16
16
  name: "background";
17
- constructor(props?: Omit<BackgroundProps, 'id'>);
17
+ private config;
18
18
  container: Container;
19
19
  transform: CanvasTransformState;
20
+ init(config: BackgroundConfig): void;
20
21
  render(): JSX.Element;
21
22
  }
22
23
  interface BackgroundProps {
@@ -47,4 +48,4 @@ interface BackgroundProps {
47
48
  transform?: CanvasTransformState;
48
49
  }
49
50
 
50
- export { Background, type BackgroundProps, BackgroundVariant };
51
+ export { Background, type BackgroundConfig, type BackgroundProps, BackgroundVariant };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { BasePlugin, Container } from '@knotx/core';
1
+ import { Container, BasePlugin } from '@knotx/core';
2
2
  import { CanvasTransformState } from '@knotx/plugins-canvas';
3
3
 
4
4
  /**
@@ -11,12 +11,13 @@ declare enum BackgroundVariant {
11
11
  Dots = "dots",
12
12
  Cross = "cross"
13
13
  }
14
- declare class Background extends BasePlugin<'background'> {
15
- private props;
14
+ type BackgroundConfig = Omit<BackgroundProps, 'id'>;
15
+ declare class Background extends BasePlugin<'background', BackgroundConfig> {
16
16
  name: "background";
17
- constructor(props?: Omit<BackgroundProps, 'id'>);
17
+ private config;
18
18
  container: Container;
19
19
  transform: CanvasTransformState;
20
+ init(config: BackgroundConfig): void;
20
21
  render(): JSX.Element;
21
22
  }
22
23
  interface BackgroundProps {
@@ -47,4 +48,4 @@ interface BackgroundProps {
47
48
  transform?: CanvasTransformState;
48
49
  }
49
50
 
50
- export { Background, type BackgroundProps, BackgroundVariant };
51
+ export { Background, type BackgroundConfig, type BackgroundProps, BackgroundVariant };
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs } from '@knotx/jsx/jsx-runtime';
2
2
  import { Layer, use, BasePlugin } from '@knotx/core';
3
- import { inject, layer } from '@knotx/decorators';
3
+ import { inject, layer, OnInit } from '@knotx/decorators';
4
4
 
5
5
  var __create = Object.create;
6
6
  var __defProp = Object.defineProperty;
@@ -70,31 +70,35 @@ var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError('Cannot use
70
70
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
71
71
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
72
72
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
73
- var _render_dec, _transform_dec, _container_dec, _a, _init;
73
+ var _render_dec, _init_dec, _transform_dec, _container_dec, _a, _init;
74
74
  var BackgroundVariant = /* @__PURE__ */ ((BackgroundVariant2) => {
75
75
  BackgroundVariant2["Lines"] = "lines";
76
76
  BackgroundVariant2["Dots"] = "dots";
77
77
  BackgroundVariant2["Cross"] = "cross";
78
78
  return BackgroundVariant2;
79
79
  })(BackgroundVariant || {});
80
- class Background extends (_a = BasePlugin, _container_dec = [inject.container()], _transform_dec = [inject.canvas.transform()], _render_dec = [layer(Layer.Background)], _a) {
81
- constructor(props = {}) {
82
- super();
83
- this.props = props;
80
+ class Background extends (_a = BasePlugin, _container_dec = [inject.container()], _transform_dec = [inject.canvas.transform()], _init_dec = [OnInit], _render_dec = [layer(Layer.Background)], _a) {
81
+ constructor() {
82
+ super(...arguments);
84
83
  __runInitializers(_init, 5, this);
85
84
  __publicField(this, "name", "background");
85
+ __publicField(this, "config");
86
86
  __publicField(this, "container", __runInitializers(_init, 8, this)), __runInitializers(_init, 11, this);
87
87
  __publicField(this, "transform", __runInitializers(_init, 12, this)), __runInitializers(_init, 15, this);
88
88
  }
89
+ init(config) {
90
+ this.config = config;
91
+ }
89
92
  render() {
90
93
  const { container, transform } = use(() => ({
91
94
  container: this.container,
92
95
  transform: this.transform
93
96
  }));
94
- return /* @__PURE__ */ jsx(BackgroundComponent, __spreadProps(__spreadValues({}, this.props), { id: this.pluginId, container, transform }));
97
+ return /* @__PURE__ */ jsx(BackgroundComponent, __spreadProps(__spreadValues({}, this.config), { id: this.pluginId, container, transform }));
95
98
  }
96
99
  }
97
100
  _init = __decoratorStart(_a);
101
+ __decorateElement(_init, 1, "init", _init_dec, Background);
98
102
  __decorateElement(_init, 1, "render", _render_dec, Background);
99
103
  __decorateElement(_init, 5, "container", _container_dec, Background);
100
104
  __decorateElement(_init, 5, "transform", _transform_dec, Background);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@knotx/plugins-background",
3
3
  "type": "module",
4
- "version": "0.0.5",
4
+ "version": "0.0.7",
5
5
  "description": "Background Plugin for Knotx",
6
6
  "author": "boenfu",
7
7
  "license": "MIT",
@@ -29,18 +29,18 @@
29
29
  "dist"
30
30
  ],
31
31
  "peerDependencies": {
32
- "@knotx/core": "0.0.5",
33
- "@knotx/decorators": "0.0.5",
34
- "@knotx/jsx": "0.0.5",
35
- "@knotx/plugins-canvas": "0.0.5"
32
+ "@knotx/core": "0.0.7",
33
+ "@knotx/decorators": "0.0.7",
34
+ "@knotx/jsx": "0.0.7",
35
+ "@knotx/plugins-canvas": "0.0.7"
36
36
  },
37
37
  "devDependencies": {
38
- "@knotx/build-config": "0.0.5",
39
- "@knotx/core": "0.0.5",
40
- "@knotx/decorators": "0.0.5",
41
- "@knotx/eslint-config": "0.0.5",
42
- "@knotx/plugins-canvas": "0.0.5",
43
- "@knotx/typescript-config": "0.0.5"
38
+ "@knotx/build-config": "0.0.7",
39
+ "@knotx/core": "0.0.7",
40
+ "@knotx/decorators": "0.0.7",
41
+ "@knotx/eslint-config": "0.0.7",
42
+ "@knotx/plugins-canvas": "0.0.7",
43
+ "@knotx/typescript-config": "0.0.7"
44
44
  },
45
45
  "scripts": {
46
46
  "build": "unbuild --failOnWarn=false",