bejamas 0.6.0 → 0.6.1

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.
@@ -10,7 +10,7 @@ import { createMatchPath, loadConfig } from "tsconfig-paths";
10
10
  import { cosmiconfig } from "cosmiconfig";
11
11
  import ora from "ora";
12
12
  import { readdir } from "fs/promises";
13
- import { Project, SyntaxKind } from "ts-morph";
13
+ import { Node, Project, SyntaxKind } from "ts-morph";
14
14
 
15
15
  //#region \0rolldown/runtime.js
16
16
  var __create = Object.create;
@@ -9146,7 +9146,7 @@ const Result = import_postcss.default.Result;
9146
9146
  const Input = import_postcss.default.Input;
9147
9147
  const Rule = import_postcss.default.Rule;
9148
9148
  const Root = import_postcss.default.Root;
9149
- const Node = import_postcss.default.Node;
9149
+ const Node$1 = import_postcss.default.Node;
9150
9150
 
9151
9151
  //#endregion
9152
9152
  //#region ../create-config/src/style-css.ts
@@ -9713,6 +9713,7 @@ function parseJsDocMetadata(frontmatterCode) {
9713
9713
  continue;
9714
9714
  } else if (line.trim().startsWith("@figmaUrl")) meta.figmaUrl = line.replace("@figmaUrl", "").trim();
9715
9715
  else if (line.trim().startsWith("@figma")) meta.figmaUrl = line.replace("@figma", "").trim();
9716
+ else if (line.trim().startsWith("@dataSlotUrl")) meta.dataSlotUrl = line.replace("@dataSlotUrl", "").trim();
9716
9717
  else if (line.trim().startsWith("@usage")) {
9717
9718
  inUsage = true;
9718
9719
  continue;
@@ -9799,20 +9800,60 @@ function extractPropsFromDeclaredProps(sourceFile) {
9799
9800
  optional: prop.hasQuestionToken()
9800
9801
  };
9801
9802
  });
9802
- const typeAlias = sourceFile.getTypeAlias("Props");
9803
- if (typeAlias) {
9804
- const typeNode = typeAlias.getTypeNode();
9805
- if (typeNode && typeNode.getKind() === SyntaxKind.TypeLiteral) return typeNode.asKindOrThrow(SyntaxKind.TypeLiteral).getProperties().map((prop) => {
9806
- const name = prop.getName();
9807
- const tn = prop.getTypeNode();
9808
- return {
9809
- name,
9810
- type: normalizeTypeText(tn ? tn.getText() : prop.getType().getText()),
9811
- optional: prop.hasQuestionToken()
9812
- };
9813
- });
9814
- }
9815
- return [];
9803
+ const fromProperties = (properties) => properties.map((prop) => {
9804
+ const tn = prop.getTypeNode();
9805
+ const rawType = tn ? tn.getText() : prop.getType().getText();
9806
+ return {
9807
+ name: prop.getName(),
9808
+ type: normalizeTypeText(rawType),
9809
+ optional: prop.hasQuestionToken()
9810
+ };
9811
+ });
9812
+ const intersect = (parts) => {
9813
+ const merged = /* @__PURE__ */ new Map();
9814
+ for (const prop of parts.flat()) {
9815
+ const existing = merged.get(prop.name);
9816
+ if (existing) existing.optional &&= prop.optional;
9817
+ else merged.set(prop.name, { ...prop });
9818
+ }
9819
+ return [...merged.values()];
9820
+ };
9821
+ const unite = (members) => {
9822
+ const merged = /* @__PURE__ */ new Map();
9823
+ for (const prop of members.flat()) {
9824
+ const existing = merged.get(prop.name);
9825
+ if (existing) {
9826
+ existing.optional ||= prop.optional;
9827
+ if (!existing.types.includes(prop.type)) existing.types.push(prop.type);
9828
+ } else merged.set(prop.name, {
9829
+ ...prop,
9830
+ types: [prop.type]
9831
+ });
9832
+ }
9833
+ return [...merged.values()].map(({ types, ...prop }) => ({
9834
+ ...prop,
9835
+ type: types.join(" | "),
9836
+ optional: prop.optional || members.some((member) => !member.some((p) => p.name === prop.name))
9837
+ }));
9838
+ };
9839
+ const collect = (node, seen) => {
9840
+ if (Node.isTypeLiteral(node)) return fromProperties(node.getProperties());
9841
+ if (Node.isParenthesizedTypeNode(node)) return collect(node.getTypeNode(), seen);
9842
+ if (Node.isIntersectionTypeNode(node)) return intersect(node.getTypeNodes().map((n) => collect(n, seen)));
9843
+ if (Node.isUnionTypeNode(node)) return unite(node.getTypeNodes().map((n) => collect(n, seen)));
9844
+ if (Node.isTypeReference(node)) {
9845
+ const name = node.getTypeName().getText();
9846
+ if (seen.has(name)) return [];
9847
+ const next = new Set(seen).add(name);
9848
+ const alias = sourceFile.getTypeAlias(name)?.getTypeNode();
9849
+ if (alias) return collect(alias, next);
9850
+ const localIface = sourceFile.getInterface(name);
9851
+ if (localIface) return fromProperties(localIface.getProperties());
9852
+ }
9853
+ return [];
9854
+ };
9855
+ const typeNode = sourceFile.getTypeAlias("Props")?.getTypeNode();
9856
+ return typeNode ? collect(typeNode, /* @__PURE__ */ new Set(["Props"])) : [];
9816
9857
  }
9817
9858
  function resolveUiRoot(cwd) {
9818
9859
  const require = createRequire$1(import.meta.url);
@@ -9906,4 +9947,4 @@ function createSourceFileFromFrontmatter(frontmatterCode) {
9906
9947
 
9907
9948
  //#endregion
9908
9949
  export { PRESET_MENU_COLORS as $, SEMANTIC_ICON_NAMES as A, getFontValue as B, BEJAMAS_COMPONENTS_SCHEMA_URL as C, ICON_LIBRARIES as D, resolveRegistryUrl as E, RTL_LANGUAGE_VALUES as F, normalizeDesignSystemConfig as G, getRadiusValue as H, designSystemConfigSchema as I, PRESET_CHART_COLORS as J, DEFAULT_PRESET_CONFIG as K, getDocumentDirection as L, getSemanticIconNameFromLucidePath as M, renderSemanticIconSvgWithAttributeString as N, buildRegistryTheme as O, DEFAULT_DESIGN_SYSTEM_CONFIG as P, PRESET_MENU_ACCENTS as Q, getDocumentLanguage as R, highlighter as S, buildUiUrl as T, getStyleDefaultRadius as U, getHeadingFontValue as V, getStyleId as W, PRESET_FONT_HEADINGS as X, PRESET_FONTS as Y, PRESET_ICON_LIBRARIES as Z, findCommonRoot as _, extractComponentTagsFromMDX as a, encodePreset as at, getProjectInfo as b, extractPropsFromDeclaredProps as c, __require as ct, parseJsDocMetadata as d, PRESET_RADII as et, resolveOutDir as f, spinner as g, toIdentifier as h, discoverExamples as i, decodePreset as it, getSemanticIconNameFromLucideExport as j, ICON_LIBRARY_COLLECTIONS as k, normalizeBlockMDX as l, slugify as m, createSourceFileFromFrontmatter as n, PRESET_THEMES as nt, extractFrontmatter as o, isPresetCode as ot, resolveUiRoot as p, PRESET_BASE_COLORS as q, detectHasImportTopLevel as r, V1_CHART_COLOR_MAP as rt, extractPropsFromAstroProps as s, fonts as st, RESERVED_COMPONENTS as t, PRESET_STYLES as tt, normalizeUsageMDX as u, getConfig as v, BASE_COLORS as w, logger as x, getWorkspaceConfig as y, getFontPackageName as z };
9909
- //# sourceMappingURL=utils-Dmd3Tydo.js.map
9950
+ //# sourceMappingURL=utils-BpBN6-Y9.js.map