@payloadcms/richtext-lexical 4.0.0-internal.d1cc1d3 → 4.0.0-internal.d21c039

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 (177) hide show
  1. package/dist/exports/client/Field-QKAL7KMC.js +2 -0
  2. package/dist/exports/client/Field-QKAL7KMC.js.map +7 -0
  3. package/dist/exports/client/bundled.css +1 -1
  4. package/dist/exports/client/chunk-LN6VX25I.js +2 -0
  5. package/dist/exports/client/{chunk-SSMQFWCQ.js.map → chunk-LN6VX25I.js.map} +4 -4
  6. package/dist/exports/client/index.js +26 -26
  7. package/dist/exports/client/index.js.map +4 -4
  8. package/dist/features/converters/lexicalToHtml/async/converters/heading.js +1 -1
  9. package/dist/features/converters/lexicalToHtml/async/converters/heading.js.map +1 -1
  10. package/dist/features/converters/lexicalToHtml/async/converters/list.d.ts.map +1 -1
  11. package/dist/features/converters/lexicalToHtml/async/converters/list.js +4 -3
  12. package/dist/features/converters/lexicalToHtml/async/converters/list.js.map +1 -1
  13. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.d.ts.map +1 -1
  14. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js +3 -2
  15. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js.map +1 -1
  16. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js +1 -1
  17. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js.map +1 -1
  18. package/dist/features/converters/lexicalToHtml/sync/converters/list.d.ts.map +1 -1
  19. package/dist/features/converters/lexicalToHtml/sync/converters/list.js +4 -3
  20. package/dist/features/converters/lexicalToHtml/sync/converters/list.js.map +1 -1
  21. package/dist/features/converters/lexicalToJSX/converter/converters/heading.d.ts.map +1 -1
  22. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js +2 -1
  23. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js.map +1 -1
  24. package/dist/features/converters/lexicalToJSX/converter/converters/list.d.ts.map +1 -1
  25. package/dist/features/converters/lexicalToJSX/converter/converters/list.js +2 -1
  26. package/dist/features/converters/lexicalToJSX/converter/converters/list.js.map +1 -1
  27. package/dist/features/heading/constants.d.ts +2 -0
  28. package/dist/features/heading/constants.d.ts.map +1 -0
  29. package/dist/features/heading/constants.js +2 -0
  30. package/dist/features/heading/constants.js.map +1 -0
  31. package/dist/features/heading/server/index.d.ts.map +1 -1
  32. package/dist/features/heading/server/index.js +5 -1
  33. package/dist/features/heading/server/index.js.map +1 -1
  34. package/dist/features/heading/server/validate.d.ts +6 -0
  35. package/dist/features/heading/server/validate.d.ts.map +1 -0
  36. package/dist/features/heading/server/validate.js +15 -0
  37. package/dist/features/heading/server/validate.js.map +1 -0
  38. package/dist/features/link/server/baseFields.d.ts.map +1 -1
  39. package/dist/features/link/server/baseFields.js +4 -5
  40. package/dist/features/link/server/baseFields.js.map +1 -1
  41. package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
  42. package/dist/features/lists/checklist/server/index.js +5 -2
  43. package/dist/features/lists/checklist/server/index.js.map +1 -1
  44. package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
  45. package/dist/features/lists/orderedList/server/index.js +5 -2
  46. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  47. package/dist/features/lists/shared/constants.d.ts +2 -0
  48. package/dist/features/lists/shared/constants.d.ts.map +1 -0
  49. package/dist/features/lists/shared/constants.js +2 -0
  50. package/dist/features/lists/shared/constants.js.map +1 -0
  51. package/dist/features/lists/shared/validate.d.ts +5 -0
  52. package/dist/features/lists/shared/validate.d.ts.map +1 -0
  53. package/dist/features/lists/shared/validate.js +15 -0
  54. package/dist/features/lists/shared/validate.js.map +1 -0
  55. package/dist/features/lists/unorderedList/server/index.d.ts.map +1 -1
  56. package/dist/features/lists/unorderedList/server/index.js +5 -2
  57. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  58. package/dist/features/relationship/client/index.d.ts +2 -2
  59. package/dist/features/relationship/client/index.d.ts.map +1 -1
  60. package/dist/features/relationship/client/index.js.map +1 -1
  61. package/dist/features/relationship/client/plugins/index.d.ts +2 -2
  62. package/dist/features/relationship/client/plugins/index.d.ts.map +1 -1
  63. package/dist/features/relationship/client/plugins/index.js +27 -31
  64. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  65. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts +2 -4
  66. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -1
  67. package/dist/features/relationship/client/utils/useEnabledRelationships.js +53 -20
  68. package/dist/features/relationship/client/utils/useEnabledRelationships.js.map +1 -1
  69. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts +2 -2
  70. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts.map +1 -1
  71. package/dist/features/relationship/server/graphQLPopulationPromise.js +2 -2
  72. package/dist/features/relationship/server/graphQLPopulationPromise.js.map +1 -1
  73. package/dist/features/relationship/server/index.d.ts +8 -1
  74. package/dist/features/relationship/server/index.d.ts.map +1 -1
  75. package/dist/features/relationship/server/index.js +28 -11
  76. package/dist/features/relationship/server/index.js.map +1 -1
  77. package/dist/features/relationship/server/schema.d.ts +2 -2
  78. package/dist/features/relationship/server/schema.d.ts.map +1 -1
  79. package/dist/features/relationship/server/schema.js +5 -10
  80. package/dist/features/relationship/server/schema.js.map +1 -1
  81. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts +1 -6
  82. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts.map +1 -1
  83. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js +3 -8
  84. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js.map +1 -1
  85. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts +8 -0
  86. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts.map +1 -0
  87. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js +19 -0
  88. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js.map +1 -0
  89. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.d.ts.map +1 -1
  90. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.js +16 -43
  91. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
  92. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.d.ts +8 -0
  93. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.d.ts.map +1 -0
  94. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js +80 -0
  95. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js.map +1 -0
  96. package/dist/features/toolbars/fixed/client/Toolbar/index.css +79 -5
  97. package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
  98. package/dist/features/toolbars/fixed/client/Toolbar/index.js +4 -1
  99. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  100. package/dist/features/toolbars/shared/ToolbarDropdown/index.css +12 -11
  101. package/dist/features/upload/client/index.d.ts +3 -2
  102. package/dist/features/upload/client/index.d.ts.map +1 -1
  103. package/dist/features/upload/client/index.js.map +1 -1
  104. package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
  105. package/dist/features/upload/client/plugin/index.js +47 -52
  106. package/dist/features/upload/client/plugin/index.js.map +1 -1
  107. package/dist/features/upload/server/graphQLPopulationPromise.d.ts +2 -2
  108. package/dist/features/upload/server/graphQLPopulationPromise.d.ts.map +1 -1
  109. package/dist/features/upload/server/graphQLPopulationPromise.js +1 -1
  110. package/dist/features/upload/server/graphQLPopulationPromise.js.map +1 -1
  111. package/dist/features/upload/server/index.d.ts +6 -2
  112. package/dist/features/upload/server/index.d.ts.map +1 -1
  113. package/dist/features/upload/server/index.js +18 -14
  114. package/dist/features/upload/server/index.js.map +1 -1
  115. package/dist/features/upload/server/schema.d.ts +2 -2
  116. package/dist/features/upload/server/schema.d.ts.map +1 -1
  117. package/dist/features/upload/server/schema.js +4 -8
  118. package/dist/features/upload/server/schema.js.map +1 -1
  119. package/dist/features/upload/server/validate.d.ts +2 -2
  120. package/dist/features/upload/server/validate.d.ts.map +1 -1
  121. package/dist/features/upload/server/validate.js +3 -0
  122. package/dist/features/upload/server/validate.js.map +1 -1
  123. package/dist/field/Diff/converters/listitem/index.d.ts.map +1 -1
  124. package/dist/field/Diff/converters/listitem/index.js +2 -1
  125. package/dist/field/Diff/converters/listitem/index.js.map +1 -1
  126. package/dist/field/Diff/index.css +19 -22
  127. package/dist/field/Diff/index.d.ts.map +1 -1
  128. package/dist/field/Diff/index.js +1 -0
  129. package/dist/field/Diff/index.js.map +1 -1
  130. package/dist/field/RenderLexical/index.d.ts +3 -1
  131. package/dist/field/RenderLexical/index.d.ts.map +1 -1
  132. package/dist/field/RenderLexical/index.js +23 -23
  133. package/dist/field/RenderLexical/index.js.map +1 -1
  134. package/dist/field/bundled.css +1 -1
  135. package/dist/field/index.css +14 -10
  136. package/dist/i18n.d.ts.map +1 -1
  137. package/dist/i18n.js +68 -0
  138. package/dist/i18n.js.map +1 -1
  139. package/dist/index.d.ts +1 -1
  140. package/dist/index.js +1 -1
  141. package/dist/index.js.map +1 -1
  142. package/dist/lexical/LexicalEditor.css +2 -2
  143. package/dist/lexical/LexicalEditor.js.map +1 -1
  144. package/dist/lexical/plugins/InsertParagraphAtEnd/index.css +16 -23
  145. package/dist/lexical/plugins/InsertParagraphAtEnd/index.d.ts.map +1 -1
  146. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js +27 -14
  147. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
  148. package/dist/lexical/theme/EditorTheme.css +25 -37
  149. package/dist/lexical/ui/ContentEditable.css +1 -0
  150. package/dist/lexical/ui/icons/H3/index.d.ts.map +1 -1
  151. package/dist/lexical/ui/icons/H3/index.js +13 -6
  152. package/dist/lexical/ui/icons/H3/index.js.map +1 -1
  153. package/dist/lexical/ui/icons/H4/index.d.ts.map +1 -1
  154. package/dist/lexical/ui/icons/H4/index.js +13 -6
  155. package/dist/lexical/ui/icons/H4/index.js.map +1 -1
  156. package/dist/lexical/ui/icons/H5/index.d.ts.map +1 -1
  157. package/dist/lexical/ui/icons/H5/index.js +13 -6
  158. package/dist/lexical/ui/icons/H5/index.js.map +1 -1
  159. package/dist/lexical/ui/icons/H6/index.d.ts.map +1 -1
  160. package/dist/lexical/ui/icons/H6/index.js +13 -6
  161. package/dist/lexical/ui/icons/H6/index.js.map +1 -1
  162. package/package.json +22 -22
  163. package/dist/dependencyChecker.spec.js +0 -16
  164. package/dist/dependencyChecker.spec.js.map +0 -1
  165. package/dist/exports/client/Field-IZKDIUJY.js +0 -2
  166. package/dist/exports/client/Field-IZKDIUJY.js.map +0 -7
  167. package/dist/exports/client/chunk-SSMQFWCQ.js +0 -2
  168. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js +0 -180
  169. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js.map +0 -1
  170. package/dist/features/link/markdownTransformer.spec.js +0 -195
  171. package/dist/features/link/markdownTransformer.spec.js.map +0 -1
  172. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js +0 -88
  173. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js.map +0 -1
  174. package/dist/lexical/utils/url.spec.js +0 -114
  175. package/dist/lexical/utils/url.spec.js.map +0 -1
  176. package/dist/utilities/jsx/jsx.spec.js +0 -178
  177. package/dist/utilities/jsx/jsx.spec.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"url.spec.js","names":["describe","it","expect","absoluteRegExp","relativeOrAnchorRegExp","validateUrl","shouldMatch","forEach","testCase","test","toBe","shouldNotMatch","not","validUrls","url","invalidUrls"],"sources":["../../../src/lexical/utils/url.spec.ts"],"sourcesContent":["import { describe, it, expect } from 'vitest'\nimport { absoluteRegExp, relativeOrAnchorRegExp, validateUrl } from './url.js'\n\ndescribe('Lexical URL Regex Matchers', () => {\n describe('relativeOrAnchorRegExp', () => {\n it('validation for links it should match', async () => {\n const shouldMatch = [\n '/path/to/resource',\n '/file-name.html',\n '/',\n '/dir/',\n '/path.with.dots/',\n '#anchor',\n '#section-title',\n '/path#fragment',\n '/page?id=123',\n '/page?id=123#section',\n '/search?q=test',\n '/?global=true',\n ]\n\n shouldMatch.forEach((testCase) => {\n expect(relativeOrAnchorRegExp.test(testCase)).toBe(true)\n })\n })\n\n it('validation for links it should not match', async () => {\n const shouldNotMatch = [\n 'match',\n 'http://example.com',\n 'relative/path',\n 'file.html',\n 'some#fragment',\n '#',\n '/#',\n '/path/with spaces',\n '',\n 'ftp://example.com',\n ]\n\n shouldNotMatch.forEach((testCase) => {\n expect(relativeOrAnchorRegExp.test(testCase)).not.toBe(true)\n })\n })\n })\n\n describe('absoluteRegExp', () => {\n it('validation for links it should match', async () => {\n const shouldMatch = [\n 'http://example.com',\n 'https://example.com',\n 'ftp://files.example.com',\n 'http://example.com/resource',\n 'https://example.com/resource?key=value',\n 'http://example.com/resource#anchor',\n 'http://www.example.com',\n 'https://sub.example.com/path/file',\n 'mailto:email@example.com',\n 'tel:+1234567890',\n 'http://user:pass@example.com',\n 'www.example.com',\n 'www.example.com/resource',\n 'www.example.com/resource?query=1',\n 'www.example.com#fragment',\n ]\n\n shouldMatch.forEach((testCase) => {\n expect(absoluteRegExp.test(testCase)).toBe(true)\n })\n })\n\n it('validation for links it should not match', async () => {\n const shouldNotMatch = [\n '/relative/path',\n '#anchor',\n 'example.com',\n '://missing.scheme',\n 'http://',\n 'http:/example.com',\n 'ftp://example .com',\n 'http://example',\n 'not-a-url',\n 'http//example.com',\n 'https://example.com/ spaces',\n ]\n\n shouldNotMatch.forEach((testCase) => {\n expect(absoluteRegExp.test(testCase)).not.toBe(true)\n })\n })\n })\n\n describe('validateUrl', () => {\n describe('absolute URLs', () => {\n it('should validate http and https URLs', () => {\n const validUrls = [\n 'http://example.com',\n 'https://example.com',\n 'http://www.example.com',\n 'https://sub.example.com/path/file',\n 'http://example.com/resource',\n 'https://example.com/resource?key=value',\n 'http://example.com/resource#anchor',\n ]\n\n validUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(true)\n })\n })\n\n it('should validate other protocol URLs', () => {\n const validUrls = ['ftp://files.example.com', 'mailto:email@example.com', 'tel:+1234567890']\n\n validUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(true)\n })\n })\n\n it('should validate www URLs without protocol', () => {\n const validUrls = [\n 'www.example.com',\n 'www.example.com/resource',\n 'www.example.com/resource?query=1',\n 'www.example.com#fragment',\n ]\n\n validUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(true)\n })\n })\n })\n\n describe('relative URLs', () => {\n it('should validate relative paths', () => {\n const validUrls = [\n '/path/to/resource',\n '/file-name.html',\n '/',\n '/dir/',\n '/path.with.dots/',\n '/path#fragment',\n ]\n\n validUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(true)\n })\n })\n })\n\n describe('anchor links', () => {\n it('should validate anchor links', () => {\n const validUrls = ['#anchor', '#section-title']\n\n validUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(true)\n })\n })\n })\n\n describe('with query params', () => {\n it('should validate relative URLs with query parameters', () => {\n const validUrls = [\n '/page?id=123',\n '/search?q=test',\n '/products?category=electronics&sort=price',\n '/path?key=value&another=param',\n '/page?id=123&filter=active',\n '/?global=true',\n ]\n\n validUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(true)\n })\n })\n\n it('should validate absolute URLs with query parameters', () => {\n const validUrls = [\n 'https://example.com?id=123',\n 'http://example.com/page?key=value',\n 'www.example.com?search=query',\n 'https://example.com/path?a=1&b=2&c=3',\n ]\n\n validUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(true)\n })\n })\n\n it('should validate URLs with query parameters and anchors', () => {\n const validUrls = [\n '/page?id=123#section',\n 'https://example.com?key=value#anchor',\n '/search?q=test#results',\n ]\n\n validUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(true)\n })\n })\n })\n\n describe('edge cases', () => {\n it('should handle the default https:// case', () => {\n expect(validateUrl('https://')).toBe(true)\n })\n\n it('should return false for empty or invalid URLs', () => {\n const invalidUrls = [\n '',\n 'not-a-url',\n 'example.com',\n 'relative/path',\n 'file.html',\n 'some#fragment',\n 'http://',\n 'http:/example.com',\n 'http//example.com',\n ]\n\n invalidUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(false)\n })\n })\n\n it('should return false for URLs with spaces', () => {\n const invalidUrls = [\n '/path/with spaces',\n 'http://example.com/ spaces',\n 'https://example.com/path with spaces',\n ]\n\n invalidUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(false)\n })\n })\n\n it('should return false for malformed URLs', () => {\n const invalidUrls = ['://missing.scheme', 'ftp://example .com', 'http://example', '#', '/#']\n\n invalidUrls.forEach((url) => {\n expect(validateUrl(url)).toBe(false)\n })\n })\n })\n })\n})\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,EAAE,EAAEC,MAAM,QAAQ;AACrC,SAASC,cAAc,EAAEC,sBAAsB,EAAEC,WAAW,QAAQ;AAEpEL,QAAA,CAAS,8BAA8B;EACrCA,QAAA,CAAS,0BAA0B;IACjCC,EAAA,CAAG,wCAAwC;MACzC,MAAMK,WAAA,GAAc,CAClB,qBACA,mBACA,KACA,SACA,oBACA,WACA,kBACA,kBACA,gBACA,wBACA,kBACA,gBACD;MAEDA,WAAA,CAAYC,OAAO,CAAEC,QAAA;QACnBN,MAAA,CAAOE,sBAAA,CAAuBK,IAAI,CAACD,QAAA,GAAWE,IAAI,CAAC;MACrD;IACF;IAEAT,EAAA,CAAG,4CAA4C;MAC7C,MAAMU,cAAA,GAAiB,CACrB,SACA,sBACA,iBACA,aACA,iBACA,KACA,MACA,qBACA,IACA,oBACD;MAEDA,cAAA,CAAeJ,OAAO,CAAEC,QAAA;QACtBN,MAAA,CAAOE,sBAAA,CAAuBK,IAAI,CAACD,QAAA,GAAWI,GAAG,CAACF,IAAI,CAAC;MACzD;IACF;EACF;EAEAV,QAAA,CA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ACA,aACA,eACA,iBACA,aACA,iBACA,WACA,qBACA,oBACD;QAEDA,WAAA,CAAYR,OAAO,CAAEO,GAAA;UACnBZ,MAAA,CAAOG,WAAA,CAAYS,GAAA,GAAMJ,IAAI,CAAC;QAChC;MACF;MAEAT,EAAA,CAAG,4CAA4C;QAC7C,MAAMc,WAAA,GAAc,CAClB,qBACA,8BACA,uCACD;QAEDA,WAAA,CAAYR,OAAO,CAAEO,GAAA;UACnBZ,MAAA,CAAOG,WAAA,CAAYS,GAAA,GAAMJ,IAAI,CAAC;QAChC;MACF;MAEAT,EAAA,CAAG,0CAA0C;QAC3C,MAAMc,WAAA,GAAc,CAAC,qBAAqB,sBAAsB,kBAAkB,KAAK,KAAK;QAE5FA,WAAA,CAAYR,OAAO,CAAEO,GAAA;UACnBZ,MAAA,CAAOG,WAAA,CAAYS,GAAA,GAAMJ,IAAI,CAAC;QAChC;MACF;IACF;EACF;AACF","ignoreList":[]}
@@ -1,178 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { extractPropsFromJSXPropsString } from './extractPropsFromJSXPropsString.js';
3
- import { propsToJSXString } from './jsx.js';
4
- describe('jsx', () => {
5
- describe('prop string to object', () => {
6
- const INPUT_AND_OUTPUT = [{
7
- input: 'key="value"',
8
- output: {
9
- key: 'value'
10
- }
11
- }, {
12
- input: "key='value'",
13
- output: {
14
- key: 'value'
15
- },
16
- inputFromOutput: 'key="value"'
17
- }, {
18
- input: 'key={[1, 2, 3]}',
19
- output: {
20
- key: [1, 2, 3]
21
- }
22
- }, {
23
- input: 'key={[1, 2, 3, [1, 2]]}',
24
- output: {
25
- key: [1, 2, 3, [1, 2]]
26
- }
27
- }, {
28
- input: 'object={4}',
29
- output: {
30
- object: 4
31
- }
32
- }, {
33
- input: 'object={{"test": 1}}',
34
- output: {
35
- object: {
36
- test: 1
37
- }
38
- }
39
- }, {
40
- input: 'object={[1, 2, 3, [1, 2]]}',
41
- output: {
42
- object: [1, 2, 3, [1, 2]]
43
- }
44
- }, {
45
- input: 'object={[1, 2]}',
46
- output: {
47
- object: [1, 2]
48
- }
49
- }, {
50
- input: 'key="value" object={{key: "value"}}',
51
- inputFromOutput: 'key="value" object={{"key": "value"}}',
52
- output: {
53
- key: 'value',
54
- object: {
55
- key: 'value'
56
- }
57
- }
58
- }, {
59
- input: 'global packageId="myId" uniqueId="some unique id!" update',
60
- output: {
61
- global: true,
62
- packageId: 'myId',
63
- uniqueId: 'some unique id!',
64
- update: true
65
- }
66
- }, {
67
- input: 'global key="value" object={{key: "value", something: "test", hello: 1}} packageId="myId" uniqueId="some unique id!" update',
68
- inputFromOutput: 'global key="value" object={{"hello": 1, "key": "value", "something": "test"}} packageId="myId" uniqueId="some unique id!" update',
69
- output: {
70
- global: true,
71
- key: 'value',
72
- object: {
73
- hello: 1,
74
- key: 'value',
75
- something: 'test'
76
- },
77
- packageId: 'myId',
78
- uniqueId: 'some unique id!',
79
- update: true
80
- }
81
- }, {
82
- input: 'object={{hello: 1, key: "value", nested: { key: "value" }, something: "test", test: [1, 2, 3]}}',
83
- inputFromOutput: 'object={{"hello": 1, "key": "value", "nested": {"key": "value"}, "something": "test", "test": [1, 2, 3]}}',
84
- output: {
85
- object: {
86
- hello: 1,
87
- key: 'value',
88
- nested: {
89
- key: 'value'
90
- },
91
- something: 'test',
92
- test: [1, 2, 3]
93
- }
94
- }
95
- }, {
96
- input: 'global key="value" object={{hello: 1, key: "value", nested: { key: "value" }, something: "test", test: [1, 2, 3]}} packageId="myId" uniqueId="some unique id!" update',
97
- inputFromOutput: 'global key="value" object={{"hello": 1, "key": "value", "nested": { "key": "value" }, "something": "test", "test": [1, 2, 3]}} packageId="myId" uniqueId="some unique id!" update',
98
- output: {
99
- global: true,
100
- key: 'value',
101
- object: {
102
- hello: 1,
103
- key: 'value',
104
- nested: {
105
- key: 'value'
106
- },
107
- something: 'test',
108
- test: [1, 2, 3]
109
- },
110
- packageId: 'myId',
111
- uniqueId: 'some unique id!',
112
- update: true
113
- }
114
- }, {
115
- // Test if unquoted property keys in objects within arrays are supprted. This is
116
- // supported through the more lenient JSOX parser, instead of using JSON.parse()
117
- input: 'key={[1, 2, { hello: "there" }]}',
118
- inputFromOutput: 'key={[1, 2, { "hello": "there" }]}',
119
- output: {
120
- key: [1, 2, {
121
- hello: 'there'
122
- }]
123
- }
124
- }, {
125
- // Test if ` strings work
126
- input: `key={[1, 2, { hello: \`there\` }]}`,
127
- inputFromOutput: 'key={[1, 2, { "hello": "there" }]}',
128
- output: {
129
- key: [1, 2, {
130
- hello: 'there'
131
- }]
132
- }
133
- }, {
134
- // Test if multiline ` strings work
135
- input: `key={[1, 2, { hello: \`Hello
136
- there\` }]}`,
137
- inputFromOutput: 'key={[1, 2, { "hello": "Hello\\nthere" }]}',
138
- output: {
139
- key: [1, 2, {
140
- hello: 'Hello\nthere'
141
- }]
142
- }
143
- }];
144
- for (const {
145
- input,
146
- output
147
- } of INPUT_AND_OUTPUT) {
148
- it(`can correctly convert to object: "${input.replace(/\n/g, '\\n')}"`, () => {
149
- const propsObject = extractPropsFromJSXPropsString({
150
- propsString: input
151
- });
152
- console.log({
153
- output,
154
- propsObject
155
- });
156
- expect(propsObject).toStrictEqual(output);
157
- });
158
- }
159
- for (const {
160
- input: originalInput,
161
- inputFromOutput,
162
- output
163
- } of INPUT_AND_OUTPUT) {
164
- const input = inputFromOutput || originalInput;
165
- it(`can correctly convert from object: "${input.replace(/\n/g, '\\n')}"`, () => {
166
- const propsString = propsToJSXString({
167
- props: output
168
- });
169
- console.log({
170
- input,
171
- propsString
172
- });
173
- expect(propsString.replaceAll(' ', '')).toBe(input.replaceAll(' ', ''));
174
- });
175
- }
176
- });
177
- });
178
- //# sourceMappingURL=jsx.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jsx.spec.js","names":["describe","it","expect","extractPropsFromJSXPropsString","propsToJSXString","INPUT_AND_OUTPUT","input","output","key","inputFromOutput","object","test","global","packageId","uniqueId","update","hello","something","nested","replace","propsObject","propsString","console","log","toStrictEqual","originalInput","props","replaceAll","toBe"],"sources":["../../../src/utilities/jsx/jsx.spec.ts"],"sourcesContent":["import { describe, it, expect } from 'vitest'\nimport { extractPropsFromJSXPropsString } from './extractPropsFromJSXPropsString.js'\nimport { propsToJSXString } from './jsx.js'\n\ndescribe('jsx', () => {\n describe('prop string to object', () => {\n const INPUT_AND_OUTPUT: {\n input: string\n inputFromOutput?: string\n output: Record<string, any>\n }[] = [\n {\n input: 'key=\"value\"',\n output: {\n key: 'value',\n },\n },\n {\n input: \"key='value'\",\n output: {\n key: 'value',\n },\n inputFromOutput: 'key=\"value\"',\n },\n {\n input: 'key={[1, 2, 3]}',\n output: {\n key: [1, 2, 3],\n },\n },\n {\n input: 'key={[1, 2, 3, [1, 2]]}',\n output: {\n key: [1, 2, 3, [1, 2]],\n },\n },\n {\n input: 'object={4}',\n output: {\n object: 4,\n },\n },\n {\n input: 'object={{\"test\": 1}}',\n output: {\n object: { test: 1 },\n },\n },\n {\n input: 'object={[1, 2, 3, [1, 2]]}',\n output: {\n object: [1, 2, 3, [1, 2]],\n },\n },\n {\n input: 'object={[1, 2]}',\n output: {\n object: [1, 2],\n },\n },\n {\n input: 'key=\"value\" object={{key: \"value\"}}',\n inputFromOutput: 'key=\"value\" object={{\"key\": \"value\"}}',\n output: {\n key: 'value',\n object: { key: 'value' },\n },\n },\n {\n input: 'global packageId=\"myId\" uniqueId=\"some unique id!\" update',\n output: {\n global: true,\n packageId: 'myId',\n uniqueId: 'some unique id!',\n update: true,\n },\n },\n {\n input:\n 'global key=\"value\" object={{key: \"value\", something: \"test\", hello: 1}} packageId=\"myId\" uniqueId=\"some unique id!\" update',\n inputFromOutput:\n 'global key=\"value\" object={{\"hello\": 1, \"key\": \"value\", \"something\": \"test\"}} packageId=\"myId\" uniqueId=\"some unique id!\" update',\n output: {\n global: true,\n key: 'value',\n object: { hello: 1, key: 'value', something: 'test' },\n packageId: 'myId',\n uniqueId: 'some unique id!',\n update: true,\n },\n },\n {\n input:\n 'object={{hello: 1, key: \"value\", nested: { key: \"value\" }, something: \"test\", test: [1, 2, 3]}}',\n inputFromOutput:\n 'object={{\"hello\": 1, \"key\": \"value\", \"nested\": {\"key\": \"value\"}, \"something\": \"test\", \"test\": [1, 2, 3]}}',\n output: {\n object: {\n hello: 1,\n key: 'value',\n nested: { key: 'value' },\n something: 'test',\n test: [1, 2, 3],\n },\n },\n },\n {\n input:\n 'global key=\"value\" object={{hello: 1, key: \"value\", nested: { key: \"value\" }, something: \"test\", test: [1, 2, 3]}} packageId=\"myId\" uniqueId=\"some unique id!\" update',\n inputFromOutput:\n 'global key=\"value\" object={{\"hello\": 1, \"key\": \"value\", \"nested\": { \"key\": \"value\" }, \"something\": \"test\", \"test\": [1, 2, 3]}} packageId=\"myId\" uniqueId=\"some unique id!\" update',\n output: {\n global: true,\n key: 'value',\n object: {\n hello: 1,\n key: 'value',\n nested: { key: 'value' },\n something: 'test',\n test: [1, 2, 3],\n },\n packageId: 'myId',\n uniqueId: 'some unique id!',\n update: true,\n },\n },\n {\n // Test if unquoted property keys in objects within arrays are supprted. This is\n // supported through the more lenient JSOX parser, instead of using JSON.parse()\n input: 'key={[1, 2, { hello: \"there\" }]}',\n inputFromOutput: 'key={[1, 2, { \"hello\": \"there\" }]}',\n output: {\n key: [1, 2, { hello: 'there' }],\n },\n },\n {\n // Test if ` strings work\n input: `key={[1, 2, { hello: \\`there\\` }]}`,\n inputFromOutput: 'key={[1, 2, { \"hello\": \"there\" }]}',\n output: {\n key: [1, 2, { hello: 'there' }],\n },\n },\n {\n // Test if multiline ` strings work\n input: `key={[1, 2, { hello: \\`Hello\nthere\\` }]}`,\n inputFromOutput: 'key={[1, 2, { \"hello\": \"Hello\\\\nthere\" }]}',\n output: {\n key: [1, 2, { hello: 'Hello\\nthere' }],\n },\n },\n ]\n\n for (const { input, output } of INPUT_AND_OUTPUT) {\n it(`can correctly convert to object: \"${input.replace(/\\n/g, '\\\\n')}\"`, () => {\n const propsObject = extractPropsFromJSXPropsString({ propsString: input })\n console.log({ output, propsObject })\n\n expect(propsObject).toStrictEqual(output)\n })\n }\n\n for (const { input: originalInput, inputFromOutput, output } of INPUT_AND_OUTPUT) {\n const input = inputFromOutput || originalInput\n it(`can correctly convert from object: \"${input.replace(/\\n/g, '\\\\n')}\"`, () => {\n const propsString = propsToJSXString({ props: output })\n console.log({ input, propsString })\n\n expect(propsString.replaceAll(' ', '')).toBe(input.replaceAll(' ', ''))\n })\n }\n })\n})\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,EAAE,EAAEC,MAAM,QAAQ;AACrC,SAASC,8BAA8B,QAAQ;AAC/C,SAASC,gBAAgB,QAAQ;AAEjCJ,QAAA,CAAS,OAAO;EACdA,QAAA,CAAS,yBAAyB;IAChC,MAAMK,gBAAA,GAIA,CACJ;MACEC,KAAA,EAAO;MACPC,MAAA,EAAQ;QACNC,GAAA,EAAK;MACP;IACF,GACA;MACEF,KAAA,EAAO;MACPC,MAAA,EAAQ;QACNC,GAAA,EAAK;MACP;MACAC,eAAA,EAAiB;IACnB,GACA;MACEH,KAAA,EAAO;MACPC,MAAA,EAAQ;QACNC,GAAA,EAAK,CAAC,GAAG,GAAG;MACd;IACF,GACA;MACEF,KAAA,EAAO;MACPC,MAAA,EAAQ;QACNC,GAAA,EAAK,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,EAAE;MACvB;IACF,GACA;MACEF,KAAA,EAAO;MACPC,MAAA,EAAQ;QACNG,MAAA,EAAQ;MACV;IACF,GACA;MACEJ,KAAA,EAAO;MACPC,MAAA,EAAQ;QACNG,MAAA,EAAQ;UAAEC,IAAA,EAAM;QAAE;MACpB;IACF,GACA;MACEL,KAAA,EAAO;MACPC,MAAA,EAAQ;QACNG,MAAA,EAAQ,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,EAAE;MAC1B;IACF,GACA;MACEJ,KAAA,EAAO;MACPC,MAAA,EAAQ;QACNG,MAAA,EAAQ,CAAC,GAAG;MACd;IACF,GACA;MAC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