synthetic-markdown 0.0.6 → 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.js CHANGED
@@ -7634,10 +7634,11 @@ var Element = class extends HTMLElement {
7634
7634
  this.appliedClasses = [];
7635
7635
  this.customClass = "";
7636
7636
  this.hasAutofocus = false;
7637
+ this.hasEditable = true;
7637
7638
  this.shadowRootElement = this.attachShadow({ mode: "open" });
7638
7639
  }
7639
7640
  static get observedAttributes() {
7640
- return ["class", "autofocus"];
7641
+ return ["class", "autofocus", "editable"];
7641
7642
  }
7642
7643
  get value() {
7643
7644
  return this.ast.text;
@@ -7648,6 +7649,7 @@ var Element = class extends HTMLElement {
7648
7649
  this.ast.setText(value);
7649
7650
  this.renderDOM();
7650
7651
  this.setAutoFocus();
7652
+ this.setEditable();
7651
7653
  this.hasAcceptedExternalValue = true;
7652
7654
  }
7653
7655
  }
@@ -7668,15 +7670,20 @@ var Element = class extends HTMLElement {
7668
7670
  return;
7669
7671
  }
7670
7672
  if (name === "autofocus") {
7671
- this.hasAutofocus = this.hasAttribute("autofocus");
7673
+ this.hasAutofocus = newValue === "" || newValue === "true" || newValue === "1";
7672
7674
  this.setAutoFocus();
7673
7675
  return;
7674
7676
  }
7677
+ if (name === "editable") {
7678
+ this.hasEditable = newValue === "" || newValue === "true" || newValue === "1";
7679
+ this.setEditable();
7680
+ return;
7681
+ }
7675
7682
  }
7676
7683
  connectedCallback() {
7677
7684
  const attrValue = this.getAttribute("value") ?? "";
7678
- this.hasAutofocus = this.hasAttribute("autofocus");
7679
7685
  this.customClass = (this.getAttribute("class") ?? "").trim();
7686
+ this.hasAutofocus = this.hasAttribute("autofocus");
7680
7687
  this.ast.setText(attrValue);
7681
7688
  this.addStyles();
7682
7689
  this.addDOM();
@@ -7691,6 +7698,7 @@ var Element = class extends HTMLElement {
7691
7698
  this.interaction.attach();
7692
7699
  this.renderDOM();
7693
7700
  this.setAutoFocus();
7701
+ this.setEditable();
7694
7702
  }
7695
7703
  disconnectedCallback() {
7696
7704
  this.interaction?.detach();
@@ -7713,10 +7721,10 @@ var Element = class extends HTMLElement {
7713
7721
  if (this.rootElement) return;
7714
7722
  const div = document.createElement("div");
7715
7723
  div.classList.add("element");
7716
- div.contentEditable = "true";
7717
7724
  this.shadowRootElement.appendChild(div);
7718
7725
  this.rootElement = div;
7719
7726
  this.applyClass();
7727
+ this.setEditable();
7720
7728
  }
7721
7729
  applyClass() {
7722
7730
  if (!this.rootElement) return;
@@ -7740,6 +7748,11 @@ var Element = class extends HTMLElement {
7740
7748
  setAutoFocus() {
7741
7749
  if (this.hasAutofocus && this.rootElement && this.select) this.select.autoFocus();
7742
7750
  }
7751
+ setEditable() {
7752
+ if (this.rootElement) {
7753
+ this.rootElement.contentEditable = this.hasEditable ? "true" : "false";
7754
+ }
7755
+ }
7743
7756
  };
7744
7757
  var element_default = Element;
7745
7758
 
package/dist/index.d.cts CHANGED
@@ -14,6 +14,7 @@ declare class Element extends HTMLElement {
14
14
  private appliedClasses;
15
15
  private customClass;
16
16
  hasAutofocus: boolean;
17
+ hasEditable: boolean;
17
18
  constructor();
18
19
  static get observedAttributes(): string[];
19
20
  get value(): string;
@@ -29,6 +30,7 @@ declare class Element extends HTMLElement {
29
30
  private applyClass;
30
31
  private emitChange;
31
32
  private setAutoFocus;
33
+ private setEditable;
32
34
  }
33
35
 
34
36
  declare function defineElement(tag?: string): void;
package/dist/index.d.ts CHANGED
@@ -14,6 +14,7 @@ declare class Element extends HTMLElement {
14
14
  private appliedClasses;
15
15
  private customClass;
16
16
  hasAutofocus: boolean;
17
+ hasEditable: boolean;
17
18
  constructor();
18
19
  static get observedAttributes(): string[];
19
20
  get value(): string;
@@ -29,6 +30,7 @@ declare class Element extends HTMLElement {
29
30
  private applyClass;
30
31
  private emitChange;
31
32
  private setAutoFocus;
33
+ private setEditable;
32
34
  }
33
35
 
34
36
  declare function defineElement(tag?: string): void;
package/dist/index.esm.js CHANGED
@@ -7606,10 +7606,11 @@ var Element = class extends HTMLElement {
7606
7606
  this.appliedClasses = [];
7607
7607
  this.customClass = "";
7608
7608
  this.hasAutofocus = false;
7609
+ this.hasEditable = true;
7609
7610
  this.shadowRootElement = this.attachShadow({ mode: "open" });
7610
7611
  }
7611
7612
  static get observedAttributes() {
7612
- return ["class", "autofocus"];
7613
+ return ["class", "autofocus", "editable"];
7613
7614
  }
7614
7615
  get value() {
7615
7616
  return this.ast.text;
@@ -7620,6 +7621,7 @@ var Element = class extends HTMLElement {
7620
7621
  this.ast.setText(value);
7621
7622
  this.renderDOM();
7622
7623
  this.setAutoFocus();
7624
+ this.setEditable();
7623
7625
  this.hasAcceptedExternalValue = true;
7624
7626
  }
7625
7627
  }
@@ -7640,15 +7642,20 @@ var Element = class extends HTMLElement {
7640
7642
  return;
7641
7643
  }
7642
7644
  if (name === "autofocus") {
7643
- this.hasAutofocus = this.hasAttribute("autofocus");
7645
+ this.hasAutofocus = newValue === "" || newValue === "true" || newValue === "1";
7644
7646
  this.setAutoFocus();
7645
7647
  return;
7646
7648
  }
7649
+ if (name === "editable") {
7650
+ this.hasEditable = newValue === "" || newValue === "true" || newValue === "1";
7651
+ this.setEditable();
7652
+ return;
7653
+ }
7647
7654
  }
7648
7655
  connectedCallback() {
7649
7656
  const attrValue = this.getAttribute("value") ?? "";
7650
- this.hasAutofocus = this.hasAttribute("autofocus");
7651
7657
  this.customClass = (this.getAttribute("class") ?? "").trim();
7658
+ this.hasAutofocus = this.hasAttribute("autofocus");
7652
7659
  this.ast.setText(attrValue);
7653
7660
  this.addStyles();
7654
7661
  this.addDOM();
@@ -7663,6 +7670,7 @@ var Element = class extends HTMLElement {
7663
7670
  this.interaction.attach();
7664
7671
  this.renderDOM();
7665
7672
  this.setAutoFocus();
7673
+ this.setEditable();
7666
7674
  }
7667
7675
  disconnectedCallback() {
7668
7676
  this.interaction?.detach();
@@ -7685,10 +7693,10 @@ var Element = class extends HTMLElement {
7685
7693
  if (this.rootElement) return;
7686
7694
  const div = document.createElement("div");
7687
7695
  div.classList.add("element");
7688
- div.contentEditable = "true";
7689
7696
  this.shadowRootElement.appendChild(div);
7690
7697
  this.rootElement = div;
7691
7698
  this.applyClass();
7699
+ this.setEditable();
7692
7700
  }
7693
7701
  applyClass() {
7694
7702
  if (!this.rootElement) return;
@@ -7712,6 +7720,11 @@ var Element = class extends HTMLElement {
7712
7720
  setAutoFocus() {
7713
7721
  if (this.hasAutofocus && this.rootElement && this.select) this.select.autoFocus();
7714
7722
  }
7723
+ setEditable() {
7724
+ if (this.rootElement) {
7725
+ this.rootElement.contentEditable = this.hasEditable ? "true" : "false";
7726
+ }
7727
+ }
7715
7728
  };
7716
7729
  var element_default = Element;
7717
7730
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "synthetic-markdown",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "author": {