@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.
- package/dist/exports/client/Field-QKAL7KMC.js +2 -0
- package/dist/exports/client/Field-QKAL7KMC.js.map +7 -0
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/chunk-LN6VX25I.js +2 -0
- package/dist/exports/client/{chunk-SSMQFWCQ.js.map → chunk-LN6VX25I.js.map} +4 -4
- package/dist/exports/client/index.js +26 -26
- package/dist/exports/client/index.js.map +4 -4
- package/dist/features/converters/lexicalToHtml/async/converters/heading.js +1 -1
- package/dist/features/converters/lexicalToHtml/async/converters/heading.js.map +1 -1
- package/dist/features/converters/lexicalToHtml/async/converters/list.d.ts.map +1 -1
- package/dist/features/converters/lexicalToHtml/async/converters/list.js +4 -3
- package/dist/features/converters/lexicalToHtml/async/converters/list.js.map +1 -1
- package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.d.ts.map +1 -1
- package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js +3 -2
- package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js.map +1 -1
- package/dist/features/converters/lexicalToHtml/sync/converters/heading.js +1 -1
- package/dist/features/converters/lexicalToHtml/sync/converters/heading.js.map +1 -1
- package/dist/features/converters/lexicalToHtml/sync/converters/list.d.ts.map +1 -1
- package/dist/features/converters/lexicalToHtml/sync/converters/list.js +4 -3
- package/dist/features/converters/lexicalToHtml/sync/converters/list.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/heading.d.ts.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/heading.js +2 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/heading.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/list.d.ts.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/list.js +2 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/list.js.map +1 -1
- package/dist/features/heading/constants.d.ts +2 -0
- package/dist/features/heading/constants.d.ts.map +1 -0
- package/dist/features/heading/constants.js +2 -0
- package/dist/features/heading/constants.js.map +1 -0
- package/dist/features/heading/server/index.d.ts.map +1 -1
- package/dist/features/heading/server/index.js +5 -1
- package/dist/features/heading/server/index.js.map +1 -1
- package/dist/features/heading/server/validate.d.ts +6 -0
- package/dist/features/heading/server/validate.d.ts.map +1 -0
- package/dist/features/heading/server/validate.js +15 -0
- package/dist/features/heading/server/validate.js.map +1 -0
- package/dist/features/link/server/baseFields.d.ts.map +1 -1
- package/dist/features/link/server/baseFields.js +4 -5
- package/dist/features/link/server/baseFields.js.map +1 -1
- package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
- package/dist/features/lists/checklist/server/index.js +5 -2
- package/dist/features/lists/checklist/server/index.js.map +1 -1
- package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
- package/dist/features/lists/orderedList/server/index.js +5 -2
- package/dist/features/lists/orderedList/server/index.js.map +1 -1
- package/dist/features/lists/shared/constants.d.ts +2 -0
- package/dist/features/lists/shared/constants.d.ts.map +1 -0
- package/dist/features/lists/shared/constants.js +2 -0
- package/dist/features/lists/shared/constants.js.map +1 -0
- package/dist/features/lists/shared/validate.d.ts +5 -0
- package/dist/features/lists/shared/validate.d.ts.map +1 -0
- package/dist/features/lists/shared/validate.js +15 -0
- package/dist/features/lists/shared/validate.js.map +1 -0
- package/dist/features/lists/unorderedList/server/index.d.ts.map +1 -1
- package/dist/features/lists/unorderedList/server/index.js +5 -2
- package/dist/features/lists/unorderedList/server/index.js.map +1 -1
- package/dist/features/relationship/client/index.d.ts +2 -2
- package/dist/features/relationship/client/index.d.ts.map +1 -1
- package/dist/features/relationship/client/index.js.map +1 -1
- package/dist/features/relationship/client/plugins/index.d.ts +2 -2
- package/dist/features/relationship/client/plugins/index.d.ts.map +1 -1
- package/dist/features/relationship/client/plugins/index.js +27 -31
- package/dist/features/relationship/client/plugins/index.js.map +1 -1
- package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts +2 -4
- package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -1
- package/dist/features/relationship/client/utils/useEnabledRelationships.js +53 -20
- package/dist/features/relationship/client/utils/useEnabledRelationships.js.map +1 -1
- package/dist/features/relationship/server/graphQLPopulationPromise.d.ts +2 -2
- package/dist/features/relationship/server/graphQLPopulationPromise.d.ts.map +1 -1
- package/dist/features/relationship/server/graphQLPopulationPromise.js +2 -2
- package/dist/features/relationship/server/graphQLPopulationPromise.js.map +1 -1
- package/dist/features/relationship/server/index.d.ts +8 -1
- package/dist/features/relationship/server/index.d.ts.map +1 -1
- package/dist/features/relationship/server/index.js +28 -11
- package/dist/features/relationship/server/index.js.map +1 -1
- package/dist/features/relationship/server/schema.d.ts +2 -2
- package/dist/features/relationship/server/schema.d.ts.map +1 -1
- package/dist/features/relationship/server/schema.js +5 -10
- package/dist/features/relationship/server/schema.js.map +1 -1
- package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts +1 -6
- package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts.map +1 -1
- package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js +3 -8
- package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js.map +1 -1
- package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts +8 -0
- package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts.map +1 -0
- package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js +19 -0
- package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js.map +1 -0
- package/dist/features/table/client/plugins/TableActionMenuPlugin/index.d.ts.map +1 -1
- package/dist/features/table/client/plugins/TableActionMenuPlugin/index.js +16 -43
- package/dist/features/table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
- package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.d.ts +8 -0
- package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.d.ts.map +1 -0
- package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js +80 -0
- package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js.map +1 -0
- package/dist/features/toolbars/fixed/client/Toolbar/index.css +79 -5
- package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
- package/dist/features/toolbars/fixed/client/Toolbar/index.js +4 -1
- package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/index.css +12 -11
- package/dist/features/upload/client/index.d.ts +3 -2
- package/dist/features/upload/client/index.d.ts.map +1 -1
- package/dist/features/upload/client/index.js.map +1 -1
- package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
- package/dist/features/upload/client/plugin/index.js +47 -52
- package/dist/features/upload/client/plugin/index.js.map +1 -1
- package/dist/features/upload/server/graphQLPopulationPromise.d.ts +2 -2
- package/dist/features/upload/server/graphQLPopulationPromise.d.ts.map +1 -1
- package/dist/features/upload/server/graphQLPopulationPromise.js +1 -1
- package/dist/features/upload/server/graphQLPopulationPromise.js.map +1 -1
- package/dist/features/upload/server/index.d.ts +6 -2
- package/dist/features/upload/server/index.d.ts.map +1 -1
- package/dist/features/upload/server/index.js +18 -14
- package/dist/features/upload/server/index.js.map +1 -1
- package/dist/features/upload/server/schema.d.ts +2 -2
- package/dist/features/upload/server/schema.d.ts.map +1 -1
- package/dist/features/upload/server/schema.js +4 -8
- package/dist/features/upload/server/schema.js.map +1 -1
- package/dist/features/upload/server/validate.d.ts +2 -2
- package/dist/features/upload/server/validate.d.ts.map +1 -1
- package/dist/features/upload/server/validate.js +3 -0
- package/dist/features/upload/server/validate.js.map +1 -1
- package/dist/field/Diff/converters/listitem/index.d.ts.map +1 -1
- package/dist/field/Diff/converters/listitem/index.js +2 -1
- package/dist/field/Diff/converters/listitem/index.js.map +1 -1
- package/dist/field/Diff/index.css +19 -22
- package/dist/field/Diff/index.d.ts.map +1 -1
- package/dist/field/Diff/index.js +1 -0
- package/dist/field/Diff/index.js.map +1 -1
- package/dist/field/RenderLexical/index.d.ts +3 -1
- package/dist/field/RenderLexical/index.d.ts.map +1 -1
- package/dist/field/RenderLexical/index.js +23 -23
- package/dist/field/RenderLexical/index.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/dist/field/index.css +14 -10
- package/dist/i18n.d.ts.map +1 -1
- package/dist/i18n.js +68 -0
- package/dist/i18n.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lexical/LexicalEditor.css +2 -2
- package/dist/lexical/LexicalEditor.js.map +1 -1
- package/dist/lexical/plugins/InsertParagraphAtEnd/index.css +16 -23
- package/dist/lexical/plugins/InsertParagraphAtEnd/index.d.ts.map +1 -1
- package/dist/lexical/plugins/InsertParagraphAtEnd/index.js +27 -14
- package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
- package/dist/lexical/theme/EditorTheme.css +25 -37
- package/dist/lexical/ui/ContentEditable.css +1 -0
- package/dist/lexical/ui/icons/H3/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/H3/index.js +13 -6
- package/dist/lexical/ui/icons/H3/index.js.map +1 -1
- package/dist/lexical/ui/icons/H4/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/H4/index.js +13 -6
- package/dist/lexical/ui/icons/H4/index.js.map +1 -1
- package/dist/lexical/ui/icons/H5/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/H5/index.js +13 -6
- package/dist/lexical/ui/icons/H5/index.js.map +1 -1
- package/dist/lexical/ui/icons/H6/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/H6/index.js +13 -6
- package/dist/lexical/ui/icons/H6/index.js.map +1 -1
- package/package.json +22 -22
- package/dist/dependencyChecker.spec.js +0 -16
- package/dist/dependencyChecker.spec.js.map +0 -1
- package/dist/exports/client/Field-IZKDIUJY.js +0 -2
- package/dist/exports/client/Field-IZKDIUJY.js.map +0 -7
- package/dist/exports/client/chunk-SSMQFWCQ.js +0 -2
- package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js +0 -180
- package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js.map +0 -1
- package/dist/features/link/markdownTransformer.spec.js +0 -195
- package/dist/features/link/markdownTransformer.spec.js.map +0 -1
- package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js +0 -88
- package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js.map +0 -1
- package/dist/lexical/utils/url.spec.js +0 -114
- package/dist/lexical/utils/url.spec.js.map +0 -1
- package/dist/utilities/jsx/jsx.spec.js +0 -178
- 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,CAAS,kBAAkB;IACzBC,EAAA,CAAG,wCAAwC;MACzC,MAAMK,WAAA,GAAc,CAClB,sBACA,uBACA,2BACA,+BACA,0CACA,sCACA,0BACA,qCACA,4BACA,mBACA,gCACA,mBACA,4BACA,oCACA,2BACD;MAEDA,WAAA,CAAYC,OAAO,CAAEC,QAAA;QACnBN,MAAA,CAAOC,cAAA,CAAeM,IAAI,CAACD,QAAA,GAAWE,IAAI,CAAC;MAC7C;IACF;IAEAT,EAAA,CAAG,4CAA4C;MAC7C,MAAMU,cAAA,GAAiB,CACrB,kBACA,WACA,eACA,qBACA,WACA,qBACA,sBACA,kBACA,aACA,qBACA,8BACD;MAEDA,cAAA,CAAeJ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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;MACEJ,KAAA,EAAO;MACPG,eAAA,EAAiB;MACjBF,MAAA,EAAQ;QACNC,GAAA,EAAK;QACLE,MAAA,EAAQ;UAAEF,GAAA,EAAK;QAAQ;MACzB;IACF,GACA;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