@kmugalkhod/lightcode 0.18.0 → 0.18.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.
- package/assets/web/{index-n305tms3.css → index-e40p9zj3.css} +1 -1
- package/assets/web/index-h22g370d.js +183 -0
- package/assets/web/index.html +1 -1
- package/cli.js +1 -1
- package/package.json +1 -1
- package/server.js +104 -7
- package/assets/web/index-ghcpktm7.js +0 -183
package/assets/web/index.html
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<meta name="theme-color" content="#0D1117" />
|
|
8
8
|
<title>Lightcode</title>
|
|
9
9
|
|
|
10
|
-
<link rel="stylesheet" crossorigin href="./index-
|
|
10
|
+
<link rel="stylesheet" crossorigin href="./index-e40p9zj3.css"><script type="module" crossorigin src="./index-h22g370d.js"></script></head>
|
|
11
11
|
<body>
|
|
12
12
|
<!--
|
|
13
13
|
THESIS: One local coding workspace shared with the CLI; this surface rejects dashboard-card clutter and keeps the project conversation central.
|
package/cli.js
CHANGED
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -17447,9 +17447,86 @@ $ErrorActionPreference = 'Stop'
|
|
|
17447
17447
|
$ProgressPreference = 'SilentlyContinue'
|
|
17448
17448
|
[Console]::OutputEncoding = [Text.UTF8Encoding]::new($false)
|
|
17449
17449
|
Add-Type -AssemblyName System.Windows.Forms
|
|
17450
|
-
$
|
|
17451
|
-
|
|
17452
|
-
|
|
17450
|
+
$modernPicker = $false
|
|
17451
|
+
try {
|
|
17452
|
+
Add-Type -Language CSharp -TypeDefinition @'
|
|
17453
|
+
using System;
|
|
17454
|
+
using System.Runtime.InteropServices;
|
|
17455
|
+
|
|
17456
|
+
namespace Lightcode {
|
|
17457
|
+
[ComImport, Guid("DC1C5A9C-E88A-4dde-A5A1-60F82A20AEF7")]
|
|
17458
|
+
internal class FileOpenDialogCoClass {}
|
|
17459
|
+
|
|
17460
|
+
[ComImport, Guid("43826D1E-E718-42EE-BC55-A1E261C37BFE"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
|
17461
|
+
internal interface IShellItem {
|
|
17462
|
+
void BindToHandler(IntPtr pbc, ref Guid bhid, ref Guid riid, out IntPtr ppv);
|
|
17463
|
+
void GetParent(out IShellItem ppsi);
|
|
17464
|
+
void GetDisplayName(uint sigdnName, out IntPtr ppszName);
|
|
17465
|
+
void GetAttributes(uint sfgaoMask, out uint psfgaoAttribs);
|
|
17466
|
+
void Compare(IShellItem psi, uint hint, out int piOrder);
|
|
17467
|
+
}
|
|
17468
|
+
|
|
17469
|
+
// IFileOpenDialog; only the IModalWindow/IFileDialog prefix of the vtable
|
|
17470
|
+
// is declared, in order.
|
|
17471
|
+
[ComImport, Guid("d57c7288-d4ad-4768-be02-9d969532d960"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
|
17472
|
+
internal interface IFileOpenDialog {
|
|
17473
|
+
[PreserveSig] int Show(IntPtr parent);
|
|
17474
|
+
void SetFileTypes(uint cFileTypes, IntPtr rgFilterSpec);
|
|
17475
|
+
void SetFileTypeIndex(uint iFileType);
|
|
17476
|
+
void GetFileTypeIndex(out uint piFileType);
|
|
17477
|
+
void Advise(IntPtr pfde, out uint pdwCookie);
|
|
17478
|
+
void Unadvise(uint dwCookie);
|
|
17479
|
+
void SetOptions(uint fos);
|
|
17480
|
+
void GetOptions(out uint pfos);
|
|
17481
|
+
void SetDefaultFolder(IShellItem psi);
|
|
17482
|
+
void SetFolder(IShellItem psi);
|
|
17483
|
+
void GetFolder(out IShellItem ppsi);
|
|
17484
|
+
void GetCurrentSelection(out IShellItem ppsi);
|
|
17485
|
+
void SetFileName([MarshalAs(UnmanagedType.LPWStr)] string pszName);
|
|
17486
|
+
void GetFileName([MarshalAs(UnmanagedType.LPWStr)] out string pszName);
|
|
17487
|
+
void SetTitle([MarshalAs(UnmanagedType.LPWStr)] string pszTitle);
|
|
17488
|
+
void SetOkButtonLabel([MarshalAs(UnmanagedType.LPWStr)] string pszText);
|
|
17489
|
+
void SetFileNameLabel([MarshalAs(UnmanagedType.LPWStr)] string pszLabel);
|
|
17490
|
+
void GetResult(out IShellItem ppsi);
|
|
17491
|
+
}
|
|
17492
|
+
|
|
17493
|
+
public static class FolderPicker {
|
|
17494
|
+
const uint PickFolders = 0x20, ForceFileSystem = 0x40, PathMustExist = 0x800, NoChangeDir = 0x8;
|
|
17495
|
+
const uint FileSystemPath = 0x80058000;
|
|
17496
|
+
const int Cancelled = unchecked((int)0x800704C7);
|
|
17497
|
+
|
|
17498
|
+
// Returns the chosen folder, or null when the user cancels.
|
|
17499
|
+
public static string Pick(IntPtr owner, string title) {
|
|
17500
|
+
var dialog = (IFileOpenDialog)new FileOpenDialogCoClass();
|
|
17501
|
+
try {
|
|
17502
|
+
uint options;
|
|
17503
|
+
dialog.GetOptions(out options);
|
|
17504
|
+
dialog.SetOptions(options | PickFolders | ForceFileSystem | PathMustExist | NoChangeDir);
|
|
17505
|
+
dialog.SetTitle(title);
|
|
17506
|
+
dialog.SetOkButtonLabel("Open project");
|
|
17507
|
+
int hr = dialog.Show(owner);
|
|
17508
|
+
if (hr == Cancelled) return null;
|
|
17509
|
+
Marshal.ThrowExceptionForHR(hr);
|
|
17510
|
+
IShellItem item;
|
|
17511
|
+
dialog.GetResult(out item);
|
|
17512
|
+
IntPtr name;
|
|
17513
|
+
item.GetDisplayName(FileSystemPath, out name);
|
|
17514
|
+
try {
|
|
17515
|
+
return Marshal.PtrToStringUni(name);
|
|
17516
|
+
} finally {
|
|
17517
|
+
Marshal.FreeCoTaskMem(name);
|
|
17518
|
+
}
|
|
17519
|
+
} finally {
|
|
17520
|
+
Marshal.ReleaseComObject(dialog);
|
|
17521
|
+
}
|
|
17522
|
+
}
|
|
17523
|
+
}
|
|
17524
|
+
}
|
|
17525
|
+
'@
|
|
17526
|
+
$modernPicker = $true
|
|
17527
|
+
} catch {
|
|
17528
|
+
$modernPicker = $false
|
|
17529
|
+
}
|
|
17453
17530
|
$owner = New-Object System.Windows.Forms.Form
|
|
17454
17531
|
$owner.Text = 'Lightcode - choose a project folder'
|
|
17455
17532
|
$owner.TopMost = $true
|
|
@@ -17471,15 +17548,35 @@ try {
|
|
|
17471
17548
|
$owner.Hide()
|
|
17472
17549
|
$owner.Show()
|
|
17473
17550
|
$owner.Activate()
|
|
17474
|
-
$
|
|
17475
|
-
|
|
17476
|
-
|
|
17551
|
+
$selected = $null
|
|
17552
|
+
$shown = $false
|
|
17553
|
+
if ($modernPicker) {
|
|
17554
|
+
try {
|
|
17555
|
+
$selected = [Lightcode.FolderPicker]::Pick($owner.Handle, 'Choose a project folder')
|
|
17556
|
+
$shown = $true
|
|
17557
|
+
} catch {
|
|
17558
|
+
# The dialog failed to open; fall back to the classic picker below.
|
|
17559
|
+
}
|
|
17560
|
+
}
|
|
17561
|
+
if (-not $shown) {
|
|
17562
|
+
$dialog = New-Object System.Windows.Forms.FolderBrowserDialog
|
|
17563
|
+
$dialog.Description = 'Choose a project folder'
|
|
17564
|
+
$dialog.ShowNewFolderButton = $true
|
|
17565
|
+
try {
|
|
17566
|
+
if ($dialog.ShowDialog($owner) -eq [System.Windows.Forms.DialogResult]::OK) {
|
|
17567
|
+
$selected = $dialog.SelectedPath
|
|
17568
|
+
}
|
|
17569
|
+
} finally {
|
|
17570
|
+
$dialog.Dispose()
|
|
17571
|
+
}
|
|
17572
|
+
}
|
|
17573
|
+
if ($selected) {
|
|
17574
|
+
$bytes = [Text.Encoding]::UTF8.GetBytes($selected)
|
|
17477
17575
|
[Console]::Out.Write('selected:' + [Convert]::ToBase64String($bytes))
|
|
17478
17576
|
} else {
|
|
17479
17577
|
[Console]::Out.Write('cancelled')
|
|
17480
17578
|
}
|
|
17481
17579
|
} finally {
|
|
17482
|
-
$dialog.Dispose()
|
|
17483
17580
|
$owner.Dispose()
|
|
17484
17581
|
}
|
|
17485
17582
|
`;
|