inventive-ui 0.0.4 → 0.0.6

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/index.js CHANGED
@@ -190,7 +190,7 @@ var BANNER_COMPACT = [
190
190
  var FULL_BANNER_WIDTH = 101;
191
191
  function resolveCliVersion() {
192
192
  try {
193
- return true ? "0.0.4" : "1.0.0";
193
+ return true ? "0.0.6" : "1.0.0";
194
194
  } catch {
195
195
  return "1.0.0";
196
196
  }
@@ -1966,6 +1966,7 @@ var BUILD_BLOCK = ` /**
1966
1966
  packageSafelist: false,
1967
1967
  includeShadeMatrix: false,
1968
1968
  includeThemePresets: true,
1969
+ includeThemeGrayScale: true,
1969
1970
  resolvePalettePatterns: true,
1970
1971
  includeArbitraryScan: true,
1971
1972
  writeFiles: false,
@@ -1978,6 +1979,7 @@ var BUILD_DEFAULT_ENTRIES = [
1978
1979
  ["packageSafelist", "false"],
1979
1980
  ["includeShadeMatrix", "false"],
1980
1981
  ["includeThemePresets", "true"],
1982
+ ["includeThemeGrayScale", "true"],
1981
1983
  ["resolvePalettePatterns", "true"],
1982
1984
  ["includeArbitraryScan", "true"],
1983
1985
  ["writeFiles", "false"],
@@ -5303,11 +5305,28 @@ function loadPublicSlotContract(cwd = process.cwd()) {
5303
5305
  return null;
5304
5306
  }
5305
5307
  }
5308
+ function slotRequiresPrefetch(entry) {
5309
+ if (entry.prefetch === true) return true;
5310
+ if (entry.prefetch === false) return false;
5311
+ if (entry.bootstrap === "sync") return true;
5312
+ return Array.isArray(entry.profile) && entry.profile.includes("critical");
5313
+ }
5306
5314
  function contractEntryToBootstrapPolicy(entry) {
5307
- if (entry.bootstrap === "sync" || Array.isArray(entry.profile) && entry.profile.includes("critical")) {
5308
- return "core";
5315
+ return slotRequiresPrefetch(entry) ? "core" : "optional";
5316
+ }
5317
+ function validateSlotPrefetchPolicy(entry) {
5318
+ const type = entry.type ?? "?";
5319
+ const requires = slotRequiresPrefetch(entry);
5320
+ if (requires && entry.prefetch === false) {
5321
+ return `slot "${type}" is core/critical but prefetch is false`;
5322
+ }
5323
+ if ((entry.bootstrap === "sync" || Array.isArray(entry.profile) && entry.profile.includes("critical")) && entry.prefetch !== true) {
5324
+ return `slot "${type}" must declare prefetch: true (sync/critical peer hub)`;
5325
+ }
5326
+ if (!requires && entry.prefetch === true) {
5327
+ return `slot "${type}" declares prefetch: true but is not sync/critical`;
5309
5328
  }
5310
- return "optional";
5329
+ return null;
5311
5330
  }
5312
5331
 
5313
5332
  // src/utils/slot-emitters.ts
@@ -5805,11 +5824,12 @@ function validateGeneratedSlotImports(cwd = process.cwd()) {
5805
5824
  );
5806
5825
  return issues.map((issue) => issue);
5807
5826
  }
5808
- function renderGetComponentExpr(emitter) {
5827
+ function renderGetComponentExpr(emitter, _slotPropsType = "unknown") {
5809
5828
  const access = emitter.lazyAccess.replace(/^\./, "").trim();
5810
5829
  const parts = access.split(".").filter(Boolean);
5811
5830
  const compName = emitter.componentName;
5812
5831
  if (parts.length === 0) {
5832
+ assertJsIdentifier(compName, "component export");
5813
5833
  return `resolveComponentExport(mod, ${JSON.stringify(compName)})`;
5814
5834
  }
5815
5835
  if (parts.length === 1) {
@@ -5824,7 +5844,11 @@ function renderGetComponentExpr(emitter) {
5824
5844
  for (const part of rest) {
5825
5845
  assertJsIdentifier(part, "component export member");
5826
5846
  }
5827
- const rootExpr = root === "default" ? "resolveComponentExport(mod, " + JSON.stringify(compName) + ")" : `resolveComponentExport(mod, ${JSON.stringify(root)})`;
5847
+ const rootName = root === "default" ? compName : root;
5848
+ if (rest.length === 1) {
5849
+ return `resolveComponentExport(mod, ${JSON.stringify(rootName)}, ${JSON.stringify(rest[0])})`;
5850
+ }
5851
+ const rootExpr = `resolveComponentExport(mod, ${JSON.stringify(rootName)})`;
5828
5852
  return `${rootExpr}?.${rest.join(".")}`;
5829
5853
  }
5830
5854
  function writeComponentSlotFiles(cwd = process.cwd()) {
@@ -5855,6 +5879,16 @@ function writeComponentSlotFiles(cwd = process.cwd()) {
5855
5879
  cwd
5856
5880
  );
5857
5881
  generationIssues.push(...emitterIssues.map((issue) => `- ${issue}`));
5882
+ const contract = loadPublicSlotContract(cwd);
5883
+ if (contract) {
5884
+ for (const entry of contract.slots ?? []) {
5885
+ if (!entry.public) continue;
5886
+ const prefetchError = validateSlotPrefetchPolicy(entry);
5887
+ if (prefetchError) {
5888
+ generationIssues.push(prefetchError);
5889
+ }
5890
+ }
5891
+ }
5858
5892
  const slotPolicy = loadSlotBootstrapPolicy(cwd);
5859
5893
  const coreEmitters = [];
5860
5894
  const optionalEmitters = [];
@@ -5960,7 +5994,7 @@ function renderGroupedSlotFileContent(emitters, options = {}) {
5960
5994
  const renderer = `${alias}Renderer`;
5961
5995
  lines.push(`const ${renderer} = createEagerComponent<${alias}SlotProps>(`);
5962
5996
  lines.push(` () => import(${escapeTsStringLiteral(emitter.lazyImportSpecifier)}),`);
5963
- lines.push(` (mod) => ${renderGetComponentExpr(emitter)} as React.ComponentType<${alias}SlotProps>,`);
5997
+ lines.push(` (mod) => ${renderGetComponentExpr(emitter, `${alias}SlotProps`)} as React.ComponentType<${alias}SlotProps>,`);
5964
5998
  if (options.prefetch) {
5965
5999
  lines.push(" { prefetch: true },");
5966
6000
  }
@@ -7795,6 +7829,11 @@ function checkCompileFirstReadiness(cwd = process.cwd(), _options = {}) {
7795
7829
  if (!/includeThemePresets\s*:\s*true/.test(configContent)) {
7796
7830
  warnings.push("iui.config.ts build.includeThemePresets should be true");
7797
7831
  }
7832
+ if (!/includeThemeGrayScale\s*:\s*true/.test(configContent)) {
7833
+ warnings.push(
7834
+ "iui.config.ts build.includeThemeGrayScale should be true (pre-expand theme gray gray-2\u202698 utilities)"
7835
+ );
7836
+ }
7798
7837
  if (!/resolvePalettePatterns\s*:\s*true/.test(configContent)) {
7799
7838
  warnings.push("iui.config.ts build.resolvePalettePatterns should be true");
7800
7839
  }
@@ -8589,7 +8628,7 @@ async function updateCommand(opts = {}) {
8589
8628
  const auth = await ensureAuthSession();
8590
8629
  await ensureLicenseSession();
8591
8630
  const inProject = isInsideProject();
8592
- const currentCliVersion = true ? "0.0.4" : "unknown";
8631
+ const currentCliVersion = true ? "0.0.6" : "unknown";
8593
8632
  const latestCliVersion = await fetchLatestCliVersion(auth.token);
8594
8633
  const cliUpdateAvailable = latestCliVersion !== null && isVersionGreater(latestCliVersion, currentCliVersion);
8595
8634
  if (latestCliVersion && cliUpdateAvailable) {
@@ -8871,7 +8910,7 @@ var AUTH_EXEMPT_COMMANDS = /* @__PURE__ */ new Set([
8871
8910
  "doctor",
8872
8911
  "list"
8873
8912
  ]);
8874
- program.name("iui").description("The official CLI for the Inventive UI Design System").version(true ? "0.0.4" : "1.0.0").option("-C, --cwd <dir>", "Run as if started in the given directory").option("-q, --quiet", "Minimal output (also respects IUI_QUIET=1)").option("--no-color", "Disable ANSI colors");
8913
+ program.name("iui").description("The official CLI for the Inventive UI Design System").version(true ? "0.0.6" : "1.0.0").option("-C, --cwd <dir>", "Run as if started in the given directory").option("-q, --quiet", "Minimal output (also respects IUI_QUIET=1)").option("--no-color", "Disable ANSI colors");
8875
8914
  program.command("login").description("Authenticate with GitHub and link your license").option("-f, --force", "Force re-authentication and register this device").option("--bootstrap", "After login, run optional setup prompts").action((opts) => loginCommand(opts));
8876
8915
  program.command("logout").description("Remove stored credentials").action(logoutCommand);
8877
8916
  program.command("whoami").description("Show authenticated identity and license details").action(whoamiCommand);