@buoy-gg/floating-tools-core 2.1.11 → 2.1.13

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 (108) hide show
  1. package/LICENSE +58 -0
  2. package/lib/commonjs/FloatingToolsStore.js +1 -501
  3. package/lib/commonjs/colors.js +1 -54
  4. package/lib/commonjs/constants.js +1 -31
  5. package/lib/commonjs/devToolsState.js +1 -325
  6. package/lib/commonjs/dial.js +1 -617
  7. package/lib/commonjs/easing.js +1 -69
  8. package/lib/commonjs/icons/benchmark-icon.js +1 -24
  9. package/lib/commonjs/icons/env-icon.js +1 -24
  10. package/lib/commonjs/icons/events-icon.js +1 -24
  11. package/lib/commonjs/icons/highlight-icon.js +1 -24
  12. package/lib/commonjs/icons/icon-data.js +1 -2268
  13. package/lib/commonjs/icons/icon-factories.js +1 -173
  14. package/lib/commonjs/icons/icon-primitives.js +1 -559
  15. package/lib/commonjs/icons/icon-primitives.native.js +1 -779
  16. package/lib/commonjs/icons/icon-renderer.js +1 -260
  17. package/lib/commonjs/icons/network-icon.js +1 -24
  18. package/lib/commonjs/icons/query-icon.js +1 -24
  19. package/lib/commonjs/icons/redux-icon.js +1 -85
  20. package/lib/commonjs/icons/renders-icon.js +1 -33
  21. package/lib/commonjs/icons/routes-icon.js +1 -49
  22. package/lib/commonjs/icons/sentry-icon.js +1 -24
  23. package/lib/commonjs/icons/storage-icon.js +1 -24
  24. package/lib/commonjs/icons/wifi-icon.js +1 -24
  25. package/lib/commonjs/index.js +1 -723
  26. package/lib/commonjs/settings.js +1 -599
  27. package/lib/commonjs/utils.js +1 -72
  28. package/lib/module/FloatingToolsStore.js +1 -496
  29. package/lib/module/colors.js +1 -49
  30. package/lib/module/constants.js +1 -27
  31. package/lib/module/devToolsState.js +1 -318
  32. package/lib/module/dial.js +1 -603
  33. package/lib/module/easing.js +1 -62
  34. package/lib/module/icons/benchmark-icon.js +1 -15
  35. package/lib/module/icons/env-icon.js +1 -15
  36. package/lib/module/icons/events-icon.js +1 -15
  37. package/lib/module/icons/highlight-icon.js +1 -15
  38. package/lib/module/icons/icon-data.js +1 -2264
  39. package/lib/module/icons/icon-factories.js +1 -163
  40. package/lib/module/icons/icon-primitives.js +1 -547
  41. package/lib/module/icons/icon-primitives.native.js +1 -767
  42. package/lib/module/icons/icon-renderer.js +1 -255
  43. package/lib/module/icons/network-icon.js +1 -15
  44. package/lib/module/icons/query-icon.js +1 -15
  45. package/lib/module/icons/redux-icon.js +1 -81
  46. package/lib/module/icons/renders-icon.js +1 -17
  47. package/lib/module/icons/routes-icon.js +1 -41
  48. package/lib/module/icons/sentry-icon.js +1 -15
  49. package/lib/module/icons/storage-icon.js +1 -15
  50. package/lib/module/icons/wifi-icon.js +1 -15
  51. package/lib/module/index.js +1 -103
  52. package/lib/module/settings.js +1 -587
  53. package/lib/module/utils.js +1 -66
  54. package/package.json +8 -8
  55. package/lib/typescript/commonjs/FloatingToolsStore.d.ts.map +0 -1
  56. package/lib/typescript/commonjs/colors.d.ts.map +0 -1
  57. package/lib/typescript/commonjs/constants.d.ts.map +0 -1
  58. package/lib/typescript/commonjs/devToolsState.d.ts.map +0 -1
  59. package/lib/typescript/commonjs/dial.d.ts.map +0 -1
  60. package/lib/typescript/commonjs/easing.d.ts.map +0 -1
  61. package/lib/typescript/commonjs/icons/benchmark-icon.d.ts.map +0 -1
  62. package/lib/typescript/commonjs/icons/env-icon.d.ts.map +0 -1
  63. package/lib/typescript/commonjs/icons/events-icon.d.ts.map +0 -1
  64. package/lib/typescript/commonjs/icons/highlight-icon.d.ts.map +0 -1
  65. package/lib/typescript/commonjs/icons/icon-data.d.ts.map +0 -1
  66. package/lib/typescript/commonjs/icons/icon-factories.d.ts.map +0 -1
  67. package/lib/typescript/commonjs/icons/icon-primitives.d.ts.map +0 -1
  68. package/lib/typescript/commonjs/icons/icon-primitives.native.d.ts.map +0 -1
  69. package/lib/typescript/commonjs/icons/icon-renderer.d.ts.map +0 -1
  70. package/lib/typescript/commonjs/icons/network-icon.d.ts.map +0 -1
  71. package/lib/typescript/commonjs/icons/query-icon.d.ts.map +0 -1
  72. package/lib/typescript/commonjs/icons/redux-icon.d.ts.map +0 -1
  73. package/lib/typescript/commonjs/icons/renders-icon.d.ts.map +0 -1
  74. package/lib/typescript/commonjs/icons/routes-icon.d.ts.map +0 -1
  75. package/lib/typescript/commonjs/icons/sentry-icon.d.ts.map +0 -1
  76. package/lib/typescript/commonjs/icons/storage-icon.d.ts.map +0 -1
  77. package/lib/typescript/commonjs/icons/wifi-icon.d.ts.map +0 -1
  78. package/lib/typescript/commonjs/index.d.ts.map +0 -1
  79. package/lib/typescript/commonjs/settings.d.ts.map +0 -1
  80. package/lib/typescript/commonjs/types.d.ts.map +0 -1
  81. package/lib/typescript/commonjs/utils.d.ts.map +0 -1
  82. package/lib/typescript/module/FloatingToolsStore.d.ts.map +0 -1
  83. package/lib/typescript/module/colors.d.ts.map +0 -1
  84. package/lib/typescript/module/constants.d.ts.map +0 -1
  85. package/lib/typescript/module/devToolsState.d.ts.map +0 -1
  86. package/lib/typescript/module/dial.d.ts.map +0 -1
  87. package/lib/typescript/module/easing.d.ts.map +0 -1
  88. package/lib/typescript/module/icons/benchmark-icon.d.ts.map +0 -1
  89. package/lib/typescript/module/icons/env-icon.d.ts.map +0 -1
  90. package/lib/typescript/module/icons/events-icon.d.ts.map +0 -1
  91. package/lib/typescript/module/icons/highlight-icon.d.ts.map +0 -1
  92. package/lib/typescript/module/icons/icon-data.d.ts.map +0 -1
  93. package/lib/typescript/module/icons/icon-factories.d.ts.map +0 -1
  94. package/lib/typescript/module/icons/icon-primitives.d.ts.map +0 -1
  95. package/lib/typescript/module/icons/icon-primitives.native.d.ts.map +0 -1
  96. package/lib/typescript/module/icons/icon-renderer.d.ts.map +0 -1
  97. package/lib/typescript/module/icons/network-icon.d.ts.map +0 -1
  98. package/lib/typescript/module/icons/query-icon.d.ts.map +0 -1
  99. package/lib/typescript/module/icons/redux-icon.d.ts.map +0 -1
  100. package/lib/typescript/module/icons/renders-icon.d.ts.map +0 -1
  101. package/lib/typescript/module/icons/routes-icon.d.ts.map +0 -1
  102. package/lib/typescript/module/icons/sentry-icon.d.ts.map +0 -1
  103. package/lib/typescript/module/icons/storage-icon.d.ts.map +0 -1
  104. package/lib/typescript/module/icons/wifi-icon.d.ts.map +0 -1
  105. package/lib/typescript/module/index.d.ts.map +0 -1
  106. package/lib/typescript/module/settings.d.ts.map +0 -1
  107. package/lib/typescript/module/types.d.ts.map +0 -1
  108. package/lib/typescript/module/utils.d.ts.map +0 -1
@@ -1,767 +1 @@
1
- "use strict";
2
-
3
- /**
4
- * Icon Primitives - MOBILE (React Native)
5
- *
6
- * This file is auto-picked by Metro (React Native bundler).
7
- * Web bundlers pick icon-primitives.tsx instead.
8
- */
9
-
10
- import { View } from 'react-native';
11
-
12
- // ===========================================
13
- // Types
14
- // ===========================================
15
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
16
- // ===========================================
17
- // Mobile Primitives (React Native Views)
18
- // ===========================================
19
-
20
- export const IconContainer = ({
21
- size,
22
- children
23
- }) => {
24
- const style = {
25
- position: 'relative',
26
- width: size,
27
- height: size
28
- };
29
- return /*#__PURE__*/_jsx(View, {
30
- style: style,
31
- children: children
32
- });
33
- };
34
- export const IconCircle = ({
35
- cx,
36
- cy,
37
- r,
38
- fill,
39
- borderColor,
40
- borderWidth = 0,
41
- opacity = 1,
42
- scaleX = 1,
43
- scaleY = 1,
44
- glowColor,
45
- glowRadius = 0
46
- }) => {
47
- const diameter = r * 2;
48
-
49
- // Build transforms array
50
- const transforms = [];
51
- if (scaleX !== 1) transforms.push({
52
- scaleX
53
- });
54
- if (scaleY !== 1) transforms.push({
55
- scaleY
56
- });
57
-
58
- // Check if this is a "transparent" element (border-only ring)
59
- // RN shadows require backgroundColor, so we need a separate glow layer
60
- const needsSeparateGlow = glowColor && glowRadius > 0 && (!fill || fill === 'transparent');
61
- const hasFillForShadow = fill && fill !== 'transparent';
62
- const style = {
63
- position: 'absolute',
64
- left: cx - r,
65
- top: cy - r,
66
- width: diameter,
67
- height: diameter,
68
- borderRadius: r,
69
- backgroundColor: fill,
70
- borderColor,
71
- borderWidth,
72
- opacity,
73
- transform: transforms.length > 0 ? transforms : undefined,
74
- // Only apply shadow if we have a fill (RN shadows need backgroundColor)
75
- ...(glowColor && glowRadius > 0 && hasFillForShadow && {
76
- shadowColor: glowColor,
77
- shadowOffset: {
78
- width: 0,
79
- height: 0
80
- },
81
- shadowOpacity: 0.9,
82
- shadowRadius: glowRadius * 0.8
83
- })
84
- };
85
-
86
- // For border-only elements (rings), create glow using a filled circle with shadow
87
- // The trick: use backgroundColor:'#000' (matches icon bg) so shadow renders,
88
- // with glowColor on the border for the visible glow effect
89
- if (needsSeparateGlow) {
90
- const strokeW = borderWidth || 1;
91
- return /*#__PURE__*/_jsxs(_Fragment, {
92
- children: [/*#__PURE__*/_jsx(View, {
93
- style: {
94
- position: 'absolute',
95
- left: cx - r,
96
- top: cy - r,
97
- width: r * 2,
98
- height: r * 2,
99
- borderRadius: r,
100
- backgroundColor: '#000',
101
- // Matches icon bg - enables shadow
102
- borderWidth: strokeW,
103
- borderColor: glowColor,
104
- opacity: 0.5,
105
- transform: transforms.length > 0 ? transforms : undefined,
106
- shadowColor: glowColor,
107
- shadowOffset: {
108
- width: 0,
109
- height: 0
110
- },
111
- shadowOpacity: 0.9,
112
- shadowRadius: 8
113
- }
114
- }), /*#__PURE__*/_jsx(View, {
115
- style: style
116
- })]
117
- });
118
- }
119
- return /*#__PURE__*/_jsx(View, {
120
- style: style
121
- });
122
- };
123
- export const IconRect = ({
124
- x,
125
- y,
126
- width,
127
- height,
128
- fill,
129
- borderColor,
130
- borderWidth = 0,
131
- borderRadius = 0,
132
- opacity = 1,
133
- glowColor,
134
- glowRadius = 0,
135
- rotation,
136
- originX = 0.5,
137
- // default center
138
- originY = 0.5 // default center
139
- }) => {
140
- // Build transform array
141
- // React Native rotates around center by default.
142
- // To rotate around a custom origin, we:
143
- // 1. Translate so the origin point moves to center
144
- // 2. Rotate
145
- // 3. Translate back
146
-
147
- const transforms = [];
148
- if (rotation !== undefined) {
149
- // Calculate offset from center to desired origin
150
- // originX/originY are 0-1 values (0=left/top, 0.5=center, 1=right/bottom)
151
- const offsetX = (0.5 - originX) * width;
152
- const offsetY = (0.5 - originY) * height;
153
-
154
- // Apply transforms: translate to origin, rotate, translate back
155
- if (offsetX !== 0 || offsetY !== 0) {
156
- transforms.push({
157
- translateX: -offsetX
158
- });
159
- transforms.push({
160
- translateY: -offsetY
161
- });
162
- }
163
- transforms.push({
164
- rotate: `${rotation}deg`
165
- });
166
- if (offsetX !== 0 || offsetY !== 0) {
167
- transforms.push({
168
- translateX: offsetX
169
- });
170
- transforms.push({
171
- translateY: offsetY
172
- });
173
- }
174
- }
175
-
176
- // Check if this is a "transparent" element (border-only)
177
- // RN shadows require backgroundColor, so we need a separate glow layer
178
- const hasGlow = glowColor && glowRadius > 0;
179
- const needsSeparateGlow = hasGlow && (!fill || fill === 'transparent');
180
- const hasFillForShadow = fill && fill !== 'transparent';
181
- const style = {
182
- position: 'absolute',
183
- left: x,
184
- top: y,
185
- width,
186
- height,
187
- borderRadius,
188
- backgroundColor: fill,
189
- borderColor,
190
- borderWidth,
191
- opacity,
192
- transform: transforms.length > 0 ? transforms : undefined,
193
- // Only apply shadow if we have a fill (RN shadows need backgroundColor)
194
- ...(hasGlow && hasFillForShadow && {
195
- shadowColor: glowColor,
196
- shadowOffset: {
197
- width: 0,
198
- height: 0
199
- },
200
- shadowOpacity: 0.9,
201
- shadowRadius: glowRadius * 0.8
202
- })
203
- };
204
-
205
- // For border-only elements, render a glow rect with shadow
206
- if (needsSeparateGlow) {
207
- const strokeW = borderWidth || 1;
208
- const glowExpand = strokeW;
209
- return /*#__PURE__*/_jsxs(_Fragment, {
210
- children: [/*#__PURE__*/_jsx(View, {
211
- style: {
212
- position: 'absolute',
213
- left: x - glowExpand,
214
- top: y - glowExpand,
215
- width: width + glowExpand * 2,
216
- height: height + glowExpand * 2,
217
- borderRadius: borderRadius + glowExpand,
218
- borderWidth: strokeW * 2,
219
- borderColor: glowColor,
220
- opacity: 0.4,
221
- transform: transforms.length > 0 ? transforms : undefined,
222
- shadowColor: glowColor,
223
- shadowOffset: {
224
- width: 0,
225
- height: 0
226
- },
227
- shadowOpacity: 0.8,
228
- shadowRadius: strokeW * 4
229
- }
230
- }), /*#__PURE__*/_jsx(View, {
231
- style: style
232
- })]
233
- });
234
- }
235
- return /*#__PURE__*/_jsx(View, {
236
- style: style
237
- });
238
- };
239
-
240
- /**
241
- * Calculates a point on a quadratic Bezier curve (1 control point)
242
- * B(t) = (1-t)²P0 + 2(1-t)tP1 + t²P2
243
- */
244
- function getQuadraticBezierPoint(t, p0x, p0y, p1x, p1y, p2x, p2y) {
245
- const mt = 1 - t;
246
- return {
247
- x: mt * mt * p0x + 2 * mt * t * p1x + t * t * p2x,
248
- y: mt * mt * p0y + 2 * mt * t * p1y + t * t * p2y
249
- };
250
- }
251
-
252
- /**
253
- * Calculates a point on a cubic Bezier curve (2 control points)
254
- * B(t) = (1-t)³P0 + 3(1-t)²tP1 + 3(1-t)t²P2 + t³P3
255
- */
256
- function getCubicBezierPoint(t, p0x, p0y, p1x, p1y, p2x, p2y, p3x, p3y) {
257
- const mt = 1 - t;
258
- const mt2 = mt * mt;
259
- const mt3 = mt2 * mt;
260
- const t2 = t * t;
261
- const t3 = t2 * t;
262
- return {
263
- x: mt3 * p0x + 3 * mt2 * t * p1x + 3 * mt * t2 * p2x + t3 * p3x,
264
- y: mt3 * p0y + 3 * mt2 * t * p1y + 3 * mt * t2 * p2y + t3 * p3y
265
- };
266
- }
267
-
268
- /**
269
- * IconLine - draws a line between two points
270
- * Auto-calculates length and rotation from coordinates!
271
- * Supports curved lines via cubic Bezier (2 control points) or quadratic (1 control point).
272
- */
273
- export const IconLine = ({
274
- x1,
275
- y1,
276
- x2,
277
- y2,
278
- stroke,
279
- strokeWidth = 1,
280
- opacity = 1,
281
- glowColor,
282
- glowRadius = 0,
283
- rotation = 0,
284
- curveX,
285
- curveY,
286
- curve2X,
287
- curve2Y
288
- }) => {
289
- // Check if this is a curved line (either control point set)
290
- const hasCurve1 = curveX !== undefined && curveX !== 0 || curveY !== undefined && curveY !== 0;
291
- const hasCurve2 = curve2X !== undefined && curve2X !== 0 || curve2Y !== undefined && curve2Y !== 0;
292
- const isCurved = hasCurve1 || hasCurve2;
293
- if (isCurved) {
294
- const midX = (x1 + x2) / 2;
295
- const midY = (y1 + y2) / 2;
296
-
297
- // Control points: offset from line midpoint
298
- const control1X = midX + (curveX ?? 0);
299
- const control1Y = midY + (curveY ?? 0);
300
- const control2X = midX + (curve2X ?? 0);
301
- const control2Y = midY + (curve2Y ?? 0);
302
-
303
- // Determine if cubic (2 distinct control points) or quadratic (1 control point)
304
- const isCubic = hasCurve1 && hasCurve2;
305
-
306
- // Estimate curve length using samples
307
- let approxLength = 0;
308
- const sampleCount = 20;
309
- let prevPt = {
310
- x: x1,
311
- y: y1
312
- };
313
- for (let i = 1; i <= sampleCount; i++) {
314
- const t = i / sampleCount;
315
- const pt = isCubic ? getCubicBezierPoint(t, x1, y1, control1X, control1Y, control2X, control2Y, x2, y2) : getQuadraticBezierPoint(t, x1, y1, hasCurve1 ? control1X : control2X, hasCurve1 ? control1Y : control2Y, x2, y2);
316
- approxLength += Math.sqrt((pt.x - prevPt.x) ** 2 + (pt.y - prevPt.y) ** 2);
317
- prevPt = pt;
318
- }
319
- const elements = [];
320
-
321
- // Dense circles for smooth body
322
- const circleSpacing = Math.max(0.05, strokeWidth * 0.02);
323
- const numCircles = Math.max(100, Math.ceil(approxLength / circleSpacing));
324
- for (let i = 0; i <= numCircles; i++) {
325
- const t = i / numCircles;
326
- const pt = isCubic ? getCubicBezierPoint(t, x1, y1, control1X, control1Y, control2X, control2Y, x2, y2) : getQuadraticBezierPoint(t, x1, y1, hasCurve1 ? control1X : control2X, hasCurve1 ? control1Y : control2Y, x2, y2);
327
- const circleStyle = {
328
- position: 'absolute',
329
- left: pt.x - strokeWidth / 2,
330
- top: pt.y - strokeWidth / 2,
331
- width: strokeWidth,
332
- height: strokeWidth,
333
- borderRadius: strokeWidth / 2,
334
- backgroundColor: stroke,
335
- opacity
336
- };
337
- elements.push(/*#__PURE__*/_jsx(View, {
338
- style: circleStyle
339
- }, `c${i}`));
340
- }
341
- return /*#__PURE__*/_jsx(_Fragment, {
342
- children: elements
343
- });
344
- }
345
-
346
- // Straight line (original logic)
347
- const dx = x2 - x1;
348
- const dy = y2 - y1;
349
- const length = Math.sqrt(dx * dx + dy * dy);
350
- const angle = Math.atan2(dy, dx) * (180 / Math.PI);
351
-
352
- // Position at midpoint of line
353
- const centerX = (x1 + x2) / 2;
354
- const centerY = (y1 + y2) / 2;
355
-
356
- // Total rotation = line angle + additional rotation
357
- const totalRotation = angle + rotation;
358
- const hasGlow = glowColor && glowRadius > 0;
359
- const style = {
360
- position: 'absolute',
361
- left: centerX - length / 2,
362
- top: centerY - strokeWidth / 2,
363
- width: length,
364
- height: strokeWidth,
365
- backgroundColor: stroke,
366
- opacity,
367
- transform: [{
368
- rotate: `${totalRotation}deg`
369
- }],
370
- borderRadius: strokeWidth / 2
371
- };
372
-
373
- // For neon glow effect, render a glow line with shadow
374
- if (hasGlow) {
375
- return /*#__PURE__*/_jsxs(_Fragment, {
376
- children: [/*#__PURE__*/_jsx(View, {
377
- style: {
378
- position: 'absolute',
379
- left: centerX - length / 2,
380
- top: centerY - strokeWidth / 2,
381
- width: length,
382
- height: strokeWidth,
383
- backgroundColor: glowColor,
384
- opacity: 0.5,
385
- transform: [{
386
- rotate: `${totalRotation}deg`
387
- }],
388
- borderRadius: strokeWidth / 2,
389
- // Shadow creates the glow
390
- shadowColor: glowColor,
391
- shadowOffset: {
392
- width: 0,
393
- height: 0
394
- },
395
- shadowOpacity: 0.9,
396
- shadowRadius: 8
397
- }
398
- }), /*#__PURE__*/_jsx(View, {
399
- style: style
400
- })]
401
- });
402
- }
403
- return /*#__PURE__*/_jsx(View, {
404
- style: style
405
- });
406
- };
407
-
408
- /**
409
- * IconTriangle - creates triangles using CSS border trick
410
- * Works in pure React Native!
411
- */
412
- export const IconTriangle = ({
413
- x,
414
- y,
415
- size,
416
- direction,
417
- fill,
418
- opacity = 1,
419
- rotation
420
- }) => {
421
- // CSS border trick: use transparent borders to create triangle
422
- // The size is the height of the triangle
423
- const halfWidth = size * 0.577; // size / sqrt(3) for equilateral-ish triangle
424
-
425
- // Build border styles based on direction
426
- let borderStyles = {};
427
- let offsetX = 0;
428
- let offsetY = 0;
429
- switch (direction) {
430
- case 'down':
431
- borderStyles = {
432
- borderLeftWidth: halfWidth,
433
- borderRightWidth: halfWidth,
434
- borderTopWidth: size,
435
- borderLeftColor: 'transparent',
436
- borderRightColor: 'transparent',
437
- borderTopColor: fill
438
- };
439
- offsetX = -halfWidth;
440
- offsetY = 0;
441
- break;
442
- case 'up':
443
- borderStyles = {
444
- borderLeftWidth: halfWidth,
445
- borderRightWidth: halfWidth,
446
- borderBottomWidth: size,
447
- borderLeftColor: 'transparent',
448
- borderRightColor: 'transparent',
449
- borderBottomColor: fill
450
- };
451
- offsetX = -halfWidth;
452
- offsetY = -size;
453
- break;
454
- case 'left':
455
- borderStyles = {
456
- borderTopWidth: halfWidth,
457
- borderBottomWidth: halfWidth,
458
- borderRightWidth: size,
459
- borderTopColor: 'transparent',
460
- borderBottomColor: 'transparent',
461
- borderRightColor: fill
462
- };
463
- offsetX = -size;
464
- offsetY = -halfWidth;
465
- break;
466
- case 'right':
467
- borderStyles = {
468
- borderTopWidth: halfWidth,
469
- borderBottomWidth: halfWidth,
470
- borderLeftWidth: size,
471
- borderTopColor: 'transparent',
472
- borderBottomColor: 'transparent',
473
- borderLeftColor: fill
474
- };
475
- offsetX = 0;
476
- offsetY = -halfWidth;
477
- break;
478
- }
479
-
480
- // Build transforms
481
- const transforms = [];
482
- if (rotation !== undefined) {
483
- transforms.push({
484
- rotate: `${rotation}deg`
485
- });
486
- }
487
- const style = {
488
- position: 'absolute',
489
- left: x + offsetX,
490
- top: y + offsetY,
491
- width: 0,
492
- height: 0,
493
- opacity,
494
- ...borderStyles,
495
- transform: transforms.length > 0 ? transforms : undefined
496
- };
497
- return /*#__PURE__*/_jsx(View, {
498
- style: style
499
- });
500
- };
501
-
502
- /**
503
- * IconArc - draws an arc using multiple line segments
504
- * Creates smooth curves in pure React Native!
505
- */
506
- export const IconArc = ({
507
- cx,
508
- cy,
509
- r,
510
- startAngle,
511
- endAngle,
512
- stroke,
513
- strokeWidth = 1.5,
514
- opacity = 1,
515
- segments
516
- }) => {
517
- // Calculate number of segments based on arc length
518
- const arcLength = Math.abs(endAngle - startAngle);
519
- const autoSegments = Math.max(8, Math.ceil(arcLength / 10)); // ~10 degrees per segment
520
- const numSegments = segments ?? autoSegments;
521
-
522
- // Generate line segments
523
- const lines = [];
524
- const angleStep = (endAngle - startAngle) / numSegments;
525
- for (let i = 0; i < numSegments; i++) {
526
- const angle1 = startAngle + i * angleStep;
527
- const angle2 = startAngle + (i + 1) * angleStep;
528
-
529
- // Convert to radians
530
- const rad1 = angle1 * Math.PI / 180;
531
- const rad2 = angle2 * Math.PI / 180;
532
-
533
- // Calculate segment endpoints
534
- const x1 = cx + r * Math.cos(rad1);
535
- const y1 = cy + r * Math.sin(rad1);
536
- const x2 = cx + r * Math.cos(rad2);
537
- const y2 = cy + r * Math.sin(rad2);
538
-
539
- // Calculate segment geometry
540
- const dx = x2 - x1;
541
- const dy = y2 - y1;
542
- const length = Math.sqrt(dx * dx + dy * dy);
543
- const angle = Math.atan2(dy, dx) * (180 / Math.PI);
544
- const midX = (x1 + x2) / 2;
545
- const midY = (y1 + y2) / 2;
546
- const style = {
547
- position: 'absolute',
548
- left: midX - length / 2,
549
- top: midY - strokeWidth / 2,
550
- width: length,
551
- height: strokeWidth,
552
- backgroundColor: stroke,
553
- opacity,
554
- transform: [{
555
- rotate: `${angle}deg`
556
- }],
557
- borderRadius: strokeWidth / 2
558
- };
559
- lines.push(/*#__PURE__*/_jsx(View, {
560
- style: style
561
- }, i));
562
- }
563
- return /*#__PURE__*/_jsx(_Fragment, {
564
- children: lines
565
- });
566
- };
567
-
568
- /**
569
- * IconSemicircle - creates a half circle (filled)
570
- * Perfect for pokeball-style split designs!
571
- */
572
- export const IconSemicircle = ({
573
- cx,
574
- cy,
575
- r,
576
- half,
577
- fill,
578
- borderColor,
579
- borderWidth = 0,
580
- opacity = 1,
581
- glowColor,
582
- glowRadius = 0
583
- }) => {
584
- const diameter = r * 2;
585
-
586
- // Calculate position and border radii based on which half
587
- let left;
588
- let top;
589
- let width;
590
- let height;
591
- let borderTopLeftRadius = 0;
592
- let borderTopRightRadius = 0;
593
- let borderBottomLeftRadius = 0;
594
- let borderBottomRightRadius = 0;
595
- switch (half) {
596
- case 'top':
597
- left = cx - r;
598
- top = cy - r;
599
- width = diameter;
600
- height = r;
601
- borderTopLeftRadius = r;
602
- borderTopRightRadius = r;
603
- break;
604
- case 'bottom':
605
- left = cx - r;
606
- top = cy;
607
- width = diameter;
608
- height = r;
609
- borderBottomLeftRadius = r;
610
- borderBottomRightRadius = r;
611
- break;
612
- case 'left':
613
- left = cx - r;
614
- top = cy - r;
615
- width = r;
616
- height = diameter;
617
- borderTopLeftRadius = r;
618
- borderBottomLeftRadius = r;
619
- break;
620
- case 'right':
621
- left = cx;
622
- top = cy - r;
623
- width = r;
624
- height = diameter;
625
- borderTopRightRadius = r;
626
- borderBottomRightRadius = r;
627
- break;
628
- }
629
-
630
- // Check if this is a "transparent" element (border-only)
631
- // RN shadows require backgroundColor, so we need a separate glow layer
632
- const hasGlow = glowColor && glowRadius > 0;
633
- const needsSeparateGlow = hasGlow && (!fill || fill === 'transparent');
634
- const hasFillForShadow = fill && fill !== 'transparent';
635
- const style = {
636
- position: 'absolute',
637
- left,
638
- top,
639
- width,
640
- height,
641
- borderTopLeftRadius,
642
- borderTopRightRadius,
643
- borderBottomLeftRadius,
644
- borderBottomRightRadius,
645
- backgroundColor: fill,
646
- borderColor,
647
- borderWidth,
648
- opacity,
649
- // Only apply shadow if we have a fill (RN shadows need backgroundColor)
650
- ...(hasGlow && hasFillForShadow && {
651
- shadowColor: glowColor,
652
- shadowOffset: {
653
- width: 0,
654
- height: 0
655
- },
656
- shadowOpacity: 0.9,
657
- shadowRadius: glowRadius * 0.8
658
- })
659
- };
660
-
661
- // For border-only elements, render a glow semicircle with shadow
662
- if (needsSeparateGlow) {
663
- const strokeW = borderWidth || 1;
664
- const glowExpand = strokeW;
665
- const glowR = r + glowExpand;
666
- const glowWidth = half === 'left' || half === 'right' ? glowR : glowR * 2;
667
- const glowHeight = half === 'top' || half === 'bottom' ? glowR : glowR * 2;
668
- const glowLeft = cx - (half === 'right' ? 0 : glowR);
669
- const glowTop = cy - (half === 'bottom' ? 0 : glowR);
670
- return /*#__PURE__*/_jsxs(_Fragment, {
671
- children: [/*#__PURE__*/_jsx(View, {
672
- style: {
673
- position: 'absolute',
674
- left: glowLeft,
675
- top: glowTop,
676
- width: glowWidth,
677
- height: glowHeight,
678
- borderTopLeftRadius: half === 'top' || half === 'left' ? glowR : 0,
679
- borderTopRightRadius: half === 'top' || half === 'right' ? glowR : 0,
680
- borderBottomLeftRadius: half === 'bottom' || half === 'left' ? glowR : 0,
681
- borderBottomRightRadius: half === 'bottom' || half === 'right' ? glowR : 0,
682
- borderWidth: strokeW * 2,
683
- borderColor: glowColor,
684
- opacity: 0.4,
685
- shadowColor: glowColor,
686
- shadowOffset: {
687
- width: 0,
688
- height: 0
689
- },
690
- shadowOpacity: 0.8,
691
- shadowRadius: strokeW * 4
692
- }
693
- }), /*#__PURE__*/_jsx(View, {
694
- style: style
695
- })]
696
- });
697
- }
698
- return /*#__PURE__*/_jsx(View, {
699
- style: style
700
- });
701
- };
702
-
703
- /**
704
- * IconSmoothArc - creates a smooth arc using the border trick
705
- * Uses bordered circles with partial borders hidden - gives perfect anti-aliased curves!
706
- * This is how the WiFi icon achieves smooth lines without dots.
707
- */
708
- export const IconSmoothArc = ({
709
- cx,
710
- cy,
711
- r,
712
- stroke,
713
- strokeWidth = 2,
714
- opacity = 1,
715
- portion = 'bottom'
716
- }) => {
717
- const diameter = r * 2;
718
-
719
- // Build border colors based on which portion to show
720
- let borderTopColor = stroke;
721
- let borderBottomColor = stroke;
722
- let borderLeftColor = stroke;
723
- let borderRightColor = stroke;
724
- switch (portion) {
725
- case 'bottom':
726
- // Show bottom arc (hide top, left, right)
727
- borderTopColor = 'transparent';
728
- borderLeftColor = 'transparent';
729
- borderRightColor = 'transparent';
730
- break;
731
- case 'top':
732
- // Show top arc (hide bottom, left, right)
733
- borderBottomColor = 'transparent';
734
- borderLeftColor = 'transparent';
735
- borderRightColor = 'transparent';
736
- break;
737
- case 'left':
738
- // Show left arc (hide top, bottom, right)
739
- borderTopColor = 'transparent';
740
- borderBottomColor = 'transparent';
741
- borderRightColor = 'transparent';
742
- break;
743
- case 'right':
744
- // Show right arc (hide top, bottom, left)
745
- borderTopColor = 'transparent';
746
- borderBottomColor = 'transparent';
747
- borderLeftColor = 'transparent';
748
- break;
749
- }
750
- const style = {
751
- position: 'absolute',
752
- left: cx - r,
753
- top: cy - r,
754
- width: diameter,
755
- height: diameter,
756
- borderRadius: r,
757
- borderWidth: strokeWidth,
758
- borderTopColor,
759
- borderBottomColor,
760
- borderLeftColor,
761
- borderRightColor,
762
- opacity
763
- };
764
- return /*#__PURE__*/_jsx(View, {
765
- style: style
766
- });
767
- };
1
+ "use strict";import{View}from"react-native";import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";export const IconContainer=({size:t,children:o})=>_jsx(View,{style:{position:"relative",width:t,height:t},children:o});export const IconCircle=({cx:t,cy:o,r:r,fill:e,borderColor:s,borderWidth:i=0,opacity:a=1,scaleX:d=1,scaleY:n=1,glowColor:h,glowRadius:l=0})=>{const c=2*r,p=[];1!==d&&p.push({scaleX:d}),1!==n&&p.push({scaleY:n});const b=h&&l>0&&(!e||"transparent"===e),u=e&&"transparent"!==e,g={position:"absolute",left:t-r,top:o-r,width:c,height:c,borderRadius:r,backgroundColor:e,borderColor:s,borderWidth:i,opacity:a,transform:p.length>0?p:void 0,...h&&l>0&&u&&{shadowColor:h,shadowOffset:{width:0,height:0},shadowOpacity:.9,shadowRadius:.8*l}};return b?_jsxs(_Fragment,{children:[_jsx(View,{style:{position:"absolute",left:t-r,top:o-r,width:2*r,height:2*r,borderRadius:r,backgroundColor:"#000",borderWidth:i||1,borderColor:h,opacity:.5,transform:p.length>0?p:void 0,shadowColor:h,shadowOffset:{width:0,height:0},shadowOpacity:.9,shadowRadius:8}}),_jsx(View,{style:g})]}):_jsx(View,{style:g})};export const IconRect=({x:t,y:o,width:r,height:e,fill:s,borderColor:i,borderWidth:a=0,borderRadius:d=0,opacity:n=1,glowColor:h,glowRadius:l=0,rotation:c,originX:p=.5,originY:b=.5})=>{const u=[];if(void 0!==c){const t=(.5-p)*r,o=(.5-b)*e;0===t&&0===o||(u.push({translateX:-t}),u.push({translateY:-o})),u.push({rotate:`${c}deg`}),0===t&&0===o||(u.push({translateX:t}),u.push({translateY:o}))}const g=h&&l>0,w=g&&(!s||"transparent"===s),f=s&&"transparent"!==s,y={position:"absolute",left:t,top:o,width:r,height:e,borderRadius:d,backgroundColor:s,borderColor:i,borderWidth:a,opacity:n,transform:u.length>0?u:void 0,...g&&f&&{shadowColor:h,shadowOffset:{width:0,height:0},shadowOpacity:.9,shadowRadius:.8*l}};if(w){const s=a||1;return _jsxs(_Fragment,{children:[_jsx(View,{style:{position:"absolute",left:t-s,top:o-s,width:r+2*s,height:e+2*s,borderRadius:d+s,borderWidth:2*s,borderColor:h,opacity:.4,transform:u.length>0?u:void 0,shadowColor:h,shadowOffset:{width:0,height:0},shadowOpacity:.8,shadowRadius:4*s}}),_jsx(View,{style:y})]})}return _jsx(View,{style:y})};function getQuadraticBezierPoint(t,o,r,e,s,i,a){const d=1-t;return{x:d*d*o+2*d*t*e+t*t*i,y:d*d*r+2*d*t*s+t*t*a}}function getCubicBezierPoint(t,o,r,e,s,i,a,d,n){const h=1-t,l=h*h,c=l*h,p=t*t,b=p*t;return{x:c*o+3*l*t*e+3*h*p*i+b*d,y:c*r+3*l*t*s+3*h*p*a+b*n}}export const IconLine=({x1:t,y1:o,x2:r,y2:e,stroke:s,strokeWidth:i=1,opacity:a=1,glowColor:d,glowRadius:n=0,rotation:h=0,curveX:l,curveY:c,curve2X:p,curve2Y:b})=>{const u=void 0!==l&&0!==l||void 0!==c&&0!==c,g=void 0!==p&&0!==p||void 0!==b&&0!==b;if(u||g){const d=(t+r)/2,n=(o+e)/2,h=d+(l??0),w=n+(c??0),f=d+(p??0),y=n+(b??0),x=u&&g;let C=0;const m=20;let R={x:t,y:o};for(let s=1;s<=m;s++){const i=s/m,a=x?getCubicBezierPoint(i,t,o,h,w,f,y,r,e):getQuadraticBezierPoint(i,t,o,u?h:f,u?w:y,r,e);C+=Math.sqrt((a.x-R.x)**2+(a.y-R.y)**2),R=a}const _=[],j=Math.max(.05,.02*i),W=Math.max(100,Math.ceil(C/j));for(let d=0;d<=W;d++){const n=d/W,l=x?getCubicBezierPoint(n,t,o,h,w,f,y,r,e):getQuadraticBezierPoint(n,t,o,u?h:f,u?w:y,r,e),c={position:"absolute",left:l.x-i/2,top:l.y-i/2,width:i,height:i,borderRadius:i/2,backgroundColor:s,opacity:a};_.push(_jsx(View,{style:c},`c${d}`))}return _jsx(_Fragment,{children:_})}const w=r-t,f=e-o,y=Math.sqrt(w*w+f*f),x=(t+r)/2,C=(o+e)/2,m=Math.atan2(f,w)*(180/Math.PI)+h,R={position:"absolute",left:x-y/2,top:C-i/2,width:y,height:i,backgroundColor:s,opacity:a,transform:[{rotate:`${m}deg`}],borderRadius:i/2};return d&&n>0?_jsxs(_Fragment,{children:[_jsx(View,{style:{position:"absolute",left:x-y/2,top:C-i/2,width:y,height:i,backgroundColor:d,opacity:.5,transform:[{rotate:`${m}deg`}],borderRadius:i/2,shadowColor:d,shadowOffset:{width:0,height:0},shadowOpacity:.9,shadowRadius:8}}),_jsx(View,{style:R})]}):_jsx(View,{style:R})};export const IconTriangle=({x:t,y:o,size:r,direction:e,fill:s,opacity:i=1,rotation:a})=>{const d=.577*r;let n={},h=0,l=0;switch(e){case"down":n={borderLeftWidth:d,borderRightWidth:d,borderTopWidth:r,borderLeftColor:"transparent",borderRightColor:"transparent",borderTopColor:s},h=-d,l=0;break;case"up":n={borderLeftWidth:d,borderRightWidth:d,borderBottomWidth:r,borderLeftColor:"transparent",borderRightColor:"transparent",borderBottomColor:s},h=-d,l=-r;break;case"left":n={borderTopWidth:d,borderBottomWidth:d,borderRightWidth:r,borderTopColor:"transparent",borderBottomColor:"transparent",borderRightColor:s},h=-r,l=-d;break;case"right":n={borderTopWidth:d,borderBottomWidth:d,borderLeftWidth:r,borderTopColor:"transparent",borderBottomColor:"transparent",borderLeftColor:s},h=0,l=-d}const c=[];void 0!==a&&c.push({rotate:`${a}deg`});const p={position:"absolute",left:t+h,top:o+l,width:0,height:0,opacity:i,...n,transform:c.length>0?c:void 0};return _jsx(View,{style:p})};export const IconArc=({cx:t,cy:o,r:r,startAngle:e,endAngle:s,stroke:i,strokeWidth:a=1.5,opacity:d=1,segments:n})=>{const h=Math.abs(s-e),l=Math.max(8,Math.ceil(h/10)),c=n??l,p=[],b=(s-e)/c;for(let s=0;s<c;s++){const n=e+(s+1)*b,h=(e+s*b)*Math.PI/180,l=n*Math.PI/180,c=t+r*Math.cos(h),u=o+r*Math.sin(h),g=t+r*Math.cos(l),w=o+r*Math.sin(l),f=g-c,y=w-u,x=Math.sqrt(f*f+y*y),C={position:"absolute",left:(c+g)/2-x/2,top:(u+w)/2-a/2,width:x,height:a,backgroundColor:i,opacity:d,transform:[{rotate:Math.atan2(y,f)*(180/Math.PI)+"deg"}],borderRadius:a/2};p.push(_jsx(View,{style:C},s))}return _jsx(_Fragment,{children:p})};export const IconSemicircle=({cx:t,cy:o,r:r,half:e,fill:s,borderColor:i,borderWidth:a=0,opacity:d=1,glowColor:n,glowRadius:h=0})=>{const l=2*r;let c,p,b,u,g=0,w=0,f=0,y=0;switch(e){case"top":c=t-r,p=o-r,b=l,u=r,g=r,w=r;break;case"bottom":c=t-r,p=o,b=l,u=r,f=r,y=r;break;case"left":c=t-r,p=o-r,b=r,u=l,g=r,f=r;break;case"right":c=t,p=o-r,b=r,u=l,w=r,y=r}const x=n&&h>0,C={position:"absolute",left:c,top:p,width:b,height:u,borderTopLeftRadius:g,borderTopRightRadius:w,borderBottomLeftRadius:f,borderBottomRightRadius:y,backgroundColor:s,borderColor:i,borderWidth:a,opacity:d,...x&&s&&"transparent"!==s&&{shadowColor:n,shadowOffset:{width:0,height:0},shadowOpacity:.9,shadowRadius:.8*h}};if(x&&(!s||"transparent"===s)){const s=a||1,i=r+s;return _jsxs(_Fragment,{children:[_jsx(View,{style:{position:"absolute",left:t-("right"===e?0:i),top:o-("bottom"===e?0:i),width:"left"===e||"right"===e?i:2*i,height:"top"===e||"bottom"===e?i:2*i,borderTopLeftRadius:"top"===e||"left"===e?i:0,borderTopRightRadius:"top"===e||"right"===e?i:0,borderBottomLeftRadius:"bottom"===e||"left"===e?i:0,borderBottomRightRadius:"bottom"===e||"right"===e?i:0,borderWidth:2*s,borderColor:n,opacity:.4,shadowColor:n,shadowOffset:{width:0,height:0},shadowOpacity:.8,shadowRadius:4*s}}),_jsx(View,{style:C})]})}return _jsx(View,{style:C})};export const IconSmoothArc=({cx:t,cy:o,r:r,stroke:e,strokeWidth:s=2,opacity:i=1,portion:a="bottom"})=>{const d=2*r;let n=e,h=e,l=e,c=e;switch(a){case"bottom":n="transparent",l="transparent",c="transparent";break;case"top":h="transparent",l="transparent",c="transparent";break;case"left":n="transparent",h="transparent",c="transparent";break;case"right":n="transparent",h="transparent",l="transparent"}return _jsx(View,{style:{position:"absolute",left:t-r,top:o-r,width:d,height:d,borderRadius:r,borderWidth:s,borderTopColor:n,borderBottomColor:h,borderLeftColor:l,borderRightColor:c,opacity:i}})};