synthetic-markdown 0.0.7 → 0.0.8

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,7 +7634,7 @@ var Element = class extends HTMLElement {
7634
7634
  this.appliedClasses = [];
7635
7635
  this.customClass = "";
7636
7636
  this.hasAutofocus = false;
7637
- this.hasEditable = true;
7637
+ this.isEditable = true;
7638
7638
  this.shadowRootElement = this.attachShadow({ mode: "open" });
7639
7639
  }
7640
7640
  static get observedAttributes() {
@@ -7663,6 +7663,13 @@ var Element = class extends HTMLElement {
7663
7663
  if (!on && currentlyOn) this.removeAttribute("autofocus");
7664
7664
  this.hasAutofocus = on;
7665
7665
  }
7666
+ get editable() {
7667
+ return this.isEditable;
7668
+ }
7669
+ set editable(value) {
7670
+ this.isEditable = value === true || value === "" || value === "true" || value === 1 || value === "1";
7671
+ this.setEditable();
7672
+ }
7666
7673
  attributeChangedCallback(name, _oldValue, newValue) {
7667
7674
  if (name === "class") {
7668
7675
  this.customClass = (newValue ?? "").trim();
@@ -7675,7 +7682,7 @@ var Element = class extends HTMLElement {
7675
7682
  return;
7676
7683
  }
7677
7684
  if (name === "editable") {
7678
- this.hasEditable = newValue === "" || newValue === "true" || newValue === "1";
7685
+ this.isEditable = newValue === "" || newValue === "true" || newValue === "1";
7679
7686
  this.setEditable();
7680
7687
  return;
7681
7688
  }
@@ -7684,6 +7691,7 @@ var Element = class extends HTMLElement {
7684
7691
  const attrValue = this.getAttribute("value") ?? "";
7685
7692
  this.customClass = (this.getAttribute("class") ?? "").trim();
7686
7693
  this.hasAutofocus = this.hasAttribute("autofocus");
7694
+ this.isEditable = this.editable;
7687
7695
  this.ast.setText(attrValue);
7688
7696
  this.addStyles();
7689
7697
  this.addDOM();
@@ -7750,7 +7758,7 @@ var Element = class extends HTMLElement {
7750
7758
  }
7751
7759
  setEditable() {
7752
7760
  if (this.rootElement) {
7753
- this.rootElement.contentEditable = this.hasEditable ? "true" : "false";
7761
+ this.rootElement.contentEditable = this.isEditable ? "true" : "false";
7754
7762
  }
7755
7763
  }
7756
7764
  };
package/dist/index.d.cts CHANGED
@@ -14,13 +14,15 @@ declare class Element extends HTMLElement {
14
14
  private appliedClasses;
15
15
  private customClass;
16
16
  hasAutofocus: boolean;
17
- hasEditable: boolean;
17
+ isEditable: boolean;
18
18
  constructor();
19
19
  static get observedAttributes(): string[];
20
20
  get value(): string;
21
21
  set value(value: string);
22
22
  get autofocus(): any;
23
23
  set autofocus(value: any);
24
+ get editable(): any;
25
+ set editable(value: any);
24
26
  attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
25
27
  connectedCallback(): void;
26
28
  disconnectedCallback(): void;
package/dist/index.d.ts CHANGED
@@ -14,13 +14,15 @@ declare class Element extends HTMLElement {
14
14
  private appliedClasses;
15
15
  private customClass;
16
16
  hasAutofocus: boolean;
17
- hasEditable: boolean;
17
+ isEditable: boolean;
18
18
  constructor();
19
19
  static get observedAttributes(): string[];
20
20
  get value(): string;
21
21
  set value(value: string);
22
22
  get autofocus(): any;
23
23
  set autofocus(value: any);
24
+ get editable(): any;
25
+ set editable(value: any);
24
26
  attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
25
27
  connectedCallback(): void;
26
28
  disconnectedCallback(): void;
package/dist/index.esm.js CHANGED
@@ -7606,7 +7606,7 @@ var Element = class extends HTMLElement {
7606
7606
  this.appliedClasses = [];
7607
7607
  this.customClass = "";
7608
7608
  this.hasAutofocus = false;
7609
- this.hasEditable = true;
7609
+ this.isEditable = true;
7610
7610
  this.shadowRootElement = this.attachShadow({ mode: "open" });
7611
7611
  }
7612
7612
  static get observedAttributes() {
@@ -7635,6 +7635,13 @@ var Element = class extends HTMLElement {
7635
7635
  if (!on && currentlyOn) this.removeAttribute("autofocus");
7636
7636
  this.hasAutofocus = on;
7637
7637
  }
7638
+ get editable() {
7639
+ return this.isEditable;
7640
+ }
7641
+ set editable(value) {
7642
+ this.isEditable = value === true || value === "" || value === "true" || value === 1 || value === "1";
7643
+ this.setEditable();
7644
+ }
7638
7645
  attributeChangedCallback(name, _oldValue, newValue) {
7639
7646
  if (name === "class") {
7640
7647
  this.customClass = (newValue ?? "").trim();
@@ -7647,7 +7654,7 @@ var Element = class extends HTMLElement {
7647
7654
  return;
7648
7655
  }
7649
7656
  if (name === "editable") {
7650
- this.hasEditable = newValue === "" || newValue === "true" || newValue === "1";
7657
+ this.isEditable = newValue === "" || newValue === "true" || newValue === "1";
7651
7658
  this.setEditable();
7652
7659
  return;
7653
7660
  }
@@ -7656,6 +7663,7 @@ var Element = class extends HTMLElement {
7656
7663
  const attrValue = this.getAttribute("value") ?? "";
7657
7664
  this.customClass = (this.getAttribute("class") ?? "").trim();
7658
7665
  this.hasAutofocus = this.hasAttribute("autofocus");
7666
+ this.isEditable = this.editable;
7659
7667
  this.ast.setText(attrValue);
7660
7668
  this.addStyles();
7661
7669
  this.addDOM();
@@ -7722,7 +7730,7 @@ var Element = class extends HTMLElement {
7722
7730
  }
7723
7731
  setEditable() {
7724
7732
  if (this.rootElement) {
7725
- this.rootElement.contentEditable = this.hasEditable ? "true" : "false";
7733
+ this.rootElement.contentEditable = this.isEditable ? "true" : "false";
7726
7734
  }
7727
7735
  }
7728
7736
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "synthetic-markdown",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "author": {