vueless 0.0.194 → 0.0.196

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.
@@ -162,6 +162,7 @@ function getMergedConfig({ defaultConfig, globalConfig, propsConfig, vuelessStra
162
162
  @param {Object} propsConfig
163
163
  @param {Object} config - final merged config.
164
164
  @param {boolean} isReplace - enables class replacement instead of merge.
165
+ @param {boolean} isVarinants - if true, prevents adding a "base" key into nested objects.
165
166
 
166
167
  @returns {Object}
167
168
  */
@@ -171,6 +172,7 @@ function mergeConfigs({
171
172
  propsConfig,
172
173
  config = {},
173
174
  isReplace = false,
175
+ isVariants = false,
174
176
  }) {
175
177
  globalConfig = cloneDeep(globalConfig || {});
176
178
  propsConfig = cloneDeep(propsConfig || {});
@@ -213,7 +215,7 @@ function mergeConfigs({
213
215
  } else if (key === safelist || key === safelistColors) {
214
216
  if (propsConfig[key]) {
215
217
  // eslint-disable-next-line no-console
216
- console.warn(`Passing '${key}' key by 'config' prop is not allowed.`);
218
+ console.warn(`Passing '${key}' key in 'config' prop is not allowed.`);
217
219
  }
218
220
  } else if (key === defaultVariants) {
219
221
  config[key] = { ...defaultConfig[key], ...globalConfig[key], ...propsConfig[key] };
@@ -235,14 +237,19 @@ function mergeConfigs({
235
237
  const isIconName = key.includes(iconName) || key.includes(iconNameCapitalize);
236
238
  const isI18n = key === i18n;
237
239
 
240
+ if (key === "variants" && !isVariants) {
241
+ isVariants = true;
242
+ }
243
+
238
244
  config[key] =
239
245
  isObject && !isEmpty && !isI18n
240
246
  ? mergeConfigs({
241
- defaultConfig: stringToObject(composedConfig[key]),
242
- globalConfig: stringToObject(globalConfig[key]),
243
- propsConfig: stringToObject(propsConfig[key]),
244
- config: stringToObject(composedConfig[key]),
247
+ defaultConfig: stringToObject(composedConfig[key], { addBase: !isVariants }),
248
+ globalConfig: stringToObject(globalConfig[key], { addBase: !isVariants }),
249
+ propsConfig: stringToObject(propsConfig[key], { addBase: !isVariants }),
250
+ config: stringToObject(composedConfig[key], { addBase: !isVariants }),
245
251
  isReplace,
252
+ isVariants,
246
253
  })
247
254
  : isReplace || isIconName || isI18n
248
255
  ? propsConfig[key] || globalConfig[key] || defaultConfig[key]
@@ -257,14 +264,15 @@ function mergeConfigs({
257
264
  }
258
265
 
259
266
  /**
260
- Turn simplified nested component config to regular config.
261
- @param {Object | String} value
262
- @returns {Object}
267
+ Turn simplified nested component config to regular config.
268
+ @param {Object | String} value
269
+ @param {Boolean} addBase
270
+ @returns {Object}
263
271
  */
264
- function stringToObject(value) {
272
+ function stringToObject(value, { addBase = false }) {
265
273
  if (value === undefined) value = "";
266
274
 
267
- return typeof value === "object" ? value : { base: value };
275
+ return typeof value !== "object" ? addBase && { base: value } : value;
268
276
  }
269
277
 
270
278
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.194",
3
+ "version": "0.0.196",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.194",
4
+ "version": "0.0.196",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",