@stillwind/host 0.0.0-stage → 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Stillwind contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,14 @@
1
- # Temporary Holding Version
1
+ # @stillwind/host
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Stillwind compiles Tailwind CSS v4 utilities into component props and static CSS.
4
+ It uses theme rules and compiler checks to keep styling code in order, even when
5
+ AI agents write much of it.
6
+
7
+ `@stillwind/host` provides the host services shared by Stillwind's build
8
+ integrations and analysis tools: CSS loading, semantic compilation, editor
9
+ queries, output finalization, and source maps.
10
+
11
+ See [Development](https://github.com/SegaraRai/stillwind/blob/main/packages/host/DEVELOPMENT.md)
12
+ for module responsibilities and preview lifetimes, and
13
+ [Analysis contracts](https://github.com/SegaraRai/stillwind/blob/main/docs/standalone-analysis.md)
14
+ for configuration and service embedding.
@@ -0,0 +1,220 @@
1
+ import { C as PluginPathCompletion, D as EditorRequest, E as EditorEdit, O as EditorResult, S as defaultPluginExport, T as EditorCompletion, _ as TypeFactsBackend, b as PluginHost, g as TypeFactSource, h as SemanticInputs, p as AvailableFacts, r as ModuleAnalysis, t as EditorSnapshot, v as TypeFactsError, w as EditorColor, y as UnverifiedRange } from "./index-CprPvXxv.js";
2
+ import { t as resolveVirtualModule } from "./resolution-BI5eZllL.js";
3
+ import { BindingRejectedIdentifier, BindingReport, NativeAssetRecord, NativeTypeFact } from "@stillwind/native";
4
+ import ts from "typescript-6";
5
+ import { AnalysisProjectConfig } from "@stillwind/config";
6
+ /**
7
+ * Supplies complete virtual files and TypeScript settings for a browser checker.
8
+ */
9
+ interface BrowserCheckerOptions {
10
+ /** Absolute virtual project path. Paths use forward slashes. */
11
+ root: string;
12
+ /** Files include package metadata, declarations, standard libraries, and source documents. */
13
+ files: ReadonlyMap<string, string>;
14
+ /** Selected virtual tsconfig path. False uses isolated defaults. */
15
+ tsconfig?: string | false;
16
+ }
17
+ /**
18
+ * Answers declaration probes with the browser TypeScript checker.
19
+ */
20
+ export declare class BrowserTypeFactsService implements TypeFactsBackend {
21
+ #private;
22
+ /**
23
+ * Creates a service without loading its sources.
24
+ *
25
+ * @param options - Virtual files and fixed TypeScript settings. Call invalidate after changing dependency files.
26
+ */
27
+ constructor(options: BrowserCheckerOptions);
28
+ /**
29
+ * Keeps project inputs for later queries and clears prepared checker buffers.
30
+ *
31
+ * @param sources - Prepared project sources, retained by reference until replaced.
32
+ * @param assets - Declarations grouped by compiler module ID, retained with the sources.
33
+ * @param inputs - File overlays and ambient declarations. Omission supplies no extra files.
34
+ * Do not mutate these inputs while they are installed. Queries select their own probes and sources.
35
+ */
36
+ setProjectSources(sources: readonly TypeFactSource[], assets: ReadonlyMap<string, readonly NativeAssetRecord[]>, inputs?: SemanticInputs): void;
37
+ /**
38
+ * Collects finite declaration candidates and rejects unavailable required queries.
39
+ *
40
+ * @param sources - Prepared sources with probes in original UTF-8 coordinates.
41
+ * @param assets - Declaration records grouped by compiler module identity.
42
+ * @param inputs - Overlays and ambient declarations for an independent query. Omission supplies none.
43
+ * An installed project uses the inputs supplied by {@link setProjectSources}.
44
+ * @returns Facts keyed by compiler identity, deduplicated by original range across checker buffers.
45
+ * Known non-asset types produce null facts. Unresolved recognition-only probes produce no fact.
46
+ * @throws If the service is closed, preparation fails, or checker contracts cannot be verified.
47
+ */
48
+ collect(sources: readonly TypeFactSource[], assets: ReadonlyMap<string, readonly NativeAssetRecord[]>, inputs?: SemanticInputs): Map<string, NativeTypeFact[]>;
49
+ /**
50
+ * Collects usable facts while retaining unavailable original ranges for analysis.
51
+ *
52
+ * @param sources - Prepared sources with original UTF-8 probes and checker correspondences.
53
+ * @param assets - Declaration records grouped by compiler module identity.
54
+ * @param inputs - Overlays and ambient declarations for an independent query. Omission supplies none.
55
+ * An installed project uses the inputs supplied by {@link setProjectSources}.
56
+ * @returns Verified facts and unverified ranges without discarding other expressions' answers.
57
+ * @throws If the service is closed, preparation fails, or checker results conflict for one original range.
58
+ */
59
+ collectAvailable(sources: readonly TypeFactSource[], assets: ReadonlyMap<string, readonly NativeAssetRecord[]>, inputs?: SemanticInputs): AvailableFacts;
60
+ /**
61
+ * Resolves authored imports and exports from module symbols in the virtual checker.
62
+ * When project sources are installed, resolves imports for the whole installed project.
63
+ *
64
+ * @param sources - Prepared sources whose checker buffers contain module requests.
65
+ * @param assets - Declaration records used to prepare checker identities and helpers.
66
+ * @param inputs - Overlays and ambient declarations for independent resolution. Omission supplies none.
67
+ * An installed project uses the inputs supplied by {@link setProjectSources}.
68
+ * @returns Maps from importing resolver identity to specifier and resolved identity. Unmatched requests are omitted.
69
+ * @throws If the service is closed or checker preparation fails.
70
+ */
71
+ resolveModules(sources: readonly TypeFactSource[], assets: ReadonlyMap<string, readonly NativeAssetRecord[]>, inputs?: SemanticInputs): Map<string, Map<string, string>>;
72
+ /**
73
+ * Discards the language service after file or configuration changes.
74
+ */
75
+ invalidate(): void;
76
+ /**
77
+ * Releases the checker. Subsequent queries reject.
78
+ */
79
+ close(): void;
80
+ }
81
+ /** Files and evaluated configuration captured for one browser project. */
82
+ interface BrowserProjectOptions {
83
+ /** Absolute virtual directory used for relative compiler identities. */
84
+ root: string;
85
+ /** Evaluated project settings. Paths use the virtual workspace. */
86
+ config: AnalysisProjectConfig;
87
+ /** Original sources, package files, and declarations captured for this project revision. */
88
+ files: ReadonlyMap<string, string>;
89
+ /**
90
+ * Maps an absolute virtual path to its original workspace URI.
91
+ * @param id - Decoded virtual source path.
92
+ * @returns URI used for diagnostic locations and source-map names.
93
+ */
94
+ documentUri?(id: string): string;
95
+ /**
96
+ * Loads plugin packages and plugin files for `@plugin` statements. Omission limits the project
97
+ * to the plugins of its configuration.
98
+ */
99
+ plugins?: PluginHost;
100
+ }
101
+ /** Rendered browser CSS and the naming fallbacks observed during its assembly. */
102
+ interface BrowserStylesheetOutput {
103
+ /** CSS after local resources are embedded. */
104
+ css: string;
105
+ /** Generator rejection records without source locations, in request order. */
106
+ rejectedNames: BindingRejectedIdentifier[];
107
+ }
108
+ /** One module's carrier and its ordered template fragments. */
109
+ interface BrowserModuleCss extends BrowserStylesheetOutput {
110
+ /** Fragments in stylesheet occurrence order, with their content fingerprints. */
111
+ parts: {
112
+ /** Content fingerprint supplied by the native emission plan. */
113
+ key: string;
114
+ /** Preserved notices required by this fragment. */
115
+ banners?: readonly string[];
116
+ /** Fragment CSS including enclosing conditions, after local resources are embedded. */
117
+ css: string;
118
+ }[];
119
+ }
120
+ type ReadonlyData<T> = T extends object ? { readonly [K in keyof T]: ReadonlyData<T[K]>; } : T;
121
+ /** Analysis records shared by cache reads. Use structuredClone() to obtain editable records. */
122
+ type BrowserModuleAnalysis = ReadonlyData<ModuleAnalysis>;
123
+ /** Owns the design system, semantic checker, and compiler artifacts for one captured inventory. */
124
+ export declare class BrowserProject {
125
+ #private;
126
+ /**
127
+ * Copies the files and configuration without loading CSS or compiling sources.
128
+ *
129
+ * @param options - Captured files and configuration. Use replaceFiles between transactions to change sources.
130
+ */
131
+ constructor(options: BrowserProjectOptions);
132
+ /**
133
+ * Reports stylesheet lint for the CSS files that this project lints.
134
+ *
135
+ * @returns Linted virtual paths in load order, and the reports whose primary location is one of
136
+ * them.
137
+ * @throws If the project is closed or the CSS graph cannot be loaded.
138
+ */
139
+ stylesheetLint(): Promise<{
140
+ /** Virtual paths of the CSS entry and the imported files marked for lint. */
141
+ sources: string[];
142
+ /** Stylesheet lint reports with original document locations. */
143
+ reports: BindingReport[];
144
+ }>;
145
+ /**
146
+ * Replaces virtual files after earlier operations finish and clears cached analysis and editor results.
147
+ * Source edits keep CSS loaded. CSS dependencies, package metadata, and file additions or deletions
148
+ * cause the next operation to reload CSS.
149
+ *
150
+ * @param files - All replacement files, copied before the update is queued.
151
+ * @returns Completion of the update. Unchanged files have no effect.
152
+ * @throws If the project is closed when the update runs.
153
+ */
154
+ replaceFiles(files: ReadonlyMap<string, string>): Promise<void>;
155
+ /**
156
+ * Loads target sources together and prepares their plugin candidates for later analysis.
157
+ *
158
+ * @param ids - Full virtual resolver IDs of the targets.
159
+ * @returns Completion of preparation, or no work after closure. Loading and plugin failures are
160
+ * left for each target's analysis to report. A failed plugin runtime is discarded before retrying.
161
+ */
162
+ prepare(ids: readonly string[]): Promise<void>;
163
+ /**
164
+ * Analyzes and transforms an entry with its demanded semantic dependencies.
165
+ *
166
+ * @param id - Absolute virtual source path, including any query selecting distinct source.
167
+ * @returns Readonly reports, code, and dependency coverage, shared by cache reads.
168
+ * @throws If the project is closed, CSS loading fails, or compilation fails.
169
+ */
170
+ analyze(id: string): Promise<BrowserModuleAnalysis>;
171
+ /**
172
+ * Returns document CSS for successfully compiled graphs. automatic:false includes
173
+ * only shared base CSS. Local text resources become data URLs; remote URLs retain
174
+ * their authored values.
175
+ *
176
+ * @returns Document CSS and naming fallbacks, or empty CSS and reports before session creation.
177
+ * @throws If an emitted local resource is absent from the captured files.
178
+ */
179
+ css(): BrowserStylesheetOutput;
180
+ /**
181
+ * Queries a captured source graph or a stylesheet in the project's CSS graph.
182
+ * CSS completion, hover, resolution, and colors retry failed graph loads with recovered
183
+ * definitions. CSS sorting and lint fixes require the original graph to load successfully.
184
+ * Plugin path completion and links read captured files inside the project root without
185
+ * loading the CSS graph or executing plugins.
186
+ * Script queries first analyze their entry.
187
+ *
188
+ * @param id - Absolute virtual entry path, including a query that selects distinct source.
189
+ * @param request - Operation with original UTF-16 offsets for that source.
190
+ * @returns The editor answer, or undefined when no snapshot is available, the CSS graph
191
+ * does not mark the stylesheet for a semantic query, or closure suppresses a pending answer.
192
+ * @throws If a script query starts after closure, or if entry analysis, CSS graph loading,
193
+ * source reading, or the editor query fails.
194
+ */
195
+ query(id: string, request: EditorRequest): Promise<EditorResult | undefined>;
196
+ /**
197
+ * Returns CSS values keyed by absolute source path for explicit stillwind/module-css imports.
198
+ * Parts preserve stylesheet occurrence order and include their content fingerprints.
199
+ *
200
+ * @returns A new map of module CSS records. No session produces an empty map.
201
+ * @throws If an emitted local resource is absent from the captured files.
202
+ */
203
+ cssValues(): ReadonlyMap<string, BrowserModuleCss>;
204
+ /**
205
+ * Prevents new analyses, waits for queued work, and releases the checker, snapshots, and native session.
206
+ *
207
+ * @returns Completion of project cleanup.
208
+ */
209
+ close(): Promise<void>;
210
+ }
211
+ /**
212
+ * Converts a workspace URI to its decoded absolute path without filesystem access.
213
+ *
214
+ * @param uri - Absolute URI whose pathname identifies a file in the virtual inventory.
215
+ * @returns The decoded pathname; the scheme and authority are omitted.
216
+ * @throws If the URI or its percent encoding is invalid.
217
+ */
218
+ export declare function virtualPath(uri: string): string;
219
+ export { type AvailableFacts, type BrowserCheckerOptions, type BrowserModuleAnalysis, type BrowserModuleCss, type BrowserProjectOptions, type BrowserStylesheetOutput, type EditorColor, type EditorCompletion, type EditorEdit, type EditorRequest, type EditorResult, EditorSnapshot, type PluginHost, type PluginPathCompletion, type TypeFactSource, type TypeFactsBackend, TypeFactsError, type UnverifiedRange, defaultPluginExport, resolveVirtualModule };
220
+ //# sourceMappingURL=browser.d.ts.map