@stillwind/host 0.11.0 → 0.12.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/CHANGELOG.md +13 -0
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +1 -1
- package/dist/{index-DdFR_SNl.d.ts → index-vMSKY1Nh.d.ts} +18 -4
- package/dist/index.d.ts +14 -1
- package/dist/index.js +2 -2
- package/dist/{options-CA4ymTHc.js → options-Cc-SlJed.js} +102 -31
- package/dist/options-Cc-SlJed.js.map +1 -0
- package/package.json +5 -5
- package/dist/options-CA4ymTHc.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @stillwind/host
|
|
2
2
|
|
|
3
|
+
## 0.12.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- `stillwind utilities` and `stillwind variants` now accept `--names-only` to list matching names without formatting CSS previews. Pattern searches in `stillwind utilities` now also include placeholder patterns for functional utilities' non-enumerable domains, such as `p-<number>` and `p-[<length-percentage>]` (`kind: "pattern"` in JSON). `stillwind theme` now includes resolved values for tokens that reference other theme variables (`resolvedValue` in JSON, and inline comments in text output).
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies:
|
|
12
|
+
- @stillwind/config@0.12.0
|
|
13
|
+
- @stillwind/native@0.12.0
|
|
14
|
+
- @stillwind/projection@0.12.0
|
|
15
|
+
|
|
3
16
|
## 0.11.0
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as PluginPathCompletion, C as TypeFactSource, D as PluginHost, E as UnverifiedRange, F as EditorResult, M as EditorCompletion, N as EditorEdit, P as EditorRequest, S as SemanticInputs, T as TypeFactsError, a as DesignSystemResult, b as AvailableFacts, c as queryDesignSystem, i as DesignSystemRequest, j as EditorColor, k as defaultPluginExport, n as DesignCandidate, o as DesignToken, r as DesignSystemContext, s as DesignTokenSource, t as EditorSnapshot, u as ModuleAnalysis, w as TypeFactsBackend } from "./index-
|
|
1
|
+
import { A as PluginPathCompletion, C as TypeFactSource, D as PluginHost, E as UnverifiedRange, F as EditorResult, M as EditorCompletion, N as EditorEdit, P as EditorRequest, S as SemanticInputs, T as TypeFactsError, a as DesignSystemResult, b as AvailableFacts, c as queryDesignSystem, i as DesignSystemRequest, j as EditorColor, k as defaultPluginExport, n as DesignCandidate, o as DesignToken, r as DesignSystemContext, s as DesignTokenSource, t as EditorSnapshot, u as ModuleAnalysis, w as TypeFactsBackend } from "./index-vMSKY1Nh.js";
|
|
2
2
|
import { t as resolveVirtualModule } from "./resolution-C7e21ept.js";
|
|
3
3
|
import { BindingRejectedIdentifier, BindingReport, NativeAssetRecord, NativeTypeFact } from "@stillwind/native";
|
|
4
4
|
import ts from "typescript-6";
|
package/dist/browser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { D as CompilationProject, I as prepareSourcePlugins, M as TypeFactsError, N as attachPlugins, _ as defaultPluginExport, a as pluginDirectory, b as analyzeModule, c as CheckerSource, d as queryDesignSystem, f as isStylesheet, h as loadEditorCssGraph, i as completePluginPaths, j as fileSourceKind, l as checkerId, m as loadCssGraph, n as cssEntrypoint, o as queryPluginPaths, r as StylesheetEditor, s as EditorSnapshot, t as compilerOptions, u as withRequestedProbes, y as finalizeCss } from "./options-Cc-SlJed.js";
|
|
2
2
|
import { t as resolveVirtualModule } from "./resolution-C5o_tmY3.js";
|
|
3
3
|
import { NativeProjectSession, fingerprint } from "@stillwind/native";
|
|
4
4
|
import ts from "typescript-6";
|
|
@@ -30,6 +30,11 @@ interface EditorCompletion extends EditorEdit {
|
|
|
30
30
|
snippet?: string;
|
|
31
31
|
/** Requests another completion after the client inserts this item. */
|
|
32
32
|
retrigger?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Concrete color of a color utility as `#rrggbb` or `#rrggbbaa`. Absent for other candidates
|
|
35
|
+
* and for colors that depend on the color scheme.
|
|
36
|
+
*/
|
|
37
|
+
color?: string;
|
|
33
38
|
/** Completion category for host-resolved plugin names, files, and directories. */
|
|
34
39
|
category?: "module" | "file" | "directory";
|
|
35
40
|
/** Lexical priority key supplied by the semantic catalog. Omission sorts by label. */
|
|
@@ -189,6 +194,11 @@ interface EditorResult {
|
|
|
189
194
|
}[];
|
|
190
195
|
/** Prefix-matching candidates with their full replacement ranges. CSS loads on resolve. */
|
|
191
196
|
completions?: EditorCompletion[];
|
|
197
|
+
/**
|
|
198
|
+
* True when the plugin catalog had more matching names than one request lists, so a longer
|
|
199
|
+
* prefix can produce other completions.
|
|
200
|
+
*/
|
|
201
|
+
completionsIncomplete?: boolean;
|
|
192
202
|
/** Concrete colors resolved against the active design system. */
|
|
193
203
|
colors?: EditorColor[];
|
|
194
204
|
/** Nonoverlapping replacements in ascending original offset order. */
|
|
@@ -842,6 +852,8 @@ type DesignSystemRequest = {
|
|
|
842
852
|
kind: "utilities" | "variants";
|
|
843
853
|
/** Decoded candidates. A `*` outside brackets and parentheses makes a pattern. */
|
|
844
854
|
targets: readonly string[];
|
|
855
|
+
/** Omits formatted CSS previews from returned candidates. */
|
|
856
|
+
namesOnly?: boolean;
|
|
845
857
|
};
|
|
846
858
|
/**
|
|
847
859
|
* Origin of a token: the project's `@theme`, or a default that `@theme` can override.
|
|
@@ -855,22 +867,24 @@ interface DesignToken {
|
|
|
855
867
|
name: string;
|
|
856
868
|
/** CSS value as written, including references to other tokens. */
|
|
857
869
|
value: string;
|
|
870
|
+
/** CSS value with known theme `var()` references substituted. Absent when unchanged. */
|
|
871
|
+
resolvedValue?: string;
|
|
858
872
|
/** Origin of the active definition. */
|
|
859
873
|
source: DesignTokenSource;
|
|
860
874
|
/** Whether utilities write the value of the token instead of a reference to it. */
|
|
861
875
|
inline: boolean;
|
|
862
876
|
}
|
|
863
877
|
/**
|
|
864
|
-
* One utility, variant,
|
|
878
|
+
* One utility, variant, marker class, or functional utility pattern, with its CSS.
|
|
865
879
|
*/
|
|
866
880
|
interface DesignCandidate {
|
|
867
881
|
/** Decoded candidate. Variant names have no trailing colon. */
|
|
868
882
|
name: string;
|
|
869
883
|
/** Kind of input that the name selects. */
|
|
870
|
-
kind: "utility" | "variant" | "marker";
|
|
884
|
+
kind: "utility" | "variant" | "marker" | "pattern";
|
|
871
885
|
/** Whether the name resolves in this design system. */
|
|
872
886
|
valid: boolean;
|
|
873
|
-
/** Formatted CSS. It is empty for an invalid name
|
|
887
|
+
/** Formatted CSS. It is empty for an invalid name, a pattern, a marker without CSS, or namesOnly. */
|
|
874
888
|
css: string;
|
|
875
889
|
/** Closest valid spelling of an invalid name. Absent when no spelling is close enough. */
|
|
876
890
|
suggestion?: string;
|
|
@@ -968,4 +982,4 @@ declare class EditorSnapshot {
|
|
|
968
982
|
query(id: string, request: EditorRequest): EditorResult | undefined;
|
|
969
983
|
}
|
|
970
984
|
export { PluginPathCompletion as A, TypeFactSource as C, PluginHost as D, UnverifiedRange as E, EditorResult as F, EditorCompletion as M, EditorEdit as N, TailwindSettings as O, EditorRequest as P, SemanticInputs as S, TypeFactsError as T, TypeFactsInputs as _, DesignSystemResult as a, AvailableFacts as b, queryDesignSystem as c, ModuleCompileOptions as d, SemanticDependency as f, TypeFactsEnvironment as g, TypeScriptFactsStats as h, DesignSystemRequest as i, EditorColor as j, defaultPluginExport as k, PluginRuntime as l, TypeScriptFactsService as m, DesignCandidate as n, DesignToken as o, TypeFact as p, DesignSystemContext as r, DesignTokenSource as s, EditorSnapshot as t, ModuleAnalysis as u, TypeScriptProject as v, TypeFactsBackend as w, CheckerSpan as x, resolveTypeFactsEnvironment as y };
|
|
971
|
-
//# sourceMappingURL=index-
|
|
985
|
+
//# sourceMappingURL=index-vMSKY1Nh.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as PluginPathCompletion, C as TypeFactSource, D as PluginHost, E as UnverifiedRange, F as EditorResult, M as EditorCompletion, N as EditorEdit, O as TailwindSettings, P as EditorRequest, S as SemanticInputs, T as TypeFactsError, _ as TypeFactsInputs, a as DesignSystemResult, b as AvailableFacts, c as queryDesignSystem, d as ModuleCompileOptions, f as SemanticDependency, g as TypeFactsEnvironment, h as TypeScriptFactsStats, i as DesignSystemRequest, j as EditorColor, k as defaultPluginExport, l as PluginRuntime, m as TypeScriptFactsService, n as DesignCandidate, o as DesignToken, p as TypeFact, r as DesignSystemContext, s as DesignTokenSource, t as EditorSnapshot, u as ModuleAnalysis, v as TypeScriptProject, w as TypeFactsBackend, x as CheckerSpan, y as resolveTypeFactsEnvironment } from "./index-
|
|
1
|
+
import { A as PluginPathCompletion, C as TypeFactSource, D as PluginHost, E as UnverifiedRange, F as EditorResult, M as EditorCompletion, N as EditorEdit, O as TailwindSettings, P as EditorRequest, S as SemanticInputs, T as TypeFactsError, _ as TypeFactsInputs, a as DesignSystemResult, b as AvailableFacts, c as queryDesignSystem, d as ModuleCompileOptions, f as SemanticDependency, g as TypeFactsEnvironment, h as TypeScriptFactsStats, i as DesignSystemRequest, j as EditorColor, k as defaultPluginExport, l as PluginRuntime, m as TypeScriptFactsService, n as DesignCandidate, o as DesignToken, p as TypeFact, r as DesignSystemContext, s as DesignTokenSource, t as EditorSnapshot, u as ModuleAnalysis, v as TypeScriptProject, w as TypeFactsBackend, x as CheckerSpan, y as resolveTypeFactsEnvironment } from "./index-vMSKY1Nh.js";
|
|
2
2
|
import { BindingDiagnostic, BindingOutput, BindingRejectedIdentifier, BindingReport, NativeAssetRecord, NativeCompilerOptions, NativeCssResource, NativeDesignSystemLoader, NativeDiagnosticBatch, NativeEditorQuery, NativeModuleSummary, NativeProjectSession, NativeSkippedCss, NativeTypeFact } from "@stillwind/native";
|
|
3
3
|
import { PreparedSource as PreparedSource$1, ProjectInput, ScriptSyntax, SourceDocument } from "@stillwind/projection";
|
|
4
4
|
import { EncodedSourceMap } from "@jridgewell/gen-mapping";
|
|
@@ -417,6 +417,19 @@ export declare class CompilationFailure extends Error {
|
|
|
417
417
|
*/
|
|
418
418
|
constructor(batches: readonly NativeDiagnosticBatch[], cause?: unknown);
|
|
419
419
|
}
|
|
420
|
+
/**
|
|
421
|
+
* Formats a compiler report for an Error message or terminal output.
|
|
422
|
+
*
|
|
423
|
+
* @param report - Structured report with a primary label, related labels, and notes.
|
|
424
|
+
* @param options - `primaryLocation: false` omits the primary path and range, for hosts that
|
|
425
|
+
* display the primary location separately, such as the Vite error overlay.
|
|
426
|
+
* @returns Text with one-based line and column ranges for source labels, followed by related labels
|
|
427
|
+
* and notes. Document-scoped primary labels use only the path.
|
|
428
|
+
*/
|
|
429
|
+
export declare function formatReport(report: BindingReport, options?: {
|
|
430
|
+
/** False omits the primary path and range. Omission includes them. */
|
|
431
|
+
primaryLocation?: boolean;
|
|
432
|
+
}): string;
|
|
420
433
|
/**
|
|
421
434
|
* Prepared direct or projected source with optional semantic facts in original UTF-8 coordinates.
|
|
422
435
|
* The host attaches these facts before native compilation.
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as cleanModuleId, C as CompilationFailure, D as CompilationProject, E as tracePhase, F as pluginLoader, I as prepareSourcePlugins, M as TypeFactsError, N as attachPlugins, O as ResolutionMismatchError, P as compileWithPlugins, S as warnRejectedNames, T as startPhase, _ as defaultPluginExport, a as pluginDirectory, b as analyzeModule, c as CheckerSource, d as queryDesignSystem, f as isStylesheet, g as PluginRuntime, h as loadEditorCssGraph, i as completePluginPaths, j as fileSourceKind, k as sourceKey, l as checkerId, m as loadCssGraph, n as cssEntrypoint, o as queryPluginPaths, p as lintsStylesheet, r as StylesheetEditor, s as EditorSnapshot, t as compilerOptions, u as withRequestedProbes, v as cssBannerPrefix, w as formatReport, x as compileModule, y as finalizeCss } from "./options-Cc-SlJed.js";
|
|
2
2
|
import { createRequire, syncBuiltinESMExports } from "node:module";
|
|
3
3
|
import { NativeProjectSession, fingerprint } from "@stillwind/native";
|
|
4
4
|
import path, { isAbsolute, relative, resolve } from "node:path";
|
|
@@ -3026,6 +3026,6 @@ var AnalysisWorkspace = class AnalysisWorkspace {
|
|
|
3026
3026
|
if (errors.length) throw new AggregateError(errors, "Failed to close Stillwind analysis hosts");
|
|
3027
3027
|
}
|
|
3028
3028
|
};
|
|
3029
|
-
export { AnalysisProject, AnalysisWorkspace, CompilationFailure, CompilationProject, EditorProject, EditorSnapshot, PluginRuntime, ResolutionMismatchError, TypeFactsError, TypeScriptFactsService, analyzeModule, attachPlugins, cleanModuleId, compileModule, compileWithPlugins, compilerModuleId, compilerOptions, composeCarrierSourceMap, composeFrameworkSourceMap, composeModuleSourceMap, createFileSystemAnalysisHost, createStylesheetResolver, cssEntrypoint, cssWithSourceMap, decodeCssSourceMap, defaultPluginExport, fileModuleDescriptor, fileSourceKind, finalizeCss, finalizeModuleWithMap, isStylesheet, lintsStylesheet, loadCssGraph, loadEditorCssGraph, moduleSourceMap, nodePluginHost, pluginLoader, queryDesignSystem, resolveTypeFactsEnvironment, startPhase, tracePhase, warnRejectedNames };
|
|
3029
|
+
export { AnalysisProject, AnalysisWorkspace, CompilationFailure, CompilationProject, EditorProject, EditorSnapshot, PluginRuntime, ResolutionMismatchError, TypeFactsError, TypeScriptFactsService, analyzeModule, attachPlugins, cleanModuleId, compileModule, compileWithPlugins, compilerModuleId, compilerOptions, composeCarrierSourceMap, composeFrameworkSourceMap, composeModuleSourceMap, createFileSystemAnalysisHost, createStylesheetResolver, cssEntrypoint, cssWithSourceMap, decodeCssSourceMap, defaultPluginExport, fileModuleDescriptor, fileSourceKind, finalizeCss, finalizeModuleWithMap, formatReport, isStylesheet, lintsStylesheet, loadCssGraph, loadEditorCssGraph, moduleSourceMap, nodePluginHost, pluginLoader, queryDesignSystem, resolveTypeFactsEnvironment, startPhase, tracePhase, warnRejectedNames };
|
|
3030
3030
|
|
|
3031
3031
|
//# sourceMappingURL=index.js.map
|
|
@@ -767,29 +767,49 @@ var CompilationFailure = class extends Error {
|
|
|
767
767
|
* @param cause - Optional preparation or checker failure that produced these reports.
|
|
768
768
|
*/
|
|
769
769
|
constructor(batches, cause) {
|
|
770
|
-
super(batches.flatMap((batch) => batch.reports).map(formatReport).join("\n"), { cause });
|
|
770
|
+
super(batches.flatMap((batch) => batch.reports).map((report) => formatReport(report)).join("\n"), { cause });
|
|
771
771
|
this.batches = batches;
|
|
772
772
|
}
|
|
773
773
|
};
|
|
774
774
|
/**
|
|
775
|
+
* Converts a `file://` URI to a readable filesystem path without requiring Node built-ins.
|
|
776
|
+
*
|
|
777
|
+
* @param uri - Source document URI or filesystem path.
|
|
778
|
+
* @returns Decoded filesystem path for `file://` URIs, or the original string otherwise.
|
|
779
|
+
*/
|
|
780
|
+
function displayUri(uri) {
|
|
781
|
+
if (!uri.startsWith("file://")) return uri;
|
|
782
|
+
try {
|
|
783
|
+
const pathname = decodeURIComponent(new URL(uri).pathname);
|
|
784
|
+
return /^\/[A-Za-z]:\//.test(pathname) ? pathname.slice(1) : pathname;
|
|
785
|
+
} catch {
|
|
786
|
+
return uri;
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
/**
|
|
775
790
|
* Formats a compiler report for an Error message or terminal output.
|
|
776
791
|
*
|
|
777
792
|
* @param report - Structured report with a primary label, related labels, and notes.
|
|
793
|
+
* @param options - `primaryLocation: false` omits the primary path and range, for hosts that
|
|
794
|
+
* display the primary location separately, such as the Vite error overlay.
|
|
778
795
|
* @returns Text with one-based line and column ranges for source labels, followed by related labels
|
|
779
|
-
* and notes. Document-scoped primary labels use only the
|
|
796
|
+
* and notes. Document-scoped primary labels use only the path.
|
|
780
797
|
*/
|
|
781
|
-
function formatReport(report) {
|
|
798
|
+
function formatReport(report, options = {}) {
|
|
782
799
|
const { location, scope } = report.primary;
|
|
783
|
-
const
|
|
784
|
-
const
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
800
|
+
const primaryPath = displayUri(location.uri);
|
|
801
|
+
const at = scope === "document" ? primaryPath : `${primaryPath}:${location.startLine + 1}:${location.startColumn + 1}-${location.endLine + 1}:${location.endColumn + 1}`;
|
|
802
|
+
const details = [
|
|
803
|
+
...report.primary.message ? [` note: ${report.primary.message}`] : [],
|
|
804
|
+
...report.related.map((label) => {
|
|
805
|
+
const loc = label.location;
|
|
806
|
+
const relatedPath = displayUri(loc.uri);
|
|
807
|
+
return ` related: ${label.scope === "document" ? relatedPath : `${relatedPath}:${loc.startLine + 1}:${loc.startColumn + 1}`}${label.message ? `: ${label.message}` : ""}`;
|
|
808
|
+
}),
|
|
809
|
+
...report.notes.map((note) => ` note: ${note}`)
|
|
810
|
+
];
|
|
811
|
+
const heading = `${report.code}: ${report.message}`;
|
|
812
|
+
return [options.primaryLocation === false ? heading : `${at}: ${heading}`, ...details].join("\n");
|
|
793
813
|
}
|
|
794
814
|
/** Collects prepared sources and semantic facts for one entry's demanded dependency graph. */
|
|
795
815
|
var ModuleGraph = class {
|
|
@@ -1610,7 +1630,7 @@ function warnRejectedNames(rejected, warn) {
|
|
|
1610
1630
|
function reportLintWarnings(output, host) {
|
|
1611
1631
|
for (const finding of output.lintFindings ?? []) {
|
|
1612
1632
|
if ((output.lintSettings?.[finding.rule] ?? "off") === "off") continue;
|
|
1613
|
-
host.warn(
|
|
1633
|
+
host.warn(`stillwind: ${finding.rule}: ${finding.message} (${displayUri(finding.uri)}:${finding.startLine + 1}:${finding.startColumn + 1})`);
|
|
1614
1634
|
}
|
|
1615
1635
|
}
|
|
1616
1636
|
/**
|
|
@@ -2677,9 +2697,10 @@ function patternExpression(target) {
|
|
|
2677
2697
|
* @returns Tokens that match, or every token for an empty target list, and unmatched targets.
|
|
2678
2698
|
*/
|
|
2679
2699
|
function theme(context, request) {
|
|
2680
|
-
const tokens = context.query.themeTokens().map(({ name, value, fallback, inline }) => ({
|
|
2700
|
+
const tokens = context.query.themeTokens().map(({ name, value, resolvedValue, fallback, inline }) => ({
|
|
2681
2701
|
name,
|
|
2682
2702
|
value,
|
|
2703
|
+
...resolvedValue ? { resolvedValue } : {},
|
|
2683
2704
|
source: fallback ? "default" : "project",
|
|
2684
2705
|
inline
|
|
2685
2706
|
})).filter(({ source }) => !request.source || source === request.source);
|
|
@@ -2704,14 +2725,14 @@ function theme(context, request) {
|
|
|
2704
2725
|
* @returns The candidate, with a suggestion when it is invalid.
|
|
2705
2726
|
* @throws If a matching utility definition is malformed.
|
|
2706
2727
|
*/
|
|
2707
|
-
function describe(query, candidates, annotations, name, kind) {
|
|
2728
|
+
function describe(query, candidates, annotations, name, kind, namesOnly) {
|
|
2708
2729
|
const css = kind === "variants" ? candidates.variant(name, "utility") : candidates.preview(name);
|
|
2709
2730
|
const marker = kind === "utilities" ? candidates.marker(name) : null;
|
|
2710
2731
|
if (css || marker) return {
|
|
2711
2732
|
name,
|
|
2712
2733
|
kind: kind === "variants" ? "variant" : marker ? "marker" : "utility",
|
|
2713
2734
|
valid: true,
|
|
2714
|
-
css: css ? query.formatCss(css, annotations) : ""
|
|
2735
|
+
css: !namesOnly && css ? query.formatCss(css, annotations) : ""
|
|
2715
2736
|
};
|
|
2716
2737
|
const suggestion = kind === "variants" ? query.suggestCandidate(`${name}:flex`)?.replace(/:flex$/, "") : query.suggestCandidate(name);
|
|
2717
2738
|
return {
|
|
@@ -2744,7 +2765,7 @@ function canonicalSpelling(query, name, kind) {
|
|
|
2744
2765
|
* @throws If a plugin fails or a matching utility definition is malformed.
|
|
2745
2766
|
*/
|
|
2746
2767
|
async function candidates(context, request) {
|
|
2747
|
-
const { kind } = request;
|
|
2768
|
+
const { kind, namesOnly = false } = request;
|
|
2748
2769
|
const catalog = new CandidateQueries(context.query);
|
|
2749
2770
|
const targets = request.targets.length ? request.targets : ["*"];
|
|
2750
2771
|
const exact = targets.filter((target) => !isPattern(target));
|
|
@@ -2757,9 +2778,11 @@ async function candidates(context, request) {
|
|
|
2757
2778
|
const name = variant ? label.slice(0, -1) : label;
|
|
2758
2779
|
return variant === (kind === "variants") && !name.endsWith("-") && expression.test(name) ? [name] : [];
|
|
2759
2780
|
});
|
|
2781
|
+
const shapes = kind === "utilities" ? context.query.functionalUtilityPatterns(prefix).filter((shape) => expression.test(shape)) : [];
|
|
2760
2782
|
patterns.push({
|
|
2761
2783
|
target,
|
|
2762
|
-
names: [...new Set(names)].sort()
|
|
2784
|
+
names: [...new Set(names)].sort(),
|
|
2785
|
+
shapes: [...new Set(shapes)].sort()
|
|
2763
2786
|
});
|
|
2764
2787
|
}
|
|
2765
2788
|
const dynamic = [...exact, ...patterns.flatMap(({ names }) => names)].map((name) => kind === "variants" ? `${name}:` : name).filter((text) => context.query.dynamicCandidates(text).length > 0);
|
|
@@ -2768,26 +2791,43 @@ async function candidates(context, request) {
|
|
|
2768
2791
|
const seen = new Set(exact);
|
|
2769
2792
|
const listed = [];
|
|
2770
2793
|
const unmatched = [];
|
|
2771
|
-
for (const { target, names } of patterns) {
|
|
2794
|
+
for (const { target, names, shapes } of patterns) {
|
|
2772
2795
|
let matched = false;
|
|
2796
|
+
const entries = [];
|
|
2773
2797
|
for (const name of names) {
|
|
2774
2798
|
if (seen.has(name)) {
|
|
2775
2799
|
matched = true;
|
|
2776
2800
|
continue;
|
|
2777
2801
|
}
|
|
2778
|
-
const candidate = describe(query, queries, context.annotations, name, kind);
|
|
2802
|
+
const candidate = describe(query, queries, context.annotations, name, kind, namesOnly);
|
|
2779
2803
|
if (candidate.valid) {
|
|
2780
2804
|
matched = true;
|
|
2781
2805
|
seen.add(name);
|
|
2782
|
-
|
|
2806
|
+
entries.push(candidate);
|
|
2807
|
+
}
|
|
2808
|
+
}
|
|
2809
|
+
for (const shape of shapes) {
|
|
2810
|
+
if (seen.has(shape)) {
|
|
2811
|
+
matched = true;
|
|
2812
|
+
continue;
|
|
2783
2813
|
}
|
|
2814
|
+
matched = true;
|
|
2815
|
+
seen.add(shape);
|
|
2816
|
+
entries.push({
|
|
2817
|
+
name: shape,
|
|
2818
|
+
kind: "pattern",
|
|
2819
|
+
valid: true,
|
|
2820
|
+
css: ""
|
|
2821
|
+
});
|
|
2784
2822
|
}
|
|
2823
|
+
entries.sort((a, b) => a.name.localeCompare(b.name));
|
|
2824
|
+
listed.push(...entries);
|
|
2785
2825
|
if (!matched) unmatched.push(target);
|
|
2786
2826
|
}
|
|
2787
2827
|
return {
|
|
2788
2828
|
tokens: [],
|
|
2789
2829
|
candidates: [...exact.map((name) => {
|
|
2790
|
-
const candidate = describe(query, queries, context.annotations, name, kind);
|
|
2830
|
+
const candidate = describe(query, queries, context.annotations, name, kind, namesOnly);
|
|
2791
2831
|
const canonical = candidate.valid ? canonicalSpelling(query, name, kind) : void 0;
|
|
2792
2832
|
return canonical ? {
|
|
2793
2833
|
...candidate,
|
|
@@ -4650,13 +4690,18 @@ var SourceQueries = class {
|
|
|
4650
4690
|
const { literal, start, end, prefix } = input;
|
|
4651
4691
|
const native = this.#candidates.complete(literal.prefix + prefix, literal.context, request.snippets === true).filter(({ label, marker }) => literal.key ? !marker && label.endsWith(":") : marker || label.endsWith(":") || !literal.site || this.#preview(literal, label.slice(literal.prefix.length)));
|
|
4652
4692
|
const known = new Set(native.map(({ label }) => label));
|
|
4653
|
-
const catalog = literal.key ?
|
|
4693
|
+
const { names: catalog, incomplete } = literal.key ? {
|
|
4694
|
+
names: [],
|
|
4695
|
+
incomplete: false
|
|
4696
|
+
} : this.#catalogCompletions(literal.prefix + prefix, literal.context);
|
|
4697
|
+
if (incomplete) result.completionsIncomplete = true;
|
|
4654
4698
|
result.completions = [...native, ...catalog.filter((candidate) => !known.has(candidate)).map((label) => ({
|
|
4655
4699
|
label,
|
|
4656
4700
|
marker: false
|
|
4657
4701
|
}))].map(({ label: candidate, marker }) => {
|
|
4658
4702
|
const label = candidate.slice(literal.prefix.length);
|
|
4659
4703
|
const source = (text) => escapeContent(text, literal);
|
|
4704
|
+
const color = marker || candidate.endsWith(":") ? void 0 : this.#color(candidate);
|
|
4660
4705
|
return {
|
|
4661
4706
|
label,
|
|
4662
4707
|
candidate,
|
|
@@ -4666,6 +4711,7 @@ var SourceQueries = class {
|
|
|
4666
4711
|
end,
|
|
4667
4712
|
newText: escapeContent(label, literal),
|
|
4668
4713
|
...marker ? { marker } : {},
|
|
4714
|
+
...color ? { color } : {},
|
|
4669
4715
|
snippet: !request.snippets ? void 0 : marker && candidate.endsWith("/") ? markerModifierSnippet(label, source) : candidate.endsWith(":") ? completionSnippet(label, source) : void 0,
|
|
4670
4716
|
retrigger: candidate.endsWith(":") || candidate.endsWith("-")
|
|
4671
4717
|
};
|
|
@@ -4739,16 +4785,41 @@ var SourceQueries = class {
|
|
|
4739
4785
|
*
|
|
4740
4786
|
* @param text - Decoded partial candidate, including enclosing and written variants.
|
|
4741
4787
|
* @param context - Input role of the literal. Only utility roles complete catalog names.
|
|
4742
|
-
* @returns
|
|
4743
|
-
* utility, at most {@link CATALOG_COMPLETIONS} of them in catalog order.
|
|
4788
|
+
* @returns `names`: candidates with the written variants, for names that start with the
|
|
4789
|
+
* partial utility, at most {@link CATALOG_COMPLETIONS} of them in catalog order. `incomplete`:
|
|
4790
|
+
* whether more names matched than `names` lists.
|
|
4744
4791
|
*/
|
|
4745
4792
|
#catalogCompletions(text, context) {
|
|
4746
|
-
if (!this.#catalogContext(context)) return
|
|
4793
|
+
if (!this.#catalogContext(context)) return {
|
|
4794
|
+
names: [],
|
|
4795
|
+
incomplete: false
|
|
4796
|
+
};
|
|
4747
4797
|
const parts = segments(text, ":");
|
|
4748
4798
|
const partial = parts.pop();
|
|
4749
|
-
if (!partial) return
|
|
4799
|
+
if (!partial) return {
|
|
4800
|
+
names: [],
|
|
4801
|
+
incomplete: false
|
|
4802
|
+
};
|
|
4750
4803
|
const variants = parts.map((part) => `${part}:`).join("");
|
|
4751
|
-
|
|
4804
|
+
const matches = [.../* @__PURE__ */ new Set([...this.#catalog, ...this.#inputCatalogs.get(partial) ?? []])].filter((name) => name.startsWith(partial));
|
|
4805
|
+
return {
|
|
4806
|
+
names: matches.slice(0, CATALOG_COMPLETIONS).map((name) => variants + name),
|
|
4807
|
+
incomplete: matches.length > CATALOG_COMPLETIONS
|
|
4808
|
+
};
|
|
4809
|
+
}
|
|
4810
|
+
/**
|
|
4811
|
+
* Formats the concrete color of a color utility for a completion swatch.
|
|
4812
|
+
*
|
|
4813
|
+
* @param candidate - Full decoded candidate, including enclosing and written variants.
|
|
4814
|
+
* @returns `#rrggbb`, or `#rrggbbaa` below full opacity. Undefined for other candidates and for
|
|
4815
|
+
* colors that depend on the color scheme.
|
|
4816
|
+
* @throws If a matching utility definition has a malformed requirement.
|
|
4817
|
+
*/
|
|
4818
|
+
#color(candidate) {
|
|
4819
|
+
const components = this.#candidates.color(candidate);
|
|
4820
|
+
if (!components) return;
|
|
4821
|
+
const [red, green, blue, alpha] = components.map((value) => Math.round(Math.min(1, Math.max(0, value)) * 255).toString(16).padStart(2, "0"));
|
|
4822
|
+
return `#${red}${green}${blue}${alpha === "ff" ? "" : alpha}`;
|
|
4752
4823
|
}
|
|
4753
4824
|
/**
|
|
4754
4825
|
* Reports whether an input role completes plugin catalog names.
|
|
@@ -5516,6 +5587,6 @@ function compilerOptions(config) {
|
|
|
5516
5587
|
rootFontSize: resolved.rootFontSize
|
|
5517
5588
|
};
|
|
5518
5589
|
}
|
|
5519
|
-
export {
|
|
5590
|
+
export { cleanModuleId as A, CompilationFailure as C, CompilationProject as D, tracePhase as E, pluginLoader as F, prepareSourcePlugins as I, TypeFactsError as M, attachPlugins as N, ResolutionMismatchError as O, compileWithPlugins as P, warnRejectedNames as S, startPhase as T, defaultPluginExport as _, pluginDirectory as a, analyzeModule as b, CheckerSource as c, queryDesignSystem as d, isStylesheet as f, PluginRuntime as g, loadEditorCssGraph as h, completePluginPaths as i, fileSourceKind as j, sourceKey as k, checkerId as l, loadCssGraph as m, cssEntrypoint as n, queryPluginPaths as o, lintsStylesheet as p, StylesheetEditor as r, EditorSnapshot as s, compilerOptions as t, withRequestedProbes as u, cssBannerPrefix as v, formatReport as w, compileModule as x, finalizeCss as y };
|
|
5520
5591
|
|
|
5521
|
-
//# sourceMappingURL=options-
|
|
5592
|
+
//# sourceMappingURL=options-Cc-SlJed.js.map
|