@star-ai/star-ui 0.0.5 → 0.0.7

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,6 +1,6 @@
1
1
 
2
- // Button 组件入口文件
3
- const StarButton = {
2
+ // Button 组件入口文件
3
+ const StarButton = {
4
4
  name: 'StarButton',
5
5
 
6
6
  // 组件属性定义
@@ -97,57 +97,21 @@ const StarButton = {
97
97
  }
98
98
  }
99
99
  }
100
-
101
- // 添加模板
102
- StarButton.template = `<view
103
- class="star-button"
104
- :class="[
105
- `star-button--${type}`,
106
- `star-button--${size}`,
107
- {
108
- 'star-button--disabled': disabled,
109
- 'star-button--loading': loading,
110
- 'star-button--block': block,
111
- 'star-button--plain': plain
112
- }
113
- ]"
114
- :style="[customStyle]"
115
- @click="handleClick"
116
- >
117
- <!-- 加载状态 -->
118
- <view v-if="loading" class="star-button__loading">
119
- <view class="star-button__loading-spinner"></view>
120
- </view>
121
100
 
122
- <!-- 图标 -->
123
- <text
124
- v-if="icon && !loading"
125
- class="star-button__icon"
126
- :class="icon"
127
- ></text>
101
+ // 添加模板
102
+ StarButton.template = '<view \n class="star-button"\n :class="[\n \`star-button--${type}\`,\n \`star-button--${size}\`,\n {\n \'star-button--disabled\': disabled,\n \'star-button--loading\': loading,\n \'star-button--block\': block,\n \'star-button--plain\': plain\n }\n ]"\n :style="[customStyle]"\n @click="handleClick"\n >\n <!-- 加载状态 -->\n <view v-if="loading" class="star-button__loading">\n <view class="star-button__loading-spinner"></view>\n </view>\n \n <!-- 图标 -->\n <text \n v-if="icon && !loading" \n class="star-button__icon" \n :class="icon"\n ></text>\n \n <!-- 文字内容 -->\n <text class="star-button__text">\n <slot></slot>\n </text>\n \n <!-- 右侧图标 -->\n <text \n v-if="rightIcon && !loading" \n class="star-button__right-icon" \n :class="rightIcon"\n ></text>\n </view>'
128
103
 
129
- <!-- 文字内容 -->
130
- <text class="star-button__text">
131
- <slot></slot>
132
- </text>
104
+ StarButton.install = function(Vue) {
105
+ Vue.component(StarButton.name, StarButton)
106
+ }
133
107
 
134
- <!-- 右侧图标 -->
135
- <text
136
- v-if="rightIcon && !loading"
137
- class="star-button__right-icon"
138
- :class="rightIcon"
139
- ></text>
140
- </view>`
141
-
142
- StarButton.install = function(Vue) {
143
- Vue.component(StarButton.name, StarButton)
144
- }
145
-
146
- // CommonJS 导出
147
- module.exports = StarButton
148
- module.exports.default = StarButton
149
-
150
- // 浏览器全局变量导出
151
- if (typeof window !== 'undefined') {
152
- window.StarButton = StarButton
153
- }
108
+ // CommonJS 导出(仅在支持module的环境中)
109
+ if (typeof module !== 'undefined' && module.exports) {
110
+ module.exports = StarButton
111
+ module.exports.default = StarButton
112
+ }
113
+
114
+ // 浏览器全局变量导出
115
+ if (typeof window !== 'undefined') {
116
+ window.StarButton = StarButton
117
+ }
@@ -1,6 +1,6 @@
1
1
 
2
- // Input 组件入口文件
3
- const StarInput = {
2
+ // Input 组件入口文件
3
+ const StarInput = {
4
4
  name: 'StarInput',
5
5
 
6
6
  props: {
@@ -175,90 +175,21 @@ const StarInput = {
175
175
  }
176
176
  }
177
177
  }
178
-
179
- // 添加模板
180
- StarInput.template = `<view class="star-input" :class="inputClasses">
181
- <!-- 前置内容 -->
182
- <view v-if="$slots.prepend || prepend" class="star-input__prepend">
183
- <slot name="prepend">
184
- <text v-if="prepend" class="star-input__prepend-text">{{ prepend }}</text>
185
- </slot>
186
- </view>
187
178
 
188
- <!-- 输入框主体 -->
189
- <view class="star-input__wrapper">
190
- <!-- 前置图标 -->
191
- <text
192
- v-if="prefixIcon"
193
- class="star-input__prefix-icon"
194
- :class="prefixIcon"
195
- @click="handlePrefixIconClick"
196
- ></text>
197
-
198
- <!-- 输入框 -->
199
- <input
200
- class="star-input__inner"
201
- :type="showPassword ? (passwordVisible ? 'text' : 'password') : type"
202
- :value="currentValue"
203
- :placeholder="placeholder"
204
- :disabled="disabled"
205
- :maxlength="maxlength"
206
- :focus="focus"
207
- :confirm-type="confirmType"
208
- :placeholder-style="placeholderStyle"
209
- :placeholder-class="placeholderClass"
210
- :cursor-spacing="cursorSpacing"
211
- @input="handleInput"
212
- @focus="handleFocus"
213
- @blur="handleBlur"
214
- @confirm="handleConfirm"
215
- @keyboardheightchange="handleKeyboardHeightChange"
216
- />
217
-
218
- <!-- 清除按钮 -->
219
- <view
220
- v-if="clearable && currentValue && !disabled"
221
- class="star-input__clear"
222
- @click="handleClear"
223
- >
224
- <text class="star-icon-close"></text>
225
- </view>
226
-
227
- <!-- 密码可见切换按钮 -->
228
- <view
229
- v-if="showPassword && currentValue"
230
- class="star-input__password-toggle"
231
- @click="togglePasswordVisible"
232
- >
233
- <text :class="passwordVisible ? 'star-icon-eye-open' : 'star-icon-eye-close'"></text>
234
- </view>
235
-
236
- <!-- 后置图标 -->
237
- <text
238
- v-if="suffixIcon"
239
- class="star-input__suffix-icon"
240
- :class="suffixIcon"
241
- @click="handleSuffixIconClick"
242
- ></text>
243
- </view>
179
+ // 添加模板
180
+ StarInput.template = '<view class="star-input" :class="inputClasses">\n <!-- 前置内容 -->\n <view v-if="$slots.prepend || prepend" class="star-input__prepend">\n <slot name="prepend">\n <text v-if="prepend" class="star-input__prepend-text">{{ prepend }}</text>\n </slot>\n </view>\n \n <!-- 输入框主体 -->\n <view class="star-input__wrapper">\n <!-- 前置图标 -->\n <text \n v-if="prefixIcon" \n class="star-input__prefix-icon" \n :class="prefixIcon"\n @click="handlePrefixIconClick"\n ></text>\n \n <!-- 输入框 -->\n <input\n class="star-input__inner"\n :type="showPassword ? (passwordVisible ? \'text\' : \'password\') : type"\n :value="currentValue"\n :placeholder="placeholder"\n :disabled="disabled"\n :maxlength="maxlength"\n :focus="focus"\n :confirm-type="confirmType"\n :placeholder-style="placeholderStyle"\n :placeholder-class="placeholderClass"\n :cursor-spacing="cursorSpacing"\n @input="handleInput"\n @focus="handleFocus"\n @blur="handleBlur"\n @confirm="handleConfirm"\n @keyboardheightchange="handleKeyboardHeightChange"\n />\n \n <!-- 清除按钮 -->\n <view \n v-if="clearable && currentValue && !disabled" \n class="star-input__clear"\n @click="handleClear"\n >\n <text class="star-icon-close"></text>\n </view>\n \n <!-- 密码可见切换按钮 -->\n <view \n v-if="showPassword && currentValue" \n class="star-input__password-toggle"\n @click="togglePasswordVisible"\n >\n <text :class="passwordVisible ? \'star-icon-eye-open\' : \'star-icon-eye-close\'"></text>\n </view>\n \n <!-- 后置图标 -->\n <text \n v-if="suffixIcon" \n class="star-input__suffix-icon" \n :class="suffixIcon"\n @click="handleSuffixIconClick"\n ></text>\n </view>\n \n <!-- 后置内容 -->\n <view v-if="$slots.append || append" class="star-input__append">\n <slot name="append">\n <text v-if="append" class="star-input__append-text">{{ append }}</text>\n </slot>\n </view>\n </view>'
244
181
 
245
- <!-- 后置内容 -->
246
- <view v-if="$slots.append || append" class="star-input__append">
247
- <slot name="append">
248
- <text v-if="append" class="star-input__append-text">{{ append }}</text>
249
- </slot>
250
- </view>
251
- </view>`
252
-
253
- StarInput.install = function(Vue) {
254
- Vue.component(StarInput.name, StarInput)
255
- }
256
-
257
- // CommonJS 导出
258
- module.exports = StarInput
259
- module.exports.default = StarInput
260
-
261
- // 浏览器全局变量导出
262
- if (typeof window !== 'undefined') {
263
- window.StarInput = StarInput
264
- }
182
+ StarInput.install = function(Vue) {
183
+ Vue.component(StarInput.name, StarInput)
184
+ }
185
+
186
+ // CommonJS 导出(仅在支持module的环境中)
187
+ if (typeof module !== 'undefined' && module.exports) {
188
+ module.exports = StarInput
189
+ module.exports.default = StarInput
190
+ }
191
+
192
+ // 浏览器全局变量导出
193
+ if (typeof window !== 'undefined') {
194
+ window.StarInput = StarInput
195
+ }
package/lib/index.js CHANGED
@@ -1,62 +1,53 @@
1
- // star-ui 组件库主入口文件
2
- const packageJson = require('../package.json')
3
-
4
- // 导入所有组件
5
- const StarButton = require('./components/Button/index.js').default
6
- const StarInput = require('./components/Input/index.js').default
7
-
8
- // 组件列表
9
- const components = [
10
- StarButton,
11
- StarInput
12
- ]
13
-
14
- // 安装函数
15
- const install = function(Vue, opts = {}) {
16
- components.forEach(component => {
17
- // 如果组件有install方法,使用install方法注册
18
- if (component.install) {
19
- Vue.use(component)
20
- }
21
- // 如果组件是Vue组件对象,直接注册
22
- else if (component.name) {
23
- Vue.component(component.name, component)
24
- }
25
- })
26
-
27
- // 挂载全局方法
28
- Vue.prototype.$MY_UI = {
29
- size: opts.size || '',
30
- zIndex: opts.zIndex || 2000
31
- }
32
- }
33
-
34
- // 如果是浏览器环境且已引入Vue,则自动安装
35
- if (typeof window !== 'undefined' && window.Vue) {
36
- install(window.Vue)
37
- }
38
-
39
- // 创建导出对象
40
- const StarUI = {
41
- version: packageJson.version,
42
- install,
43
- // 导出所有组件
44
- StarButton,
45
- StarInput
46
- }
47
-
48
- // CommonJS 导出
49
- module.exports = StarUI
50
- module.exports.default = StarUI
51
-
52
- // 为每个组件添加单独的导出(支持按需导入)
53
- components.forEach(component => {
54
- if (component.name) {
55
- module.exports[component.name] = component
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
3
+ typeof define === 'function' && define.amd ? define(factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.StarUI = factory());
5
+ }(this, (function () {
6
+ 'use strict';
7
+
8
+ // 导入组件
9
+ const StarButton = require('./components/Button/index.js');
10
+ const StarInput = require('./components/Input/index.js');
11
+
12
+ // 组件列表
13
+ const components = [
14
+ StarButton,
15
+ StarInput
16
+ ];
17
+
18
+ // 安装函数
19
+ const install = function(Vue, opts = {}) {
20
+ components.forEach(component => {
21
+ // 如果组件有install方法,使用install方法注册
22
+ if (component.install) {
23
+ Vue.use(component);
24
+ }
25
+ // 如果组件是Vue组件对象,直接注册
26
+ else if (component.name) {
27
+ Vue.component(component.name, component);
28
+ }
29
+ });
30
+
31
+ // 挂载全局方法
32
+ Vue.prototype.$MY_UI = {
33
+ size: opts.size || '',
34
+ zIndex: opts.zIndex || 2000
35
+ };
36
+ };
37
+
38
+ // 如果是浏览器环境且已引入Vue,则自动安装
39
+ if (typeof window !== 'undefined' && window.Vue) {
40
+ install(window.Vue);
56
41
  }
57
- })
58
42
 
59
- // 浏览器全局变量导出
60
- if (typeof window !== 'undefined') {
61
- window.StarUI = StarUI
62
- }
43
+ // 创建导出对象
44
+ const StarUI = {
45
+ version: '0.0.7',
46
+ install,
47
+ // 导出所有组件
48
+ StarButton,
49
+ StarInput
50
+ };
51
+
52
+ return StarUI;
53
+ })));
package/lib/package.json CHANGED
@@ -1,13 +1,10 @@
1
1
  {
2
2
  "name": "@star-ai/star-ui",
3
- "version": "0.0.4",
3
+ "version": "0.0.7",
4
4
  "description": "基于Uniapp的Vue2组件库",
5
5
  "main": "index.js",
6
- "files": [
7
- "components",
8
- "styles",
9
- "index.js"
10
- ],
6
+ "module": "index.js",
7
+ "browser": "star-ui.umd.js",
11
8
  "dependencies": {
12
9
  "@vue/shared": "^3.0.0",
13
10
  "core-js": "^3.8.3"
@@ -0,0 +1,64 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
3
+ typeof define === 'function' && define.amd ? define(factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.StarUI = factory());
5
+ }(this, (function () {
6
+ 'use strict';
7
+
8
+ // 组件定义
9
+
10
+ // Button 组件
11
+ const StarButton = window.StarButton || {};
12
+
13
+
14
+ // Input 组件
15
+ const StarInput = window.StarInput || {};
16
+
17
+
18
+ // 组件列表
19
+ const components = [
20
+ StarButton,
21
+ StarInput
22
+ ];
23
+
24
+ // 安装函数
25
+ const install = function(Vue, opts = {}) {
26
+ components.forEach(component => {
27
+ // 如果组件有install方法,使用install方法注册
28
+ if (component.install) {
29
+ Vue.use(component);
30
+ }
31
+ // 如果组件是Vue组件对象,直接注册
32
+ else if (component.name) {
33
+ Vue.component(component.name, component);
34
+ }
35
+ });
36
+
37
+ // 挂载全局方法
38
+ Vue.prototype.$MY_UI = {
39
+ size: opts.size || '',
40
+ zIndex: opts.zIndex || 2000
41
+ };
42
+ };
43
+
44
+ // 如果是浏览器环境且已引入Vue,则自动安装
45
+ if (typeof window !== 'undefined' && window.Vue) {
46
+ install(window.Vue);
47
+ }
48
+
49
+ // 创建导出对象
50
+ const StarUI = {
51
+ version: '0.0.7',
52
+ install,
53
+ // 导出所有组件
54
+ StarButton,
55
+ StarInput
56
+ };
57
+
58
+ // 浏览器全局变量导出
59
+ if (typeof window !== 'undefined') {
60
+ window.StarUI = StarUI;
61
+ }
62
+
63
+ return StarUI;
64
+ })));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@star-ai/star-ui",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "基于Uniapp的Vue2组件库",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.js",