builder-settings-types 0.0.3 → 0.0.4

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