vueless 0.0.668 → 0.0.669

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": "vueless",
3
- "version": "0.0.668",
3
+ "version": "0.0.669",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
@@ -23,16 +23,15 @@ import { COMPONENT_NAME } from "./constants.ts";
23
23
  import { vClickOutside } from "../directives";
24
24
 
25
25
  import type { ComputedRef } from "vue";
26
- import type { UDatePickerProps, Config, Locale } from "./types.ts";
26
+ import type { Props, Config, Locale } from "./types.ts";
27
27
  import type { ComponentExposed } from "../types.ts";
28
28
  import type { Config as UCalendarConfig } from "../ui.form-calendar/types.ts";
29
29
  import type { DateLocale } from "../ui.form-calendar/utilFormatting.ts";
30
30
 
31
31
  defineOptions({ inheritAttrs: false });
32
32
 
33
- type Props = UDatePickerProps<TModelValue>;
34
- const props = withDefaults(defineProps<Props>(), {
35
- ...getDefaults<Props, Config>(defaultConfig, COMPONENT_NAME),
33
+ const props = withDefaults(defineProps<Props<TModelValue>>(), {
34
+ ...getDefaults<Props<TModelValue>, Config>(defaultConfig, COMPONENT_NAME),
36
35
  modelValue: undefined,
37
36
  minDate: undefined,
38
37
  maxDate: undefined,
@@ -12,13 +12,13 @@ import URow from "../../ui.container-row/URow.vue";
12
12
 
13
13
  import { COMPONENT_NAME } from "../constants.ts";
14
14
 
15
- import type { UDatePickerProps } from "../types.ts";
15
+ import type { Props } from "../types.ts";
16
16
 
17
- interface DefaultUDatePickerArgs extends UDatePickerProps<unknown> {
17
+ interface DefaultUDatePickerArgs extends Props<unknown> {
18
18
  slotTemplate?: string;
19
19
  }
20
20
 
21
- interface EnumUDatePickerArgs extends UDatePickerProps<unknown> {
21
+ interface EnumUDatePickerArgs extends Props<unknown> {
22
22
  slotTemplate?: string;
23
23
  enum: "size";
24
24
  }
@@ -5,7 +5,7 @@ import type { ComponentConfig } from "../types.ts";
5
5
  export type Locale = typeof defaultConfig.i18n;
6
6
  export type Config = typeof defaultConfig;
7
7
 
8
- export interface UDatePickerProps<TModelValue> {
8
+ export interface Props<TModelValue> {
9
9
  /**
10
10
  * Calendar value (JavaScript Date object or string formatted in given `dateFormat` or object when `range` enabled).
11
11
  */
@@ -11,7 +11,7 @@ const CLOSING_BRACKET = "}";
11
11
  const IGNORE_PROP = "@ignore";
12
12
  const CUSTOM_PROP = "@custom";
13
13
 
14
- const PROPS_INTERFACE_REG_EXP = /export\s+interface\s+Props\s*{([^}]*)}/s;
14
+ const PROPS_INTERFACE_REG_EXP = /export\s+interface\s+Props(?:<\w+>)?\s*{([^}]*)}/s;
15
15
  const UNION_SYMBOLS_REG_EXP = /[?|:"|;]/g;
16
16
  const WORD_IN_QUOTE_REG_EXP = /"([^"]+)"/g;
17
17
 
@@ -129,6 +129,11 @@ async function modifyComponentTypes(filePath, props) {
129
129
  const defaultOptionalMark = lines[propIndex]?.includes(OPTIONAL_MARK) ? OPTIONAL_MARK : "";
130
130
  const optionalMark = required === undefined ? defaultOptionalMark : userOptionalMark;
131
131
 
132
+ const isExtendOnly = lines
133
+ .slice(propIndex - 2, propIndex)
134
+ .join("")
135
+ .includes("@extendOnly");
136
+
132
137
  const propDescription = description?.replaceAll(/[\n\s]+/g, " ").trim() || "–"; // removes new lines and double spaces.
133
138
  const propType = unionType.length ? unionType : type;
134
139
 
@@ -142,14 +147,14 @@ async function modifyComponentTypes(filePath, props) {
142
147
 
143
148
  /* Check if the prop type already exists. */
144
149
  if (~propIndex) {
145
- if (unionType.length && isAssignableValue) {
150
+ if (unionType.length && (isAssignableValue || !isExtendOnly)) {
146
151
  // Remove multiline union types;
147
152
  lines.splice(propIndex + 1, propEndIndex);
148
153
 
149
154
  lines.splice(propIndex, 1, ` ${name}${defaultOptionalMark}: ${propType};`);
150
155
  }
151
156
 
152
- if (unionType.length && !isAssignableValue) {
157
+ if (unionType.length && isExtendOnly && !isAssignableValue) {
153
158
  // eslint-disable-next-line no-console
154
159
  console.warn(`${unionType} is not assignable to type ${defaultUnionType}.`);
155
160
  }