@varlet/ui 3.7.2 → 3.7.4-alpha.1734454650011

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.
@@ -3,5 +3,5 @@ import '../../icon/icon.css'
3
3
  import '../../ripple/ripple.css'
4
4
  import '../../popup/popup.css'
5
5
  import '../actionSheet.css'
6
- import '../ActionItemSfc.css'
7
6
  import '../ActionSheetSfc.css'
7
+ import '../ActionItemSfc.css'
@@ -1,5 +1,5 @@
1
1
  import { useParent } from "@varlet/use";
2
- import { error } from "../utils/logger.mjs";
2
+ import { assert } from "@varlet/shared";
3
3
  import {
4
4
  BOTTOM_NAVIGATION_BIND_BOTTOM_NAVIGATION_ITEM_KEY
5
5
  } from "../bottom-navigation/provide.mjs";
@@ -7,9 +7,7 @@ function useBottomNavigation() {
7
7
  const { parentProvider, index, bindParent } = useParent(
8
8
  BOTTOM_NAVIGATION_BIND_BOTTOM_NAVIGATION_ITEM_KEY
9
9
  );
10
- if (!bindParent) {
11
- error("BottomNavigationItem", "<var-bottom-navigation-item/> must in <var-bottom-navigation/>");
12
- }
10
+ assert(!!bindParent, "BottomNavigationItem", "<var-bottom-navigation-item/> must in <var-bottom-navigation/>");
13
11
  return {
14
12
  index,
15
13
  bottomNavigation: parentProvider,
@@ -1,13 +1,11 @@
1
1
  import { useParent } from "@varlet/use";
2
- import { error } from "../utils/logger.mjs";
2
+ import { assert } from "@varlet/shared";
3
3
  import { BREADCRUMBS_BIND_BREADCRUMB_ITEM_KEY } from "../breadcrumbs/provide.mjs";
4
4
  function useBreadcrumb() {
5
5
  const { parentProvider, bindParent, index } = useParent(
6
6
  BREADCRUMBS_BIND_BREADCRUMB_ITEM_KEY
7
7
  );
8
- if (!bindParent) {
9
- error("Breadcrumb", "<var-breadcrumb/> must in <var-breadcrumbs/>");
10
- }
8
+ assert(!!bindParent, "Breadcrumb", "<var-breadcrumb/> must in <var-breadcrumbs/>");
11
9
  return {
12
10
  index,
13
11
  breadcrumb: parentProvider,
@@ -1,13 +1,11 @@
1
1
  import { useParent } from "@varlet/use";
2
- import { error } from "../utils/logger.mjs";
2
+ import { assert } from "@varlet/shared";
3
3
  import { COLLAPSE_BIND_COLLAPSE_ITEM_KEY } from "../collapse/provide.mjs";
4
4
  function useCollapse() {
5
5
  const { parentProvider, index, bindParent } = useParent(
6
6
  COLLAPSE_BIND_COLLAPSE_ITEM_KEY
7
7
  );
8
- if (!bindParent) {
9
- error("Collapse", "<var-collapse-item/> must in <var-collapse>");
10
- }
8
+ assert(!!bindParent, "Collapse", "<var-collapse-item/> must in <var-collapse>");
11
9
  return {
12
10
  index,
13
11
  collapse: parentProvider,
@@ -28,7 +28,7 @@ import {
28
28
  MONTH_LIST,
29
29
  WEEK_HEADER
30
30
  } from "./props.mjs";
31
- import { isArray, toNumber, doubleRaf, call } from "@varlet/shared";
31
+ import { isArray, toNumber, doubleRaf, call, error } from "@varlet/shared";
32
32
  import { createNamespace, formatElevation } from "../utils/components.mjs";
33
33
  import { padStart } from "../utils/shared.mjs";
34
34
  import { t } from "../locale/index.mjs";
@@ -562,19 +562,21 @@ const __sfc__ = defineComponent({
562
562
  }
563
563
  function checkValue() {
564
564
  if ((props2.multiple || props2.range) && !isArray(props2.modelValue)) {
565
- console.error('[Varlet] DatePicker: type of prop "modelValue" should be an Array');
565
+ error("DatePicker", 'type of prop "modelValue" should be an Array');
566
566
  return false;
567
567
  }
568
568
  if (!props2.multiple && !props2.range && isArray(props2.modelValue)) {
569
- console.error('[Varlet] DatePicker: type of prop "modelValue" should be a String');
569
+ error("DatePicker", 'type of prop "modelValue" should be a String');
570
570
  return false;
571
571
  }
572
572
  return true;
573
573
  }
574
574
  function invalidFormatDate(date) {
575
- if (isArray(date)) return false;
575
+ if (isArray(date)) {
576
+ return false;
577
+ }
576
578
  if (date === "Invalid Date") {
577
- console.error('[Varlet] DatePicker: "modelValue" is an Invalid Date');
579
+ error("DatePicker", '"modelValue" is an Invalid Date');
578
580
  return true;
579
581
  }
580
582
  return false;
@@ -1,13 +1,11 @@
1
1
  import { useParent } from "@varlet/use";
2
- import { error } from "../utils/logger.mjs";
2
+ import { assert } from "@varlet/shared";
3
3
  import { INDEX_BAR_BIND_INDEX_ANCHOR_KEY } from "../index-bar/provide.mjs";
4
4
  function useIndexBar() {
5
5
  const { parentProvider, index, bindParent } = useParent(
6
6
  INDEX_BAR_BIND_INDEX_ANCHOR_KEY
7
7
  );
8
- if (!bindParent) {
9
- error("IndexAnchor", 'You should use this component in "IndexBar"');
10
- }
8
+ assert(!!bindParent, "IndexAnchor", 'You should use this component in "IndexBar"');
11
9
  return {
12
10
  index,
13
11
  indexBar: parentProvider,
@@ -280,7 +280,7 @@ import './tooltip/style/index.mjs'
280
280
  import './uploader/style/index.mjs'
281
281
  import './watermark/style/index.mjs'
282
282
 
283
- const version = '3.7.2'
283
+ const version = '3.7.4-alpha.1734454650011'
284
284
 
285
285
  function install(app) {
286
286
  ActionSheet.install && app.use(ActionSheet)
package/es/index.mjs CHANGED
@@ -186,7 +186,7 @@ export * from './tooltip/index.mjs'
186
186
  export * from './uploader/index.mjs'
187
187
  export * from './watermark/index.mjs'
188
188
 
189
- const version = '3.7.2'
189
+ const version = '3.7.4-alpha.1734454650011'
190
190
 
191
191
  function install(app) {
192
192
  ActionSheet.install && app.use(ActionSheet)
@@ -1,13 +1,11 @@
1
1
  import { useParent } from "@varlet/use";
2
- import { error } from "../utils/logger.mjs";
2
+ import { assert } from "@varlet/shared";
3
3
  import { MENU_SELECT_BIND_MENU_OPTION_KEY } from "../menu-select/provide.mjs";
4
4
  function useMenuSelect() {
5
5
  const { index, parentProvider, bindParent } = useParent(
6
6
  MENU_SELECT_BIND_MENU_OPTION_KEY
7
7
  );
8
- if (!bindParent) {
9
- error("MenuOption", "<var-menu-option/> must in <var-menu-select/>");
10
- }
8
+ assert(!!bindParent, "MenuOption", "<var-menu-option/> must in <var-menu-select/>");
11
9
  return {
12
10
  index,
13
11
  menuSelect: parentProvider,
@@ -1,11 +1,9 @@
1
1
  import { useParent } from "@varlet/use";
2
- import { error } from "../utils/logger.mjs";
2
+ import { assert } from "@varlet/shared";
3
3
  import { SELECT_BIND_OPTION_KEY } from "../select/provide.mjs";
4
4
  function useSelect() {
5
5
  const { index, parentProvider, bindParent } = useParent(SELECT_BIND_OPTION_KEY);
6
- if (!bindParent) {
7
- error("Option", "<var-option/> must in <var-select/>");
8
- }
6
+ assert(!!bindParent, "Option", "<var-option/> must in <var-select/>");
9
7
  return {
10
8
  index,
11
9
  select: parentProvider,
@@ -1,13 +1,13 @@
1
- import { defineComponent, Teleport, Transition, mergeProps as _mergeProps, createVNode as _createVNode } from "vue";
1
+ import { defineComponent, Teleport, Transition, createVNode as _createVNode, mergeProps as _mergeProps } from "vue";
2
2
  import { props } from "./props.mjs";
3
3
  import { useLock } from "../context/lock.mjs";
4
4
  import { useZIndex } from "../context/zIndex.mjs";
5
5
  import { createNamespace, useTeleport } from "../utils/components.mjs";
6
6
  import { call, preventDefault } from "@varlet/shared";
7
-
8
-
9
7
  import { useStack } from "../context/stack.mjs";
10
8
  import { useEventListener } from "@varlet/use";
9
+
10
+
11
11
  const {
12
12
  name,
13
13
  n
@@ -22,7 +22,7 @@ var stdin_default = defineComponent({
22
22
  }) {
23
23
  const {
24
24
  zIndex
25
- } = useZIndex(() => props2.show, 1);
25
+ } = useZIndex(() => props2.show, 3);
26
26
  const {
27
27
  onStackTop
28
28
  } = useStack(() => props2.show, zIndex);
@@ -50,11 +50,20 @@ var stdin_default = defineComponent({
50
50
  return _createVNode("div", _mergeProps({
51
51
  "class": n(),
52
52
  "style": {
53
- zIndex: zIndex.value
53
+ zIndex: zIndex.value - 2
54
54
  }
55
- }, attrs, {
55
+ }, attrs), [_createVNode("div", {
56
+ "class": n("overlay"),
57
+ "style": {
58
+ zIndex: zIndex.value - 1
59
+ },
56
60
  "onClick": handleClickOverlay
57
- }), [call(slots.default)]);
61
+ }, null), _createVNode("div", {
62
+ "class": n("content"),
63
+ "style": {
64
+ zIndex: zIndex.value
65
+ }
66
+ }, [call(slots.default)])]);
58
67
  }
59
68
  function renderTransitionOverlay() {
60
69
  return _createVNode(Transition, {
@@ -1 +1 @@
1
- :root { --overlay-background-color: rgba(0, 0, 0, 0.6);}.var-overlay { display: flex; justify-content: center; align-items: center; position: fixed; top: 0; right: 0; bottom: 0; left: 0; background-color: var(--overlay-background-color); transition: all 0.25s;}.var-overlay--fade-enter-from,.var-overlay--fade-leave-to { opacity: 0;}.var-overlay--fade-enter-active,.var-overlay--fade-leave-active { transition: opacity 0.25s;}
1
+ :root { --overlay-background-color: rgba(0, 0, 0, 0.6);}.var-overlay { display: flex; justify-content: center; align-items: center; position: fixed; top: 0; right: 0; bottom: 0; left: 0;}.var-overlay--fade-enter-from,.var-overlay--fade-leave-to { opacity: 0;}.var-overlay--fade-enter-active,.var-overlay--fade-leave-active { transition: opacity 0.25s;}.var-overlay__overlay { position: fixed; top: 0; right: 0; bottom: 0; left: 0; background-color: var(--overlay-background-color);}.var-overlay__content { position: relative;}
@@ -1 +1 @@
1
- :root { --popup-content-background-color: var(--color-surface-container-low); --popup-overlay-background-color: rgba(0, 0, 0, 0.6);}.var-fade-enter-from,.var-fade-leave-to { opacity: 0;}.var-fade-enter-active,.var-fade-leave-active { transition: opacity 0.25s;}.var-pop-center-enter-from,.var-pop-center-leave-to { transform: scale(0.3);}.var-pop-center-enter-active,.var-pop-center-leave-active { transition: all 0.25s;}.var-pop-bottom-enter-from,.var-pop-bottom-leave-to { transform: translateY(100%);}.var-pop-bottom-enter-active,.var-pop-bottom-leave-active { transition: all 0.25s;}.var-pop-top-enter-from,.var-pop-top-leave-to { transform: translateY(-100%);}.var-pop-top-enter-active,.var-pop-top-leave-active { transition: all 0.25s;}.var-pop-left-enter-from,.var-pop-left-leave-to { transform: translateX(-100%);}.var-pop-left-enter-active,.var-pop-left-leave-active { transition: all 0.25s;}.var-pop-right-enter-from,.var-pop-right-leave-to { transform: translateX(100%);}.var-pop-right-enter-active,.var-pop-right-leave-active { transition: all 0.25s;}.var-popup { display: flex; justify-content: center; align-items: center; position: fixed; top: 0; right: 0; bottom: 0; left: 0; overflow: auto; scrollbar-width: none;}.var-popup__overlay { display: flex; justify-content: center; align-items: center; position: fixed; top: 0; right: 0; bottom: 0; left: 0; background-color: var(--popup-overlay-background-color); transition: all 0.25s;}.var-popup__content { overflow: auto; transition: all 0.25s; pointer-events: auto;}.var-popup--content-background-color { background-color: var(--popup-content-background-color);}.var-popup--center { position: relative;}.var-popup--bottom { width: 100%; position: absolute; left: 0; bottom: 0;}.var-popup--top { width: 100%; position: absolute; left: 0; top: 0;}.var-popup--left { height: 100%; position: absolute; left: 0; top: 0;}.var-popup--right { height: 100%; position: absolute; right: 0; top: 0;}.var-popup--safe-area { padding-bottom: constant(safe-area-inset-bottom); padding-bottom: env(safe-area-inset-bottom);}.var-popup--safe-area-top { padding-top: constant(safe-area-inset-top); padding-top: env(safe-area-inset-top);}.var-popup--pointer-events-none { pointer-events: none;}
1
+ :root { --popup-content-background-color: var(--color-surface-container-low); --popup-overlay-background-color: rgba(0, 0, 0, 0.6);}.var-fade-enter-from,.var-fade-leave-to { opacity: 0;}.var-fade-enter-active,.var-fade-leave-active { transition: opacity 0.25s;}.var-pop-center-enter-from,.var-pop-center-leave-to { transform: scale(0.3);}.var-pop-center-enter-active,.var-pop-center-leave-active { transition: all 0.25s;}.var-pop-bottom-enter-from,.var-pop-bottom-leave-to { transform: translateY(100%);}.var-pop-bottom-enter-active,.var-pop-bottom-leave-active { transition: all 0.25s;}.var-pop-top-enter-from,.var-pop-top-leave-to { transform: translateY(-100%);}.var-pop-top-enter-active,.var-pop-top-leave-active { transition: all 0.25s;}.var-pop-left-enter-from,.var-pop-left-leave-to { transform: translateX(-100%);}.var-pop-left-enter-active,.var-pop-left-leave-active { transition: all 0.25s;}.var-pop-right-enter-from,.var-pop-right-leave-to { transform: translateX(100%);}.var-pop-right-enter-active,.var-pop-right-leave-active { transition: all 0.25s;}.var-popup { display: flex; justify-content: center; align-items: center; position: fixed; top: 0; right: 0; bottom: 0; left: 0; overflow: auto; scrollbar-width: none;}.var-popup__overlay { position: fixed; top: 0; right: 0; bottom: 0; left: 0; background-color: var(--popup-overlay-background-color); transition: all 0.25s;}.var-popup__content { overflow: auto; transition: all 0.25s; pointer-events: auto;}.var-popup--content-background-color { background-color: var(--popup-content-background-color);}.var-popup--center { position: relative;}.var-popup--bottom { width: 100%; position: absolute; left: 0; bottom: 0;}.var-popup--top { width: 100%; position: absolute; left: 0; top: 0;}.var-popup--left { height: 100%; position: absolute; left: 0; top: 0;}.var-popup--right { height: 100%; position: absolute; right: 0; top: 0;}.var-popup--safe-area { padding-bottom: constant(safe-area-inset-bottom); padding-bottom: env(safe-area-inset-bottom);}.var-popup--safe-area-top { padding-top: constant(safe-area-inset-top); padding-top: env(safe-area-inset-top);}.var-popup--pointer-events-none { pointer-events: none;}
@@ -5,13 +5,12 @@ import VarOption from "../option/index.mjs";
5
5
  import VarFieldDecorator from "../field-decorator/index.mjs";
6
6
  import VarFormDetails from "../form-details/index.mjs";
7
7
  import { computed, defineComponent, ref, watch, nextTick } from "vue";
8
- import { isArray, isEmpty, call, preventDefault, doubleRaf, isFunction } from "@varlet/shared";
8
+ import { isArray, isEmpty, call, preventDefault, doubleRaf, isFunction, assert } from "@varlet/shared";
9
9
  import { props } from "./props.mjs";
10
10
  import { useValidation, createNamespace, MaybeVNode } from "../utils/components.mjs";
11
11
  import { useOptions } from "./provide.mjs";
12
12
  import { useForm } from "../form/provide.mjs";
13
13
  import { focusChildElementByKey, toPxNum } from "../utils/elements.mjs";
14
- import { error } from "../utils/logger.mjs";
15
14
  import { useSelectController } from "./useSelectController.mjs";
16
15
  import { useEventListener } from "@varlet/use";
17
16
  const { name, n, classes } = createNamespace("select");
@@ -325,10 +324,11 @@ const __sfc__ = defineComponent({
325
324
  watch(
326
325
  () => props2.multiple,
327
326
  () => {
328
- const { multiple: multiple2, modelValue } = props2;
329
- if (multiple2 && !isArray(modelValue)) {
330
- error("Select", "The modelValue must be an array when multiple is true");
331
- }
327
+ assert(
328
+ props2.multiple && isArray(props2.modelValue),
329
+ "Select",
330
+ "The modelValue must be an array when multiple is true"
331
+ );
332
332
  }
333
333
  );
334
334
  bindOptions(selectProvider);
@@ -5,8 +5,7 @@ import { defineComponent, ref, onBeforeUnmount, computed, reactive, nextTick, wa
5
5
  import { useValidation, createNamespace } from "../utils/components.mjs";
6
6
  import { useForm } from "../form/provide.mjs";
7
7
  import { getLeft, toSizeUnit } from "../utils/elements.mjs";
8
- import { warn } from "../utils/logger.mjs";
9
- import { isArray, isNumber, toNumber, getRect, preventDefault, call, hasOwn, clamp } from "@varlet/shared";
8
+ import { isArray, isNumber, toNumber, getRect, preventDefault, call, hasOwn, clamp, error, warn } from "@varlet/shared";
10
9
  import { props, Thumbs } from "./props.mjs";
11
10
  import { onSmartMounted, onWindowResize, useEventListener } from "@varlet/use";
12
11
  const { name, n, classes } = createNamespace("slider");
@@ -449,7 +448,7 @@ const __sfc__ = defineComponent({
449
448
  }
450
449
  function stepValidator() {
451
450
  if (toNumber(props2.step) <= 0) {
452
- warn("[Varlet] Slider", '"step" should be > 0');
451
+ warn("Slider", '"step" should be > 0');
453
452
  return false;
454
453
  }
455
454
  return true;
@@ -457,15 +456,15 @@ const __sfc__ = defineComponent({
457
456
  function valueValidator() {
458
457
  const { range, modelValue } = props2;
459
458
  if (range && !isArray(modelValue)) {
460
- console.error('[Varlet] Slider: "modelValue" should be an Array');
459
+ error("Slider", '"modelValue" should be an Array');
461
460
  return false;
462
461
  }
463
462
  if (!range && isArray(modelValue)) {
464
- console.error('[Varlet] Slider: "modelValue" should be a Number');
463
+ error("Slider", '"modelValue" should be a Number');
465
464
  return false;
466
465
  }
467
466
  if (range && isArray(modelValue) && modelValue.length < 2) {
468
- console.error('[Varlet] Slider: "modelValue" should have two value');
467
+ error("Slider", '"modelValue" should have two value');
469
468
  return false;
470
469
  }
471
470
  return true;
@@ -1,7 +1,7 @@
1
1
  import '../../styles/common.css'
2
- import '../SnackbarSfc.css'
3
2
  import '../../styles/elevation.css'
4
3
  import '../../loading/loading.css'
5
4
  import '../../icon/icon.css'
6
5
  import '../snackbar.css'
7
6
  import '../coreSfc.css'
7
+ import '../SnackbarSfc.css'
@@ -1,11 +1,9 @@
1
1
  import { useParent } from "@varlet/use";
2
- import { error } from "../utils/logger.mjs";
2
+ import { assert } from "@varlet/shared";
3
3
  import { STEPS_BIND_STEP_KEY } from "../steps/provide.mjs";
4
4
  function useSteps() {
5
5
  const { parentProvider, index, bindParent } = useParent(STEPS_BIND_STEP_KEY);
6
- if (!bindParent) {
7
- error("Steps", "<step/> must in <steps>");
8
- }
6
+ assert(!!bindParent, "Steps", "<step/> must in <steps>");
9
7
  return {
10
8
  index,
11
9
  steps: parentProvider,