@kedataindo/docflow-element 0.0.80 → 0.0.82

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.
@@ -38,10 +38,11 @@ export declare class DocsEditorElement extends HTMLElement {
38
38
  /**
39
39
  * Unmount the inner Vue editor and release its collaboration setup.
40
40
  *
41
- * Ownership: a setup handed to a mounted editor is destroyed exactly once
42
- * by the editor itself (`createEditor().destroy()` → `setup.destroy()`).
43
- * Only setups that were resolved but never reached an editor (element
44
- * disconnected / room changed mid-resolution) are destroyed here.
41
+ * Ownership: the element owns every setup it builds. The editor no longer
42
+ * destroys host-provided setups (`createEditor().destroy()` only tears down
43
+ * the TipTap view — see `EditorOptions.collaboration`), so releasing the
44
+ * room is the element's job. The Vue element is removed first so the editor
45
+ * view is detached before the shared Y.Doc/provider/awareness go away.
45
46
  */
46
47
  private _teardownEditor;
47
48
  private _buildProps;
@@ -1 +1 @@
1
- {"version":3,"file":"DocsEditorElement.d.ts","sourceRoot":"","sources":["../src/DocsEditorElement.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACxB,MAAM,gCAAgC,CAAA;AAQvC,qBAAa,iBAAkB,SAAQ,WAAW;IAChD,MAAM,CAAC,kBAAkB,WAAqE;IAE9F,OAAO,CAAC,WAAW,CAAC,CAAa;IACjC,OAAO,CAAC,WAAW,CAAC,CAAY;IAChC,OAAO,CAAC,QAAQ,CAAyB;IACzC,OAAO,CAAC,cAAc,CAAC,CAAoB;IAC3C;;;;;;OAMG;IACH,OAAO,CAAC,YAAY,CAAC,CAAoB;IACzC,yEAAyE;IACzE,OAAO,CAAC,cAAc,CAAI;IAC1B,OAAO,CAAC,UAAU,CAAQ;IAE1B,IAAI,OAAO,IAAI,gBAAgB,EAAE,CAEhC;IAED,IAAI,OAAO,CAAC,KAAK,EAAE,gBAAgB,EAAE,EAKpC;IAED;;;OAGG;IACH,IAAI,aAAa,IAAI,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;;OAMG;YACW,MAAM;IAkCpB;;;;;;;;OAQG;IACH,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,WAAW;CA2BpB"}
package/dist/index.cjs CHANGED
@@ -136,20 +136,18 @@ var DocsEditorElement = class extends HTMLElement {
136
136
  /**
137
137
  * Unmount the inner Vue editor and release its collaboration setup.
138
138
  *
139
- * Ownership: a setup handed to a mounted editor is destroyed exactly once
140
- * by the editor itself (`createEditor().destroy()` → `setup.destroy()`).
141
- * Only setups that were resolved but never reached an editor (element
142
- * disconnected / room changed mid-resolution) are destroyed here.
139
+ * Ownership: the element owns every setup it builds. The editor no longer
140
+ * destroys host-provided setups (`createEditor().destroy()` only tears down
141
+ * the TipTap view — see `EditorOptions.collaboration`), so releasing the
142
+ * room is the element's job. The Vue element is removed first so the editor
143
+ * view is detached before the shared Y.Doc/provider/awareness go away.
143
144
  */
144
145
  _teardownEditor() {
145
- const setupHandedToEditor = this._vueElement !== void 0;
146
146
  this._vueElement?.remove();
147
147
  this._vueElement = void 0;
148
148
  const setup = this._collabSetup;
149
149
  this._collabSetup = void 0;
150
- if (setup && !setupHandedToEditor) {
151
- setup.destroy();
152
- }
150
+ setup?.destroy();
153
151
  }
154
152
  _buildProps() {
155
153
  const editableAttr = this.getAttribute("editable");
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  var s = Object.defineProperty;
2
- var l = (a, r, t) => r in a ? s(a, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[r] = t;
3
- var n = (a, r, t) => l(a, typeof r != "symbol" ? r + "" : r, t);
2
+ var l = (e, r, t) => r in e ? s(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
3
+ var i = (e, r, t) => l(e, typeof r != "symbol" ? r + "" : r, t);
4
4
  import { DocsEditor as b } from "@kedataindo/docflow-vue";
5
5
  import { defineCustomElement as m } from "vue";
6
6
  import { createCollaboration as g } from "@kedataindo/docflow-core";
@@ -8,10 +8,10 @@ const w = '@import"https://fonts.googleapis.com/css2?family=Inter:wght@300;400;5
8
8
  class c extends HTMLElement {
9
9
  constructor() {
10
10
  super(...arguments);
11
- n(this, "_vueElement");
12
- n(this, "_shadowRoot");
13
- n(this, "_plugins", []);
14
- n(this, "_onImageUpload");
11
+ i(this, "_vueElement");
12
+ i(this, "_shadowRoot");
13
+ i(this, "_plugins", []);
14
+ i(this, "_onImageUpload");
15
15
  /**
16
16
  * Prebuilt collaboration setup (issue fe-aktifai#230). Providers are built
17
17
  * asynchronously via `createCollaboration()` — which lazy-imports
@@ -19,10 +19,10 @@ class c extends HTMLElement {
19
19
  * then mounts the inner editor with it (a mounted editor cannot be rewired
20
20
  * to another room; swapping rooms means a full remount).
21
21
  */
22
- n(this, "_collabSetup");
22
+ i(this, "_collabSetup");
23
23
  /** Monotonic token invalidating in-flight async collaboration builds. */
24
- n(this, "_collabRequest", 0);
25
- n(this, "_connected", !1);
24
+ i(this, "_collabRequest", 0);
25
+ i(this, "_connected", !1);
26
26
  }
27
27
  get plugins() {
28
28
  return this._plugins;
@@ -53,8 +53,8 @@ class c extends HTMLElement {
53
53
  disconnectedCallback() {
54
54
  this._connected = !1, this._collabRequest += 1, this._teardownEditor();
55
55
  }
56
- attributeChangedCallback(t, o, e) {
57
- if (!(o === e || !this._connected)) {
56
+ attributeChangedCallback(t, o, n) {
57
+ if (!(o === n || !this._connected)) {
58
58
  if (t === "room" || t === "websocket-url") {
59
59
  this._mount();
60
60
  return;
@@ -72,51 +72,51 @@ class c extends HTMLElement {
72
72
  async _mount() {
73
73
  const t = ++this._collabRequest;
74
74
  this._teardownEditor();
75
- const o = this.getAttribute("room"), e = this._buildProps();
75
+ const o = this.getAttribute("room"), n = this._buildProps();
76
76
  if (o) {
77
77
  const d = this.getAttribute("websocket-url");
78
78
  try {
79
- const i = await g(
79
+ const a = await g(
80
80
  d ? { room: o, provider: "websocket", websocketUrl: d, user: { name: "Anonymous", color: "#3b82f6" } } : { room: o, user: { name: "Anonymous", color: "#3b82f6" } }
81
81
  );
82
82
  if (t !== this._collabRequest || !this._connected) {
83
- i.destroy();
83
+ a.destroy();
84
84
  return;
85
85
  }
86
- this._collabSetup = i, e.collaboration = i;
87
- } catch (i) {
88
- console.warn("[DocsEditorElement] collaboration setup failed, falling back to local editor", i);
86
+ this._collabSetup = a, n.collaboration = a;
87
+ } catch (a) {
88
+ console.warn("[DocsEditorElement] collaboration setup failed, falling back to local editor", a);
89
89
  }
90
90
  }
91
- !this._connected || !this._shadowRoot || (this._vueElement = new h(e), this._shadowRoot.appendChild(this._vueElement));
91
+ !this._connected || !this._shadowRoot || (this._vueElement = new h(n), this._shadowRoot.appendChild(this._vueElement));
92
92
  }
93
93
  /**
94
94
  * Unmount the inner Vue editor and release its collaboration setup.
95
95
  *
96
- * Ownership: a setup handed to a mounted editor is destroyed exactly once
97
- * by the editor itself (`createEditor().destroy()` → `setup.destroy()`).
98
- * Only setups that were resolved but never reached an editor (element
99
- * disconnected / room changed mid-resolution) are destroyed here.
96
+ * Ownership: the element owns every setup it builds. The editor no longer
97
+ * destroys host-provided setups (`createEditor().destroy()` only tears down
98
+ * the TipTap view — see `EditorOptions.collaboration`), so releasing the
99
+ * room is the element's job. The Vue element is removed first so the editor
100
+ * view is detached before the shared Y.Doc/provider/awareness go away.
100
101
  */
101
102
  _teardownEditor() {
102
- var e;
103
- const t = this._vueElement !== void 0;
104
- (e = this._vueElement) == null || e.remove(), this._vueElement = void 0;
105
- const o = this._collabSetup;
106
- this._collabSetup = void 0, o && !t && o.destroy();
103
+ var o;
104
+ (o = this._vueElement) == null || o.remove(), this._vueElement = void 0;
105
+ const t = this._collabSetup;
106
+ this._collabSetup = void 0, t == null || t.destroy();
107
107
  }
108
108
  _buildProps() {
109
- const t = this.getAttribute("editable"), o = t === null ? !0 : t !== "false", e = this.getAttribute("debug"), d = e === null ? !1 : e !== "false";
110
- let i;
109
+ const t = this.getAttribute("editable"), o = t === null ? !0 : t !== "false", n = this.getAttribute("debug"), d = n === null ? !1 : n !== "false";
110
+ let a;
111
111
  const p = this.getAttribute("content");
112
112
  if (p !== null)
113
113
  try {
114
- i = JSON.parse(p);
114
+ a = JSON.parse(p);
115
115
  } catch {
116
- i = p;
116
+ a = p;
117
117
  }
118
118
  return {
119
- modelValue: i,
119
+ modelValue: a,
120
120
  editable: o,
121
121
  debug: d,
122
122
  plugins: this._plugins,
@@ -124,9 +124,9 @@ class c extends HTMLElement {
124
124
  };
125
125
  }
126
126
  }
127
- n(c, "observedAttributes", ["room", "theme", "editable", "content", "websocket-url", "debug"]);
128
- function k(a = "docs-editor", r = typeof customElements < "u" ? customElements : void 0) {
129
- r && !r.get(a) && r.define(a, c);
127
+ i(c, "observedAttributes", ["room", "theme", "editable", "content", "websocket-url", "debug"]);
128
+ function k(e = "docs-editor", r = typeof customElements < "u" ? customElements : void 0) {
129
+ r && !r.get(e) && r.define(e, c);
130
130
  }
131
131
  export {
132
132
  c as DocsEditorElement,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kedataindo/docflow-element",
3
3
  "license": "UNLICENSED",
4
- "version": "0.0.80",
4
+ "version": "0.0.82",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",
@@ -21,8 +21,8 @@
21
21
  "dist"
22
22
  ],
23
23
  "dependencies": {
24
- "@kedataindo/docflow-core": "0.0.80",
25
- "@kedataindo/docflow-vue": "0.0.83"
24
+ "@kedataindo/docflow-core": "0.0.82",
25
+ "@kedataindo/docflow-vue": "0.0.85"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "vue": "^3.5.0"