@doubao-dev/plugin-app-dev 0.0.0-stage → 0.0.40-canary-dea0ddc73-20261026073950

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 (107) hide show
  1. package/README.md +10 -2
  2. package/dist/147.js +9 -0
  3. package/dist/assets.d.ts +5 -0
  4. package/dist/assets.js +4 -0
  5. package/dist/index.d.ts +43 -0
  6. package/dist/index.js +1378 -0
  7. package/dist/plugin.d.ts +102 -0
  8. package/dist/plugin.js +4995 -0
  9. package/dist/preview.js +16 -0
  10. package/dist/rslib-runtime.js +33 -0
  11. package/dist/skills/doubao-plugin-app/SKILL.md +21 -0
  12. package/dist/skills/doubao-plugin-app/references/app-development.md +85 -0
  13. package/dist/skills/doubao-plugin-app/references/frontend/components/container-overlay.md +131 -0
  14. package/dist/skills/doubao-plugin-app/references/frontend/components/form-controls.md +146 -0
  15. package/dist/skills/doubao-plugin-app/references/frontend/components/interactive-controls.md +120 -0
  16. package/dist/skills/doubao-plugin-app/references/frontend/components/map-canvas.md +107 -0
  17. package/dist/skills/doubao-plugin-app/references/frontend/components/overview.md +43 -0
  18. package/dist/skills/doubao-plugin-app/references/frontend/components/scroll-list.md +149 -0
  19. package/dist/skills/doubao-plugin-app/references/frontend/components/text-media.md +209 -0
  20. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/01-/345/237/272/347/241/200.md +1389 -0
  21. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/02-/347/263/273/347/273/237.md +1376 -0
  22. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/03-/350/207/252/345/256/232/344/271/211/351/200/232/344/277/241.md +127 -0
  23. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/04-/345/256/232/344/275/215.md +784 -0
  24. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/05-/345/255/230/345/202/250.md +1176 -0
  25. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/06-/350/267/257/347/224/261.md +839 -0
  26. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/07-/347/225/214/351/235/242.md +376 -0
  27. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/08-/344/272/244/344/272/222.md +1319 -0
  28. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/09-/350/276/223/345/205/245.md +192 -0
  29. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/10-/347/275/221/347/273/234.md +900 -0
  30. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/11-/345/252/222/344/275/223.md +1496 -0
  31. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/12-/344/270/232/345/212/241/350/203/275/345/212/233.md +1281 -0
  32. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/13-/347/231/273/345/275/225.md +511 -0
  33. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/14-/346/224/257/344/273/230.md +943 -0
  34. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/15-/346/225/260/346/215/256/345/210/206/346/236/220.md +124 -0
  35. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/16-/350/223/235/347/211/231.md +3364 -0
  36. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/17-wi-fi.md +1028 -0
  37. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/18-/345/212/240/351/200/237/345/272/246/350/256/241.md +354 -0
  38. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/19-ibeacon.md +508 -0
  39. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/20-/347/275/227/347/233/230.md +320 -0
  40. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/21-/350/256/276/345/244/207/346/226/271/345/220/221.md +351 -0
  41. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/22-/351/231/200/350/236/272/344/273/252.md +354 -0
  42. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/23-/345/252/222/344/275/223-/350/256/276/345/244/207-/347/275/221/347/273/234.md +264 -0
  43. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/24-/347/237/255/344/277/241.md +155 -0
  44. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/25-/346/227/240/351/232/234/347/242/215.md +144 -0
  45. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/26-/345/237/272/347/241/200/344/277/241/346/201/257.md +238 -0
  46. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/27-/347/224/265/346/261/240.md +235 -0
  47. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/28-/345/211/252/350/264/264/346/235/277.md +303 -0
  48. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/29-/345/212/240/345/257/206.md +126 -0
  49. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/30-/346/227/245/345/216/206.md +417 -0
  50. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/31-/347/224/265/350/257/235.md +144 -0
  51. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/32-/346/211/253/347/240/201.md +236 -0
  52. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/33-/345/261/217/345/271/225.md +747 -0
  53. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/34-/351/234/207/345/212/250.md +277 -0
  54. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/35-/346/226/207/344/273/266/347/263/273/347/273/237.md +431 -0
  55. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/common-errors.md +69 -0
  56. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/groups.md +43 -0
  57. package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/quick-reference.md +436 -0
  58. package/dist/skills/doubao-plugin-app/references/frontend/examples/common-patterns.md +590 -0
  59. package/dist/skills/doubao-plugin-app/references/frontend/examples/doubao-agentic-service-api-recipes.md +209 -0
  60. package/dist/skills/doubao-plugin-app/references/frontend/examples/page-widget-basics.md +368 -0
  61. package/dist/skills/doubao-plugin-app/references/frontend/examples/page-widget-recipes.md +65 -0
  62. package/dist/skills/doubao-plugin-app/references/frontend/framework/core.md +283 -0
  63. package/dist/skills/doubao-plugin-app/references/frontend/guides/auth.md +277 -0
  64. package/dist/skills/doubao-plugin-app/references/frontend/guides/best-practices.md +574 -0
  65. package/dist/skills/doubao-plugin-app/references/frontend/guides/client-tools-and-events.md +209 -0
  66. package/dist/skills/doubao-plugin-app/references/frontend/guides/component-development.md +832 -0
  67. package/dist/skills/doubao-plugin-app/references/frontend/guides/debugger-mcp.md +537 -0
  68. package/dist/skills/doubao-plugin-app/references/frontend/guides/expired-widget.md +101 -0
  69. package/dist/skills/doubao-plugin-app/references/frontend/guides/performance-optimization.md +417 -0
  70. package/dist/skills/doubao-plugin-app/references/frontend/guides/troubleshooting.md +278 -0
  71. package/dist/skills/doubao-plugin-app/references/frontend/lynx/best-practices.md +720 -0
  72. package/dist/skills/doubao-plugin-app/references/frontend/lynx/css/pseudo-classes.md +149 -0
  73. package/dist/skills/doubao-plugin-app/references/frontend/lynx/css/selectors.md +224 -0
  74. package/dist/skills/doubao-plugin-app/references/frontend/lynx/css/supported-properties.md +269 -0
  75. package/dist/skills/doubao-plugin-app/references/frontend/lynx/css/values-and-units.md +314 -0
  76. package/dist/skills/doubao-plugin-app/references/frontend/lynx/layout/flex-layout.md +334 -0
  77. package/dist/skills/doubao-plugin-app/references/frontend/lynx/layout/grid-layout.md +408 -0
  78. package/dist/skills/doubao-plugin-app/references/frontend/lynx/layout/linear-layout.md +355 -0
  79. package/dist/skills/doubao-plugin-app/references/frontend/lynx/layout/relative-layout.md +189 -0
  80. package/dist/skills/doubao-plugin-app/references/frontend/lynx/lynx-vs-web/css-differences.md +737 -0
  81. package/dist/skills/doubao-plugin-app/references/frontend/lynx/lynx-vs-web/migration-guide.md +669 -0
  82. package/dist/skills/doubao-plugin-app/references/frontend/lynx/lynx-vs-web/unsupported-features.md +290 -0
  83. package/dist/skills/doubao-plugin-app/references/frontend/lynx/overview.md +60 -0
  84. package/dist/skills/doubao-plugin-app/references/frontend/lynx/patterns/animation.md +243 -0
  85. package/dist/skills/doubao-plugin-app/references/frontend/lynx/patterns/responsive.md +194 -0
  86. package/dist/skills/doubao-plugin-app/references/frontend/lynx/patterns/theming.md +143 -0
  87. package/dist/skills/doubao-plugin-app/references/frontend/lynx/quick-reference.md +229 -0
  88. package/dist/skills/doubao-plugin-app/references/frontend/rules/dos-and-donts.md +479 -0
  89. package/dist/skills/doubao-plugin-app/references/frontend/widget-templates/design-boundary.md +46 -0
  90. package/dist/skills/doubao-plugin-app/references/frontend/widget-templates/overview.md +118 -0
  91. package/dist/skills/doubao-plugin-app/references/frontend/widget-templates/props.md +301 -0
  92. package/dist/skills/doubao-plugin-app/references/mcp-and-cards.md +38 -0
  93. package/dist/templates/README.md.template +11 -0
  94. package/dist/templates/com.doubao/app/manifest.yaml +41 -0
  95. package/dist/templates/com.doubao/app/package.json.template +13 -0
  96. package/dist/templates/com.doubao/app/src/app.config.ts.template +5 -0
  97. package/dist/templates/com.doubao/app/src/app.ts.template +3 -0
  98. package/dist/templates/com.doubao/app/src/pages/home/index.css +14 -0
  99. package/dist/templates/com.doubao/app/src/pages/home/index.tsx.template +14 -0
  100. package/dist/templates/com.doubao/app/src/widgets/example/index.tsx.template +29 -0
  101. package/dist/templates/com.doubao/app/tsconfig.json +19 -0
  102. package/dist/templates/mcp.json +9 -0
  103. package/dist/templates/plugin.json.template +29 -0
  104. package/dist/templates/skills/example/SKILL.md.template +14 -0
  105. package/dist/upload.d.ts +44 -0
  106. package/dist/upload.js +38 -0
  107. package/package.json +60 -3
@@ -0,0 +1,290 @@
1
+ # 不支持的 CSS 特性
2
+
3
+ 以下 Web CSS 特性在 Lynx 中**不支持**或**部分支持**。
4
+
5
+ ## ⚠️ 重要:解析但不生效的选择器
6
+
7
+ 以下选择器可以被 CSS 解析器识别(不会报错),但**选择器匹配器并未实现**,因此永远不会匹配到元素,样式也不会生效。这是最常见的陷阱。
8
+
9
+ ### 结构性伪类(解析但不匹配)
10
+
11
+ - ⚠️ `:nth-child()` / `:nth-last-child()`
12
+ - ⚠️ `:nth-of-type()` / `:nth-last-of-type()`
13
+ - ⚠️ `:first-child` / `:last-child`
14
+ - ⚠️ `:only-child`
15
+ - ⚠️ `:first-of-type` / `:last-of-type`
16
+ - ⚠️ `:only-of-type`
17
+ - ⚠️ `:empty`
18
+
19
+ ### 功能性伪类(解析但不匹配)
20
+
21
+ - ⚠️ `:is()`
22
+ - ⚠️ `:where()`
23
+ - ⚠️ `:has()` - 父选择器
24
+ - ⚠️ `:lang()`
25
+ - ⚠️ `:dir()`
26
+
27
+ ### 链接/状态伪类(解析但不匹配)
28
+
29
+ - ⚠️ `:link`
30
+ - ⚠️ `:visited`
31
+ - ⚠️ `:checked` - 表单选中状态(解析但不匹配)
32
+ - ⚠️ `:enabled` / `:disabled` - 表单状态(解析但不匹配)
33
+ - ⚠️ `:default`
34
+
35
+ ### 伪元素(解析但不匹配)
36
+
37
+ - ⚠️ `::before`
38
+ - ⚠️ `::after`
39
+ - ⚠️ `::first-line`
40
+ - ⚠️ `::first-letter`
41
+ - ⚠️ `::backdrop`
42
+
43
+ ### 实际有效的选择器(共 7 个)
44
+
45
+ | 选择器 | 状态 | 说明 |
46
+ | --------------- | ----------- | ------------------ |
47
+ | `:not()` | ✅ 完全支持 | 嵌套选择器匹配 |
48
+ | `:hover` | ✅ 完全支持 | 悬停状态 |
49
+ | `:active` | ✅ 完全支持 | 激活状态 |
50
+ | `:focus` | ✅ 完全支持 | 聚焦状态 |
51
+ | `:root` | ✅ 完全支持 | 匹配根元素(page) |
52
+ | `::placeholder` | ✅ 完全支持 | 占位符样式 |
53
+ | `::selection` | ✅ 完全支持 | 选中文本样式 |
54
+
55
+ > **陷阱提示**:如果你写了 `:first-child` 或 `::before` 这样的选择器,CSS 解析不会报错,但样式永远不会生效。请使用其他方式实现相同效果。
56
+
57
+ ## 完全不支持的特性
58
+
59
+ ### Display
60
+
61
+ - ❌ `display: block` - 默认行为,无需设置
62
+ - ❌ `display: inline` - 使用 `<text>` 组件
63
+ - ❌ `display: inline-block` - 使用 Flex
64
+ - ❌ `display: table*` - 所有表格相关
65
+ - ❌ `display: list-item`
66
+ - ❌ `display: run-in`
67
+ - ❌ `display: contents`
68
+
69
+ ### Float
70
+
71
+ - ❌ `float: left`
72
+ - ❌ `float: right`
73
+ - ❌ `float: none`
74
+ - ❌ `clear: left`
75
+ - ❌ `clear: right`
76
+ - ❌ `clear: both`
77
+ - ❌ `clear: none`
78
+
79
+ ### Position
80
+
81
+ - ❌ `position: static` - 默认就是 relative
82
+
83
+ ### 长度值
84
+
85
+ - ❌ `stretch`
86
+
87
+ ### 单位
88
+
89
+ - ❌ `cm` - 厘米
90
+ - ❌ `mm` - 毫米
91
+ - ❌ `in` - 英寸
92
+ - ❌ `pt` - 点
93
+ - ❌ `pc` - 派卡
94
+ - ❌ `ch` - 字符宽度
95
+ - ❌ `ex` - x 高度
96
+ - ❌ `vmin` - 视口最小值(部分支持)
97
+ - ❌ `vmax` - 视口最大值(部分支持)
98
+
99
+ ### 伪类
100
+
101
+ - ❌ `:is()` - 较新的选择器
102
+ - ❌ `:where()` - 较新的选择器
103
+ - ❌ `:has()` - 父选择器
104
+ - ❌ `:target` - 目标伪类
105
+ - ❌ `:lang()`
106
+ - ❌ `:dir()`
107
+ - ❌ `:read-only`
108
+ - ❌ `:read-write`
109
+ - ❌ `:placeholder-shown`
110
+ - ❌ `:default`
111
+ - ❌ `:checked` - 部分支持
112
+ - ❌ `:indeterminate`
113
+ - ❌ `:valid`
114
+ - ❌ `:invalid`
115
+ - ❌ `:in-range`
116
+ - ❌ `:out-of-range`
117
+ - ❌ `:required`
118
+ - ❌ `:optional`
119
+ - ❌ `:blank`
120
+
121
+ ### 伪元素
122
+
123
+ - ❌ `::before` - 完全不支持
124
+ - ❌ `::after` - 完全不支持
125
+ - ❌ `::first-line` - 首行
126
+ - ❌ `::first-letter` - 首字母
127
+ - ❌ `::marker` - 列表标记
128
+ - ❌ `::backdrop`
129
+ - ❌ `::cue`
130
+ - ❌ `::part()`
131
+ - ❌ `::slotted()`
132
+
133
+ ### 伪元素 content
134
+
135
+ - ❌ `content: "text"` - 不支持生成文本
136
+ - ❌ `content: url()` - 不支持生成图片
137
+ - ❌ `content: attr()` - 不支持
138
+
139
+ ### At-rules
140
+
141
+ #### 媒体查询 @media ⚠️
142
+
143
+ **重要说明**:Lynx **不支持** CSS `@media` 规则。
144
+
145
+ - ❌ **完全不支持**:`@media (min-width: ...)`, `@media (max-width: ...)` - 不会在运行时生效
146
+ - ❌ **不支持**:`@media print` - 打印媒体
147
+ - ❌ **不支持**:`@media speech`, `@media tty` 等其他媒体类型
148
+
149
+ **替代方案**:
150
+
151
+ 1. 使用 **rem + vw** 实现响应式适配(**推荐**)
152
+ 2. 使用 **视口单位**(vw/vh)实现流式布局
153
+ 3. 使用 **JavaScript 动态调整**样式
154
+
155
+ ```css
156
+ /* 推荐方案:使用 rem + vw 代替媒体查询 */
157
+ page {
158
+ font-size: calc(100vw / 23.4375); /* 1rem = 16px @ 375px */
159
+ }
160
+
161
+ .container {
162
+ width: 100vw;
163
+ padding: 4vw; /* 根据视口宽度自动调整 */
164
+ }
165
+
166
+ .title {
167
+ font-size: 2.25rem; /* 约 36px @ 375px,自动根据屏幕宽度缩放 */
168
+ }
169
+
170
+ /* 备选方案:直接使用 vw */
171
+ .subtitle {
172
+ font-size: 4.8vw; /* 约 18px @ 375px */
173
+ }
174
+ ```
175
+
176
+ ```javascript
177
+ // JavaScript 动态调整
178
+ const viewportWidth = /* 获取视口宽度 */;
179
+ if (viewportWidth >= 768) {
180
+ // 应用大屏样式
181
+ }
182
+ ```
183
+
184
+ ```css
185
+ /* 使用视口单位代替媒体查询 */
186
+ .container {
187
+ width: 100vw;
188
+ padding: 4vw; /* 根据视口宽度自动调整 */
189
+ }
190
+ ```
191
+
192
+ #### 其他 At-rules
193
+
194
+ - ❌ `@layer` - CSS 层叠层(Cascading Layers)
195
+ - ❌ `@supports` - 特性查询
196
+ - ❌ `@keyframes` - 某些高级特性
197
+ - ❌ `@import` - 部分支持
198
+ - ❌ `@font-face` - 部分支持
199
+ - ❌ `@charset`
200
+ - ❌ `@namespace`
201
+
202
+ ### 属性
203
+
204
+ - ❌ `content` - 配合 ::before/::after 生成内容
205
+ - ❌ `quotes`
206
+ - ❌ `counter-*`
207
+ - ❌ `list-style-type`
208
+ - ❌ `list-style-image`
209
+ - ❌ `list-style-position`
210
+ - ❌ `caption-side`
211
+ - ❌ `table-layout`
212
+ - ❌ `border-collapse`
213
+ - ❌ `border-spacing`
214
+ - ❌ `empty-cells`
215
+ - ❌ `vertical-align` - 部分支持
216
+ - ❌ `text-indent` - 部分支持
217
+ - ❌ `text-transform`
218
+ - ❌ `letter-spacing` - 部分支持
219
+ - ❌ `word-spacing`
220
+ - ❌ `word-break`
221
+ - ❌ `word-wrap` / `overflow-wrap`
222
+ - ❌ `hyphens`
223
+ - ❌ `tab-size`
224
+ - ❌ `writing-mode`
225
+ - ❌ `text-orientation`
226
+ - ❌ `unicode-bidi`
227
+ - ❌ `white-space: pre | pre-wrap | pre-line | break-spaces` - 仅支持 normal/nowrap
228
+ - ❌ `pointer-events`
229
+ - ❌ `cursor`
230
+ - ❌ `user-select` - 部分支持
231
+ - ❌ `resize`
232
+ - ❌ `scroll-behavior`
233
+ - ❌ `scroll-snap-*`
234
+ - ❌ `overscroll-behavior`
235
+ - ❌ `transform-style`
236
+
237
+ ### 值
238
+
239
+ - ❌ `currentColor` - 部分支持
240
+
241
+ ### env() 函数
242
+
243
+ - ✅ **支持**:`env(safe-area-inset-top)`, `env(safe-area-inset-right)`, `env(safe-area-inset-bottom)`, `env(safe-area-inset-left)` - 安全区域适配
244
+ - ❌ **不支持**:所有其他 `env()` 值(如 `env(titlebar-area-x)`, `env(keyboard-inset-height)` 等)
245
+
246
+ ### 函数
247
+
248
+ - ❌ `min()`
249
+ - ❌ `max()`
250
+ - ❌ `clamp()`
251
+
252
+ ## 部分支持的特性
253
+
254
+ ### Grid 布局
255
+
256
+ - ❌ 命名网格线: `grid-template-columns: [start] 1fr [end]`
257
+ - ❌ `grid-column` 简写属性(请使用 `grid-column-start/end`)
258
+ - ❌ `grid-row` 简写属性(请使用 `grid-row-start/end`)
259
+ - ❌ `grid-area` 简写
260
+ - ⚠️ `minmax()`: 支持基本用法,但复杂场景下行为可能与 Web 不同
261
+
262
+ ### Flexbox
263
+
264
+ - ⚠️ `flex-basis: min-content` - 视为 0px
265
+ - ⚠️ `flex-basis: max-content` - 视为 auto
266
+
267
+ ### 选择器
268
+
269
+ - ⚠️ 属性选择器: `[attr^="val"]`, `[attr$="val"]`, `[attr*="val"]`
270
+
271
+ ### 文本
272
+
273
+ - ⚠️ `text-overflow: fade` - 仅支持 clip/ellipsis
274
+ - ⚠️ `vertical-align`
275
+
276
+ ### 变换
277
+
278
+ - ⚠️ `perspective`
279
+
280
+ ## 替代方案
281
+
282
+ | 不支持的特性 | 替代方案 |
283
+ | ----------------- | ------------------------- |
284
+ | `float` | `display: flex` |
285
+ | `display: inline` | `<text>` 组件 |
286
+ | `min-content` | 使用固定值或 `auto` |
287
+ | `writing-mode` | 使用 transform 旋转 |
288
+ | `word-break` | 调整 `white-space` |
289
+ | `pointer-events` | 调整 `opacity` 或移出屏幕 |
290
+ | `user-select` | 使用平台特定 API |
@@ -0,0 +1,60 @@
1
+ # Lynx API Docs
2
+
3
+ ## Overview
4
+
5
+ **Pre-training knowledge is insufficient for Lynx.** Lynx is a rendering platform (like a browser) with its own elements, non-standard CSS behavior, unique layout systems, and web-incompatible defaults. Always retrieve from these references before writing or modifying Lynx page code.
6
+
7
+ ## Core Rule
8
+
9
+ **MUST ALWAYS read the relevant API docs BEFORE writing or editing any Lynx code.**
10
+
11
+ Do not rely on web CSS knowledge. Do not assume standard HTML behavior. Do not guess element APIs. Lynx is a distinct platform with its own rules.
12
+
13
+ ## Why Web Knowledge Fails
14
+
15
+ Lynx is **not** a web browser. Web assumptions produce broken Lynx code:
16
+
17
+ - **Elements**: `<view>`, `<text>`, `<image>` — not `<div>`, `<span>`, `<img>`
18
+ - **CSS defaults**: `border-box`, no margin collapsing, Linear layout (not Flow)
19
+ - **Properties**: Many CSS properties are unsupported or behave differently — always check `css/` docs
20
+
21
+ **Every web assumption is a potential bug.**
22
+
23
+ ## How to Use the Docs
24
+
25
+ 1. Identify what you're working on (layout, CSS, migration, pattern)
26
+ 2. Look up the relevant doc file from the table below
27
+ 3. **Read the doc BEFORE writing or editing code**
28
+ 4. Apply the rules and constraints from the doc
29
+ 5. If uncertain, search the `layout/` or `css/` directories
30
+
31
+ ## Quick Reference
32
+
33
+ | Task | Read These Files First |
34
+ |------|------------------------|
35
+ | Choose layout | `layout/linear-layout.md` (default), `layout/flex-layout.md`, `layout/grid-layout.md`, `layout/relative-layout.md` |
36
+ | CSS properties/units | `css/supported-properties.md`, `css/values-and-units.md` |
37
+ | CSS selectors | `css/selectors.md`, `css/pseudo-classes.md` |
38
+ | Migrate from web | `lynx-vs-web/migration-guide.md`, `lynx-vs-web/css-differences.md` |
39
+ | Theming/animation/responsive | `patterns/theming.md`, `patterns/animation.md`, `patterns/responsive.md` |
40
+ | General lookup | `quick-reference.md`, `best-practices.md` |
41
+
42
+ ## Core Rules
43
+
44
+ The compact layout decision rules and key CSS constraints are documented in `quick-reference.md`. Most critical:
45
+
46
+ - **Text** must use `<text>` component
47
+ - **Default box-sizing** is `border-box` (not `content-box`)
48
+ - **No margin collapsing**
49
+ - **Use `rem` + `vw`** for screen adaptation
50
+
51
+ ## Red Flags — Stop and Read Docs
52
+
53
+ - Adding a `<div>` or `<span>` → Lynx uses `<view>`, `<text>`
54
+ - Using `margin` without checking if margin collapsing applies → It doesn't
55
+ - Assuming `content-box` → Default is `border-box`
56
+ - Using web CSS properties without checking `css/supported-properties.md`
57
+ - Choosing `rpx` for web-portable code → `rpx` is Lynx-specific; use `rem` + `vw` for web compatibility
58
+ - Writing plain text without `<text>` wrapper → Invalid in Lynx
59
+ - Using web pseudo-classes without checking `css/pseudo-classes.md`
60
+ - Assuming standard HTML flow layout → Lynx uses linear layout by default
@@ -0,0 +1,243 @@
1
+ # 动画效果
2
+
3
+ 在 Lynx 中实现动画和过渡效果。
4
+
5
+ ## 过渡动画
6
+
7
+ ### 基础过渡
8
+
9
+ ```css
10
+ .element {
11
+ transition: all 0.3s ease;
12
+ opacity: 1;
13
+ transform: scale(1);
14
+ }
15
+
16
+ .element:hover {
17
+ opacity: 0.8;
18
+ transform: scale(1.05);
19
+ }
20
+ ```
21
+
22
+ ### 属性特定过渡
23
+
24
+ ```css
25
+ .button {
26
+ background-color: #ff351a;
27
+ transition: background-color 0.3s ease, transform 0.2s ease;
28
+ }
29
+
30
+ .button:active {
31
+ background-color: #e63016;
32
+ transform: scale(0.98);
33
+ }
34
+ ```
35
+
36
+ ## 关键帧动画
37
+
38
+ ### 淡入
39
+
40
+ ```css
41
+ @keyframes fadeIn {
42
+ from {
43
+ opacity: 0;
44
+ }
45
+ to {
46
+ opacity: 1;
47
+ }
48
+ }
49
+
50
+ .fade-in {
51
+ animation: fadeIn 0.3s ease-out;
52
+ }
53
+ ```
54
+
55
+ ### 滑入
56
+
57
+ ```css
58
+ @keyframes slideIn {
59
+ from {
60
+ transform: translateX(-100%);
61
+ opacity: 0;
62
+ }
63
+ to {
64
+ transform: translateX(0);
65
+ opacity: 1;
66
+ }
67
+ }
68
+
69
+ .slide-in {
70
+ animation: slideIn 0.3s ease-out;
71
+ }
72
+ ```
73
+
74
+ ### 弹跳
75
+
76
+ ```css
77
+ @keyframes bounce {
78
+ 0%,
79
+ 100% {
80
+ transform: translateY(0);
81
+ }
82
+ 50% {
83
+ transform: translateY(-10px);
84
+ }
85
+ }
86
+
87
+ .bounce {
88
+ animation: bounce 0.6s ease infinite;
89
+ }
90
+ ```
91
+
92
+ ### 旋转
93
+
94
+ ```css
95
+ @keyframes spin {
96
+ from {
97
+ transform: rotate(0deg);
98
+ }
99
+ to {
100
+ transform: rotate(360deg);
101
+ }
102
+ }
103
+
104
+ .spin {
105
+ animation: spin 1s linear infinite;
106
+ }
107
+ ```
108
+
109
+ ### 脉冲
110
+
111
+ ```css
112
+ @keyframes pulse {
113
+ 0%,
114
+ 100% {
115
+ transform: scale(1);
116
+ opacity: 1;
117
+ }
118
+ 50% {
119
+ transform: scale(1.05);
120
+ opacity: 0.8;
121
+ }
122
+ }
123
+
124
+ .pulse {
125
+ animation: pulse 1.5s ease-in-out infinite;
126
+ }
127
+ ```
128
+
129
+ ## 使用示例
130
+
131
+ ### 列表项进入动画
132
+
133
+ ```jsx
134
+ function List({ items }) {
135
+ return (
136
+ <view className="list">
137
+ {items.map((item, index) => (
138
+ <view
139
+ key={item.id}
140
+ className="list-item"
141
+ style={{ animationDelay: `${index * 0.1}s` }}
142
+ >
143
+ <text>{item.name}</text>
144
+ </view>
145
+ ))}
146
+ </view>
147
+ );
148
+ }
149
+ ```
150
+
151
+ ```css
152
+ .list-item {
153
+ opacity: 0;
154
+ animation: slideIn 0.3s ease-out forwards;
155
+ }
156
+
157
+ @keyframes slideIn {
158
+ from {
159
+ transform: translateX(-20px);
160
+ opacity: 0;
161
+ }
162
+ to {
163
+ transform: translateX(0);
164
+ opacity: 1;
165
+ }
166
+ }
167
+ ```
168
+
169
+ ### 加载动画
170
+
171
+ ```css
172
+ .loading-spinner {
173
+ width: 40px;
174
+ height: 40px;
175
+ border: 3px solid #f0f0f0;
176
+ border-top-color: #ff351a;
177
+ border-radius: 50%;
178
+ animation: spin 0.8s linear infinite;
179
+ }
180
+ ```
181
+
182
+ ### 骨架屏闪烁
183
+
184
+ ```css
185
+ .skeleton {
186
+ background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
187
+ background-size: 200% 100%;
188
+ animation: shimmer 1.5s infinite;
189
+ }
190
+
191
+ @keyframes shimmer {
192
+ 0% {
193
+ background-position: 200% 0;
194
+ }
195
+ 100% {
196
+ background-position: -200% 0;
197
+ }
198
+ }
199
+ ```
200
+
201
+ ## 性能优化
202
+
203
+ ### 使用 transform 和 opacity
204
+
205
+ ```css
206
+ /* ✅ 性能友好 */
207
+ .optimized {
208
+ transition: transform 0.3s ease, opacity 0.3s ease;
209
+ will-change: transform, opacity;
210
+ }
211
+
212
+ /* ❌ 避免动画这些属性 */
213
+ .slow {
214
+ transition: width 0.3s, height 0.3s, margin 0.3s;
215
+ }
216
+ ```
217
+
218
+ ### 硬件加速
219
+
220
+ ```css
221
+ .gpu-accelerated {
222
+ transform: translateZ(0);
223
+ /* 或 */
224
+ transform: translate3d(0, 0, 0);
225
+ }
226
+ ```
227
+
228
+ ### 移除 will-change
229
+
230
+ ```css
231
+ .animation-complete {
232
+ will-change: auto;
233
+ }
234
+ ```
235
+
236
+ ## 动画最佳实践
237
+
238
+ 1. **使用 transform 和 opacity**: 性能最好的动画属性
239
+ 2. **限制动画数量**: 避免同时运行太多动画
240
+ 3. **使用 will-change**: 提前告知浏览器优化
241
+ 4. **动画完成后清理**: 移除 will-change 和动画类
242
+ 5. **减少重排**: 避免动画 width、height、margin 等属性
243
+ 6. **合理使用 requestAnimationFrame**: 复杂动画使用 JS 控制