@lvce-editor/ports-view 0.6.2 → 0.6.3

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.
@@ -1366,17 +1366,18 @@ const normalizePort = input => {
1366
1366
  if (!Number.isSafeInteger(port) || port < 1 || port > 65_535) {
1367
1367
  throw new RangeError('port must be an integer between 1 and 65535');
1368
1368
  }
1369
- const forwardedAddress = input.forwardedAddress ?? `localhost:${port}`;
1370
- const runningProcess = input.runningProcess ?? '';
1371
- const origin = input.origin ?? userForwarded();
1369
+ const rawInput = input;
1370
+ const forwardedAddress = rawInput.forwardedAddress ?? `localhost:${port}`;
1371
+ const runningProcess = rawInput.runningProcess ?? '';
1372
+ const origin = rawInput.origin ?? userForwarded();
1372
1373
  assertString(forwardedAddress, 'forwardedAddress');
1373
1374
  assertString(runningProcess, 'runningProcess');
1374
1375
  assertString(origin, 'origin');
1375
- if (input.active !== undefined && typeof input.active !== 'boolean') {
1376
+ if (rawInput.active !== undefined && typeof rawInput.active !== 'boolean') {
1376
1377
  throw new TypeError('active must be a boolean');
1377
1378
  }
1378
1379
  return {
1379
- active: input.active ?? true,
1380
+ active: rawInput.active ?? true,
1380
1381
  forwardedAddress,
1381
1382
  origin,
1382
1383
  port,
@@ -1489,7 +1490,11 @@ const submitAddPort = state => {
1489
1490
  }
1490
1491
  return {
1491
1492
  ...addPort(state, {
1492
- port
1493
+ active: true,
1494
+ forwardedAddress: `localhost:${port}`,
1495
+ origin: userForwarded(),
1496
+ port,
1497
+ runningProcess: ''
1493
1498
  }),
1494
1499
  addPortError: '',
1495
1500
  addPortValue: '',
@@ -2244,7 +2249,7 @@ const PortsStatusIconActive = 'PortsStatusIconActive';
2244
2249
  const PortsStatusIconInactive = 'PortsStatusIconInactive';
2245
2250
  const PortsTable = 'PortsTable';
2246
2251
  const PortsTableBody = 'PortsTableBody';
2247
- const PortsTableCell = 'PortsTableCell';
2252
+ const PortsColumn = 'PortsColumn';
2248
2253
  const PortsTableHeader = 'PortsTableHeader';
2249
2254
  const PortsTableRow = 'PortsTableRow';
2250
2255
  const PortsTableRowOdd = 'PortsTableRowOdd';
@@ -2369,10 +2374,10 @@ const getRowClassName = port => {
2369
2374
  return className;
2370
2375
  };
2371
2376
 
2372
- const getTextCell = (value, className) => {
2377
+ const getTextCell = value => {
2373
2378
  return [{
2374
2379
  childCount: 1,
2375
- className: mergeClassNames(PortsTableCell, className),
2380
+ className: PortsColumn,
2376
2381
  role: Cell,
2377
2382
  title: value,
2378
2383
  type: Div
@@ -2384,7 +2389,7 @@ const Unfocusable = -1;
2384
2389
 
2385
2390
  const statusCell = {
2386
2391
  childCount: 1,
2387
- className: mergeClassNames(PortsTableCell, 'PortsStatusColumn'),
2392
+ className: PortsColumn,
2388
2393
  role: Cell,
2389
2394
  type: Div
2390
2395
  };
@@ -2396,9 +2401,9 @@ const getPortRowVirtualDom = port => {
2396
2401
  className: getRowClassName(port),
2397
2402
  role: Row,
2398
2403
  type: Div
2399
- }, statusCell, ...getPortsStatusVirtualDom(port.active, port.port), ...getTextCell(portText, 'PortsPortColumn'), {
2404
+ }, statusCell, ...getPortsStatusVirtualDom(port.active, port.port), ...getTextCell(portText), {
2400
2405
  childCount: 1,
2401
- className: mergeClassNames(PortsTableCell, 'PortsAddressColumn'),
2406
+ className: PortsColumn,
2402
2407
  role: Cell,
2403
2408
  title: port.forwardedAddress,
2404
2409
  type: Div
@@ -2409,7 +2414,7 @@ const getPortRowVirtualDom = port => {
2409
2414
  role: Link,
2410
2415
  tabIndex: Unfocusable,
2411
2416
  type: A
2412
- }, text(port.forwardedAddress), ...getTextCell(port.runningProcess, 'PortsProcessColumn'), ...getTextCell(port.origin, 'PortsOriginColumn')];
2417
+ }, text(port.forwardedAddress), ...getTextCell(port.runningProcess), ...getTextCell(port.origin)];
2413
2418
  };
2414
2419
 
2415
2420
  const getVisiblePorts = state => {
@@ -2466,16 +2471,17 @@ const headerRow = {
2466
2471
  role: Row,
2467
2472
  type: Div
2468
2473
  };
2469
- const getHeaderCell = (label, className) => {
2470
- return [{
2471
- childCount: 1,
2472
- className: mergeClassNames(PortsTableCell, className),
2473
- role: ColumnHeader,
2474
- type: Div
2475
- }, text(label)];
2474
+ const headerCell = {
2475
+ childCount: 1,
2476
+ className: PortsColumn,
2477
+ role: ColumnHeader,
2478
+ type: Div
2479
+ };
2480
+ const getHeaderCell = label => {
2481
+ return [headerCell, text(label)];
2476
2482
  };
2477
2483
  const getPortsTableHeaderVirtualDom = () => {
2478
- return [headerRow, ...getHeaderCell('', 'PortsStatusColumn'), ...getHeaderCell(port(), 'PortsPortColumn'), ...getHeaderCell(forwardedAddress(), 'PortsAddressColumn'), ...getHeaderCell(runningProcess(), 'PortsProcessColumn'), ...getHeaderCell(origin(), 'PortsOriginColumn')];
2484
+ return [headerRow, ...getHeaderCell(''), ...getHeaderCell(port()), ...getHeaderCell(forwardedAddress()), ...getHeaderCell(runningProcess()), ...getHeaderCell(origin())];
2479
2485
  };
2480
2486
 
2481
2487
  const table = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/ports-view",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
4
4
  "description": "Ports View Worker",
5
5
  "repository": {
6
6
  "type": "git",