radiant-docs 0.1.21 → 0.1.22

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "radiant-docs",
3
- "version": "0.1.21",
3
+ "version": "0.1.22",
4
4
  "description": "CLI tool for previewing Radiant documentation locally",
5
5
  "type": "module",
6
6
  "bin": {
@@ -103,9 +103,15 @@ import CodeTabEdge from "../ui/CodeTabEdge.astro";
103
103
  const filename =
104
104
  itemElement.getAttribute("data-rd-tab-filename") ??
105
105
  `file-name-${index + 1}.txt`;
106
+ const hideTabIcon =
107
+ itemElement.getAttribute("data-rd-tab-hide-icon") === "true";
106
108
  const tabIconTemplate = itemElement.querySelector(
107
109
  "template[data-rd-code-group-tab-icon]",
108
110
  );
111
+ const hasTabIcon =
112
+ !hideTabIcon &&
113
+ !!tabIconTemplate &&
114
+ tabIconTemplate.innerHTML.trim().length > 0;
109
115
 
110
116
  const tabWrapper = document.createElement("div");
111
117
  tabWrapper.className = "relative z-10 text-xs font-medium";
@@ -113,25 +119,25 @@ import CodeTabEdge from "../ui/CodeTabEdge.astro";
113
119
  const tabButton = document.createElement("button");
114
120
  tabButton.type = "button";
115
121
  tabButton.className =
116
- "relative inline-flex h-9 items-center gap-2 border-0 bg-transparent px-3 py-1.5 text-xs font-medium text-neutral-600 transition-colors duration-150 focus:outline-none focus-visible:outline-none cursor-pointer";
122
+ `relative inline-flex h-9 items-center border-0 bg-transparent px-3 py-1.5 text-xs font-medium text-neutral-600 transition-colors duration-150 focus:outline-none focus-visible:outline-none cursor-pointer ${hasTabIcon ? "gap-2" : ""}`;
117
123
  tabButton.setAttribute("aria-label", filename);
118
124
  tabButton.setAttribute("data-rd-code-group-tab", String(index));
119
125
 
120
- const iconContainer = document.createElement("span");
121
- iconContainer.className =
122
- "pointer-events-none inline-flex shrink-0 items-center rounded-[4px] transition-opacity duration-150";
123
-
124
- if (tabIconTemplate && tabIconTemplate.innerHTML.trim().length > 0) {
126
+ let iconContainer = null;
127
+ if (hasTabIcon) {
128
+ iconContainer = document.createElement("span");
129
+ iconContainer.className =
130
+ "pointer-events-none inline-flex shrink-0 items-center rounded-[4px] transition-opacity duration-150";
125
131
  iconContainer.innerHTML = tabIconTemplate.innerHTML;
126
- } else {
127
- iconContainer.classList.add("hidden");
128
132
  }
129
133
 
130
134
  const labelElement = document.createElement("span");
131
135
  labelElement.className = "whitespace-pre leading-none";
132
136
  labelElement.textContent = filename;
133
137
 
134
- tabButton.appendChild(iconContainer);
138
+ if (iconContainer) {
139
+ tabButton.appendChild(iconContainer);
140
+ }
135
141
  tabButton.appendChild(labelElement);
136
142
  tabWrapper.appendChild(tabButton);
137
143
  tabsElement.appendChild(tabWrapper);
@@ -169,7 +175,7 @@ import CodeTabEdge from "../ui/CodeTabEdge.astro";
169
175
  tabButton.classList.toggle("text-neutral-900", isActive);
170
176
  tabButton.classList.toggle("text-neutral-600", !isActive);
171
177
 
172
- if (iconContainer.classList.contains("hidden")) return;
178
+ if (!iconContainer) return;
173
179
  iconContainer.classList.toggle("opacity-100", isActive);
174
180
  iconContainer.classList.toggle("opacity-80", !isActive);
175
181
  });