wgsl-edit 0.0.17 → 0.0.19
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/README.md +2 -1
- package/dist/Language.js +1 -1
- package/dist/WgslEdit-BiLVs-hz.js +5 -0
- package/dist/WgslEdit.d.ts +13 -2
- package/dist/WgslEdit.js +756 -2
- package/dist/index.js +1 -1
- package/dist/wgsl-edit.js +2620 -2595
- package/package.json +5 -5
- package/src/Language.ts +2 -1
- package/src/WgslEdit.ts +55 -8
- package/dist/WgslEdit-mSpL7CXc.js +0 -729
package/README.md
CHANGED
|
@@ -76,6 +76,7 @@ editor.project = { // load a full project
|
|
|
76
76
|
| `tabs` | boolean | `true` | Show tab bar |
|
|
77
77
|
| `lint` | `on` `off` | `on` | Real-time WESL validation |
|
|
78
78
|
| `line-numbers` | `true` `false` | `false` | Show line numbers |
|
|
79
|
+
| `fetch-libs` | `true` `false` | `true` | Auto-fetch missing libraries from npm |
|
|
79
80
|
| `shader-root` | string | - | Root path for shader imports |
|
|
80
81
|
|
|
81
82
|
### Properties
|
|
@@ -86,7 +87,7 @@ editor.project = { // load a full project
|
|
|
86
87
|
- `project: WeslProject` - Set full project (sources, conditions, packageName, etc.)
|
|
87
88
|
- `activeFile: string` - Get/set active file name
|
|
88
89
|
- `fileNames: string[]` - List all file names
|
|
89
|
-
- `theme`, `tabs`, `lint`, `lineNumbers`, `readonly`, `shaderRoot` - Mirror attributes
|
|
90
|
+
- `theme`, `tabs`, `lint`, `lineNumbers`, `readonly`, `shaderRoot`, `fetchLibs` - Mirror attributes
|
|
90
91
|
|
|
91
92
|
### Methods
|
|
92
93
|
|
package/dist/Language.js
CHANGED
|
@@ -99,7 +99,7 @@ function findMissingPackages(rootAst, result, resolver, ignored, libs) {
|
|
|
99
99
|
const pkgs = [];
|
|
100
100
|
for (const imp of rootAst.imports) {
|
|
101
101
|
const root = imp.segments[0]?.name;
|
|
102
|
-
if (!root || !isExternalRoot(root) || ignored.has(root)) continue;
|
|
102
|
+
if (!root || !isExternalRoot(root) || ignored.has(root) || loaded.has(root)) continue;
|
|
103
103
|
const modPath = imp.segments.map((s) => s.name).join("::");
|
|
104
104
|
if (!resolver.resolveModule(modPath)) pkgs.push(root);
|
|
105
105
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
//#region src/WgslEdit.css?inline
|
|
2
|
+
var WgslEdit_default = ":host {\n --tab-bar-bg: transparent;\n --tab-border: #ccc;\n --tab-color: #999;\n --tab-active-bg: #fff;\n --tab-active-color: #222;\n --tab-accent: #5f61d8;\n\n display: flex;\n flex-direction: column;\n position: relative;\n min-height: 100px;\n}\n\n:host(.dark) {\n --tab-bar-bg: transparent;\n --tab-border: #555;\n --tab-color: #999;\n --tab-active-bg: #1e1e1e;\n --tab-active-color: #fff;\n}\n\n.tab-bar {\n --bar-v: 6px;\n --bar-h: 8px;\n display: flex;\n align-items: center;\n gap: 14px;\n padding: var(--bar-v) var(--bar-h);\n background: var(--tab-bar-bg);\n flex-shrink: 0;\n position: relative;\n}\n\n.tab-bar::after {\n content: \"\";\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n height: 1px;\n background: var(--tab-border);\n}\n\n.tab {\n --tab-v: 5px;\n --tab-h: 12px;\n display: flex;\n align-items: center;\n gap: 16px;\n padding: var(--tab-v) var(--tab-h);\n background: transparent;\n border: none;\n border-radius: 0;\n color: var(--tab-color);\n cursor: pointer;\n position: relative;\n font-size: 15px;\n font-family: system-ui, sans-serif;\n}\n\n.tab.active {\n color: var(--tab-accent);\n font-weight: 600;\n padding-bottom: calc(var(--tab-v) + var(--bar-v) + 0.5px);\n margin-bottom: calc(-1 * (var(--bar-v) + 0.5px));\n position: relative;\n z-index: 1;\n border-bottom: 2px solid var(--tab-accent);\n}\n\n.tab.active:first-child {\n margin-left: calc(-1 * var(--bar-h));\n padding-left: calc(var(--tab-h) + var(--bar-h));\n}\n\n.tab-close {\n position: absolute;\n right: -8px;\n /* top: 2px; */\n width: 16px;\n height: 16px;\n padding: 0;\n border: none;\n background: transparent;\n color: inherit;\n cursor: pointer;\n opacity: 0;\n font-size: 18px;\n line-height: 1;\n}\n\n.tab:hover .tab-close {\n opacity: 0.6;\n}\n\n.tab-close:hover {\n opacity: 1;\n}\n\n.tab-rename {\n background: var(--tab-active-bg);\n border: 1px solid var(--tab-border);\n border-radius: 4px;\n color: var(--tab-active-color);\n font-size: 15px;\n font-family: system-ui, sans-serif;\n padding: 0 4px;\n outline: none;\n}\n\n.tab-add {\n padding: 0 10px;\n background: transparent;\n border: none;\n color: var(--tab-color);\n cursor: pointer;\n font-size: 25px;\n line-height: 1;\n}\n\n.tab-add:hover {\n color: var(--tab-active-color);\n}\n\n.editor-container {\n flex: 1;\n min-height: 0;\n width: 100%;\n padding: var(--editor-padding, 16px 0 0);\n}\n\n.cm-editor {\n height: 100%;\n font-size: var(--editor-font-size, 14px);\n}\n\n.cm-scroller {\n overflow: auto;\n}\n\n.snackbar {\n position: absolute;\n bottom: 16px;\n left: 16px;\n background: #e8e8e8;\n color: #333;\n padding: 10px 20px;\n border-radius: 8px;\n font-size: 14px;\n font-family: system-ui, sans-serif;\n line-height: 1.4;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\n opacity: 0;\n pointer-events: none;\n transition: opacity 0.2s;\n z-index: 10;\n}\n\n:host(.dark) .snackbar {\n background: #3a3a3a;\n color: #e0e0e0;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);\n}\n\n.snackbar.visible {\n opacity: 1;\n}\n";
|
|
3
|
+
|
|
4
|
+
//#endregion
|
|
5
|
+
export { WgslEdit_default as t };
|
package/dist/WgslEdit.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Conditions, LinkParams } from "wesl";
|
|
1
|
+
import { Conditions, LinkParams, WeslBundle } from "wesl";
|
|
2
2
|
|
|
3
3
|
//#region src/WgslEdit.d.ts
|
|
4
4
|
type WeslProject = Pick<LinkParams, "weslSrc" | "rootModuleName" | "conditions" | "constants" | "libs" | "packageName">;
|
|
@@ -20,13 +20,16 @@ declare class WgslEdit extends HTMLElement {
|
|
|
20
20
|
private _lineNumbers;
|
|
21
21
|
private _files;
|
|
22
22
|
private _activeFile;
|
|
23
|
+
private _rootModuleName;
|
|
23
24
|
private _tabs;
|
|
24
25
|
private _lint;
|
|
26
|
+
private _fetchLibs;
|
|
25
27
|
private _conditions;
|
|
26
28
|
private _packageName;
|
|
27
29
|
private _libs;
|
|
28
30
|
private _ignorePackages;
|
|
29
31
|
private _fetchingPkgs;
|
|
32
|
+
private _fetchedPkgs;
|
|
30
33
|
private _snackTimer;
|
|
31
34
|
private _externalDiagnostics;
|
|
32
35
|
private _lintFromEl;
|
|
@@ -52,7 +55,12 @@ declare class WgslEdit extends HTMLElement {
|
|
|
52
55
|
set project(value: WeslProject);
|
|
53
56
|
/** Link/compile WESL sources into WGSL. Returns the compiled WGSL string. */
|
|
54
57
|
link(options?: Partial<LinkParams>): Promise<string>;
|
|
55
|
-
/**
|
|
58
|
+
/** Library bundles for linking (set via project). */
|
|
59
|
+
get libs(): WeslBundle[];
|
|
60
|
+
/** Root module for linking (stable across tab switches). */
|
|
61
|
+
get rootModuleName(): string | undefined;
|
|
62
|
+
set rootModuleName(value: string | undefined);
|
|
63
|
+
/** Currently active file name (selected tab). */
|
|
56
64
|
get activeFile(): string;
|
|
57
65
|
/** Switch to a file by name. */
|
|
58
66
|
set activeFile(name: string);
|
|
@@ -67,6 +75,9 @@ declare class WgslEdit extends HTMLElement {
|
|
|
67
75
|
/** Line numbers visibility (default: true). */
|
|
68
76
|
get lineNumbers(): boolean;
|
|
69
77
|
set lineNumbers(value: boolean);
|
|
78
|
+
/** Whether to auto-fetch missing library packages from npm (default: true). */
|
|
79
|
+
get fetchLibs(): boolean;
|
|
80
|
+
set fetchLibs(value: boolean);
|
|
70
81
|
/** Whether the editor is currently loading content. */
|
|
71
82
|
get loading(): boolean;
|
|
72
83
|
set loading(value: boolean);
|