@digi-frontend/dgate-api-documentation 1.4.97 → 2.0.1-test.0

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 (36) hide show
  1. package/README.md +333 -0
  2. package/dist/index.cjs +1009 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.d.cts +793 -0
  5. package/dist/index.d.cts.map +1 -0
  6. package/dist/index.d.ts +792 -8
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +977 -43
  9. package/dist/index.js.map +1 -1
  10. package/package.json +53 -70
  11. package/dist/index.css +0 -12
  12. package/dist/index.css.map +0 -1
  13. package/dist/index.d.mts +0 -9
  14. package/dist/index.mjs +0 -25
  15. package/dist/index.mjs.map +0 -1
  16. package/src/components/Chips/style.scss +0 -147
  17. package/src/components/InfoForm/InfoForm.module.scss +0 -165
  18. package/src/components/JsonInput/style.module.scss +0 -133
  19. package/src/components/LivePreview/LivePreview.module.scss +0 -181
  20. package/src/components/MethodAccordion/MethodAccordion.module.scss +0 -399
  21. package/src/components/SectionHead/SectionHead.scss +0 -29
  22. package/src/components/SimpleLabelValue/style.scss +0 -30
  23. package/src/components/Tooltip/Tooltip.scss +0 -133
  24. package/src/components/_global.scss +0 -338
  25. package/src/components/dialog/style.scss +0 -188
  26. package/src/components/table/style.scss +0 -223
  27. package/src/layout/docsComponents/Codebox/style.module.scss +0 -43
  28. package/src/layout/docsComponents/DocsAside/style.module.scss +0 -113
  29. package/src/layout/docsComponents/DocsContent/EndpointPage/style.scss +0 -382
  30. package/src/layout/docsComponents/DocsContent/OverviewPage/style.scss +0 -332
  31. package/src/layout/docsComponents/DocsContent/style.scss +0 -0
  32. package/src/layout/docsComponents/DocsHeader/DocsHeader.module.scss +0 -297
  33. package/src/layout/docsComponents/DocsSideMenuTree/style.scss +0 -202
  34. package/src/layout/docsComponents/index.scss +0 -49
  35. package/src/test.scss +0 -3
  36. package/src/test2.module.scss +0 -5
package/README.md ADDED
@@ -0,0 +1,333 @@
1
+ # DGate API Documentation View
2
+
3
+ A modern, type-safe React component library for rendering and managing API documentation interfaces.
4
+ Built with Zustand for state management and designed for scalability and developer experience.
5
+
6
+ ## Features
7
+
8
+ - **🎯 Type-Safe State Management**: Built with Zustand and TypeScript for reliable state handling
9
+ - **🏗️ Modular Architecture**: Separation of concerns between view and editor states
10
+ - **⚡ Performance Optimized**: Selective subscriptions to minimize unnecessary re-renders
11
+ - **🛠️ Developer Experience**: Comprehensive TypeScript support with excellent IDE integration
12
+ - **🎨 Theme Support**: Built-in light/dark theme switching capabilities
13
+ - **📝 Content Editing**: Integrated editor state management for content modification workflows
14
+
15
+ ## Quick Start
16
+
17
+ ### Installation
18
+
19
+ ```bash
20
+ pnpm install
21
+ ```
22
+
23
+ ### Development
24
+
25
+ ```bash
26
+ pnpm run build
27
+ ```
28
+
29
+ ### Usage Example
30
+
31
+ ```typescript
32
+ import { useStore } from './store'
33
+
34
+ function MyComponent() {
35
+ // State access
36
+ const theme = useStore((state) => state.view.theme)
37
+ const isEditing = useStore((state) => state.editor.isEditing)
38
+
39
+ // Actions
40
+ const setTheme = useStore((state) => state.setTheme)
41
+ const startEdit = useStore((state) => state.startEdit)
42
+
43
+ return (
44
+ <div className={`theme-${theme}`}>
45
+ <button onClick={() => setTheme('dark')}>Switch Theme</button>
46
+ <button onClick={() => startEdit('content')}>Edit Content</button>
47
+ </div>
48
+ )
49
+ }
50
+ ```
51
+
52
+ ## Architecture
53
+
54
+ ### Store Organization
55
+
56
+ The application state is organized into two primary domains:
57
+
58
+ - **View State**: UI preferences, display data, and user interface state
59
+ - **Editor State**: Content editing, form management, and modification tracking
60
+
61
+ ### Key Components
62
+
63
+ - **`src/store/`**: Centralized state management with Zustand
64
+ - **`src/store/README.md`**: Complete usage guide with examples
65
+ - **`src/types/`**: TypeScript definitions and interfaces
66
+
67
+ ## State Management Patterns
68
+
69
+ ### Direct State Access
70
+
71
+ ```typescript
72
+ const count = useStore((state) => state.view.count)
73
+ ```
74
+
75
+ ### Action Dispatching
76
+
77
+ ```typescript
78
+ const increment = useStore((state) => state.increment)
79
+ increment()
80
+ ```
81
+
82
+ ### Computed Values
83
+
84
+ ```typescript
85
+ const totalItems = useStore((state) => state.getItemCount())
86
+ ```
87
+
88
+ ## Development Guidelines
89
+
90
+ ### Adding New Features
91
+
92
+ 1. Define interfaces in the store types
93
+ 2. Add initial state values
94
+ 3. Implement actions with proper typing
95
+ 4. Create computed getters as needed
96
+ 5. See `src/store/README.md` for detailed examples
97
+
98
+ ### Best Practices
99
+
100
+ - Use TypeScript strictly for all implementations
101
+ - Leverage Immer for immutable state updates
102
+ - Organize actions by domain (view vs editor)
103
+ - Implement computed values for derived state
104
+ - Use selective subscriptions for performance
105
+
106
+ ## Technical Stack
107
+
108
+ - **Zustand**: Lightweight state management
109
+ - **TypeScript**: Type safety and developer experience
110
+ - **Immer**: Immutable state updates
111
+ - **React**: UI component framework
112
+ - **DevTools**: Debugging and state inspection
113
+
114
+ ## Local Development Setup
115
+
116
+ ### Linking this package locally with pnpm
117
+
118
+ This guide explains how to link **`@digi-frontend/dgate-api-documentation`** with a separate React
119
+ app for live development.
120
+
121
+ ---
122
+
123
+ #### Folder layout
124
+
125
+ Place the app and this library **side-by-side** (for example, on Desktop):
126
+
127
+ ```
128
+ Desktop/
129
+ dgate-api-documentation/ ← this repo (the library)
130
+ your-react-app/ ← the consuming app
131
+ ```
132
+
133
+ ---
134
+
135
+ #### 1) In the app: install peer dependencies
136
+
137
+ The app must provide the library's required peers:
138
+
139
+ ```bash
140
+ cd .\your-next-app
141
+ pnpm add react react-dom antd @ant-design/cssinjs
142
+ ```
143
+
144
+ > In the **library**, keep `react`, `react-dom`, `antd`, and `@ant-design/cssinjs` in
145
+ > **peerDependencies** (and optionally in `devDependencies` for local lib testing).
146
+ > Do **not** put them in `dependencies` in the lib.
147
+
148
+ ---
149
+
150
+ #### 2) In the app: link the library by relative path
151
+
152
+ Remove any previous install and add the link:
153
+
154
+ ```bash
155
+ pnpm remove @digi-frontend/dgate-api-documentation
156
+ pnpm add @digi-frontend/dgate-api-documentation@link:../dgate-api-documentation
157
+ ```
158
+
159
+ If the path has spaces, quote it:
160
+
161
+ ```bash
162
+ pnpm add @digi-frontend/dgate-api-documentation@link:"../dgate-api-documentation"
163
+ ```
164
+
165
+ ---
166
+
167
+ #### 3) In the app: Next.js config (webpack-only)
168
+
169
+ Use webpack in dev and let Next transpile the linked package.
170
+
171
+ **`next.config.ts` (in the app):**
172
+
173
+ ```ts
174
+ import type { NextConfig } from 'next'
175
+
176
+ const config: NextConfig = {
177
+ // Transpile the linked library if it ships TS/ESM source
178
+ transpilePackages: ['@digi-frontend/dgate-api-documentation'],
179
+
180
+ webpack(config) {
181
+ // Follow pnpm symlinks so HMR works across repos
182
+ config.resolve.symlinks = true
183
+ return config
184
+ },
185
+
186
+ eslint: { ignoreDuringBuilds: true },
187
+ }
188
+
189
+ export default config
190
+ ```
191
+
192
+ **Start dev (webpack):**
193
+
194
+ ```bash
195
+ pnpm dev
196
+ ```
197
+
198
+ > Don't pass `--turbo`/`--turbopack`. Turbopack does not follow out-of-tree links.
199
+
200
+ ---
201
+
202
+ #### 4) In the library: start development mode
203
+
204
+ To enable live updates, run the development server in the **library** package:
205
+
206
+ ```bash
207
+ cd ../dgate-api-documentation
208
+ pnpm dev
209
+ ```
210
+
211
+ This will start the library in watch mode, allowing changes to be reflected immediately in the
212
+ consuming app.
213
+
214
+ ---
215
+
216
+ #### 5) Verify the link
217
+
218
+ From the **app** folder:
219
+
220
+ ```bash
221
+ # Show that the dependency is linked
222
+ pnpm list @digi-frontend/dgate-api-documentation
223
+ ```
224
+
225
+ ```bash
226
+ # Show the symlink target path on disk
227
+ (Get-Item ./node_modules/@digi-frontend/dgate-api-documentation).Target
228
+ ```
229
+
230
+ Optionally resolve the entry file:
231
+
232
+ ```bash
233
+ # CJS resolution (works if the package exposes a CJS entry)
234
+ node -p "require.resolve('@digi-frontend/dgate-api-documentation')"
235
+ ```
236
+
237
+ If your package is ESM-only:
238
+
239
+ ```bash
240
+ node --input-type=module -p "import.meta.resolve('@digi-frontend/dgate-api-documentation')"
241
+ ```
242
+
243
+ > If `require.resolve('@pkg/package.json')` fails with `ERR_PACKAGE_PATH_NOT_EXPORTED`,
244
+ > that's normal unless you explicitly export `./package.json` in the lib's `exports`.
245
+
246
+ ---
247
+
248
+ #### 6) Troubleshooting
249
+
250
+ **Fast Refresh performs full reload**
251
+ A module from the lib is likely imported both inside and _outside_ the React render tree.
252
+ Split React components/hooks and non-React utilities into separate modules/entries (e.g.,
253
+ `@pkg/react` vs `@pkg/core`).
254
+
255
+ **"Invalid hook call" (duplicate React)**
256
+
257
+ - Ensure the lib keeps `react` and `react-dom` in **peerDependencies** (not `dependencies`).
258
+ - The app must install compatible versions.
259
+ - If needed, hard-dedupe to the app's React in `next.config.ts`:
260
+
261
+ ```ts
262
+ webpack(config) {
263
+ config.resolve.alias = {
264
+ ...(config.resolve.alias ?? {}),
265
+ react: require('path').resolve(__dirname, 'node_modules/react'),
266
+ 'react-dom': require('path').resolve(__dirname, 'node_modules/react-dom'),
267
+ }
268
+ return config
269
+ }
270
+ ```
271
+
272
+ **File watching on Windows is flaky**
273
+ Enable polling temporarily:
274
+
275
+ ```bash
276
+ $env:WATCHPACK_POLLING="true"; pnpm dev
277
+ ```
278
+
279
+ **Avoid `pnpm link --global`**
280
+ Global links resolve peers relative to the lib folder and can cause missing/duplicate React/AntD in
281
+ the app.
282
+
283
+ ---
284
+
285
+ #### 7) Unlink / switch back to registry
286
+
287
+ From the **app** folder:
288
+
289
+ ```bash
290
+ pnpm remove @digi-frontend/dgate-api-documentation
291
+ pnpm add @digi-frontend/dgate-api-documentation # install from registry again
292
+ ```
293
+
294
+ ---
295
+
296
+ #### 8) Alternatives (if you don't want a live symlink)
297
+
298
+ **Local tarball**
299
+
300
+ ```bash
301
+ # in the lib
302
+ pnpm pack # creates a .tgz
303
+ # in the app
304
+ pnpm add ../dgate-api-documentation/@digi-frontend/dgate-api-documentation-x.y.z.tgz
305
+ ```
306
+
307
+ **`file:` protocol (no live updates)**
308
+
309
+ ```json
310
+ {
311
+ "dependencies": {
312
+ "@digi-frontend/dgate-api-documentation": "file:../dgate-api-documentation"
313
+ }
314
+ }
315
+ ```
316
+
317
+ ```bash
318
+ pnpm install
319
+ ```
320
+
321
+ ---
322
+
323
+ ### Summary
324
+
325
+ - Link with:
326
+
327
+ ```bash
328
+ pnpm add @digi-frontend/dgate-api-documentation@link:../dgate-api-documentation
329
+ ```
330
+
331
+ - Run **webpack dev** (`pnpm dev`, no Turbopack).
332
+ - Keep peers in the **app**, not as `dependencies` in the lib.
333
+ - Verify with `pnpm list` and `Get-Item … .Target`.