@breadstone/mosaik-themes 0.0.211 → 0.0.214

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/index.d.mts CHANGED
@@ -102,18 +102,49 @@ declare namespace CssLength {
102
102
  */
103
103
  function isCssLength(value: unknown): value is CssLength;
104
104
  /**
105
+ * Determines whether the given value is 'auto'.
106
+ *
105
107
  * @public
108
+ * @param value - The value to check.
109
+ * @returns `true` if the value is 'auto'; otherwise, `false`.
106
110
  */
107
111
  function isAuto(value: unknown): value is Extract<CssLength, 'auto'>;
108
112
  /**
113
+ * Determines whether the given value is a percentage CSS length.
114
+ *
109
115
  * @public
116
+ * @param value - The value to check.
117
+ * @returns `true` if the value is a percentage; otherwise, `false`.
110
118
  */
111
119
  function isPercentage(value: unknown): value is `${number}%`;
112
120
  /**
121
+ * Determines whether the given value is a valid CSS length with units (excluding percentages).
122
+ *
113
123
  * @public
124
+ * @param value - The value to check.
125
+ * @returns `true` if the value is a valid CSS length with units; otherwise, `false`.
114
126
  */
115
127
  function isLength(value: unknown): value is `${number}${CssLengthUnit}`;
128
+ /**
129
+ * Converts a `CssLength` to a number.
130
+ * Only works for numeric values without units.
131
+ *
132
+ * @public
133
+ * @param value - The `CssLength` value to convert.
134
+ * @returns The numeric value.
135
+ * @throws Error if the value is not a number.
136
+ */
116
137
  function toNumber(value: CssLength): number;
138
+ /**
139
+ * Converts a `CssLength` to a string representation.
140
+ * Numbers are treated as pixels.
141
+ *
142
+ * @public
143
+ * @param value - The `CssLength` value to convert.
144
+ * @param defaultUnit - The default unit to use if the value is a number.
145
+ * @returns The string representation of the `CssLength`.
146
+ */
147
+ function toString(value?: CssLength, defaultUnit?: CssLengthUnit): string;
117
148
  /**
118
149
  * Extracts the unit from a CSS length string.
119
150
  *
package/index.d.ts CHANGED
@@ -102,18 +102,49 @@ declare namespace CssLength {
102
102
  */
103
103
  function isCssLength(value: unknown): value is CssLength;
104
104
  /**
105
+ * Determines whether the given value is 'auto'.
106
+ *
105
107
  * @public
108
+ * @param value - The value to check.
109
+ * @returns `true` if the value is 'auto'; otherwise, `false`.
106
110
  */
107
111
  function isAuto(value: unknown): value is Extract<CssLength, 'auto'>;
108
112
  /**
113
+ * Determines whether the given value is a percentage CSS length.
114
+ *
109
115
  * @public
116
+ * @param value - The value to check.
117
+ * @returns `true` if the value is a percentage; otherwise, `false`.
110
118
  */
111
119
  function isPercentage(value: unknown): value is `${number}%`;
112
120
  /**
121
+ * Determines whether the given value is a valid CSS length with units (excluding percentages).
122
+ *
113
123
  * @public
124
+ * @param value - The value to check.
125
+ * @returns `true` if the value is a valid CSS length with units; otherwise, `false`.
114
126
  */
115
127
  function isLength(value: unknown): value is `${number}${CssLengthUnit}`;
128
+ /**
129
+ * Converts a `CssLength` to a number.
130
+ * Only works for numeric values without units.
131
+ *
132
+ * @public
133
+ * @param value - The `CssLength` value to convert.
134
+ * @returns The numeric value.
135
+ * @throws Error if the value is not a number.
136
+ */
116
137
  function toNumber(value: CssLength): number;
138
+ /**
139
+ * Converts a `CssLength` to a string representation.
140
+ * Numbers are treated as pixels.
141
+ *
142
+ * @public
143
+ * @param value - The `CssLength` value to convert.
144
+ * @param defaultUnit - The default unit to use if the value is a number.
145
+ * @returns The string representation of the `CssLength`.
146
+ */
147
+ function toString(value?: CssLength, defaultUnit?: CssLengthUnit): string;
117
148
  /**
118
149
  * Extracts the unit from a CSS length string.
119
150
  *
package/index.js CHANGED
@@ -2645,6 +2645,17 @@ var CssColor;
2645
2645
  }
2646
2646
  __name(toNumber, "toNumber");
2647
2647
  CssLength2.toNumber = toNumber;
2648
+ function toString(value, defaultUnit = "px") {
2649
+ if (value === void 0 || value === null) {
2650
+ return "";
2651
+ }
2652
+ if (typeof value === "number") {
2653
+ return `${value}${defaultUnit}`;
2654
+ }
2655
+ return value;
2656
+ }
2657
+ __name(toString, "toString");
2658
+ CssLength2.toString = toString;
2648
2659
  function extractUnit(cssLength) {
2649
2660
  const match = /[a-z%]+$/i.exec(cssLength);
2650
2661
  const lengt = match ? match[0] : null;