@griffel/react 1.5.20 → 1.5.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.
Files changed (65) hide show
  1. package/README.md +4 -164
  2. package/RendererContext.cjs.js +8 -8
  3. package/RendererContext.cjs.js.map +1 -1
  4. package/RendererContext.esm.js +10 -8
  5. package/RendererContext.esm.js.map +1 -1
  6. package/TextDirectionContext.cjs.js +8 -8
  7. package/TextDirectionContext.cjs.js.map +1 -1
  8. package/TextDirectionContext.esm.js +10 -8
  9. package/TextDirectionContext.esm.js.map +1 -1
  10. package/__css.cjs.js +4 -4
  11. package/__css.cjs.js.map +1 -1
  12. package/__css.esm.js +4 -4
  13. package/__css.esm.js.map +1 -1
  14. package/__resetCSS.cjs.js +4 -4
  15. package/__resetCSS.cjs.js.map +1 -1
  16. package/__resetCSS.esm.js +4 -4
  17. package/__resetCSS.esm.js.map +1 -1
  18. package/__resetStyles.cjs.js +4 -4
  19. package/__resetStyles.cjs.js.map +1 -1
  20. package/__resetStyles.esm.js +4 -4
  21. package/__resetStyles.esm.js.map +1 -1
  22. package/__styles.cjs.js +4 -4
  23. package/__styles.cjs.js.map +1 -1
  24. package/__styles.esm.js +4 -4
  25. package/__styles.esm.js.map +1 -1
  26. package/index.cjs.d.ts +1 -0
  27. package/index.cjs.js +4 -0
  28. package/index.cjs.js.map +1 -1
  29. package/index.esm.js +1 -1
  30. package/insertionFactory.cjs.js.map +1 -1
  31. package/insertionFactory.esm.js.map +1 -1
  32. package/makeResetStyles.cjs.js.map +1 -1
  33. package/makeResetStyles.esm.js.map +1 -1
  34. package/makeStaticStyles.cjs.js.map +1 -1
  35. package/makeStaticStyles.esm.js.map +1 -1
  36. package/makeStyles.cjs.js.map +1 -1
  37. package/makeStyles.esm.js.map +1 -1
  38. package/package.json +3 -4
  39. package/renderToStyleElements.cjs.js +8 -10
  40. package/renderToStyleElements.cjs.js.map +1 -1
  41. package/renderToStyleElements.esm.js +8 -10
  42. package/renderToStyleElements.esm.js.map +1 -1
  43. package/src/RendererContext.d.ts +24 -24
  44. package/src/TextDirectionContext.d.ts +19 -19
  45. package/src/__css.d.ts +7 -7
  46. package/src/__resetCSS.d.ts +6 -6
  47. package/src/__resetStyles.d.ts +7 -7
  48. package/src/__styles.d.ts +7 -7
  49. package/src/index.d.ts +12 -12
  50. package/src/insertionFactory.d.ts +2 -2
  51. package/src/makeResetStyles.d.ts +2 -2
  52. package/src/makeStaticStyles.d.ts +2 -2
  53. package/src/makeStyles.d.ts +2 -2
  54. package/src/renderToStyleElements.d.ts +8 -8
  55. package/src/useInsertionEffect.d.ts +2 -2
  56. package/src/utils/canUseDOM.d.ts +4 -4
  57. package/src/utils/isInsideComponent.d.ts +1 -1
  58. package/useInsertionEffect.esm.js.map +1 -1
  59. package/utils/canUseDOM.cjs.js +2 -2
  60. package/utils/canUseDOM.cjs.js.map +1 -1
  61. package/utils/canUseDOM.esm.js +2 -2
  62. package/utils/canUseDOM.esm.js.map +1 -1
  63. package/utils/isInsideComponent.cjs.js.map +1 -1
  64. package/utils/isInsideComponent.esm.js +2 -0
  65. package/utils/isInsideComponent.esm.js.map +1 -1
package/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- export { createDOMRenderer, mergeClasses, shorthands } from '@griffel/core';
1
+ export { RESET, createDOMRenderer, mergeClasses, shorthands } from '@griffel/core';
2
2
  export { makeStyles } from './makeStyles.esm.js';
3
3
  export { makeResetStyles } from './makeResetStyles.esm.js';
4
4
  export { makeStaticStyles } from './makeStaticStyles.esm.js';
@@ -1 +1 @@
1
- {"version":3,"file":"insertionFactory.cjs.js","sources":["../../../packages/react/src/insertionFactory.ts"],"sourcesContent":["import type { CSSRulesByBucket, GriffelInsertionFactory, GriffelRenderer } from '@griffel/core';\n\nimport { canUseDOM } from './utils/canUseDOM';\nimport { useInsertionEffect } from './useInsertionEffect';\n\nexport const insertionFactory: GriffelInsertionFactory = () => {\n const insertionCache: Record<string, boolean> = {};\n\n return function insert(renderer: GriffelRenderer, cssRules: CSSRulesByBucket) {\n // Even if `useInsertionEffect` is available, we can use it on a client only as it will not be executed in SSR\n if (useInsertionEffect && canUseDOM()) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useInsertionEffect(() => {\n renderer.insertCSSRules(cssRules!);\n }, [renderer, cssRules]);\n\n return;\n }\n\n if (insertionCache[renderer.id] === undefined) {\n renderer.insertCSSRules(cssRules!);\n insertionCache[renderer.id] = true;\n }\n };\n};\n"],"names":["insertionFactory","insertionCache","insert","renderer","cssRules","useInsertionEffect","canUseDOM","insertCSSRules","id","undefined"],"mappings":";;;;;;;MAKaA,gBAAgB,GAA4BA;EACvD,MAAMC,cAAc,GAA4B,EAAE;EAElD,OAAO,SAASC,MAAMA,CAACC,QAAyB,EAAEC,QAA0B;;IAE1E,IAAIC,qCAAkB,IAAIC,mBAAS,EAAE,EAAE;;MAErCD,qCAAkB,CAAC;QACjBF,QAAQ,CAACI,cAAc,CAACH,QAAS,CAAC;OACnC,EAAE,CAACD,QAAQ,EAAEC,QAAQ,CAAC,CAAC;MAExB;;IAGF,IAAIH,cAAc,CAACE,QAAQ,CAACK,EAAE,CAAC,KAAKC,SAAS,EAAE;MAC7CN,QAAQ,CAACI,cAAc,CAACH,QAAS,CAAC;MAClCH,cAAc,CAACE,QAAQ,CAACK,EAAE,CAAC,GAAG,IAAI;;GAErC;AACH;;;;"}
1
+ {"version":3,"file":"insertionFactory.cjs.js","sources":["../../../packages/react/src/insertionFactory.ts"],"sourcesContent":["import type { CSSRulesByBucket, GriffelInsertionFactory, GriffelRenderer } from '@griffel/core';\n\nimport { canUseDOM } from './utils/canUseDOM';\nimport { useInsertionEffect } from './useInsertionEffect';\n\nexport const insertionFactory: GriffelInsertionFactory = () => {\n const insertionCache: Record<string, boolean> = {};\n\n return function insert(renderer: GriffelRenderer, cssRules: CSSRulesByBucket) {\n // Even if `useInsertionEffect` is available, we can use it on a client only as it will not be executed in SSR\n if (useInsertionEffect && canUseDOM()) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useInsertionEffect(() => {\n renderer.insertCSSRules(cssRules!);\n }, [renderer, cssRules]);\n\n return;\n }\n\n if (insertionCache[renderer.id] === undefined) {\n renderer.insertCSSRules(cssRules!);\n insertionCache[renderer.id] = true;\n }\n };\n};\n"],"names":["insertionFactory","insertionCache","insert","renderer","cssRules","useInsertionEffect","canUseDOM","insertCSSRules","id","undefined"],"mappings":";;;;;;;AAKaA,MAAAA,gBAAgB,GAA4BA,MAAK;EAC5D,MAAMC,cAAc,GAA4B,EAAE,CAAA;AAElD,EAAA,OAAO,SAASC,MAAMA,CAACC,QAAyB,EAAEC,QAA0B,EAAA;AAC1E;AACA,IAAA,IAAIC,qCAAkB,IAAIC,mBAAS,EAAE,EAAE;AACrC;AACAD,MAAAA,qCAAkB,CAAC,MAAK;AACtBF,QAAAA,QAAQ,CAACI,cAAc,CAACH,QAAS,CAAC,CAAA;AACpC,OAAC,EAAE,CAACD,QAAQ,EAAEC,QAAQ,CAAC,CAAC,CAAA;AAExB,MAAA,OAAA;AACD,KAAA;IAED,IAAIH,cAAc,CAACE,QAAQ,CAACK,EAAE,CAAC,KAAKC,SAAS,EAAE;AAC7CN,MAAAA,QAAQ,CAACI,cAAc,CAACH,QAAS,CAAC,CAAA;AAClCH,MAAAA,cAAc,CAACE,QAAQ,CAACK,EAAE,CAAC,GAAG,IAAI,CAAA;AACnC,KAAA;GACF,CAAA;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"insertionFactory.esm.js","sources":["../../../packages/react/src/insertionFactory.ts"],"sourcesContent":["import type { CSSRulesByBucket, GriffelInsertionFactory, GriffelRenderer } from '@griffel/core';\n\nimport { canUseDOM } from './utils/canUseDOM';\nimport { useInsertionEffect } from './useInsertionEffect';\n\nexport const insertionFactory: GriffelInsertionFactory = () => {\n const insertionCache: Record<string, boolean> = {};\n\n return function insert(renderer: GriffelRenderer, cssRules: CSSRulesByBucket) {\n // Even if `useInsertionEffect` is available, we can use it on a client only as it will not be executed in SSR\n if (useInsertionEffect && canUseDOM()) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useInsertionEffect(() => {\n renderer.insertCSSRules(cssRules!);\n }, [renderer, cssRules]);\n\n return;\n }\n\n if (insertionCache[renderer.id] === undefined) {\n renderer.insertCSSRules(cssRules!);\n insertionCache[renderer.id] = true;\n }\n };\n};\n"],"names":["insertionFactory","insertionCache","insert","renderer","cssRules","useInsertionEffect","canUseDOM","insertCSSRules","id","undefined"],"mappings":";;;MAKaA,gBAAgB,GAA4BA;EACvD,MAAMC,cAAc,GAA4B,EAAE;EAElD,OAAO,SAASC,MAAMA,CAACC,QAAyB,EAAEC,QAA0B;;IAE1E,IAAIC,kBAAkB,IAAIC,SAAS,EAAE,EAAE;;MAErCD,kBAAkB,CAAC;QACjBF,QAAQ,CAACI,cAAc,CAACH,QAAS,CAAC;OACnC,EAAE,CAACD,QAAQ,EAAEC,QAAQ,CAAC,CAAC;MAExB;;IAGF,IAAIH,cAAc,CAACE,QAAQ,CAACK,EAAE,CAAC,KAAKC,SAAS,EAAE;MAC7CN,QAAQ,CAACI,cAAc,CAACH,QAAS,CAAC;MAClCH,cAAc,CAACE,QAAQ,CAACK,EAAE,CAAC,GAAG,IAAI;;GAErC;AACH;;;;"}
1
+ {"version":3,"file":"insertionFactory.esm.js","sources":["../../../packages/react/src/insertionFactory.ts"],"sourcesContent":["import type { CSSRulesByBucket, GriffelInsertionFactory, GriffelRenderer } from '@griffel/core';\n\nimport { canUseDOM } from './utils/canUseDOM';\nimport { useInsertionEffect } from './useInsertionEffect';\n\nexport const insertionFactory: GriffelInsertionFactory = () => {\n const insertionCache: Record<string, boolean> = {};\n\n return function insert(renderer: GriffelRenderer, cssRules: CSSRulesByBucket) {\n // Even if `useInsertionEffect` is available, we can use it on a client only as it will not be executed in SSR\n if (useInsertionEffect && canUseDOM()) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useInsertionEffect(() => {\n renderer.insertCSSRules(cssRules!);\n }, [renderer, cssRules]);\n\n return;\n }\n\n if (insertionCache[renderer.id] === undefined) {\n renderer.insertCSSRules(cssRules!);\n insertionCache[renderer.id] = true;\n }\n };\n};\n"],"names":["insertionFactory","insertionCache","insert","renderer","cssRules","useInsertionEffect","canUseDOM","insertCSSRules","id","undefined"],"mappings":";;;AAKaA,MAAAA,gBAAyC,GAAGA,MAAM;EAC7D,MAAMC,cAAuC,GAAG,EAAE,CAAA;AAElD,EAAA,OAAO,SAASC,MAAMA,CAACC,QAAyB,EAAEC,QAA0B,EAAE;AAC5E;AACA,IAAA,IAAIC,kBAAkB,IAAIC,SAAS,EAAE,EAAE;AACrC;AACAD,MAAAA,kBAAkB,CAAC,MAAM;AACvBF,QAAAA,QAAQ,CAACI,cAAc,CAACH,QAAS,CAAC,CAAA;AACpC,OAAC,EAAE,CAACD,QAAQ,EAAEC,QAAQ,CAAC,CAAC,CAAA;AAExB,MAAA,OAAA;AACF,KAAA;IAEA,IAAIH,cAAc,CAACE,QAAQ,CAACK,EAAE,CAAC,KAAKC,SAAS,EAAE;AAC7CN,MAAAA,QAAQ,CAACI,cAAc,CAACH,QAAS,CAAC,CAAA;AAClCH,MAAAA,cAAc,CAACE,QAAQ,CAACK,EAAE,CAAC,GAAG,IAAI,CAAA;AACpC,KAAA;GACD,CAAA;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"makeResetStyles.cjs.js","sources":["../../../packages/react/src/makeResetStyles.ts"],"sourcesContent":["import { makeResetStyles as vanillaMakeResetStyles } from '@griffel/core';\nimport type { GriffelResetStyle } from '@griffel/core';\n\nimport { insertionFactory } from './insertionFactory';\nimport { useRenderer } from './RendererContext';\nimport { useTextDirection } from './TextDirectionContext';\nimport { isInsideComponent } from './utils/isInsideComponent';\n\nexport function makeResetStyles(styles: GriffelResetStyle) {\n const getStyles = vanillaMakeResetStyles(styles, insertionFactory);\n\n if (process.env.NODE_ENV !== 'production') {\n if (isInsideComponent()) {\n throw new Error(\n [\n \"makeResetStyles(): this function cannot be called in component's scope.\",\n 'All makeResetStyles() calls should be top level i.e. in a root scope of a file.',\n ].join(' '),\n );\n }\n }\n\n return function useClassName(): string {\n const dir = useTextDirection();\n const renderer = useRenderer();\n\n return getStyles({ dir, renderer });\n };\n}\n"],"names":["makeResetStyles","styles","getStyles","vanillaMakeResetStyles","insertionFactory","process","env","NODE_ENV","isInsideComponent","Error","join","useClassName","dir","useTextDirection","renderer","useRenderer"],"mappings":";;;;;;;;;;SAQgBA,eAAeA,CAACC,MAAyB;EACvD,MAAMC,SAAS,GAAGC,oBAAsB,CAACF,MAAM,EAAEG,iCAAgB,CAAC;EAElE,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzC,IAAIC,mCAAiB,EAAE,EAAE;MACvB,MAAM,IAAIC,KAAK,CACb,CACE,yEAAyE,EACzE,iFAAiF,CAClF,CAACC,IAAI,CAAC,GAAG,CAAC,CACZ;;;EAIL,OAAO,SAASC,YAAYA;IAC1B,MAAMC,GAAG,GAAGC,qCAAgB,EAAE;IAC9B,MAAMC,QAAQ,GAAGC,2BAAW,EAAE;IAE9B,OAAOb,SAAS,CAAC;MAAEU,GAAG;MAAEE;KAAU,CAAC;GACpC;AACH;;;;"}
1
+ {"version":3,"file":"makeResetStyles.cjs.js","sources":["../../../packages/react/src/makeResetStyles.ts"],"sourcesContent":["import { makeResetStyles as vanillaMakeResetStyles } from '@griffel/core';\nimport type { GriffelResetStyle } from '@griffel/core';\n\nimport { insertionFactory } from './insertionFactory';\nimport { useRenderer } from './RendererContext';\nimport { useTextDirection } from './TextDirectionContext';\nimport { isInsideComponent } from './utils/isInsideComponent';\n\nexport function makeResetStyles(styles: GriffelResetStyle) {\n const getStyles = vanillaMakeResetStyles(styles, insertionFactory);\n\n if (process.env.NODE_ENV !== 'production') {\n if (isInsideComponent()) {\n throw new Error(\n [\n \"makeResetStyles(): this function cannot be called in component's scope.\",\n 'All makeResetStyles() calls should be top level i.e. in a root scope of a file.',\n ].join(' '),\n );\n }\n }\n\n return function useClassName(): string {\n const dir = useTextDirection();\n const renderer = useRenderer();\n\n return getStyles({ dir, renderer });\n };\n}\n"],"names":["makeResetStyles","styles","getStyles","vanillaMakeResetStyles","insertionFactory","process","env","NODE_ENV","isInsideComponent","Error","join","useClassName","dir","useTextDirection","renderer","useRenderer"],"mappings":";;;;;;;;;;AAQM,SAAUA,eAAeA,CAACC,MAAyB,EAAA;AACvD,EAAA,MAAMC,SAAS,GAAGC,oBAAsB,CAACF,MAAM,EAAEG,iCAAgB,CAAC,CAAA;AAElE,EAAA,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzC,IAAIC,mCAAiB,EAAE,EAAE;AACvB,MAAA,MAAM,IAAIC,KAAK,CACb,CACE,yEAAyE,EACzE,iFAAiF,CAClF,CAACC,IAAI,CAAC,GAAG,CAAC,CACZ,CAAA;AACF,KAAA;AACF,GAAA;EAED,OAAO,SAASC,YAAYA,GAAA;AAC1B,IAAA,MAAMC,GAAG,GAAGC,qCAAgB,EAAE,CAAA;AAC9B,IAAA,MAAMC,QAAQ,GAAGC,2BAAW,EAAE,CAAA;AAE9B,IAAA,OAAOb,SAAS,CAAC;MAAEU,GAAG;AAAEE,MAAAA,QAAAA;AAAQ,KAAE,CAAC,CAAA;GACpC,CAAA;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"makeResetStyles.esm.js","sources":["../../../packages/react/src/makeResetStyles.ts"],"sourcesContent":["import { makeResetStyles as vanillaMakeResetStyles } from '@griffel/core';\nimport type { GriffelResetStyle } from '@griffel/core';\n\nimport { insertionFactory } from './insertionFactory';\nimport { useRenderer } from './RendererContext';\nimport { useTextDirection } from './TextDirectionContext';\nimport { isInsideComponent } from './utils/isInsideComponent';\n\nexport function makeResetStyles(styles: GriffelResetStyle) {\n const getStyles = vanillaMakeResetStyles(styles, insertionFactory);\n\n if (process.env.NODE_ENV !== 'production') {\n if (isInsideComponent()) {\n throw new Error(\n [\n \"makeResetStyles(): this function cannot be called in component's scope.\",\n 'All makeResetStyles() calls should be top level i.e. in a root scope of a file.',\n ].join(' '),\n );\n }\n }\n\n return function useClassName(): string {\n const dir = useTextDirection();\n const renderer = useRenderer();\n\n return getStyles({ dir, renderer });\n };\n}\n"],"names":["makeResetStyles","styles","getStyles","vanillaMakeResetStyles","insertionFactory","process","env","NODE_ENV","isInsideComponent","Error","join","useClassName","dir","useTextDirection","renderer","useRenderer"],"mappings":";;;;;;SAQgBA,eAAeA,CAACC,MAAyB;EACvD,MAAMC,SAAS,GAAGC,iBAAsB,CAACF,MAAM,EAAEG,gBAAgB,CAAC;EAElE,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzC,IAAIC,iBAAiB,EAAE,EAAE;MACvB,MAAM,IAAIC,KAAK,CACb,CACE,yEAAyE,EACzE,iFAAiF,CAClF,CAACC,IAAI,CAAC,GAAG,CAAC,CACZ;;;EAIL,OAAO,SAASC,YAAYA;IAC1B,MAAMC,GAAG,GAAGC,gBAAgB,EAAE;IAC9B,MAAMC,QAAQ,GAAGC,WAAW,EAAE;IAE9B,OAAOb,SAAS,CAAC;MAAEU,GAAG;MAAEE;KAAU,CAAC;GACpC;AACH;;;;"}
1
+ {"version":3,"file":"makeResetStyles.esm.js","sources":["../../../packages/react/src/makeResetStyles.ts"],"sourcesContent":["import { makeResetStyles as vanillaMakeResetStyles } from '@griffel/core';\nimport type { GriffelResetStyle } from '@griffel/core';\n\nimport { insertionFactory } from './insertionFactory';\nimport { useRenderer } from './RendererContext';\nimport { useTextDirection } from './TextDirectionContext';\nimport { isInsideComponent } from './utils/isInsideComponent';\n\nexport function makeResetStyles(styles: GriffelResetStyle) {\n const getStyles = vanillaMakeResetStyles(styles, insertionFactory);\n\n if (process.env.NODE_ENV !== 'production') {\n if (isInsideComponent()) {\n throw new Error(\n [\n \"makeResetStyles(): this function cannot be called in component's scope.\",\n 'All makeResetStyles() calls should be top level i.e. in a root scope of a file.',\n ].join(' '),\n );\n }\n }\n\n return function useClassName(): string {\n const dir = useTextDirection();\n const renderer = useRenderer();\n\n return getStyles({ dir, renderer });\n };\n}\n"],"names":["makeResetStyles","styles","getStyles","vanillaMakeResetStyles","insertionFactory","process","env","NODE_ENV","isInsideComponent","Error","join","useClassName","dir","useTextDirection","renderer","useRenderer"],"mappings":";;;;;;AAQO,SAASA,eAAeA,CAACC,MAAyB,EAAE;AACzD,EAAA,MAAMC,SAAS,GAAGC,iBAAsB,CAACF,MAAM,EAAEG,gBAAgB,CAAC,CAAA;AAElE,EAAA,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzC,IAAIC,iBAAiB,EAAE,EAAE;AACvB,MAAA,MAAM,IAAIC,KAAK,CACb,CACE,yEAAyE,EACzE,iFAAiF,CAClF,CAACC,IAAI,CAAC,GAAG,CACZ,CAAC,CAAA;AACH,KAAA;AACF,GAAA;EAEA,OAAO,SAASC,YAAYA,GAAW;AACrC,IAAA,MAAMC,GAAG,GAAGC,gBAAgB,EAAE,CAAA;AAC9B,IAAA,MAAMC,QAAQ,GAAGC,WAAW,EAAE,CAAA;AAE9B,IAAA,OAAOb,SAAS,CAAC;MAAEU,GAAG;AAAEE,MAAAA,QAAAA;AAAS,KAAC,CAAC,CAAA;GACpC,CAAA;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"makeStaticStyles.cjs.js","sources":["../../../packages/react/src/makeStaticStyles.ts"],"sourcesContent":["import { makeStaticStyles as vanillaMakeStaticStyles } from '@griffel/core';\nimport type { GriffelStaticStyles, MakeStaticStylesOptions } from '@griffel/core';\n\nimport { insertionFactory } from './insertionFactory';\nimport { useRenderer } from './RendererContext';\n\nexport function makeStaticStyles(styles: GriffelStaticStyles | GriffelStaticStyles[]) {\n const getStyles = vanillaMakeStaticStyles(styles, insertionFactory);\n\n if (process.env.NODE_ENV === 'test') {\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n return () => {};\n }\n\n return function useStaticStyles(): void {\n const renderer = useRenderer();\n const options: MakeStaticStylesOptions = { renderer };\n\n return getStyles(options);\n };\n}\n"],"names":["makeStaticStyles","styles","getStyles","vanillaMakeStaticStyles","insertionFactory","process","env","NODE_ENV","useStaticStyles","renderer","useRenderer","options"],"mappings":";;;;;;;;SAMgBA,gBAAgBA,CAACC,MAAmD;EAClF,MAAMC,SAAS,GAAGC,qBAAuB,CAACF,MAAM,EAAEG,iCAAgB,CAAC;EAEnE,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,MAAM,EAAE;;IAEnC,OAAO,QAAQ;;EAGjB,OAAO,SAASC,eAAeA;IAC7B,MAAMC,QAAQ,GAAGC,2BAAW,EAAE;IAC9B,MAAMC,OAAO,GAA4B;MAAEF;KAAU;IAErD,OAAOP,SAAS,CAACS,OAAO,CAAC;GAC1B;AACH;;;;"}
1
+ {"version":3,"file":"makeStaticStyles.cjs.js","sources":["../../../packages/react/src/makeStaticStyles.ts"],"sourcesContent":["import { makeStaticStyles as vanillaMakeStaticStyles } from '@griffel/core';\nimport type { GriffelStaticStyles, MakeStaticStylesOptions } from '@griffel/core';\n\nimport { insertionFactory } from './insertionFactory';\nimport { useRenderer } from './RendererContext';\n\nexport function makeStaticStyles(styles: GriffelStaticStyles | GriffelStaticStyles[]) {\n const getStyles = vanillaMakeStaticStyles(styles, insertionFactory);\n\n if (process.env.NODE_ENV === 'test') {\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n return () => {};\n }\n\n return function useStaticStyles(): void {\n const renderer = useRenderer();\n const options: MakeStaticStylesOptions = { renderer };\n\n return getStyles(options);\n };\n}\n"],"names":["makeStaticStyles","styles","getStyles","vanillaMakeStaticStyles","insertionFactory","process","env","NODE_ENV","useStaticStyles","renderer","useRenderer","options"],"mappings":";;;;;;;;AAMM,SAAUA,gBAAgBA,CAACC,MAAmD,EAAA;AAClF,EAAA,MAAMC,SAAS,GAAGC,qBAAuB,CAACF,MAAM,EAAEG,iCAAgB,CAAC,CAAA;AAEnE,EAAA,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,MAAM,EAAE;AACnC;IACA,OAAO,MAAO,EAAC,CAAA;AAChB,GAAA;EAED,OAAO,SAASC,eAAeA,GAAA;AAC7B,IAAA,MAAMC,QAAQ,GAAGC,2BAAW,EAAE,CAAA;AAC9B,IAAA,MAAMC,OAAO,GAA4B;AAAEF,MAAAA,QAAAA;KAAU,CAAA;IAErD,OAAOP,SAAS,CAACS,OAAO,CAAC,CAAA;GAC1B,CAAA;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"makeStaticStyles.esm.js","sources":["../../../packages/react/src/makeStaticStyles.ts"],"sourcesContent":["import { makeStaticStyles as vanillaMakeStaticStyles } from '@griffel/core';\nimport type { GriffelStaticStyles, MakeStaticStylesOptions } from '@griffel/core';\n\nimport { insertionFactory } from './insertionFactory';\nimport { useRenderer } from './RendererContext';\n\nexport function makeStaticStyles(styles: GriffelStaticStyles | GriffelStaticStyles[]) {\n const getStyles = vanillaMakeStaticStyles(styles, insertionFactory);\n\n if (process.env.NODE_ENV === 'test') {\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n return () => {};\n }\n\n return function useStaticStyles(): void {\n const renderer = useRenderer();\n const options: MakeStaticStylesOptions = { renderer };\n\n return getStyles(options);\n };\n}\n"],"names":["makeStaticStyles","styles","getStyles","vanillaMakeStaticStyles","insertionFactory","process","env","NODE_ENV","useStaticStyles","renderer","useRenderer","options"],"mappings":";;;;SAMgBA,gBAAgBA,CAACC,MAAmD;EAClF,MAAMC,SAAS,GAAGC,kBAAuB,CAACF,MAAM,EAAEG,gBAAgB,CAAC;EAEnE,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,MAAM,EAAE;;IAEnC,OAAO,QAAQ;;EAGjB,OAAO,SAASC,eAAeA;IAC7B,MAAMC,QAAQ,GAAGC,WAAW,EAAE;IAC9B,MAAMC,OAAO,GAA4B;MAAEF;KAAU;IAErD,OAAOP,SAAS,CAACS,OAAO,CAAC;GAC1B;AACH;;;;"}
1
+ {"version":3,"file":"makeStaticStyles.esm.js","sources":["../../../packages/react/src/makeStaticStyles.ts"],"sourcesContent":["import { makeStaticStyles as vanillaMakeStaticStyles } from '@griffel/core';\nimport type { GriffelStaticStyles, MakeStaticStylesOptions } from '@griffel/core';\n\nimport { insertionFactory } from './insertionFactory';\nimport { useRenderer } from './RendererContext';\n\nexport function makeStaticStyles(styles: GriffelStaticStyles | GriffelStaticStyles[]) {\n const getStyles = vanillaMakeStaticStyles(styles, insertionFactory);\n\n if (process.env.NODE_ENV === 'test') {\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n return () => {};\n }\n\n return function useStaticStyles(): void {\n const renderer = useRenderer();\n const options: MakeStaticStylesOptions = { renderer };\n\n return getStyles(options);\n };\n}\n"],"names":["makeStaticStyles","styles","getStyles","vanillaMakeStaticStyles","insertionFactory","process","env","NODE_ENV","useStaticStyles","renderer","useRenderer","options"],"mappings":";;;;AAMO,SAASA,gBAAgBA,CAACC,MAAmD,EAAE;AACpF,EAAA,MAAMC,SAAS,GAAGC,kBAAuB,CAACF,MAAM,EAAEG,gBAAgB,CAAC,CAAA;AAEnE,EAAA,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,MAAM,EAAE;AACnC;IACA,OAAO,MAAM,EAAE,CAAA;AACjB,GAAA;EAEA,OAAO,SAASC,eAAeA,GAAS;AACtC,IAAA,MAAMC,QAAQ,GAAGC,WAAW,EAAE,CAAA;AAC9B,IAAA,MAAMC,OAAgC,GAAG;AAAEF,MAAAA,QAAAA;KAAU,CAAA;IAErD,OAAOP,SAAS,CAACS,OAAO,CAAC,CAAA;GAC1B,CAAA;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"makeStyles.cjs.js","sources":["../../../packages/react/src/makeStyles.ts"],"sourcesContent":["import { makeStyles as vanillaMakeStyles } from '@griffel/core';\nimport type { GriffelStyle } from '@griffel/core';\n\nimport { insertionFactory } from './insertionFactory';\nimport { useRenderer } from './RendererContext';\nimport { useTextDirection } from './TextDirectionContext';\nimport { isInsideComponent } from './utils/isInsideComponent';\n\nexport function makeStyles<Slots extends string | number>(stylesBySlots: Record<Slots, GriffelStyle>) {\n const getStyles = vanillaMakeStyles(stylesBySlots, insertionFactory);\n\n if (process.env.NODE_ENV !== 'production') {\n if (isInsideComponent()) {\n throw new Error(\n [\n \"makeStyles(): this function cannot be called in component's scope.\",\n 'All makeStyles() calls should be top level i.e. in a root scope of a file.',\n ].join(' '),\n );\n }\n }\n\n return function useClasses(): Record<Slots, string> {\n const dir = useTextDirection();\n const renderer = useRenderer();\n\n return getStyles({ dir, renderer });\n };\n}\n"],"names":["makeStyles","stylesBySlots","getStyles","vanillaMakeStyles","insertionFactory","process","env","NODE_ENV","isInsideComponent","Error","join","useClasses","dir","useTextDirection","renderer","useRenderer"],"mappings":";;;;;;;;;;SAQgBA,UAAUA,CAAgCC,aAA0C;EAClG,MAAMC,SAAS,GAAGC,eAAiB,CAACF,aAAa,EAAEG,iCAAgB,CAAC;EAEpE,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzC,IAAIC,mCAAiB,EAAE,EAAE;MACvB,MAAM,IAAIC,KAAK,CACb,CACE,oEAAoE,EACpE,4EAA4E,CAC7E,CAACC,IAAI,CAAC,GAAG,CAAC,CACZ;;;EAIL,OAAO,SAASC,UAAUA;IACxB,MAAMC,GAAG,GAAGC,qCAAgB,EAAE;IAC9B,MAAMC,QAAQ,GAAGC,2BAAW,EAAE;IAE9B,OAAOb,SAAS,CAAC;MAAEU,GAAG;MAAEE;KAAU,CAAC;GACpC;AACH;;;;"}
1
+ {"version":3,"file":"makeStyles.cjs.js","sources":["../../../packages/react/src/makeStyles.ts"],"sourcesContent":["import { makeStyles as vanillaMakeStyles } from '@griffel/core';\nimport type { GriffelStyle } from '@griffel/core';\n\nimport { insertionFactory } from './insertionFactory';\nimport { useRenderer } from './RendererContext';\nimport { useTextDirection } from './TextDirectionContext';\nimport { isInsideComponent } from './utils/isInsideComponent';\n\nexport function makeStyles<Slots extends string | number>(stylesBySlots: Record<Slots, GriffelStyle>) {\n const getStyles = vanillaMakeStyles(stylesBySlots, insertionFactory);\n\n if (process.env.NODE_ENV !== 'production') {\n if (isInsideComponent()) {\n throw new Error(\n [\n \"makeStyles(): this function cannot be called in component's scope.\",\n 'All makeStyles() calls should be top level i.e. in a root scope of a file.',\n ].join(' '),\n );\n }\n }\n\n return function useClasses(): Record<Slots, string> {\n const dir = useTextDirection();\n const renderer = useRenderer();\n\n return getStyles({ dir, renderer });\n };\n}\n"],"names":["makeStyles","stylesBySlots","getStyles","vanillaMakeStyles","insertionFactory","process","env","NODE_ENV","isInsideComponent","Error","join","useClasses","dir","useTextDirection","renderer","useRenderer"],"mappings":";;;;;;;;;;AAQM,SAAUA,UAAUA,CAAgCC,aAA0C,EAAA;AAClG,EAAA,MAAMC,SAAS,GAAGC,eAAiB,CAACF,aAAa,EAAEG,iCAAgB,CAAC,CAAA;AAEpE,EAAA,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzC,IAAIC,mCAAiB,EAAE,EAAE;AACvB,MAAA,MAAM,IAAIC,KAAK,CACb,CACE,oEAAoE,EACpE,4EAA4E,CAC7E,CAACC,IAAI,CAAC,GAAG,CAAC,CACZ,CAAA;AACF,KAAA;AACF,GAAA;EAED,OAAO,SAASC,UAAUA,GAAA;AACxB,IAAA,MAAMC,GAAG,GAAGC,qCAAgB,EAAE,CAAA;AAC9B,IAAA,MAAMC,QAAQ,GAAGC,2BAAW,EAAE,CAAA;AAE9B,IAAA,OAAOb,SAAS,CAAC;MAAEU,GAAG;AAAEE,MAAAA,QAAAA;AAAQ,KAAE,CAAC,CAAA;GACpC,CAAA;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"makeStyles.esm.js","sources":["../../../packages/react/src/makeStyles.ts"],"sourcesContent":["import { makeStyles as vanillaMakeStyles } from '@griffel/core';\nimport type { GriffelStyle } from '@griffel/core';\n\nimport { insertionFactory } from './insertionFactory';\nimport { useRenderer } from './RendererContext';\nimport { useTextDirection } from './TextDirectionContext';\nimport { isInsideComponent } from './utils/isInsideComponent';\n\nexport function makeStyles<Slots extends string | number>(stylesBySlots: Record<Slots, GriffelStyle>) {\n const getStyles = vanillaMakeStyles(stylesBySlots, insertionFactory);\n\n if (process.env.NODE_ENV !== 'production') {\n if (isInsideComponent()) {\n throw new Error(\n [\n \"makeStyles(): this function cannot be called in component's scope.\",\n 'All makeStyles() calls should be top level i.e. in a root scope of a file.',\n ].join(' '),\n );\n }\n }\n\n return function useClasses(): Record<Slots, string> {\n const dir = useTextDirection();\n const renderer = useRenderer();\n\n return getStyles({ dir, renderer });\n };\n}\n"],"names":["makeStyles","stylesBySlots","getStyles","vanillaMakeStyles","insertionFactory","process","env","NODE_ENV","isInsideComponent","Error","join","useClasses","dir","useTextDirection","renderer","useRenderer"],"mappings":";;;;;;SAQgBA,UAAUA,CAAgCC,aAA0C;EAClG,MAAMC,SAAS,GAAGC,YAAiB,CAACF,aAAa,EAAEG,gBAAgB,CAAC;EAEpE,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzC,IAAIC,iBAAiB,EAAE,EAAE;MACvB,MAAM,IAAIC,KAAK,CACb,CACE,oEAAoE,EACpE,4EAA4E,CAC7E,CAACC,IAAI,CAAC,GAAG,CAAC,CACZ;;;EAIL,OAAO,SAASC,UAAUA;IACxB,MAAMC,GAAG,GAAGC,gBAAgB,EAAE;IAC9B,MAAMC,QAAQ,GAAGC,WAAW,EAAE;IAE9B,OAAOb,SAAS,CAAC;MAAEU,GAAG;MAAEE;KAAU,CAAC;GACpC;AACH;;;;"}
1
+ {"version":3,"file":"makeStyles.esm.js","sources":["../../../packages/react/src/makeStyles.ts"],"sourcesContent":["import { makeStyles as vanillaMakeStyles } from '@griffel/core';\nimport type { GriffelStyle } from '@griffel/core';\n\nimport { insertionFactory } from './insertionFactory';\nimport { useRenderer } from './RendererContext';\nimport { useTextDirection } from './TextDirectionContext';\nimport { isInsideComponent } from './utils/isInsideComponent';\n\nexport function makeStyles<Slots extends string | number>(stylesBySlots: Record<Slots, GriffelStyle>) {\n const getStyles = vanillaMakeStyles(stylesBySlots, insertionFactory);\n\n if (process.env.NODE_ENV !== 'production') {\n if (isInsideComponent()) {\n throw new Error(\n [\n \"makeStyles(): this function cannot be called in component's scope.\",\n 'All makeStyles() calls should be top level i.e. in a root scope of a file.',\n ].join(' '),\n );\n }\n }\n\n return function useClasses(): Record<Slots, string> {\n const dir = useTextDirection();\n const renderer = useRenderer();\n\n return getStyles({ dir, renderer });\n };\n}\n"],"names":["makeStyles","stylesBySlots","getStyles","vanillaMakeStyles","insertionFactory","process","env","NODE_ENV","isInsideComponent","Error","join","useClasses","dir","useTextDirection","renderer","useRenderer"],"mappings":";;;;;;AAQO,SAASA,UAAUA,CAAgCC,aAA0C,EAAE;AACpG,EAAA,MAAMC,SAAS,GAAGC,YAAiB,CAACF,aAAa,EAAEG,gBAAgB,CAAC,CAAA;AAEpE,EAAA,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzC,IAAIC,iBAAiB,EAAE,EAAE;AACvB,MAAA,MAAM,IAAIC,KAAK,CACb,CACE,oEAAoE,EACpE,4EAA4E,CAC7E,CAACC,IAAI,CAAC,GAAG,CACZ,CAAC,CAAA;AACH,KAAA;AACF,GAAA;EAEA,OAAO,SAASC,UAAUA,GAA0B;AAClD,IAAA,MAAMC,GAAG,GAAGC,gBAAgB,EAAE,CAAA;AAC9B,IAAA,MAAMC,QAAQ,GAAGC,WAAW,EAAE,CAAA;AAE9B,IAAA,OAAOb,SAAS,CAAC;MAAEU,GAAG;AAAEE,MAAAA,QAAAA;AAAS,KAAC,CAAC,CAAA;GACpC,CAAA;AACH;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@griffel/react",
3
- "version": "1.5.20",
3
+ "version": "1.5.22",
4
4
  "description": "React implementation of Atomic CSS-in-JS",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -15,13 +15,12 @@
15
15
  }
16
16
  },
17
17
  "dependencies": {
18
- "@griffel/core": "^1.15.2",
18
+ "@griffel/core": "^1.16.0",
19
19
  "tslib": "^2.1.0"
20
20
  },
21
21
  "peerDependencies": {
22
22
  "react": ">=16.8.0 <19.0.0"
23
23
  },
24
24
  "module": "./index.esm.js",
25
- "main": "./index.cjs.js",
26
- "types": "./src/index.d.ts"
25
+ "main": "./index.cjs.js"
27
26
  }
@@ -25,10 +25,10 @@ function _interopNamespace(e) {
25
25
 
26
26
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
27
27
 
28
- /**
29
- * This method returns a list of <style> React elements with the rendered CSS. This is useful for Server-Side rendering.
30
- *
31
- * @public
28
+ /**
29
+ * This method returns a list of <style> React elements with the rendered CSS. This is useful for Server-Side rendering.
30
+ *
31
+ * @public
32
32
  */
33
33
  function renderToStyleElements(renderer) {
34
34
  const stylesheets = Object.values(renderer.stylesheets)
@@ -54,16 +54,14 @@ function renderToStyleElements(renderer) {
54
54
  if (!cssRules.length) {
55
55
  return null;
56
56
  }
57
- return /*#__PURE__*/React__namespace.createElement('style', {
58
- key: stylesheet.bucketName,
59
- // TODO: support "nonce"
60
- // ...renderer.styleNodeAttributes,
61
- ...stylesheet.elementAttributes,
57
+ return /*#__PURE__*/React__namespace.createElement('style', Object.assign({
58
+ key: stylesheet.bucketName
59
+ }, stylesheet.elementAttributes, {
62
60
  'data-make-styles-rehydration': 'true',
63
61
  dangerouslySetInnerHTML: {
64
62
  __html: cssRules.join('')
65
63
  }
66
- });
64
+ }));
67
65
  }).filter(Boolean);
68
66
  }
69
67
 
@@ -1 +1 @@
1
- {"version":3,"file":"renderToStyleElements.cjs.js","sources":["../../../packages/react/src/renderToStyleElements.ts"],"sourcesContent":["import { styleBucketOrdering } from '@griffel/core';\nimport * as React from 'react';\nimport type { GriffelRenderer } from '@griffel/core';\n\n/**\n * This method returns a list of <style> React elements with the rendered CSS. This is useful for Server-Side rendering.\n *\n * @public\n */\nexport function renderToStyleElements(renderer: GriffelRenderer): React.ReactElement[] {\n const stylesheets = Object.values(renderer.stylesheets)\n // first sort: bucket names\n .sort((a, b) => {\n return styleBucketOrdering.indexOf(a.bucketName) - styleBucketOrdering.indexOf(b.bucketName);\n })\n // second sort: media queries\n .sort((a, b) => {\n const mediaA = a.elementAttributes['media'];\n const mediaB = b.elementAttributes['media'];\n\n if (mediaA && mediaB) {\n return renderer.compareMediaQueries(mediaA, mediaB);\n }\n\n if (mediaA || mediaB) {\n return mediaA ? 1 : -1;\n }\n\n return 0;\n });\n\n return stylesheets\n .map(stylesheet => {\n const cssRules = stylesheet.cssRules();\n // don't want to create any empty style elements\n if (!cssRules.length) {\n return null;\n }\n\n return React.createElement('style', {\n key: stylesheet.bucketName,\n\n // TODO: support \"nonce\"\n // ...renderer.styleNodeAttributes,\n ...stylesheet.elementAttributes,\n 'data-make-styles-rehydration': 'true',\n\n dangerouslySetInnerHTML: {\n __html: cssRules.join(''),\n },\n });\n })\n .filter(Boolean) as React.ReactElement[];\n}\n"],"names":["renderToStyleElements","renderer","stylesheets","Object","values","sort","a","b","styleBucketOrdering","indexOf","bucketName","mediaA","elementAttributes","mediaB","compareMediaQueries","map","stylesheet","cssRules","length","React","createElement","key","dangerouslySetInnerHTML","__html","join","filter","Boolean"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA;;;;;SAKgBA,qBAAqBA,CAACC,QAAyB;EAC7D,MAAMC,WAAW,GAAGC,MAAM,CAACC,MAAM,CAACH,QAAQ,CAACC,WAAW;;GAEnDG,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC;IACT,OAAOC,wBAAmB,CAACC,OAAO,CAACH,CAAC,CAACI,UAAU,CAAC,GAAGF,wBAAmB,CAACC,OAAO,CAACF,CAAC,CAACG,UAAU,CAAC;GAC7F;;GAEAL,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC;IACT,MAAMI,MAAM,GAAGL,CAAC,CAACM,iBAAiB,CAAC,OAAO,CAAC;IAC3C,MAAMC,MAAM,GAAGN,CAAC,CAACK,iBAAiB,CAAC,OAAO,CAAC;IAE3C,IAAID,MAAM,IAAIE,MAAM,EAAE;MACpB,OAAOZ,QAAQ,CAACa,mBAAmB,CAACH,MAAM,EAAEE,MAAM,CAAC;;IAGrD,IAAIF,MAAM,IAAIE,MAAM,EAAE;MACpB,OAAOF,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC;;IAGxB,OAAO,CAAC;GACT,CAAC;EAEJ,OAAOT,WAAW,CACfa,GAAG,CAACC,UAAU;IACb,MAAMC,QAAQ,GAAGD,UAAU,CAACC,QAAQ,EAAE;;IAEtC,IAAI,CAACA,QAAQ,CAACC,MAAM,EAAE;MACpB,OAAO,IAAI;;IAGb,oBAAOC,gBAAK,CAACC,aAAa,CAAC,OAAO,EAAE;MAClCC,GAAG,EAAEL,UAAU,CAACN,UAAU;;;MAI1B,GAAGM,UAAU,CAACJ,iBAAiB;MAC/B,8BAA8B,EAAE,MAAM;MAEtCU,uBAAuB,EAAE;QACvBC,MAAM,EAAEN,QAAQ,CAACO,IAAI,CAAC,EAAE;;KAE3B,CAAC;GACH,CAAC,CACDC,MAAM,CAACC,OAAO,CAAyB;AAC5C;;;;"}
1
+ {"version":3,"file":"renderToStyleElements.cjs.js","sources":["../../../packages/react/src/renderToStyleElements.ts"],"sourcesContent":["import { styleBucketOrdering } from '@griffel/core';\nimport * as React from 'react';\nimport type { GriffelRenderer } from '@griffel/core';\n\n/**\n * This method returns a list of <style> React elements with the rendered CSS. This is useful for Server-Side rendering.\n *\n * @public\n */\nexport function renderToStyleElements(renderer: GriffelRenderer): React.ReactElement[] {\n const stylesheets = Object.values(renderer.stylesheets)\n // first sort: bucket names\n .sort((a, b) => {\n return styleBucketOrdering.indexOf(a.bucketName) - styleBucketOrdering.indexOf(b.bucketName);\n })\n // second sort: media queries\n .sort((a, b) => {\n const mediaA = a.elementAttributes['media'];\n const mediaB = b.elementAttributes['media'];\n\n if (mediaA && mediaB) {\n return renderer.compareMediaQueries(mediaA, mediaB);\n }\n\n if (mediaA || mediaB) {\n return mediaA ? 1 : -1;\n }\n\n return 0;\n });\n\n return stylesheets\n .map(stylesheet => {\n const cssRules = stylesheet.cssRules();\n // don't want to create any empty style elements\n if (!cssRules.length) {\n return null;\n }\n\n return React.createElement('style', {\n key: stylesheet.bucketName,\n\n // TODO: support \"nonce\"\n // ...renderer.styleNodeAttributes,\n ...stylesheet.elementAttributes,\n 'data-make-styles-rehydration': 'true',\n\n dangerouslySetInnerHTML: {\n __html: cssRules.join(''),\n },\n });\n })\n .filter(Boolean) as React.ReactElement[];\n}\n"],"names":["renderToStyleElements","renderer","stylesheets","Object","values","sort","a","b","styleBucketOrdering","indexOf","bucketName","mediaA","elementAttributes","mediaB","compareMediaQueries","map","stylesheet","cssRules","length","React","createElement","assign","key","dangerouslySetInnerHTML","__html","join","filter","Boolean"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA;;;;AAIG;AACG,SAAUA,qBAAqBA,CAACC,QAAyB,EAAA;EAC7D,MAAMC,WAAW,GAAGC,MAAM,CAACC,MAAM,CAACH,QAAQ,CAACC,WAAW,CAAA;AACpD;AAAA,GACCG,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAI;AACb,IAAA,OAAOC,wBAAmB,CAACC,OAAO,CAACH,CAAC,CAACI,UAAU,CAAC,GAAGF,wBAAmB,CAACC,OAAO,CAACF,CAAC,CAACG,UAAU,CAAC,CAAA;GAC7F,CAAA;AACD;AAAA,GACCL,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAI;AACb,IAAA,MAAMI,MAAM,GAAGL,CAAC,CAACM,iBAAiB,CAAC,OAAO,CAAC,CAAA;AAC3C,IAAA,MAAMC,MAAM,GAAGN,CAAC,CAACK,iBAAiB,CAAC,OAAO,CAAC,CAAA;IAE3C,IAAID,MAAM,IAAIE,MAAM,EAAE;AACpB,MAAA,OAAOZ,QAAQ,CAACa,mBAAmB,CAACH,MAAM,EAAEE,MAAM,CAAC,CAAA;AACpD,KAAA;IAED,IAAIF,MAAM,IAAIE,MAAM,EAAE;AACpB,MAAA,OAAOF,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC,CAAA;AACvB,KAAA;AAED,IAAA,OAAO,CAAC,CAAA;AACV,GAAC,CAAC,CAAA;AAEJ,EAAA,OAAOT,WAAW,CACfa,GAAG,CAACC,UAAU,IAAG;AAChB,IAAA,MAAMC,QAAQ,GAAGD,UAAU,CAACC,QAAQ,EAAE,CAAA;AACtC;AACA,IAAA,IAAI,CAACA,QAAQ,CAACC,MAAM,EAAE;AACpB,MAAA,OAAO,IAAI,CAAA;AACZ,KAAA;IAED,oBAAOC,gBAAK,CAACC,aAAa,CAAC,OAAO,EAAAjB,MAAA,CAAAkB,MAAA,CAAA;MAChCC,GAAG,EAAEN,UAAU,CAACN,UAAAA;KAIbM,EAAAA,UAAU,CAACJ,iBAAiB,EAAA;AAC/B,MAAA,8BAA8B,EAAE,MAAM;AAEtCW,MAAAA,uBAAuB,EAAE;AACvBC,QAAAA,MAAM,EAAEP,QAAQ,CAACQ,IAAI,CAAC,EAAE,CAAA;AACzB,OAAA;AAAA,KAAA,CACF,CAAC,CAAA;AACJ,GAAC,CAAC,CACDC,MAAM,CAACC,OAAO,CAAyB,CAAA;AAC5C;;;;"}
@@ -1,10 +1,10 @@
1
1
  import { styleBucketOrdering } from '@griffel/core';
2
2
  import * as React from 'react';
3
3
 
4
- /**
5
- * This method returns a list of <style> React elements with the rendered CSS. This is useful for Server-Side rendering.
6
- *
7
- * @public
4
+ /**
5
+ * This method returns a list of <style> React elements with the rendered CSS. This is useful for Server-Side rendering.
6
+ *
7
+ * @public
8
8
  */
9
9
  function renderToStyleElements(renderer) {
10
10
  const stylesheets = Object.values(renderer.stylesheets)
@@ -30,16 +30,14 @@ function renderToStyleElements(renderer) {
30
30
  if (!cssRules.length) {
31
31
  return null;
32
32
  }
33
- return /*#__PURE__*/React.createElement('style', {
34
- key: stylesheet.bucketName,
35
- // TODO: support "nonce"
36
- // ...renderer.styleNodeAttributes,
37
- ...stylesheet.elementAttributes,
33
+ return /*#__PURE__*/React.createElement('style', Object.assign({
34
+ key: stylesheet.bucketName
35
+ }, stylesheet.elementAttributes, {
38
36
  'data-make-styles-rehydration': 'true',
39
37
  dangerouslySetInnerHTML: {
40
38
  __html: cssRules.join('')
41
39
  }
42
- });
40
+ }));
43
41
  }).filter(Boolean);
44
42
  }
45
43
 
@@ -1 +1 @@
1
- {"version":3,"file":"renderToStyleElements.esm.js","sources":["../../../packages/react/src/renderToStyleElements.ts"],"sourcesContent":["import { styleBucketOrdering } from '@griffel/core';\nimport * as React from 'react';\nimport type { GriffelRenderer } from '@griffel/core';\n\n/**\n * This method returns a list of <style> React elements with the rendered CSS. This is useful for Server-Side rendering.\n *\n * @public\n */\nexport function renderToStyleElements(renderer: GriffelRenderer): React.ReactElement[] {\n const stylesheets = Object.values(renderer.stylesheets)\n // first sort: bucket names\n .sort((a, b) => {\n return styleBucketOrdering.indexOf(a.bucketName) - styleBucketOrdering.indexOf(b.bucketName);\n })\n // second sort: media queries\n .sort((a, b) => {\n const mediaA = a.elementAttributes['media'];\n const mediaB = b.elementAttributes['media'];\n\n if (mediaA && mediaB) {\n return renderer.compareMediaQueries(mediaA, mediaB);\n }\n\n if (mediaA || mediaB) {\n return mediaA ? 1 : -1;\n }\n\n return 0;\n });\n\n return stylesheets\n .map(stylesheet => {\n const cssRules = stylesheet.cssRules();\n // don't want to create any empty style elements\n if (!cssRules.length) {\n return null;\n }\n\n return React.createElement('style', {\n key: stylesheet.bucketName,\n\n // TODO: support \"nonce\"\n // ...renderer.styleNodeAttributes,\n ...stylesheet.elementAttributes,\n 'data-make-styles-rehydration': 'true',\n\n dangerouslySetInnerHTML: {\n __html: cssRules.join(''),\n },\n });\n })\n .filter(Boolean) as React.ReactElement[];\n}\n"],"names":["renderToStyleElements","renderer","stylesheets","Object","values","sort","a","b","styleBucketOrdering","indexOf","bucketName","mediaA","elementAttributes","mediaB","compareMediaQueries","map","stylesheet","cssRules","length","React","createElement","key","dangerouslySetInnerHTML","__html","join","filter","Boolean"],"mappings":";;;AAIA;;;;;SAKgBA,qBAAqBA,CAACC,QAAyB;EAC7D,MAAMC,WAAW,GAAGC,MAAM,CAACC,MAAM,CAACH,QAAQ,CAACC,WAAW;;GAEnDG,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC;IACT,OAAOC,mBAAmB,CAACC,OAAO,CAACH,CAAC,CAACI,UAAU,CAAC,GAAGF,mBAAmB,CAACC,OAAO,CAACF,CAAC,CAACG,UAAU,CAAC;GAC7F;;GAEAL,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC;IACT,MAAMI,MAAM,GAAGL,CAAC,CAACM,iBAAiB,CAAC,OAAO,CAAC;IAC3C,MAAMC,MAAM,GAAGN,CAAC,CAACK,iBAAiB,CAAC,OAAO,CAAC;IAE3C,IAAID,MAAM,IAAIE,MAAM,EAAE;MACpB,OAAOZ,QAAQ,CAACa,mBAAmB,CAACH,MAAM,EAAEE,MAAM,CAAC;;IAGrD,IAAIF,MAAM,IAAIE,MAAM,EAAE;MACpB,OAAOF,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC;;IAGxB,OAAO,CAAC;GACT,CAAC;EAEJ,OAAOT,WAAW,CACfa,GAAG,CAACC,UAAU;IACb,MAAMC,QAAQ,GAAGD,UAAU,CAACC,QAAQ,EAAE;;IAEtC,IAAI,CAACA,QAAQ,CAACC,MAAM,EAAE;MACpB,OAAO,IAAI;;IAGb,oBAAOC,KAAK,CAACC,aAAa,CAAC,OAAO,EAAE;MAClCC,GAAG,EAAEL,UAAU,CAACN,UAAU;;;MAI1B,GAAGM,UAAU,CAACJ,iBAAiB;MAC/B,8BAA8B,EAAE,MAAM;MAEtCU,uBAAuB,EAAE;QACvBC,MAAM,EAAEN,QAAQ,CAACO,IAAI,CAAC,EAAE;;KAE3B,CAAC;GACH,CAAC,CACDC,MAAM,CAACC,OAAO,CAAyB;AAC5C;;;;"}
1
+ {"version":3,"file":"renderToStyleElements.esm.js","sources":["../../../packages/react/src/renderToStyleElements.ts"],"sourcesContent":["import { styleBucketOrdering } from '@griffel/core';\nimport * as React from 'react';\nimport type { GriffelRenderer } from '@griffel/core';\n\n/**\n * This method returns a list of <style> React elements with the rendered CSS. This is useful for Server-Side rendering.\n *\n * @public\n */\nexport function renderToStyleElements(renderer: GriffelRenderer): React.ReactElement[] {\n const stylesheets = Object.values(renderer.stylesheets)\n // first sort: bucket names\n .sort((a, b) => {\n return styleBucketOrdering.indexOf(a.bucketName) - styleBucketOrdering.indexOf(b.bucketName);\n })\n // second sort: media queries\n .sort((a, b) => {\n const mediaA = a.elementAttributes['media'];\n const mediaB = b.elementAttributes['media'];\n\n if (mediaA && mediaB) {\n return renderer.compareMediaQueries(mediaA, mediaB);\n }\n\n if (mediaA || mediaB) {\n return mediaA ? 1 : -1;\n }\n\n return 0;\n });\n\n return stylesheets\n .map(stylesheet => {\n const cssRules = stylesheet.cssRules();\n // don't want to create any empty style elements\n if (!cssRules.length) {\n return null;\n }\n\n return React.createElement('style', {\n key: stylesheet.bucketName,\n\n // TODO: support \"nonce\"\n // ...renderer.styleNodeAttributes,\n ...stylesheet.elementAttributes,\n 'data-make-styles-rehydration': 'true',\n\n dangerouslySetInnerHTML: {\n __html: cssRules.join(''),\n },\n });\n })\n .filter(Boolean) as React.ReactElement[];\n}\n"],"names":["renderToStyleElements","renderer","stylesheets","Object","values","sort","a","b","styleBucketOrdering","indexOf","bucketName","mediaA","elementAttributes","mediaB","compareMediaQueries","map","stylesheet","cssRules","length","React","createElement","assign","key","dangerouslySetInnerHTML","__html","join","filter","Boolean"],"mappings":";;;AAIA;AACA;AACA;AACA;AACA;AACO,SAASA,qBAAqBA,CAACC,QAAyB,EAAwB;EACrF,MAAMC,WAAW,GAAGC,MAAM,CAACC,MAAM,CAACH,QAAQ,CAACC,WAAW,CAAA;AACpD;AAAA,GACCG,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAK;AACd,IAAA,OAAOC,mBAAmB,CAACC,OAAO,CAACH,CAAC,CAACI,UAAU,CAAC,GAAGF,mBAAmB,CAACC,OAAO,CAACF,CAAC,CAACG,UAAU,CAAC,CAAA;GAC7F,CAAA;AACD;AAAA,GACCL,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAK;AACd,IAAA,MAAMI,MAAM,GAAGL,CAAC,CAACM,iBAAiB,CAAC,OAAO,CAAC,CAAA;AAC3C,IAAA,MAAMC,MAAM,GAAGN,CAAC,CAACK,iBAAiB,CAAC,OAAO,CAAC,CAAA;IAE3C,IAAID,MAAM,IAAIE,MAAM,EAAE;AACpB,MAAA,OAAOZ,QAAQ,CAACa,mBAAmB,CAACH,MAAM,EAAEE,MAAM,CAAC,CAAA;AACrD,KAAA;IAEA,IAAIF,MAAM,IAAIE,MAAM,EAAE;AACpB,MAAA,OAAOF,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC,CAAA;AACxB,KAAA;AAEA,IAAA,OAAO,CAAC,CAAA;AACV,GAAC,CAAC,CAAA;AAEJ,EAAA,OAAOT,WAAW,CACfa,GAAG,CAACC,UAAU,IAAI;AACjB,IAAA,MAAMC,QAAQ,GAAGD,UAAU,CAACC,QAAQ,EAAE,CAAA;AACtC;AACA,IAAA,IAAI,CAACA,QAAQ,CAACC,MAAM,EAAE;AACpB,MAAA,OAAO,IAAI,CAAA;AACb,KAAA;IAEA,oBAAOC,KAAK,CAACC,aAAa,CAAC,OAAO,EAAAjB,MAAA,CAAAkB,MAAA,CAAA;MAChCC,GAAG,EAAEN,UAAU,CAACN,UAAAA;KAIbM,EAAAA,UAAU,CAACJ,iBAAiB,EAAA;AAC/B,MAAA,8BAA8B,EAAE,MAAM;AAEtCW,MAAAA,uBAAuB,EAAE;AACvBC,QAAAA,MAAM,EAAEP,QAAQ,CAACQ,IAAI,CAAC,EAAE,CAAA;AAC1B,OAAA;AAAC,KAAA,CACF,CAAC,CAAA;AACJ,GAAC,CAAC,CACDC,MAAM,CAACC,OAAO,CAAC,CAAA;AACpB;;;;"}
@@ -1,24 +1,24 @@
1
- import type { GriffelRenderer } from '@griffel/core';
2
- import * as React from 'react';
3
- export interface RendererProviderProps {
4
- /** An instance of Griffel renderer. */
5
- renderer: GriffelRenderer;
6
- /**
7
- * Document used to insert CSS variables to head
8
- */
9
- targetDocument?: Document;
10
- /**
11
- * Content wrapped by the RendererProvider
12
- */
13
- children: React.ReactNode;
14
- }
15
- /**
16
- * @public
17
- */
18
- export declare const RendererProvider: React.FC<RendererProviderProps>;
19
- /**
20
- * Returns an instance of current makeStyles() renderer.
21
- *
22
- * @private Exported as "useRenderer_unstable" use it on own risk. Can be changed or removed without a notice.
23
- */
24
- export declare function useRenderer(): GriffelRenderer;
1
+ import type { GriffelRenderer } from '@griffel/core';
2
+ import * as React from 'react';
3
+ export interface RendererProviderProps {
4
+ /** An instance of Griffel renderer. */
5
+ renderer: GriffelRenderer;
6
+ /**
7
+ * Document used to insert CSS variables to head
8
+ */
9
+ targetDocument?: Document;
10
+ /**
11
+ * Content wrapped by the RendererProvider
12
+ */
13
+ children: React.ReactNode;
14
+ }
15
+ /**
16
+ * @public
17
+ */
18
+ export declare const RendererProvider: React.FC<RendererProviderProps>;
19
+ /**
20
+ * Returns an instance of current makeStyles() renderer.
21
+ *
22
+ * @private Exported as "useRenderer_unstable" use it on own risk. Can be changed or removed without a notice.
23
+ */
24
+ export declare function useRenderer(): GriffelRenderer;
@@ -1,19 +1,19 @@
1
- import * as React from 'react';
2
- export interface TextDirectionProviderProps {
3
- /** Indicates the directionality of the element's text. */
4
- dir: 'ltr' | 'rtl';
5
- /**
6
- * Content wrapped by the TextDirectionProvider.
7
- */
8
- children: React.ReactNode;
9
- }
10
- /**
11
- * @public
12
- */
13
- export declare const TextDirectionProvider: React.FC<TextDirectionProviderProps>;
14
- /**
15
- * Returns current directionality of the element's text.
16
- *
17
- * @private
18
- */
19
- export declare function useTextDirection(): "ltr" | "rtl";
1
+ import * as React from 'react';
2
+ export interface TextDirectionProviderProps {
3
+ /** Indicates the directionality of the element's text. */
4
+ dir: 'ltr' | 'rtl';
5
+ /**
6
+ * Content wrapped by the TextDirectionProvider.
7
+ */
8
+ children: React.ReactNode;
9
+ }
10
+ /**
11
+ * @public
12
+ */
13
+ export declare const TextDirectionProvider: React.FC<TextDirectionProviderProps>;
14
+ /**
15
+ * Returns current directionality of the element's text.
16
+ *
17
+ * @private
18
+ */
19
+ export declare function useTextDirection(): "ltr" | "rtl";
package/src/__css.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import type { CSSClassesMapBySlot } from '@griffel/core';
2
- /**
3
- * A version of makeStyles() that accepts build output as an input and skips all runtime transforms & DOM insertion.
4
- *
5
- * @internal
6
- */
7
- export declare function __css<Slots extends string>(classesMapBySlot: CSSClassesMapBySlot<Slots>): () => Record<Slots, string>;
1
+ import type { CSSClassesMapBySlot } from '@griffel/core';
2
+ /**
3
+ * A version of makeStyles() that accepts build output as an input and skips all runtime transforms & DOM insertion.
4
+ *
5
+ * @internal
6
+ */
7
+ export declare function __css<Slots extends string>(classesMapBySlot: CSSClassesMapBySlot<Slots>): () => Record<Slots, string>;
@@ -1,6 +1,6 @@
1
- /**
2
- * A version of makeResetStyles() that accepts build output as an input and skips all runtime transforms & DOM insertion.
3
- *
4
- * @internal
5
- */
6
- export declare function __resetCSS(ltrClassName: string, rtlClassName: string | null): () => string;
1
+ /**
2
+ * A version of makeResetStyles() that accepts build output as an input and skips all runtime transforms & DOM insertion.
3
+ *
4
+ * @internal
5
+ */
6
+ export declare function __resetCSS(ltrClassName: string, rtlClassName: string | null): () => string;
@@ -1,7 +1,7 @@
1
- import type { CSSRulesByBucket } from '@griffel/core';
2
- /**
3
- * A version of makeResetStyles() that accepts build output as an input and skips all runtime transforms.
4
- *
5
- * @internal
6
- */
7
- export declare function __resetStyles(ltrClassName: string, rtlClassName: string | null, cssRules: CSSRulesByBucket | string[]): () => string;
1
+ import type { CSSRulesByBucket } from '@griffel/core';
2
+ /**
3
+ * A version of makeResetStyles() that accepts build output as an input and skips all runtime transforms.
4
+ *
5
+ * @internal
6
+ */
7
+ export declare function __resetStyles(ltrClassName: string, rtlClassName: string | null, cssRules: CSSRulesByBucket | string[]): () => string;
package/src/__styles.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import type { CSSClassesMapBySlot, CSSRulesByBucket } from '@griffel/core';
2
- /**
3
- * A version of makeStyles() that accepts build output as an input and skips all runtime transforms.
4
- *
5
- * @internal
6
- */
7
- export declare function __styles<Slots extends string>(classesMapBySlot: CSSClassesMapBySlot<Slots>, cssRules: CSSRulesByBucket): () => Record<Slots, string>;
1
+ import type { CSSClassesMapBySlot, CSSRulesByBucket } from '@griffel/core';
2
+ /**
3
+ * A version of makeStyles() that accepts build output as an input and skips all runtime transforms.
4
+ *
5
+ * @internal
6
+ */
7
+ export declare function __styles<Slots extends string>(classesMapBySlot: CSSClassesMapBySlot<Slots>, cssRules: CSSRulesByBucket): () => Record<Slots, string>;
package/src/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- export { shorthands, mergeClasses, createDOMRenderer } from '@griffel/core';
2
- export type { GriffelStyle, GriffelResetStyle, CreateDOMRendererOptions, GriffelRenderer } from '@griffel/core';
3
- export { makeStyles } from './makeStyles';
4
- export { makeResetStyles } from './makeResetStyles';
5
- export { makeStaticStyles } from './makeStaticStyles';
6
- export { renderToStyleElements } from './renderToStyleElements';
7
- export { RendererProvider, useRenderer as useRenderer_unstable } from './RendererContext';
8
- export { TextDirectionProvider } from './TextDirectionContext';
9
- export { __css } from './__css';
10
- export { __styles } from './__styles';
11
- export { __resetCSS } from './__resetCSS';
12
- export { __resetStyles } from './__resetStyles';
1
+ export { RESET, shorthands, mergeClasses, createDOMRenderer } from '@griffel/core';
2
+ export type { GriffelStyle, GriffelResetStyle, CreateDOMRendererOptions, GriffelRenderer } from '@griffel/core';
3
+ export { makeStyles } from './makeStyles';
4
+ export { makeResetStyles } from './makeResetStyles';
5
+ export { makeStaticStyles } from './makeStaticStyles';
6
+ export { renderToStyleElements } from './renderToStyleElements';
7
+ export { RendererProvider, useRenderer as useRenderer_unstable } from './RendererContext';
8
+ export { TextDirectionProvider } from './TextDirectionContext';
9
+ export { __css } from './__css';
10
+ export { __styles } from './__styles';
11
+ export { __resetCSS } from './__resetCSS';
12
+ export { __resetStyles } from './__resetStyles';
@@ -1,2 +1,2 @@
1
- import type { GriffelInsertionFactory } from '@griffel/core';
2
- export declare const insertionFactory: GriffelInsertionFactory;
1
+ import type { GriffelInsertionFactory } from '@griffel/core';
2
+ export declare const insertionFactory: GriffelInsertionFactory;
@@ -1,2 +1,2 @@
1
- import type { GriffelResetStyle } from '@griffel/core';
2
- export declare function makeResetStyles(styles: GriffelResetStyle): () => string;
1
+ import type { GriffelResetStyle } from '@griffel/core';
2
+ export declare function makeResetStyles(styles: GriffelResetStyle): () => string;
@@ -1,2 +1,2 @@
1
- import type { GriffelStaticStyles } from '@griffel/core';
2
- export declare function makeStaticStyles(styles: GriffelStaticStyles | GriffelStaticStyles[]): () => void;
1
+ import type { GriffelStaticStyles } from '@griffel/core';
2
+ export declare function makeStaticStyles(styles: GriffelStaticStyles | GriffelStaticStyles[]): () => void;
@@ -1,2 +1,2 @@
1
- import type { GriffelStyle } from '@griffel/core';
2
- export declare function makeStyles<Slots extends string | number>(stylesBySlots: Record<Slots, GriffelStyle>): () => Record<Slots, string>;
1
+ import type { GriffelStyle } from '@griffel/core';
2
+ export declare function makeStyles<Slots extends string | number>(stylesBySlots: Record<Slots, GriffelStyle>): () => Record<Slots, string>;
@@ -1,8 +1,8 @@
1
- import * as React from 'react';
2
- import type { GriffelRenderer } from '@griffel/core';
3
- /**
4
- * This method returns a list of <style> React elements with the rendered CSS. This is useful for Server-Side rendering.
5
- *
6
- * @public
7
- */
8
- export declare function renderToStyleElements(renderer: GriffelRenderer): React.ReactElement[];
1
+ import * as React from 'react';
2
+ import type { GriffelRenderer } from '@griffel/core';
3
+ /**
4
+ * This method returns a list of <style> React elements with the rendered CSS. This is useful for Server-Side rendering.
5
+ *
6
+ * @public
7
+ */
8
+ export declare function renderToStyleElements(renderer: GriffelRenderer): React.ReactElement[];
@@ -1,2 +1,2 @@
1
- import * as React from 'react';
2
- export declare const useInsertionEffect: typeof React.useInsertionEffect | undefined;
1
+ import * as React from 'react';
2
+ export declare const useInsertionEffect: typeof React.useInsertionEffect | undefined;
@@ -1,4 +1,4 @@
1
- /**
2
- * Verifies if an application can use DOM.
3
- */
4
- export declare function canUseDOM(): boolean;
1
+ /**
2
+ * Verifies if an application can use DOM.
3
+ */
4
+ export declare function canUseDOM(): boolean;
@@ -1 +1 @@
1
- export declare function isInsideComponent(): boolean;
1
+ export declare function isInsideComponent(): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"useInsertionEffect.esm.js","sources":["../../../packages/react/src/useInsertionEffect.ts"],"sourcesContent":["import * as React from 'react';\n\nexport const useInsertionEffect: typeof React.useInsertionEffect | undefined =\n // @ts-expect-error Hack to make sure that `useInsertionEffect` will not cause bundling issues in older React versions\n // eslint-disable-next-line no-useless-concat\n React['useInsertion' + 'Effect'] ? React['useInsertion' + 'Effect'] : undefined;\n"],"names":["useInsertionEffect","React","undefined"],"mappings":";;MAEaA,kBAAkB;AAC7B;AACA;AACAC,KAAK,CAAC,cAAc,GAAG,QAAQ,CAAC,GAAGA,KAAK,CAAC,cAAc,GAAG,QAAQ,CAAC,GAAGC;;;;"}
1
+ {"version":3,"file":"useInsertionEffect.esm.js","sources":["../../../packages/react/src/useInsertionEffect.ts"],"sourcesContent":["import * as React from 'react';\n\nexport const useInsertionEffect: typeof React.useInsertionEffect | undefined =\n // @ts-expect-error Hack to make sure that `useInsertionEffect` will not cause bundling issues in older React versions\n // eslint-disable-next-line no-useless-concat\n React['useInsertion' + 'Effect'] ? React['useInsertion' + 'Effect'] : undefined;\n"],"names":["useInsertionEffect","React","undefined"],"mappings":";;MAEaA,kBAA+D;AAC1E;AACA;AACAC,KAAK,CAAC,cAAc,GAAG,QAAQ,CAAC,GAAGA,KAAK,CAAC,cAAc,GAAG,QAAQ,CAAC,GAAGC;;;;"}
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- /**
6
- * Verifies if an application can use DOM.
5
+ /**
6
+ * Verifies if an application can use DOM.
7
7
  */
8
8
  function canUseDOM() {
9
9
  return typeof window !== 'undefined' && !!(window.document && window.document.createElement);
@@ -1 +1 @@
1
- {"version":3,"file":"canUseDOM.cjs.js","sources":["../../../../packages/react/src/utils/canUseDOM.ts"],"sourcesContent":["/**\n * Verifies if an application can use DOM.\n */\nexport function canUseDOM(): boolean {\n return typeof window !== 'undefined' && !!(window.document && window.document.createElement);\n}\n"],"names":["canUseDOM","window","document","createElement"],"mappings":";;;;AAAA;;;SAGgBA,SAASA;EACvB,OAAO,OAAOC,MAAM,KAAK,WAAW,IAAI,CAAC,EAAEA,MAAM,CAACC,QAAQ,IAAID,MAAM,CAACC,QAAQ,CAACC,aAAa,CAAC;AAC9F;;;;"}
1
+ {"version":3,"file":"canUseDOM.cjs.js","sources":["../../../../packages/react/src/utils/canUseDOM.ts"],"sourcesContent":["/**\n * Verifies if an application can use DOM.\n */\nexport function canUseDOM(): boolean {\n return typeof window !== 'undefined' && !!(window.document && window.document.createElement);\n}\n"],"names":["canUseDOM","window","document","createElement"],"mappings":";;;;AAAA;;AAEG;SACaA,SAASA,GAAA;AACvB,EAAA,OAAO,OAAOC,MAAM,KAAK,WAAW,IAAI,CAAC,EAAEA,MAAM,CAACC,QAAQ,IAAID,MAAM,CAACC,QAAQ,CAACC,aAAa,CAAC,CAAA;AAC9F;;;;"}
@@ -1,5 +1,5 @@
1
- /**
2
- * Verifies if an application can use DOM.
1
+ /**
2
+ * Verifies if an application can use DOM.
3
3
  */
4
4
  function canUseDOM() {
5
5
  return typeof window !== 'undefined' && !!(window.document && window.document.createElement);
@@ -1 +1 @@
1
- {"version":3,"file":"canUseDOM.esm.js","sources":["../../../../packages/react/src/utils/canUseDOM.ts"],"sourcesContent":["/**\n * Verifies if an application can use DOM.\n */\nexport function canUseDOM(): boolean {\n return typeof window !== 'undefined' && !!(window.document && window.document.createElement);\n}\n"],"names":["canUseDOM","window","document","createElement"],"mappings":"AAAA;;;SAGgBA,SAASA;EACvB,OAAO,OAAOC,MAAM,KAAK,WAAW,IAAI,CAAC,EAAEA,MAAM,CAACC,QAAQ,IAAID,MAAM,CAACC,QAAQ,CAACC,aAAa,CAAC;AAC9F;;;;"}
1
+ {"version":3,"file":"canUseDOM.esm.js","sources":["../../../../packages/react/src/utils/canUseDOM.ts"],"sourcesContent":["/**\n * Verifies if an application can use DOM.\n */\nexport function canUseDOM(): boolean {\n return typeof window !== 'undefined' && !!(window.document && window.document.createElement);\n}\n"],"names":["canUseDOM","window","document","createElement"],"mappings":"AAAA;AACA;AACA;AACO,SAASA,SAASA,GAAY;AACnC,EAAA,OAAO,OAAOC,MAAM,KAAK,WAAW,IAAI,CAAC,EAAEA,MAAM,CAACC,QAAQ,IAAID,MAAM,CAACC,QAAQ,CAACC,aAAa,CAAC,CAAA;AAC9F;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"isInsideComponent.cjs.js","sources":["../../../../packages/react/src/utils/isInsideComponent.ts"],"sourcesContent":["import * as React from 'react';\n\nexport function isInsideComponent() {\n // React 18 always logs errors if a dispatcher is not present:\n // https://github.com/facebook/react/blob/42f15b324f50d0fd98322c21646ac3013e30344a/packages/react/src/ReactHooks.js#L26-L36\n try {\n // @ts-expect-error \"SECRET_INTERNALS\" are not typed\n const dispatcher = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher.current;\n\n // Before any React component was rendered \"dispatcher\" will be \"null\"\n if (dispatcher === null || dispatcher === undefined) {\n return false;\n }\n\n // A check with hooks call (i.e. call \"React.useContext()\" outside a component) will always produce errors, but\n // a call on the dispatcher wont\n dispatcher.useContext({});\n return true;\n } catch (e) {\n return false;\n }\n}\n"],"names":["isInsideComponent","dispatcher","React","__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED","ReactCurrentDispatcher","current","undefined","useContext","e"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;SAEgBA,iBAAiBA;;;EAG/B,IAAI;;IAEF,MAAMC,UAAU,GAAGC,gBAAK,CAACC,kDAAkD,CAACC,sBAAsB,CAACC,OAAO;;IAG1G,IAAIJ,UAAU,KAAK,IAAI,IAAIA,UAAU,KAAKK,SAAS,EAAE;MACnD,OAAO,KAAK;;;;IAKdL,UAAU,CAACM,UAAU,CAAC,EAAE,CAAC;IACzB,OAAO,IAAI;GACZ,CAAC,OAAOC,CAAC,EAAE;IACV,OAAO,KAAK;;AAEhB;;;;"}
1
+ {"version":3,"file":"isInsideComponent.cjs.js","sources":["../../../../packages/react/src/utils/isInsideComponent.ts"],"sourcesContent":["import * as React from 'react';\n\nexport function isInsideComponent() {\n // React 18 always logs errors if a dispatcher is not present:\n // https://github.com/facebook/react/blob/42f15b324f50d0fd98322c21646ac3013e30344a/packages/react/src/ReactHooks.js#L26-L36\n try {\n // @ts-expect-error \"SECRET_INTERNALS\" are not typed\n const dispatcher = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher.current;\n\n // Before any React component was rendered \"dispatcher\" will be \"null\"\n if (dispatcher === null || dispatcher === undefined) {\n return false;\n }\n\n // A check with hooks call (i.e. call \"React.useContext()\" outside a component) will always produce errors, but\n // a call on the dispatcher wont\n dispatcher.useContext({});\n return true;\n } catch (e) {\n return false;\n }\n}\n"],"names":["isInsideComponent","dispatcher","React","__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED","ReactCurrentDispatcher","current","undefined","useContext","e"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;SAEgBA,iBAAiBA,GAAA;AAC/B;AACA;EACA,IAAI;AACF;IACA,MAAMC,UAAU,GAAGC,gBAAK,CAACC,kDAAkD,CAACC,sBAAsB,CAACC,OAAO,CAAA;AAE1G;AACA,IAAA,IAAIJ,UAAU,KAAK,IAAI,IAAIA,UAAU,KAAKK,SAAS,EAAE;AACnD,MAAA,OAAO,KAAK,CAAA;AACb,KAAA;AAED;AACA;AACAL,IAAAA,UAAU,CAACM,UAAU,CAAC,EAAE,CAAC,CAAA;AACzB,IAAA,OAAO,IAAI,CAAA;GACZ,CAAC,OAAOC,CAAC,EAAE;AACV,IAAA,OAAO,KAAK,CAAA;AACb,GAAA;AACH;;;;"}
@@ -6,10 +6,12 @@ function isInsideComponent() {
6
6
  try {
7
7
  // @ts-expect-error "SECRET_INTERNALS" are not typed
8
8
  const dispatcher = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher.current;
9
+
9
10
  // Before any React component was rendered "dispatcher" will be "null"
10
11
  if (dispatcher === null || dispatcher === undefined) {
11
12
  return false;
12
13
  }
14
+
13
15
  // A check with hooks call (i.e. call "React.useContext()" outside a component) will always produce errors, but
14
16
  // a call on the dispatcher wont
15
17
  dispatcher.useContext({});
@@ -1 +1 @@
1
- {"version":3,"file":"isInsideComponent.esm.js","sources":["../../../../packages/react/src/utils/isInsideComponent.ts"],"sourcesContent":["import * as React from 'react';\n\nexport function isInsideComponent() {\n // React 18 always logs errors if a dispatcher is not present:\n // https://github.com/facebook/react/blob/42f15b324f50d0fd98322c21646ac3013e30344a/packages/react/src/ReactHooks.js#L26-L36\n try {\n // @ts-expect-error \"SECRET_INTERNALS\" are not typed\n const dispatcher = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher.current;\n\n // Before any React component was rendered \"dispatcher\" will be \"null\"\n if (dispatcher === null || dispatcher === undefined) {\n return false;\n }\n\n // A check with hooks call (i.e. call \"React.useContext()\" outside a component) will always produce errors, but\n // a call on the dispatcher wont\n dispatcher.useContext({});\n return true;\n } catch (e) {\n return false;\n }\n}\n"],"names":["isInsideComponent","dispatcher","React","__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED","ReactCurrentDispatcher","current","undefined","useContext","e"],"mappings":";;SAEgBA,iBAAiBA;;;EAG/B,IAAI;;IAEF,MAAMC,UAAU,GAAGC,KAAK,CAACC,kDAAkD,CAACC,sBAAsB,CAACC,OAAO;;IAG1G,IAAIJ,UAAU,KAAK,IAAI,IAAIA,UAAU,KAAKK,SAAS,EAAE;MACnD,OAAO,KAAK;;;;IAKdL,UAAU,CAACM,UAAU,CAAC,EAAE,CAAC;IACzB,OAAO,IAAI;GACZ,CAAC,OAAOC,CAAC,EAAE;IACV,OAAO,KAAK;;AAEhB;;;;"}
1
+ {"version":3,"file":"isInsideComponent.esm.js","sources":["../../../../packages/react/src/utils/isInsideComponent.ts"],"sourcesContent":["import * as React from 'react';\n\nexport function isInsideComponent() {\n // React 18 always logs errors if a dispatcher is not present:\n // https://github.com/facebook/react/blob/42f15b324f50d0fd98322c21646ac3013e30344a/packages/react/src/ReactHooks.js#L26-L36\n try {\n // @ts-expect-error \"SECRET_INTERNALS\" are not typed\n const dispatcher = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher.current;\n\n // Before any React component was rendered \"dispatcher\" will be \"null\"\n if (dispatcher === null || dispatcher === undefined) {\n return false;\n }\n\n // A check with hooks call (i.e. call \"React.useContext()\" outside a component) will always produce errors, but\n // a call on the dispatcher wont\n dispatcher.useContext({});\n return true;\n } catch (e) {\n return false;\n }\n}\n"],"names":["isInsideComponent","dispatcher","React","__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED","ReactCurrentDispatcher","current","undefined","useContext","e"],"mappings":";;AAEO,SAASA,iBAAiBA,GAAG;AAClC;AACA;EACA,IAAI;AACF;IACA,MAAMC,UAAU,GAAGC,KAAK,CAACC,kDAAkD,CAACC,sBAAsB,CAACC,OAAO,CAAA;;AAE1G;AACA,IAAA,IAAIJ,UAAU,KAAK,IAAI,IAAIA,UAAU,KAAKK,SAAS,EAAE;AACnD,MAAA,OAAO,KAAK,CAAA;AACd,KAAA;;AAEA;AACA;AACAL,IAAAA,UAAU,CAACM,UAAU,CAAC,EAAE,CAAC,CAAA;AACzB,IAAA,OAAO,IAAI,CAAA;GACZ,CAAC,OAAOC,CAAC,EAAE;AACV,IAAA,OAAO,KAAK,CAAA;AACd,GAAA;AACF;;;;"}