@noirmd/previewer 2.0.0 → 2.0.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.
package/dist/react.cjs CHANGED
@@ -11333,7 +11333,10 @@ var modalDirective = ({ props, renderSlot }) => {
11333
11333
  const dialog = createModal(modalTitle);
11334
11334
  const body = dialog.querySelector(".nr-modal__body");
11335
11335
  if (body) {
11336
- body.appendChild(renderSlot("default"));
11336
+ const prose = document.createElement("div");
11337
+ prose.className = "nr-prose";
11338
+ prose.appendChild(renderSlot("default"));
11339
+ body.appendChild(prose);
11337
11340
  }
11338
11341
  btn.addEventListener("click", () => {
11339
11342
  if (!dialog.open) {
@@ -11487,8 +11490,10 @@ var cardDirective = ({
11487
11490
  const dialog = createModal(title || "Detalles");
11488
11491
  const modalBody = dialog.querySelector(".nr-modal__body");
11489
11492
  if (modalBody) {
11490
- const contentSlot = renderSlot("content") || renderSlot("default");
11491
- modalBody.appendChild(contentSlot);
11493
+ const prose = document.createElement("div");
11494
+ prose.className = "nr-prose";
11495
+ prose.appendChild(renderSlot("content") || renderSlot("default"));
11496
+ modalBody.appendChild(prose);
11492
11497
  }
11493
11498
  card.addEventListener("click", () => {
11494
11499
  if (!dialog.open) {
@@ -11845,6 +11850,75 @@ function renderDirective(element, ctx, allElements) {
11845
11850
 
11846
11851
  // react/useTailwindCDN.ts
11847
11852
  var import_react = require("react");
11853
+
11854
+ // vanilla/tailwindTheme.ts
11855
+ var THEME_STYLE_ID = "nr-tailwind-theme";
11856
+ var NR_THEME_CSS = `
11857
+ @theme {
11858
+ --color-primary: var(--color-accent-primary, oklch(var(--p, 55% 0.3 240) / 1));
11859
+ --color-primary-content: #ffffff;
11860
+ --color-secondary: oklch(var(--s, 55% 0.25 200) / 1);
11861
+ --color-secondary-content: #ffffff;
11862
+ --color-accent: var(--color-accent-primary, oklch(var(--a, 65% 0.25 160) / 1));
11863
+ --color-accent-content: #ffffff;
11864
+ --color-neutral: oklch(var(--n, 50% 0.05 240) / 1);
11865
+ --color-neutral-content: var(--color-text-primary, oklch(var(--nc, 92% 0.02 240) / 1));
11866
+ --color-base-100: var(--color-background-primary, oklch(var(--b1, 15% 0.01 260) / 1));
11867
+ --color-base-200: var(--color-background-secondary-solid, oklch(var(--b2, 20% 0.02 260) / 1));
11868
+ --color-base-300: var(--color-border, oklch(var(--b3, 25% 0.03 260) / 1));
11869
+ --color-base-content: var(--color-text-primary, oklch(var(--bc, 92% 0.02 260) / 1));
11870
+ --color-info: oklch(var(--in, 70% 0.2 220) / 1);
11871
+ --color-info-content: #ffffff;
11872
+ --color-success: oklch(var(--su, 65% 0.25 140) / 1);
11873
+ --color-success-content: #ffffff;
11874
+ --color-warning: oklch(var(--wa, 80% 0.25 80) / 1);
11875
+ --color-warning-content: #1f2937;
11876
+ --color-error: oklch(var(--er, 65% 0.3 30) / 1);
11877
+ --color-error-content: #ffffff;
11878
+ }
11879
+ `;
11880
+ function getVar(root, name) {
11881
+ return getComputedStyle(root).getPropertyValue(name).trim();
11882
+ }
11883
+ function stylesheetHasTheme() {
11884
+ for (const sheet of Array.from(document.styleSheets)) {
11885
+ let rules = null;
11886
+ try {
11887
+ rules = sheet.cssRules;
11888
+ } catch {
11889
+ continue;
11890
+ }
11891
+ if (!rules) continue;
11892
+ for (const rule of Array.from(rules)) {
11893
+ const css2 = rule.cssText || "";
11894
+ if (css2.includes("@theme") || css2.includes('@plugin "daisyui"')) return true;
11895
+ }
11896
+ }
11897
+ return false;
11898
+ }
11899
+ function hasHostTheme() {
11900
+ if (typeof window === "undefined" || typeof document === "undefined") return true;
11901
+ if (getVar(document.documentElement, "--color-primary")) return true;
11902
+ if (getVar(document.documentElement, "--color-base-100")) return true;
11903
+ if (document.body && (getVar(document.body, "--color-primary") || getVar(document.body, "--color-base-100"))) return true;
11904
+ return stylesheetHasTheme();
11905
+ }
11906
+ function injectNRTailwindTheme() {
11907
+ if (typeof document === "undefined") return;
11908
+ if (document.getElementById(THEME_STYLE_ID)) return;
11909
+ if (hasHostTheme()) return;
11910
+ const style = document.createElement("style");
11911
+ style.id = THEME_STYLE_ID;
11912
+ style.setAttribute("type", "text/tailwindcss");
11913
+ style.textContent = NR_THEME_CSS;
11914
+ document.head.appendChild(style);
11915
+ }
11916
+ function removeNRTailwindTheme() {
11917
+ if (typeof document === "undefined") return;
11918
+ document.getElementById(THEME_STYLE_ID)?.remove();
11919
+ }
11920
+
11921
+ // react/useTailwindCDN.ts
11848
11922
  var CDN_URL = "https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4";
11849
11923
  var SCRIPT_ID = "tailwind-cdn-v4-runtime";
11850
11924
  var CONFIG_ID = "tailwind-cdn-v4-config";
@@ -11864,6 +11938,7 @@ function useLazyTailwindCDN(enabled) {
11864
11938
  if ((window.__twCDNRefs ?? 0) <= 0) {
11865
11939
  document.getElementById(SCRIPT_ID)?.remove();
11866
11940
  document.getElementById(CONFIG_ID)?.remove();
11941
+ removeNRTailwindTheme();
11867
11942
  window.__twCDNRefs = 0;
11868
11943
  loadedRef.current = false;
11869
11944
  }
@@ -11876,6 +11951,7 @@ function useLazyTailwindCDN(enabled) {
11876
11951
  configScript.textContent = TAILWIND_CDN_CONFIG;
11877
11952
  document.head.appendChild(configScript);
11878
11953
  }
11954
+ injectNRTailwindTheme();
11879
11955
  if (!document.getElementById(SCRIPT_ID)) {
11880
11956
  const script = document.createElement("script");
11881
11957
  script.id = SCRIPT_ID;
@@ -11888,6 +11964,7 @@ function useLazyTailwindCDN(enabled) {
11888
11964
  if ((window.__twCDNRefs ?? 0) <= 0) {
11889
11965
  document.getElementById(SCRIPT_ID)?.remove();
11890
11966
  document.getElementById(CONFIG_ID)?.remove();
11967
+ removeNRTailwindTheme();
11891
11968
  window.__twCDNRefs = 0;
11892
11969
  loadedRef.current = false;
11893
11970
  }
@@ -11908,6 +11985,7 @@ function preloadTailwindCDN() {
11908
11985
  configScript.textContent = TAILWIND_CDN_CONFIG;
11909
11986
  document.head.appendChild(configScript);
11910
11987
  }
11988
+ injectNRTailwindTheme();
11911
11989
  const script = document.createElement("script");
11912
11990
  script.id = SCRIPT_ID;
11913
11991
  script.src = CDN_URL;