@doubao-apps/create 0.0.33 → 0.0.34

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 (48) hide show
  1. package/dist/421.js +4 -4
  2. package/dist/cli.js +74 -66
  3. package/dist/index.d.ts +1 -2
  4. package/dist/template-empty/README.md +1 -1
  5. package/dist/template-empty/package.json +2 -2
  6. package/dist/template-starter/README.md +48 -169
  7. package/dist/template-starter/package.json +2 -2
  8. package/dist/template-starter/src/app.config.ts +2 -3
  9. package/dist/template-starter/src/pages/home/index.scss +38 -172
  10. package/dist/template-starter/src/pages/home/index.tsx +20 -78
  11. package/dist/template-starter/src/widgets/hello-world/index.scss +23 -0
  12. package/dist/template-starter/src/widgets/hello-world/index.tsx +29 -0
  13. package/package.json +6 -2
  14. package/dist/template-empty/AGENTS.md +0 -299
  15. package/dist/template-empty/references/examples/common-patterns.md +0 -589
  16. package/dist/template-empty/references/examples/component-basics.md +0 -526
  17. package/dist/template-empty/references/guides/best-practices.md +0 -571
  18. package/dist/template-empty/references/guides/component-development.md +0 -891
  19. package/dist/template-empty/references/guides/performance-optimization.md +0 -402
  20. package/dist/template-empty/references/guides/troubleshooting.md +0 -287
  21. package/dist/template-empty/references/reference/components-quick-ref.md +0 -103
  22. package/dist/template-empty/references/reference/framework-api-quick-ref.md +0 -550
  23. package/dist/template-empty/references/reference/open-api/README.md +0 -8
  24. package/dist/template-empty/references/reference/open-api.md +0 -11
  25. package/dist/template-empty/references/rules/dos-and-donts.md +0 -467
  26. package/dist/template-starter/AGENTS.md +0 -299
  27. package/dist/template-starter/debug-scene/render-home-page-full.json +0 -6
  28. package/dist/template-starter/debug-scene/render-home-page.json +0 -5
  29. package/dist/template-starter/debug-scene/render-react-lynx-page-full.json +0 -6
  30. package/dist/template-starter/references/examples/common-patterns.md +0 -589
  31. package/dist/template-starter/references/examples/component-basics.md +0 -526
  32. package/dist/template-starter/references/guides/best-practices.md +0 -571
  33. package/dist/template-starter/references/guides/component-development.md +0 -891
  34. package/dist/template-starter/references/guides/performance-optimization.md +0 -402
  35. package/dist/template-starter/references/guides/troubleshooting.md +0 -287
  36. package/dist/template-starter/references/reference/components-quick-ref.md +0 -103
  37. package/dist/template-starter/references/reference/framework-api-quick-ref.md +0 -550
  38. package/dist/template-starter/references/reference/open-api/README.md +0 -8
  39. package/dist/template-starter/references/reference/open-api.md +0 -11
  40. package/dist/template-starter/references/rules/dos-and-donts.md +0 -467
  41. package/dist/template-starter/src/pages/applet/index.scss +0 -279
  42. package/dist/template-starter/src/pages/applet/index.tsx +0 -78
  43. package/dist/template-starter/src/pages/lynx/index.scss +0 -249
  44. package/dist/template-starter/src/pages/lynx/index.tsx +0 -78
  45. package/dist/template-starter/src/pages/react-lynx/index.scss +0 -335
  46. package/dist/template-starter/src/pages/react-lynx/index.tsx +0 -132
  47. package/dist/template-starter/src/widgets/weather-card/index.scss +0 -272
  48. package/dist/template-starter/src/widgets/weather-card/index.tsx +0 -193
@@ -1,272 +0,0 @@
1
- :root {
2
- --primary-bg: #0a0a0a;
3
- --secondary-bg: #1a1a1a;
4
- --card-bg: #161616;
5
- --primary-text: #ffffff;
6
- --secondary-text: #a0a0a0;
7
- --accent-text: #00d4ff;
8
- --border-color: #2a2a2a;
9
- --success-color: #00ff88;
10
- --warning-color: #ffaa00;
11
- --error-color: #ff4444;
12
-
13
- --space-xs: 6rpx;
14
- --space-sm: 12rpx;
15
- --space-md: 18rpx;
16
- --space-lg: 24rpx;
17
- --space-xl: 32rpx;
18
- --space-xxl: 48rpx;
19
- --space-xxxl: 64rpx;
20
-
21
- --border-radius-sm: 8rpx;
22
- --border-radius-md: 12rpx;
23
- --border-radius-lg: 16rpx;
24
- --border-radius-xl: 20rpx;
25
-
26
- --shadow-sm: 0 2rpx 6rpx rgba(0, 0, 0, 0.3);
27
- --shadow-md: 0 4rpx 12rpx rgba(0, 0, 0, 0.4);
28
- --shadow-lg: 0 6rpx 20rpx rgba(0, 0, 0, 0.5);
29
- --shadow-xl: 0 8rpx 32rpx rgba(0, 0, 0, 0.6);
30
- }
31
-
32
- .weather-card {
33
- background: var(--card-bg);
34
- border-radius: var(--border-radius-xl);
35
- border: 1rpx solid rgba(255, 255, 255, 0.08);
36
- box-shadow: var(--shadow-lg);
37
- overflow: hidden;
38
- position: relative;
39
- transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
40
-
41
- // Weather-specific gradients
42
- &--sunny {
43
- background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
44
- border-color: rgba(255, 215, 0, 0.2);
45
- }
46
-
47
- &--cloudy {
48
- background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #7e8ba3 100%);
49
- border-color: rgba(135, 206, 235, 0.2);
50
- }
51
-
52
- &--overcast {
53
- background: linear-gradient(135deg, #2c3e50 0%, #34495e 50%, #7f8c8d 100%);
54
- border-color: rgba(112, 128, 144, 0.2);
55
- }
56
-
57
- &--rainy {
58
- background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #4a6fa5 100%);
59
- border-color: rgba(70, 130, 180, 0.2);
60
- }
61
-
62
- &--stormy {
63
- background: linear-gradient(135deg, #0c0c1e 0%, #1a1a3e 50%, #2d1b69 100%);
64
- border-color: rgba(25, 25, 112, 0.2);
65
- }
66
-
67
- &--snowy {
68
- background: linear-gradient(135deg, #e6e9f0 0%, #eef1f5 50%, #f5f7fa 100%);
69
- border-color: rgba(240, 248, 255, 0.3);
70
-
71
- .weather-card__city,
72
- .weather-card__temperature,
73
- .weather-card__condition,
74
- .weather-card__detail-value,
75
- .weather-card__forecast-day,
76
- .weather-card__forecast-high,
77
- .weather-card__forecast-low {
78
- color: #2c3e50 !important;
79
- }
80
-
81
- .weather-card__detail-label,
82
- .weather-card__update-time {
83
- color: #7f8c8d !important;
84
- }
85
- }
86
-
87
- &__container {
88
- padding: var(--space-lg);
89
- position: relative;
90
- z-index: 1;
91
- }
92
-
93
- &__header {
94
- display: flex;
95
- justify-content: space-between;
96
- align-items: flex-start;
97
- margin-bottom: var(--space-md);
98
- }
99
-
100
- &__location-info {
101
- flex: 1;
102
- }
103
-
104
- &__city {
105
- font-size: 32rpx;
106
- font-weight: 700;
107
- color: var(--primary-text);
108
- margin-bottom: var(--space-xs);
109
- display: block;
110
- letter-spacing: 0.5rpx;
111
- }
112
-
113
- &__update-time {
114
- font-size: 20rpx;
115
- color: var(--secondary-text);
116
- display: block;
117
- opacity: 0.8;
118
- }
119
-
120
- &__refresh {
121
- padding: var(--space-sm);
122
- border-radius: var(--border-radius-md);
123
- background: rgba(255, 255, 255, 0.05);
124
- border: 1rpx solid rgba(255, 255, 255, 0.1);
125
- transition: all 0.3s ease;
126
-
127
- &--loading {
128
- animation: pulse 1.5s ease-in-out infinite;
129
- }
130
-
131
- &:active {
132
- background: rgba(255, 255, 255, 0.1);
133
- transform: scale(0.95);
134
- }
135
- }
136
-
137
- &__refresh-icon {
138
- font-size: 24rpx;
139
- color: var(--accent-text);
140
- }
141
-
142
- &__main {
143
- display: flex;
144
- justify-content: space-between;
145
- align-items: center;
146
- margin-bottom: var(--space-lg);
147
- }
148
-
149
- &__current {
150
- flex: 1;
151
- }
152
-
153
- &__temperature {
154
- font-size: 72rpx;
155
- font-weight: 700;
156
- color: var(--primary-text);
157
- margin-bottom: var(--space-xs);
158
- display: block;
159
- line-height: 1;
160
- text-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.3);
161
- }
162
-
163
- &__condition {
164
- font-size: 24rpx;
165
- color: var(--primary-text);
166
- display: block;
167
- opacity: 0.9;
168
- font-weight: 500;
169
- }
170
-
171
- &__icon {
172
- font-size: 64rpx;
173
- line-height: 1;
174
- text-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.2);
175
- }
176
-
177
- &__details {
178
- display: flex;
179
- gap: var(--space-md);
180
- margin-bottom: var(--space-lg);
181
- padding: var(--space-md);
182
- background: rgba(255, 255, 255, 0.03);
183
- border-radius: var(--border-radius-md);
184
- border: 1rpx solid rgba(255, 255, 255, 0.05);
185
-
186
- .weather-card__detail-item {
187
- flex: 1;
188
- }
189
- }
190
-
191
- &__detail-item {
192
- text-align: center;
193
- padding: var(--space-sm) 0;
194
- }
195
-
196
- &__detail-value {
197
- font-size: 24rpx;
198
- font-weight: 600;
199
- color: var(--primary-text);
200
- margin-bottom: var(--space-xs);
201
- display: block;
202
- line-height: 1.2;
203
- }
204
-
205
- &__detail-label {
206
- font-size: 18rpx;
207
- color: var(--secondary-text);
208
- display: block;
209
- opacity: 0.8;
210
- }
211
-
212
- &__forecast {
213
- display: flex;
214
- justify-content: space-between;
215
- padding-top: var(--space-md);
216
- border-top: 1rpx solid rgba(255, 255, 255, 0.1);
217
- }
218
-
219
- &__forecast-item {
220
- flex: 1;
221
- text-align: center;
222
- padding: var(--space-sm);
223
- border-radius: var(--border-radius-sm);
224
- transition: all 0.3s ease;
225
-
226
- &:active {
227
- background: rgba(255, 255, 255, 0.05);
228
- }
229
- }
230
-
231
- &__forecast-day {
232
- font-size: 20rpx;
233
- color: var(--primary-text);
234
- margin-bottom: var(--space-xs);
235
- display: block;
236
- font-weight: 500;
237
- }
238
-
239
- &__forecast-icon {
240
- font-size: 28rpx;
241
- margin-bottom: var(--space-xs);
242
- display: block;
243
- line-height: 1;
244
- }
245
-
246
- &__forecast-temps {
247
- display: flex;
248
- justify-content: center;
249
- gap: var(--space-xs);
250
- }
251
-
252
- &__forecast-high {
253
- font-size: 20rpx;
254
- font-weight: 600;
255
- color: var(--primary-text);
256
- }
257
-
258
- &__forecast-low {
259
- font-size: 20rpx;
260
- color: var(--secondary-text);
261
- opacity: 0.8;
262
- }
263
- }
264
-
265
- @keyframes pulse {
266
- 0%, 100% {
267
- opacity: 1;
268
- }
269
- 50% {
270
- opacity: 0.5;
271
- }
272
- }
@@ -1,193 +0,0 @@
1
- import { defineWidget, useEffect, useState } from '@doubao-apps/framework';
2
- import './index.scss';
3
-
4
- interface WeatherData {
5
- city: string;
6
- temperature: number;
7
- condition: string;
8
- humidity: number;
9
- pressure: number;
10
- windSpeed: number;
11
- icon: string;
12
- lastUpdate: Date;
13
- }
14
-
15
- interface WeatherForecast {
16
- day: string;
17
- high: number;
18
- low: number;
19
- icon: string;
20
- condition: string;
21
- }
22
-
23
- function WeatherCard() {
24
- const [weather, setWeather] = useState<WeatherData>({
25
- city: '北京',
26
- temperature: 22,
27
- condition: '晴朗',
28
- humidity: 45,
29
- pressure: 1013,
30
- windSpeed: 5,
31
- icon: '☀️',
32
- lastUpdate: new Date()
33
- });
34
-
35
- const [forecast, setForecast] = useState<WeatherForecast[]>([
36
- { day: '明天', high: 24, low: 16, icon: '🌤️', condition: '多云' },
37
- { day: '后天', high: 22, low: 14, icon: '⛅', condition: '阴天' },
38
- { day: '周四', high: 20, low: 12, icon: '🌦️', condition: '小雨' }
39
- ]);
40
-
41
- const [loading, setLoading] = useState(false);
42
-
43
- const weatherConditions = [
44
- { condition: '晴朗', icon: '☀️', gradient: 'sunny', color: '#FFD700' },
45
- { condition: '多云', icon: '⛅', gradient: 'cloudy', color: '#87CEEB' },
46
- { condition: '阴天', icon: '☁️', gradient: 'overcast', color: '#708090' },
47
- { condition: '小雨', icon: '🌦️', gradient: 'rainy', color: '#4682B4' },
48
- { condition: '中雨', icon: '🌧️', gradient: 'rainy', color: '#1E90FF' },
49
- { condition: '大雨', icon: '⛈️', gradient: 'stormy', color: '#191970' },
50
- { condition: '雪', icon: '❄️', gradient: 'snowy', color: '#F0F8FF' }
51
- ];
52
-
53
- const formatTime = (date: Date) =>
54
- date.toLocaleTimeString('zh-CN', {
55
- hour: '2-digit',
56
- minute: '2-digit'
57
- });
58
-
59
- const loadWeather = () => {
60
- setLoading(true);
61
- setTimeout(() => {
62
- const randomCondition = weatherConditions[Math.floor(Math.random() * weatherConditions.length)];
63
-
64
- const newWeather = {
65
- city: '北京',
66
- temperature: Math.floor(Math.random() * 20) + 15,
67
- condition: randomCondition.condition,
68
- humidity: Math.floor(Math.random() * 40) + 30,
69
- pressure: 1010 + Math.floor(Math.random() * 20),
70
- windSpeed: Math.floor(Math.random() * 15) + 2,
71
- icon: randomCondition.icon,
72
- lastUpdate: new Date()
73
- };
74
-
75
- const newForecast = [
76
- {
77
- day: '明天',
78
- high: newWeather.temperature + Math.floor(Math.random() * 6) - 2,
79
- low: newWeather.temperature - Math.floor(Math.random() * 6) - 2,
80
- icon: weatherConditions[Math.floor(Math.random() * weatherConditions.length)].icon,
81
- condition: weatherConditions[Math.floor(Math.random() * weatherConditions.length)].condition
82
- },
83
- {
84
- day: '后天',
85
- high: newWeather.temperature + Math.floor(Math.random() * 4) - 2,
86
- low: newWeather.temperature - Math.floor(Math.random() * 4) - 2,
87
- icon: weatherConditions[Math.floor(Math.random() * weatherConditions.length)].icon,
88
- condition: weatherConditions[Math.floor(Math.random() * weatherConditions.length)].condition
89
- },
90
- {
91
- day: '周四',
92
- high: newWeather.temperature + Math.floor(Math.random() * 8) - 4,
93
- low: newWeather.temperature - Math.floor(Math.random() * 8) - 4,
94
- icon: weatherConditions[Math.floor(Math.random() * weatherConditions.length)].icon,
95
- condition: weatherConditions[Math.floor(Math.random() * weatherConditions.length)].condition
96
- }
97
- ];
98
-
99
- setWeather(newWeather);
100
- setForecast(newForecast);
101
- setLoading(false);
102
- }, 800);
103
- };
104
-
105
- useEffect(() => {
106
- loadWeather();
107
- const interval = setInterval(loadWeather, 60000);
108
- return () => clearInterval(interval);
109
- }, []);
110
-
111
- const handleRefresh = () => {
112
- loadWeather();
113
- };
114
-
115
- const currentCondition = weatherConditions.find((c) => c.condition === weather.condition);
116
-
117
- return (
118
- <view className={`weather-card weather-card--${currentCondition?.gradient || 'sunny'}`}>
119
- <view className="weather-card__container">
120
- {/* Header - Compact */}
121
- <view className="weather-card__header">
122
- <view className="weather-card__location-info">
123
- <text className="weather-card__city">{weather.city}</text>
124
- <text className="weather-card__update-time">{formatTime(weather.lastUpdate)}</text>
125
- </view>
126
- <view
127
- className={`weather-card__refresh ${loading ? 'weather-card__refresh--loading' : ''}`}
128
- bindtap={handleRefresh}
129
- >
130
- <text className="weather-card__refresh-icon">⟳</text>
131
- </view>
132
- </view>
133
-
134
- {/* Main Weather Display */}
135
- <view className="weather-card__main">
136
- <view className="weather-card__current">
137
- <text className="weather-card__temperature">{weather.temperature}°</text>
138
- <text className="weather-card__condition">{weather.condition}</text>
139
- </view>
140
- <text className="weather-card__icon">{weather.icon}</text>
141
- </view>
142
-
143
- {/* Weather Details - Compact Grid */}
144
- <view className="weather-card__details">
145
- <view className="weather-card__detail-item">
146
- <text className="weather-card__detail-value">{weather.humidity}%</text>
147
- <text className="weather-card__detail-label">湿度</text>
148
- </view>
149
- <view className="weather-card__detail-item">
150
- <text className="weather-card__detail-value">{weather.windSpeed}m/s</text>
151
- <text className="weather-card__detail-label">风速</text>
152
- </view>
153
- <view className="weather-card__detail-item">
154
- <text className="weather-card__detail-value">{weather.pressure}</text>
155
- <text className="weather-card__detail-label">气压</text>
156
- </view>
157
- </view>
158
-
159
- {/* Forecast - Compact */}
160
- <view className="weather-card__forecast">
161
- {forecast.map((item) => (
162
- <view key={item.day} className="weather-card__forecast-item">
163
- <text className="weather-card__forecast-day">{item.day}</text>
164
- <text className="weather-card__forecast-icon">{item.icon}</text>
165
- <view className="weather-card__forecast-temps">
166
- <text className="weather-card__forecast-high">{item.high}°</text>
167
- <text className="weather-card__forecast-low">{item.low}°</text>
168
- </view>
169
- </view>
170
- ))}
171
- </view>
172
- </view>
173
- </view>
174
- );
175
- }
176
-
177
- export default defineWidget({
178
- onShow() {
179
- console.log('Weather card shown');
180
- },
181
- onHide() {
182
- console.log('Weather card hidden');
183
- },
184
- onForeground() {
185
- console.log('Weather card on foreground');
186
- },
187
- onBackground() {
188
- console.log('Weather card on background');
189
- },
190
- render() {
191
- return <WeatherCard />;
192
- }
193
- });