@workbench-kit/shell-react 0.0.2-prototype.0.2.10 → 0.0.2-prototype.0.2.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workbench-kit/shell-react",
3
- "version": "0.0.2-prototype.0.2.10",
3
+ "version": "0.0.2-prototype.0.2.11",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {
@@ -21,13 +21,13 @@
21
21
  "@xyflow/react": "^12.11.2",
22
22
  "jsonata": "^2.2.0",
23
23
  "react-table-mapping": "^1.0.3",
24
- "@workbench-kit/platform": "0.0.2-prototype.0.2.10",
25
- "@workbench-kit/tokens": "0.0.2-prototype.0.2.10",
26
- "@workbench-kit/workbench-config": "0.0.2-prototype.0.2.10",
27
- "@workbench-kit/react": "0.0.2-prototype.0.2.10",
28
- "@workbench-kit/field-remap": "0.0.2-prototype.0.2.10",
29
- "@workbench-kit/workbench-core": "0.0.2-prototype.0.2.10",
30
- "@workbench-kit/workspace": "0.0.2-prototype.0.2.10"
24
+ "@workbench-kit/platform": "0.0.2-prototype.0.2.11",
25
+ "@workbench-kit/react": "0.0.2-prototype.0.2.11",
26
+ "@workbench-kit/tokens": "0.0.2-prototype.0.2.11",
27
+ "@workbench-kit/workbench-config": "0.0.2-prototype.0.2.11",
28
+ "@workbench-kit/workspace": "0.0.2-prototype.0.2.11",
29
+ "@workbench-kit/field-remap": "0.0.2-prototype.0.2.11",
30
+ "@workbench-kit/workbench-core": "0.0.2-prototype.0.2.11"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "react": "^19.0.0",
@@ -9,6 +9,8 @@ import {
9
9
  type WorkbenchStorageWriter,
10
10
  } from '@workbench-kit/workbench-core';
11
11
 
12
+ import { isRecord } from '../is-record.js';
13
+
12
14
  export const DEFAULT_WORKBENCH_EDITOR_STATE_STORAGE_KEY = 'workbench-kit/.workbench/editors';
13
15
 
14
16
  export function isWorkbenchEditorStatePersistenceAvailable(): boolean {
@@ -176,7 +178,3 @@ function cloneEditorLayoutForStorage(layout: EditorLayoutNode): EditorLayoutNode
176
178
  children: layout.children.map(cloneEditorLayoutForStorage),
177
179
  };
178
180
  }
179
-
180
- function isRecord(value: unknown): value is Record<string, unknown> {
181
- return typeof value === 'object' && value !== null;
182
- }
@@ -19,6 +19,7 @@ import type {
19
19
  EditorDocumentViewRenderContext,
20
20
  } from '@workbench-kit/workbench-core';
21
21
 
22
+ import { isRecord } from '../is-record.js';
22
23
  import { replaceJsonValueAtPath, type JsonFormPath } from '../jdw/json-form-source-patch.js';
23
24
 
24
25
  type JsonPath = JsonFormPath;
@@ -280,7 +281,7 @@ function JsonValueFormField({
280
281
  );
281
282
  }
282
283
 
283
- if (isJsonRecord(value)) {
284
+ if (isRecord(value)) {
284
285
  const entries = Object.entries(value);
285
286
 
286
287
  return (
@@ -433,10 +434,6 @@ function parseJsonObject(content: string): Record<string, unknown> | null {
433
434
  }
434
435
  }
435
436
 
436
- function isJsonRecord(value: unknown): value is Record<string, unknown> {
437
- return typeof value === 'object' && value !== null && !Array.isArray(value);
438
- }
439
-
440
437
  function isJdwWidgetJson(content: string): boolean {
441
438
  const parsed = parseJsonWidgetData(content);
442
439
  return parsed.value !== null;
@@ -482,7 +479,7 @@ function getJsonPathValue(value: unknown, path: JsonPath): unknown {
482
479
  continue;
483
480
  }
484
481
 
485
- if (isJsonRecord(cursor) && typeof segment === 'string') {
482
+ if (isRecord(cursor) && typeof segment === 'string') {
486
483
  cursor = cursor[segment];
487
484
  continue;
488
485
  }
@@ -0,0 +1,4 @@
1
+ /** Package-internal plain-object guard (not a public export). */
2
+ export function isRecord(value: unknown): value is Record<string, unknown> {
3
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
4
+ }
@@ -1,3 +1,5 @@
1
+ import { isRecord } from '../is-record.js';
2
+
1
3
  export type JsonFormPath = readonly (string | number)[];
2
4
 
3
5
  export interface JsonTextRange {
@@ -49,7 +51,7 @@ function updateJsonPathValue(value: unknown, path: JsonFormPath, nextValue: unkn
49
51
  return nextArray;
50
52
  }
51
53
 
52
- if (isJsonRecord(value) && typeof head === 'string') {
54
+ if (isRecord(value) && typeof head === 'string') {
53
55
  return {
54
56
  ...value,
55
57
  [head]: updateJsonPathValue(value[head], tail, nextValue),
@@ -59,10 +61,6 @@ function updateJsonPathValue(value: unknown, path: JsonFormPath, nextValue: unkn
59
61
  return value;
60
62
  }
61
63
 
62
- function isJsonRecord(value: unknown): value is Record<string, unknown> {
63
- return typeof value === 'object' && value !== null && !Array.isArray(value);
64
- }
65
-
66
64
  export function findJsonValueRangeAtPath(source: string, path: JsonFormPath): JsonTextRange | null {
67
65
  const start = skipWhitespace(source, 0);
68
66
  if (start >= source.length) {
@@ -23,6 +23,7 @@ import {
23
23
  } from '@workbench-kit/workbench-core';
24
24
  import type { PreferenceScope } from '@workbench-kit/workbench-config';
25
25
 
26
+ import { isRecord } from '../is-record.js';
26
27
  import { useWorkbench } from './provider.js';
27
28
  import { WORKBENCH_PREFERENCE_SCOPES } from './settings-constants.js';
28
29
 
@@ -593,7 +594,3 @@ function titleFromExtensionId(extensionId: string): string {
593
594
  function slugId(value: string): string {
594
595
  return value.toLowerCase().replace(/[^a-z0-9_-]+/g, '-');
595
596
  }
596
-
597
- function isRecord(value: unknown): value is Record<string, unknown> {
598
- return typeof value === 'object' && value !== null && !Array.isArray(value);
599
- }