@harborclient/sdk 0.6.3 → 0.6.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 (86) hide show
  1. package/dist/components/BusyIndicator/index.d.ts +3 -2
  2. package/dist/components/BusyIndicator/index.d.ts.map +1 -1
  3. package/dist/components/BusyIndicator/index.js +11 -3
  4. package/dist/components/Button/index.d.ts +23 -8
  5. package/dist/components/Button/index.d.ts.map +1 -1
  6. package/dist/components/Button/index.js +6 -4
  7. package/dist/components/CodeEditor/index.d.ts +9 -1
  8. package/dist/components/CodeEditor/index.d.ts.map +1 -1
  9. package/dist/components/CodeEditor/index.js +186 -62
  10. package/dist/components/FieldError/index.d.ts.map +1 -1
  11. package/dist/components/FieldError/index.js +1 -1
  12. package/dist/components/FormDataEditor/index.d.ts.map +1 -1
  13. package/dist/components/FormDataEditor/index.js +10 -38
  14. package/dist/components/FormDataEditor/utils.d.ts +19 -0
  15. package/dist/components/FormDataEditor/utils.d.ts.map +1 -0
  16. package/dist/components/FormDataEditor/utils.js +28 -0
  17. package/dist/components/FormGroup/index.d.ts +6 -1
  18. package/dist/components/FormGroup/index.d.ts.map +1 -1
  19. package/dist/components/FormGroup/index.js +25 -31
  20. package/dist/components/KeyValueEditor/index.d.ts.map +1 -1
  21. package/dist/components/KeyValueEditor/index.js +2 -3
  22. package/dist/components/Modal/ModalFormLayout.d.ts.map +1 -1
  23. package/dist/components/Modal/ModalFormLayout.js +2 -1
  24. package/dist/components/Modal/ModalHeader.d.ts +5 -1
  25. package/dist/components/Modal/ModalHeader.d.ts.map +1 -1
  26. package/dist/components/Modal/ModalHeader.js +2 -2
  27. package/dist/components/Modal/index.d.ts.map +1 -1
  28. package/dist/components/Modal/index.js +4 -2
  29. package/dist/components/OverlayCloseButton/index.d.ts.map +1 -1
  30. package/dist/components/OverlayCloseButton/index.js +1 -2
  31. package/dist/components/Page/index.d.ts +46 -0
  32. package/dist/components/Page/index.d.ts.map +1 -0
  33. package/dist/components/Page/index.js +18 -0
  34. package/dist/components/PageSidebar/index.d.ts +45 -0
  35. package/dist/components/PageSidebar/index.d.ts.map +1 -0
  36. package/dist/components/PageSidebar/index.js +24 -0
  37. package/dist/components/Resizable/Resizable.d.ts.map +1 -1
  38. package/dist/components/Resizable/Resizable.js +1 -1
  39. package/dist/components/Resizable/ResizeHandle.js +2 -2
  40. package/dist/components/ResourceList/index.d.ts +11 -1
  41. package/dist/components/ResourceList/index.d.ts.map +1 -1
  42. package/dist/components/ResourceList/index.js +4 -2
  43. package/dist/components/RowActionsMenu/index.d.ts.map +1 -1
  44. package/dist/components/RowActionsMenu/index.js +150 -11
  45. package/dist/components/SegmentedTabs/index.d.ts.map +1 -1
  46. package/dist/components/SegmentedTabs/index.js +2 -2
  47. package/dist/components/SidebarLayout/index.d.ts +22 -0
  48. package/dist/components/SidebarLayout/index.d.ts.map +1 -0
  49. package/dist/components/SidebarLayout/index.js +11 -0
  50. package/dist/components/TabCloseButton/index.d.ts +1 -1
  51. package/dist/components/TabCloseButton/index.js +2 -2
  52. package/dist/components/Table/index.d.ts +103 -0
  53. package/dist/components/Table/index.d.ts.map +1 -0
  54. package/dist/components/Table/index.js +99 -0
  55. package/dist/components/VariableInput/index.d.ts.map +1 -1
  56. package/dist/components/VariableInput/index.js +84 -10
  57. package/dist/components/VariableTable/index.d.ts.map +1 -1
  58. package/dist/components/VariableTable/index.js +2 -2
  59. package/dist/components/enhanceControl.d.ts +28 -0
  60. package/dist/components/enhanceControl.d.ts.map +1 -0
  61. package/dist/components/enhanceControl.js +84 -0
  62. package/dist/components/enhanceControl.test.d.ts +2 -0
  63. package/dist/components/enhanceControl.test.d.ts.map +1 -0
  64. package/dist/components/enhanceControl.test.js +83 -0
  65. package/dist/components/index.d.ts +6 -1
  66. package/dist/components/index.d.ts.map +1 -1
  67. package/dist/components/index.js +4 -1
  68. package/dist/components/useDialogFocus.d.ts +3 -2
  69. package/dist/components/useDialogFocus.d.ts.map +1 -1
  70. package/dist/components/useDialogFocus.js +61 -4
  71. package/dist/components/utils.d.ts +25 -0
  72. package/dist/components/utils.d.ts.map +1 -1
  73. package/dist/components/utils.js +24 -0
  74. package/dist/components/utils.test.js +18 -1
  75. package/dist/types.d.ts.map +1 -1
  76. package/dist/variables/index.d.ts +1 -1
  77. package/dist/variables/index.d.ts.map +1 -1
  78. package/dist/variables/index.js +1 -1
  79. package/dist/variables/tokens.d.ts +31 -0
  80. package/dist/variables/tokens.d.ts.map +1 -1
  81. package/dist/variables/tokens.js +38 -1
  82. package/dist/variables/tokens.test.js +46 -1
  83. package/package.json +1 -1
  84. package/dist/components/OverlayPage/index.d.ts +0 -40
  85. package/dist/components/OverlayPage/index.d.ts.map +0 -1
  86. package/dist/components/OverlayPage/index.js +0 -18
@@ -22,6 +22,37 @@ export declare const VARIABLE_TOKEN_PATTERN: RegExp;
22
22
  * @returns Ordered tokens for rendering or further processing.
23
23
  */
24
24
  export declare function tokenizeVariables(text: string): VariableToken[];
25
+ /**
26
+ * A {{variable}} token located at a character offset in source text.
27
+ */
28
+ export interface VariableTokenMatch {
29
+ key: string;
30
+ start: number;
31
+ end: number;
32
+ }
33
+ /**
34
+ * Returns the variable token containing the given character offset, if any.
35
+ *
36
+ * @param text - Text containing variable placeholders.
37
+ * @param offset - Zero-based character offset from the start of `text`.
38
+ * @returns Matching token range and key, or null when offset is outside a token.
39
+ */
40
+ export declare function getVariableTokenAtOffset(text: string, offset: number): VariableTokenMatch | null;
41
+ /**
42
+ * Resolved tooltip text for a variable key.
43
+ */
44
+ export interface VariableTooltipContent {
45
+ text: string;
46
+ muted: boolean;
47
+ }
48
+ /**
49
+ * Resolves display text for a variable tooltip.
50
+ *
51
+ * @param key - Variable name from a {{key}} placeholder.
52
+ * @param variables - Collection-scoped variables.
53
+ * @returns Tooltip body text and whether it should use muted styling.
54
+ */
55
+ export declare function getVariableTooltipContent(key: string, variables: Variable[]): VariableTooltipContent;
25
56
  /**
26
57
  * Resolves a single variable key against collection variables.
27
58
  *
@@ -1 +1 @@
1
- {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/variables/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG5C;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,WAAW,CAAC;AAE5C;;GAEG;AACH,eAAO,MAAM,sBAAsB,QAGlC,CAAC;AAgBF;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CAmB/D;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,MAAM,GAAG,SAAS,CAEtF;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,MAAM,CAY/E"}
1
+ {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/variables/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG5C;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,WAAW,CAAC;AAE5C;;GAEG;AACH,eAAO,MAAM,sBAAsB,QAGlC,CAAC;AAgBF;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CAmB/D;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,kBAAkB,GAAG,IAAI,CAahG;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAChB;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,QAAQ,EAAE,GACpB,sBAAsB,CAYxB;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,MAAM,GAAG,SAAS,CAEtF;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,MAAM,CAY/E"}
@@ -1,4 +1,4 @@
1
- import { resolveDynamicVariable } from './dynamic.js';
1
+ import { getDynamicVariableDescription, resolveDynamicVariable } from './dynamic.js';
2
2
  /**
3
3
  * Allowed characters inside a `{{variable}}` token name (excluding braces).
4
4
  * Includes `$` so Postman-style dynamic names such as `$randomUUID` are recognized.
@@ -42,6 +42,43 @@ export function tokenizeVariables(text) {
42
42
  }
43
43
  return tokens;
44
44
  }
45
+ /**
46
+ * Returns the variable token containing the given character offset, if any.
47
+ *
48
+ * @param text - Text containing variable placeholders.
49
+ * @param offset - Zero-based character offset from the start of `text`.
50
+ * @returns Matching token range and key, or null when offset is outside a token.
51
+ */
52
+ export function getVariableTokenAtOffset(text, offset) {
53
+ let position = 0;
54
+ for (const token of tokenizeVariables(text)) {
55
+ const start = position;
56
+ const end = position + token.text.length;
57
+ if (token.key && offset >= start && offset <= end) {
58
+ return { key: token.key, start, end };
59
+ }
60
+ position = end;
61
+ }
62
+ return null;
63
+ }
64
+ /**
65
+ * Resolves display text for a variable tooltip.
66
+ *
67
+ * @param key - Variable name from a {{key}} placeholder.
68
+ * @param variables - Collection-scoped variables.
69
+ * @returns Tooltip body text and whether it should use muted styling.
70
+ */
71
+ export function getVariableTooltipContent(key, variables) {
72
+ const value = resolveVariable(key, variables);
73
+ if (value !== undefined) {
74
+ return { text: value, muted: false };
75
+ }
76
+ const dynamicDescription = getDynamicVariableDescription(key);
77
+ if (dynamicDescription) {
78
+ return { text: `Dynamic: ${dynamicDescription}`, muted: true };
79
+ }
80
+ return { text: 'Not defined', muted: true };
81
+ }
45
82
  /**
46
83
  * Resolves a single variable key against collection variables.
47
84
  *
@@ -1,5 +1,5 @@
1
1
  import { describe, expect, it } from '@jest/globals';
2
- import { resolveVariable, substituteVariables, tokenizeVariables } from './tokens.js';
2
+ import { getVariableTokenAtOffset, getVariableTooltipContent, resolveVariable, substituteVariables, tokenizeVariables } from './tokens.js';
3
3
  /**
4
4
  * Builds a test variable row.
5
5
  *
@@ -113,3 +113,48 @@ describe('resolveVariable', () => {
113
113
  expect(resolveVariable('missing', [variable('host', 'api.example.com')])).toBeUndefined();
114
114
  });
115
115
  });
116
+ describe('getVariableTokenAtOffset', () => {
117
+ const text = 'https://{{host}}/api/{{version}}';
118
+ it('returns the token when offset is inside a variable placeholder', () => {
119
+ expect(getVariableTokenAtOffset(text, 10)).toEqual({
120
+ key: 'host',
121
+ start: 8,
122
+ end: 16
123
+ });
124
+ });
125
+ it('returns null when offset is outside any token', () => {
126
+ expect(getVariableTokenAtOffset(text, 0)).toBeNull();
127
+ expect(getVariableTokenAtOffset(text, 7)).toBeNull();
128
+ });
129
+ it('matches at token start and end boundaries', () => {
130
+ expect(getVariableTokenAtOffset('{{host}}', 0)?.key).toBe('host');
131
+ expect(getVariableTokenAtOffset('{{host}}', 8)?.key).toBe('host');
132
+ });
133
+ it('matches tokens with whitespace around the key', () => {
134
+ expect(getVariableTokenAtOffset('https://{{ host }}/users', 10)).toEqual({
135
+ key: 'host',
136
+ start: 8,
137
+ end: 18
138
+ });
139
+ });
140
+ });
141
+ describe('getVariableTooltipContent', () => {
142
+ it('returns resolved static value without muted styling', () => {
143
+ expect(getVariableTooltipContent('host', [variable('host', 'api.example.com')])).toEqual({
144
+ text: 'api.example.com',
145
+ muted: false
146
+ });
147
+ });
148
+ it('returns dynamic description for registered dynamic variables', () => {
149
+ expect(getVariableTooltipContent('$guid', [])).toEqual({
150
+ text: 'Dynamic: A uuid-v4 style guid',
151
+ muted: true
152
+ });
153
+ });
154
+ it('returns Not defined for unknown keys', () => {
155
+ expect(getVariableTooltipContent('missing', [variable('host', 'api.example.com')])).toEqual({
156
+ text: 'Not defined',
157
+ muted: true
158
+ });
159
+ });
160
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harborclient/sdk",
3
- "version": "0.6.3",
3
+ "version": "0.6.6",
4
4
  "description": "TypeScript SDK for HarborClient plugin development.",
5
5
  "keywords": [
6
6
  "harborclient",
@@ -1,40 +0,0 @@
1
- import type { JSX, ReactNode } from 'react';
2
- interface Props {
3
- /**
4
- * Page title shown in the overlay header.
5
- */
6
- title: ReactNode;
7
- /**
8
- * Called when the user closes the overlay.
9
- */
10
- onClose: () => void;
11
- /**
12
- * Scrollable page body content.
13
- */
14
- children: ReactNode;
15
- /**
16
- * Optional footer actions such as Save/Cancel rows.
17
- */
18
- footer?: ReactNode;
19
- /**
20
- * Accessible name for the header close button.
21
- */
22
- closeLabel?: string;
23
- /**
24
- * Additional Tailwind classes merged onto the outer scroll container.
25
- */
26
- className?: string;
27
- }
28
- /**
29
- * Full-page scrollable overlay shell shared by environment, collection, and plugin views.
30
- *
31
- * @param title - Header title text or element.
32
- * @param onClose - Close handler for the header button.
33
- * @param children - Main page content.
34
- * @param footer - Optional trailing action row below the body.
35
- * @param closeLabel - Accessible close button label.
36
- * @param className - Extra classes on the outer container.
37
- */
38
- export declare function OverlayPage({ title, onClose, children, footer, closeLabel, className }: Props): JSX.Element;
39
- export {};
40
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/OverlayPage/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAG5C,UAAU,KAAK;IACb;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC;IAEjB;;OAEG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;IAEpB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,OAAO,EACP,QAAQ,EACR,MAAM,EACN,UAAU,EACV,SAAS,EACV,EAAE,KAAK,GAAG,GAAG,CAAC,OAAO,CAiBrB"}
@@ -1,18 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "@harborclient/sdk/jsx-runtime";
2
- import { OverlayCloseButton } from '../OverlayCloseButton/index.js';
3
- /**
4
- * Full-page scrollable overlay shell shared by environment, collection, and plugin views.
5
- *
6
- * @param title - Header title text or element.
7
- * @param onClose - Close handler for the header button.
8
- * @param children - Main page content.
9
- * @param footer - Optional trailing action row below the body.
10
- * @param closeLabel - Accessible close button label.
11
- * @param className - Extra classes on the outer container.
12
- */
13
- export function OverlayPage({ title, onClose, children, footer, closeLabel, className }) {
14
- const outer = className
15
- ? `flex min-h-0 flex-1 flex-col overflow-y-auto p-6 ${className}`
16
- : 'flex min-h-0 flex-1 flex-col overflow-y-auto p-6';
17
- return (_jsx("div", { className: outer, children: _jsxs("div", { className: "mx-auto w-full", children: [_jsxs("div", { className: "mb-6 flex items-center justify-between gap-4", children: [_jsx("h1", { className: "m-0 text-[15px] font-semibold text-text", children: title }), _jsx(OverlayCloseButton, { label: closeLabel, onClose: onClose })] }), children, footer] }) }));
18
- }