snail.vue 1.0.22 → 1.0.24

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.
@@ -1,4 +1,4 @@
1
- import { AlignStyle, SizeOptions } from 'snail.style';
1
+ import { AlignStyle, SizeOptions } from 'snail.view';
2
2
  import * as vue from 'vue';
3
3
  import { Component, App, Ref, ShallowRef } from 'vue';
4
4
  import { IScope } from 'snail.core';
@@ -549,73 +549,6 @@ declare function triggerAppCreated(app: App): App;
549
549
  */
550
550
  declare function getSvgIcon(options: IconOptions): IconPathOptions;
551
551
 
552
- /**
553
- * 监视器 模块:封装便捷方法做监听,并在不支持浏览器下做垫片
554
- * - 和 VueUse 库很像,但只封装自己需要的
555
- * - 内部变量不使用响应式,那样外部需要 传入el时内部需要兼容useTemplateRef逻辑,这个交给外部处理更灵活
556
- * - ResizeObserver 监听元素大小变化
557
- */
558
-
559
- /**
560
- * 使用作用域
561
- * - 内部管理多个子作用域,在destroy时自动执行子作用域的destroy方法
562
- * - 在vue的setup中使用时,vue组件销毁时,自动销毁作用域
563
- * @returns 销毁方法,add 添加子作用域
564
- */
565
- declare function useScopes(): IScope & {
566
- add: (scope: IScope) => void;
567
- };
568
- /**
569
- * 监听Interval执行
570
- * - 内部使用 setInterval 实现
571
- * @param fn 执行方法
572
- * @param delay 间隔,单位:ms
573
- * @param args fn执行时传递参数
574
- * @returns destroy 停止fn执行
575
- */
576
- declare function onInterval(fn: (...args: any[]) => void, delay?: number, ...args: any[]): IScope;
577
- /**
578
- * 监听Timeout执行
579
- * - 内部使用 setTimeout 实现
580
- * @param fn 执行方法
581
- * @param delay 延时,单位:ms
582
- * @param args fn执行时传递参数
583
- * @returns destroy 停止fn执行;若fn已执行则无效
584
- */
585
- declare function onTimeout(fn: (...args: any[]) => void, delay?: number, ...args: any[]): IScope;
586
- /**
587
- * 监听事件
588
- * - 内部使用addEventListener 方法监听事件,销毁时自动执行removeEventListener
589
- * @param target 监听元素
590
- * @param name 事件名称
591
- * @param fn 事件处理方法
592
- * @returns destroy 销毁监听
593
- */
594
- declare function onEvent(target: Element | Window, name: string, fn: EventListenerOrEventListenerObject): IScope;
595
- /**
596
- * 监听元素尺寸变化
597
- * @param el 监听元素
598
- * @param fn 尺寸变化时的回调方法
599
- * @returns destroy 销毁监听
600
- */
601
- declare function onResize(el: Element, fn: (size: Readonly<{
602
- width: number;
603
- height: number;
604
- }>) => void): IScope;
605
- /**
606
- * 监听元素客户端位置、大小变化
607
- * - 位置计算规则:相对window屏幕
608
- * @param el 监听元素
609
- * @param fn
610
- * @returns destroy 销毁监听
611
- */
612
- declare function onRerect(el: Element, fn: (rect: DOMRectReadOnly) => void): IScope;
613
-
614
- /**
615
- * 动画相应时样式类型
616
- */
617
- type AnimationRefStyle = Partial<CSSStyleDeclaration>;
618
-
619
552
  /**
620
553
  * 响应式助手类,封装一些响应式相关的工具方法
621
554
  */
@@ -632,21 +565,6 @@ type AnimationRefStyle = Partial<CSSStyleDeclaration>;
632
565
  * @returns 新创建的作用域对象
633
566
  */
634
567
  declare function scopeRef<T>(rv: Ref<T> | ShallowRef<T>, start: T, end: T, dealy?: number): IScope;
635
- /**
636
- * 动画ref,方法执行逻辑:
637
- * - 1、初始动画,设置styleRef起始值:styleRef.value = start
638
- * - 2、开始动画,设置styleRef目标值:styleRef.value = target
639
- * - 3、结束动画,设置styleRef最终值:styleRef.value = end
640
- * - 备注示例:外部自己控制动画效果,这里只操作样式值
641
- * - 1、设置height动画效果(0-100,1s动画结束后清理height值):animationRef(styleRef,1000,{height:0},{height:"100px",{}})
642
- * @param styleRef 动画样式ref对象
643
- * @param start 初始动画style样式
644
- * @param target 目标动画style样式
645
- * @param aTime 动画时间,单位ms,延迟 aTime后执行【结束动画】操作,不传入则忽略【结束动画】操作
646
- * @param end 结束动画style样式;不传入则忽略【结束动画】操作
647
- * @returns 作用域对象,destroy 方法直接执行【结束动画】操作
648
- */
649
- declare function animationRef(styleRef: ShallowRef<AnimationRefStyle>, start: AnimationRefStyle, target: AnimationRefStyle, aTime?: number, end?: AnimationRefStyle): IScope;
650
568
 
651
569
  /**
652
570
  * 模态弹窗显示的组件配置选项
@@ -1124,5 +1042,5 @@ declare const components: {
1124
1042
  */
1125
1043
  declare function mount(options: ComponentMountOptions, onDestroyed?: (fn: () => void) => void): IScope;
1126
1044
 
1127
- export { animationRef, components, confirm, getSvgIcon, mount, onAppCreated, onEvent, onInterval, onRerect, onResize, onTimeout, openDialog, scopeDialog, scopeRef, toast, triggerAppCreated, useScopes };
1045
+ export { components, confirm, getSvgIcon, mount, onAppCreated, openDialog, scopeDialog, scopeRef, toast, triggerAppCreated };
1128
1046
  export type { ButtonOptions, ComponentMountOptions, ComponentOptions, ConfirmHandle, ConfirmOptions, Dialog, DialogHandle, DialogOpenResult, DialogOptions, DragVerifyInfo, DragVerifyOptions, EmptyOptions, FoldEvents, FoldOptions, FoldStatus, FooterEvents, FooterOptions, HeaderEvents, HeaderOptions, IconOptions, IconPathOptions, IconType, InputEvents, InputOptions, LoadingOptions, ScrollEvents, ScrollOptions, ScrollTouchType, SwitchEvents, SwitchOptions, TableColOptions, TableOptions, TableRowOptions, TableStyleOptions, ToastHandle, ToastOptions };
package/dist/snail.vue.js CHANGED
@@ -1,7 +1,7 @@
1
1
  //@ sourceURL=/snail.vue.js
2
- import { defineComponent, createElementBlock, openBlock, normalizeClass, renderSlot, createTextVNode, createBlock, createCommentVNode, toDisplayString, createElementVNode, normalizeProps, guardReactiveProps, unref, computed, mergeProps, mergeModels, useModel, getCurrentScope, onScopeDispose, Transition, withCtx, ref, shallowRef, watch, onErrorCaptured, onActivated, onDeactivated, Fragment, resolveDynamicComponent, createSlots, renderList, useTemplateRef, onUnmounted, normalizeStyle, createVNode, TransitionGroup, withModifiers, createApp, onMounted } from 'vue';
3
- import { tidyString, throwError, mustString, style, mustFunction, throwIfFalse, isStringNotEmpty, isObject, script, delay, getMessage, hook, mustObject, defer, newId, isFunction } from 'snail.core';
4
- import { getSizeStyle, getAlignStyle } from 'snail.style';
2
+ import { defineComponent, createElementBlock, openBlock, normalizeClass, renderSlot, createTextVNode, createBlock, createCommentVNode, toDisplayString, createElementVNode, normalizeProps, guardReactiveProps, unref, computed, mergeProps, mergeModels, useModel, Transition, withCtx, ref, shallowRef, watch, onErrorCaptured, onActivated, onDeactivated, Fragment, resolveDynamicComponent, createSlots, renderList, useTemplateRef, onUnmounted, createVNode, normalizeStyle, TransitionGroup, withModifiers, createApp, onMounted } from 'vue';
3
+ import { tidyString, throwError, mustString, mustFunction, useScope, isStringNotEmpty, isObject, script, delay, getMessage, useHook, mustObject, defer, newId, isFunction } from 'snail.core';
4
+ import { link, useAnimation, style, useObserver } from 'snail.view';
5
5
 
6
6
  var _sfc_main$h = defineComponent({
7
7
  ...{
@@ -135,7 +135,7 @@ var _sfc_main$f = defineComponent({
135
135
  }
136
136
  });
137
137
 
138
- var addLink = href => setTimeout(style.register, 0, href);
138
+ var addLink = href => setTimeout(link.register, 0, href);
139
139
 
140
140
  addLink("/styles/snail.vue.vue.css");
141
141
 
@@ -246,150 +246,21 @@ const appCreatedFns = [];
246
246
  function onAppCreated(fn) {
247
247
  mustFunction(fn, "fn");
248
248
  appCreatedFns.push(fn);
249
- return {
250
- destroy: () => {
251
- const index = appCreatedFns.indexOf(fn);
252
- index >= 0 && appCreatedFns.splice(index, 1);
253
- }
254
- };
249
+ return useScope().onDestroy(() => {
250
+ const index = appCreatedFns.indexOf(fn);
251
+ index >= 0 && appCreatedFns.splice(index, 1);
252
+ });
255
253
  }
256
254
  function triggerAppCreated(app) {
257
255
  appCreatedFns.forEach(fn => fn(app));
258
256
  return app;
259
257
  }
260
258
 
261
- function tryOnScopeDispose(fn) {
262
- if (getCurrentScope()) {
263
- onScopeDispose(fn);
264
- return true;
265
- }
266
- return false;
267
- }
268
- function useScopes() {
269
- const scopes = [];
270
- const destroy = () => scopes.forEach(scope => scope.destroy());
271
- tryOnScopeDispose(destroy);
272
- function add(scope) {
273
- onScope(scope, () => {
274
- const index = scopes.indexOf(scope);
275
- index >= 0 && scopes.splice(index, 1);
276
- });
277
- scopes.push(scope);
278
- }
279
- return {
280
- add,
281
- destroy
282
- };
283
- }
284
- function onScope(scope, destroy) {
285
- mustFunction((scope || {}).destroy, "onScope: scope.destroy");
286
- mustFunction(destroy, "onScope: destroy");
287
- const origin = scope.destroy;
288
- scope.destroy = function () {
289
- origin();
290
- destroy();
291
- };
292
- }
293
- function onInterval(fn, delay) {
294
- mustFunction(fn, "onInterval: fn");
295
- for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
296
- args[_key - 2] = arguments[_key];
297
- }
298
- const timer = setInterval(fn, delay, ...args);
299
- return {
300
- destroy: () => clearInterval(timer)
301
- };
302
- }
303
- function onTimeout(fn, delay) {
304
- mustFunction(fn, "onTimeout: fn");
305
- for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
306
- args[_key2 - 2] = arguments[_key2];
307
- }
308
- const timer = setTimeout(fn, delay, ...args);
309
- return {
310
- destroy: () => clearTimeout(timer)
311
- };
312
- }
313
- function onEvent(target, name, fn) {
314
- throwIfFalse(target instanceof Element || target === window, "onEvent: target must be Element or Window");
315
- mustString(name, "onEvent: name");
316
- mustFunction(fn, "onEvent: fn");
317
- target.addEventListener(name, fn);
318
- return {
319
- destroy: () => target.removeEventListener(name, fn)
320
- };
321
- }
322
- function onResize(el, fn) {
323
- throwIfFalse(el instanceof Element, "onResize: el must be Element.");
324
- var isDestroy = false;
325
- var preSize = void 0;
326
- function calcSize() {
327
- if (isDestroy == true) {
328
- resizeObserver && resizeObserver.disconnect();
329
- timer && clearInterval(timer);
330
- return;
331
- }
332
- const rect = el.getBoundingClientRect();
333
- const isChange = preSize == void 0 || preSize.width != rect.width || preSize.height != rect.height;
334
- if (isChange == true) {
335
- preSize = Object.freeze({
336
- width: rect.width,
337
- height: rect.height
338
- });
339
- fn(preSize);
340
- }
341
- }
342
- const resizeObserver = "ResizeObserver" in window ? new ResizeObserver(calcSize) : void 0;
343
- const timer = resizeObserver ? resizeObserver.observe(el) : setInterval(calcSize, 100);
344
- calcSize();
345
- return {
346
- destroy: () => isDestroy = true
347
- };
348
- }
349
- function onRerect(el, fn) {
350
- throwIfFalse(el instanceof Element, "onRect: el must be Element.");
351
- var isDestroy = false;
352
- var preRect = void 0;
353
- function calcRect() {
354
- if (isDestroy == true) {
355
- clearInterval(timer);
356
- return;
357
- }
358
- const rect = el.getBoundingClientRect();
359
- const isChange = preRect == void 0 || rect.x != preRect.x || rect.y != preRect.y || rect.width != preRect.width || rect.height != preRect.height;
360
- if (isChange == true) {
361
- preRect = DOMRectReadOnly.fromRect(rect);
362
- fn(preRect);
363
- }
364
- }
365
- const timer = setInterval(calcRect, 100);
366
- calcRect();
367
- return {
368
- destroy: () => isDestroy = true
369
- };
370
- }
371
-
372
259
  function scopeRef(rv, start, end, dealy) {
373
260
  rv.value = start;
374
- const destroy = () => rv.value = end;
375
- return dealy > 0 ? {
376
- destroy: () => setTimeout(destroy, dealy)
377
- } : {
378
- destroy
379
- };
380
- }
381
- function animationRef(styleRef, start, target, aTime, end) {
382
- styleRef.value = start;
383
- const st = setTimeout(() => styleRef.value = target, 1);
384
- const ct = aTime != void 0 && end != void 0 ? setTimeout(() => styleRef.value = end, aTime) : void 0;
385
- function destroy() {
386
- clearTimeout(st);
387
- ct && clearTimeout(ct);
388
- styleRef.value = end;
389
- }
390
- return {
391
- destroy
392
- };
261
+ return useScope().onDestroy(() => {
262
+ dealy > 0 ? setTimeout(() => rv.value = end, dealy) : rv.value = end;
263
+ });
393
264
  }
394
265
 
395
266
  var _sfc_main$c = defineComponent({
@@ -522,6 +393,10 @@ const _hoisted_4$1 = {
522
393
  class: "status"
523
394
  };
524
395
  const _hoisted_5$1 = ["title"];
396
+ const _hoisted_6 = {
397
+ class: "fold-body",
398
+ ref: "foldBody"
399
+ };
525
400
  var _sfc_main$a = defineComponent({
526
401
  ...{
527
402
  name: "Fold",
@@ -547,22 +422,45 @@ var _sfc_main$a = defineComponent({
547
422
  } = _ref;
548
423
  const props = __props;
549
424
  const emit = __emit;
425
+ const animationScope = useAnimation();
550
426
  const status = useModel(__props, "status");
551
- const statusWatch = watch(status, calcFoldStyle);
427
+ const statusWatch = watch(status, updateFoldStyle);
552
428
  const statusIcon = getFoldStatusDraw();
553
- const foldBodyRef = useTemplateRef("foldBodyRef");
554
- const foldStyleRef = shallowRef(Object.create(null));
555
- function calcFoldStyle() {
429
+ const foldStatusSpanRef = useTemplateRef("foldStatusSpan");
430
+ const foldBodyRef = useTemplateRef("foldBody");
431
+ function updateFoldStyle() {
432
+ const isExpand = status.value == "expand";
433
+ if (foldStatusSpanRef.value) {
434
+ animationScope.transition(foldStatusSpanRef.value, {
435
+ from: {
436
+ transition: "transform 0.2s ease",
437
+ transform: isExpand ? "rotateZ(180deg)" : "rotate(0)"
438
+ },
439
+ to: {
440
+ transform: isExpand ? "rotate(0)" : "rotateZ(180deg)"
441
+ },
442
+ end: {
443
+ transform: isExpand ? "" : "rotateZ(180deg)"
444
+ }
445
+ });
446
+ }
556
447
  if (foldBodyRef.value) {
557
448
  const minHeight = 32;
558
449
  const maxHeight = minHeight + foldBodyRef.value.getBoundingClientRect().height;
559
- animationRef(foldStyleRef, {
560
- height: `${status.value == "expand" ? minHeight : maxHeight}px`,
561
- overflow: "hidden"
562
- }, {
563
- height: `${status.value == "expand" ? maxHeight : minHeight}px`,
564
- overflow: "hidden"
565
- }, 200, Object.create(null));
450
+ animationScope.transition(foldBodyRef.value.parentElement, {
451
+ from: {
452
+ transition: "height 0.2s ease",
453
+ overflow: "hidden",
454
+ height: `${isExpand ? minHeight : maxHeight}px`
455
+ },
456
+ to: {
457
+ height: `${isExpand ? maxHeight : minHeight}px`
458
+ },
459
+ end: {
460
+ overflow: isExpand ? "" : "hidden",
461
+ height: isExpand ? "" : `${minHeight}px`
462
+ }
463
+ });
566
464
  }
567
465
  }
568
466
  function onStatusClick() {
@@ -578,11 +476,13 @@ var _sfc_main$a = defineComponent({
578
476
  }
579
477
  emit("change", status.value);
580
478
  }
581
- onUnmounted(() => statusWatch.stop());
479
+ onUnmounted(() => {
480
+ animationScope.destroy();
481
+ statusWatch.stop();
482
+ });
582
483
  return (_ctx, _cache) => {
583
484
  return openBlock(), createElementBlock("div", {
584
- class: normalizeClass(["snail-fold", status.value]),
585
- style: normalizeStyle(foldStyleRef.value)
485
+ class: normalizeClass(["snail-fold", status.value])
586
486
  }, [createElementVNode("div", _hoisted_1$7, [renderSlot(_ctx.$slots, "header", {}, () => [createElementVNode("div", {
587
487
  class: "title",
588
488
  textContent: toDisplayString(props.title)
@@ -591,16 +491,13 @@ var _sfc_main$a = defineComponent({
591
491
  class: "subtitle",
592
492
  textContent: toDisplayString(props.subtitle)
593
493
  }, null, 8, _hoisted_3$2)) : createCommentVNode("", true), props.disable != true ? (openBlock(), createElementBlock("div", _hoisted_4$1, [createElementVNode("span", {
594
- title: status.value == "expand" ? "收起" : "展开"
494
+ title: status.value == "expand" ? "收起" : "展开",
495
+ ref: "foldStatusSpan"
595
496
  }, [createVNode(_sfc_main$f, {
596
497
  type: "custom",
597
498
  draw: unref(statusIcon),
598
499
  onClick: onStatusClick
599
- }, null, 8, ["draw"])], 8, _hoisted_5$1)])) : createCommentVNode("", true)])]), createElementVNode("div", {
600
- class: "fold-body",
601
- ref_key: "foldBodyRef",
602
- ref: foldBodyRef
603
- }, [renderSlot(_ctx.$slots, "default")], 512)], 6);
500
+ }, null, 8, ["draw"])], 8, _hoisted_5$1)])) : createCommentVNode("", true)])]), createElementVNode("div", _hoisted_6, [renderSlot(_ctx.$slots, "default")], 512)], 2);
604
501
  };
605
502
  }
606
503
  });
@@ -846,19 +743,17 @@ function openDialog(options, onDestroyed) {
846
743
  }
847
744
  async function scopeDialog(options, scopeRef) {
848
745
  scopeRef.value && scopeRef.value.destroy();
849
- scopeRef.value = {
850
- destroy() {
851
- scopeRef.value = void 0;
852
- ret.destroy();
853
- }
854
- };
746
+ scopeRef.value = useScope().onDestroy(() => {
747
+ scopeRef.value = void 0;
748
+ ret.destroy();
749
+ });
855
750
  const ret = openDialog(options);
856
751
  const data = await ret;
857
752
  scopeRef.value = void 0;
858
753
  return data;
859
754
  }
860
755
  const descriptors = ref([]);
861
- const dialogHook = hook.newScope();
756
+ const dialogHook = useHook();
862
757
  const createDialogHookCode = dialog => `onCloseDialog:${dialog.id}`;
863
758
  function destroyDialog(dialog) {
864
759
  const index = descriptors.value.indexOf(dialog);
@@ -887,12 +782,10 @@ const initVueApp = (() => {
887
782
  })();
888
783
 
889
784
  function getTitleStyle(options, isFlex) {
890
- const style = Object.create(null);
891
- if (options.titleStyle) {
892
- getSizeStyle(style, options.titleStyle, "width", isFlex);
893
- getAlignStyle(style, options.titleStyle, isFlex);
894
- }
895
- return style;
785
+ return options && options.titleStyle ? style.build({
786
+ ...options.titleStyle,
787
+ width: options.titleStyle
788
+ }, isFlex) : Object.create(null);
896
789
  }
897
790
 
898
791
  const _hoisted_1$4 = ["textContent"];
@@ -1008,8 +901,8 @@ var _sfc_main$3 = defineComponent({
1008
901
  width: 0,
1009
902
  height: 0
1010
903
  });
1011
- const scopes = useScopes();
1012
904
  var destroyTimer;
905
+ const observer = useObserver();
1013
906
  function onMouseEvent(isLeave) {
1014
907
  destroyTimer && clearTimeout(destroyTimer);
1015
908
  destroyTimer = void 0;
@@ -1020,12 +913,12 @@ var _sfc_main$3 = defineComponent({
1020
913
  setTimeout(props.close, 200);
1021
914
  }
1022
915
  onMounted(() => {
1023
- scopes.add(onResize(toastRef.value, size => toastSize.value = size));
916
+ observer.onSize(toastRef.value, size => toastSize.value = size);
1024
917
  destroyTimer = setTimeout(onToastClose, 2e3);
1025
918
  showToast.value = true;
1026
919
  });
1027
920
  onUnmounted(() => {
1028
- scopes.destroy();
921
+ observer.destroy();
1029
922
  destroyTimer && clearTimeout(destroyTimer);
1030
923
  });
1031
924
  return (_ctx, _cache) => {
@@ -1314,13 +1207,9 @@ function mount(options, onDestroyed) {
1314
1207
  });
1315
1208
  triggerAppCreated(app);
1316
1209
  app.mount(options.target);
1317
- function destroy() {
1318
- app.unmount();
1319
- }
1320
- isFunction(onDestroyed) && onDestroyed(destroy);
1321
- return {
1322
- destroy
1323
- };
1210
+ const scope = useScope().onDestroy(() => app.unmount());
1211
+ isFunction(onDestroyed) && onDestroyed(scope.destroy);
1212
+ return scope;
1324
1213
  }
1325
1214
 
1326
- export { animationRef, components, confirm, getSvgIcon, mount, onAppCreated, onEvent, onInterval, onRerect, onResize, onTimeout, openDialog, scopeDialog, scopeRef, toast, triggerAppCreated, useScopes };
1215
+ export { components, confirm, getSvgIcon, mount, onAppCreated, openDialog, scopeDialog, scopeRef, toast, triggerAppCreated };
@@ -1,9 +1,9 @@
1
1
  //@ sourceURL=/snail.vue.js
2
2
  (function (global, factory) {
3
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('snail.core'), require('snail.style')) :
4
- typeof define === 'function' && define.amd ? define(['exports', 'vue', 'snail.core', 'snail.style'], factory) :
5
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.SnailVue = global.SnailVue || {}, global.Vue, global.Snail, global.SnailStyle));
6
- })(this, (function (exports, vue, snail_core, snail_style) { 'use strict';
3
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('snail.core'), require('snail.view')) :
4
+ typeof define === 'function' && define.amd ? define(['exports', 'vue', 'snail.core', 'snail.view'], factory) :
5
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.SnailVue = global.SnailVue || {}, global.Vue, global.Snail, global.SnailView));
6
+ })(this, (function (exports, vue, snail_core, snail_view) { 'use strict';
7
7
 
8
8
  var _sfc_main$h = vue.defineComponent({
9
9
  ...{
@@ -244,150 +244,21 @@
244
244
  function onAppCreated(fn) {
245
245
  snail_core.mustFunction(fn, "fn");
246
246
  appCreatedFns.push(fn);
247
- return {
248
- destroy: () => {
249
- const index = appCreatedFns.indexOf(fn);
250
- index >= 0 && appCreatedFns.splice(index, 1);
251
- }
252
- };
247
+ return snail_core.useScope().onDestroy(() => {
248
+ const index = appCreatedFns.indexOf(fn);
249
+ index >= 0 && appCreatedFns.splice(index, 1);
250
+ });
253
251
  }
254
252
  function triggerAppCreated(app) {
255
253
  appCreatedFns.forEach(fn => fn(app));
256
254
  return app;
257
255
  }
258
256
 
259
- function tryOnScopeDispose(fn) {
260
- if (vue.getCurrentScope()) {
261
- vue.onScopeDispose(fn);
262
- return true;
263
- }
264
- return false;
265
- }
266
- function useScopes() {
267
- const scopes = [];
268
- const destroy = () => scopes.forEach(scope => scope.destroy());
269
- tryOnScopeDispose(destroy);
270
- function add(scope) {
271
- onScope(scope, () => {
272
- const index = scopes.indexOf(scope);
273
- index >= 0 && scopes.splice(index, 1);
274
- });
275
- scopes.push(scope);
276
- }
277
- return {
278
- add,
279
- destroy
280
- };
281
- }
282
- function onScope(scope, destroy) {
283
- snail_core.mustFunction((scope || {}).destroy, "onScope: scope.destroy");
284
- snail_core.mustFunction(destroy, "onScope: destroy");
285
- const origin = scope.destroy;
286
- scope.destroy = function () {
287
- origin();
288
- destroy();
289
- };
290
- }
291
- function onInterval(fn, delay) {
292
- snail_core.mustFunction(fn, "onInterval: fn");
293
- for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
294
- args[_key - 2] = arguments[_key];
295
- }
296
- const timer = setInterval(fn, delay, ...args);
297
- return {
298
- destroy: () => clearInterval(timer)
299
- };
300
- }
301
- function onTimeout(fn, delay) {
302
- snail_core.mustFunction(fn, "onTimeout: fn");
303
- for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
304
- args[_key2 - 2] = arguments[_key2];
305
- }
306
- const timer = setTimeout(fn, delay, ...args);
307
- return {
308
- destroy: () => clearTimeout(timer)
309
- };
310
- }
311
- function onEvent(target, name, fn) {
312
- snail_core.throwIfFalse(target instanceof Element || target === window, "onEvent: target must be Element or Window");
313
- snail_core.mustString(name, "onEvent: name");
314
- snail_core.mustFunction(fn, "onEvent: fn");
315
- target.addEventListener(name, fn);
316
- return {
317
- destroy: () => target.removeEventListener(name, fn)
318
- };
319
- }
320
- function onResize(el, fn) {
321
- snail_core.throwIfFalse(el instanceof Element, "onResize: el must be Element.");
322
- var isDestroy = false;
323
- var preSize = void 0;
324
- function calcSize() {
325
- if (isDestroy == true) {
326
- resizeObserver && resizeObserver.disconnect();
327
- timer && clearInterval(timer);
328
- return;
329
- }
330
- const rect = el.getBoundingClientRect();
331
- const isChange = preSize == void 0 || preSize.width != rect.width || preSize.height != rect.height;
332
- if (isChange == true) {
333
- preSize = Object.freeze({
334
- width: rect.width,
335
- height: rect.height
336
- });
337
- fn(preSize);
338
- }
339
- }
340
- const resizeObserver = "ResizeObserver" in window ? new ResizeObserver(calcSize) : void 0;
341
- const timer = resizeObserver ? resizeObserver.observe(el) : setInterval(calcSize, 100);
342
- calcSize();
343
- return {
344
- destroy: () => isDestroy = true
345
- };
346
- }
347
- function onRerect(el, fn) {
348
- snail_core.throwIfFalse(el instanceof Element, "onRect: el must be Element.");
349
- var isDestroy = false;
350
- var preRect = void 0;
351
- function calcRect() {
352
- if (isDestroy == true) {
353
- clearInterval(timer);
354
- return;
355
- }
356
- const rect = el.getBoundingClientRect();
357
- const isChange = preRect == void 0 || rect.x != preRect.x || rect.y != preRect.y || rect.width != preRect.width || rect.height != preRect.height;
358
- if (isChange == true) {
359
- preRect = DOMRectReadOnly.fromRect(rect);
360
- fn(preRect);
361
- }
362
- }
363
- const timer = setInterval(calcRect, 100);
364
- calcRect();
365
- return {
366
- destroy: () => isDestroy = true
367
- };
368
- }
369
-
370
257
  function scopeRef(rv, start, end, dealy) {
371
258
  rv.value = start;
372
- const destroy = () => rv.value = end;
373
- return dealy > 0 ? {
374
- destroy: () => setTimeout(destroy, dealy)
375
- } : {
376
- destroy
377
- };
378
- }
379
- function animationRef(styleRef, start, target, aTime, end) {
380
- styleRef.value = start;
381
- const st = setTimeout(() => styleRef.value = target, 1);
382
- const ct = aTime != void 0 && end != void 0 ? setTimeout(() => styleRef.value = end, aTime) : void 0;
383
- function destroy() {
384
- clearTimeout(st);
385
- ct && clearTimeout(ct);
386
- styleRef.value = end;
387
- }
388
- return {
389
- destroy
390
- };
259
+ return snail_core.useScope().onDestroy(() => {
260
+ dealy > 0 ? setTimeout(() => rv.value = end, dealy) : rv.value = end;
261
+ });
391
262
  }
392
263
 
393
264
  var _sfc_main$c = vue.defineComponent({
@@ -520,6 +391,10 @@
520
391
  class: "status"
521
392
  };
522
393
  const _hoisted_5$1 = ["title"];
394
+ const _hoisted_6 = {
395
+ class: "fold-body",
396
+ ref: "foldBody"
397
+ };
523
398
  var _sfc_main$a = vue.defineComponent({
524
399
  ...{
525
400
  name: "Fold",
@@ -545,22 +420,45 @@
545
420
  } = _ref;
546
421
  const props = __props;
547
422
  const emit = __emit;
423
+ const animationScope = snail_view.useAnimation();
548
424
  const status = vue.useModel(__props, "status");
549
- const statusWatch = vue.watch(status, calcFoldStyle);
425
+ const statusWatch = vue.watch(status, updateFoldStyle);
550
426
  const statusIcon = getFoldStatusDraw();
551
- const foldBodyRef = vue.useTemplateRef("foldBodyRef");
552
- const foldStyleRef = vue.shallowRef(Object.create(null));
553
- function calcFoldStyle() {
427
+ const foldStatusSpanRef = vue.useTemplateRef("foldStatusSpan");
428
+ const foldBodyRef = vue.useTemplateRef("foldBody");
429
+ function updateFoldStyle() {
430
+ const isExpand = status.value == "expand";
431
+ if (foldStatusSpanRef.value) {
432
+ animationScope.transition(foldStatusSpanRef.value, {
433
+ from: {
434
+ transition: "transform 0.2s ease",
435
+ transform: isExpand ? "rotateZ(180deg)" : "rotate(0)"
436
+ },
437
+ to: {
438
+ transform: isExpand ? "rotate(0)" : "rotateZ(180deg)"
439
+ },
440
+ end: {
441
+ transform: isExpand ? "" : "rotateZ(180deg)"
442
+ }
443
+ });
444
+ }
554
445
  if (foldBodyRef.value) {
555
446
  const minHeight = 32;
556
447
  const maxHeight = minHeight + foldBodyRef.value.getBoundingClientRect().height;
557
- animationRef(foldStyleRef, {
558
- height: `${status.value == "expand" ? minHeight : maxHeight}px`,
559
- overflow: "hidden"
560
- }, {
561
- height: `${status.value == "expand" ? maxHeight : minHeight}px`,
562
- overflow: "hidden"
563
- }, 200, Object.create(null));
448
+ animationScope.transition(foldBodyRef.value.parentElement, {
449
+ from: {
450
+ transition: "height 0.2s ease",
451
+ overflow: "hidden",
452
+ height: `${isExpand ? minHeight : maxHeight}px`
453
+ },
454
+ to: {
455
+ height: `${isExpand ? maxHeight : minHeight}px`
456
+ },
457
+ end: {
458
+ overflow: isExpand ? "" : "hidden",
459
+ height: isExpand ? "" : `${minHeight}px`
460
+ }
461
+ });
564
462
  }
565
463
  }
566
464
  function onStatusClick() {
@@ -576,11 +474,13 @@
576
474
  }
577
475
  emit("change", status.value);
578
476
  }
579
- vue.onUnmounted(() => statusWatch.stop());
477
+ vue.onUnmounted(() => {
478
+ animationScope.destroy();
479
+ statusWatch.stop();
480
+ });
580
481
  return (_ctx, _cache) => {
581
482
  return vue.openBlock(), vue.createElementBlock("div", {
582
- class: vue.normalizeClass(["snail-fold", status.value]),
583
- style: vue.normalizeStyle(foldStyleRef.value)
483
+ class: vue.normalizeClass(["snail-fold", status.value])
584
484
  }, [vue.createElementVNode("div", _hoisted_1$7, [vue.renderSlot(_ctx.$slots, "header", {}, () => [vue.createElementVNode("div", {
585
485
  class: "title",
586
486
  textContent: vue.toDisplayString(props.title)
@@ -589,16 +489,13 @@
589
489
  class: "subtitle",
590
490
  textContent: vue.toDisplayString(props.subtitle)
591
491
  }, null, 8, _hoisted_3$2)) : vue.createCommentVNode("", true), props.disable != true ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$1, [vue.createElementVNode("span", {
592
- title: status.value == "expand" ? "收起" : "展开"
492
+ title: status.value == "expand" ? "收起" : "展开",
493
+ ref: "foldStatusSpan"
593
494
  }, [vue.createVNode(_sfc_main$f, {
594
495
  type: "custom",
595
496
  draw: vue.unref(statusIcon),
596
497
  onClick: onStatusClick
597
- }, null, 8, ["draw"])], 8, _hoisted_5$1)])) : vue.createCommentVNode("", true)])]), vue.createElementVNode("div", {
598
- class: "fold-body",
599
- ref_key: "foldBodyRef",
600
- ref: foldBodyRef
601
- }, [vue.renderSlot(_ctx.$slots, "default")], 512)], 6);
498
+ }, null, 8, ["draw"])], 8, _hoisted_5$1)])) : vue.createCommentVNode("", true)])]), vue.createElementVNode("div", _hoisted_6, [vue.renderSlot(_ctx.$slots, "default")], 512)], 2);
602
499
  };
603
500
  }
604
501
  });
@@ -844,19 +741,17 @@
844
741
  }
845
742
  async function scopeDialog(options, scopeRef) {
846
743
  scopeRef.value && scopeRef.value.destroy();
847
- scopeRef.value = {
848
- destroy() {
849
- scopeRef.value = void 0;
850
- ret.destroy();
851
- }
852
- };
744
+ scopeRef.value = snail_core.useScope().onDestroy(() => {
745
+ scopeRef.value = void 0;
746
+ ret.destroy();
747
+ });
853
748
  const ret = openDialog(options);
854
749
  const data = await ret;
855
750
  scopeRef.value = void 0;
856
751
  return data;
857
752
  }
858
753
  const descriptors = vue.ref([]);
859
- const dialogHook = snail_core.hook.newScope();
754
+ const dialogHook = snail_core.useHook();
860
755
  const createDialogHookCode = dialog => `onCloseDialog:${dialog.id}`;
861
756
  function destroyDialog(dialog) {
862
757
  const index = descriptors.value.indexOf(dialog);
@@ -885,12 +780,10 @@
885
780
  })();
886
781
 
887
782
  function getTitleStyle(options, isFlex) {
888
- const style = Object.create(null);
889
- if (options.titleStyle) {
890
- snail_style.getSizeStyle(style, options.titleStyle, "width", isFlex);
891
- snail_style.getAlignStyle(style, options.titleStyle, isFlex);
892
- }
893
- return style;
783
+ return options && options.titleStyle ? snail_view.style.build({
784
+ ...options.titleStyle,
785
+ width: options.titleStyle
786
+ }, isFlex) : Object.create(null);
894
787
  }
895
788
 
896
789
  const _hoisted_1$4 = ["textContent"];
@@ -1006,8 +899,8 @@
1006
899
  width: 0,
1007
900
  height: 0
1008
901
  });
1009
- const scopes = useScopes();
1010
902
  var destroyTimer;
903
+ const observer = snail_view.useObserver();
1011
904
  function onMouseEvent(isLeave) {
1012
905
  destroyTimer && clearTimeout(destroyTimer);
1013
906
  destroyTimer = void 0;
@@ -1018,12 +911,12 @@
1018
911
  setTimeout(props.close, 200);
1019
912
  }
1020
913
  vue.onMounted(() => {
1021
- scopes.add(onResize(toastRef.value, size => toastSize.value = size));
914
+ observer.onSize(toastRef.value, size => toastSize.value = size);
1022
915
  destroyTimer = setTimeout(onToastClose, 2e3);
1023
916
  showToast.value = true;
1024
917
  });
1025
918
  vue.onUnmounted(() => {
1026
- scopes.destroy();
919
+ observer.destroy();
1027
920
  destroyTimer && clearTimeout(destroyTimer);
1028
921
  });
1029
922
  return (_ctx, _cache) => {
@@ -1312,31 +1205,20 @@
1312
1205
  });
1313
1206
  triggerAppCreated(app);
1314
1207
  app.mount(options.target);
1315
- function destroy() {
1316
- app.unmount();
1317
- }
1318
- snail_core.isFunction(onDestroyed) && onDestroyed(destroy);
1319
- return {
1320
- destroy
1321
- };
1208
+ const scope = snail_core.useScope().onDestroy(() => app.unmount());
1209
+ snail_core.isFunction(onDestroyed) && onDestroyed(scope.destroy);
1210
+ return scope;
1322
1211
  }
1323
1212
 
1324
- exports.animationRef = animationRef;
1325
1213
  exports.components = components;
1326
1214
  exports.confirm = confirm;
1327
1215
  exports.getSvgIcon = getSvgIcon;
1328
1216
  exports.mount = mount;
1329
1217
  exports.onAppCreated = onAppCreated;
1330
- exports.onEvent = onEvent;
1331
- exports.onInterval = onInterval;
1332
- exports.onRerect = onRerect;
1333
- exports.onResize = onResize;
1334
- exports.onTimeout = onTimeout;
1335
1218
  exports.openDialog = openDialog;
1336
1219
  exports.scopeDialog = scopeDialog;
1337
1220
  exports.scopeRef = scopeRef;
1338
1221
  exports.toast = toast;
1339
1222
  exports.triggerAppCreated = triggerAppCreated;
1340
- exports.useScopes = useScopes;
1341
1223
 
1342
1224
  }));
@@ -1,36 +1,36 @@
1
1
  /* src:base\button.vue index:0 */
2
2
  .snail-button{align-items:center;border-radius:2px;cursor:pointer;display:inline-flex;font-size:14px;justify-content:center;white-space:nowrap}.snail-button.max{height:40px;width:120px}.snail-button.middle{height:32px;width:90px}.snail-button.normal{height:28px;width:54px}.snail-button.small{height:20px;width:30px}.snail-button.primary{background-color:#5ca3ff;color:#fff}.snail-button.default{background-color:#fff;border:1px solid #dddfed;color:#2e2f33}.snail-button.link{color:#4c9aff}
3
- /* src:base\icon.vue index:0 */
4
- .snail-icon{cursor:pointer;opacity:1}
5
- /* src:base\switch.vue index:0 */
6
- .snail-switch{border-radius:10px 10px 10px 10px;cursor:pointer;height:20px!important;overflow:hidden;position:relative;width:36px!important}.snail-switch>div{height:100%;width:100%}.snail-switch>div.on{background-color:#5ca3ff}.snail-switch>div.off{background-color:#c4c8cc;position:absolute;transition:left .2s ease}.snail-switch>div.status{background:#fff;border-radius:10px 10px 10px 10px;height:16px;position:absolute;top:2px;transition:left .2s ease;width:16px}.snail-switch.on>div.off{left:100%;top:0}.snail-switch.on>div.status{left:calc(100% - 18px)}.snail-switch.off>div.off{left:0;top:0}.snail-switch.off>div.status{left:2px}.snail-switch.readonly{cursor:default}
7
3
  /* src:base\footer.vue index:0 */
8
4
  .snail-footer{align-items:center;background-color:#fff;display:flex;flex-shrink:0;height:72px;padding:0 40px;width:100%}.snail-footer>.snail-button:nth-child(n+2){margin-left:20px}.snail-footer.start-divider{border-top:1px solid #dddfed}.snail-footer.left{justify-content:left}.snail-footer.center{justify-content:center}.snail-footer.right{justify-content:right}
9
- /* src:container\dynamic.vue index:0 */
10
- .snail-dynamic-error{color:red}.snail-dynamic-error>span{color:gray}
5
+ /* src:base\switch.vue index:0 */
6
+ .snail-switch{border-radius:10px 10px 10px 10px;cursor:pointer;height:20px!important;overflow:hidden;position:relative;width:36px!important}.snail-switch>div{height:100%;width:100%}.snail-switch>div.on{background-color:#5ca3ff}.snail-switch>div.off{background-color:#c4c8cc;position:absolute;transition:left .2s ease}.snail-switch>div.status{background:#fff;border-radius:10px 10px 10px 10px;height:16px;position:absolute;top:2px;transition:left .2s ease;width:16px}.snail-switch.on>div.off{left:100%;top:0}.snail-switch.on>div.status{left:calc(100% - 18px)}.snail-switch.off>div.off{left:0;top:0}.snail-switch.off>div.status{left:2px}.snail-switch.readonly{cursor:default}
11
7
  /* src:base\header.vue index:0 */
12
8
  .snail-header{align-items:center;background-color:#fff;display:flex;flex-direction:row;flex-shrink:0;position:relative;width:100%}.snail-header>.header-title{color:#2e3033;flex:1;line-height:48px;overflow:hidden;padding-left:24px;text-overflow:ellipsis;white-space:nowrap}.snail-header>.header-title.center{text-align:center}.snail-header>.header-title.right{text-align:right}.snail-header.start-divider{border-bottom:1px solid #dddfed}.snail-header.page{height:48px}.snail-header.page>.header-title{font-size:16px;font-weight:700}.snail-header.page>.close-icon{margin-right:18px}.snail-header.dialog{height:64px;padding-top:16px}.snail-header.dialog>.header-title{font-size:20px}.snail-header.dialog>.close-icon{position:absolute;right:8px;top:8px}
9
+ /* src:base\icon.vue index:0 */
10
+ .snail-icon{cursor:pointer;opacity:1}
11
+ /* src:container\dynamic.vue index:0 */
12
+ .snail-dynamic-error{color:red}.snail-dynamic-error>span{color:gray}
13
13
  /* src:container\fold.vue index:0 */
14
- .snail-fold{flex-shrink:0;transition:height .2s ease}.snail-fold>div.fold-header{align-items:center;display:flex;height:32px;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none}.snail-fold>div.fold-header:before{background-color:#2c97fb;content:"";height:18px;left:0;position:absolute;top:7px;width:4px}.snail-fold>div.fold-header>.subtitle,.snail-fold>div.fold-header>.title{overflow:hidden;white-space:nowrap}.snail-fold>div.fold-header>.title{color:#2e3033;font-size:14px;font-weight:700;padding-left:20px}.snail-fold>div.fold-header>.subtitle{color:#8a9099;font-size:13px}.snail-fold>div.fold-header>div.status{display:flex;flex:1;justify-content:right;justify-self:right}.snail-fold>div.fold-header>div.status>span{transition:transform .2s ease}.snail-fold>div.fold-body{padding-left:20px}.snail-fold.expand>div.fold-header>div.status>span{transform:rotate(0deg)}.snail-fold.fold{height:32px;overflow:hidden}.snail-fold.fold>div.fold-header>div.status>span{transform:rotate(180deg)}
15
- /* src:container\table.vue index:0 */
16
- .snail-table{display:flex;flex-direction:column}.snail-table>footer.table-footer,.snail-table>header.table-header{align-items:center;display:flex;flex-shrink:0;width:100%}.snail-table>header.table-header{position:sticky!important;top:0}.snail-table>main.table-body{flex:1;width:100%}.snail-table.start-border>footer.table-footer>.table-col:nth-child(n+2),.snail-table.start-border>header.table-header>.table-col:nth-child(n+2),.snail-table.start-border>main.table-body>.table-row>.table-col:nth-child(n+2){border-left:none!important}.snail-table.start-border>footer.table-footer>.table-col,.snail-table.start-border>main.table-body>.table-row>.table-col{border-top:none!important}
14
+ .snail-fold{flex-shrink:0}.snail-fold>div.fold-header{align-items:center;display:flex;height:32px;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none}.snail-fold>div.fold-header:before{background-color:#2c97fb;content:"";height:18px;left:0;position:absolute;top:7px;width:4px}.snail-fold>div.fold-header>.subtitle,.snail-fold>div.fold-header>.title{overflow:hidden;white-space:nowrap}.snail-fold>div.fold-header>.title{color:#2e3033;font-size:14px;font-weight:700;padding-left:20px}.snail-fold>div.fold-header>.subtitle{color:#8a9099;font-size:13px}.snail-fold>div.fold-header>div.status{display:flex;flex:1;justify-content:right;justify-self:right}.snail-fold>div.fold-body{padding-left:20px}
17
15
  /* src:container\scroll.vue index:0 */
18
16
  .snail-scroll{overflow:hidden}.snail-scroll.scroll-x{overflow-x:auto}.snail-scroll.scroll-y{overflow-y:auto}
17
+ /* src:container\table.vue index:0 */
18
+ .snail-table{display:flex;flex-direction:column}.snail-table>footer.table-footer,.snail-table>header.table-header{align-items:center;display:flex;flex-shrink:0;width:100%}.snail-table>header.table-header{position:sticky!important;top:0}.snail-table>main.table-body{flex:1;width:100%}.snail-table.start-border>footer.table-footer>.table-col:nth-child(n+2),.snail-table.start-border>header.table-header>.table-col:nth-child(n+2),.snail-table.start-border>main.table-body>.table-row>.table-col:nth-child(n+2){border-left:none!important}.snail-table.start-border>footer.table-footer>.table-col,.snail-table.start-border>main.table-body>.table-row>.table-col{border-top:none!important}
19
19
  /* src:container\components\table-row.vue index:0 */
20
20
  .table-row{align-items:center;display:flex;min-width:100%}
21
21
  /* src:container\components\table-col.vue index:0 */
22
22
  .table-col{align-items:center;display:inline-flex;height:100%;white-space:nowrap}.table-col.left{justify-content:left}.table-col.center{justify-content:center}.table-col.right{justify-content:right}
23
- /* src:prompt\empty.vue index:0 */
24
- .snail-empty{align-items:center;display:flex;flex-direction:column;height:100%;justify-content:center;width:100%}.snail-empty>img{height:60px;width:60px}.snail-empty>div.message{color:#babdc2;font-size:14px;font-weight:400;padding:0 10px 10px}
25
- /* src:prompt\loading.vue index:0 */
26
- .snail-loading{bottom:0;left:0;position:absolute;right:0;top:0;z-index:10000}.snail-loading.show-mask{background-color:rgba(0,0,0,.15)}.snail-loading:after,.snail-loading:before{animation:snail-loading-stretch 1s ease-in-out infinite;border-radius:50%;content:"";display:block;display:inline-block;height:10px;left:50%;margin-left:-18px;margin-top:-6px;position:absolute;top:50%;width:10px}.snail-loading:before{background-color:#279bf1}.snail-loading:after{animation-delay:-.5s;background:#64d214;margin-left:0;margin-right:-18px}@keyframes snail-loading-stretch{0%,to{transform:scale(1)}50%{transform:scale(2)}}.snail-loading-enter-active,.snail-loading-leave-active{transition:opacity .5s ease-in-out}.snail-loading-enter-from,.snail-loading-leave-to{opacity:0}
27
23
  /* src:form\input.vue index:0 */
28
24
  .snail-input{display:inline-flex;min-height:34px}.snail-input>.input-title{flex-shrink:0;font-size:14px;padding-top:6px}.snail-input>.input-title>span.text{color:#2e3033}.snail-input>.input-title>span.required{color:#f74b4b;margin-left:2px}.snail-input>.input-body{align-self:start;display:flex;flex:1;height:32px}.snail-input>.input-body>input{border:1px solid #dddfed;color:#2e3033;flex:1;font-size:14px;font-weight:400;padding:0 10px;text-overflow:ellipsis}.snail-input>.input-body>input:focus{border:1px solid #3292ea}.snail-input>.input-body>span{background-color:red;flex-shrink:0}.snail-input.readonly>div.input-body>input:focus{border:1px solid #dddfed}
29
25
  /* src:prompt\drag-verify.vue index:0 */
30
26
  .snail-drag-verify{background:#f8f9fa;border:1px solid #dddfed;border-radius:8px;height:40px;overflow:hidden;position:relative;width:100%}.snail-drag-verify>div{height:100%;width:100%}.snail-drag-verify>.drag-progress{background-color:#0c6;transition:width .5s ease-in-out}.snail-drag-verify>.drag-handle,.snail-drag-verify>.verify-message{left:0;position:absolute;top:0;transition:left .5s ease-in-out}.snail-drag-verify>.verify-message{align-items:center;background-image:-webkit-linear-gradient(left,#666,#666 45%,#fff 50%,#666 55%,#666);color:#7e848c;display:flex;font-size:12px;font-weight:400;justify-content:center;-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-text-fill-color:transparent;animation:snail-drag-verify 2s linear infinite;-webkit-background-clip:text;background-clip:text;background-size:200% 100%}.snail-drag-verify>.drag-handle{align-items:center;background-color:#fff;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAnUExURQAAAGBQUGBaWmJZWWJYWGNYWGNZWWJYWGJZWWBYWGNYWGNZWWRYWIqwlb0AAAANdFJOUwAQMMDQoFBgcCCw4ECQ8pPMAAAAP0lEQVQI12NgwATTGBgawAwRBYZwMIPRiYErAcxSFmA0AjN4HBikBcCsUgYmQxQGE0wKphhIQrSzwAyEW4EOACHhB32zIad6AAAAAElFTkSuQmCC);background-position:50%;background-repeat:no-repeat;border-right:1px solid #dddfed;cursor:move;display:flex;justify-content:center;width:40px}.snail-drag-verify.dragging>.drag-handle,.snail-drag-verify.dragging>.drag-progress{transition:none!important}.snail-drag-verify.success>.verify-message{-webkit-text-fill-color:#fff;color:#fff}.snail-drag-verify.success>.drag-handle>svg{background:#76c61d;border-radius:50%;padding:4px}@keyframes snail-drag-verify{0%{background-position:0 0}to{background-position:-200% 0}}
31
- /* src:prompt\components\confirm.vue index:0 */
32
- .snail-confirm{background-color:#fff;border-radius:4px;box-sizing:border-box;color:#2e2f33;display:flex;flex-direction:column;max-height:350px;max-width:548px;min-width:348px}.snail-confirm>main{flex:1;font-size:14px;margin:20px 40px;overflow:auto;word-wrap:break-word;box-sizing:border-box}
27
+ /* src:prompt\empty.vue index:0 */
28
+ .snail-empty{align-items:center;display:flex;flex-direction:column;height:100%;justify-content:center;width:100%}.snail-empty>img{height:60px;width:60px}.snail-empty>div.message{color:#babdc2;font-size:14px;font-weight:400;padding:0 10px 10px}
29
+ /* src:prompt\loading.vue index:0 */
30
+ .snail-loading{bottom:0;left:0;position:absolute;right:0;top:0;z-index:10000}.snail-loading.show-mask{background-color:rgba(0,0,0,.15)}.snail-loading:after,.snail-loading:before{animation:snail-loading-stretch 1s ease-in-out infinite;border-radius:50%;content:"";display:block;display:inline-block;height:10px;left:50%;margin-left:-18px;margin-top:-6px;position:absolute;top:50%;width:10px}.snail-loading:before{background-color:#279bf1}.snail-loading:after{animation-delay:-.5s;background:#64d214;margin-left:0;margin-right:-18px}@keyframes snail-loading-stretch{0%,to{transform:scale(1)}50%{transform:scale(2)}}.snail-loading-enter-active,.snail-loading-leave-active{transition:opacity .5s ease-in-out}.snail-loading-enter-from,.snail-loading-leave-to{opacity:0}
33
31
  /* src:prompt\components\toast.vue index:0 */
34
32
  .snail-toast{background:rgba(0,0,0,.7);border-radius:5px;color:#fff;display:flex;max-height:200px;max-width:500px;min-width:200px;opacity:.2;overflow:hidden;padding:20px 30px 20px 20px;position:fixed;transition:opacity .2s ease;z-index:99999}.snail-toast.show-toast{opacity:1}.snail-toast>svg.close-icon{position:absolute;right:10px;top:12px}.snail-toast>div.icon{align-items:center;align-self:center;background:hsla(0,0%,100%,.15);border-radius:50%;display:flex;height:26px;justify-content:center;margin-right:6px;width:26px}.snail-toast>div.icon>svg{background:#fff;border-radius:50%;cursor:none!important}.snail-toast>div.message{flex:1;line-height:24px;overflow:hidden;word-break:break-all}
33
+ /* src:prompt\components\confirm.vue index:0 */
34
+ .snail-confirm{background-color:#fff;border-radius:4px;box-sizing:border-box;color:#2e2f33;display:flex;flex-direction:column;max-height:350px;max-width:548px;min-width:348px}.snail-confirm>main{flex:1;font-size:14px;margin:20px 40px;overflow:auto;word-wrap:break-word;box-sizing:border-box}
35
35
  /* src:container\components\dialog-wrapper.vue index:0 */
36
36
  .snail-dialog{align-items:center;bottom:0;display:flex;justify-content:center;left:0;overflow:hidden;position:fixed;right:0;top:0}.snail-dialog:before{background-color:rgba(24,27,33,.45);content:"";height:100%;position:absolute;width:100%}.snail-dialog>.dialog-body{background-color:#fff;border-radius:4px;box-shadow:0 0 15px rgba(0,0,0,.3);box-sizing:border-box;position:relative}.snail-dialog.unactive:before{display:none!important}.snail-dialog.unactive>.dialog-body{box-shadow:0 0 4px rgba(0,0,0,.3)}.snail-dialog-enter-active,.snail-dialog-leave-active{transition:scale .1s ease-in-out,opacity .1s ease}.snail-dialog-enter-from{opacity:0;scale:.4}.snail-dialog-leave-to{opacity:0;scale:0}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "依赖【snail】,基于vue封装常用UI组件",
4
4
  "author": "snail_dev@163.com",
5
5
  "license": "MIT",
6
- "version": "1.0.22",
6
+ "version": "1.0.24",
7
7
  "type": "module",
8
8
  "main": "dist/snail.vue.js",
9
9
  "module": "dist/snail.vue.js",
@@ -15,18 +15,18 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "vue": "^3.5.14",
18
- "snail.core": ">=1.2.13"
18
+ "snail.core": ">=2.0.4",
19
+ "snail.view": ">=1.0.4"
19
20
  },
20
21
  "devDependencies": {
21
22
  "vue-tsc": "^2.2.10",
22
23
  "snail.rollup": ">=1.2.8",
23
24
  "snail.rollup-asset": ">=1.2.1",
24
25
  "snail.rollup-html": ">=1.2.3",
25
- "snail.rollup-url": ">=1.2.1",
26
+ "snail.rollup-url": ">=1.2.2",
26
27
  "snail.rollup-inject": ">=1.2.1",
27
28
  "snail.rollup-script": ">=1.2.4",
28
29
  "snail.rollup-style": ">=1.2.5",
29
- "snail.style": ">=1.0.0",
30
30
  "snail.rollup-vue": ">=1.2.4"
31
31
  }
32
32
  }