@websolutespa/payload-plugin-seo 2.0.1-next.3 → 2.0.1-next.4
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/CHANGELOG.md
CHANGED
|
@@ -2,15 +2,53 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { FieldLabel, useField, useFormFields } from '@payloadcms/ui';
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import
|
|
5
|
+
import { Mention, MentionsInput } from 'react-mentions';
|
|
6
6
|
const baseClass = 'text-with-tokens';
|
|
7
|
+
const mentionsStyle = {
|
|
8
|
+
control: {
|
|
9
|
+
display: 'block',
|
|
10
|
+
width: '100%'
|
|
11
|
+
},
|
|
12
|
+
'&singleLine': {
|
|
13
|
+
input: {
|
|
14
|
+
width: '100%',
|
|
15
|
+
padding: '0.375rem 0.75rem',
|
|
16
|
+
border: '1px solid var(--theme-elevation-150)',
|
|
17
|
+
borderRadius: 'var(--border-radius)',
|
|
18
|
+
backgroundColor: 'var(--theme-input-bg)',
|
|
19
|
+
color: 'var(--theme-text)',
|
|
20
|
+
fontSize: '1rem',
|
|
21
|
+
lineHeight: '1.5',
|
|
22
|
+
outline: 'none'
|
|
23
|
+
},
|
|
24
|
+
highlighter: {
|
|
25
|
+
padding: '0.375rem 0.75rem',
|
|
26
|
+
border: '1px solid transparent'
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
suggestions: {
|
|
30
|
+
list: {
|
|
31
|
+
backgroundColor: 'var(--theme-bg)',
|
|
32
|
+
border: '1px solid var(--theme-elevation-150)',
|
|
33
|
+
borderRadius: 'var(--border-radius)',
|
|
34
|
+
maxHeight: '200px',
|
|
35
|
+
overflowY: 'auto'
|
|
36
|
+
},
|
|
37
|
+
item: {
|
|
38
|
+
padding: '4px 12px',
|
|
39
|
+
'&focused': {
|
|
40
|
+
backgroundColor: 'var(--theme-elevation-50)'
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
7
45
|
export const TextWithTokens = (props)=>{
|
|
8
46
|
const { path, field } = props;
|
|
9
47
|
const { label, required } = field;
|
|
10
48
|
const { value, setValue } = useField({
|
|
11
49
|
path
|
|
12
50
|
});
|
|
13
|
-
const tokensField = useFormFields(([fields
|
|
51
|
+
const tokensField = useFormFields(([fields])=>fields.tokens);
|
|
14
52
|
let tokens = tokensField?.value || [];
|
|
15
53
|
tokens = tokens.map((token)=>token.replace('[', '').replace(']', ''));
|
|
16
54
|
const classes = [
|
|
@@ -26,17 +64,21 @@ export const TextWithTokens = (props)=>{
|
|
|
26
64
|
path: path,
|
|
27
65
|
required: required
|
|
28
66
|
}),
|
|
29
|
-
/*#__PURE__*/ _jsx(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
67
|
+
/*#__PURE__*/ _jsx(MentionsInput, {
|
|
68
|
+
singleLine: true,
|
|
69
|
+
value: value ?? '',
|
|
70
|
+
onChange: (_, newValue)=>setValue(newValue),
|
|
71
|
+
style: mentionsStyle,
|
|
72
|
+
children: /*#__PURE__*/ _jsx(Mention, {
|
|
73
|
+
trigger: "[",
|
|
74
|
+
data: tokens.map((t)=>({
|
|
75
|
+
id: t,
|
|
76
|
+
display: t
|
|
77
|
+
})),
|
|
78
|
+
markup: "[__display__]",
|
|
79
|
+
displayTransform: (_, display)=>`[${display}]`,
|
|
80
|
+
appendSpaceOnAdd: true
|
|
81
|
+
})
|
|
40
82
|
})
|
|
41
83
|
]
|
|
42
84
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/TextWithTokens.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { FieldLabel, useField, useFormFields } from '@payloadcms/ui';\r\nimport { TextFieldClientProps } from 'payload';\r\nimport * as React from 'react';\r\nimport
|
|
1
|
+
{"version":3,"sources":["../../src/components/TextWithTokens.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { FieldLabel, useField, useFormFields } from '@payloadcms/ui';\r\nimport { TextFieldClientProps } from 'payload';\r\nimport * as React from 'react';\r\nimport { Mention, MentionsInput } from 'react-mentions';\r\n\r\nconst baseClass = 'text-with-tokens';\r\n\r\nconst mentionsStyle = {\r\n control: {\r\n display: 'block',\r\n width: '100%',\r\n },\r\n '&singleLine': {\r\n input: {\r\n width: '100%',\r\n padding: '0.375rem 0.75rem',\r\n border: '1px solid var(--theme-elevation-150)',\r\n borderRadius: 'var(--border-radius)',\r\n backgroundColor: 'var(--theme-input-bg)',\r\n color: 'var(--theme-text)',\r\n fontSize: '1rem',\r\n lineHeight: '1.5',\r\n outline: 'none',\r\n },\r\n highlighter: {\r\n padding: '0.375rem 0.75rem',\r\n border: '1px solid transparent',\r\n },\r\n },\r\n suggestions: {\r\n list: {\r\n backgroundColor: 'var(--theme-bg)',\r\n border: '1px solid var(--theme-elevation-150)',\r\n borderRadius: 'var(--border-radius)',\r\n maxHeight: '200px',\r\n overflowY: 'auto' as const,\r\n },\r\n item: {\r\n padding: '4px 12px',\r\n '&focused': {\r\n backgroundColor: 'var(--theme-elevation-50)',\r\n },\r\n },\r\n },\r\n};\r\n\r\nexport const TextWithTokens: React.FC<TextFieldClientProps> = (props) => {\r\n const { path, field } = props;\r\n const { label, required } = field;\r\n const { value, setValue } = useField<string>({ path });\r\n\r\n const tokensField = useFormFields(([fields]) => fields.tokens);\r\n let tokens = (tokensField?.value as string[]) || [];\r\n tokens = tokens.map((token) => token.replace('[', '').replace(']', ''));\r\n\r\n const classes = ['field-type', 'textarea', baseClass].join(' ');\r\n\r\n return (\r\n <div className={classes}>\r\n <FieldLabel label={label} path={path} required={required} />\r\n <MentionsInput\r\n singleLine\r\n value={value ?? ''}\r\n onChange={(_, newValue) => setValue(newValue)}\r\n style={mentionsStyle}\r\n >\r\n <Mention\r\n trigger=\"[\"\r\n data={tokens.map((t) => ({ id: t, display: t }))}\r\n markup=\"[__display__]\"\r\n displayTransform={(_, display) => `[${display}]`}\r\n appendSpaceOnAdd\r\n />\r\n </MentionsInput>\r\n </div>\r\n );\r\n};\r\n"],"names":["FieldLabel","useField","useFormFields","React","Mention","MentionsInput","baseClass","mentionsStyle","control","display","width","input","padding","border","borderRadius","backgroundColor","color","fontSize","lineHeight","outline","highlighter","suggestions","list","maxHeight","overflowY","item","TextWithTokens","props","path","field","label","required","value","setValue","tokensField","fields","tokens","map","token","replace","classes","join","div","className","singleLine","onChange","_","newValue","style","trigger","data","t","id","markup","displayTransform","appendSpaceOnAdd"],"mappings":"AAAA;;AAEA,SAASA,UAAU,EAAEC,QAAQ,EAAEC,aAAa,QAAQ,iBAAiB;AAErE,YAAYC,WAAW,QAAQ;AAC/B,SAASC,OAAO,EAAEC,aAAa,QAAQ,iBAAiB;AAExD,MAAMC,YAAY;AAElB,MAAMC,gBAAgB;IACpBC,SAAS;QACPC,SAAS;QACTC,OAAO;IACT;IACA,eAAe;QACbC,OAAO;YACLD,OAAO;YACPE,SAAS;YACTC,QAAQ;YACRC,cAAc;YACdC,iBAAiB;YACjBC,OAAO;YACPC,UAAU;YACVC,YAAY;YACZC,SAAS;QACX;QACAC,aAAa;YACXR,SAAS;YACTC,QAAQ;QACV;IACF;IACAQ,aAAa;QACXC,MAAM;YACJP,iBAAiB;YACjBF,QAAQ;YACRC,cAAc;YACdS,WAAW;YACXC,WAAW;QACb;QACAC,MAAM;YACJb,SAAS;YACT,YAAY;gBACVG,iBAAiB;YACnB;QACF;IACF;AACF;AAEA,OAAO,MAAMW,iBAAiD,CAACC;IAC7D,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGF;IACxB,MAAM,EAAEG,KAAK,EAAEC,QAAQ,EAAE,GAAGF;IAC5B,MAAM,EAAEG,KAAK,EAAEC,QAAQ,EAAE,GAAGhC,SAAiB;QAAE2B;IAAK;IAEpD,MAAMM,cAAchC,cAAc,CAAC,CAACiC,OAAO,GAAKA,OAAOC,MAAM;IAC7D,IAAIA,SAAS,AAACF,aAAaF,SAAsB,EAAE;IACnDI,SAASA,OAAOC,GAAG,CAAC,CAACC,QAAUA,MAAMC,OAAO,CAAC,KAAK,IAAIA,OAAO,CAAC,KAAK;IAEnE,MAAMC,UAAU;QAAC;QAAc;QAAYlC;KAAU,CAACmC,IAAI,CAAC;IAE3D,qBACE,MAACC;QAAIC,WAAWH;;0BACd,KAACxC;gBAAW8B,OAAOA;gBAAOF,MAAMA;gBAAMG,UAAUA;;0BAChD,KAAC1B;gBACCuC,UAAU;gBACVZ,OAAOA,SAAS;gBAChBa,UAAU,CAACC,GAAGC,WAAad,SAASc;gBACpCC,OAAOzC;0BAEP,cAAA,KAACH;oBACC6C,SAAQ;oBACRC,MAAMd,OAAOC,GAAG,CAAC,CAACc,IAAO,CAAA;4BAAEC,IAAID;4BAAG1C,SAAS0C;wBAAE,CAAA;oBAC7CE,QAAO;oBACPC,kBAAkB,CAACR,GAAGrC,UAAY,CAAC,CAAC,EAAEA,QAAQ,CAAC,CAAC;oBAChD8C,gBAAgB;;;;;AAK1B,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","names":[],"sources":["../../src/components/TextWithTokens.tsx","../../src/components/Tokens.tsx"],"sourcesContent":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"client.d.ts","names":[],"sources":["../../src/components/TextWithTokens.tsx","../../src/components/Tokens.tsx"],"sourcesContent":[],"mappings":";;;;cAgDa,gBAAgB,KAAA,CAAM,GAAG;;;;cCzCzB,QAAQ,KAAA,CAAM,GAAG"}
|
package/dist/exports/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/exports/client.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../src/exports/client.ts"],"sourcesContent":["'use client';\r\n\r\nexport { TextWithTokens } from '../components/TextWithTokens';\r\nexport { Tokens } from '../components/Tokens';\r\n\r\n"],"names":["TextWithTokens","Tokens"],"mappings":"AAAA;AAEA,SAASA,cAAc,QAAQ,+BAA+B;AAC9D,SAASC,MAAM,QAAQ,uBAAuB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@websolutespa/payload-plugin-seo",
|
|
3
|
-
"version": "2.0.1-next.
|
|
3
|
+
"version": "2.0.1-next.4",
|
|
4
4
|
"description": "SEO plugin for PayloadCms",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"payload",
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
"types": "tsc --noemit"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"react-
|
|
32
|
+
"react-mentions": "^4.4.10",
|
|
33
33
|
"ts-deepmerge": "^2.0.1"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@payloadcms/db-mongodb": "3.70.0",
|
|
37
|
+
"@payloadcms/ui": "3.70.0",
|
|
37
38
|
"@websolutespa/bom-core": "2.0.1-next.2",
|
|
38
39
|
"@websolutespa/payload-utils": "2.0.1-next.2",
|
|
39
|
-
"@payloadcms/ui": "3.70.0",
|
|
40
40
|
"payload": "3.70.0",
|
|
41
41
|
"react": "19.2.1",
|
|
42
42
|
"react-dom": "19.2.1",
|
|
@@ -49,8 +49,9 @@
|
|
|
49
49
|
"@swc/cli": "0.6.0",
|
|
50
50
|
"@swc/core": "1.6.4",
|
|
51
51
|
"@types/express": "^4.17.15",
|
|
52
|
-
"@types/react-dom": "19.2.1",
|
|
53
52
|
"@types/react": "19.2.1",
|
|
53
|
+
"@types/react-dom": "19.2.1",
|
|
54
|
+
"@types/react-mentions": "^4.4.1",
|
|
54
55
|
"@types/uuid": "^9.0.2",
|
|
55
56
|
"@websolutespa/bom-core": "2.0.1-next.2",
|
|
56
57
|
"@websolutespa/eslint-config": "2.0.1-next.2",
|
|
@@ -63,8 +64,8 @@
|
|
|
63
64
|
"mongodb-memory-server": "10.1.4",
|
|
64
65
|
"npm-run-all": "4.1.5",
|
|
65
66
|
"payload": "3.70.0",
|
|
66
|
-
"react-dom": "19.2.1",
|
|
67
67
|
"react": "19.2.1",
|
|
68
|
+
"react-dom": "19.2.1",
|
|
68
69
|
"tsdown": "0.12.9",
|
|
69
70
|
"typescript": "5.8.3",
|
|
70
71
|
"uuid": "9.0.1"
|