@knotx/plugins-selection 0.3.1 → 0.3.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.
package/dist/index.cjs CHANGED
@@ -73,8 +73,8 @@ var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError('Cannot use
73
73
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
74
74
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
75
75
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
76
- var _destroy_dec, _clearSelection_dec, _getSelected_dec, _init_dec, _canInteract_dec, _endInteraction_dec, _startInteraction_dec, _registerRules_dec, _selected_dec, _a, _init;
77
- class Selection extends (_a = core.BasePlugin, _selected_dec = [decorators.register("selected")], _registerRules_dec = [decorators.register("registerRules")], _startInteraction_dec = [decorators.inject.startInteraction()], _endInteraction_dec = [decorators.inject.endInteraction()], _canInteract_dec = [decorators.inject.canInteract()], _init_dec = [decorators.OnInit], _getSelected_dec = [decorators.tool("Get selected items", {})], _clearSelection_dec = [decorators.tool("Clear selection", {})], _destroy_dec = [decorators.OnDestroy], _a) {
76
+ var _destroy_dec, _clearSelection_dec, _getSelected_dec, _init_dec, _interaction_dec, _registerRules_dec, _selected_dec, _a, _init;
77
+ class Selection extends (_a = core.BasePlugin, _selected_dec = [decorators.register("selected")], _registerRules_dec = [decorators.register("registerRules")], _interaction_dec = [decorators.inject.interaction()], _init_dec = [decorators.OnInit], _getSelected_dec = [decorators.tool("Get selected items", {})], _clearSelection_dec = [decorators.tool("Clear selection", {})], _destroy_dec = [decorators.OnDestroy], _a) {
78
78
  constructor() {
79
79
  super(...arguments);
80
80
  __runInitializers(_init, 5, this);
@@ -99,18 +99,16 @@ class Selection extends (_a = core.BasePlugin, _selected_dec = [decorators.regis
99
99
  });
100
100
  };
101
101
  })), __runInitializers(_init, 15, this);
102
- __publicField(this, "startInteraction", __runInitializers(_init, 16, this)), __runInitializers(_init, 19, this);
103
- __publicField(this, "endInteraction", __runInitializers(_init, 20, this)), __runInitializers(_init, 23, this);
104
- __publicField(this, "canInteract", __runInitializers(_init, 24, this)), __runInitializers(_init, 27, this);
102
+ __publicField(this, "interaction", __runInitializers(_init, 16, this)), __runInitializers(_init, 19, this);
105
103
  __publicField(this, "onBeforeStart", (_) => {
106
104
  });
107
105
  __publicField(this, "onBeforeDrag", () => {
108
106
  this.isDragging = this.enableDrag;
109
- return this.enableDrag && this.canInteract(this.pluginId, "select", core.InteractionPriority.MarqueeSelection);
107
+ return this.enableDrag && this.interaction.canInteract(core.InteractionPriority.MarqueeSelection);
110
108
  });
111
109
  __publicField(this, "onStart", ({ event, store }) => {
112
110
  var _a2;
113
- this.startInteraction(this.pluginId, "select", core.InteractionPriority.MarqueeSelection);
111
+ this.interaction.start(this.pluginId, "select", core.InteractionPriority.MarqueeSelection);
114
112
  if (!(event == null ? void 0 : event.ctrlKey) && !(event == null ? void 0 : event.metaKey) && !(event == null ? void 0 : event.shiftKey)) {
115
113
  store.stored.forEach((element) => {
116
114
  const rule = this.getElementRule(element);
@@ -175,16 +173,16 @@ class Selection extends (_a = core.BasePlugin, _selected_dec = [decorators.regis
175
173
  });
176
174
  });
177
175
  __publicField(this, "onStop", ({ event }) => {
178
- this.endInteraction(this.pluginId, "select");
176
+ this.interaction.end(this.pluginId, "select");
179
177
  if (event) {
180
178
  if (this.isDragging) {
181
179
  this.isDragging = false;
182
180
  }
183
181
  }
184
182
  cancelAnimationFrame(this.updateFrameId);
185
- this.updateFrameId = requestAnimationFrame(this.updateSelection);
183
+ this.updateFrameId = requestAnimationFrame(this.updateSelected);
186
184
  });
187
- __publicField(this, "updateSelection", () => {
185
+ __publicField(this, "updateSelected", () => {
188
186
  var _a2;
189
187
  const selected = [];
190
188
  for (const element of ((_a2 = this.selection) == null ? void 0 : _a2.getSelection()) || []) {
@@ -253,9 +251,7 @@ __decorateElement(_init, 1, "clearSelection", _clearSelection_dec, Selection);
253
251
  __decorateElement(_init, 1, "destroy", _destroy_dec, Selection);
254
252
  __decorateElement(_init, 5, "selected", _selected_dec, Selection);
255
253
  __decorateElement(_init, 5, "registerRules", _registerRules_dec, Selection);
256
- __decorateElement(_init, 5, "startInteraction", _startInteraction_dec, Selection);
257
- __decorateElement(_init, 5, "endInteraction", _endInteraction_dec, Selection);
258
- __decorateElement(_init, 5, "canInteract", _canInteract_dec, Selection);
254
+ __decorateElement(_init, 5, "interaction", _interaction_dec, Selection);
259
255
  __decoratorMetadata(_init, Selection);
260
256
 
261
257
  exports.Selection = Selection;
package/dist/index.d.cts CHANGED
@@ -70,9 +70,7 @@ declare class Selection extends BasePlugin<'selection', SelectionConfig> {
70
70
  private updateFrameId;
71
71
  selected: SelectionSelectedItem[];
72
72
  registerRules: (rules: SelectionRule[]) => () => void;
73
- private startInteraction;
74
- private endInteraction;
75
- private canInteract;
73
+ private interaction;
76
74
  init(config?: SelectionConfig): void;
77
75
  private createSelection;
78
76
  private onBeforeStart;
@@ -81,7 +79,7 @@ declare class Selection extends BasePlugin<'selection', SelectionConfig> {
81
79
  private onMove;
82
80
  private onStop;
83
81
  private getElementRule;
84
- private updateSelection;
82
+ private updateSelected;
85
83
  getSelected(): SelectionSelectedItem[];
86
84
  clearSelection(): void;
87
85
  destroy(): void;
package/dist/index.d.mts CHANGED
@@ -70,9 +70,7 @@ declare class Selection extends BasePlugin<'selection', SelectionConfig> {
70
70
  private updateFrameId;
71
71
  selected: SelectionSelectedItem[];
72
72
  registerRules: (rules: SelectionRule[]) => () => void;
73
- private startInteraction;
74
- private endInteraction;
75
- private canInteract;
73
+ private interaction;
76
74
  init(config?: SelectionConfig): void;
77
75
  private createSelection;
78
76
  private onBeforeStart;
@@ -81,7 +79,7 @@ declare class Selection extends BasePlugin<'selection', SelectionConfig> {
81
79
  private onMove;
82
80
  private onStop;
83
81
  private getElementRule;
84
- private updateSelection;
82
+ private updateSelected;
85
83
  getSelected(): SelectionSelectedItem[];
86
84
  clearSelection(): void;
87
85
  destroy(): void;
package/dist/index.d.ts CHANGED
@@ -70,9 +70,7 @@ declare class Selection extends BasePlugin<'selection', SelectionConfig> {
70
70
  private updateFrameId;
71
71
  selected: SelectionSelectedItem[];
72
72
  registerRules: (rules: SelectionRule[]) => () => void;
73
- private startInteraction;
74
- private endInteraction;
75
- private canInteract;
73
+ private interaction;
76
74
  init(config?: SelectionConfig): void;
77
75
  private createSelection;
78
76
  private onBeforeStart;
@@ -81,7 +79,7 @@ declare class Selection extends BasePlugin<'selection', SelectionConfig> {
81
79
  private onMove;
82
80
  private onStop;
83
81
  private getElementRule;
84
- private updateSelection;
82
+ private updateSelected;
85
83
  getSelected(): SelectionSelectedItem[];
86
84
  clearSelection(): void;
87
85
  destroy(): void;
package/dist/index.js CHANGED
@@ -67,8 +67,8 @@ var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError('Cannot use
67
67
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
68
68
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
69
69
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
70
- var _destroy_dec, _clearSelection_dec, _getSelected_dec, _init_dec, _canInteract_dec, _endInteraction_dec, _startInteraction_dec, _registerRules_dec, _selected_dec, _a, _init;
71
- class Selection extends (_a = BasePlugin, _selected_dec = [register("selected")], _registerRules_dec = [register("registerRules")], _startInteraction_dec = [inject.startInteraction()], _endInteraction_dec = [inject.endInteraction()], _canInteract_dec = [inject.canInteract()], _init_dec = [OnInit], _getSelected_dec = [tool("Get selected items", {})], _clearSelection_dec = [tool("Clear selection", {})], _destroy_dec = [OnDestroy], _a) {
70
+ var _destroy_dec, _clearSelection_dec, _getSelected_dec, _init_dec, _interaction_dec, _registerRules_dec, _selected_dec, _a, _init;
71
+ class Selection extends (_a = BasePlugin, _selected_dec = [register("selected")], _registerRules_dec = [register("registerRules")], _interaction_dec = [inject.interaction()], _init_dec = [OnInit], _getSelected_dec = [tool("Get selected items", {})], _clearSelection_dec = [tool("Clear selection", {})], _destroy_dec = [OnDestroy], _a) {
72
72
  constructor() {
73
73
  super(...arguments);
74
74
  __runInitializers(_init, 5, this);
@@ -93,18 +93,16 @@ class Selection extends (_a = BasePlugin, _selected_dec = [register("selected")]
93
93
  });
94
94
  };
95
95
  })), __runInitializers(_init, 15, this);
96
- __publicField(this, "startInteraction", __runInitializers(_init, 16, this)), __runInitializers(_init, 19, this);
97
- __publicField(this, "endInteraction", __runInitializers(_init, 20, this)), __runInitializers(_init, 23, this);
98
- __publicField(this, "canInteract", __runInitializers(_init, 24, this)), __runInitializers(_init, 27, this);
96
+ __publicField(this, "interaction", __runInitializers(_init, 16, this)), __runInitializers(_init, 19, this);
99
97
  __publicField(this, "onBeforeStart", (_) => {
100
98
  });
101
99
  __publicField(this, "onBeforeDrag", () => {
102
100
  this.isDragging = this.enableDrag;
103
- return this.enableDrag && this.canInteract(this.pluginId, "select", InteractionPriority.MarqueeSelection);
101
+ return this.enableDrag && this.interaction.canInteract(InteractionPriority.MarqueeSelection);
104
102
  });
105
103
  __publicField(this, "onStart", ({ event, store }) => {
106
104
  var _a2;
107
- this.startInteraction(this.pluginId, "select", InteractionPriority.MarqueeSelection);
105
+ this.interaction.start(this.pluginId, "select", InteractionPriority.MarqueeSelection);
108
106
  if (!(event == null ? void 0 : event.ctrlKey) && !(event == null ? void 0 : event.metaKey) && !(event == null ? void 0 : event.shiftKey)) {
109
107
  store.stored.forEach((element) => {
110
108
  const rule = this.getElementRule(element);
@@ -169,16 +167,16 @@ class Selection extends (_a = BasePlugin, _selected_dec = [register("selected")]
169
167
  });
170
168
  });
171
169
  __publicField(this, "onStop", ({ event }) => {
172
- this.endInteraction(this.pluginId, "select");
170
+ this.interaction.end(this.pluginId, "select");
173
171
  if (event) {
174
172
  if (this.isDragging) {
175
173
  this.isDragging = false;
176
174
  }
177
175
  }
178
176
  cancelAnimationFrame(this.updateFrameId);
179
- this.updateFrameId = requestAnimationFrame(this.updateSelection);
177
+ this.updateFrameId = requestAnimationFrame(this.updateSelected);
180
178
  });
181
- __publicField(this, "updateSelection", () => {
179
+ __publicField(this, "updateSelected", () => {
182
180
  var _a2;
183
181
  const selected = [];
184
182
  for (const element of ((_a2 = this.selection) == null ? void 0 : _a2.getSelection()) || []) {
@@ -247,9 +245,7 @@ __decorateElement(_init, 1, "clearSelection", _clearSelection_dec, Selection);
247
245
  __decorateElement(_init, 1, "destroy", _destroy_dec, Selection);
248
246
  __decorateElement(_init, 5, "selected", _selected_dec, Selection);
249
247
  __decorateElement(_init, 5, "registerRules", _registerRules_dec, Selection);
250
- __decorateElement(_init, 5, "startInteraction", _startInteraction_dec, Selection);
251
- __decorateElement(_init, 5, "endInteraction", _endInteraction_dec, Selection);
252
- __decorateElement(_init, 5, "canInteract", _canInteract_dec, Selection);
248
+ __decorateElement(_init, 5, "interaction", _interaction_dec, Selection);
253
249
  __decoratorMetadata(_init, Selection);
254
250
 
255
251
  export { Selection };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knotx/plugins-selection",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Selection Plugin for Knotx",
5
5
  "author": "boenfu",
6
6
  "license": "MIT",
@@ -30,13 +30,13 @@
30
30
  "dependencies": {
31
31
  "@viselect/vanilla": "^3.9.0",
32
32
  "rxjs": "^7.8.1",
33
- "@knotx/core": "0.3.1",
34
- "@knotx/decorators": "0.3.1"
33
+ "@knotx/core": "0.3.2",
34
+ "@knotx/decorators": "0.3.2"
35
35
  },
36
36
  "devDependencies": {
37
- "@knotx/build-config": "0.3.1",
38
- "@knotx/eslint-config": "0.3.1",
39
- "@knotx/typescript-config": "0.3.1"
37
+ "@knotx/build-config": "0.3.2",
38
+ "@knotx/eslint-config": "0.3.2",
39
+ "@knotx/typescript-config": "0.3.2"
40
40
  },
41
41
  "scripts": {
42
42
  "build": "unbuild",