builder-settings-types 0.0.11 → 0.0.15
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";Object.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class r{constructor(t={}){this.props=t,this.title=t.title||"Setting",this.value=t.defaultValue}defaultDraw(){const t=document.createElement("div"),e=document.createElement("label");e.textContent=this.title??"";const s=document.createElement("input");return s.type=this.inputType,s.placeholder=this.props.placeholder||`Enter ${this.title}`,s.value=this.value!==void 0?String(this.value):"",t.appendChild(e),t.appendChild(s),t}}class a{constructor(t){this.title=t.title,this.settings=t.settings,Object.assign(this,t.settings)}}class i extends r{constructor(t={}){super(t),this.props=t,this.inputType="number"}draw(){const t=super.defaultDraw(),e=t.querySelector("input");return this.props.minValue!==void 0&&(e.min=String(this.props.minValue)),this.props.maxValue!==void 0&&(e.max=String(this.props.maxValue)),this.props.className&&e.classList.add(this.props.className),t}}class l extends a{constructor(){super({title:"Margin",settings:{margin:new i({title:"Margin All"}),marginTop:new i({title:"Margin Top"}),marginRight:new i({title:"Margin Right"}),marginBottom:new i({title:"Margin Bottom"}),marginLeft:new i({title:"Margin Left"})}})}getCssCode(){return`
|
|
2
2
|
margin-botton: ${this.settings.marginBottom.value}px;
|
|
3
3
|
margin-top: ${this.settings.marginTop.value}px;
|
|
4
4
|
margin-right: ${this.settings.marginRight.value}px;
|
|
5
5
|
margin-left: ${this.settings.marginLeft.value}px;
|
|
6
|
-
`}}
|
|
6
|
+
`}}class g extends r{constructor(t={}){super(t),this.inputType="text"}draw(){return super.defaultDraw()}}exports.MarginSetting=l;exports.NumberSetting=i;exports.Setting=r;exports.SettingGroup=a;exports.StringSetting=g;
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
class r {
|
|
2
|
-
constructor(t) {
|
|
3
|
-
this.title = t.title, this.settings = t.settings, Object.assign(this, t.settings);
|
|
4
|
-
}
|
|
5
|
-
}
|
|
6
|
-
const o = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
7
|
-
__proto__: null,
|
|
8
|
-
SettingGroup: r
|
|
9
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
10
|
-
class l {
|
|
11
2
|
constructor(t = {}) {
|
|
12
3
|
this.props = t, this.title = t.title || "Setting", this.value = t.defaultValue;
|
|
13
4
|
}
|
|
@@ -18,7 +9,12 @@ class l {
|
|
|
18
9
|
return s.type = this.inputType, s.placeholder = this.props.placeholder || `Enter ${this.title}`, s.value = this.value !== void 0 ? String(this.value) : "", t.appendChild(e), t.appendChild(s), t;
|
|
19
10
|
}
|
|
20
11
|
}
|
|
21
|
-
class
|
|
12
|
+
class a {
|
|
13
|
+
constructor(t) {
|
|
14
|
+
this.title = t.title, this.settings = t.settings, Object.assign(this, t.settings);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
class i extends r {
|
|
22
18
|
constructor(t = {}) {
|
|
23
19
|
super(t), this.props = t, this.inputType = "number";
|
|
24
20
|
}
|
|
@@ -27,11 +23,7 @@ class i extends l {
|
|
|
27
23
|
return this.props.minValue !== void 0 && (e.min = String(this.props.minValue)), this.props.maxValue !== void 0 && (e.max = String(this.props.maxValue)), this.props.className && e.classList.add(this.props.className), t;
|
|
28
24
|
}
|
|
29
25
|
}
|
|
30
|
-
|
|
31
|
-
__proto__: null,
|
|
32
|
-
NumberSetting: i
|
|
33
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
34
|
-
class g extends r {
|
|
26
|
+
class l extends a {
|
|
35
27
|
constructor() {
|
|
36
28
|
super({
|
|
37
29
|
title: "Margin",
|
|
@@ -53,11 +45,7 @@ class g extends r {
|
|
|
53
45
|
`;
|
|
54
46
|
}
|
|
55
47
|
}
|
|
56
|
-
|
|
57
|
-
__proto__: null,
|
|
58
|
-
MarginSetting: g
|
|
59
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
60
|
-
class p extends l {
|
|
48
|
+
class u extends r {
|
|
61
49
|
constructor(t = {}) {
|
|
62
50
|
super(t), this.inputType = "text";
|
|
63
51
|
}
|
|
@@ -65,21 +53,10 @@ class p extends l {
|
|
|
65
53
|
return super.defaultDraw();
|
|
66
54
|
}
|
|
67
55
|
}
|
|
68
|
-
const c = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
69
|
-
__proto__: null,
|
|
70
|
-
StringSetting: p
|
|
71
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
72
|
-
function m() {
|
|
73
|
-
console.log("logg yes fixed");
|
|
74
|
-
}
|
|
75
|
-
const d = {
|
|
76
|
-
SettingGroup: r,
|
|
77
|
-
settingsGroup: o,
|
|
78
|
-
marginSettings: u,
|
|
79
|
-
numberSettings: a,
|
|
80
|
-
stringSettings: c
|
|
81
|
-
};
|
|
82
56
|
export {
|
|
83
|
-
|
|
84
|
-
|
|
57
|
+
l as MarginSetting,
|
|
58
|
+
i as NumberSetting,
|
|
59
|
+
r as Setting,
|
|
60
|
+
a as SettingGroup,
|
|
61
|
+
u as StringSetting
|
|
85
62
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
declare
|
|
2
|
-
SettingGroup: typeof settingsGroup.SettingGroup;
|
|
3
|
-
settingsGroup: typeof settingsGroup;
|
|
4
|
-
marginSettings: typeof marginSettings;
|
|
5
|
-
numberSettings: typeof numberSettings;
|
|
6
|
-
stringSettings: typeof stringSettings;
|
|
7
|
-
};
|
|
8
|
-
export default _default;
|
|
9
|
-
|
|
10
|
-
export declare function logger(): void;
|
|
11
|
-
|
|
12
|
-
declare class MarginSetting extends SettingGroup<{
|
|
1
|
+
export declare class MarginSetting extends SettingGroup<{
|
|
13
2
|
margin: NumberSetting;
|
|
14
3
|
marginTop: NumberSetting;
|
|
15
4
|
marginRight: NumberSetting;
|
|
@@ -20,33 +9,20 @@ declare class MarginSetting extends SettingGroup<{
|
|
|
20
9
|
getCssCode(): string;
|
|
21
10
|
}
|
|
22
11
|
|
|
23
|
-
declare
|
|
24
|
-
export {
|
|
25
|
-
MarginSetting
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
declare interface NumberInputProps extends SettingProps<number> {
|
|
12
|
+
export declare interface NumberInputProps extends SettingProps<number> {
|
|
30
13
|
minValue?: number;
|
|
31
14
|
maxValue?: number;
|
|
32
15
|
className?: string;
|
|
33
16
|
}
|
|
34
17
|
|
|
35
|
-
declare class NumberSetting extends Setting<number> {
|
|
18
|
+
export declare class NumberSetting extends Setting<number> {
|
|
36
19
|
protected props: NumberInputProps;
|
|
37
20
|
inputType: string;
|
|
38
21
|
constructor(props?: NumberInputProps);
|
|
39
22
|
draw(): HTMLElement;
|
|
40
23
|
}
|
|
41
24
|
|
|
42
|
-
declare
|
|
43
|
-
export {
|
|
44
|
-
NumberInputProps,
|
|
45
|
-
NumberSetting
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
declare abstract class Setting<T> {
|
|
25
|
+
export declare abstract class Setting<T> {
|
|
50
26
|
protected props: SettingProps<T>;
|
|
51
27
|
value: T | undefined;
|
|
52
28
|
title: string | undefined;
|
|
@@ -56,45 +32,31 @@ declare abstract class Setting<T> {
|
|
|
56
32
|
defaultDraw(): HTMLElement;
|
|
57
33
|
}
|
|
58
34
|
|
|
59
|
-
declare class SettingGroup<T extends Record<string, Setting<any> | SettingGroup<any>>> {
|
|
35
|
+
export declare class SettingGroup<T extends Record<string, Setting<any> | SettingGroup<any>>> {
|
|
60
36
|
title: string;
|
|
61
37
|
settings: T;
|
|
62
38
|
constructor(groupProps: SettingGroupProps<T>);
|
|
63
39
|
}
|
|
64
40
|
|
|
65
|
-
declare type SettingGroupProps<T> = {
|
|
41
|
+
export declare type SettingGroupProps<T> = {
|
|
66
42
|
title: string;
|
|
67
43
|
settings: T;
|
|
68
44
|
};
|
|
69
45
|
|
|
70
|
-
declare interface SettingProps<T> {
|
|
46
|
+
export declare interface SettingProps<T> {
|
|
71
47
|
defaultValue?: T;
|
|
72
48
|
title?: string;
|
|
73
49
|
placeholder?: string;
|
|
74
50
|
}
|
|
75
51
|
|
|
76
|
-
declare
|
|
77
|
-
export {
|
|
78
|
-
SettingGroupProps,
|
|
79
|
-
SettingGroup
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
declare interface StringInputProps extends SettingProps<string> {
|
|
52
|
+
export declare interface StringInputProps extends SettingProps<string> {
|
|
84
53
|
maxLength?: number;
|
|
85
54
|
}
|
|
86
55
|
|
|
87
|
-
declare class StringSetting extends Setting<string> {
|
|
56
|
+
export declare class StringSetting extends Setting<string> {
|
|
88
57
|
inputType: string;
|
|
89
58
|
constructor(props?: StringInputProps);
|
|
90
59
|
draw(): HTMLElement;
|
|
91
60
|
}
|
|
92
61
|
|
|
93
|
-
declare namespace stringSettings {
|
|
94
|
-
export {
|
|
95
|
-
StringInputProps,
|
|
96
|
-
StringSetting
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
62
|
export { }
|
package/package.json
CHANGED