synthetic-markdown 0.0.3 → 0.0.5
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/README.md +1 -1
- package/dist/index.cjs.js +25 -2
- package/dist/index.d.cts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.esm.js +25 -2
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.cjs.js
CHANGED
|
@@ -7633,11 +7633,13 @@ var Element = class extends HTMLElement {
|
|
|
7633
7633
|
this.intent = null;
|
|
7634
7634
|
this.styled = false;
|
|
7635
7635
|
this.hasAcceptedExternalValue = false;
|
|
7636
|
+
this.appliedClasses = [];
|
|
7637
|
+
this.customClass = "";
|
|
7636
7638
|
this.hasAutofocus = false;
|
|
7637
7639
|
this.shadowRootElement = this.attachShadow({ mode: "open" });
|
|
7638
7640
|
}
|
|
7639
7641
|
static get observedAttributes() {
|
|
7640
|
-
return ["autofocus"];
|
|
7642
|
+
return ["class", "autofocus"];
|
|
7641
7643
|
}
|
|
7642
7644
|
get value() {
|
|
7643
7645
|
return this.ast.text;
|
|
@@ -7661,15 +7663,22 @@ var Element = class extends HTMLElement {
|
|
|
7661
7663
|
if (!on && currentlyOn) this.removeAttribute("autofocus");
|
|
7662
7664
|
this.hasAutofocus = on;
|
|
7663
7665
|
}
|
|
7664
|
-
attributeChangedCallback(name,
|
|
7666
|
+
attributeChangedCallback(name, _oldValue, newValue) {
|
|
7667
|
+
if (name === "class") {
|
|
7668
|
+
this.customClass = (newValue ?? "").trim();
|
|
7669
|
+
this.applyClass();
|
|
7670
|
+
return;
|
|
7671
|
+
}
|
|
7665
7672
|
if (name === "autofocus") {
|
|
7666
7673
|
this.hasAutofocus = this.hasAttribute("autofocus");
|
|
7667
7674
|
this.setAutoFocus();
|
|
7675
|
+
return;
|
|
7668
7676
|
}
|
|
7669
7677
|
}
|
|
7670
7678
|
connectedCallback() {
|
|
7671
7679
|
const attrValue = this.getAttribute("value") ?? "";
|
|
7672
7680
|
this.hasAutofocus = this.hasAttribute("autofocus");
|
|
7681
|
+
this.customClass = (this.getAttribute("class") ?? "").trim();
|
|
7673
7682
|
this.ast.setText(attrValue);
|
|
7674
7683
|
this.addStyles();
|
|
7675
7684
|
this.addDOM();
|
|
@@ -7709,6 +7718,20 @@ var Element = class extends HTMLElement {
|
|
|
7709
7718
|
div.contentEditable = "true";
|
|
7710
7719
|
this.shadowRootElement.appendChild(div);
|
|
7711
7720
|
this.rootElement = div;
|
|
7721
|
+
this.applyClass();
|
|
7722
|
+
}
|
|
7723
|
+
applyClass() {
|
|
7724
|
+
if (!this.rootElement) return;
|
|
7725
|
+
if (this.appliedClasses.length) {
|
|
7726
|
+
this.rootElement.classList.remove(...this.appliedClasses);
|
|
7727
|
+
this.appliedClasses = [];
|
|
7728
|
+
}
|
|
7729
|
+
if (!this.customClass) return;
|
|
7730
|
+
const classes = this.customClass.split(/\s+/).filter(Boolean);
|
|
7731
|
+
if (classes.length) {
|
|
7732
|
+
this.rootElement.classList.add(...classes);
|
|
7733
|
+
this.appliedClasses = classes;
|
|
7734
|
+
}
|
|
7712
7735
|
}
|
|
7713
7736
|
emitChange() {
|
|
7714
7737
|
this.dispatchEvent(new Event("change", {
|
package/dist/index.d.cts
CHANGED
|
@@ -11,19 +11,22 @@ declare class Element extends HTMLElement {
|
|
|
11
11
|
private intent;
|
|
12
12
|
private styled;
|
|
13
13
|
private hasAcceptedExternalValue;
|
|
14
|
+
private appliedClasses;
|
|
15
|
+
private customClass;
|
|
14
16
|
hasAutofocus: boolean;
|
|
15
|
-
static get observedAttributes(): string[];
|
|
16
17
|
constructor();
|
|
18
|
+
static get observedAttributes(): string[];
|
|
17
19
|
get value(): string;
|
|
18
20
|
set value(value: string);
|
|
19
21
|
get autofocus(): any;
|
|
20
22
|
set autofocus(value: any);
|
|
21
|
-
attributeChangedCallback(name: string,
|
|
23
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
22
24
|
connectedCallback(): void;
|
|
23
25
|
disconnectedCallback(): void;
|
|
24
26
|
private renderDOM;
|
|
25
27
|
private addStyles;
|
|
26
28
|
private addDOM;
|
|
29
|
+
private applyClass;
|
|
27
30
|
private emitChange;
|
|
28
31
|
private setAutoFocus;
|
|
29
32
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -11,19 +11,22 @@ declare class Element extends HTMLElement {
|
|
|
11
11
|
private intent;
|
|
12
12
|
private styled;
|
|
13
13
|
private hasAcceptedExternalValue;
|
|
14
|
+
private appliedClasses;
|
|
15
|
+
private customClass;
|
|
14
16
|
hasAutofocus: boolean;
|
|
15
|
-
static get observedAttributes(): string[];
|
|
16
17
|
constructor();
|
|
18
|
+
static get observedAttributes(): string[];
|
|
17
19
|
get value(): string;
|
|
18
20
|
set value(value: string);
|
|
19
21
|
get autofocus(): any;
|
|
20
22
|
set autofocus(value: any);
|
|
21
|
-
attributeChangedCallback(name: string,
|
|
23
|
+
attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
22
24
|
connectedCallback(): void;
|
|
23
25
|
disconnectedCallback(): void;
|
|
24
26
|
private renderDOM;
|
|
25
27
|
private addStyles;
|
|
26
28
|
private addDOM;
|
|
29
|
+
private applyClass;
|
|
27
30
|
private emitChange;
|
|
28
31
|
private setAutoFocus;
|
|
29
32
|
}
|
package/dist/index.esm.js
CHANGED
|
@@ -7605,11 +7605,13 @@ var Element = class extends HTMLElement {
|
|
|
7605
7605
|
this.intent = null;
|
|
7606
7606
|
this.styled = false;
|
|
7607
7607
|
this.hasAcceptedExternalValue = false;
|
|
7608
|
+
this.appliedClasses = [];
|
|
7609
|
+
this.customClass = "";
|
|
7608
7610
|
this.hasAutofocus = false;
|
|
7609
7611
|
this.shadowRootElement = this.attachShadow({ mode: "open" });
|
|
7610
7612
|
}
|
|
7611
7613
|
static get observedAttributes() {
|
|
7612
|
-
return ["autofocus"];
|
|
7614
|
+
return ["class", "autofocus"];
|
|
7613
7615
|
}
|
|
7614
7616
|
get value() {
|
|
7615
7617
|
return this.ast.text;
|
|
@@ -7633,15 +7635,22 @@ var Element = class extends HTMLElement {
|
|
|
7633
7635
|
if (!on && currentlyOn) this.removeAttribute("autofocus");
|
|
7634
7636
|
this.hasAutofocus = on;
|
|
7635
7637
|
}
|
|
7636
|
-
attributeChangedCallback(name,
|
|
7638
|
+
attributeChangedCallback(name, _oldValue, newValue) {
|
|
7639
|
+
if (name === "class") {
|
|
7640
|
+
this.customClass = (newValue ?? "").trim();
|
|
7641
|
+
this.applyClass();
|
|
7642
|
+
return;
|
|
7643
|
+
}
|
|
7637
7644
|
if (name === "autofocus") {
|
|
7638
7645
|
this.hasAutofocus = this.hasAttribute("autofocus");
|
|
7639
7646
|
this.setAutoFocus();
|
|
7647
|
+
return;
|
|
7640
7648
|
}
|
|
7641
7649
|
}
|
|
7642
7650
|
connectedCallback() {
|
|
7643
7651
|
const attrValue = this.getAttribute("value") ?? "";
|
|
7644
7652
|
this.hasAutofocus = this.hasAttribute("autofocus");
|
|
7653
|
+
this.customClass = (this.getAttribute("class") ?? "").trim();
|
|
7645
7654
|
this.ast.setText(attrValue);
|
|
7646
7655
|
this.addStyles();
|
|
7647
7656
|
this.addDOM();
|
|
@@ -7681,6 +7690,20 @@ var Element = class extends HTMLElement {
|
|
|
7681
7690
|
div.contentEditable = "true";
|
|
7682
7691
|
this.shadowRootElement.appendChild(div);
|
|
7683
7692
|
this.rootElement = div;
|
|
7693
|
+
this.applyClass();
|
|
7694
|
+
}
|
|
7695
|
+
applyClass() {
|
|
7696
|
+
if (!this.rootElement) return;
|
|
7697
|
+
if (this.appliedClasses.length) {
|
|
7698
|
+
this.rootElement.classList.remove(...this.appliedClasses);
|
|
7699
|
+
this.appliedClasses = [];
|
|
7700
|
+
}
|
|
7701
|
+
if (!this.customClass) return;
|
|
7702
|
+
const classes = this.customClass.split(/\s+/).filter(Boolean);
|
|
7703
|
+
if (classes.length) {
|
|
7704
|
+
this.rootElement.classList.add(...classes);
|
|
7705
|
+
this.appliedClasses = classes;
|
|
7706
|
+
}
|
|
7684
7707
|
}
|
|
7685
7708
|
emitChange() {
|
|
7686
7709
|
this.dispatchEvent(new Event("change", {
|