@varlet/ui 2.11.6 → 2.11.8

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/lib/varlet.cjs.js CHANGED
@@ -610,6 +610,15 @@ function onWindowResize(listener) {
610
610
  useEventListener(() => window, "resize", listener, { passive: true });
611
611
  useEventListener(() => window, "orientationchange", listener, { passive: true });
612
612
  }
613
+ function useInitialized(source, value) {
614
+ const initialized = vue.ref(false);
615
+ vue.watch(source, (newValue) => {
616
+ if (value === newValue) {
617
+ initialized.value = true;
618
+ }
619
+ }, { immediate: true });
620
+ return initialized;
621
+ }
613
622
  function asyncGeneratorStep$d(gen, resolve, reject, _next, _throw, key, arg) {
614
623
  try {
615
624
  var info = gen[key](arg);
@@ -1156,6 +1165,31 @@ function useZIndex(source, count) {
1156
1165
  zIndex
1157
1166
  };
1158
1167
  }
1168
+ var POPUP_BIND_POPUP_ITEM_KEY = Symbol("POPUP_BIND_POPUP_ITEM_KEY");
1169
+ function usePopup() {
1170
+ var {
1171
+ bindParent,
1172
+ parentProvider,
1173
+ index
1174
+ } = useParent(POPUP_BIND_POPUP_ITEM_KEY);
1175
+ return {
1176
+ index,
1177
+ popup: parentProvider,
1178
+ bindPopup: bindParent
1179
+ };
1180
+ }
1181
+ function usePopupItems() {
1182
+ var {
1183
+ bindChildren,
1184
+ childProviders,
1185
+ length
1186
+ } = useChildren(POPUP_BIND_POPUP_ITEM_KEY);
1187
+ return {
1188
+ length,
1189
+ popupItems: childProviders,
1190
+ bindPopupItems: bindChildren
1191
+ };
1192
+ }
1159
1193
  function _extends$n() {
1160
1194
  _extends$n = Object.assign ? Object.assign.bind() : function(target) {
1161
1195
  for (var i = 1; i < arguments.length; i++) {
@@ -1186,12 +1220,16 @@ const Popup = vue.defineComponent({
1186
1220
  slots,
1187
1221
  attrs
1188
1222
  } = _ref;
1223
+ var rendered = useInitialized(() => props2.show, true);
1189
1224
  var {
1190
1225
  zIndex
1191
1226
  } = useZIndex(() => props2.show, 3);
1192
1227
  var {
1193
1228
  disabled
1194
1229
  } = useTeleport();
1230
+ var {
1231
+ bindPopupItems
1232
+ } = usePopupItems();
1195
1233
  var hidePopup = () => {
1196
1234
  var {
1197
1235
  closeOnClickOverlay,
@@ -1203,11 +1241,6 @@ const Popup = vue.defineComponent({
1203
1241
  }
1204
1242
  call(props2["onUpdate:show"], false);
1205
1243
  };
1206
- useLock(() => props2.show, () => props2.lockScroll);
1207
- vue.watch(() => props2.show, (newValue) => {
1208
- newValue ? call(props2.onOpen) : call(props2.onClose);
1209
- });
1210
- useRouteListener(() => call(props2.onRouteChange));
1211
1244
  var renderOverlay = () => {
1212
1245
  var {
1213
1246
  overlayClass = "",
@@ -1222,50 +1255,51 @@ const Popup = vue.defineComponent({
1222
1255
  }, null);
1223
1256
  };
1224
1257
  var renderContent = () => {
1225
- return vue.createVNode("div", vue.mergeProps({
1258
+ return vue.withDirectives(vue.createVNode("div", vue.mergeProps({
1226
1259
  "class": classes$14(n$1h("content"), n$1h("--" + props2.position), [props2.defaultStyle, n$1h("--content-background-color")], [props2.defaultStyle, n$1h("$-elevation--3")], [props2.safeArea, n$1h("--safe-area")], [props2.safeAreaTop, n$1h("--safe-area-top")]),
1227
1260
  "style": {
1228
1261
  zIndex: zIndex.value
1229
1262
  }
1230
- }, attrs), [call(slots.default)]);
1263
+ }, attrs), [rendered.value && call(slots.default)]), [[vue.vShow, props2.show]]);
1231
1264
  };
1232
1265
  var renderPopup = () => {
1233
- var {
1234
- onOpened,
1235
- onClosed,
1236
- show,
1237
- overlay: overlay2,
1238
- transition,
1239
- position
1240
- } = props2;
1266
+ var _slot;
1241
1267
  return vue.createVNode(vue.Transition, {
1242
1268
  "name": n$1h("$-fade"),
1243
- "onAfterEnter": onOpened,
1244
- "onAfterLeave": onClosed
1269
+ "onAfterEnter": props2.onOpened,
1270
+ "onAfterLeave": props2.onClosed
1245
1271
  }, {
1246
1272
  default: () => [vue.withDirectives(vue.createVNode("div", {
1247
1273
  "class": classes$14(n$1h("$--box"), n$1h()),
1248
1274
  "style": {
1249
1275
  zIndex: zIndex.value - 2
1250
1276
  }
1251
- }, [overlay2 && renderOverlay(), vue.createVNode(vue.Transition, {
1252
- "name": transition || n$1h("$-pop-" + position)
1253
- }, {
1254
- default: () => [show && renderContent()]
1255
- })]), [[vue.vShow, show]])]
1277
+ }, [props2.overlay && renderOverlay(), vue.createVNode(vue.Transition, {
1278
+ "name": props2.transition || n$1h("$-pop-" + props2.position)
1279
+ }, _isSlot$3(_slot = renderContent()) ? _slot : {
1280
+ default: () => [_slot]
1281
+ })]), [[vue.vShow, props2.show]])]
1256
1282
  });
1257
1283
  };
1284
+ useLock(() => props2.show, () => props2.lockScroll);
1285
+ vue.watch(() => props2.show, (newValue) => {
1286
+ newValue ? call(props2.onOpen) : call(props2.onClose);
1287
+ });
1288
+ bindPopupItems({
1289
+ show: vue.computed(() => props2.show)
1290
+ });
1291
+ useRouteListener(() => call(props2.onRouteChange));
1258
1292
  return () => {
1259
1293
  var {
1260
1294
  teleport
1261
1295
  } = props2;
1262
1296
  if (teleport) {
1263
- var _slot;
1297
+ var _slot2;
1264
1298
  return vue.createVNode(vue.Teleport, {
1265
1299
  "to": teleport,
1266
1300
  "disabled": disabled.value
1267
- }, _isSlot$3(_slot = renderPopup()) ? _slot : {
1268
- default: () => [_slot]
1301
+ }, _isSlot$3(_slot2 = renderPopup()) ? _slot2 : {
1302
+ default: () => [_slot2]
1269
1303
  });
1270
1304
  }
1271
1305
  return renderPopup();
@@ -14215,6 +14249,10 @@ var __sfc__$I = vue.defineComponent({
14215
14249
  bindSwipeItems,
14216
14250
  length
14217
14251
  } = useSwipeItems();
14252
+ var {
14253
+ popup: popup2,
14254
+ bindPopup
14255
+ } = usePopup();
14218
14256
  var initializedIndex = false;
14219
14257
  var touching = false;
14220
14258
  var timer = -1;
@@ -14481,11 +14519,27 @@ var __sfc__$I = vue.defineComponent({
14481
14519
  vertical
14482
14520
  };
14483
14521
  bindSwipeItems(swipeProvider);
14522
+ call(bindPopup, null);
14484
14523
  vue.watch(() => length.value, /* @__PURE__ */ _asyncToGenerator$7(function* () {
14485
14524
  yield doubleRaf();
14486
14525
  initialIndex();
14487
14526
  resize();
14488
14527
  }));
14528
+ if (popup2) {
14529
+ vue.watch(() => popup2.show.value, /* @__PURE__ */ function() {
14530
+ var _ref3 = _asyncToGenerator$7(function* (show) {
14531
+ if (show) {
14532
+ yield doubleRaf();
14533
+ resize();
14534
+ } else {
14535
+ stopAutoplay();
14536
+ }
14537
+ });
14538
+ return function(_x) {
14539
+ return _ref3.apply(this, arguments);
14540
+ };
14541
+ }());
14542
+ }
14489
14543
  vue.onActivated(resize);
14490
14544
  onSmartUnmounted(stopAutoplay);
14491
14545
  onWindowResize(resize);
@@ -23828,6 +23882,9 @@ const avatar$1 = {
23828
23882
  const link$1 = {
23829
23883
  "--link-default-color": "#fff"
23830
23884
  };
23885
+ const progress$1 = {
23886
+ "--progress-label-color": "#fff"
23887
+ };
23831
23888
  function _extends() {
23832
23889
  _extends = Object.assign ? Object.assign.bind() : function(target) {
23833
23890
  for (var i = 1; i < arguments.length; i++) {
@@ -23853,7 +23910,7 @@ const dark = _extends({
23853
23910
  "--color-danger": "#ef5350",
23854
23911
  "--color-disabled": "#404040",
23855
23912
  "--color-text-disabled": "#757575"
23856
- }, button$1, cell$1, card$1, timePicker$1, datePicker$1, skeleton$1, tabs$1, tab$1, popup$1, dialog$1, actionSheet$1, chip$1, badge$1, uploader$1, collapse, pullRefresh$1, switchThemes, steps, pagination$1, table$1, fieldDecorator$1, select$1, radio$1, checkbox$1, divider$1, picker$1, appBar$1, bottomNavigation$1, bottomNavigationItem$1, menu$1, result$1, breadcrumb$1, paper$1, avatar$1, link$1);
23913
+ }, button$1, cell$1, card$1, timePicker$1, datePicker$1, skeleton$1, tabs$1, tab$1, popup$1, dialog$1, actionSheet$1, chip$1, badge$1, uploader$1, collapse, pullRefresh$1, switchThemes, steps, pagination$1, table$1, fieldDecorator$1, select$1, radio$1, checkbox$1, divider$1, picker$1, appBar$1, bottomNavigation$1, bottomNavigationItem$1, menu$1, result$1, breadcrumb$1, paper$1, avatar$1, link$1, progress$1);
23857
23914
  var Themes = {
23858
23915
  dark
23859
23916
  };
@@ -25547,7 +25604,7 @@ const TimePickerSfc = "";
25547
25604
  const TooltipSfc = "";
25548
25605
  const uploader = "";
25549
25606
  const UploaderSfc = "";
25550
- const version = "2.11.6";
25607
+ const version = "2.11.8";
25551
25608
  function install(app) {
25552
25609
  ActionSheet.install && app.use(ActionSheet);
25553
25610
  AppBar.install && app.use(AppBar);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varlet/ui",
3
- "version": "2.11.6",
3
+ "version": "2.11.8",
4
4
  "description": "A material like components library",
5
5
  "main": "lib/varlet.cjs.js",
6
6
  "module": "es/index.mjs",
@@ -46,9 +46,9 @@
46
46
  "@popperjs/core": "^2.11.6",
47
47
  "dayjs": "^1.10.4",
48
48
  "decimal.js": "^10.2.1",
49
- "@varlet/use": "2.11.6",
50
- "@varlet/icons": "2.11.6",
51
- "@varlet/shared": "2.11.6"
49
+ "@varlet/shared": "2.11.8",
50
+ "@varlet/icons": "2.11.8",
51
+ "@varlet/use": "2.11.8"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@vue/runtime-core": "3.3.1",
@@ -63,8 +63,8 @@
63
63
  "typescript": "^4.4.4",
64
64
  "vue": "3.3.2",
65
65
  "vue-router": "4.2.0",
66
- "@varlet/cli": "2.11.6",
67
- "@varlet/touch-emulator": "2.11.6"
66
+ "@varlet/cli": "2.11.8",
67
+ "@varlet/touch-emulator": "2.11.8"
68
68
  },
69
69
  "browserslist": [
70
70
  "Chrome >= 54",