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