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