@knotx/core 0.4.2 → 0.4.4

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
@@ -16,12 +16,16 @@ class DOMElement {
16
16
  this.dom = dom;
17
17
  __publicField$4(this, "classList");
18
18
  __publicField$4(this, "attribute");
19
+ __publicField$4(this, "uniqSelector");
19
20
  this.classList = dom.classList;
20
21
  this.attribute = {
21
22
  get: (name) => dom.getAttribute(name),
22
23
  set: (name, value) => dom.setAttribute(name, value),
23
24
  remove: (name) => dom.removeAttribute(name)
24
25
  };
26
+ if (dom.id) {
27
+ this.uniqSelector = `#${dom.id}`;
28
+ }
25
29
  }
26
30
  getRect() {
27
31
  return this.dom.getBoundingClientRect();
@@ -479,7 +483,7 @@ const _BasePlugin = class _BasePlugin {
479
483
  Reflect.set(this, utils.getSymbol("engine"), new rxjs.BehaviorSubject(null));
480
484
  }
481
485
  get pluginId() {
482
- return `${this.name.toLowerCase()}-${this._instanceId}`;
486
+ return `knotx-plugin-${this.name.toLowerCase()}-${this._instanceId}`;
483
487
  }
484
488
  onDestroy() {
485
489
  this.subscriptions.forEach((subscription) => {
package/dist/index.d.cts CHANGED
@@ -55,6 +55,10 @@ interface EventListenerObject<E> {
55
55
  interface Element {
56
56
  classList: ElementClassList;
57
57
  attribute: ElementAttribute;
58
+ /**
59
+ * 唯一标识,如果存在,则在顶层进行 query 时,只会查出来一个元素(当前元素)
60
+ */
61
+ uniqSelector: string | undefined;
58
62
  getRect: () => ElementRect;
59
63
  addEventListener: EventListenerDefinition;
60
64
  removeEventListener: EventListenerDefinition;
@@ -65,6 +69,7 @@ declare class DOMElement implements Element {
65
69
  readonly dom: HTMLElement;
66
70
  classList: ElementClassList;
67
71
  attribute: ElementAttribute;
72
+ uniqSelector: string | undefined;
68
73
  constructor(dom: HTMLElement);
69
74
  getRect(): DOMRect;
70
75
  query(selector: string): Element | null;
package/dist/index.d.mts CHANGED
@@ -55,6 +55,10 @@ interface EventListenerObject<E> {
55
55
  interface Element {
56
56
  classList: ElementClassList;
57
57
  attribute: ElementAttribute;
58
+ /**
59
+ * 唯一标识,如果存在,则在顶层进行 query 时,只会查出来一个元素(当前元素)
60
+ */
61
+ uniqSelector: string | undefined;
58
62
  getRect: () => ElementRect;
59
63
  addEventListener: EventListenerDefinition;
60
64
  removeEventListener: EventListenerDefinition;
@@ -65,6 +69,7 @@ declare class DOMElement implements Element {
65
69
  readonly dom: HTMLElement;
66
70
  classList: ElementClassList;
67
71
  attribute: ElementAttribute;
72
+ uniqSelector: string | undefined;
68
73
  constructor(dom: HTMLElement);
69
74
  getRect(): DOMRect;
70
75
  query(selector: string): Element | null;
package/dist/index.d.ts CHANGED
@@ -55,6 +55,10 @@ interface EventListenerObject<E> {
55
55
  interface Element {
56
56
  classList: ElementClassList;
57
57
  attribute: ElementAttribute;
58
+ /**
59
+ * 唯一标识,如果存在,则在顶层进行 query 时,只会查出来一个元素(当前元素)
60
+ */
61
+ uniqSelector: string | undefined;
58
62
  getRect: () => ElementRect;
59
63
  addEventListener: EventListenerDefinition;
60
64
  removeEventListener: EventListenerDefinition;
@@ -65,6 +69,7 @@ declare class DOMElement implements Element {
65
69
  readonly dom: HTMLElement;
66
70
  classList: ElementClassList;
67
71
  attribute: ElementAttribute;
72
+ uniqSelector: string | undefined;
68
73
  constructor(dom: HTMLElement);
69
74
  getRect(): DOMRect;
70
75
  query(selector: string): Element | null;
package/dist/index.js CHANGED
@@ -16,12 +16,16 @@ class DOMElement {
16
16
  this.dom = dom;
17
17
  __publicField$4(this, "classList");
18
18
  __publicField$4(this, "attribute");
19
+ __publicField$4(this, "uniqSelector");
19
20
  this.classList = dom.classList;
20
21
  this.attribute = {
21
22
  get: (name) => dom.getAttribute(name),
22
23
  set: (name, value) => dom.setAttribute(name, value),
23
24
  remove: (name) => dom.removeAttribute(name)
24
25
  };
26
+ if (dom.id) {
27
+ this.uniqSelector = `#${dom.id}`;
28
+ }
25
29
  }
26
30
  getRect() {
27
31
  return this.dom.getBoundingClientRect();
@@ -479,7 +483,7 @@ const _BasePlugin = class _BasePlugin {
479
483
  Reflect.set(this, getSymbol("engine"), new BehaviorSubject(null));
480
484
  }
481
485
  get pluginId() {
482
- return `${this.name.toLowerCase()}-${this._instanceId}`;
486
+ return `knotx-plugin-${this.name.toLowerCase()}-${this._instanceId}`;
483
487
  }
484
488
  onDestroy() {
485
489
  this.subscriptions.forEach((subscription) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knotx/core",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "Core for Knotx",
5
5
  "author": "boenfu",
6
6
  "license": "MIT",
@@ -46,14 +46,14 @@
46
46
  "jsonschema": "^1.5.0",
47
47
  "lodash-es": "^4.17.21",
48
48
  "rxjs": "^7.8.1",
49
- "@knotx/data": "0.4.2",
50
- "@knotx/utils": "0.4.2"
49
+ "@knotx/data": "0.4.4",
50
+ "@knotx/utils": "0.4.4"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/lodash-es": "^4.17.12",
54
- "@knotx/build-config": "0.4.2",
55
- "@knotx/eslint-config": "0.4.2",
56
- "@knotx/typescript-config": "0.4.2"
54
+ "@knotx/build-config": "0.4.4",
55
+ "@knotx/eslint-config": "0.4.4",
56
+ "@knotx/typescript-config": "0.4.4"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "unbuild",