@buoy-gg/floating-tools-core 7.0.4 → 7.0.5
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.
- package/lib/commonjs/icons/ICONS.md +63 -34
- package/lib/commonjs/icons/benchmark-icon.js +5 -5
- package/lib/commonjs/icons/console-icon.js +26 -0
- package/lib/commonjs/icons/env-icon.js +5 -5
- package/lib/commonjs/icons/events-icon.js +5 -5
- package/lib/commonjs/icons/generated/icon-data.g.js +5203 -0
- package/lib/commonjs/icons/highlight-icon.js +5 -5
- package/lib/commonjs/icons/image-overlay-icon.js +26 -0
- package/lib/commonjs/icons/images-icon.js +26 -0
- package/lib/commonjs/icons/impersonate-icon.js +26 -0
- package/lib/commonjs/icons/jotai-icon.js +26 -0
- package/lib/commonjs/icons/network-icon.js +5 -5
- package/lib/commonjs/icons/query-icon.js +5 -5
- package/lib/commonjs/icons/redux-icon.js +15 -76
- package/lib/commonjs/icons/renders-icon.js +6 -6
- package/lib/commonjs/icons/routes-icon.js +25 -25
- package/lib/commonjs/icons/sentry-icon.js +5 -5
- package/lib/commonjs/icons/storage-icon.js +5 -5
- package/lib/commonjs/icons/wifi-icon.js +5 -5
- package/lib/commonjs/icons/zustand-icon.js +26 -0
- package/lib/commonjs/index.js +78 -0
- package/lib/module/icons/ICONS.md +63 -34
- package/lib/module/icons/benchmark-icon.js +3 -3
- package/lib/module/icons/console-icon.js +17 -0
- package/lib/module/icons/env-icon.js +3 -3
- package/lib/module/icons/events-icon.js +3 -3
- package/lib/module/icons/generated/icon-data.g.js +5198 -0
- package/lib/module/icons/highlight-icon.js +3 -3
- package/lib/module/icons/image-overlay-icon.js +17 -0
- package/lib/module/icons/images-icon.js +17 -0
- package/lib/module/icons/impersonate-icon.js +17 -0
- package/lib/module/icons/jotai-icon.js +17 -0
- package/lib/module/icons/network-icon.js +3 -3
- package/lib/module/icons/query-icon.js +3 -3
- package/lib/module/icons/redux-icon.js +9 -75
- package/lib/module/icons/renders-icon.js +3 -3
- package/lib/module/icons/routes-icon.js +3 -3
- package/lib/module/icons/sentry-icon.js +3 -3
- package/lib/module/icons/storage-icon.js +3 -3
- package/lib/module/icons/wifi-icon.js +3 -3
- package/lib/module/icons/zustand-icon.js +17 -0
- package/lib/module/index.js +6 -0
- package/lib/typescript/commonjs/icons/benchmark-icon.d.ts +3 -3
- package/lib/typescript/commonjs/icons/benchmark-icon.d.ts.map +1 -1
- package/lib/typescript/commonjs/icons/console-icon.d.ts +14 -0
- package/lib/typescript/commonjs/icons/console-icon.d.ts.map +1 -0
- package/lib/typescript/commonjs/icons/env-icon.d.ts +3 -3
- package/lib/typescript/commonjs/icons/env-icon.d.ts.map +1 -1
- package/lib/typescript/commonjs/icons/events-icon.d.ts +3 -3
- package/lib/typescript/commonjs/icons/events-icon.d.ts.map +1 -1
- package/lib/typescript/commonjs/icons/generated/icon-data.g.d.ts +124 -0
- package/lib/typescript/commonjs/icons/generated/icon-data.g.d.ts.map +1 -0
- package/lib/typescript/commonjs/icons/highlight-icon.d.ts +3 -3
- package/lib/typescript/commonjs/icons/highlight-icon.d.ts.map +1 -1
- package/lib/typescript/commonjs/icons/image-overlay-icon.d.ts +14 -0
- package/lib/typescript/commonjs/icons/image-overlay-icon.d.ts.map +1 -0
- package/lib/typescript/commonjs/icons/images-icon.d.ts +14 -0
- package/lib/typescript/commonjs/icons/images-icon.d.ts.map +1 -0
- package/lib/typescript/commonjs/icons/impersonate-icon.d.ts +14 -0
- package/lib/typescript/commonjs/icons/impersonate-icon.d.ts.map +1 -0
- package/lib/typescript/commonjs/icons/jotai-icon.d.ts +14 -0
- package/lib/typescript/commonjs/icons/jotai-icon.d.ts.map +1 -0
- package/lib/typescript/commonjs/icons/network-icon.d.ts +3 -3
- package/lib/typescript/commonjs/icons/network-icon.d.ts.map +1 -1
- package/lib/typescript/commonjs/icons/query-icon.d.ts +3 -3
- package/lib/typescript/commonjs/icons/query-icon.d.ts.map +1 -1
- package/lib/typescript/commonjs/icons/redux-icon.d.ts +8 -3
- package/lib/typescript/commonjs/icons/redux-icon.d.ts.map +1 -1
- package/lib/typescript/commonjs/icons/renders-icon.d.ts +3 -3
- package/lib/typescript/commonjs/icons/renders-icon.d.ts.map +1 -1
- package/lib/typescript/commonjs/icons/routes-icon.d.ts +3 -3
- package/lib/typescript/commonjs/icons/routes-icon.d.ts.map +1 -1
- package/lib/typescript/commonjs/icons/sentry-icon.d.ts +3 -3
- package/lib/typescript/commonjs/icons/sentry-icon.d.ts.map +1 -1
- package/lib/typescript/commonjs/icons/storage-icon.d.ts +3 -3
- package/lib/typescript/commonjs/icons/storage-icon.d.ts.map +1 -1
- package/lib/typescript/commonjs/icons/wifi-icon.d.ts +3 -3
- package/lib/typescript/commonjs/icons/wifi-icon.d.ts.map +1 -1
- package/lib/typescript/commonjs/icons/zustand-icon.d.ts +14 -0
- package/lib/typescript/commonjs/icons/zustand-icon.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +6 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/module/icons/benchmark-icon.d.ts +3 -3
- package/lib/typescript/module/icons/benchmark-icon.d.ts.map +1 -1
- package/lib/typescript/module/icons/console-icon.d.ts +14 -0
- package/lib/typescript/module/icons/console-icon.d.ts.map +1 -0
- package/lib/typescript/module/icons/env-icon.d.ts +3 -3
- package/lib/typescript/module/icons/env-icon.d.ts.map +1 -1
- package/lib/typescript/module/icons/events-icon.d.ts +3 -3
- package/lib/typescript/module/icons/events-icon.d.ts.map +1 -1
- package/lib/typescript/module/icons/generated/icon-data.g.d.ts +124 -0
- package/lib/typescript/module/icons/generated/icon-data.g.d.ts.map +1 -0
- package/lib/typescript/module/icons/highlight-icon.d.ts +3 -3
- package/lib/typescript/module/icons/highlight-icon.d.ts.map +1 -1
- package/lib/typescript/module/icons/image-overlay-icon.d.ts +14 -0
- package/lib/typescript/module/icons/image-overlay-icon.d.ts.map +1 -0
- package/lib/typescript/module/icons/images-icon.d.ts +14 -0
- package/lib/typescript/module/icons/images-icon.d.ts.map +1 -0
- package/lib/typescript/module/icons/impersonate-icon.d.ts +14 -0
- package/lib/typescript/module/icons/impersonate-icon.d.ts.map +1 -0
- package/lib/typescript/module/icons/jotai-icon.d.ts +14 -0
- package/lib/typescript/module/icons/jotai-icon.d.ts.map +1 -0
- package/lib/typescript/module/icons/network-icon.d.ts +3 -3
- package/lib/typescript/module/icons/network-icon.d.ts.map +1 -1
- package/lib/typescript/module/icons/query-icon.d.ts +3 -3
- package/lib/typescript/module/icons/query-icon.d.ts.map +1 -1
- package/lib/typescript/module/icons/redux-icon.d.ts +8 -3
- package/lib/typescript/module/icons/redux-icon.d.ts.map +1 -1
- package/lib/typescript/module/icons/renders-icon.d.ts +3 -3
- package/lib/typescript/module/icons/renders-icon.d.ts.map +1 -1
- package/lib/typescript/module/icons/routes-icon.d.ts +3 -3
- package/lib/typescript/module/icons/routes-icon.d.ts.map +1 -1
- package/lib/typescript/module/icons/sentry-icon.d.ts +3 -3
- package/lib/typescript/module/icons/sentry-icon.d.ts.map +1 -1
- package/lib/typescript/module/icons/storage-icon.d.ts +3 -3
- package/lib/typescript/module/icons/storage-icon.d.ts.map +1 -1
- package/lib/typescript/module/icons/wifi-icon.d.ts +3 -3
- package/lib/typescript/module/icons/wifi-icon.d.ts.map +1 -1
- package/lib/typescript/module/icons/zustand-icon.d.ts +14 -0
- package/lib/typescript/module/icons/zustand-icon.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +6 -0
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/lib/commonjs/icons/icon-data.js +0 -2268
- package/lib/module/icons/icon-data.js +0 -2264
- package/lib/typescript/commonjs/icons/icon-data.d.ts +0 -66
- package/lib/typescript/commonjs/icons/icon-data.d.ts.map +0 -1
- package/lib/typescript/module/icons/icon-data.d.ts +0 -66
- 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
|
|
52
|
+
### 1. Define Icon Data (`shared/icons/my-icon.json`)
|
|
40
53
|
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
71
|
+
Then generate the per-framework constants:
|
|
45
72
|
|
|
46
|
-
|
|
47
|
-
|
|
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
|
|
406
|
+
#### 2. Add `shared/icons/my-icon.json`
|
|
386
407
|
|
|
387
|
-
```
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
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:
|
|
417
|
+
{ "type": "circle", "cx": 0, "cy": 0, "r": 10, "fill": "color", "opacity": 0.1 },
|
|
398
418
|
|
|
399
419
|
// Layer 2: Main shape
|
|
400
|
-
{ type:
|
|
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:
|
|
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
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
802
|
+
shared/icons/*.json → THE SOURCE OF TRUTH. Hand-edit these.
|
|
803
|
+
shared/icons/SPEC.md → Cross-framework rendering contract
|
|
804
|
+
scripts/gen-icons.mjs → Generator (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
|
|
813
|
+
[icon-name]-icon.tsx → Individual icon exports
|
|
785
814
|
```
|
|
786
815
|
|
|
787
816
|
### Type Reference
|
|
@@ -6,19 +6,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
Object.defineProperty(exports, "BENCHMARK_ICON_COLOR", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function () {
|
|
9
|
-
return
|
|
9
|
+
return _iconDataG.BENCHMARK_ICON_COLOR;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
exports.BenchmarkIcon = void 0;
|
|
13
13
|
var _iconRenderer = require("./icon-renderer.js");
|
|
14
|
-
var
|
|
14
|
+
var _iconDataG = require("./generated/icon-data.g.js");
|
|
15
15
|
/**
|
|
16
16
|
* BenchmarkIcon - Data-driven icon
|
|
17
17
|
*
|
|
18
|
-
*
|
|
18
|
+
* Defined as pure data in shared/icons/benchmark.json (Buoy Icon Format).
|
|
19
19
|
* The renderer transforms it to components.
|
|
20
20
|
*
|
|
21
|
-
* To change: edit
|
|
21
|
+
* To change: edit that JSON, then run `node scripts/gen-icons.mjs`.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
const BenchmarkIcon = exports.BenchmarkIcon = (0, _iconRenderer.createIcon)(
|
|
24
|
+
const BenchmarkIcon = exports.BenchmarkIcon = (0, _iconRenderer.createIcon)(_iconDataG.benchmarkIconData);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "CONSOLE_ICON_COLOR", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _iconDataG.CONSOLE_ICON_COLOR;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
exports.ConsoleIcon = void 0;
|
|
13
|
+
var _iconRenderer = require("./icon-renderer.js");
|
|
14
|
+
var _iconDataG = require("./generated/icon-data.g.js");
|
|
15
|
+
/**
|
|
16
|
+
* ConsoleIcon - Data-driven icon
|
|
17
|
+
*
|
|
18
|
+
* Terminal frame with a `>_` prompt.
|
|
19
|
+
*
|
|
20
|
+
* Defined as pure data in shared/icons/console.json (Buoy Icon Format), so this
|
|
21
|
+
* is the same artwork the Flutter build renders.
|
|
22
|
+
*
|
|
23
|
+
* To change: edit that JSON, then run `node scripts/gen-icons.mjs`.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
const ConsoleIcon = exports.ConsoleIcon = (0, _iconRenderer.createIcon)(_iconDataG.consoleIconData);
|
|
@@ -6,19 +6,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
Object.defineProperty(exports, "ENV_ICON_COLOR", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function () {
|
|
9
|
-
return
|
|
9
|
+
return _iconDataG.ENV_ICON_COLOR;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
exports.EnvIcon = void 0;
|
|
13
13
|
var _iconRenderer = require("./icon-renderer.js");
|
|
14
|
-
var
|
|
14
|
+
var _iconDataG = require("./generated/icon-data.g.js");
|
|
15
15
|
/**
|
|
16
16
|
* EnvIcon - Data-driven icon
|
|
17
17
|
*
|
|
18
|
-
*
|
|
18
|
+
* Defined as pure data in shared/icons/env.json (Buoy Icon Format).
|
|
19
19
|
* The renderer transforms it to components.
|
|
20
20
|
*
|
|
21
|
-
* To change: edit
|
|
21
|
+
* To change: edit that JSON, then run `node scripts/gen-icons.mjs`.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
const EnvIcon = exports.EnvIcon = (0, _iconRenderer.createIcon)(
|
|
24
|
+
const EnvIcon = exports.EnvIcon = (0, _iconRenderer.createIcon)(_iconDataG.envIconData);
|
|
@@ -6,19 +6,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
Object.defineProperty(exports, "EVENTS_ICON_COLOR", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function () {
|
|
9
|
-
return
|
|
9
|
+
return _iconDataG.EVENTS_ICON_COLOR;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
exports.EventsIcon = void 0;
|
|
13
13
|
var _iconRenderer = require("./icon-renderer.js");
|
|
14
|
-
var
|
|
14
|
+
var _iconDataG = require("./generated/icon-data.g.js");
|
|
15
15
|
/**
|
|
16
16
|
* EventsIcon - Data-driven icon
|
|
17
17
|
*
|
|
18
|
-
*
|
|
18
|
+
* Defined as pure data in shared/icons/events.json (Buoy Icon Format).
|
|
19
19
|
* The renderer transforms it to components.
|
|
20
20
|
*
|
|
21
|
-
* To change: edit
|
|
21
|
+
* To change: edit that JSON, then run `node scripts/gen-icons.mjs`.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
const EventsIcon = exports.EventsIcon = (0, _iconRenderer.createIcon)(
|
|
24
|
+
const EventsIcon = exports.EventsIcon = (0, _iconRenderer.createIcon)(_iconDataG.eventsIconData);
|