@farris/cli 2.0.3 → 2.1.0

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.
Files changed (125) hide show
  1. package/lib/commands/build.js +6 -7
  2. package/lib/commands/build.js.map +1 -1
  3. package/lib/commands/generate/api.js +188 -0
  4. package/lib/commands/generate/api.js.map +1 -0
  5. package/lib/commands/generate/common.js +101 -0
  6. package/lib/commands/generate/common.js.map +1 -0
  7. package/lib/commands/generate/component.js +163 -0
  8. package/lib/commands/generate/component.js.map +1 -0
  9. package/lib/commands/generate/view.js +195 -0
  10. package/lib/commands/generate/view.js.map +1 -0
  11. package/lib/commands/workspace/add-app.js +170 -0
  12. package/lib/commands/workspace/add-app.js.map +1 -0
  13. package/lib/commands/workspace/create.js +310 -0
  14. package/lib/commands/workspace/create.js.map +1 -0
  15. package/lib/commands/workspace/inspect.js +31 -0
  16. package/lib/commands/workspace/inspect.js.map +1 -0
  17. package/lib/commands/workspace/verify.js +39 -0
  18. package/lib/commands/workspace/verify.js.map +1 -0
  19. package/lib/common/constant.js +42 -1
  20. package/lib/common/constant.js.map +1 -1
  21. package/lib/common/get-vite-config.js +66 -9
  22. package/lib/common/get-vite-config.js.map +1 -1
  23. package/lib/common/output.js +93 -0
  24. package/lib/common/output.js.map +1 -0
  25. package/lib/common/safety.js +172 -0
  26. package/lib/common/safety.js.map +1 -0
  27. package/lib/common/template-renderer.js +113 -0
  28. package/lib/common/template-renderer.js.map +1 -0
  29. package/lib/common/transaction.js +84 -0
  30. package/lib/common/transaction.js.map +1 -0
  31. package/lib/common/verifier.js +147 -0
  32. package/lib/common/verifier.js.map +1 -0
  33. package/lib/config/vite-common.js +1 -1
  34. package/lib/config/vite-common.js.map +1 -1
  35. package/lib/index.js +124 -30
  36. package/lib/index.js.map +1 -1
  37. package/package.json +14 -10
  38. package/templates/workspace/app/farris.config.mjs +13 -0
  39. package/templates/{lib → workspace/app}/index.html +12 -12
  40. package/templates/workspace/app/package.json +22 -0
  41. package/templates/workspace/app/src/App.tsx +11 -0
  42. package/templates/workspace/app/src/main.ts +11 -0
  43. package/templates/workspace/app/src/router/index.ts +16 -0
  44. package/templates/workspace/app/src/styles/index.css +0 -0
  45. package/templates/workspace/app/src/styles/index.scss +0 -0
  46. package/templates/workspace/app/src/views/home/composables/use-home.ts +7 -0
  47. package/templates/workspace/app/src/views/home/home.component.tsx +15 -0
  48. package/templates/workspace/app/src/views/home/index.ts +4 -0
  49. package/templates/workspace/app/tsconfig.json +21 -0
  50. package/templates/workspace/root/README.md +28 -0
  51. package/templates/workspace/root/package.json +13 -0
  52. package/templates/workspace/root/pnpm-workspace.yaml +12 -0
  53. package/templates/lib/.eslintrc.cjs +0 -15
  54. package/templates/lib/.prettierrc.json +0 -8
  55. package/templates/lib/components/button/index.ts +0 -7
  56. package/templates/lib/components/button/src/button.component.tsx +0 -84
  57. package/templates/lib/components/button/src/button.props.ts +0 -55
  58. package/templates/lib/components/button/src/button.scss +0 -179
  59. package/templates/lib/components/common/index.ts +0 -6
  60. package/templates/lib/components/common/src/common.scss +0 -4
  61. package/templates/lib/components/common/src/compositions/index.ts +0 -19
  62. package/templates/lib/components/common/src/compositions/types.ts +0 -6
  63. package/templates/lib/components/common/src/compositions/use-bem/index.ts +0 -46
  64. package/templates/lib/components/common/src/compositions/use-click-away/index.ts +0 -40
  65. package/templates/lib/components/common/src/compositions/use-context/use-children-contexts.ts +0 -40
  66. package/templates/lib/components/common/src/compositions/use-context/use-parent-context.ts +0 -24
  67. package/templates/lib/components/common/src/compositions/use-event-listener/index.ts +0 -45
  68. package/templates/lib/components/common/src/compositions/use-expose/index.ts +0 -9
  69. package/templates/lib/components/common/src/compositions/use-lay-render/index.ts +0 -17
  70. package/templates/lib/components/common/src/compositions/use-link/index.ts +0 -14
  71. package/templates/lib/components/common/src/compositions/use-lock-scroll/index.ts +0 -25
  72. package/templates/lib/components/common/src/compositions/use-long-press/index.ts +0 -141
  73. package/templates/lib/components/common/src/compositions/use-momentum/index.ts +0 -82
  74. package/templates/lib/components/common/src/compositions/use-mount-component/index.ts +0 -48
  75. package/templates/lib/components/common/src/compositions/use-rect/index.ts +0 -31
  76. package/templates/lib/components/common/src/compositions/use-refs/index.ts +0 -21
  77. package/templates/lib/components/common/src/compositions/use-resize-observer/index.ts +0 -85
  78. package/templates/lib/components/common/src/compositions/use-resize-observer/utils.ts +0 -37
  79. package/templates/lib/components/common/src/compositions/use-scroll-parent/index.ts +0 -42
  80. package/templates/lib/components/common/src/compositions/use-touch/index.ts +0 -82
  81. package/templates/lib/components/common/src/compositions/use-touch-move/index.ts +0 -120
  82. package/templates/lib/components/common/src/entity/base-property.ts +0 -129
  83. package/templates/lib/components/common/src/entity/entity-schema.ts +0 -274
  84. package/templates/lib/components/common/src/entity/input-base-property.ts +0 -285
  85. package/templates/lib/components/common/src/style/animation/index.scss +0 -150
  86. package/templates/lib/components/common/src/style/base.scss +0 -63
  87. package/templates/lib/components/common/src/style/fonts/farris-mobile-icon.ttf +0 -0
  88. package/templates/lib/components/common/src/style/icon.scss +0 -6
  89. package/templates/lib/components/common/src/style/index.scss +0 -4
  90. package/templates/lib/components/common/src/style/mixins/bem.scss +0 -204
  91. package/templates/lib/components/common/src/style/mixins/border-radius.scss +0 -13
  92. package/templates/lib/components/common/src/style/mixins/ellipsis.scss +0 -15
  93. package/templates/lib/components/common/src/style/mixins/hairline.scss +0 -113
  94. package/templates/lib/components/common/src/style/mixins/index.scss +0 -6
  95. package/templates/lib/components/common/src/style/mixins/margin.scss +0 -10
  96. package/templates/lib/components/common/src/style/mixins/safe-area.scss +0 -9
  97. package/templates/lib/components/common/src/style/variables.scss +0 -113
  98. package/templates/lib/components/common/src/utils/index.ts +0 -15
  99. package/templates/lib/components/common/src/utils/src/common.ts +0 -83
  100. package/templates/lib/components/common/src/utils/src/date.ts +0 -134
  101. package/templates/lib/components/common/src/utils/src/dom/event.ts +0 -37
  102. package/templates/lib/components/common/src/utils/src/hook.ts +0 -18
  103. package/templates/lib/components/common/src/utils/src/number.ts +0 -26
  104. package/templates/lib/components/common/src/utils/src/query-filter.ts +0 -40
  105. package/templates/lib/components/common/src/utils/src/resove-asset.ts +0 -33
  106. package/templates/lib/components/common/src/utils/src/string.ts +0 -18
  107. package/templates/lib/components/common/src/utils/src/throttle.ts +0 -41
  108. package/templates/lib/components/common/src/utils/src/transition.ts +0 -14
  109. package/templates/lib/components/common/src/utils/src/type.ts +0 -105
  110. package/templates/lib/components/common/src/utils/src/use-appearance.ts +0 -33
  111. package/templates/lib/components/common/src/utils/src/with-install.ts +0 -16
  112. package/templates/lib/components/common/src/utils/src/with-register-designer.ts +0 -16
  113. package/templates/lib/components/common/src/utils/src/with-register.ts +0 -16
  114. package/templates/lib/components/common/types.ts +0 -131
  115. package/templates/lib/components/index.scss +0 -2
  116. package/templates/lib/components/index.ts +0 -21
  117. package/templates/lib/farris.config.mjs +0 -56
  118. package/templates/lib/package.json +0 -32
  119. package/templates/lib/src/App.vue +0 -80
  120. package/templates/lib/src/components/TheButton.vue +0 -3
  121. package/templates/lib/src/main.ts +0 -10
  122. package/templates/lib/src/router/index.ts +0 -23
  123. package/templates/lib/src/views/AboutView.vue +0 -15
  124. package/templates/lib/src/views/HomeView.vue +0 -9
  125. package/templates/lib/tsconfig.json +0 -20
@@ -1,63 +0,0 @@
1
- /* Box sizing rules */
2
- *,
3
- *::before,
4
- *::after {
5
- box-sizing: border-box;
6
- }
7
-
8
- /* Remove default margin */
9
- body,
10
- h1,
11
- h2,
12
- h3,
13
- h4,
14
- p,
15
- figure,
16
- blockquote,
17
- dl,
18
- dd {
19
- margin: 0;
20
- }
21
-
22
- /* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */
23
- ul[role="list"],
24
- ol[role="list"] {
25
- list-style: none;
26
- }
27
-
28
- /* Set core root defaults */
29
- html:focus-within {
30
- scroll-behavior: smooth;
31
- }
32
-
33
- /* Set core body defaults */
34
- body {
35
- min-height: 100vh;
36
- text-rendering: optimizeSpeed;
37
- line-height: 1.5;
38
- font-family: -apple-system, "Noto Sans", "Helvetica Neue", Helvetica,
39
- "Nimbus Sans L", Arial, "Liberation Sans", "PingFang SC", "Hiragino Sans GB",
40
- "Noto Sans CJK SC", "Source Han Sans SC", "Source Han Sans CN",
41
- "Microsoft YaHei", "Wenquanyi Micro Hei", "WenQuanYi Zen Hei", "ST Heiti",
42
- SimHei, "WenQuanYi Zen Hei Sharp", sans-serif;
43
- }
44
-
45
- /* A elements that don't have a class get default styles */
46
- a:not([class]) {
47
- text-decoration-skip-ink: auto;
48
- }
49
-
50
- /* Make images easier to work with */
51
- img,
52
- picture {
53
- max-width: 100%;
54
- display: block;
55
- }
56
-
57
- /* Inherit fonts for inputs and buttons */
58
- input,
59
- button,
60
- textarea,
61
- select {
62
- font: inherit;
63
- }
@@ -1,6 +0,0 @@
1
- @font-face {
2
- font-family: 'farrisMobile';
3
- font-style: normal;
4
- font-weight: normal;
5
- src: url(./fonts/farris-mobile-icon.ttf) format('truetype');
6
- }
@@ -1,4 +0,0 @@
1
- // @import './base';
2
- // @import './icon';
3
- // @import './variables';
4
- // @import './animation';
@@ -1,204 +0,0 @@
1
- /*
2
- 基于 BEM(Block Element Modifier)命名规范的 SCSS 混合(mixins)和辅助函数,用于生成符合 BEM 规范的 CSS 类名
3
- */
4
-
5
- // 命名空间前缀,所有类名都会以 fm- 开头
6
- $namespace: 'fm';
7
- // 元素分隔符,用于连接 Block 和 Element,例如 fm-block__element
8
- $element-separator: '__';
9
- //修饰符分隔符,用于连接 Block/Element 和 Modifier,例如 fm-block--modifier
10
- $modifier-separator :'--';
11
- //状态前缀,用于标识组件的状态,例如 is-active
12
- $state-prefix: 'is-';
13
-
14
- /**
15
- 功能:将传入的选择器转换为字符串形式,并去掉首尾的引号。
16
- 用途:在后续函数中用于解析选择器内容。
17
- */
18
- @function selectorToString($selector) {
19
- $selector: inspect($selector);
20
- $selector: str-slice($selector, 2, -2);
21
- @return $selector;
22
- }
23
-
24
- /*
25
- 功能:检查选择器是否包含修饰符分隔符 --。
26
- 用途:判断是否需要特殊处理修饰符规则
27
- */
28
- @function containsModifier($selector) {
29
- $selector: selectorToString($selector);
30
-
31
- @if str-index($selector, $modifier-separator) {
32
- @return true;
33
- }
34
-
35
- @else {
36
- @return false;
37
- }
38
- }
39
-
40
- /*
41
- 功能:检查选择器是否包含状态前缀 .is-。
42
- 用途:判断是否需要处理状态相关的规则。
43
- */
44
- @function containWhenFlag($selector) {
45
- $selector: selectorToString($selector);
46
-
47
- @if str-index($selector, '.' + $state-prefix) {
48
- @return true;
49
- }
50
-
51
- @else {
52
- @return false;
53
- }
54
- }
55
-
56
- /*
57
- 功能:检查选择器是否包含伪类(如 :hover、:active 等)。
58
- 用途:判断是否需要处理伪类规则。
59
- */
60
- @function containPseudoClass($selector) {
61
- $selector: selectorToString($selector);
62
-
63
- @if str-index($selector, ':') {
64
- @return true;
65
- }
66
-
67
- @else {
68
- @return false;
69
- }
70
- }
71
-
72
- /*
73
- 功能:综合判断选择器是否包含修饰符、状态或伪类。
74
- 用途:决定是否需要特殊嵌套规则。
75
- */
76
- @function hitAllSpecialNestRule($selector) {
77
-
78
- @return containsModifier($selector) or containWhenFlag($selector) or containPseudoClass($selector);
79
- }
80
-
81
- /*
82
- 功能:生成 Block 的基础类名。
83
- 用法:
84
- 输入: @include b(button) { color: red; }
85
- 输出:.fm-button { color: red; }
86
- */
87
- @mixin b($block) {
88
-
89
- $B: #{$namespace + '-' + $block} !global;
90
-
91
- .#{$B} {
92
- @content;
93
- }
94
- }
95
-
96
- /*
97
- 功能:生成 Element 的类名。
98
- 用法:
99
- 输入:
100
- @include b(button) {
101
- @include e(text) {
102
- font-size: 14px;
103
- }
104
- }
105
- 输出:
106
- .fm-button__text {
107
- font-size: 14px;
108
- }
109
-
110
- */
111
- @mixin e($element, $inheritParent: false) {
112
- $E: $element !global;
113
- $selector: &;
114
- $currentSelector: "";
115
- $insertSelector: "";
116
-
117
- @each $unit in $element {
118
- @if $inheritParent {
119
- $currentSelector: #{$currentSelector + $selector + $element-separator + $unit + ","};
120
- } @else {
121
- $currentSelector: #{$currentSelector + "." + $B + $element-separator + $insertSelector + $unit + ","};
122
- }
123
- }
124
-
125
- @if hitAllSpecialNestRule($selector) {
126
- @at-root {
127
- #{$selector} {
128
- #{$currentSelector} {
129
- @content;
130
- }
131
- }
132
- }
133
- }
134
-
135
- @else {
136
- @at-root {
137
- #{$currentSelector} {
138
- @content;
139
- }
140
- }
141
- }
142
- }
143
-
144
- /*
145
- 功能:生成 Modifier 的类名。
146
- 用法:
147
- 输入:
148
- @include b(button) {
149
- @include m(disabled) {
150
- opacity: 0.5;
151
- }
152
- }
153
- 输出:
154
- .fm-button--disabled {
155
- opacity: 0.5;
156
- }
157
-
158
- */
159
- @mixin m($modifier) {
160
- $selector: &;
161
- $currentSelector: "";
162
-
163
- @each $unit in $modifier {
164
- $currentSelector: #{$currentSelector + & + $modifier-separator + $unit + ","};
165
- }
166
-
167
- @at-root {
168
- #{$currentSelector} {
169
- @content;
170
- }
171
- }
172
- }
173
-
174
- /*
175
- 功能:生成根节点上的 Modifier 类名。
176
- 用法:
177
- 输入:
178
- @include b(button) {
179
- @include e(text) {
180
- @include root-m(disabled) {
181
- pointer-events: none;
182
- }
183
- }
184
- }
185
-
186
- 输出:
187
- .fm-button--disabled {
188
- pointer-events: none;
189
- }
190
- */
191
- @mixin root-m($modifier) {
192
- $selector: #{"." + $B};
193
- $currentSelector: "";
194
-
195
- @each $unit in $modifier {
196
- $currentSelector: #{$currentSelector + & + $selector + $modifier-separator + $unit + ","};
197
- }
198
-
199
- @at-root {
200
- #{$currentSelector} {
201
- @content;
202
- }
203
- }
204
- }
@@ -1,13 +0,0 @@
1
- @mixin borderRadius($size, $position: '') {
2
- @if ($position == 'top') {
3
- border-radius: 0 0 $size $size;
4
- } @else if($position == 'bottom') {
5
- border-radius: $size $size 0 0;
6
- } @else if($position == 'left') {
7
- border-radius: 0 $size $size 0;
8
- } @else if($position == 'right') {
9
- border-radius: $size 0 0 $size;
10
- } @else {
11
- border-radius: $size
12
- }
13
- }
@@ -1,15 +0,0 @@
1
- @mixin multi-ellipsis($lines) {
2
- display: -webkit-box;
3
- overflow: hidden;
4
- text-overflow: ellipsis;
5
- -webkit-line-clamp: $lines;
6
-
7
- /* autoprefixer: ignore next */
8
- -webkit-box-orient: vertical;
9
- }
10
-
11
- @mixin ellipsis {
12
- overflow: hidden;
13
- white-space: nowrap;
14
- text-overflow: ellipsis;
15
- }
@@ -1,113 +0,0 @@
1
- @mixin scale-hairline-common($color, $top, $right, $bottom, $left) {
2
- content: '';
3
- position: absolute;
4
- background-color: $color;
5
- display: block;
6
- z-index: 1;
7
- top: $top;
8
- right: $right;
9
- bottom: $bottom;
10
- left: $left;
11
- }
12
-
13
- @mixin hairline(
14
- $direction,
15
- $color: #ddd,
16
- $radius: 0,
17
- $type: solid,
18
- ) {
19
- @if ($direction == 'top') {
20
- border-top: 1px $type $color;
21
- position: relative;
22
- border-top: none;
23
- &::before {
24
- @include scale-hairline-common($color, 0, auto, auto, 0);
25
- width: 100%;
26
- height: 1px;
27
- transform-origin: 50% 50%;
28
- transform: scaleY(0.5);
29
- }
30
- } @else if ($direction == 'bottom') {
31
- border-bottom: 1px $type $color;
32
- position: relative;
33
- border-bottom: none;
34
- &::after {
35
- @include scale-hairline-common($color, auto, auto, 0, 0);
36
- width: 100%;
37
- height: 1px;
38
- transform-origin: 50% 100%;
39
- transform: scaleY(0.5);
40
- }
41
- } @else if ($direction == 'left') {
42
- border-left: 1px $type $color;
43
- position: relative;
44
- border-left: none;
45
- &::before {
46
- @include scale-hairline-common($color, 0, auto, auto, 0);
47
- width: 1px;
48
- height: 100%;
49
- transform-origin: 100% 50%;
50
- transform: scaleX(0.5);
51
- }
52
- } @else if ($direction == 'right') {
53
- border-right: 1px $type $color;
54
- position: relative;
55
- border-right: none;
56
- &::after {
57
- @include scale-hairline-common($color, 0, 0, auto, auto);
58
- width: 1px;
59
- height: 100%;
60
- background: $color;
61
- transform-origin: 100% 50%;
62
- transform: scaleX(0.5);
63
- }
64
- } @else if ($direction == 'all') {
65
- border: 1px $type $color;
66
- border-radius: $radius;
67
- position: relative;
68
- border: none;
69
- &::before {
70
- content: '';
71
- position: absolute;
72
- left: 0;
73
- top: 0;
74
- width: 200%;
75
- height: 200%;
76
- border: 1px $type $color;
77
- border-radius: $radius * 2;
78
- transform-origin: 0 0;
79
- transform: scale(0.5);
80
- box-sizing: border-box;
81
- pointer-events: none;
82
- }
83
- }
84
- }
85
-
86
- @mixin hairline-remove($position) {
87
- @if $position == 'left' {
88
- border-left: 0;
89
- &:before {
90
- display: none !important;
91
- }
92
- } @else if $position == 'right' {
93
- border-right: 0;
94
- &:after {
95
- display: none !important;
96
- }
97
- } @else if $position == 'top' {
98
- border-top: 0;
99
- &:before {
100
- display: none !important;
101
- }
102
- } @else if $position == 'bottom' {
103
- border-bottom: 0;
104
- &:after {
105
- display: none !important;
106
- }
107
- } @else if $position == 'all' {
108
- border: 0;
109
- &:before {
110
- display: none !important;
111
- }
112
- }
113
- }
@@ -1,6 +0,0 @@
1
- @forward 'bem';
2
- @forward 'border-radius';
3
- @forward 'ellipsis';
4
- @forward 'hairline';
5
- @forward 'safe-area';
6
- @forward 'margin';
@@ -1,10 +0,0 @@
1
- @mixin not-first-child-margin($size, $position: '') {
2
- &:not(:first-child) {
3
- #{'margin-' + $position}: $size;
4
- }
5
- }
6
- @mixin not-last-child-margin($size, $position: '') {
7
- &:not(:last-child) {
8
- #{'margin-' + $position}: $size;
9
- }
10
- }
@@ -1,9 +0,0 @@
1
- @mixin safeArea($styleName) {
2
- @if($styleName){
3
- #{$styleName}: 0;
4
- @supports ((bottom: constant(safe-area-inset-bottom)) or (bottom: env(safe-area-inset-bottom))) and (-webkit-overflow-scrolling: touch) {
5
- #{$styleName}: constant(safe-area-inset-bottom);
6
- #{$styleName}: env(safe-area-inset-bottom);
7
- }
8
- }
9
- }
@@ -1,113 +0,0 @@
1
- :root {
2
- // Color Palette
3
- --fm-black: #000;
4
- --fm-white: #fff;
5
- --fm-gray-1: #f2f3f5;
6
- --fm-gray-2: #eee;
7
- --fm-gray-3: #ddd;
8
- --fm-gray-4: #ccc;
9
- --fm-gray-5: #999;
10
- --fm-gray-6: #666;
11
- --fm-gray-7: #333;
12
- --fm-red: #F24645;
13
- --fm-red-light: #f9e8e8;
14
- --fm-blue: #3A90FF;
15
- --fm-blue-2: #65a7ff;
16
- --fm-blue-light: #ecf2fe;
17
- --fm-green: #5CC171;
18
- --fm-green-2: #5AC1C3;
19
- --fm-green-light: #e9f5ed;
20
- --fm-orange: #FF9800;
21
- --fm-orange-2: #FA6400;
22
- --fm-orange-3: #FFB400;
23
- --fm-orange-light: #faf0e1;
24
-
25
- // Component Colors
26
- --fm-primary-color: var(--fm-blue);
27
- --fm-success-color: var(--fm-green);
28
- --fm-danger-color: var(--fm-red);
29
- --fm-warning-color: var(--fm-orange);
30
- --fm-submit-color: var(--fm-green-2);
31
- --fm-primary-color-light: var(--fm-blue-light);
32
- --fm-success-color-light: var(--fm-green-light);
33
- --fm-danger-color-light: var(--fm-red-light);
34
- --fm-warning-color-light: var(--fm-orange-light);
35
- --fm-text-color: var(--fm-gray-7);
36
- --fm-text-color-light: var(--fm-gray-5);
37
- --fm-active-color: var(--fm-gray-1);
38
- --fm-disabled-color: var(--fm-gray-4);
39
- --fm-readonly-color: var(--fm-gray-6);
40
- --fm-active-opacity: 0.7;
41
- --fm-readonly-opacity: 0.6;
42
- --fm-disabled-opacity: 0.5;
43
- --fm-background: var(--fm-gray-1);
44
- --fm-background-white: var(--fm-white);
45
- --fm-box-shadow-color: var(--fm-gray-1);
46
-
47
- // Padding
48
- --fm-padding-base: 4px;
49
- --fm-padding-xs: 8px;
50
- --fm-padding-sm: 12px;
51
- --fm-padding-md: 16px;
52
- --fm-padding-lg: 24px;
53
- --fm-padding-xl: 32px;
54
- --fm-padding-horizontal-xs: 0 var(--fm-padding-xs);
55
- --fm-padding-horizontal-sm: 0 var(--fm-padding-sm);
56
- --fm-padding-horizontal-md: 0 var(--fm-padding-md);
57
- --fm-padding-horizontal-lg: 0 var(--fm-padding-lg);
58
-
59
- // Margin
60
- --fm-margin-base: 4px;
61
- --fm-margin-xs: 8px;
62
- --fm-margin-sm: 12px;
63
- --fm-margin-md: 16px;
64
- --fm-margin-lg: 24px;
65
- --fm-margin-xl: 32px;
66
- --fm-margin-horizontal-xs: 0 var(--fm-margin-xs);
67
- --fm-margin-horizontal-sm: 0 var(--fm-margin-sm);
68
- --fm-margin-horizontal-md: 0 var(--fm-margin-md);
69
- --fm-margin-horizontal-lg: 0 var(--fm-margin-lg);
70
-
71
- // Font
72
- --fm-font-bold-light: 500;
73
- --fm-font-bold: 600;
74
- --fm-font-size: 16px;
75
- --fm-line-height: 1.2;
76
-
77
- --fm-font-size-xs: 10px;
78
- --fm-font-size-sm: 12px;
79
- --fm-font-size-md: 14px;
80
- --fm-font-size-lg: 16px;
81
-
82
- // Gradient Colors
83
- --fm-gradient-blue: linear-gradient(-45deg,var(--fm-blue-2) 0%, var(--fm-blue) 100%);
84
- --fm-gradient-orange: linear-gradient(-45deg,var(--fm-orange) 0%, var(--fm-orange-2) 100%);
85
-
86
- /* stylelint-disable */
87
- --fm-base-font: -apple-system, BlinkMacSystemFont, 'Helvetica Neue',
88
- Helvetica, Segoe UI, Arial, Roboto, 'PingFang SC', 'miui',
89
- 'Hiragino Sans GB', 'Microsoft Yahei', sans-serif;
90
- --fm-price-font: avenir-heavy, 'PingFang SC', helvetica neue, arial,
91
- sans-serif;
92
- /* stylelint-enable */
93
-
94
- // Animation
95
- --fm-duration-base: 0.3s;
96
- --fm-duration-fast: 0.2s;
97
- --fm-ease-out: ease-out;
98
- --fm-ease-in: ease-in;
99
-
100
- // Border
101
- --fm-noborder: none;
102
- --fm-radius-sm: 2px;
103
- --fm-radius-md: 4px;
104
- --fm-radius-lg: 8px;
105
- --fm-radius-max: 999px;
106
-
107
- --fm-zindex-1: 9;
108
- --fm-zindex-2: 10;
109
- --fm-zindex-3: 99;
110
- --fm-zindex-4: 100;
111
- --fm-zindex-5: 999;
112
- --fm-zindex-6: 1000;
113
- }
@@ -1,15 +0,0 @@
1
- export * from './src/dom/event';
2
- export * from './src/common';
3
- export * from './src/hook';
4
- export * from './src/number';
5
- export * from './src/resove-asset';
6
- export * from './src/throttle';
7
- export * from './src/transition';
8
- export * from './src/type';
9
- export * from './src/date';
10
- export * from './src/string';
11
- export * from './src/use-appearance';
12
- export * from './src/query-filter';
13
- export * from './src/with-install';
14
- export * from './src/with-register';
15
- export * from './src/with-register-designer';
@@ -1,83 +0,0 @@
1
- import { isDef, isNumeric, isObject } from './type';
2
-
3
- export function noop() { }
4
-
5
- export function addUnit(value: string | number) {
6
- if (!isDef(value)) {
7
- return undefined;
8
- }
9
- value = String(value);
10
- return isNumeric(value) ? `${value}px` : value;
11
- }
12
-
13
- export const escapeHtml = (str: string) => {
14
- if (str === null || str === undefined || str === '') {
15
- return '';
16
- }
17
- return str
18
- .replace(/&/g, '&')
19
- .replace(/</g, '&lt;')
20
- .replace(/>/g, '&gt;')
21
- .replace(/"/g, '&quot;')
22
- .replace(/'/g, '&#39;')
23
- .replace(/\//g, '&#x2F;');
24
- };
25
-
26
- export const unescapeHtml = (str: string) => {
27
- if (str === null || str === undefined || str === '') {
28
- return '';
29
- }
30
- return str
31
- .replace(/&amp;/g, '&')
32
- .replace(/&lt;/g, '<')
33
- .replace(/&gt;/g, '>')
34
- .replace(/&quot;/g, '"')
35
- .replace(/&#39;/g, "'")
36
- .replace(/&#x2F;/g, '/');
37
- };
38
-
39
- export const getValue = (field: string, data: any, safe = false) => {
40
- if (!data) {
41
- return '';
42
- }
43
- let resultVal = '';
44
- if (field.indexOf('.') === -1) {
45
- resultVal = data[field];
46
- } else {
47
- resultVal = field.split('.').reduce((obj, key) => {
48
- if (obj) {
49
- return obj[key];
50
- }
51
- return null;
52
- }, data);
53
- }
54
-
55
- if (safe) {
56
- return escapeHtml(resultVal);
57
- }
58
- return resultVal;
59
- };
60
-
61
- export const setValue = (obj: Record<string, any>, field: string, val: any) => {
62
- if(!obj || !field){
63
- return;
64
- }
65
- if (field.indexOf('.') > 0) {
66
- const fieldMap = field.split('.');
67
- const target = fieldMap.slice(0, -1).reduce((record, fieldItem) => {
68
- if(!isObject(record[fieldItem])) {
69
- record[fieldItem] = {};
70
- }
71
- return record[fieldItem];
72
- }, obj);
73
-
74
- if (target) {
75
- const targetField = fieldMap.pop();
76
- if (targetField) {
77
- target[targetField] = val;
78
- }
79
- }
80
- } else {
81
- obj[field] = val;
82
- }
83
- };