@stackone/malachite 2.38.0 → 2.40.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tailwindSheet.js","sources":["../src/tailwindSheet.ts"],"sourcesContent":["import tailwindCss from './tailwind.css?inline';\n\nlet tailwindSheet: CSSStyleSheet | null = null;\nlet tailwindSheetAttempted = false;\n\nconst ensureTailwindSheet = (): CSSStyleSheet | null => {\n if (tailwindSheet || tailwindSheetAttempted) {\n return tailwindSheet;\n }\n tailwindSheetAttempted = true;\n if (typeof CSSStyleSheet === 'undefined') {\n return null;\n }\n try {\n const sheet = new CSSStyleSheet();\n sheet.replaceSync(tailwindCss);\n tailwindSheet = sheet;\n } catch (error) {\n console.error('Failed to construct Tailwind stylesheet:', error);\n }\n return tailwindSheet;\n};\n\nconst FALLBACK_STYLE_ID = 'malachite-tailwind-style';\n\nconst adoptSheet = (root: ShadowRoot, sheet: CSSStyleSheet): boolean => {\n if (!('adoptedStyleSheets' in root)) {\n return false;\n }\n try {\n if (!root.adoptedStyleSheets.includes(sheet)) {\n root.adoptedStyleSheets = [...root.adoptedStyleSheets, sheet];\n }\n return true;\n } catch {\n return false;\n }\n};\n\nconst appendStyleTag = (root: ShadowRoot, css: string): void => {\n if (root.querySelector(`#${FALLBACK_STYLE_ID}`)) {\n return;\n }\n const style = document.createElement('style');\n style.id = FALLBACK_STYLE_ID;\n style.textContent = css;\n root.appendChild(style);\n};\n\n// Vite HMR: when tailwind.css changes, mutate the shared sheet in place so every\n// already-adopted shadow root picks up the new rules without a full reload.\nif (import.meta.hot) {\n import.meta.hot.accept('./tailwind.css?inline', (newModule) => {\n const next = (newModule as unknown as { default?: string } | undefined)?.default;\n if (next && tailwindSheet) {\n tailwindSheet.replaceSync(next);\n }\n });\n}\n\nexport const adoptTailwindSheet = (root: ShadowRoot): void => {\n const sheet = ensureTailwindSheet();\n if (!sheet || !adoptSheet(root, sheet)) {\n appendStyleTag(root, tailwindCss);\n }\n};\n"],"names":["tailwindSheet","tailwindSheetAttempted","ensureTailwindSheet","sheet","tailwindCss","error","FALLBACK_STYLE_ID","adoptSheet","root","appendStyleTag","css","style","adoptTailwindSheet"],"mappings":";AAEA,IAAIA,IAAsC,MACtCC,IAAyB;AAE7B,MAAMC,IAAsB,MAA4B;AACpD,MAAIF,KAAiBC;AACjB,WAAOD;AAGX,MADAC,IAAyB,IACrB,OAAO,gBAAkB;AACzB,WAAO;AAEX,MAAI;AACA,UAAME,IAAQ,IAAI,cAAA;AAClB,IAAAA,EAAM,YAAYC,CAAW,GAC7BJ,IAAgBG;AAAA,EACpB,SAASE,GAAO;AACZ,YAAQ,MAAM,4CAA4CA,CAAK;AAAA,EACnE;AACA,SAAOL;AACX,GAEMM,IAAoB,4BAEpBC,IAAa,CAACC,GAAkBL,MAAkC;AACpE,MAAI,EAAE,wBAAwBK;AAC1B,WAAO;AAEX,MAAI;AACA,WAAKA,EAAK,mBAAmB,SAASL,CAAK,MACvCK,EAAK,qBAAqB,CAAC,GAAGA,EAAK,oBAAoBL,CAAK,IAEzD;AAAA,EACX,QAAQ;AACJ,WAAO;AAAA,EACX;AACJ,GAEMM,IAAiB,CAACD,GAAkBE,MAAsB;AAC5D,MAAIF,EAAK,cAAc,IAAIF,CAAiB,EAAE;AAC1C;AAEJ,QAAMK,IAAQ,SAAS,cAAc,OAAO;AAC5C,EAAAA,EAAM,KAAKL,GACXK,EAAM,cAAcD,GACpBF,EAAK,YAAYG,CAAK;AAC1B,GAaaC,IAAqB,CAACJ,MAA2B;AAC1D,QAAML,IAAQD,EAAA;AACd,GAAI,CAACC,KAAS,CAACI,EAAWC,GAAML,CAAK,MACjCM,EAAeD,GAAMJ,CAAW;AAExC;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackone/malachite",
3
- "version": "2.38.0",
3
+ "version": "2.40.0",
4
4
  "description": "StackOne's themeable React component library — Shadow DOM isolated, scoped Tailwind, theme-token driven.",
5
5
  "license": "MIT",
6
6
  "author": "StackOne",