@semigarden/synthetic-md 0.0.17 → 0.0.18

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
@@ -6874,6 +6874,9 @@ var Element = class extends HTMLElement {
6874
6874
  this.autofocus = false;
6875
6875
  this.shadowRootElement = this.attachShadow({ mode: "open" });
6876
6876
  }
6877
+ static get observedAttributes() {
6878
+ return ["autofocus"];
6879
+ }
6877
6880
  connectedCallback() {
6878
6881
  const attrValue = this.getAttribute("value") ?? "";
6879
6882
  this.autofocus = this.hasAttribute("autofocus");
@@ -6890,6 +6893,7 @@ var Element = class extends HTMLElement {
6890
6893
  this.interaction = new interaction_default(this.rootElement, this.select, this.editor, this.input, this.intent);
6891
6894
  this.interaction.attach();
6892
6895
  this.renderDOM();
6896
+ console.log("autofocus element on connectedCallback", this.autofocus);
6893
6897
  this.autoFocus();
6894
6898
  }
6895
6899
  disconnectedCallback() {
@@ -6897,11 +6901,19 @@ var Element = class extends HTMLElement {
6897
6901
  this.select?.detach();
6898
6902
  this.caret?.clear();
6899
6903
  }
6904
+ attributeChangedCallback(name, oldValue, newValue) {
6905
+ if (name === "autofocus") {
6906
+ this.autofocus = this.hasAttribute("autofocus");
6907
+ console.log("autofocus element on attributeChangedCallback", this.autofocus);
6908
+ this.autoFocus();
6909
+ }
6910
+ }
6900
6911
  set value(value) {
6901
6912
  if (value === this.ast.text) return;
6902
6913
  if (!this.hasAcceptedExternalValue && value !== "" || value !== "" && value !== this.ast.text) {
6903
6914
  this.ast.setText(value);
6904
6915
  this.renderDOM();
6916
+ console.log("autofocus element on set value", this.autofocus);
6905
6917
  this.autoFocus();
6906
6918
  this.hasAcceptedExternalValue = true;
6907
6919
  }
@@ -6936,6 +6948,7 @@ var Element = class extends HTMLElement {
6936
6948
  }));
6937
6949
  }
6938
6950
  autoFocus() {
6951
+ console.log("autofocus element", this.autofocus);
6939
6952
  if (this.autofocus && this.rootElement && this.select) this.select.autoFocus();
6940
6953
  }
6941
6954
  };
package/dist/index.d.cts CHANGED
@@ -12,9 +12,11 @@ declare class Element extends HTMLElement {
12
12
  private styled;
13
13
  private hasAcceptedExternalValue;
14
14
  autofocus: boolean;
15
+ static get observedAttributes(): string[];
15
16
  constructor();
16
17
  connectedCallback(): void;
17
18
  disconnectedCallback(): void;
19
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
18
20
  set value(value: string);
19
21
  get value(): string;
20
22
  private renderDOM;
package/dist/index.d.ts CHANGED
@@ -12,9 +12,11 @@ declare class Element extends HTMLElement {
12
12
  private styled;
13
13
  private hasAcceptedExternalValue;
14
14
  autofocus: boolean;
15
+ static get observedAttributes(): string[];
15
16
  constructor();
16
17
  connectedCallback(): void;
17
18
  disconnectedCallback(): void;
19
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
18
20
  set value(value: string);
19
21
  get value(): string;
20
22
  private renderDOM;
package/dist/index.esm.js CHANGED
@@ -6846,6 +6846,9 @@ var Element = class extends HTMLElement {
6846
6846
  this.autofocus = false;
6847
6847
  this.shadowRootElement = this.attachShadow({ mode: "open" });
6848
6848
  }
6849
+ static get observedAttributes() {
6850
+ return ["autofocus"];
6851
+ }
6849
6852
  connectedCallback() {
6850
6853
  const attrValue = this.getAttribute("value") ?? "";
6851
6854
  this.autofocus = this.hasAttribute("autofocus");
@@ -6862,6 +6865,7 @@ var Element = class extends HTMLElement {
6862
6865
  this.interaction = new interaction_default(this.rootElement, this.select, this.editor, this.input, this.intent);
6863
6866
  this.interaction.attach();
6864
6867
  this.renderDOM();
6868
+ console.log("autofocus element on connectedCallback", this.autofocus);
6865
6869
  this.autoFocus();
6866
6870
  }
6867
6871
  disconnectedCallback() {
@@ -6869,11 +6873,19 @@ var Element = class extends HTMLElement {
6869
6873
  this.select?.detach();
6870
6874
  this.caret?.clear();
6871
6875
  }
6876
+ attributeChangedCallback(name, oldValue, newValue) {
6877
+ if (name === "autofocus") {
6878
+ this.autofocus = this.hasAttribute("autofocus");
6879
+ console.log("autofocus element on attributeChangedCallback", this.autofocus);
6880
+ this.autoFocus();
6881
+ }
6882
+ }
6872
6883
  set value(value) {
6873
6884
  if (value === this.ast.text) return;
6874
6885
  if (!this.hasAcceptedExternalValue && value !== "" || value !== "" && value !== this.ast.text) {
6875
6886
  this.ast.setText(value);
6876
6887
  this.renderDOM();
6888
+ console.log("autofocus element on set value", this.autofocus);
6877
6889
  this.autoFocus();
6878
6890
  this.hasAcceptedExternalValue = true;
6879
6891
  }
@@ -6908,6 +6920,7 @@ var Element = class extends HTMLElement {
6908
6920
  }));
6909
6921
  }
6910
6922
  autoFocus() {
6923
+ console.log("autofocus element", this.autofocus);
6911
6924
  if (this.autofocus && this.rootElement && this.select) this.select.autoFocus();
6912
6925
  }
6913
6926
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@semigarden/synthetic-md",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "description": "A UI primitive for unified Markdown editing and rendering",
5
5
  "license": "MIT",
6
6
  "author": {