@rettangoli/ui 1.0.8 → 1.0.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rettangoli/ui",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "A UI component library for building web interfaces.",
5
5
  "main": "dist/rettangoli-esm.min.js",
6
6
  "type": "module",
@@ -29,11 +29,11 @@ template:
29
29
  - rtgl-form#formDialog slot=content :form=formDialogConfig.form :defaultValues=formDialogConfig.defaultValues :context=formDialogConfig.context ?disabled=${formDialogConfig.disabled} key=form-dialog-${formDialogConfig.key}: null
30
30
  - $if !isFormDialogOpen:
31
31
  - rtgl-view slot=content g=lg p=lg:
32
- - rtgl-view d=h g=md:
33
- - rtgl-view d=h ah=c av=c g=md:
34
- - rtgl-view g=md: null
35
- - rtgl-view h=24 av=c:
36
- - rtgl-text s=lg: ${config.title}
32
+ - rtgl-view g=sm w=f:
33
+ - $if config.title:
34
+ - rtgl-text s=lg: ${config.title}
35
+ - rtgl-text c=mu-fg: ${config.message}
36
+ $else:
37
37
  - rtgl-text: ${config.message}
38
38
  - rtgl-view d=h g=md mt=lg w=f ah=e:
39
39
  - $if config.mode == 'confirm':
@@ -19,6 +19,15 @@ import stylesGenerator from "../styles/viewStyles.js";
19
19
  import marginStyles from "../styles/marginStyles.js";
20
20
  import anchorStyles from "../styles/anchorStyles.js";
21
21
 
22
+ const normalizeRawCssValue = (value) => {
23
+ if (value === undefined || value === null) {
24
+ return null;
25
+ }
26
+
27
+ const normalizedValue = `${value}`.trim();
28
+ return normalizedValue.length > 0 ? normalizedValue : null;
29
+ };
30
+
22
31
  // Internal implementation without uhtml
23
32
  class RettangoliViewElement extends HTMLElement {
24
33
  static styleSheet = null;
@@ -80,6 +89,10 @@ class RettangoliViewElement extends HTMLElement {
80
89
  "w",
81
90
  "h",
82
91
  "ar",
92
+ "bgi",
93
+ "bgs",
94
+ "bgp",
95
+ "bgr",
83
96
  "hide",
84
97
  "show",
85
98
  "sh",
@@ -141,6 +154,18 @@ class RettangoliViewElement extends HTMLElement {
141
154
  const aspectRatio = normalizeAspectRatio(
142
155
  this.getAttribute(addSizePrefix("ar")),
143
156
  );
157
+ const backgroundImage = normalizeRawCssValue(
158
+ this.getAttribute(addSizePrefix("bgi")),
159
+ );
160
+ const backgroundSize = normalizeRawCssValue(
161
+ this.getAttribute(addSizePrefix("bgs")),
162
+ );
163
+ const backgroundPosition = normalizeRawCssValue(
164
+ this.getAttribute(addSizePrefix("bgp")),
165
+ );
166
+ const backgroundRepeat = normalizeRawCssValue(
167
+ this.getAttribute(addSizePrefix("bgr")),
168
+ );
144
169
 
145
170
  if (zIndex !== null) {
146
171
  this._styles[size]["z-index"] = zIndex;
@@ -154,6 +179,22 @@ class RettangoliViewElement extends HTMLElement {
154
179
  this._styles[size]["aspect-ratio"] = aspectRatio;
155
180
  }
156
181
 
182
+ if (backgroundImage !== null) {
183
+ this._styles[size]["background-image"] = backgroundImage;
184
+ }
185
+
186
+ if (backgroundSize !== null) {
187
+ this._styles[size]["background-size"] = backgroundSize;
188
+ }
189
+
190
+ if (backgroundPosition !== null) {
191
+ this._styles[size]["background-position"] = backgroundPosition;
192
+ }
193
+
194
+ if (backgroundRepeat !== null) {
195
+ this._styles[size]["background-repeat"] = backgroundRepeat;
196
+ }
197
+
157
198
  applyDimensionToStyleBucket({
158
199
  styleBucket: this._styles[size],
159
200
  axis: "width",