@launchdarkly/toolbar 0.0.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.
Files changed (80) hide show
  1. package/LICENSE +13 -0
  2. package/README.md +197 -0
  3. package/dist/index.d.ts +3 -0
  4. package/dist/js/index.js +4157 -0
  5. package/dist/services/DevServerClient.d.ts +34 -0
  6. package/dist/services/FlagStateManager.d.ts +15 -0
  7. package/dist/static/font/Audimat3000-Regulier.var-subset.woff2 +0 -0
  8. package/dist/static/font/Inter.var-subset.woff2 +0 -0
  9. package/dist/tests/LaunchDarklyToolbar.test.d.ts +1 -0
  10. package/dist/tests/Tabs.test.d.ts +1 -0
  11. package/dist/tests/mocks/flags.d.ts +2 -0
  12. package/dist/types/devServer.d.ts +29 -0
  13. package/dist/ui/List/List.css.d.ts +2 -0
  14. package/dist/ui/List/List.d.ts +5 -0
  15. package/dist/ui/List/ListItem.d.ts +6 -0
  16. package/dist/ui/Tabs/TabButton.d.ts +8 -0
  17. package/dist/ui/Tabs/Tabs.css.d.ts +6 -0
  18. package/dist/ui/Tabs/Tabs.d.ts +8 -0
  19. package/dist/ui/Tabs/useTabsContext.d.ts +7 -0
  20. package/dist/ui/Toolbar/Header/Header.css.d.ts +18 -0
  21. package/dist/ui/Toolbar/Header/Header.d.ts +10 -0
  22. package/dist/ui/Toolbar/Header/components/ActionButtons.d.ts +10 -0
  23. package/dist/ui/Toolbar/Header/components/EnvironmentLabel.d.ts +5 -0
  24. package/dist/ui/Toolbar/Header/components/LogoSection.d.ts +1 -0
  25. package/dist/ui/Toolbar/Header/components/SearchSection.d.ts +8 -0
  26. package/dist/ui/Toolbar/Header/components/index.d.ts +4 -0
  27. package/dist/ui/Toolbar/LaunchDarklyToolbar.css.d.ts +12 -0
  28. package/dist/ui/Toolbar/LaunchDarklyToolbar.d.ts +10 -0
  29. package/dist/ui/Toolbar/TabContent/EventsTabContent.css.d.ts +3 -0
  30. package/dist/ui/Toolbar/TabContent/EventsTabContent.d.ts +1 -0
  31. package/dist/ui/Toolbar/TabContent/FlagTabContent.css.d.ts +8 -0
  32. package/dist/ui/Toolbar/TabContent/FlagTabContent.d.ts +1 -0
  33. package/dist/ui/Toolbar/TabContent/SettingsTab.css.d.ts +11 -0
  34. package/dist/ui/Toolbar/TabContent/SettingsTabContent.d.ts +1 -0
  35. package/dist/ui/Toolbar/components/ActionButtonsContainer.css.d.ts +4 -0
  36. package/dist/ui/Toolbar/components/ActionButtonsContainer.d.ts +6 -0
  37. package/dist/ui/Toolbar/components/CircleLogo.d.ts +5 -0
  38. package/dist/ui/Toolbar/components/ConnectionStatus.css.d.ts +4 -0
  39. package/dist/ui/Toolbar/components/ConnectionStatus.d.ts +6 -0
  40. package/dist/ui/Toolbar/components/ErrorMessage.css.d.ts +2 -0
  41. package/dist/ui/Toolbar/components/ErrorMessage.d.ts +5 -0
  42. package/dist/ui/Toolbar/components/ExpandedToolbarContent.d.ts +15 -0
  43. package/dist/ui/Toolbar/components/FlagControls.css.d.ts +11 -0
  44. package/dist/ui/Toolbar/components/FlagControls.d.ts +20 -0
  45. package/dist/ui/Toolbar/components/GenericHelpText.css.d.ts +3 -0
  46. package/dist/ui/Toolbar/components/GenericHelpText.d.ts +6 -0
  47. package/dist/ui/Toolbar/components/IconButton.css.d.ts +4 -0
  48. package/dist/ui/Toolbar/components/IconButton.d.ts +11 -0
  49. package/dist/ui/Toolbar/components/OverrideIndicator.css.d.ts +5 -0
  50. package/dist/ui/Toolbar/components/OverrideIndicator.d.ts +5 -0
  51. package/dist/ui/Toolbar/components/StatusDot.css.d.ts +1 -0
  52. package/dist/ui/Toolbar/components/StatusDot.d.ts +5 -0
  53. package/dist/ui/Toolbar/components/TabContentRenderer.d.ts +7 -0
  54. package/dist/ui/Toolbar/components/icons/ArrowUndoIcon.d.ts +5 -0
  55. package/dist/ui/Toolbar/components/icons/CancelCircleIcon.d.ts +5 -0
  56. package/dist/ui/Toolbar/components/icons/CheckIcon.d.ts +5 -0
  57. package/dist/ui/Toolbar/components/icons/ChevronDownIcon.d.ts +5 -0
  58. package/dist/ui/Toolbar/components/icons/DeleteIcon.d.ts +5 -0
  59. package/dist/ui/Toolbar/components/icons/EditIcon.d.ts +5 -0
  60. package/dist/ui/Toolbar/components/icons/GearIcon.d.ts +5 -0
  61. package/dist/ui/Toolbar/components/icons/Icon.css.d.ts +1 -0
  62. package/dist/ui/Toolbar/components/icons/LaunchDarklyIcon.d.ts +5 -0
  63. package/dist/ui/Toolbar/components/icons/SearchIcon.d.ts +5 -0
  64. package/dist/ui/Toolbar/components/icons/SyncIcon.d.ts +5 -0
  65. package/dist/ui/Toolbar/components/icons/ToggleOffIcon.d.ts +5 -0
  66. package/dist/ui/Toolbar/components/icons/XIcon.d.ts +5 -0
  67. package/dist/ui/Toolbar/components/icons/index.d.ts +11 -0
  68. package/dist/ui/Toolbar/components/index.d.ts +8 -0
  69. package/dist/ui/Toolbar/constants/animations.d.ts +99 -0
  70. package/dist/ui/Toolbar/constants/config.d.ts +3 -0
  71. package/dist/ui/Toolbar/constants/index.d.ts +2 -0
  72. package/dist/ui/Toolbar/context/LaunchDarklyToolbarProvider.d.ts +20 -0
  73. package/dist/ui/Toolbar/context/SearchProvider.d.ts +10 -0
  74. package/dist/ui/Toolbar/hooks/index.d.ts +3 -0
  75. package/dist/ui/Toolbar/hooks/useToolbarAnimations.d.ts +20 -0
  76. package/dist/ui/Toolbar/hooks/useToolbarState.d.ts +22 -0
  77. package/dist/ui/Toolbar/hooks/useToolbarVisibility.d.ts +5 -0
  78. package/dist/ui/Toolbar/types/index.d.ts +1 -0
  79. package/dist/ui/Toolbar/types/toolbar.d.ts +12 -0
  80. package/package.json +100 -0
package/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2022 Catamorphic, Co.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,197 @@
1
+ # LaunchDarkly Toolbar
2
+
3
+ > ⚠️ **Warning:** This package is currently not ready for production use and is considered unsupported. Features, APIs, and behavior may change without notice.
4
+
5
+ A React component that provides a developer-friendly toolbar for interacting with LaunchDarkly during development.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install @launchdarkly/toolbar
11
+ # or
12
+ yarn add @launchdarkly/toolbar
13
+ # or
14
+ pnpm add @launchdarkly/toolbar
15
+ ```
16
+
17
+ 1. **Import the component and styles:**
18
+
19
+ ```tsx
20
+ import { LaunchDarklyToolbar } from '@launchdarkly/toolbar';
21
+ ```
22
+
23
+ 2. **Add the toolbar to your app:**
24
+
25
+ ```tsx
26
+ function App() {
27
+ return (
28
+ <div>
29
+ {/* Your app content */}
30
+ <h1>My App</h1>
31
+
32
+ {/* LaunchDarkly Toolbar */}
33
+ <LaunchDarklyToolbar devServerUrl="http://localhost:8765" position="right" />
34
+ </div>
35
+ );
36
+ }
37
+ ```
38
+
39
+ 3. **Start your LaunchDarkly dev server:**
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
57
+
58
+ ```tsx
59
+ import { LaunchDarklyToolbar } from '@launchdarkly/toolbar';
60
+
61
+ function App() {
62
+ return (
63
+ <>
64
+ <main>
65
+ <h1>My Application</h1>
66
+ {/* Your app content */}
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
+ </>
104
+ );
105
+ }
106
+ ```
107
+
108
+ ## How It Works
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
116
+
117
+ ## Toolbar Visibility Control
118
+
119
+ The toolbar includes built-in visibility controls that allow developers to easily show/hide the toolbar during development. When the toolbar loads, it automatically exposes a global API on the browser's window object.
120
+
121
+ ### Global API
122
+
123
+ The toolbar provides a `window.ldToolbar` API with the following methods:
124
+
125
+ ```javascript
126
+ // Enable the toolbar (removes it from localStorage and shows the toolbar)
127
+ window.ldToolbar.enable();
128
+
129
+ // Disable the toolbar (saves preference to localStorage and hides the toolbar)
130
+ window.ldToolbar.disable();
131
+
132
+ // Toggle the toolbar visibility
133
+ window.ldToolbar.toggle();
134
+
135
+ // Check current status (returns true if enabled, false if disabled)
136
+ window.ldToolbar.status();
137
+ ```
138
+
139
+ ### Console Information
140
+
141
+ When the toolbar loads, you'll see helpful console output showing the available commands:
142
+
143
+ ```
144
+ 🔧 LaunchDarkly toolbar controls available:
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
149
+ ```
150
+
151
+ ### Persistent State
152
+
153
+ The toolbar's visibility state is automatically saved to localStorage and persists across browser sessions. The state is also synchronized across multiple tabs of the same application.
154
+
155
+ ### Usage Examples
156
+
157
+ ```javascript
158
+ // Hide the toolbar for focused development
159
+ window.ldToolbar.disable();
160
+ // Console: ✅ LaunchDarkly toolbar disabled.
161
+
162
+ // Show the toolbar when you need it
163
+ window.ldToolbar.enable();
164
+ // Console: ✅ LaunchDarkly toolbar enabled.
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
170
+
171
+ // Quick toggle
172
+ window.ldToolbar.toggle();
173
+ ```
174
+
175
+ ## Development Server Setup
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 subs-project --cors-enabled true
181
+ ```
182
+
183
+ ## TypeScript
184
+
185
+ The package includes complete TypeScript definitions. No additional `@types` packages needed.
186
+
187
+ ```tsx
188
+ 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
+ ```
196
+
197
+ Built with ❤️ for the LaunchDarkly developer community.
@@ -0,0 +1,3 @@
1
+ import './globals.css';
2
+ export { LaunchDarklyToolbar } from './ui/Toolbar/LaunchDarklyToolbar';
3
+ export type { LaunchDarklyToolbarProps } from './ui/Toolbar/LaunchDarklyToolbar';