@kaitify/core 0.0.2-beta.19 → 0.0.2-beta.20

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.
@@ -6025,51 +6025,51 @@ interact_min.exports;
6025
6025
  var interact_minExports = interact_min.exports;
6026
6026
  const interact = /* @__PURE__ */ getDefaultExportFromCjs(interact_minExports);
6027
6027
  const IMAGE_NODE_TAG = "kaitify-image";
6028
- class ImageElement extends HTMLElement {
6029
- constructor() {
6030
- super();
6031
- }
6032
- /**
6033
- * dom挂载,首次渲染
6034
- */
6035
- connectedCallback() {
6036
- this.innerHTML = `<span is-indicator></span><img />`;
6037
- const image = this.querySelector("img");
6038
- const src = this.getAttribute("data-src");
6039
- const alt = this.getAttribute("data-alt");
6040
- if (src) {
6041
- image.setAttribute("src", src);
6042
- }
6043
- if (alt) {
6044
- image.setAttribute("alt", alt);
6028
+ if (typeof HTMLElement !== "undefined" && !customElements.get(IMAGE_NODE_TAG)) {
6029
+ class ImageElement extends HTMLElement {
6030
+ constructor() {
6031
+ super();
6045
6032
  }
6046
- }
6047
- /**
6048
- * 属性更新时更新内容
6049
- */
6050
- attributeChangedCallback(name, _, newValue) {
6051
- const image = this.querySelector("img");
6052
- if (!image) return;
6053
- if (name === "data-src") {
6054
- if (newValue) {
6055
- image.setAttribute("src", newValue);
6056
- } else {
6057
- image.removeAttribute("src");
6033
+ /**
6034
+ * dom挂载,首次渲染
6035
+ */
6036
+ connectedCallback() {
6037
+ this.innerHTML = `<span is-indicator></span><img />`;
6038
+ const image = this.querySelector("img");
6039
+ const src = this.getAttribute("data-src");
6040
+ const alt = this.getAttribute("data-alt");
6041
+ if (src) {
6042
+ image.setAttribute("src", src);
6043
+ }
6044
+ if (alt) {
6045
+ image.setAttribute("alt", alt);
6058
6046
  }
6059
6047
  }
6060
- if (name === "data-alt") {
6061
- if (newValue) {
6062
- image.setAttribute("alt", newValue);
6063
- } else {
6064
- image.removeAttribute("alt");
6048
+ /**
6049
+ * 属性更新时更新内容
6050
+ */
6051
+ attributeChangedCallback(name, _, newValue) {
6052
+ const image = this.querySelector("img");
6053
+ if (!image) return;
6054
+ if (name === "data-src") {
6055
+ if (newValue) {
6056
+ image.setAttribute("src", newValue);
6057
+ } else {
6058
+ image.removeAttribute("src");
6059
+ }
6060
+ }
6061
+ if (name === "data-alt") {
6062
+ if (newValue) {
6063
+ image.setAttribute("alt", newValue);
6064
+ } else {
6065
+ image.removeAttribute("alt");
6066
+ }
6065
6067
  }
6066
6068
  }
6069
+ static get observedAttributes() {
6070
+ return ["data-src", "data-alt"];
6071
+ }
6067
6072
  }
6068
- static get observedAttributes() {
6069
- return ["data-src", "data-alt"];
6070
- }
6071
- }
6072
- if (!customElements.get(IMAGE_NODE_TAG)) {
6073
6073
  customElements.define(IMAGE_NODE_TAG, ImageElement);
6074
6074
  }
6075
6075
  const handleResizable$1 = (editor) => {
@@ -6282,84 +6282,84 @@ const ImageExtension = () => Extension.create({
6282
6282
  }
6283
6283
  });
6284
6284
  const VIDEO_NODE_TAG = "kaitify-video";
6285
- class VideoElement extends HTMLElement {
6286
- constructor() {
6287
- super();
6288
- }
6289
- /**
6290
- * dom挂载,首次渲染
6291
- */
6292
- connectedCallback() {
6293
- this.innerHTML = `<span is-indicator></span><video />`;
6294
- const video = this.querySelector("video");
6295
- const src = this.getAttribute("data-src");
6296
- const autoplay = this.getAttribute("data-autoplay");
6297
- const controls = this.getAttribute("data-controls");
6298
- const muted = this.getAttribute("data-muted");
6299
- const loop = this.getAttribute("data-loop");
6300
- if (src) {
6301
- video.setAttribute("src", src);
6302
- }
6303
- if (autoplay) {
6304
- video.setAttribute("autoplay", autoplay);
6305
- }
6306
- if (controls) {
6307
- video.setAttribute("controls", controls);
6308
- }
6309
- if (muted) {
6310
- video.setAttribute("muted", muted);
6311
- }
6312
- if (loop) {
6313
- video.setAttribute("loop", loop);
6285
+ if (typeof HTMLElement !== "undefined" && !customElements.get(VIDEO_NODE_TAG)) {
6286
+ class VideoElement extends HTMLElement {
6287
+ constructor() {
6288
+ super();
6314
6289
  }
6315
- }
6316
- /**
6317
- * 属性更新时更新内容
6318
- */
6319
- attributeChangedCallback(name, _, newValue) {
6320
- const video = this.querySelector("video");
6321
- if (!video) return;
6322
- if (name === "data-src") {
6323
- if (newValue) {
6324
- video.setAttribute("src", newValue);
6325
- } else {
6326
- video.removeAttribute("src");
6290
+ /**
6291
+ * dom挂载,首次渲染
6292
+ */
6293
+ connectedCallback() {
6294
+ this.innerHTML = `<span is-indicator></span><video />`;
6295
+ const video = this.querySelector("video");
6296
+ const src = this.getAttribute("data-src");
6297
+ const autoplay = this.getAttribute("data-autoplay");
6298
+ const controls = this.getAttribute("data-controls");
6299
+ const muted = this.getAttribute("data-muted");
6300
+ const loop = this.getAttribute("data-loop");
6301
+ if (src) {
6302
+ video.setAttribute("src", src);
6327
6303
  }
6328
- }
6329
- if (name === "data-autoplay") {
6330
- if (newValue) {
6331
- video.setAttribute("autoplay", newValue);
6332
- } else {
6333
- video.removeAttribute("autoplay");
6304
+ if (autoplay) {
6305
+ video.setAttribute("autoplay", autoplay);
6334
6306
  }
6335
- }
6336
- if (name === "data-controls") {
6337
- if (newValue) {
6338
- video.setAttribute("controls", newValue);
6339
- } else {
6340
- video.removeAttribute("controls");
6307
+ if (controls) {
6308
+ video.setAttribute("controls", controls);
6341
6309
  }
6342
- }
6343
- if (name === "data-muted") {
6344
- if (newValue) {
6345
- video.setAttribute("muted", newValue);
6346
- } else {
6347
- video.removeAttribute("muted");
6310
+ if (muted) {
6311
+ video.setAttribute("muted", muted);
6312
+ }
6313
+ if (loop) {
6314
+ video.setAttribute("loop", loop);
6348
6315
  }
6349
6316
  }
6350
- if (name === "data-loop") {
6351
- if (newValue) {
6352
- video.setAttribute("loop", newValue);
6353
- } else {
6354
- video.removeAttribute("loop");
6317
+ /**
6318
+ * 属性更新时更新内容
6319
+ */
6320
+ attributeChangedCallback(name, _, newValue) {
6321
+ const video = this.querySelector("video");
6322
+ if (!video) return;
6323
+ if (name === "data-src") {
6324
+ if (newValue) {
6325
+ video.setAttribute("src", newValue);
6326
+ } else {
6327
+ video.removeAttribute("src");
6328
+ }
6329
+ }
6330
+ if (name === "data-autoplay") {
6331
+ if (newValue) {
6332
+ video.setAttribute("autoplay", newValue);
6333
+ } else {
6334
+ video.removeAttribute("autoplay");
6335
+ }
6336
+ }
6337
+ if (name === "data-controls") {
6338
+ if (newValue) {
6339
+ video.setAttribute("controls", newValue);
6340
+ } else {
6341
+ video.removeAttribute("controls");
6342
+ }
6343
+ }
6344
+ if (name === "data-muted") {
6345
+ if (newValue) {
6346
+ video.setAttribute("muted", newValue);
6347
+ } else {
6348
+ video.removeAttribute("muted");
6349
+ }
6350
+ }
6351
+ if (name === "data-loop") {
6352
+ if (newValue) {
6353
+ video.setAttribute("loop", newValue);
6354
+ } else {
6355
+ video.removeAttribute("loop");
6356
+ }
6355
6357
  }
6356
6358
  }
6359
+ static get observedAttributes() {
6360
+ return ["data-src", "data-autoplay", "data-controls", "data-muted", "data-loop"];
6361
+ }
6357
6362
  }
6358
- static get observedAttributes() {
6359
- return ["data-src", "data-autoplay", "data-controls", "data-muted", "data-loop"];
6360
- }
6361
- }
6362
- if (!customElements.get(VIDEO_NODE_TAG)) {
6363
6363
  customElements.define(VIDEO_NODE_TAG, VideoElement);
6364
6364
  }
6365
6365
  const handleResizable = (editor) => {
@@ -7673,18 +7673,18 @@ const IndentExtension = () => Extension.create({
7673
7673
  }
7674
7674
  });
7675
7675
  const HORIZONTAL_NODE_TAG = "kaitify-horizontal";
7676
- class HorizontalElement extends HTMLElement {
7677
- constructor() {
7678
- super();
7679
- }
7680
- /**
7681
- * dom挂载,首次渲染
7682
- */
7683
- connectedCallback() {
7684
- this.innerHTML = `<span><hr /></span>`;
7676
+ if (typeof HTMLElement !== "undefined" && !customElements.get(HORIZONTAL_NODE_TAG)) {
7677
+ class HorizontalElement extends HTMLElement {
7678
+ constructor() {
7679
+ super();
7680
+ }
7681
+ /**
7682
+ * dom挂载,首次渲染
7683
+ */
7684
+ connectedCallback() {
7685
+ this.innerHTML = `<span><hr /></span>`;
7686
+ }
7685
7687
  }
7686
- }
7687
- if (customElements.get(HORIZONTAL_NODE_TAG)) {
7688
7688
  customElements.define(HORIZONTAL_NODE_TAG, HorizontalElement);
7689
7689
  }
7690
7690
  const handleClick$2 = (editor) => {
@@ -8380,18 +8380,18 @@ const ListExtension = () => Extension.create({
8380
8380
  }
8381
8381
  });
8382
8382
  const TASK_CHECKBOX_NODE_TAG = "kaitify-task-checkbox";
8383
- class TaskCheckboxElement extends HTMLElement {
8384
- constructor() {
8385
- super();
8386
- }
8387
- /**
8388
- * dom挂载,首次渲染
8389
- */
8390
- connectedCallback() {
8391
- this.innerHTML = `<span></span>`;
8383
+ if (typeof HTMLElement !== "undefined" && !customElements.get(TASK_CHECKBOX_NODE_TAG)) {
8384
+ class TaskCheckboxElement extends HTMLElement {
8385
+ constructor() {
8386
+ super();
8387
+ }
8388
+ /**
8389
+ * dom挂载,首次渲染
8390
+ */
8391
+ connectedCallback() {
8392
+ this.innerHTML = `<span></span>`;
8393
+ }
8392
8394
  }
8393
- }
8394
- if (!customElements.get(TASK_CHECKBOX_NODE_TAG)) {
8395
8395
  customElements.define(TASK_CHECKBOX_NODE_TAG, TaskCheckboxElement);
8396
8396
  }
8397
8397
  const createTaskNode = () => {
@@ -23181,35 +23181,35 @@ var katex = {
23181
23181
  }
23182
23182
  };
23183
23183
  const MATH_NODE_TAG = "kaitify-math";
23184
- class MathElement extends HTMLElement {
23185
- constructor() {
23186
- super();
23187
- }
23188
- /**
23189
- * dom挂载,首次渲染
23190
- */
23191
- connectedCallback() {
23192
- this.innerHTML = `<span>${katex.renderToString(this.getAttribute("data-value") ?? "", {
23193
- output: "html",
23194
- throwOnError: false
23195
- })}</span>`;
23196
- }
23197
- /**
23198
- * 属性更新时更新内容
23199
- */
23200
- attributeChangedCallback(name, _, newValue) {
23201
- if (name === "data-value") {
23202
- this.innerHTML = `<span>${katex.renderToString(newValue, {
23184
+ if (typeof HTMLElement !== "undefined" && !customElements.get(MATH_NODE_TAG)) {
23185
+ class MathElement extends HTMLElement {
23186
+ constructor() {
23187
+ super();
23188
+ }
23189
+ /**
23190
+ * dom挂载,首次渲染
23191
+ */
23192
+ connectedCallback() {
23193
+ this.innerHTML = `<span>${katex.renderToString(this.getAttribute("data-value") ?? "", {
23203
23194
  output: "html",
23204
23195
  throwOnError: false
23205
23196
  })}</span>`;
23206
23197
  }
23198
+ /**
23199
+ * 属性更新时更新内容
23200
+ */
23201
+ attributeChangedCallback(name, _, newValue) {
23202
+ if (name === "data-value") {
23203
+ this.innerHTML = `<span>${katex.renderToString(newValue, {
23204
+ output: "html",
23205
+ throwOnError: false
23206
+ })}</span>`;
23207
+ }
23208
+ }
23209
+ static get observedAttributes() {
23210
+ return ["data-value"];
23211
+ }
23207
23212
  }
23208
- static get observedAttributes() {
23209
- return ["data-value"];
23210
- }
23211
- }
23212
- if (!customElements.get(MATH_NODE_TAG)) {
23213
23213
  customElements.define(MATH_NODE_TAG, MathElement);
23214
23214
  }
23215
23215
  const handleClick$1 = (editor) => {
@@ -35922,35 +35922,35 @@ const CodeBlockExtension = (props) => Extension.create({
35922
35922
  }
35923
35923
  });
35924
35924
  const ATTACHMENT_NODE_TAG = "kaitify-attachment";
35925
- class AttachmentElement extends HTMLElement {
35926
- constructor() {
35927
- super();
35928
- }
35929
- /**
35930
- * dom挂载,首次渲染
35931
- */
35932
- connectedCallback() {
35933
- this.innerHTML = `<span><span is-icon></span><span is-text></span></span>`;
35934
- this.querySelector("span[is-icon]").setAttribute("style", `background-image:url(${this.getAttribute("data-icon")})`);
35935
- this.querySelector("span[is-text]").textContent = this.getAttribute("data-text");
35936
- }
35937
- /**
35938
- * 属性更新时更新内容
35939
- */
35940
- attributeChangedCallback(name, _, newValue) {
35941
- if (name == "data-icon") {
35942
- const icon = this.querySelector("span[is-icon]");
35943
- if (icon) icon.style.backgroundImage = `url(${newValue})`;
35944
- } else if (name == "data-text") {
35945
- const text2 = this.querySelector("span[is-text]");
35946
- if (text2) text2.textContent = newValue;
35925
+ if (typeof HTMLElement !== "undefined" && !customElements.get(ATTACHMENT_NODE_TAG)) {
35926
+ class AttachmentElement extends HTMLElement {
35927
+ constructor() {
35928
+ super();
35929
+ }
35930
+ /**
35931
+ * dom挂载,首次渲染
35932
+ */
35933
+ connectedCallback() {
35934
+ this.innerHTML = `<span><span is-icon></span><span is-text></span></span>`;
35935
+ this.querySelector("span[is-icon]").setAttribute("style", `background-image:url(${this.getAttribute("data-icon")})`);
35936
+ this.querySelector("span[is-text]").textContent = this.getAttribute("data-text");
35937
+ }
35938
+ /**
35939
+ * 属性更新时更新内容
35940
+ */
35941
+ attributeChangedCallback(name, _, newValue) {
35942
+ if (name == "data-icon") {
35943
+ const icon = this.querySelector("span[is-icon]");
35944
+ if (icon) icon.style.backgroundImage = `url(${newValue})`;
35945
+ } else if (name == "data-text") {
35946
+ const text2 = this.querySelector("span[is-text]");
35947
+ if (text2) text2.textContent = newValue;
35948
+ }
35949
+ }
35950
+ static get observedAttributes() {
35951
+ return ["data-text", "data-icon"];
35947
35952
  }
35948
35953
  }
35949
- static get observedAttributes() {
35950
- return ["data-text", "data-icon"];
35951
- }
35952
- }
35953
- if (!customElements.get(ATTACHMENT_NODE_TAG)) {
35954
35954
  customElements.define(ATTACHMENT_NODE_TAG, AttachmentElement);
35955
35955
  }
35956
35956
  const defaultIcon = '<svg t="1728556328694" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1473" width="200" height="200"><path d="M960 448c0 88-72 160-160 160H352c-52.8 0-96-43.2-96-96s43.2-96 96-96h416v64H352c-17.6 0-32 14.4-32 32s14.4 32 32 32h448c52.8 0 96-43.2 96-96s-43.2-96-96-96H288c-88 0-160 72-160 160s72 160 160 160h352v64H288C164 736 64 636 64 512s100-224 224-224h512c88 0 160 72 160 160z" p-id="1474" fill="#06c27c"></path></svg>';