@launchdarkly/toolbar 0.10.0 → 0.11.0-beta.1
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/README.md +48 -132
- package/dist/index.d.ts +3 -0
- package/dist/js/index.js +1730 -994
- package/dist/plugins/FlagOverridePlugin.d.ts +57 -0
- package/dist/plugins/index.d.ts +2 -0
- package/dist/tests/DevServerProvider.test.d.ts +1 -0
- package/dist/tests/ExpandedToolbarContent.test.d.ts +1 -0
- package/dist/tests/FlagSdkOverrideProvider.test.d.ts +1 -0
- package/dist/types/devServer.d.ts +2 -2
- package/dist/types/plugin.d.ts +31 -0
- package/dist/ui/Toolbar/Header/Header.d.ts +2 -0
- package/dist/ui/Toolbar/Header/components/ActionButtons.d.ts +1 -0
- package/dist/ui/Toolbar/LaunchDarklyToolbar.d.ts +8 -2
- package/dist/ui/Toolbar/TabContent/FlagDevServerTabContent.d.ts +1 -0
- package/dist/ui/Toolbar/TabContent/FlagSdkOverrideTabContent.d.ts +6 -0
- package/dist/ui/Toolbar/TabContent/SettingsTabContent.d.ts +6 -1
- package/dist/ui/Toolbar/components/ExpandedToolbarContent.d.ts +4 -1
- package/dist/ui/Toolbar/components/LocalFlagControls.css.d.ts +4 -0
- package/dist/ui/Toolbar/components/LocalFlagControls.d.ts +20 -0
- package/dist/ui/Toolbar/components/TabContentRenderer.d.ts +4 -1
- package/dist/ui/Toolbar/constants/index.d.ts +1 -1
- package/dist/ui/Toolbar/constants/virtualization.d.ts +4 -0
- package/dist/ui/Toolbar/context/{LaunchDarklyToolbarProvider.d.ts → DevServerProvider.d.ts} +6 -6
- package/dist/ui/Toolbar/context/FlagSdkOverrideProvider.d.ts +19 -0
- package/dist/ui/Toolbar/context/index.d.ts +3 -0
- package/dist/ui/Toolbar/types/toolbar.d.ts +7 -1
- package/package.json +10 -7
- package/dist/ui/Toolbar/TabContent/FlagTabContent.d.ts +0 -1
- package/dist/ui/Toolbar/constants/config.d.ts +0 -3
- /package/dist/ui/Toolbar/TabContent/{FlagTabContent.css.d.ts → FlagDevServerTabContent.css.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -2,183 +2,103 @@
|
|
|
2
2
|
|
|
3
3
|
> ⚠️ **Warning:** This package is currently not ready for production use and is considered unsupported. Features, APIs, and behavior may change without notice.
|
|
4
4
|
|
|
5
|
-
A React component that provides a developer-friendly toolbar for interacting with LaunchDarkly during development.
|
|
5
|
+
A React component that provides a developer-friendly toolbar for interacting with LaunchDarkly during development. The toolbar supports two modes:
|
|
6
|
+
|
|
7
|
+
- **Dev Server Mode**: Connect to a LaunchDarkly CLI dev server for flag browsing and real-time updates
|
|
8
|
+
- **SDK Mode**: Integrate with flag override plugins for local flag testing
|
|
6
9
|
|
|
7
10
|
## Installation
|
|
8
11
|
|
|
9
12
|
```bash
|
|
10
13
|
npm install @launchdarkly/toolbar
|
|
11
|
-
# or
|
|
12
|
-
yarn add @launchdarkly/toolbar
|
|
13
|
-
# or
|
|
14
|
-
pnpm add @launchdarkly/toolbar
|
|
15
14
|
```
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
**Dev Server Mode** (connects to LaunchDarkly CLI dev server):
|
|
18
19
|
|
|
19
20
|
```tsx
|
|
20
21
|
import { LaunchDarklyToolbar } from '@launchdarkly/toolbar';
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
2. **Add the toolbar to your app:**
|
|
24
22
|
|
|
25
|
-
```tsx
|
|
26
23
|
function App() {
|
|
27
24
|
return (
|
|
28
25
|
<div>
|
|
29
|
-
{/* Your app content */}
|
|
30
26
|
<h1>My App</h1>
|
|
31
|
-
|
|
32
|
-
{/* LaunchDarkly Toolbar */}
|
|
33
|
-
<LaunchDarklyToolbar devServerUrl="http://localhost:8765" position="right" />
|
|
27
|
+
<LaunchDarklyToolbar devServerUrl="http://localhost:8765" />
|
|
34
28
|
</div>
|
|
35
29
|
);
|
|
36
30
|
}
|
|
37
31
|
```
|
|
38
32
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
# Make sure your LaunchDarkly dev server is running
|
|
43
|
-
# The toolbar will automatically connect and display your flags
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
## Props
|
|
47
|
-
|
|
48
|
-
| Prop | Type | Default | Description |
|
|
49
|
-
| -------------- | ------------------- | ------------------------- | --------------------------------------------- |
|
|
50
|
-
| `devServerUrl` | `string` | `"http://localhost:8765"` | URL of your LaunchDarkly development server |
|
|
51
|
-
| `position` | `"left" \| "right"` | `"right"` | Position of the toolbar on screen |
|
|
52
|
-
| `projectKey` | `string` | `undefined` | Optional project key for multi-project setups |
|
|
53
|
-
|
|
54
|
-
## Usage Examples
|
|
55
|
-
|
|
56
|
-
### Basic Usage
|
|
33
|
+
**SDK Mode** (integrates with flag override override plugins):
|
|
57
34
|
|
|
58
35
|
```tsx
|
|
59
36
|
import { LaunchDarklyToolbar } from '@launchdarkly/toolbar';
|
|
37
|
+
import { flagOverridePlugin } from './your-flag-override-plugin';
|
|
60
38
|
|
|
61
39
|
function App() {
|
|
62
40
|
return (
|
|
63
|
-
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
</main>
|
|
68
|
-
|
|
69
|
-
<LaunchDarklyToolbar />
|
|
70
|
-
</>
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
### Custom Configuration
|
|
76
|
-
|
|
77
|
-
```tsx
|
|
78
|
-
import { LaunchDarklyToolbar } from '@launchdarkly/toolbar';
|
|
79
|
-
|
|
80
|
-
function App() {
|
|
81
|
-
return (
|
|
82
|
-
<>
|
|
83
|
-
<main>{/* Your app content */}</main>
|
|
84
|
-
|
|
85
|
-
<LaunchDarklyToolbar devServerUrl="http://localhost:3001" position="left" projectKey="my-project" />
|
|
86
|
-
</>
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### Usage
|
|
92
|
-
|
|
93
|
-
```tsx
|
|
94
|
-
import { LaunchDarklyToolbar } from '@launchdarkly/toolbar';
|
|
95
|
-
|
|
96
|
-
function App() {
|
|
97
|
-
return (
|
|
98
|
-
<>
|
|
99
|
-
<main>{/* Your app content */}</main>
|
|
100
|
-
|
|
101
|
-
{/* Only show toolbar in development */}
|
|
102
|
-
{process.env.NODE_ENV === 'development' && <LaunchDarklyToolbar />}
|
|
103
|
-
</>
|
|
41
|
+
<div>
|
|
42
|
+
<h1>My App</h1>
|
|
43
|
+
<LaunchDarklyToolbar flagOverridePlugin={flagOverridePlugin} />
|
|
44
|
+
</div>
|
|
104
45
|
);
|
|
105
46
|
}
|
|
106
47
|
```
|
|
107
48
|
|
|
108
|
-
##
|
|
109
|
-
|
|
110
|
-
The LaunchDarkly Toolbar connects to your LaunchDarkly development server to provide real-time flag management capabilities:
|
|
111
|
-
|
|
112
|
-
1. **Automatic Discovery** - The toolbar automatically discovers available flags from your dev server
|
|
113
|
-
2. **Real-time Updates** - Flag changes are reflected immediately in your application
|
|
114
|
-
3. **Event Stream** - Monitor flag evaluation events as they happen
|
|
115
|
-
4. **Search & Filter** - Quickly find flags using the built-in search functionality
|
|
49
|
+
## Props
|
|
116
50
|
|
|
117
|
-
|
|
51
|
+
| Prop | Type | Default | Description |
|
|
52
|
+
| -------------------- | --------------------- | ----------- | ------------------------------------------------------------------------- |
|
|
53
|
+
| `devServerUrl` | `string` (optional) | `undefined` | URL of your LaunchDarkly dev server. If provided, enables Dev Server Mode |
|
|
54
|
+
| `flagOverridePlugin` | `IFlagOverridePlugin` | `undefined` | Flag override plugin for SDK Mode. Shows Overrides tab when provided |
|
|
55
|
+
| `position` | `"left" \| "right"` | `"right"` | Position of the toolbar on screen |
|
|
56
|
+
| `projectKey` | `string` (optional) | `undefined` | Optional project key for multi-project setups (Dev Server Mode only) |
|
|
57
|
+
| `pollIntervalInMs` | `number` (optional) | `5000` | Polling interval for dev server updates (Dev Server Mode only) |
|
|
118
58
|
|
|
119
|
-
|
|
59
|
+
## Configuration
|
|
120
60
|
|
|
121
|
-
###
|
|
61
|
+
### Mode Determination
|
|
122
62
|
|
|
123
|
-
The toolbar
|
|
63
|
+
The toolbar automatically determines its mode:
|
|
124
64
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
window.ldToolbar.enable();
|
|
128
|
-
|
|
129
|
-
// Disable the toolbar (saves preference to localStorage and hides the toolbar)
|
|
130
|
-
window.ldToolbar.disable();
|
|
65
|
+
- **Dev Server Mode**: When `devServerUrl` is provided
|
|
66
|
+
- **SDK Mode**: When `devServerUrl` is omitted
|
|
131
67
|
|
|
132
|
-
|
|
133
|
-
window.ldToolbar.toggle();
|
|
68
|
+
### Available Features by Mode
|
|
134
69
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
70
|
+
| Mode | Available Tabs |
|
|
71
|
+
| ------------------- | ------------------------------------------------------ |
|
|
72
|
+
| **Dev Server Mode** | Flags, Settings |
|
|
73
|
+
| **SDK Mode** | Overrides (if `flagOverridePlugin` provided), Settings |
|
|
138
74
|
|
|
139
|
-
|
|
75
|
+
## Setup
|
|
140
76
|
|
|
141
|
-
|
|
77
|
+
**Dev Server Mode**: Start your LaunchDarkly dev server with CORS enabled:
|
|
142
78
|
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
window.ldToolbar.enable() - Enable toolbar
|
|
146
|
-
window.ldToolbar.disable() - Disable toolbar
|
|
147
|
-
window.ldToolbar.toggle() - Toggle toolbar
|
|
148
|
-
window.ldToolbar.status() - Check current status
|
|
79
|
+
```bash
|
|
80
|
+
ldcli dev-server start --project your-project --cors-enabled true
|
|
149
81
|
```
|
|
150
82
|
|
|
151
|
-
|
|
83
|
+
**SDK Mode**: No additional setup required.
|
|
152
84
|
|
|
153
|
-
|
|
85
|
+
## Visibility Control
|
|
154
86
|
|
|
155
|
-
|
|
87
|
+
The toolbar provides a global API for show/hide control:
|
|
156
88
|
|
|
157
89
|
```javascript
|
|
158
|
-
//
|
|
159
|
-
window.ldToolbar.
|
|
160
|
-
// Console: ✅ LaunchDarkly toolbar disabled.
|
|
90
|
+
// Toggle visibility
|
|
91
|
+
window.ldToolbar.toggle();
|
|
161
92
|
|
|
162
|
-
//
|
|
93
|
+
// Enable/disable explicitly
|
|
163
94
|
window.ldToolbar.enable();
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
// Check if the toolbar is currently visible
|
|
167
|
-
const isEnabled = window.ldToolbar.status();
|
|
168
|
-
// Console: LaunchDarkly toolbar is currently: ✅ ENABLED
|
|
169
|
-
// Returns: true
|
|
95
|
+
window.ldToolbar.disable();
|
|
170
96
|
|
|
171
|
-
//
|
|
172
|
-
window.ldToolbar.
|
|
97
|
+
// Check current status
|
|
98
|
+
window.ldToolbar.status(); // returns true/false
|
|
173
99
|
```
|
|
174
100
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
The toolbar requires a LaunchDarkly CLI dev-server to be running with CORS enabled.
|
|
178
|
-
|
|
179
|
-
```bash
|
|
180
|
-
ldcli dev-server start --project demo-project --cors-enabled true
|
|
181
|
-
```
|
|
101
|
+
Visibility preferences are automatically saved to localStorage.
|
|
182
102
|
|
|
183
103
|
## TypeScript
|
|
184
104
|
|
|
@@ -186,12 +106,8 @@ The package includes complete TypeScript definitions. No additional `@types` pac
|
|
|
186
106
|
|
|
187
107
|
```tsx
|
|
188
108
|
import type { LaunchDarklyToolbarProps } from '@launchdarkly/toolbar';
|
|
189
|
-
|
|
190
|
-
const toolbarConfig: LaunchDarklyToolbarProps = {
|
|
191
|
-
devServerUrl: 'http://localhost:8765',
|
|
192
|
-
position: 'right',
|
|
193
|
-
projectKey: 'my-project',
|
|
194
|
-
};
|
|
195
109
|
```
|
|
196
110
|
|
|
111
|
+
---
|
|
112
|
+
|
|
197
113
|
Built with ❤️ for the LaunchDarkly developer community.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import './globals.css';
|
|
2
2
|
export { LaunchDarklyToolbar } from './ui/Toolbar/LaunchDarklyToolbar';
|
|
3
3
|
export type { LaunchDarklyToolbarProps } from './ui/Toolbar/LaunchDarklyToolbar';
|
|
4
|
+
export type { IFlagOverridePlugin } from './types/plugin';
|
|
5
|
+
export { FlagOverridePlugin } from './plugins';
|
|
6
|
+
export type { FlagOverridePluginConfig } from './plugins';
|