@unif/react-native-design 0.33.0 → 0.34.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 (188) hide show
  1. package/lib/module/components/ui/ActionMenuContent/ActionMenuContent.js +97 -0
  2. package/lib/module/components/ui/ActionMenuContent/ActionMenuContent.js.map +1 -0
  3. package/lib/module/components/ui/ActionMenuContent/index.js +4 -0
  4. package/lib/module/components/ui/ActionMenuContent/index.js.map +1 -0
  5. package/lib/module/components/ui/ActionMenuContent/styles.js +54 -0
  6. package/lib/module/components/ui/ActionMenuContent/styles.js.map +1 -0
  7. package/lib/module/components/ui/ActionMenuContent/types.js.map +1 -0
  8. package/lib/module/components/ui/Avatar/Avatar.js +3 -3
  9. package/lib/module/components/ui/Avatar/Avatar.js.map +1 -1
  10. package/lib/module/components/ui/Button/ButtonBase.js +10 -2
  11. package/lib/module/components/ui/Button/ButtonBase.js.map +1 -1
  12. package/lib/module/components/ui/DrawerHeader/DrawerHeader.js +3 -3
  13. package/lib/module/components/ui/DrawerHeader/DrawerHeader.js.map +1 -1
  14. package/lib/module/components/ui/IconButton/IconButton.js +5 -1
  15. package/lib/module/components/ui/IconButton/IconButton.js.map +1 -1
  16. package/lib/module/components/ui/ImagePreview/ImagePreview.js +200 -0
  17. package/lib/module/components/ui/ImagePreview/ImagePreview.js.map +1 -0
  18. package/lib/module/components/ui/ImagePreview/constants.js +5 -0
  19. package/lib/module/components/ui/ImagePreview/constants.js.map +1 -0
  20. package/lib/module/components/ui/ImagePreview/index.js +4 -0
  21. package/lib/module/components/ui/ImagePreview/index.js.map +1 -0
  22. package/lib/module/components/ui/ImagePreview/styles.js +55 -0
  23. package/lib/module/components/ui/ImagePreview/styles.js.map +1 -0
  24. package/lib/module/components/ui/ImagePreview/types.js +4 -0
  25. package/lib/module/components/ui/ImagePreview/types.js.map +1 -0
  26. package/lib/module/components/ui/Sheet/Sheet.js +40 -0
  27. package/lib/module/components/ui/Sheet/Sheet.js.map +1 -0
  28. package/lib/module/components/ui/Sheet/index.js +4 -0
  29. package/lib/module/components/ui/Sheet/index.js.map +1 -0
  30. package/lib/module/components/ui/Sheet/styles.js +41 -0
  31. package/lib/module/components/ui/Sheet/styles.js.map +1 -0
  32. package/lib/module/components/ui/Sheet/types.js +4 -0
  33. package/lib/module/components/ui/Sheet/types.js.map +1 -0
  34. package/lib/module/components/ui/SmsField/SmsField.js +40 -0
  35. package/lib/module/components/ui/SmsField/SmsField.js.map +1 -0
  36. package/lib/module/components/ui/SmsField/index.js +4 -0
  37. package/lib/module/components/ui/SmsField/index.js.map +1 -0
  38. package/lib/module/components/ui/SmsField/types.js +4 -0
  39. package/lib/module/components/ui/SmsField/types.js.map +1 -0
  40. package/lib/module/components/ui/TextEntryContent/TextEntryContent.js +60 -0
  41. package/lib/module/components/ui/TextEntryContent/TextEntryContent.js.map +1 -0
  42. package/lib/module/components/ui/TextEntryContent/index.js +4 -0
  43. package/lib/module/components/ui/TextEntryContent/index.js.map +1 -0
  44. package/lib/module/components/ui/TextEntryContent/styles.js +29 -0
  45. package/lib/module/components/ui/TextEntryContent/styles.js.map +1 -0
  46. package/lib/module/components/ui/TextEntryContent/types.js +4 -0
  47. package/lib/module/components/ui/TextEntryContent/types.js.map +1 -0
  48. package/lib/module/components/ui/Thumbnail/Thumbnail.js +3 -3
  49. package/lib/module/components/ui/Thumbnail/Thumbnail.js.map +1 -1
  50. package/lib/module/components/ui/index.js +5 -1
  51. package/lib/module/components/ui/index.js.map +1 -1
  52. package/lib/module/components/ui/shared/ImageAttempt.js.map +1 -1
  53. package/lib/module/components/ui/shared/selectImageAttemptSource.shared.js +6 -5
  54. package/lib/module/components/ui/shared/selectImageAttemptSource.shared.js.map +1 -1
  55. package/lib/module/components/ui/shared/useImageSource.js +11 -0
  56. package/lib/module/components/ui/shared/useImageSource.js.map +1 -0
  57. package/lib/module/icons/data.js +87 -1
  58. package/lib/module/icons/data.js.map +1 -1
  59. package/lib/module/utils/imageSource.js +47 -13
  60. package/lib/module/utils/imageSource.js.map +1 -1
  61. package/lib/typescript/src/components/ui/ActionMenuContent/ActionMenuContent.d.ts +4 -0
  62. package/lib/typescript/src/components/ui/ActionMenuContent/ActionMenuContent.d.ts.map +1 -0
  63. package/lib/typescript/src/components/ui/ActionMenuContent/index.d.ts +3 -0
  64. package/lib/typescript/src/components/ui/ActionMenuContent/index.d.ts.map +1 -0
  65. package/lib/typescript/src/components/ui/ActionMenuContent/styles.d.ts +51 -0
  66. package/lib/typescript/src/components/ui/ActionMenuContent/styles.d.ts.map +1 -0
  67. package/lib/typescript/src/components/ui/ActionMenuContent/types.d.ts +25 -0
  68. package/lib/typescript/src/components/ui/ActionMenuContent/types.d.ts.map +1 -0
  69. package/lib/typescript/src/components/ui/Button/ButtonBase.d.ts +3 -1
  70. package/lib/typescript/src/components/ui/Button/ButtonBase.d.ts.map +1 -1
  71. package/lib/typescript/src/components/ui/IconButton/IconButton.d.ts +1 -1
  72. package/lib/typescript/src/components/ui/IconButton/IconButton.d.ts.map +1 -1
  73. package/lib/typescript/src/components/ui/IconButton/types.d.ts +4 -0
  74. package/lib/typescript/src/components/ui/IconButton/types.d.ts.map +1 -1
  75. package/lib/typescript/src/components/ui/ImagePreview/ImagePreview.d.ts +3 -0
  76. package/lib/typescript/src/components/ui/ImagePreview/ImagePreview.d.ts.map +1 -0
  77. package/lib/typescript/src/components/ui/ImagePreview/constants.d.ts +3 -0
  78. package/lib/typescript/src/components/ui/ImagePreview/constants.d.ts.map +1 -0
  79. package/lib/typescript/src/components/ui/ImagePreview/index.d.ts +3 -0
  80. package/lib/typescript/src/components/ui/ImagePreview/index.d.ts.map +1 -0
  81. package/lib/typescript/src/components/ui/ImagePreview/styles.d.ts +56 -0
  82. package/lib/typescript/src/components/ui/ImagePreview/styles.d.ts.map +1 -0
  83. package/lib/typescript/src/components/ui/ImagePreview/types.d.ts +33 -0
  84. package/lib/typescript/src/components/ui/ImagePreview/types.d.ts.map +1 -0
  85. package/lib/typescript/src/components/ui/Sheet/Sheet.d.ts +4 -0
  86. package/lib/typescript/src/components/ui/Sheet/Sheet.d.ts.map +1 -0
  87. package/lib/typescript/src/components/ui/Sheet/index.d.ts +3 -0
  88. package/lib/typescript/src/components/ui/Sheet/index.d.ts.map +1 -0
  89. package/lib/typescript/src/components/ui/Sheet/styles.d.ts +38 -0
  90. package/lib/typescript/src/components/ui/Sheet/styles.d.ts.map +1 -0
  91. package/lib/typescript/src/components/ui/Sheet/types.d.ts +13 -0
  92. package/lib/typescript/src/components/ui/Sheet/types.d.ts.map +1 -0
  93. package/lib/typescript/src/components/ui/SmsField/SmsField.d.ts +4 -0
  94. package/lib/typescript/src/components/ui/SmsField/SmsField.d.ts.map +1 -0
  95. package/lib/typescript/src/components/ui/SmsField/index.d.ts +3 -0
  96. package/lib/typescript/src/components/ui/SmsField/index.d.ts.map +1 -0
  97. package/lib/typescript/src/components/ui/SmsField/types.d.ts +12 -0
  98. package/lib/typescript/src/components/ui/SmsField/types.d.ts.map +1 -0
  99. package/lib/typescript/src/components/ui/TextEntryContent/TextEntryContent.d.ts +4 -0
  100. package/lib/typescript/src/components/ui/TextEntryContent/TextEntryContent.d.ts.map +1 -0
  101. package/lib/typescript/src/components/ui/TextEntryContent/index.d.ts +3 -0
  102. package/lib/typescript/src/components/ui/TextEntryContent/index.d.ts.map +1 -0
  103. package/lib/typescript/src/components/ui/TextEntryContent/styles.d.ts +26 -0
  104. package/lib/typescript/src/components/ui/TextEntryContent/styles.d.ts.map +1 -0
  105. package/lib/typescript/src/components/ui/TextEntryContent/types.d.ts +18 -0
  106. package/lib/typescript/src/components/ui/TextEntryContent/types.d.ts.map +1 -0
  107. package/lib/typescript/src/components/ui/index.d.ts +10 -2
  108. package/lib/typescript/src/components/ui/index.d.ts.map +1 -1
  109. package/lib/typescript/src/components/ui/shared/ImageAttempt.d.ts +3 -2
  110. package/lib/typescript/src/components/ui/shared/ImageAttempt.d.ts.map +1 -1
  111. package/lib/typescript/src/components/ui/shared/selectImageAttemptSource.shared.d.ts +3 -2
  112. package/lib/typescript/src/components/ui/shared/selectImageAttemptSource.shared.d.ts.map +1 -1
  113. package/lib/typescript/src/components/ui/shared/useImageSource.d.ts +6 -0
  114. package/lib/typescript/src/components/ui/shared/useImageSource.d.ts.map +1 -0
  115. package/lib/typescript/src/icons/data.d.ts +1 -1
  116. package/lib/typescript/src/icons/data.d.ts.map +1 -1
  117. package/lib/typescript/src/utils/imageSource.d.ts +3 -2
  118. package/lib/typescript/src/utils/imageSource.d.ts.map +1 -1
  119. package/lib/typescript/type-tests/content-api.d.ts +2 -0
  120. package/lib/typescript/type-tests/content-api.d.ts.map +1 -0
  121. package/package.json +1 -1
  122. package/src/components/ui/ActionMenuContent/ActionMenuContent.tsx +118 -0
  123. package/src/components/ui/ActionMenuContent/index.ts +6 -0
  124. package/src/components/ui/ActionMenuContent/styles.ts +47 -0
  125. package/src/components/ui/ActionMenuContent/types.ts +27 -0
  126. package/src/components/ui/Avatar/Avatar.tsx +3 -3
  127. package/src/components/ui/Button/ButtonBase.tsx +11 -2
  128. package/src/components/ui/DrawerHeader/DrawerHeader.tsx +3 -3
  129. package/src/components/ui/IconButton/IconButton.tsx +9 -1
  130. package/src/components/ui/IconButton/types.ts +4 -0
  131. package/src/components/ui/ImagePreview/ImagePreview.tsx +243 -0
  132. package/src/components/ui/ImagePreview/constants.ts +2 -0
  133. package/src/components/ui/ImagePreview/index.ts +6 -0
  134. package/src/components/ui/ImagePreview/styles.ts +48 -0
  135. package/src/components/ui/ImagePreview/types.ts +37 -0
  136. package/src/components/ui/Sheet/Sheet.tsx +43 -0
  137. package/src/components/ui/Sheet/index.ts +2 -0
  138. package/src/components/ui/Sheet/styles.ts +40 -0
  139. package/src/components/ui/Sheet/types.ts +14 -0
  140. package/src/components/ui/SmsField/SmsField.tsx +40 -0
  141. package/src/components/ui/SmsField/index.ts +2 -0
  142. package/src/components/ui/SmsField/types.ts +15 -0
  143. package/src/components/ui/TextEntryContent/TextEntryContent.tsx +56 -0
  144. package/src/components/ui/TextEntryContent/index.ts +2 -0
  145. package/src/components/ui/TextEntryContent/styles.ts +17 -0
  146. package/src/components/ui/TextEntryContent/types.ts +18 -0
  147. package/src/components/ui/Thumbnail/Thumbnail.tsx +3 -3
  148. package/src/components/ui/index.ts +18 -2
  149. package/src/components/ui/shared/ImageAttempt.tsx +3 -2
  150. package/src/components/ui/shared/selectImageAttemptSource.shared.ts +7 -5
  151. package/src/components/ui/shared/useImageSource.ts +8 -0
  152. package/src/icons/data.ts +134 -0
  153. package/src/utils/imageSource.ts +78 -15
  154. package/lib/module/components/ui/BorderBeam/BorderBeam.js +0 -102
  155. package/lib/module/components/ui/BorderBeam/BorderBeam.js.map +0 -1
  156. package/lib/module/components/ui/BorderBeam/BorderBeam.web.js +0 -108
  157. package/lib/module/components/ui/BorderBeam/BorderBeam.web.js.map +0 -1
  158. package/lib/module/components/ui/BorderBeam/index.js +0 -4
  159. package/lib/module/components/ui/BorderBeam/index.js.map +0 -1
  160. package/lib/module/components/ui/BorderBeam/normalizeBorderBeam.js +0 -23
  161. package/lib/module/components/ui/BorderBeam/normalizeBorderBeam.js.map +0 -1
  162. package/lib/module/components/ui/BorderBeam/shared.js +0 -54
  163. package/lib/module/components/ui/BorderBeam/shared.js.map +0 -1
  164. package/lib/module/components/ui/BorderBeam/styles.js +0 -18
  165. package/lib/module/components/ui/BorderBeam/styles.js.map +0 -1
  166. package/lib/module/components/ui/BorderBeam/types.js.map +0 -1
  167. package/lib/typescript/src/components/ui/BorderBeam/BorderBeam.d.ts +0 -10
  168. package/lib/typescript/src/components/ui/BorderBeam/BorderBeam.d.ts.map +0 -1
  169. package/lib/typescript/src/components/ui/BorderBeam/BorderBeam.web.d.ts +0 -5
  170. package/lib/typescript/src/components/ui/BorderBeam/BorderBeam.web.d.ts.map +0 -1
  171. package/lib/typescript/src/components/ui/BorderBeam/index.d.ts +0 -3
  172. package/lib/typescript/src/components/ui/BorderBeam/index.d.ts.map +0 -1
  173. package/lib/typescript/src/components/ui/BorderBeam/normalizeBorderBeam.d.ts +0 -16
  174. package/lib/typescript/src/components/ui/BorderBeam/normalizeBorderBeam.d.ts.map +0 -1
  175. package/lib/typescript/src/components/ui/BorderBeam/shared.d.ts +0 -28
  176. package/lib/typescript/src/components/ui/BorderBeam/shared.d.ts.map +0 -1
  177. package/lib/typescript/src/components/ui/BorderBeam/styles.d.ts +0 -15
  178. package/lib/typescript/src/components/ui/BorderBeam/styles.d.ts.map +0 -1
  179. package/lib/typescript/src/components/ui/BorderBeam/types.d.ts +0 -23
  180. package/lib/typescript/src/components/ui/BorderBeam/types.d.ts.map +0 -1
  181. package/src/components/ui/BorderBeam/BorderBeam.tsx +0 -130
  182. package/src/components/ui/BorderBeam/BorderBeam.web.tsx +0 -127
  183. package/src/components/ui/BorderBeam/index.ts +0 -2
  184. package/src/components/ui/BorderBeam/normalizeBorderBeam.ts +0 -58
  185. package/src/components/ui/BorderBeam/shared.ts +0 -47
  186. package/src/components/ui/BorderBeam/styles.ts +0 -16
  187. package/src/components/ui/BorderBeam/types.ts +0 -23
  188. /package/lib/module/components/ui/{BorderBeam → ActionMenuContent}/types.js +0 -0
@@ -20,13 +20,14 @@ type SnapshotResult =
20
20
  valid: true;
21
21
  snapshot: SnapshotValue;
22
22
  canonical: string;
23
+ children?: ReadonlyMap<string, SnapshotResult>;
23
24
  }
24
25
  | {
25
26
  valid: false;
26
27
  canonical: string;
27
28
  };
28
29
 
29
- type ResolvedImageSource = Readonly<{
30
+ export type ResolvedImageSource = Readonly<{
30
31
  source: ImageSourcePropType;
31
32
  key: string;
32
33
  }>;
@@ -34,8 +35,12 @@ type ResolvedImageSource = Readonly<{
34
35
  const hasOwn = (value: object, key: PropertyKey): boolean =>
35
36
  Object.prototype.hasOwnProperty.call(value, key);
36
37
 
37
- function valid(snapshot: SnapshotValue, canonical: string): SnapshotResult {
38
- return { valid: true, snapshot, canonical };
38
+ function valid(
39
+ snapshot: SnapshotValue,
40
+ canonical: string,
41
+ children?: ReadonlyMap<string, SnapshotResult>
42
+ ): SnapshotResult {
43
+ return { valid: true, snapshot, canonical, children };
39
44
  }
40
45
 
41
46
  function invalid(kind: string): SnapshotResult {
@@ -45,7 +50,8 @@ function invalid(kind: string): SnapshotResult {
45
50
  function visitArray(
46
51
  value: object,
47
52
  keys: readonly string[],
48
- seen: WeakSet<object>
53
+ seen: WeakSet<object>,
54
+ previous?: SnapshotResult
49
55
  ): SnapshotResult {
50
56
  if (!keys.includes('length')) return invalid('descriptor');
51
57
 
@@ -67,6 +73,12 @@ function visitArray(
67
73
  const keySet = new Set(keys);
68
74
  const parts: string[] = [];
69
75
  const snapshot: SnapshotValue[] = [];
76
+ const children = new Map<string, SnapshotResult>();
77
+ const previousChildren = previous?.valid ? previous.children : undefined;
78
+ let unchanged =
79
+ previous?.valid === true &&
80
+ Array.isArray(previous.snapshot) &&
81
+ previousChildren?.size === length;
70
82
  let allValid = true;
71
83
 
72
84
  for (let index = 0; index < length; index += 1) {
@@ -82,7 +94,10 @@ function visitArray(
82
94
  return invalid('descriptor');
83
95
  }
84
96
 
85
- const item = visit(descriptor.value, seen);
97
+ const priorItem = previousChildren?.get(key);
98
+ const item = visit(descriptor.value, seen, priorItem);
99
+ children.set(key, item);
100
+ unchanged = unchanged && item === priorItem;
86
101
  parts.push(item.canonical);
87
102
  if (item.valid) {
88
103
  snapshot.push(item.snapshot);
@@ -91,19 +106,29 @@ function visitArray(
91
106
  }
92
107
  }
93
108
 
109
+ if (allValid && unchanged && previous?.valid) return previous;
94
110
  const canonical = `array:[${parts.join(',')}]`;
95
111
  return allValid
96
- ? valid(Object.freeze(snapshot), canonical)
112
+ ? valid(Object.freeze(snapshot), canonical, children)
97
113
  : { valid: false, canonical };
98
114
  }
99
115
 
100
116
  function visitObject(
101
117
  value: object,
102
118
  keys: readonly string[],
103
- seen: WeakSet<object>
119
+ seen: WeakSet<object>,
120
+ previous?: SnapshotResult
104
121
  ): SnapshotResult {
105
122
  const snapshot: Record<string, SnapshotValue> = {};
106
123
  const parts: string[] = [];
124
+ const children = new Map<string, SnapshotResult>();
125
+ const previousChildren = previous?.valid ? previous.children : undefined;
126
+ let unchanged =
127
+ previous?.valid === true &&
128
+ previous.snapshot !== null &&
129
+ typeof previous.snapshot === 'object' &&
130
+ !Array.isArray(previous.snapshot) &&
131
+ previousChildren?.size === keys.length;
107
132
  let allValid = true;
108
133
 
109
134
  for (const key of [...keys].sort()) {
@@ -112,7 +137,10 @@ function visitObject(
112
137
  if (!descriptor.enumerable) return invalid('non-enumerable');
113
138
  if (!hasOwn(descriptor, 'value')) return invalid('accessor');
114
139
 
115
- const item = visit(descriptor.value, seen);
140
+ const priorItem = previousChildren?.get(key);
141
+ const item = visit(descriptor.value, seen, priorItem);
142
+ children.set(key, item);
143
+ unchanged = unchanged && item === priorItem;
116
144
  parts.push(`${JSON.stringify(key)}:${item.canonical}`);
117
145
  if (item.valid) {
118
146
  Object.defineProperty(snapshot, key, {
@@ -126,9 +154,10 @@ function visitObject(
126
154
  }
127
155
  }
128
156
 
157
+ if (allValid && unchanged && previous?.valid) return previous;
129
158
  const canonical = `object:{${parts.join(',')}}`;
130
159
  return allValid
131
- ? valid(Object.freeze(snapshot), canonical)
160
+ ? valid(Object.freeze(snapshot), canonical, children)
132
161
  : { valid: false, canonical };
133
162
  }
134
163
 
@@ -136,7 +165,19 @@ function visitObject(
136
165
  * 只从 own data descriptor 读取一次,绝不执行 getter。snapshot 与 canonical
137
166
  * key 因而来自同一份值;任何 descriptor / Proxy 异常都失败关闭。
138
167
  */
139
- function visit(value: unknown, seen: WeakSet<object>): SnapshotResult {
168
+ function visit(
169
+ value: unknown,
170
+ seen: WeakSet<object>,
171
+ previous?: SnapshotResult
172
+ ): SnapshotResult {
173
+ // Objects are always re-read through their descriptors: callers can mutate
174
+ // an existing source or supply a Proxy. Only observed primitive values are reused.
175
+ if (
176
+ (value === null || typeof value !== 'object') &&
177
+ previous?.valid &&
178
+ Object.is(previous.snapshot, value)
179
+ )
180
+ return previous;
140
181
  if (value === undefined) return valid(undefined, 'undefined:');
141
182
  if (value === null) return valid(null, 'null:');
142
183
 
@@ -173,8 +214,8 @@ function visit(value: unknown, seen: WeakSet<object>): SnapshotResult {
173
214
  seen.add(value);
174
215
  try {
175
216
  return isArray
176
- ? visitArray(value, keys, seen)
177
- : visitObject(value, keys, seen);
217
+ ? visitArray(value, keys, seen, previous)
218
+ : visitObject(value, keys, seen, previous);
178
219
  } finally {
179
220
  seen.delete(value);
180
221
  }
@@ -183,9 +224,12 @@ function visit(value: unknown, seen: WeakSet<object>): SnapshotResult {
183
224
  }
184
225
  }
185
226
 
186
- function snapshotValue(value: unknown): SnapshotResult {
227
+ function snapshotValue(
228
+ value: unknown,
229
+ previous?: SnapshotResult
230
+ ): SnapshotResult {
187
231
  try {
188
- return visit(value, new WeakSet<object>());
232
+ return visit(value, new WeakSet<object>(), previous);
189
233
  } catch {
190
234
  return invalid('exception');
191
235
  }
@@ -273,7 +317,12 @@ function asImageSource(
273
317
  export function resolveImageSource(
274
318
  source: unknown
275
319
  ): ResolvedImageSource | undefined {
276
- const result = snapshotValue(source);
320
+ return resolveSnapshot(snapshotValue(source));
321
+ }
322
+
323
+ function resolveSnapshot(
324
+ result: SnapshotResult
325
+ ): ResolvedImageSource | undefined {
277
326
  if (!result.valid) return undefined;
278
327
 
279
328
  const snapshot = asImageSource(result.snapshot);
@@ -285,6 +334,20 @@ export function resolveImageSource(
285
334
  });
286
335
  }
287
336
 
337
+ /** One resolver belongs to one mounted media component; only its latest tree is kept. */
338
+ export function createImageSourceResolver() {
339
+ let previous: SnapshotResult | undefined;
340
+ let resolved: ResolvedImageSource | undefined;
341
+ return (source: unknown): ResolvedImageSource | undefined => {
342
+ const next = snapshotValue(source, previous);
343
+ if (next !== previous) {
344
+ resolved = resolveSnapshot(next);
345
+ previous = resolved === undefined ? undefined : next;
346
+ }
347
+ return resolved;
348
+ };
349
+ }
350
+
288
351
  export function imageSourceKey(
289
352
  source: ImageSourcePropType | undefined
290
353
  ): string {
@@ -1,102 +0,0 @@
1
- "use strict";
2
-
3
- import React, { useEffect, useState } from 'react';
4
- import { View } from 'react-native';
5
- import Animated, { cancelAnimation, Easing, ReduceMotion, useAnimatedProps, useSharedValue, withRepeat, withTiming } from 'react-native-reanimated';
6
- import Svg, { Rect } from 'react-native-svg';
7
- import { radius, useColors, usePrefersReducedMotion } from "../../../theme/index.js";
8
- import { A11Y_HIDDEN_PROPS } from "../shared/a11y.js";
9
- import { normalizeBorderBeam } from "./normalizeBorderBeam.js";
10
- import { borderBeamGeometry, borderBeamTrail, EMPTY_BORDER_BEAM_LAYOUT } from "./shared.js";
11
- import { styles } from "./styles.js";
12
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- const AnimatedRect = Animated.createAnimatedComponent(Rect);
14
-
15
- /**
16
- * 沿内容边缘循环移动的装饰性流光描边。
17
- *
18
- * 组件不承载加载、错误或焦点语义;业务状态仍由调用方自己的可访问元素表达。
19
- * 系统开启「减弱动态效果」时隐藏流光,只保留原内容。
20
- */
21
- export function BorderBeam({
22
- children,
23
- active = true,
24
- color,
25
- duration,
26
- lineWidth,
27
- size,
28
- borderRadius = radius.md,
29
- style,
30
- testID
31
- }) {
32
- const colors = useColors();
33
- const reducedMotion = usePrefersReducedMotion();
34
- const [layout, setLayout] = useState(EMPTY_BORDER_BEAM_LAYOUT);
35
- const normalized = normalizeBorderBeam({
36
- duration,
37
- lineWidth,
38
- size,
39
- borderRadius
40
- });
41
- const geometry = borderBeamGeometry({
42
- layout,
43
- ...normalized
44
- });
45
- const trail = borderBeamTrail(geometry.beamLength);
46
- const dashOffset = useSharedValue(0);
47
- const showVisual = active && !reducedMotion && geometry.perimeter > 0;
48
- useEffect(() => {
49
- cancelAnimation(dashOffset);
50
- dashOffset.value = 0;
51
- if (!showVisual) return;
52
- dashOffset.value = withRepeat(withTiming(-geometry.perimeter, {
53
- duration: normalized.duration,
54
- easing: Easing.linear,
55
- reduceMotion: ReduceMotion.System
56
- }), -1, false, undefined, ReduceMotion.System);
57
- return () => cancelAnimation(dashOffset);
58
- }, [dashOffset, geometry.perimeter, normalized.duration, showVisual]);
59
- const animatedProps = useAnimatedProps(() => ({
60
- strokeDashoffset: dashOffset.value
61
- }));
62
- const handleLayout = event => {
63
- const width = Math.max(0, event.nativeEvent.layout.width);
64
- const height = Math.max(0, event.nativeEvent.layout.height);
65
- setLayout(current => current.width === width && current.height === height ? current : {
66
- width,
67
- height
68
- });
69
- };
70
- return /*#__PURE__*/_jsxs(View, {
71
- onLayout: handleLayout,
72
- style: [styles.container, {
73
- borderRadius: normalized.borderRadius
74
- }, style],
75
- testID: testID,
76
- children: [children, showVisual ? /*#__PURE__*/_jsx(View, {
77
- pointerEvents: "none",
78
- style: styles.visual,
79
- ...A11Y_HIDDEN_PROPS,
80
- children: /*#__PURE__*/_jsx(Svg, {
81
- width: layout.width,
82
- height: layout.height,
83
- children: trail.map(layer => /*#__PURE__*/_jsx(AnimatedRect, {
84
- animatedProps: animatedProps,
85
- x: normalized.lineWidth / 2,
86
- y: normalized.lineWidth / 2,
87
- width: geometry.rectWidth,
88
- height: geometry.rectHeight,
89
- rx: geometry.radius,
90
- ry: geometry.radius,
91
- fill: "none",
92
- stroke: color ?? colors.primary,
93
- strokeOpacity: layer.opacity,
94
- strokeWidth: normalized.lineWidth,
95
- strokeLinecap: "round",
96
- strokeDasharray: [layer.length, Math.max(0, geometry.perimeter - layer.length)]
97
- }, `${layer.length}-${layer.opacity}`))
98
- })
99
- }) : null]
100
- });
101
- }
102
- //# sourceMappingURL=BorderBeam.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","useEffect","useState","View","Animated","cancelAnimation","Easing","ReduceMotion","useAnimatedProps","useSharedValue","withRepeat","withTiming","Svg","Rect","radius","useColors","usePrefersReducedMotion","A11Y_HIDDEN_PROPS","normalizeBorderBeam","borderBeamGeometry","borderBeamTrail","EMPTY_BORDER_BEAM_LAYOUT","styles","jsx","_jsx","jsxs","_jsxs","AnimatedRect","createAnimatedComponent","BorderBeam","children","active","color","duration","lineWidth","size","borderRadius","md","style","testID","colors","reducedMotion","layout","setLayout","normalized","geometry","trail","beamLength","dashOffset","showVisual","perimeter","value","easing","linear","reduceMotion","System","undefined","animatedProps","strokeDashoffset","handleLayout","event","width","Math","max","nativeEvent","height","current","onLayout","container","pointerEvents","visual","map","layer","x","y","rectWidth","rectHeight","rx","ry","fill","stroke","primary","strokeOpacity","opacity","strokeWidth","strokeLinecap","strokeDasharray","length"],"sourceRoot":"../../../../../src","sources":["components/ui/BorderBeam/BorderBeam.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAElD,SAASC,IAAI,QAAQ,cAAc;AACnC,OAAOC,QAAQ,IACbC,eAAe,EACfC,MAAM,EACNC,YAAY,EACZC,gBAAgB,EAChBC,cAAc,EACdC,UAAU,EACVC,UAAU,QACL,yBAAyB;AAChC,OAAOC,GAAG,IAAIC,IAAI,QAAQ,kBAAkB;AAE5C,SAASC,MAAM,EAAEC,SAAS,EAAEC,uBAAuB,QAAQ,yBAAgB;AAC3E,SAASC,iBAAiB,QAAQ,mBAAgB;AAClD,SAASC,mBAAmB,QAAQ,0BAAuB;AAC3D,SACEC,kBAAkB,EAClBC,eAAe,EACfC,wBAAwB,QACnB,aAAU;AACjB,SAASC,MAAM,QAAQ,aAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAGlC,MAAMC,YAAY,GAAGvB,QAAQ,CAACwB,uBAAuB,CAACf,IAAI,CAAC;;AAE3D;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASgB,UAAUA,CAAC;EACzBC,QAAQ;EACRC,MAAM,GAAG,IAAI;EACbC,KAAK;EACLC,QAAQ;EACRC,SAAS;EACTC,IAAI;EACJC,YAAY,GAAGtB,MAAM,CAACuB,EAAE;EACxBC,KAAK;EACLC;AACe,CAAC,EAAqB;EAC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,SAAU;UAC1BV,MAAM,EAAEpB,QAAQ,CAAC+B,UAAW;UAC5BC,EAAE,EAAEhC,QAAQ,CAAC/B,MAAO;UACpBgE,EAAE,EAAEjC,QAAQ,CAAC/B,MAAO;UACpBiE,IAAI,EAAC,MAAM;UACXC,MAAM,EAAEhD,KAAK,IAAIQ,MAAM,CAACyC,OAAQ;UAChCC,aAAa,EAAEV,KAAK,CAACW,OAAQ;UAC7BC,WAAW,EAAExC,UAAU,CAACV,SAAU;UAClCmD,aAAa,EAAC,OAAO;UACrBC,eAAe,EAAE,CACfd,KAAK,CAACe,MAAM,EACZzB,IAAI,CAACC,GAAG,CAAC,CAAC,EAAElB,QAAQ,CAACK,SAAS,GAAGsB,KAAK,CAACe,MAAM,CAAC;QAC9C,GAhBG,GAAGf,KAAK,CAACe,MAAM,IAAIf,KAAK,CAACW,OAAO,EAiBtC,CACF;MAAC,CACC;IAAC,CACF,CAAC,GACL,IAAI;EAAA,CACJ,CAAC;AAEX","ignoreList":[]}
@@ -1,108 +0,0 @@
1
- "use strict";
2
-
3
- import React, { useEffect, useRef, useState } from 'react';
4
- import { View } from 'react-native';
5
- import Svg, { Rect } from 'react-native-svg';
6
- import { radius, useColors, usePrefersReducedMotion } from "../../../theme/index.js";
7
- import { A11Y_HIDDEN_PROPS } from "../shared/a11y.js";
8
- import { normalizeBorderBeam } from "./normalizeBorderBeam.js";
9
- import { borderBeamGeometry, borderBeamTrail, EMPTY_BORDER_BEAM_LAYOUT } from "./shared.js";
10
- import { styles } from "./styles.js";
11
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
- const KEYFRAMES_ID = 'unif-border-beam-keyframes';
13
- const win = globalThis;
14
- function ensureKeyframes() {
15
- if (typeof win.document === 'undefined') return;
16
- if (win.document.getElementById(KEYFRAMES_ID)) return;
17
- const sheet = win.document.createElement('style');
18
- sheet.id = KEYFRAMES_ID;
19
- sheet.textContent = '@keyframes unif-border-beam-flow { from { stroke-dashoffset: 0; } to { stroke-dashoffset: calc(-1 * var(--unif-border-beam-path)); } }';
20
- win.document.head.appendChild(sheet);
21
- }
22
-
23
- /** Web 版用 CSS keyframes 插值,JS 只在布局或 props 变化时更新一次。 */
24
- export function BorderBeam({
25
- children,
26
- active = true,
27
- color,
28
- duration,
29
- lineWidth,
30
- size,
31
- borderRadius = radius.md,
32
- style,
33
- testID
34
- }) {
35
- const colors = useColors();
36
- const reducedMotion = usePrefersReducedMotion();
37
- const [layout, setLayout] = useState(EMPTY_BORDER_BEAM_LAYOUT);
38
- const rectRefs = useRef([]);
39
- const normalized = normalizeBorderBeam({
40
- duration,
41
- lineWidth,
42
- size,
43
- borderRadius
44
- });
45
- const geometry = borderBeamGeometry({
46
- layout,
47
- ...normalized
48
- });
49
- const trail = borderBeamTrail(geometry.beamLength);
50
- const showVisual = active && !reducedMotion && geometry.perimeter > 0;
51
- useEffect(() => {
52
- if (!showVisual) return;
53
- ensureKeyframes();
54
- const nodes = rectRefs.current.filter(node => node?.style);
55
- if (nodes.length === 0) return;
56
- nodes.forEach(node => {
57
- node.style.setProperty('--unif-border-beam-path', `${geometry.perimeter}px`);
58
- node.style.animation = `unif-border-beam-flow ${normalized.duration}ms linear infinite`;
59
- });
60
- return () => {
61
- nodes.forEach(node => {
62
- node.style.animation = '';
63
- });
64
- };
65
- }, [geometry.perimeter, normalized.duration, showVisual]);
66
- const handleLayout = event => {
67
- const width = Math.max(0, event.nativeEvent.layout.width);
68
- const height = Math.max(0, event.nativeEvent.layout.height);
69
- setLayout(current => current.width === width && current.height === height ? current : {
70
- width,
71
- height
72
- });
73
- };
74
- return /*#__PURE__*/_jsxs(View, {
75
- onLayout: handleLayout,
76
- style: [styles.container, {
77
- borderRadius: normalized.borderRadius
78
- }, style],
79
- testID: testID,
80
- children: [children, showVisual ? /*#__PURE__*/_jsx(View, {
81
- pointerEvents: "none",
82
- style: styles.visual,
83
- ...A11Y_HIDDEN_PROPS,
84
- children: /*#__PURE__*/_jsx(Svg, {
85
- width: layout.width,
86
- height: layout.height,
87
- children: trail.map((layer, index) => /*#__PURE__*/_jsx(Rect, {
88
- ref: node => {
89
- rectRefs.current[index] = node;
90
- },
91
- x: normalized.lineWidth / 2,
92
- y: normalized.lineWidth / 2,
93
- width: geometry.rectWidth,
94
- height: geometry.rectHeight,
95
- rx: geometry.radius,
96
- ry: geometry.radius,
97
- fill: "none",
98
- stroke: color ?? colors.primary,
99
- strokeOpacity: layer.opacity,
100
- strokeWidth: normalized.lineWidth,
101
- strokeLinecap: "round",
102
- strokeDasharray: [layer.length, Math.max(0, geometry.perimeter - layer.length)]
103
- }, `${layer.length}-${layer.opacity}`))
104
- })
105
- }) : null]
106
- });
107
- }
108
- //# sourceMappingURL=BorderBeam.web.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","useEffect","useRef","useState","View","Svg","Rect","radius","useColors","usePrefersReducedMotion","A11Y_HIDDEN_PROPS","normalizeBorderBeam","borderBeamGeometry","borderBeamTrail","EMPTY_BORDER_BEAM_LAYOUT","styles","jsx","_jsx","jsxs","_jsxs","KEYFRAMES_ID","win","globalThis","ensureKeyframes","document","getElementById","sheet","createElement","id","textContent","head","appendChild","BorderBeam","children","active","color","duration","lineWidth","size","borderRadius","md","style","testID","colors","reducedMotion","layout","setLayout","rectRefs","normalized","geometry","trail","beamLength","showVisual","perimeter","nodes","current","filter","node","length","forEach","setProperty","animation","handleLayout","event","width","Math","max","nativeEvent","height","onLayout","container","pointerEvents","visual","map","layer","index","ref","x","y","rectWidth","rectHeight","rx","ry","fill","stroke","primary","strokeOpacity","opacity","strokeWidth","strokeLinecap","strokeDasharray"],"sourceRoot":"../../../../../src","sources":["components/ui/BorderBeam/BorderBeam.web.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAE1D,SAASC,IAAI,QAAQ,cAAc;AACnC,OAAOC,GAAG,IAAIC,IAAI,QAAQ,kBAAkB;AAE5C,SAASC,MAAM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EAAEjD,KAAK,IAAIQ,MAAM,CAAC0C,OAAQ;UAChCC,aAAa,EAAEZ,KAAK,CAACa,OAAQ;UAC7BC,WAAW,EAAExC,UAAU,CAACX,SAAU;UAClCoD,aAAa,EAAC,OAAO;UACrBC,eAAe,EAAE,CACfhB,KAAK,CAAChB,MAAM,EACZO,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEjB,QAAQ,CAACI,SAAS,GAAGqB,KAAK,CAAChB,MAAM,CAAC;QAC9C,GAlBG,GAAGgB,KAAK,CAAChB,MAAM,IAAIgB,KAAK,CAACa,OAAO,EAmBtC,CACF;MAAC,CACC;IAAC,CACF,CAAC,GACL,IAAI;EAAA,CACJ,CAAC;AAEX","ignoreList":[]}
@@ -1,4 +0,0 @@
1
- "use strict";
2
-
3
- export { BorderBeam } from './BorderBeam';
4
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["BorderBeam"],"sourceRoot":"../../../../../src","sources":["components/ui/BorderBeam/index.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,cAAc","ignoreList":[]}
@@ -1,23 +0,0 @@
1
- "use strict";
2
-
3
- export const BORDER_BEAM_DEFAULTS = {
4
- duration: 2400,
5
- lineWidth: 2,
6
- size: 40,
7
- borderRadius: 12
8
- };
9
- const normalizeNumber = (value, fallback, min, max, allowZero = false) => {
10
- if (typeof value !== 'number' || !Number.isFinite(value) || value < 0 || !allowZero && value === 0) {
11
- return fallback;
12
- }
13
- return Math.min(max, Math.max(min, value));
14
- };
15
- export function normalizeBorderBeam(input) {
16
- return {
17
- duration: normalizeNumber(input.duration, BORDER_BEAM_DEFAULTS.duration, 300, 60_000),
18
- lineWidth: normalizeNumber(input.lineWidth, BORDER_BEAM_DEFAULTS.lineWidth, 0.5, 8),
19
- size: normalizeNumber(input.size, BORDER_BEAM_DEFAULTS.size, 8, 1_000),
20
- borderRadius: normalizeNumber(input.borderRadius, BORDER_BEAM_DEFAULTS.borderRadius, 0, 1_000, true)
21
- };
22
- }
23
- //# sourceMappingURL=normalizeBorderBeam.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["BORDER_BEAM_DEFAULTS","duration","lineWidth","size","borderRadius","normalizeNumber","value","fallback","min","max","allowZero","Number","isFinite","Math","normalizeBorderBeam","input"],"sourceRoot":"../../../../../src","sources":["components/ui/BorderBeam/normalizeBorderBeam.ts"],"mappings":";;AAOA,OAAO,MAAMA,oBAA0C,GAAG;EACxDC,QAAQ,EAAE,IAAI;EACdC,SAAS,EAAE,CAAC;EACZC,IAAI,EAAE,EAAE;EACRC,YAAY,EAAE;AAChB,CAAC;AAID,MAAMC,eAAe,GAAGA,CACtBC,KAAyB,EACzBC,QAAgB,EAChBC,GAAW,EACXC,GAAW,EACXC,SAAS,GAAG,KAAK,KACN;EACX,IACE,OAAOJ,KAAK,KAAK,QAAQ,IACzB,CAACK,MAAM,CAACC,QAAQ,CAACN,KAAK,CAAC,IACvBA,KAAK,GAAG,CAAC,IACR,CAACI,SAAS,IAAIJ,KAAK,KAAK,CAAE,EAC3B;IACA,OAAOC,QAAQ;EACjB;EACA,OAAOM,IAAI,CAACL,GAAG,CAACC,GAAG,EAAEI,IAAI,CAACJ,GAAG,CAACD,GAAG,EAAEF,KAAK,CAAC,CAAC;AAC5C,CAAC;AAED,OAAO,SAASQ,mBAAmBA,CAACC,KAAwB,EAAE;EAC5D,OAAO;IACLd,QAAQ,EAAEI,eAAe,CACvBU,KAAK,CAACd,QAAQ,EACdD,oBAAoB,CAACC,QAAQ,EAC7B,GAAG,EACH,MACF,CAAC;IACDC,SAAS,EAAEG,eAAe,CACxBU,KAAK,CAACb,SAAS,EACfF,oBAAoB,CAACE,SAAS,EAC9B,GAAG,EACH,CACF,CAAC;IACDC,IAAI,EAAEE,eAAe,CAACU,KAAK,CAACZ,IAAI,EAAEH,oBAAoB,CAACG,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC;IACtEC,YAAY,EAAEC,eAAe,CAC3BU,KAAK,CAACX,YAAY,EAClBJ,oBAAoB,CAACI,YAAY,EACjC,CAAC,EACD,KAAK,EACL,IACF;EACF,CAAC;AACH","ignoreList":[]}
@@ -1,54 +0,0 @@
1
- "use strict";
2
-
3
- export const EMPTY_BORDER_BEAM_LAYOUT = {
4
- width: 0,
5
- height: 0
6
- };
7
- const BORDER_BEAM_TRAIL = [{
8
- lengthRatio: 1,
9
- opacity: 0.12
10
- }, {
11
- lengthRatio: 0.75,
12
- opacity: 0.24
13
- }, {
14
- lengthRatio: 0.5,
15
- opacity: 0.42
16
- }, {
17
- lengthRatio: 0.25,
18
- opacity: 0.88
19
- }];
20
-
21
- /**
22
- * 把单色线段拆成由淡到亮的叠加尾迹。
23
- *
24
- * 所有层共享同一动画相位,较短且更亮的层叠在前端,形成接近渐变的彗星头;
25
- * 同时避免 SVG gradient 在 Native/Web 上的实现差异。
26
- */
27
- export function borderBeamTrail(beamLength) {
28
- const safeLength = Math.max(0, beamLength);
29
- return BORDER_BEAM_TRAIL.map(({
30
- lengthRatio,
31
- opacity
32
- }) => ({
33
- length: safeLength * lengthRatio,
34
- opacity
35
- }));
36
- }
37
- export function borderBeamGeometry(input) {
38
- const {
39
- layout,
40
- lineWidth
41
- } = input;
42
- const rectWidth = Math.max(0, layout.width - lineWidth);
43
- const rectHeight = Math.max(0, layout.height - lineWidth);
44
- const perimeter = Math.max(0, 2 * (rectWidth + rectHeight));
45
- const beamLength = Math.min(input.size, perimeter / 2);
46
- return {
47
- beamLength,
48
- perimeter,
49
- rectHeight,
50
- rectWidth,
51
- radius: Math.min(input.borderRadius, rectWidth / 2, rectHeight / 2)
52
- };
53
- }
54
- //# sourceMappingURL=shared.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["EMPTY_BORDER_BEAM_LAYOUT","width","height","BORDER_BEAM_TRAIL","lengthRatio","opacity","borderBeamTrail","beamLength","safeLength","Math","max","map","length","borderBeamGeometry","input","layout","lineWidth","rectWidth","rectHeight","perimeter","min","size","radius","borderRadius"],"sourceRoot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G,CAAC,CAAC;EACtD,OAAO;IACLZ,UAAU;IACVY,SAAS;IACTD,UAAU;IACVD,SAAS;IACTK,MAAM,EAAEb,IAAI,CAACW,GAAG,CAACN,KAAK,CAACS,YAAY,EAAEN,SAAS,GAAG,CAAC,EAAEC,UAAU,GAAG,CAAC;EACpE,CAAC;AACH","ignoreList":[]}
@@ -1,18 +0,0 @@
1
- "use strict";
2
-
3
- import { StyleSheet } from 'react-native';
4
- export const styles = StyleSheet.create({
5
- container: {
6
- position: 'relative'
7
- },
8
- visual: {
9
- position: 'absolute',
10
- top: 0,
11
- right: 0,
12
- bottom: 0,
13
- left: 0,
14
- zIndex: 1,
15
- elevation: 1
16
- }
17
- });
18
- //# sourceMappingURL=styles.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["StyleSheet","styles","create","container","position","visual","top","right","bottom","left","zIndex","elevation"],"sourceRoot":"../../../../../src","sources":["components/ui/BorderBeam/styles.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,cAAc;AAEzC,OAAO,MAAMC,MAAM,GAAGD,UAAU,CAACE,MAAM,CAAC;EACtCC,SAAS,EAAE;IACTC,QAAQ,EAAE;EACZ,CAAC;EACDC,MAAM,EAAE;IACND,QAAQ,EAAE,UAAU;IACpBE,GAAG,EAAE,CAAC;IACNC,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE,CAAC;IACTC,IAAI,EAAE,CAAC;IACPC,MAAM,EAAE,CAAC;IACTC,SAAS,EAAE;EACb;AACF,CAAC,CAAC","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["components/ui/BorderBeam/types.ts"],"mappings":"","ignoreList":[]}
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import type { BorderBeamProps } from './types';
3
- /**
4
- * 沿内容边缘循环移动的装饰性流光描边。
5
- *
6
- * 组件不承载加载、错误或焦点语义;业务状态仍由调用方自己的可访问元素表达。
7
- * 系统开启「减弱动态效果」时隐藏流光,只保留原内容。
8
- */
9
- export declare function BorderBeam({ children, active, color, duration, lineWidth, size, borderRadius, style, testID, }: BorderBeamProps): React.JSX.Element;
10
- //# sourceMappingURL=BorderBeam.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BorderBeam.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ui/BorderBeam/BorderBeam.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAuBnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAI/C;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,MAAa,EACb,KAAK,EACL,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,YAAwB,EACxB,KAAK,EACL,MAAM,GACP,EAAE,eAAe,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAsFrC"}
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- import type { BorderBeamProps } from './types';
3
- /** Web 版用 CSS keyframes 插值,JS 只在布局或 props 变化时更新一次。 */
4
- export declare function BorderBeam({ children, active, color, duration, lineWidth, size, borderRadius, style, testID, }: BorderBeamProps): React.JSX.Element;
5
- //# sourceMappingURL=BorderBeam.web.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BorderBeam.web.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ui/BorderBeam/BorderBeam.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAc3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAe/C,sDAAsD;AACtD,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,MAAa,EACb,KAAK,EACL,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,YAAwB,EACxB,KAAK,EACL,MAAM,GACP,EAAE,eAAe,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAsFrC"}
@@ -1,3 +0,0 @@
1
- export { BorderBeam } from './BorderBeam';
2
- export type { BorderBeamProps } from './types';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ui/BorderBeam/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC"}
@@ -1,16 +0,0 @@
1
- export type NormalizedBorderBeam = {
2
- duration: number;
3
- lineWidth: number;
4
- size: number;
5
- borderRadius: number;
6
- };
7
- export declare const BORDER_BEAM_DEFAULTS: NormalizedBorderBeam;
8
- type BorderBeamNumbers = Partial<NormalizedBorderBeam>;
9
- export declare function normalizeBorderBeam(input: BorderBeamNumbers): {
10
- duration: number;
11
- lineWidth: number;
12
- size: number;
13
- borderRadius: number;
14
- };
15
- export {};
16
- //# sourceMappingURL=normalizeBorderBeam.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"normalizeBorderBeam.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ui/BorderBeam/normalizeBorderBeam.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,oBAKlC,CAAC;AAEF,KAAK,iBAAiB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAoBvD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,iBAAiB;;;;;EAuB3D"}
@@ -1,28 +0,0 @@
1
- export type BorderBeamLayout = Readonly<{
2
- width: number;
3
- height: number;
4
- }>;
5
- export declare const EMPTY_BORDER_BEAM_LAYOUT: BorderBeamLayout;
6
- /**
7
- * 把单色线段拆成由淡到亮的叠加尾迹。
8
- *
9
- * 所有层共享同一动画相位,较短且更亮的层叠在前端,形成接近渐变的彗星头;
10
- * 同时避免 SVG gradient 在 Native/Web 上的实现差异。
11
- */
12
- export declare function borderBeamTrail(beamLength: number): {
13
- length: number;
14
- opacity: 0.12 | 0.24 | 0.42 | 0.88;
15
- }[];
16
- export declare function borderBeamGeometry(input: {
17
- layout: BorderBeamLayout;
18
- lineWidth: number;
19
- size: number;
20
- borderRadius: number;
21
- }): {
22
- beamLength: number;
23
- perimeter: number;
24
- rectHeight: number;
25
- rectWidth: number;
26
- radius: number;
27
- };
28
- //# sourceMappingURL=shared.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ui/BorderBeam/shared.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE3E,eAAO,MAAM,wBAAwB,EAAE,gBAGtC,CAAC;AASF;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM;;;IAMjD;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE;IACxC,MAAM,EAAE,gBAAgB,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;CACtB;;;;;;EAaA"}