@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.js CHANGED
@@ -11313,7 +11313,10 @@ var modalDirective = ({ props, renderSlot }) => {
11313
11313
  const dialog = createModal(modalTitle);
11314
11314
  const body = dialog.querySelector(".nr-modal__body");
11315
11315
  if (body) {
11316
- body.appendChild(renderSlot("default"));
11316
+ const prose = document.createElement("div");
11317
+ prose.className = "nr-prose";
11318
+ prose.appendChild(renderSlot("default"));
11319
+ body.appendChild(prose);
11317
11320
  }
11318
11321
  btn.addEventListener("click", () => {
11319
11322
  if (!dialog.open) {
@@ -11467,8 +11470,10 @@ var cardDirective = ({
11467
11470
  const dialog = createModal(title || "Detalles");
11468
11471
  const modalBody = dialog.querySelector(".nr-modal__body");
11469
11472
  if (modalBody) {
11470
- const contentSlot = renderSlot("content") || renderSlot("default");
11471
- modalBody.appendChild(contentSlot);
11473
+ const prose = document.createElement("div");
11474
+ prose.className = "nr-prose";
11475
+ prose.appendChild(renderSlot("content") || renderSlot("default"));
11476
+ modalBody.appendChild(prose);
11472
11477
  }
11473
11478
  card.addEventListener("click", () => {
11474
11479
  if (!dialog.open) {
@@ -11825,6 +11830,75 @@ function renderDirective(element, ctx, allElements) {
11825
11830
 
11826
11831
  // react/useTailwindCDN.ts
11827
11832
  import { useEffect, useRef } from "react";
11833
+
11834
+ // vanilla/tailwindTheme.ts
11835
+ var THEME_STYLE_ID = "nr-tailwind-theme";
11836
+ var NR_THEME_CSS = `
11837
+ @theme {
11838
+ --color-primary: var(--color-accent-primary, oklch(var(--p, 55% 0.3 240) / 1));
11839
+ --color-primary-content: #ffffff;
11840
+ --color-secondary: oklch(var(--s, 55% 0.25 200) / 1);
11841
+ --color-secondary-content: #ffffff;
11842
+ --color-accent: var(--color-accent-primary, oklch(var(--a, 65% 0.25 160) / 1));
11843
+ --color-accent-content: #ffffff;
11844
+ --color-neutral: oklch(var(--n, 50% 0.05 240) / 1);
11845
+ --color-neutral-content: var(--color-text-primary, oklch(var(--nc, 92% 0.02 240) / 1));
11846
+ --color-base-100: var(--color-background-primary, oklch(var(--b1, 15% 0.01 260) / 1));
11847
+ --color-base-200: var(--color-background-secondary-solid, oklch(var(--b2, 20% 0.02 260) / 1));
11848
+ --color-base-300: var(--color-border, oklch(var(--b3, 25% 0.03 260) / 1));
11849
+ --color-base-content: var(--color-text-primary, oklch(var(--bc, 92% 0.02 260) / 1));
11850
+ --color-info: oklch(var(--in, 70% 0.2 220) / 1);
11851
+ --color-info-content: #ffffff;
11852
+ --color-success: oklch(var(--su, 65% 0.25 140) / 1);
11853
+ --color-success-content: #ffffff;
11854
+ --color-warning: oklch(var(--wa, 80% 0.25 80) / 1);
11855
+ --color-warning-content: #1f2937;
11856
+ --color-error: oklch(var(--er, 65% 0.3 30) / 1);
11857
+ --color-error-content: #ffffff;
11858
+ }
11859
+ `;
11860
+ function getVar(root, name) {
11861
+ return getComputedStyle(root).getPropertyValue(name).trim();
11862
+ }
11863
+ function stylesheetHasTheme() {
11864
+ for (const sheet of Array.from(document.styleSheets)) {
11865
+ let rules = null;
11866
+ try {
11867
+ rules = sheet.cssRules;
11868
+ } catch {
11869
+ continue;
11870
+ }
11871
+ if (!rules) continue;
11872
+ for (const rule of Array.from(rules)) {
11873
+ const css2 = rule.cssText || "";
11874
+ if (css2.includes("@theme") || css2.includes('@plugin "daisyui"')) return true;
11875
+ }
11876
+ }
11877
+ return false;
11878
+ }
11879
+ function hasHostTheme() {
11880
+ if (typeof window === "undefined" || typeof document === "undefined") return true;
11881
+ if (getVar(document.documentElement, "--color-primary")) return true;
11882
+ if (getVar(document.documentElement, "--color-base-100")) return true;
11883
+ if (document.body && (getVar(document.body, "--color-primary") || getVar(document.body, "--color-base-100"))) return true;
11884
+ return stylesheetHasTheme();
11885
+ }
11886
+ function injectNRTailwindTheme() {
11887
+ if (typeof document === "undefined") return;
11888
+ if (document.getElementById(THEME_STYLE_ID)) return;
11889
+ if (hasHostTheme()) return;
11890
+ const style = document.createElement("style");
11891
+ style.id = THEME_STYLE_ID;
11892
+ style.setAttribute("type", "text/tailwindcss");
11893
+ style.textContent = NR_THEME_CSS;
11894
+ document.head.appendChild(style);
11895
+ }
11896
+ function removeNRTailwindTheme() {
11897
+ if (typeof document === "undefined") return;
11898
+ document.getElementById(THEME_STYLE_ID)?.remove();
11899
+ }
11900
+
11901
+ // react/useTailwindCDN.ts
11828
11902
  var CDN_URL = "https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4";
11829
11903
  var SCRIPT_ID = "tailwind-cdn-v4-runtime";
11830
11904
  var CONFIG_ID = "tailwind-cdn-v4-config";
@@ -11844,6 +11918,7 @@ function useLazyTailwindCDN(enabled) {
11844
11918
  if ((window.__twCDNRefs ?? 0) <= 0) {
11845
11919
  document.getElementById(SCRIPT_ID)?.remove();
11846
11920
  document.getElementById(CONFIG_ID)?.remove();
11921
+ removeNRTailwindTheme();
11847
11922
  window.__twCDNRefs = 0;
11848
11923
  loadedRef.current = false;
11849
11924
  }
@@ -11856,6 +11931,7 @@ function useLazyTailwindCDN(enabled) {
11856
11931
  configScript.textContent = TAILWIND_CDN_CONFIG;
11857
11932
  document.head.appendChild(configScript);
11858
11933
  }
11934
+ injectNRTailwindTheme();
11859
11935
  if (!document.getElementById(SCRIPT_ID)) {
11860
11936
  const script = document.createElement("script");
11861
11937
  script.id = SCRIPT_ID;
@@ -11868,6 +11944,7 @@ function useLazyTailwindCDN(enabled) {
11868
11944
  if ((window.__twCDNRefs ?? 0) <= 0) {
11869
11945
  document.getElementById(SCRIPT_ID)?.remove();
11870
11946
  document.getElementById(CONFIG_ID)?.remove();
11947
+ removeNRTailwindTheme();
11871
11948
  window.__twCDNRefs = 0;
11872
11949
  loadedRef.current = false;
11873
11950
  }
@@ -11888,6 +11965,7 @@ function preloadTailwindCDN() {
11888
11965
  configScript.textContent = TAILWIND_CDN_CONFIG;
11889
11966
  document.head.appendChild(configScript);
11890
11967
  }
11968
+ injectNRTailwindTheme();
11891
11969
  const script = document.createElement("script");
11892
11970
  script.id = SCRIPT_ID;
11893
11971
  script.src = CDN_URL;