@react-email/editor 0.0.0-experimental.34 → 0.0.0-experimental.37

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 (68) hide show
  1. package/dist/core/index.cjs +8 -7
  2. package/dist/core/index.d.cts +2 -2
  3. package/dist/core/index.d.mts +3 -2
  4. package/dist/core/index.mjs +3 -3
  5. package/dist/create-paste-handler-B8BtjBk3.d.cts +14 -0
  6. package/dist/create-paste-handler-B8BtjBk3.d.cts.map +1 -0
  7. package/dist/create-paste-handler-CGR738bC.d.mts +14 -0
  8. package/dist/create-paste-handler-CGR738bC.d.mts.map +1 -0
  9. package/dist/{columns-Cos2lqfu.mjs → event-bus-CHEzOS_O.mjs} +45 -45
  10. package/dist/event-bus-CHEzOS_O.mjs.map +1 -0
  11. package/dist/{columns-BXN-NNd4.cjs → event-bus-fb8U7hrl.cjs} +42 -42
  12. package/dist/extension-B8yvCdun.cjs +1248 -0
  13. package/dist/extension-XZBBjuHO.mjs +1123 -0
  14. package/dist/extension-XZBBjuHO.mjs.map +1 -0
  15. package/dist/extensions/index.cjs +45 -45
  16. package/dist/extensions/index.d.cts +2 -41
  17. package/dist/extensions/index.d.cts.map +1 -1
  18. package/dist/extensions/index.d.mts +3 -41
  19. package/dist/extensions/index.d.mts.map +1 -1
  20. package/dist/extensions/index.mjs +3 -3
  21. package/dist/{core-mUMTkab3.mjs → extensions-DWsu9kwZ.mjs} +221 -221
  22. package/dist/extensions-DWsu9kwZ.mjs.map +1 -0
  23. package/dist/{core-DVox_fis.cjs → extensions-aMMnHcs9.cjs} +298 -280
  24. package/dist/{global-content-kdUzYcsA.mjs → global-content-5rAU84QT.mjs} +1 -1
  25. package/dist/{global-content-kdUzYcsA.mjs.map → global-content-5rAU84QT.mjs.map} +1 -1
  26. package/dist/{global-content-BRvA4PRG.cjs → global-content-62RO9uoQ.cjs} +1 -1
  27. package/dist/{index-CVRlPqX_.d.cts → index-C4KcMQ0R.d.cts} +43 -13
  28. package/dist/index-C4KcMQ0R.d.cts.map +1 -0
  29. package/dist/{index-BrSAA0dn.d.mts → index-CxX7W63O.d.mts} +43 -13
  30. package/dist/index-CxX7W63O.d.mts.map +1 -0
  31. package/dist/index.cjs +74 -0
  32. package/dist/index.css +859 -0
  33. package/dist/index.css.map +1 -0
  34. package/dist/index.d.cts +33 -0
  35. package/dist/index.d.cts.map +1 -0
  36. package/dist/index.d.mts +33 -0
  37. package/dist/index.d.mts.map +1 -0
  38. package/dist/index.mjs +74 -0
  39. package/dist/index.mjs.map +1 -0
  40. package/dist/plugins/index.cjs +22 -1114
  41. package/dist/plugins/index.d.cts +16 -1
  42. package/dist/plugins/index.d.cts.map +1 -1
  43. package/dist/plugins/index.d.mts +17 -2
  44. package/dist/plugins/index.d.mts.map +1 -1
  45. package/dist/plugins/index.mjs +2 -1097
  46. package/dist/root-BMxsq1NF.mjs +2401 -0
  47. package/dist/root-BMxsq1NF.mjs.map +1 -0
  48. package/dist/root-CNVO39XG.cjs +2941 -0
  49. package/dist/{set-text-alignment-BO24ieeE.mjs → set-text-alignment-GMXOPMlJ.mjs} +1 -1
  50. package/dist/{set-text-alignment-BO24ieeE.mjs.map → set-text-alignment-GMXOPMlJ.mjs.map} +1 -1
  51. package/dist/{styles-DLviD0JK.mjs → styles-_TMw3YxC.mjs} +1 -1
  52. package/dist/{styles-DLviD0JK.mjs.map → styles-_TMw3YxC.mjs.map} +1 -1
  53. package/dist/ui/index.cjs +128 -2515
  54. package/dist/ui/index.d.cts +97 -102
  55. package/dist/ui/index.d.cts.map +1 -1
  56. package/dist/ui/index.d.mts +98 -103
  57. package/dist/ui/index.d.mts.map +1 -1
  58. package/dist/ui/index.mjs +2 -2388
  59. package/dist/ui/index.mjs.map +1 -1
  60. package/dist/utils/index.cjs +1 -1
  61. package/dist/utils/index.mjs +1 -1
  62. package/package.json +12 -2
  63. package/dist/columns-Cos2lqfu.mjs.map +0 -1
  64. package/dist/core-mUMTkab3.mjs.map +0 -1
  65. package/dist/index-BrSAA0dn.d.mts.map +0 -1
  66. package/dist/index-CVRlPqX_.d.cts.map +0 -1
  67. package/dist/plugins/index.mjs.map +0 -1
  68. /package/dist/{set-text-alignment-CbECklB4.cjs → set-text-alignment-aNb7Ml9N.cjs} +0 -0
@@ -16,4 +16,4 @@ function setTextAlignment(editor, alignment) {
16
16
 
17
17
  //#endregion
18
18
  export { setTextAlignment as t };
19
- //# sourceMappingURL=set-text-alignment-BO24ieeE.mjs.map
19
+ //# sourceMappingURL=set-text-alignment-GMXOPMlJ.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"set-text-alignment-BO24ieeE.mjs","names":[],"sources":["../src/utils/set-text-alignment.ts"],"sourcesContent":["import type { Editor } from '@tiptap/core';\n\nexport function setTextAlignment(editor: Editor, alignment: string) {\n const { from, to } = editor.state.selection;\n const tr = editor.state.tr;\n editor.state.doc.nodesBetween(from, to, (node, pos) => {\n if (node.isTextblock) {\n const prop = 'align' in node.attrs ? 'align' : 'alignment';\n tr.setNodeMarkup(pos, null, { ...node.attrs, [prop]: alignment });\n }\n });\n editor.view.dispatch(tr);\n}\n"],"mappings":";AAEA,SAAgB,iBAAiB,QAAgB,WAAmB;CAClE,MAAM,EAAE,MAAM,OAAO,OAAO,MAAM;CAClC,MAAM,KAAK,OAAO,MAAM;AACxB,QAAO,MAAM,IAAI,aAAa,MAAM,KAAK,MAAM,QAAQ;AACrD,MAAI,KAAK,aAAa;GACpB,MAAM,OAAO,WAAW,KAAK,QAAQ,UAAU;AAC/C,MAAG,cAAc,KAAK,MAAM;IAAE,GAAG,KAAK;KAAQ,OAAO;IAAW,CAAC;;GAEnE;AACF,QAAO,KAAK,SAAS,GAAG"}
1
+ {"version":3,"file":"set-text-alignment-GMXOPMlJ.mjs","names":[],"sources":["../src/utils/set-text-alignment.ts"],"sourcesContent":["import type { Editor } from '@tiptap/core';\n\nexport function setTextAlignment(editor: Editor, alignment: string) {\n const { from, to } = editor.state.selection;\n const tr = editor.state.tr;\n editor.state.doc.nodesBetween(from, to, (node, pos) => {\n if (node.isTextblock) {\n const prop = 'align' in node.attrs ? 'align' : 'alignment';\n tr.setNodeMarkup(pos, null, { ...node.attrs, [prop]: alignment });\n }\n });\n editor.view.dispatch(tr);\n}\n"],"mappings":";AAEA,SAAgB,iBAAiB,QAAgB,WAAmB;CAClE,MAAM,EAAE,MAAM,OAAO,OAAO,MAAM;CAClC,MAAM,KAAK,OAAO,MAAM;AACxB,QAAO,MAAM,IAAI,aAAa,MAAM,KAAK,MAAM,QAAQ;AACrD,MAAI,KAAK,aAAa;GACpB,MAAM,OAAO,WAAW,KAAK,QAAQ,UAAU;AAC/C,MAAG,cAAc,KAAK,MAAM;IAAE,GAAG,KAAK;KAAQ,OAAO;IAAW,CAAC;;GAEnE;AACF,QAAO,KAAK,SAAS,GAAG"}
@@ -191,4 +191,4 @@ function resolveConflictingStyles(resetStyles, inlineStyles) {
191
191
 
192
192
  //#endregion
193
193
  export { inlineCssToJs as n, resolveConflictingStyles as r, ensureBorderStyleFallback as t };
194
- //# sourceMappingURL=styles-DLviD0JK.mjs.map
194
+ //# sourceMappingURL=styles-_TMw3YxC.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles-DLviD0JK.mjs","names":[],"sources":["../src/utils/styles.ts"],"sourcesContent":["import type { CssJs } from './types';\n\nconst WHITE_SPACE_REGEX = /\\s+/;\n\nconst BORDER_WIDTH_TO_STYLE: Record<string, string> = {\n borderWidth: 'borderStyle',\n borderTopWidth: 'borderTopStyle',\n borderRightWidth: 'borderRightStyle',\n borderBottomWidth: 'borderBottomStyle',\n borderLeftWidth: 'borderLeftStyle',\n};\n\nexport const jsToInlineCss = (styleObject: { [key: string]: any }) => {\n const parts: string[] = [];\n\n for (const key in styleObject) {\n const value = styleObject[key];\n if (value !== 0 && value !== undefined && value !== null && value !== '') {\n const KEBAB_CASE_REGEX = /[A-Z]/g;\n const formattedKey = key.replace(\n KEBAB_CASE_REGEX,\n (match) => `-${match.toLowerCase()}`,\n );\n parts.push(`${formattedKey}:${value}`);\n }\n }\n\n return parts.join(';') + (parts.length ? ';' : '');\n};\n\nexport const inlineCssToJs = (\n inlineStyle: string,\n options: { removeUnit?: boolean } = {},\n) => {\n const styleObject: { [key: string]: string } = {};\n\n if (!inlineStyle || inlineStyle === '' || typeof inlineStyle === 'object') {\n return styleObject;\n }\n\n inlineStyle.split(';').forEach((style: string) => {\n if (style.trim()) {\n const [key, value] = style.split(':');\n const valueTrimmed = value?.trim();\n\n if (!valueTrimmed) {\n return;\n }\n\n const formattedKey = key\n .trim()\n .replace(/-\\w/g, (match) => match[1].toUpperCase());\n\n const UNIT_REGEX = /px|%/g;\n const sanitizedValue = options?.removeUnit\n ? valueTrimmed.replace(UNIT_REGEX, '')\n : valueTrimmed;\n\n styleObject[formattedKey] = sanitizedValue;\n }\n });\n\n return styleObject;\n};\n\n/**\n * Expands CSS shorthand properties (margin, padding) into their longhand equivalents.\n * This prevents shorthand properties from overriding specific longhand properties in email clients.\n *\n * @param styles - Style object that may contain shorthand properties\n * @returns New style object with shorthand properties expanded to longhand\n *\n * @example\n * expandShorthandProperties({ margin: '0', paddingTop: '10px' })\n * // Returns: { marginTop: '0', marginRight: '0', marginBottom: '0', marginLeft: '0', paddingTop: '10px' }\n */\nexport function expandShorthandProperties(\n styles: Record<string, string>,\n): Record<string, string> {\n if (!styles || typeof styles !== 'object') {\n return {};\n }\n\n const expanded: Record<string, any> = {};\n\n for (const key in styles) {\n const value = styles[key];\n if (value === undefined || value === null || value === '') {\n continue;\n }\n\n switch (key) {\n case 'margin': {\n const values = parseShorthandValue(value);\n expanded.marginTop = values.top;\n expanded.marginRight = values.right;\n expanded.marginBottom = values.bottom;\n expanded.marginLeft = values.left;\n break;\n }\n case 'padding': {\n const values = parseShorthandValue(value);\n expanded.paddingTop = values.top;\n expanded.paddingRight = values.right;\n expanded.paddingBottom = values.bottom;\n expanded.paddingLeft = values.left;\n break;\n }\n case 'border': {\n const values = convertBorderValue(value);\n expanded.borderStyle = values.style;\n expanded.borderWidth = values.width;\n expanded.borderColor = values.color;\n break;\n }\n case 'borderTopLeftRadius':\n case 'borderTopRightRadius':\n case 'borderBottomLeftRadius':\n case 'borderBottomRightRadius': {\n // Always preserve the longhand property\n expanded[key] = value;\n\n // When all four corners are present and identical, also add the shorthand\n if (\n styles.borderTopLeftRadius &&\n styles.borderTopRightRadius &&\n styles.borderBottomLeftRadius &&\n styles.borderBottomRightRadius\n ) {\n const values = [\n styles.borderTopLeftRadius,\n styles.borderTopRightRadius,\n styles.borderBottomLeftRadius,\n styles.borderBottomRightRadius,\n ];\n\n if (new Set(values).size === 1) {\n expanded.borderRadius = values[0];\n }\n }\n\n break;\n }\n\n default: {\n // Keep all other properties as-is\n expanded[key] = value;\n }\n }\n }\n\n return expanded;\n}\n\n/**\n * Parses CSS shorthand value (1-4 values) into individual side values.\n * Follows CSS specification for shorthand property value parsing.\n *\n * @param value - Shorthand value string (e.g., '0', '10px 20px', '5px 10px 15px 20px')\n * @returns Object with top, right, bottom, left values\n */\nfunction parseShorthandValue(value: string | number): {\n top: string;\n right: string;\n bottom: string;\n left: string;\n} {\n const stringValue = String(value).trim();\n const parts = stringValue.split(WHITE_SPACE_REGEX);\n const len = parts.length;\n\n if (len === 1) {\n return { top: parts[0], right: parts[0], bottom: parts[0], left: parts[0] };\n }\n if (len === 2) {\n return { top: parts[0], right: parts[1], bottom: parts[0], left: parts[1] };\n }\n if (len === 3) {\n return { top: parts[0], right: parts[1], bottom: parts[2], left: parts[1] };\n }\n if (len === 4) {\n return { top: parts[0], right: parts[1], bottom: parts[2], left: parts[3] };\n }\n\n return {\n top: stringValue,\n right: stringValue,\n bottom: stringValue,\n left: stringValue,\n };\n}\n\nfunction convertBorderValue(value: string | number): {\n style: string;\n width: string;\n color: string;\n} {\n const stringValue = String(value).trim();\n const parts = stringValue.split(WHITE_SPACE_REGEX);\n\n switch (parts.length) {\n case 1:\n // border: 1px → all sides\n return {\n style: 'solid',\n width: parts[0],\n color: 'black',\n };\n case 2:\n // border: 1px solid → top/bottom, left/right\n return {\n style: parts[1],\n width: parts[0],\n color: 'black',\n };\n case 3:\n // border: 1px solid #000 → top, left/right, bottom\n return {\n style: parts[1],\n width: parts[0],\n color: parts[2],\n };\n case 4:\n // border: 1px solid #000 #fff → top, right, bottom, left\n return {\n style: parts[1],\n width: parts[0],\n color: parts[2],\n };\n default:\n // Invalid format, return the original value for all sides\n return {\n style: 'solid',\n width: stringValue,\n color: 'black',\n };\n }\n}\n\n/**\n * When a border-width is present but border-style is missing, browsers default\n * to `none` and the border is invisible. This adds `solid` as a sensible\n * fallback so borders show up immediately after setting a width.\n */\nexport function ensureBorderStyleFallback(\n styles: Record<string, string | number>,\n): Record<string, string | number> {\n for (const [widthKey, styleKey] of Object.entries(BORDER_WIDTH_TO_STYLE)) {\n const widthValue = styles[widthKey];\n if (!widthValue || widthValue === '0' || widthValue === '0px') {\n continue;\n }\n if (!styles[styleKey]) {\n // Keep shorthand borderStyle authoritative for each side when present.\n if (styleKey !== 'borderStyle' && styles.borderStyle) {\n continue;\n }\n styles[styleKey] = 'solid';\n }\n }\n return styles;\n}\n\n/**\n * Resolves conflicts between reset styles and inline styles by expanding\n * shorthand properties (margin, padding) to longhand before merging.\n * This prevents shorthand properties from overriding specific longhand properties.\n *\n * @param resetStyles - Base reset styles that may contain shorthand properties\n * @param inlineStyles - Inline styles that should override reset styles\n * @returns Merged styles with inline styles taking precedence\n */\nexport function resolveConflictingStyles(\n resetStyles: CssJs['reset'],\n inlineStyles: Record<string, string>,\n) {\n const expandedResetStyles = expandShorthandProperties(\n resetStyles as Record<string, string>,\n );\n const expandedInlineStyles = expandShorthandProperties(inlineStyles);\n\n return {\n ...expandedResetStyles,\n ...expandedInlineStyles,\n };\n}\n"],"mappings":";AAEA,MAAM,oBAAoB;AAE1B,MAAM,wBAAgD;CACpD,aAAa;CACb,gBAAgB;CAChB,kBAAkB;CAClB,mBAAmB;CACnB,iBAAiB;CAClB;AAoBD,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K,EAEH,QAAO;GACL,OAAO,MAAM;GACb,OAAO,MAAM;GACb,OAAO,MAAM;GACd;EACH,QAEE,QAAO;GACL,OAAO;GACP,OAAO;GACP,OAAO;GACR;;;;;;;;AASP,SAAgB,0BACd,QACiC;AACjC,MAAK,MAAM,CAAC,UAAU,aAAa,OAAO,QAAQ,sBAAsB,EAAE;EACxE,MAAM,aAAa,OAAO;AAC1B,MAAI,CAAC,cAAc,eAAe,OAAO,eAAe,MACtD;AAEF,MAAI,CAAC,OAAO,WAAW;AAErB,OAAI,aAAa,iBAAiB,OAAO,YACvC;AAEF,UAAO,YAAY;;;AAGvB,QAAO;;;;;;;;;;;AAYT,SAAgB,yBACd,aACA,cACA;CACA,MAAM,sBAAsB,0BAC1B,YACD;CACD,MAAM,uBAAuB,0BAA0B,aAAa;AAEpE,QAAO;EACL,GAAG;EACH,GAAG;EACJ"}
1
+ {"version":3,"file":"styles-_TMw3YxC.mjs","names":[],"sources":["../src/utils/styles.ts"],"sourcesContent":["import type { CssJs } from './types';\n\nconst WHITE_SPACE_REGEX = /\\s+/;\n\nconst BORDER_WIDTH_TO_STYLE: Record<string, string> = {\n borderWidth: 'borderStyle',\n borderTopWidth: 'borderTopStyle',\n borderRightWidth: 'borderRightStyle',\n borderBottomWidth: 'borderBottomStyle',\n borderLeftWidth: 'borderLeftStyle',\n};\n\nexport const jsToInlineCss = (styleObject: { [key: string]: any }) => {\n const parts: string[] = [];\n\n for (const key in styleObject) {\n const value = styleObject[key];\n if (value !== 0 && value !== undefined && value !== null && value !== '') {\n const KEBAB_CASE_REGEX = /[A-Z]/g;\n const formattedKey = key.replace(\n KEBAB_CASE_REGEX,\n (match) => `-${match.toLowerCase()}`,\n );\n parts.push(`${formattedKey}:${value}`);\n }\n }\n\n return parts.join(';') + (parts.length ? ';' : '');\n};\n\nexport const inlineCssToJs = (\n inlineStyle: string,\n options: { removeUnit?: boolean } = {},\n) => {\n const styleObject: { [key: string]: string } = {};\n\n if (!inlineStyle || inlineStyle === '' || typeof inlineStyle === 'object') {\n return styleObject;\n }\n\n inlineStyle.split(';').forEach((style: string) => {\n if (style.trim()) {\n const [key, value] = style.split(':');\n const valueTrimmed = value?.trim();\n\n if (!valueTrimmed) {\n return;\n }\n\n const formattedKey = key\n .trim()\n .replace(/-\\w/g, (match) => match[1].toUpperCase());\n\n const UNIT_REGEX = /px|%/g;\n const sanitizedValue = options?.removeUnit\n ? valueTrimmed.replace(UNIT_REGEX, '')\n : valueTrimmed;\n\n styleObject[formattedKey] = sanitizedValue;\n }\n });\n\n return styleObject;\n};\n\n/**\n * Expands CSS shorthand properties (margin, padding) into their longhand equivalents.\n * This prevents shorthand properties from overriding specific longhand properties in email clients.\n *\n * @param styles - Style object that may contain shorthand properties\n * @returns New style object with shorthand properties expanded to longhand\n *\n * @example\n * expandShorthandProperties({ margin: '0', paddingTop: '10px' })\n * // Returns: { marginTop: '0', marginRight: '0', marginBottom: '0', marginLeft: '0', paddingTop: '10px' }\n */\nexport function expandShorthandProperties(\n styles: Record<string, string>,\n): Record<string, string> {\n if (!styles || typeof styles !== 'object') {\n return {};\n }\n\n const expanded: Record<string, any> = {};\n\n for (const key in styles) {\n const value = styles[key];\n if (value === undefined || value === null || value === '') {\n continue;\n }\n\n switch (key) {\n case 'margin': {\n const values = parseShorthandValue(value);\n expanded.marginTop = values.top;\n expanded.marginRight = values.right;\n expanded.marginBottom = values.bottom;\n expanded.marginLeft = values.left;\n break;\n }\n case 'padding': {\n const values = parseShorthandValue(value);\n expanded.paddingTop = values.top;\n expanded.paddingRight = values.right;\n expanded.paddingBottom = values.bottom;\n expanded.paddingLeft = values.left;\n break;\n }\n case 'border': {\n const values = convertBorderValue(value);\n expanded.borderStyle = values.style;\n expanded.borderWidth = values.width;\n expanded.borderColor = values.color;\n break;\n }\n case 'borderTopLeftRadius':\n case 'borderTopRightRadius':\n case 'borderBottomLeftRadius':\n case 'borderBottomRightRadius': {\n // Always preserve the longhand property\n expanded[key] = value;\n\n // When all four corners are present and identical, also add the shorthand\n if (\n styles.borderTopLeftRadius &&\n styles.borderTopRightRadius &&\n styles.borderBottomLeftRadius &&\n styles.borderBottomRightRadius\n ) {\n const values = [\n styles.borderTopLeftRadius,\n styles.borderTopRightRadius,\n styles.borderBottomLeftRadius,\n styles.borderBottomRightRadius,\n ];\n\n if (new Set(values).size === 1) {\n expanded.borderRadius = values[0];\n }\n }\n\n break;\n }\n\n default: {\n // Keep all other properties as-is\n expanded[key] = value;\n }\n }\n }\n\n return expanded;\n}\n\n/**\n * Parses CSS shorthand value (1-4 values) into individual side values.\n * Follows CSS specification for shorthand property value parsing.\n *\n * @param value - Shorthand value string (e.g., '0', '10px 20px', '5px 10px 15px 20px')\n * @returns Object with top, right, bottom, left values\n */\nfunction parseShorthandValue(value: string | number): {\n top: string;\n right: string;\n bottom: string;\n left: string;\n} {\n const stringValue = String(value).trim();\n const parts = stringValue.split(WHITE_SPACE_REGEX);\n const len = parts.length;\n\n if (len === 1) {\n return { top: parts[0], right: parts[0], bottom: parts[0], left: parts[0] };\n }\n if (len === 2) {\n return { top: parts[0], right: parts[1], bottom: parts[0], left: parts[1] };\n }\n if (len === 3) {\n return { top: parts[0], right: parts[1], bottom: parts[2], left: parts[1] };\n }\n if (len === 4) {\n return { top: parts[0], right: parts[1], bottom: parts[2], left: parts[3] };\n }\n\n return {\n top: stringValue,\n right: stringValue,\n bottom: stringValue,\n left: stringValue,\n };\n}\n\nfunction convertBorderValue(value: string | number): {\n style: string;\n width: string;\n color: string;\n} {\n const stringValue = String(value).trim();\n const parts = stringValue.split(WHITE_SPACE_REGEX);\n\n switch (parts.length) {\n case 1:\n // border: 1px → all sides\n return {\n style: 'solid',\n width: parts[0],\n color: 'black',\n };\n case 2:\n // border: 1px solid → top/bottom, left/right\n return {\n style: parts[1],\n width: parts[0],\n color: 'black',\n };\n case 3:\n // border: 1px solid #000 → top, left/right, bottom\n return {\n style: parts[1],\n width: parts[0],\n color: parts[2],\n };\n case 4:\n // border: 1px solid #000 #fff → top, right, bottom, left\n return {\n style: parts[1],\n width: parts[0],\n color: parts[2],\n };\n default:\n // Invalid format, return the original value for all sides\n return {\n style: 'solid',\n width: stringValue,\n color: 'black',\n };\n }\n}\n\n/**\n * When a border-width is present but border-style is missing, browsers default\n * to `none` and the border is invisible. This adds `solid` as a sensible\n * fallback so borders show up immediately after setting a width.\n */\nexport function ensureBorderStyleFallback(\n styles: Record<string, string | number>,\n): Record<string, string | number> {\n for (const [widthKey, styleKey] of Object.entries(BORDER_WIDTH_TO_STYLE)) {\n const widthValue = styles[widthKey];\n if (!widthValue || widthValue === '0' || widthValue === '0px') {\n continue;\n }\n if (!styles[styleKey]) {\n // Keep shorthand borderStyle authoritative for each side when present.\n if (styleKey !== 'borderStyle' && styles.borderStyle) {\n continue;\n }\n styles[styleKey] = 'solid';\n }\n }\n return styles;\n}\n\n/**\n * Resolves conflicts between reset styles and inline styles by expanding\n * shorthand properties (margin, padding) to longhand before merging.\n * This prevents shorthand properties from overriding specific longhand properties.\n *\n * @param resetStyles - Base reset styles that may contain shorthand properties\n * @param inlineStyles - Inline styles that should override reset styles\n * @returns Merged styles with inline styles taking precedence\n */\nexport function resolveConflictingStyles(\n resetStyles: CssJs['reset'],\n inlineStyles: Record<string, string>,\n) {\n const expandedResetStyles = expandShorthandProperties(\n resetStyles as Record<string, string>,\n );\n const expandedInlineStyles = expandShorthandProperties(inlineStyles);\n\n return {\n ...expandedResetStyles,\n ...expandedInlineStyles,\n };\n}\n"],"mappings":";AAEA,MAAM,oBAAoB;AAE1B,MAAM,wBAAgD;CACpD,aAAa;CACb,gBAAgB;CAChB,kBAAkB;CAClB,mBAAmB;CACnB,iBAAiB;CAClB;AAoBD,MAAa,iBACX,aACA,UAAoC,EAAE,KACnC;CACH,MAAM,cAAyC,EAAE;AAEjD,KAAI,CAAC,eAAe,gBAAgB,MAAM,OAAO,gBAAgB,SAC/D,QAAO;AAGT,aAAY,MAAM,IAAI,CAAC,SAAS,UAAkB;AAChD,MAAI,MAAM,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