@buoy-gg/floating-tools-core 7.0.4 → 7.0.6

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 (129) hide show
  1. package/lib/commonjs/icons/ICONS.md +63 -34
  2. package/lib/commonjs/icons/benchmark-icon.js +5 -5
  3. package/lib/commonjs/icons/console-icon.js +26 -0
  4. package/lib/commonjs/icons/env-icon.js +5 -5
  5. package/lib/commonjs/icons/events-icon.js +5 -5
  6. package/lib/commonjs/icons/generated/icon-data.g.js +5203 -0
  7. package/lib/commonjs/icons/highlight-icon.js +5 -5
  8. package/lib/commonjs/icons/image-overlay-icon.js +26 -0
  9. package/lib/commonjs/icons/images-icon.js +26 -0
  10. package/lib/commonjs/icons/impersonate-icon.js +26 -0
  11. package/lib/commonjs/icons/jotai-icon.js +26 -0
  12. package/lib/commonjs/icons/network-icon.js +5 -5
  13. package/lib/commonjs/icons/query-icon.js +5 -5
  14. package/lib/commonjs/icons/redux-icon.js +15 -76
  15. package/lib/commonjs/icons/renders-icon.js +6 -6
  16. package/lib/commonjs/icons/routes-icon.js +25 -25
  17. package/lib/commonjs/icons/sentry-icon.js +5 -5
  18. package/lib/commonjs/icons/storage-icon.js +5 -5
  19. package/lib/commonjs/icons/wifi-icon.js +5 -5
  20. package/lib/commonjs/icons/zustand-icon.js +26 -0
  21. package/lib/commonjs/index.js +78 -0
  22. package/lib/module/icons/ICONS.md +63 -34
  23. package/lib/module/icons/benchmark-icon.js +3 -3
  24. package/lib/module/icons/console-icon.js +17 -0
  25. package/lib/module/icons/env-icon.js +3 -3
  26. package/lib/module/icons/events-icon.js +3 -3
  27. package/lib/module/icons/generated/icon-data.g.js +5198 -0
  28. package/lib/module/icons/highlight-icon.js +3 -3
  29. package/lib/module/icons/image-overlay-icon.js +17 -0
  30. package/lib/module/icons/images-icon.js +17 -0
  31. package/lib/module/icons/impersonate-icon.js +17 -0
  32. package/lib/module/icons/jotai-icon.js +17 -0
  33. package/lib/module/icons/network-icon.js +3 -3
  34. package/lib/module/icons/query-icon.js +3 -3
  35. package/lib/module/icons/redux-icon.js +9 -75
  36. package/lib/module/icons/renders-icon.js +3 -3
  37. package/lib/module/icons/routes-icon.js +3 -3
  38. package/lib/module/icons/sentry-icon.js +3 -3
  39. package/lib/module/icons/storage-icon.js +3 -3
  40. package/lib/module/icons/wifi-icon.js +3 -3
  41. package/lib/module/icons/zustand-icon.js +17 -0
  42. package/lib/module/index.js +6 -0
  43. package/lib/typescript/commonjs/icons/benchmark-icon.d.ts +3 -3
  44. package/lib/typescript/commonjs/icons/benchmark-icon.d.ts.map +1 -1
  45. package/lib/typescript/commonjs/icons/console-icon.d.ts +14 -0
  46. package/lib/typescript/commonjs/icons/console-icon.d.ts.map +1 -0
  47. package/lib/typescript/commonjs/icons/env-icon.d.ts +3 -3
  48. package/lib/typescript/commonjs/icons/env-icon.d.ts.map +1 -1
  49. package/lib/typescript/commonjs/icons/events-icon.d.ts +3 -3
  50. package/lib/typescript/commonjs/icons/events-icon.d.ts.map +1 -1
  51. package/lib/typescript/commonjs/icons/generated/icon-data.g.d.ts +124 -0
  52. package/lib/typescript/commonjs/icons/generated/icon-data.g.d.ts.map +1 -0
  53. package/lib/typescript/commonjs/icons/highlight-icon.d.ts +3 -3
  54. package/lib/typescript/commonjs/icons/highlight-icon.d.ts.map +1 -1
  55. package/lib/typescript/commonjs/icons/image-overlay-icon.d.ts +14 -0
  56. package/lib/typescript/commonjs/icons/image-overlay-icon.d.ts.map +1 -0
  57. package/lib/typescript/commonjs/icons/images-icon.d.ts +14 -0
  58. package/lib/typescript/commonjs/icons/images-icon.d.ts.map +1 -0
  59. package/lib/typescript/commonjs/icons/impersonate-icon.d.ts +14 -0
  60. package/lib/typescript/commonjs/icons/impersonate-icon.d.ts.map +1 -0
  61. package/lib/typescript/commonjs/icons/jotai-icon.d.ts +14 -0
  62. package/lib/typescript/commonjs/icons/jotai-icon.d.ts.map +1 -0
  63. package/lib/typescript/commonjs/icons/network-icon.d.ts +3 -3
  64. package/lib/typescript/commonjs/icons/network-icon.d.ts.map +1 -1
  65. package/lib/typescript/commonjs/icons/query-icon.d.ts +3 -3
  66. package/lib/typescript/commonjs/icons/query-icon.d.ts.map +1 -1
  67. package/lib/typescript/commonjs/icons/redux-icon.d.ts +8 -3
  68. package/lib/typescript/commonjs/icons/redux-icon.d.ts.map +1 -1
  69. package/lib/typescript/commonjs/icons/renders-icon.d.ts +3 -3
  70. package/lib/typescript/commonjs/icons/renders-icon.d.ts.map +1 -1
  71. package/lib/typescript/commonjs/icons/routes-icon.d.ts +3 -3
  72. package/lib/typescript/commonjs/icons/routes-icon.d.ts.map +1 -1
  73. package/lib/typescript/commonjs/icons/sentry-icon.d.ts +3 -3
  74. package/lib/typescript/commonjs/icons/sentry-icon.d.ts.map +1 -1
  75. package/lib/typescript/commonjs/icons/storage-icon.d.ts +3 -3
  76. package/lib/typescript/commonjs/icons/storage-icon.d.ts.map +1 -1
  77. package/lib/typescript/commonjs/icons/wifi-icon.d.ts +3 -3
  78. package/lib/typescript/commonjs/icons/wifi-icon.d.ts.map +1 -1
  79. package/lib/typescript/commonjs/icons/zustand-icon.d.ts +14 -0
  80. package/lib/typescript/commonjs/icons/zustand-icon.d.ts.map +1 -0
  81. package/lib/typescript/commonjs/index.d.ts +6 -0
  82. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  83. package/lib/typescript/module/icons/benchmark-icon.d.ts +3 -3
  84. package/lib/typescript/module/icons/benchmark-icon.d.ts.map +1 -1
  85. package/lib/typescript/module/icons/console-icon.d.ts +14 -0
  86. package/lib/typescript/module/icons/console-icon.d.ts.map +1 -0
  87. package/lib/typescript/module/icons/env-icon.d.ts +3 -3
  88. package/lib/typescript/module/icons/env-icon.d.ts.map +1 -1
  89. package/lib/typescript/module/icons/events-icon.d.ts +3 -3
  90. package/lib/typescript/module/icons/events-icon.d.ts.map +1 -1
  91. package/lib/typescript/module/icons/generated/icon-data.g.d.ts +124 -0
  92. package/lib/typescript/module/icons/generated/icon-data.g.d.ts.map +1 -0
  93. package/lib/typescript/module/icons/highlight-icon.d.ts +3 -3
  94. package/lib/typescript/module/icons/highlight-icon.d.ts.map +1 -1
  95. package/lib/typescript/module/icons/image-overlay-icon.d.ts +14 -0
  96. package/lib/typescript/module/icons/image-overlay-icon.d.ts.map +1 -0
  97. package/lib/typescript/module/icons/images-icon.d.ts +14 -0
  98. package/lib/typescript/module/icons/images-icon.d.ts.map +1 -0
  99. package/lib/typescript/module/icons/impersonate-icon.d.ts +14 -0
  100. package/lib/typescript/module/icons/impersonate-icon.d.ts.map +1 -0
  101. package/lib/typescript/module/icons/jotai-icon.d.ts +14 -0
  102. package/lib/typescript/module/icons/jotai-icon.d.ts.map +1 -0
  103. package/lib/typescript/module/icons/network-icon.d.ts +3 -3
  104. package/lib/typescript/module/icons/network-icon.d.ts.map +1 -1
  105. package/lib/typescript/module/icons/query-icon.d.ts +3 -3
  106. package/lib/typescript/module/icons/query-icon.d.ts.map +1 -1
  107. package/lib/typescript/module/icons/redux-icon.d.ts +8 -3
  108. package/lib/typescript/module/icons/redux-icon.d.ts.map +1 -1
  109. package/lib/typescript/module/icons/renders-icon.d.ts +3 -3
  110. package/lib/typescript/module/icons/renders-icon.d.ts.map +1 -1
  111. package/lib/typescript/module/icons/routes-icon.d.ts +3 -3
  112. package/lib/typescript/module/icons/routes-icon.d.ts.map +1 -1
  113. package/lib/typescript/module/icons/sentry-icon.d.ts +3 -3
  114. package/lib/typescript/module/icons/sentry-icon.d.ts.map +1 -1
  115. package/lib/typescript/module/icons/storage-icon.d.ts +3 -3
  116. package/lib/typescript/module/icons/storage-icon.d.ts.map +1 -1
  117. package/lib/typescript/module/icons/wifi-icon.d.ts +3 -3
  118. package/lib/typescript/module/icons/wifi-icon.d.ts.map +1 -1
  119. package/lib/typescript/module/icons/zustand-icon.d.ts +14 -0
  120. package/lib/typescript/module/icons/zustand-icon.d.ts.map +1 -0
  121. package/lib/typescript/module/index.d.ts +6 -0
  122. package/lib/typescript/module/index.d.ts.map +1 -1
  123. package/package.json +1 -1
  124. package/lib/commonjs/icons/icon-data.js +0 -2268
  125. package/lib/module/icons/icon-data.js +0 -2264
  126. package/lib/typescript/commonjs/icons/icon-data.d.ts +0 -66
  127. package/lib/typescript/commonjs/icons/icon-data.d.ts.map +0 -1
  128. package/lib/typescript/module/icons/icon-data.d.ts +0 -66
  129. package/lib/typescript/module/icons/icon-data.d.ts.map +0 -1
@@ -2,6 +2,19 @@
2
2
 
3
3
  A declarative, data-driven icon system for creating scalable vector-like icons using pure React components. Works on both **web** and **React Native** without SVG dependencies.
4
4
 
5
+ > **Source of truth moved.** Icons are now authored as framework-neutral JSON in
6
+ > `shared/icons/*.json` (the Buoy Icon Format) and **generated** into every framework —
7
+ > React Native, web/desktop, and Flutter. The old hand-written `icon-data.ts` is gone;
8
+ > `generated/icon-data.g.ts` replaces it and must never be edited by hand.
9
+ >
10
+ > - **`shared/icons/SPEC.md`** — the normative cross-framework rendering contract.
11
+ > It wins over this document wherever the two disagree.
12
+ > - **`shared/icons/schema.json`** — the machine-checkable shape.
13
+ > - **`/ICON_FORMAT_PLAN.md`** — why, and what is still being ported.
14
+ >
15
+ > This document remains the best *authoring* reference for the element types and
16
+ > coordinate system. Edit the JSON, then run `pnpm icons`.
17
+
5
18
  ## Table of Contents
6
19
 
7
20
  - [Core Philosophy](#core-philosophy)
@@ -36,28 +49,36 @@ This separation provides:
36
49
 
37
50
  ## Quick Start
38
51
 
39
- ### 1. Define Icon Data (`icon-data.ts`)
52
+ ### 1. Define Icon Data (`shared/icons/my-icon.json`)
40
53
 
41
- ```typescript
42
- import type { IconData } from './icon-renderer';
54
+ Icon data is **no longer written in TypeScript**. It lives as framework-neutral JSON
55
+ in `shared/icons/`, so Flutter (and any future framework) renders the same icon.
56
+
57
+ ```jsonc
58
+ {
59
+ "$schema": "./schema.json",
60
+ "name": "my-icon",
61
+ "colorExport": "MY_ICON_COLOR",
62
+ "color": "#FF6B6B",
63
+ "bgColor": "#000",
64
+ "elements": [
65
+ { "type": "circle", "cx": 0, "cy": 0, "r": 8, "fill": "color", "opacity": 0.9 },
66
+ { "type": "rect", "x": -4, "y": -4, "width": 8, "height": 8, "fill": "bg", "borderRadius": 2 }
67
+ ]
68
+ }
69
+ ```
43
70
 
44
- export const MY_ICON_COLOR = '#FF6B6B';
71
+ Then generate the per-framework constants:
45
72
 
46
- export const myIconData: IconData = {
47
- color: MY_ICON_COLOR,
48
- bgColor: '#000',
49
- elements: [
50
- { type: 'circle', cx: 0, cy: 0, r: 8, fill: 'color', opacity: 0.9 },
51
- { type: 'rect', x: -4, y: -4, width: 8, height: 8, fill: 'bg', borderRadius: 2 },
52
- ],
53
- };
73
+ ```bash
74
+ pnpm icons # regenerates icon-data.g.ts (and the Dart equivalent)
54
75
  ```
55
76
 
56
77
  ### 2. Create Icon Component (`my-icon.tsx`)
57
78
 
58
79
  ```typescript
59
80
  import { createIcon } from './icon-renderer';
60
- import { myIconData, MY_ICON_COLOR } from './icon-data';
81
+ import { myIconData, MY_ICON_COLOR } from './generated/icon-data.g';
61
82
 
62
83
  export { MY_ICON_COLOR };
63
84
  export const MyIcon = createIcon(myIconData);
@@ -382,34 +403,36 @@ createBar(0, -4, 2, 8, { opacity: 0.5 }) // Vertical bar at 50%
382
403
  - Identify layers (back to front order matters!)
383
404
  - Choose your theme color
384
405
 
385
- #### 2. Add to `icon-data.ts`
406
+ #### 2. Add `shared/icons/my-icon.json`
386
407
 
387
- ```typescript
388
- // Color constant
389
- export const MY_ICON_COLOR = '#00BFFF';
390
-
391
- // Icon data
392
- export const myIconData: IconData = {
393
- color: MY_ICON_COLOR,
394
- bgColor: '#000',
395
- elements: [
408
+ ```jsonc
409
+ {
410
+ "$schema": "./schema.json",
411
+ "name": "my-icon",
412
+ "colorExport": "MY_ICON_COLOR",
413
+ "color": "#00BFFF",
414
+ "bgColor": "#000",
415
+ "elements": [
396
416
  // Layer 1: Background glow (behind everything)
397
- { type: 'circle', cx: 0, cy: 0, r: 10, fill: 'color', opacity: 0.1 },
417
+ { "type": "circle", "cx": 0, "cy": 0, "r": 10, "fill": "color", "opacity": 0.1 },
398
418
 
399
419
  // Layer 2: Main shape
400
- { type: 'circle', cx: 0, cy: 0, r: 8, fill: 'color', opacity: 0.9 },
420
+ { "type": "circle", "cx": 0, "cy": 0, "r": 8, "fill": "color", "opacity": 0.9 },
401
421
 
402
422
  // Layer 3: Details (on top)
403
- { type: 'circle', cx: 0, cy: 0, r: 3, fill: '#fff', opacity: 0.3 },
404
- ],
405
- };
423
+ { "type": "circle", "cx": 0, "cy": 0, "r": 3, "fill": "#fff", "opacity": 0.3 }
424
+ ]
425
+ }
406
426
  ```
407
427
 
428
+ Run `pnpm icons` to regenerate. The filename must match the `name` field, and the
429
+ generated TS symbol is `myIconData` (`<camelName>IconData`).
430
+
408
431
  #### 3. Create Icon Component (`my-icon.tsx`)
409
432
 
410
433
  ```typescript
411
434
  import { createIcon } from './icon-renderer';
412
- import { myIconData, MY_ICON_COLOR } from './icon-data';
435
+ import { myIconData, MY_ICON_COLOR } from './generated/icon-data.g';
413
436
 
414
437
  export { MY_ICON_COLOR };
415
438
  export const MyIcon = createIcon(myIconData);
@@ -776,12 +799,18 @@ elements: [
776
799
  ## Architecture Reference
777
800
 
778
801
  ```
779
- icon-data.ts Pure data definitions (IconData objects)
780
- icon-renderer.tsx renderIconData() + createIcon() + types
781
- icon-factories.tsHelper functions (createNode, createLine, etc.)
782
- icon-primitives.tsx → Web primitives (CSS/divs)
802
+ shared/icons/*.json THE SOURCE OF TRUTH. Hand-edit these.
803
+ shared/icons/SPEC.md Cross-framework rendering contract
804
+ scripts/gen-icons.mjsGenerator (pnpm icons)
805
+
806
+ ├─► generated/icon-data.g.ts → GENERATED IconData objects — never edit
807
+ └─► (Flutter Dart constants)
808
+
809
+ icon-renderer.tsx → renderIconData() + createIcon() + types
810
+ icon-factories.ts → Helper functions (createNode, createLine, etc.)
811
+ icon-primitives.tsx → Web primitives (CSS/divs)
783
812
  icon-primitives.native.tsx → React Native primitives (Views)
784
- [icon-name]-icon.tsx → Individual icon exports
813
+ [icon-name]-icon.tsx → Individual icon exports
785
814
  ```
786
815
 
787
816
  ### Type Reference
@@ -3,13 +3,13 @@
3
3
  /**
4
4
  * BenchmarkIcon - Data-driven icon
5
5
  *
6
- * The icon is defined as pure data in icon-data.ts
6
+ * Defined as pure data in shared/icons/benchmark.json (Buoy Icon Format).
7
7
  * The renderer transforms it to components.
8
8
  *
9
- * To change: edit benchmarkIconData in icon-data.ts
9
+ * To change: edit that JSON, then run `node scripts/gen-icons.mjs`.
10
10
  */
11
11
 
12
12
  import { createIcon } from "./icon-renderer.js";
13
- import { benchmarkIconData, BENCHMARK_ICON_COLOR } from "./icon-data.js";
13
+ import { benchmarkIconData, BENCHMARK_ICON_COLOR } from "./generated/icon-data.g.js";
14
14
  export { BENCHMARK_ICON_COLOR };
15
15
  export const BenchmarkIcon = createIcon(benchmarkIconData);
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * ConsoleIcon - Data-driven icon
5
+ *
6
+ * Terminal frame with a `>_` prompt.
7
+ *
8
+ * Defined as pure data in shared/icons/console.json (Buoy Icon Format), so this
9
+ * is the same artwork the Flutter build renders.
10
+ *
11
+ * To change: edit that JSON, then run `node scripts/gen-icons.mjs`.
12
+ */
13
+
14
+ import { createIcon } from "./icon-renderer.js";
15
+ import { consoleIconData, CONSOLE_ICON_COLOR } from "./generated/icon-data.g.js";
16
+ export { CONSOLE_ICON_COLOR };
17
+ export const ConsoleIcon = createIcon(consoleIconData);
@@ -3,13 +3,13 @@
3
3
  /**
4
4
  * EnvIcon - Data-driven icon
5
5
  *
6
- * The icon is defined as pure data in icon-data.ts
6
+ * Defined as pure data in shared/icons/env.json (Buoy Icon Format).
7
7
  * The renderer transforms it to components.
8
8
  *
9
- * To change: edit envIconData in icon-data.ts
9
+ * To change: edit that JSON, then run `node scripts/gen-icons.mjs`.
10
10
  */
11
11
 
12
12
  import { createIcon } from "./icon-renderer.js";
13
- import { envIconData, ENV_ICON_COLOR } from "./icon-data.js";
13
+ import { envIconData, ENV_ICON_COLOR } from "./generated/icon-data.g.js";
14
14
  export { ENV_ICON_COLOR };
15
15
  export const EnvIcon = createIcon(envIconData);
@@ -3,13 +3,13 @@
3
3
  /**
4
4
  * EventsIcon - Data-driven icon
5
5
  *
6
- * The icon is defined as pure data in icon-data.ts
6
+ * Defined as pure data in shared/icons/events.json (Buoy Icon Format).
7
7
  * The renderer transforms it to components.
8
8
  *
9
- * To change: edit eventsIconData in icon-data.ts
9
+ * To change: edit that JSON, then run `node scripts/gen-icons.mjs`.
10
10
  */
11
11
 
12
12
  import { createIcon } from "./icon-renderer.js";
13
- import { eventsIconData, EVENTS_ICON_COLOR } from "./icon-data.js";
13
+ import { eventsIconData, EVENTS_ICON_COLOR } from "./generated/icon-data.g.js";
14
14
  export { EVENTS_ICON_COLOR };
15
15
  export const EventsIcon = createIcon(eventsIconData);