@fusion.dev/helix-docs 0.177.1 → 0.178.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/catalog.d.ts CHANGED
@@ -62,6 +62,12 @@ export interface Element {
62
62
  cssProperties: ApiMember[];
63
63
  cssStates: ApiMember[];
64
64
  description: string;
65
+ /**
66
+ * The entry that registers the element, under the tier's package: the
67
+ * family's own, such as `filter-input`, or one of its own where the family's
68
+ * leaves it out, such as `filter-input/menu`.
69
+ */
70
+ entry: string;
65
71
  events: EventDoc[];
66
72
  label: string;
67
73
  methods: ApiMember[];
package/dist/catalog.js CHANGED
@@ -72,9 +72,28 @@ const examplesOf = (slug, declared, sources) => {
72
72
  };
73
73
  }));
74
74
  };
75
+ const entriesOf = (manifest) => {
76
+ const entries = new Map();
77
+ for (const module of manifest.modules ?? []) {
78
+ const entry = /^src\/(.+)\/index\.ts$/.exec(module.path ?? '')?.[1];
79
+ if (!entry) {
80
+ continue;
81
+ }
82
+ for (const exported of module.exports ?? []) {
83
+ const from = exported.declaration?.module?.replace(/\.[jt]s$/, '');
84
+ const held = from === undefined ? undefined : entries.get(from);
85
+ if (from !== undefined && (held === undefined || entry.length < held.length)) {
86
+ entries.set(from, entry);
87
+ }
88
+ }
89
+ }
90
+ return entries;
91
+ };
75
92
  export const catalog = (manifests, examples = []) => {
76
93
  const byFamily = new Map();
94
+ const entryOf = new Map();
77
95
  for (const manifest of manifests) {
96
+ const entries = entriesOf(manifest);
78
97
  for (const module of manifest.modules ?? []) {
79
98
  for (const declaration of module.declarations ?? []) {
80
99
  if (!declaration.tagName) {
@@ -85,6 +104,7 @@ export const catalog = (manifests, examples = []) => {
85
104
  continue;
86
105
  }
87
106
  byFamily.set(family, [...(byFamily.get(family) ?? []), declaration]);
107
+ entryOf.set(declaration, entries.get((module.path ?? '').replace(/\.[jt]s$/, '')) ?? family);
88
108
  }
89
109
  }
90
110
  }
@@ -105,6 +125,7 @@ export const catalog = (manifests, examples = []) => {
105
125
  cssProperties: members(entry.cssProperties),
106
126
  cssStates: members(entry.cssStates),
107
127
  description: entry.description ?? '',
128
+ entry: entryOf.get(entry) ?? slug,
108
129
  events: (entry.events ?? []).map((event) => ({
109
130
  description: event.description ?? '',
110
131
  name: event.name ?? '',