@stillwind/host 0.4.1 → 0.6.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/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-DAGqsQ8n.js";
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-BXbvCuG7.js";
2
2
  import { t as resolveVirtualModule } from "./resolution-BI5eZllL.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 { D as fileSourceKind, M as prepareSourcePlugins, O as TypeFactsError, S as analyzeModule, _ as loadEditorCssGraph, a as pluginDirectory, c as CheckerSource, d as CompilationProject, g as loadCssGraph, i as completePluginPaths, k as attachPlugins, l as checkerId, m as isStylesheet, n as cssEntrypoint, o as queryPluginPaths, p as queryDesignSystem, r as StylesheetEditor, s as EditorSnapshot, t as compilerOptions, u as withRequestedProbes, x as finalizeCss, y as defaultPluginExport } from "./options-BOutD9j7.js";
1
+ import { D as fileSourceKind, M as prepareSourcePlugins, O as TypeFactsError, S as analyzeModule, _ as loadEditorCssGraph, a as pluginDirectory, c as CheckerSource, d as CompilationProject, g as loadCssGraph, i as completePluginPaths, k as attachPlugins, l as checkerId, m as isStylesheet, n as cssEntrypoint, o as queryPluginPaths, p as queryDesignSystem, r as StylesheetEditor, s as EditorSnapshot, t as compilerOptions, u as withRequestedProbes, x as finalizeCss, y as defaultPluginExport } from "./options-yvOsPpQU.js";
2
2
  import { t as resolveVirtualModule } from "./resolution-C3cvLPzx.js";
3
3
  import { NativeProjectSession, fingerprint } from "@stillwind/native";
4
4
  import ts from "typescript-6";
@@ -59,6 +59,12 @@ interface EditorColor {
59
59
  blue: number;
60
60
  /** Effective opacity after utility modifiers, in the inclusive range 0..1. */
61
61
  alpha: number;
62
+ /**
63
+ * Color scheme whose `light-dark()` arguments produce this color. Absent when both schemes
64
+ * produce it. A light color is followed by a dark color with the same range, and neither
65
+ * accepts a color presentation.
66
+ */
67
+ scheme?: "light" | "dark";
62
68
  }
63
69
  /**
64
70
  * Requests address original document UTF-16 offsets, including incomplete candidate text.
@@ -943,4 +949,4 @@ declare class EditorSnapshot {
943
949
  query(id: string, request: EditorRequest): EditorResult | undefined;
944
950
  }
945
951
  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 };
946
- //# sourceMappingURL=index-DAGqsQ8n.d.ts.map
952
+ //# sourceMappingURL=index-BXbvCuG7.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-DAGqsQ8n.js";
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-BXbvCuG7.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";
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as compileWithPlugins, C as compileModule, D as fileSourceKind, E as cleanModuleId, M as prepareSourcePlugins, O as TypeFactsError, S as analyzeModule, T as CompilationFailure, _ as loadEditorCssGraph, a as pluginDirectory, b as cssBannerPrefix, c as CheckerSource, d as CompilationProject, f as sourceKey, g as loadCssGraph, h as lintsStylesheet, i as completePluginPaths, j as pluginLoader, k as attachPlugins, l as checkerId, m as isStylesheet, n as cssEntrypoint, o as queryPluginPaths, p as queryDesignSystem, r as StylesheetEditor, s as EditorSnapshot, t as compilerOptions, u as withRequestedProbes, v as PluginRuntime, w as warnRejectedNames, x as finalizeCss, y as defaultPluginExport } from "./options-BOutD9j7.js";
1
+ import { A as compileWithPlugins, C as compileModule, D as fileSourceKind, E as cleanModuleId, M as prepareSourcePlugins, O as TypeFactsError, S as analyzeModule, T as CompilationFailure, _ as loadEditorCssGraph, a as pluginDirectory, b as cssBannerPrefix, c as CheckerSource, d as CompilationProject, f as sourceKey, g as loadCssGraph, h as lintsStylesheet, i as completePluginPaths, j as pluginLoader, k as attachPlugins, l as checkerId, m as isStylesheet, n as cssEntrypoint, o as queryPluginPaths, p as queryDesignSystem, r as StylesheetEditor, s as EditorSnapshot, t as compilerOptions, u as withRequestedProbes, v as PluginRuntime, w as warnRejectedNames, x as finalizeCss, y as defaultPluginExport } from "./options-yvOsPpQU.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";
@@ -1925,6 +1925,18 @@ var CandidateQueries = class {
1925
1925
  color(candidate) {
1926
1926
  return this.#query.candidateColor(candidate) ?? void 0;
1927
1927
  }
1928
+ /**
1929
+ * Resolves a color utility's concrete colors in both color schemes against this query's theme.
1930
+ *
1931
+ * @param candidate - Full decoded ordinary utility candidate, including variants and modifiers.
1932
+ * @returns One color without a scheme, a light color followed by a dark color when
1933
+ * `light-dark()` selects different colors, or an empty array when the candidate is not a color
1934
+ * utility or has no unambiguous concrete color in either scheme.
1935
+ * @throws If a matching utility definition has a malformed requirement.
1936
+ */
1937
+ colors(candidate) {
1938
+ return this.#query.candidateColors(candidate);
1939
+ }
1928
1940
  };
1929
1941
  /**
1930
1942
  * Splits at delimiters outside brackets, parentheses, single or double quotes, and escapes.
@@ -4110,15 +4122,12 @@ var SourceQueries = class {
4110
4122
  if (request.kind === "colors") {
4111
4123
  result.colors = tokens.flatMap((token) => {
4112
4124
  if (!this.#colorInput(token.literal) || !this.#preview(token.literal, token.text)) return [];
4113
- const color = this.#candidates.color(token.literal.prefix + token.text);
4114
- return color ? [{
4125
+ return this.#candidates.colors(token.literal.prefix + token.text).map(({ scheme, ...color }) => ({
4115
4126
  start: token.start,
4116
4127
  end: token.end,
4117
- red: color[0],
4118
- green: color[1],
4119
- blue: color[2],
4120
- alpha: color[3]
4121
- }] : [];
4128
+ ...color,
4129
+ ...scheme ? { scheme } : {}
4130
+ }));
4122
4131
  });
4123
4132
  return result;
4124
4133
  }
@@ -4770,15 +4779,16 @@ var StylesheetEditor = class {
4770
4779
  links: []
4771
4780
  };
4772
4781
  if (request.kind === "colors" || request.kind === "colorPresentation") {
4773
- const colors = this.#query.stylesheetColors(this.#text).map((color) => ({
4782
+ const colors = this.#query.stylesheetColors(this.#text).map(({ scheme, ...color }) => ({
4774
4783
  ...color,
4775
4784
  start: this.#utf16(color.start),
4776
- end: this.#utf16(color.end)
4785
+ end: this.#utf16(color.end),
4786
+ ...scheme ? { scheme } : {}
4777
4787
  }));
4778
4788
  if (request.kind === "colors") result.colors = colors.map(({ candidate: _candidate, ...color }) => color);
4779
4789
  else {
4780
4790
  const color = colors.find((color) => color.start === request.start && color.end === request.end);
4781
- if (color) {
4791
+ if (color && !color.scheme) {
4782
4792
  const newText = color.candidate ? colorReplacement(color.candidate, "", request.color, new CandidateQueries(this.#query)) : cssColor(request.color);
4783
4793
  if (newText) result.edits = [{
4784
4794
  start: color.start,
@@ -4967,4 +4977,4 @@ function compilerOptions(config) {
4967
4977
  }
4968
4978
  export { compileWithPlugins as A, compileModule as C, fileSourceKind as D, cleanModuleId as E, prepareSourcePlugins as M, TypeFactsError as O, analyzeModule as S, CompilationFailure as T, loadEditorCssGraph as _, pluginDirectory as a, cssBannerPrefix as b, CheckerSource as c, CompilationProject as d, sourceKey as f, loadCssGraph as g, lintsStylesheet as h, completePluginPaths as i, pluginLoader as j, attachPlugins as k, checkerId as l, isStylesheet as m, cssEntrypoint as n, queryPluginPaths as o, queryDesignSystem as p, StylesheetEditor as r, EditorSnapshot as s, compilerOptions as t, withRequestedProbes as u, PluginRuntime as v, warnRejectedNames as w, finalizeCss as x, defaultPluginExport as y };
4969
4979
 
4970
- //# sourceMappingURL=options-BOutD9j7.js.map
4980
+ //# sourceMappingURL=options-yvOsPpQU.js.map