@sanity/assist 1.2.13 → 1.2.15-ui2.1
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/index.esm.js +32 -27
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +32 -27
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
- package/src/_lib/form/DocumentForm.tsx +1 -1
- package/src/assistInspector/InstructionTaskHistoryButton.tsx +2 -3
- package/src/node_modules/.vitest/results.json +1 -0
- package/src/plugin.tsx +6 -2
- package/src/schemas/serialize/serializeSchema.test.ts +15 -2
- package/src/schemas/serialize/serializeSchema.ts +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/assist",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.15-ui2.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@sanity/icons": "^2.4.0",
|
|
58
58
|
"@sanity/incompatible-plugin": "^1.0.4",
|
|
59
|
-
"@sanity/ui": "^
|
|
59
|
+
"@sanity/ui": "^2.0.0-beta.13",
|
|
60
60
|
"date-fns": "^2.30.0",
|
|
61
61
|
"react-fast-compare": "^3.2.1",
|
|
62
62
|
"react-is": "^18.2.0",
|
|
@@ -64,18 +64,18 @@
|
|
|
64
64
|
"rxjs-exhaustmap-with-trailing": "^2.1.1"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@commitlint/cli": "^17.
|
|
68
|
-
"@commitlint/config-conventional": "^17.
|
|
67
|
+
"@commitlint/cli": "^17.8.1",
|
|
68
|
+
"@commitlint/config-conventional": "^17.8.1",
|
|
69
69
|
"@rollup/plugin-image": "^3.0.3",
|
|
70
70
|
"@sanity/pkg-utils": "^2.4.10",
|
|
71
71
|
"@sanity/plugin-kit": "^3.1.10",
|
|
72
|
-
"@sanity/semantic-release-preset": "^4.1.
|
|
73
|
-
"@types/react": "^18.2.
|
|
74
|
-
"@types/styled-components": "^5.1.
|
|
72
|
+
"@sanity/semantic-release-preset": "^4.1.6",
|
|
73
|
+
"@types/react": "^18.2.37",
|
|
74
|
+
"@types/styled-components": "^5.1.30",
|
|
75
75
|
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
|
76
76
|
"@typescript-eslint/parser": "^5.62.0",
|
|
77
77
|
"date-fns": "^2.30.0",
|
|
78
|
-
"eslint": "^8.
|
|
78
|
+
"eslint": "^8.53.0",
|
|
79
79
|
"eslint-config-prettier": "^8.10.0",
|
|
80
80
|
"eslint-config-sanity": "^6.0.0",
|
|
81
81
|
"eslint-plugin-prettier": "^4.2.1",
|
|
@@ -85,16 +85,16 @@
|
|
|
85
85
|
"react": "^18.2.0",
|
|
86
86
|
"react-dom": "^18.2.0",
|
|
87
87
|
"rimraf": "^4.4.0",
|
|
88
|
-
"sanity": "^3.
|
|
88
|
+
"sanity": "^3.23.1",
|
|
89
89
|
"semantic-release": "^21.1.2",
|
|
90
|
-
"styled-components": "^
|
|
90
|
+
"styled-components": "^6.1.1",
|
|
91
91
|
"typescript": "^5.2.2",
|
|
92
92
|
"vitest": "^0.34.6"
|
|
93
93
|
},
|
|
94
94
|
"peerDependencies": {
|
|
95
95
|
"react": "^18",
|
|
96
96
|
"sanity": "^3.16",
|
|
97
|
-
"styled-components": "^5.2"
|
|
97
|
+
"styled-components": "^5.2 || ^6.0.0"
|
|
98
98
|
},
|
|
99
99
|
"engines": {
|
|
100
100
|
"node": ">=14"
|
|
@@ -167,7 +167,7 @@ export function InstructionTaskHistoryButton(props: InstructionTaskHistoryButton
|
|
|
167
167
|
)
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
const TASK_STATUS_BUTTON_TOOLTIP_PROPS: StatusButtonProps['
|
|
170
|
+
const TASK_STATUS_BUTTON_TOOLTIP_PROPS: StatusButtonProps['tooltipProps'] = {
|
|
171
171
|
placement: 'top',
|
|
172
172
|
}
|
|
173
173
|
|
|
@@ -190,11 +190,10 @@ const TaskStatusButton = forwardRef(function TaskStatusButton(
|
|
|
190
190
|
mode="bleed"
|
|
191
191
|
onClick={onClick}
|
|
192
192
|
tone={hasErrors ? 'critical' : undefined}
|
|
193
|
-
fontSize={1}
|
|
194
193
|
disabled={disabled}
|
|
195
194
|
ref={ref}
|
|
196
195
|
selected={selected}
|
|
197
|
-
|
|
196
|
+
tooltipProps={TASK_STATUS_BUTTON_TOOLTIP_PROPS}
|
|
198
197
|
/>
|
|
199
198
|
)
|
|
200
199
|
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":"0.32.2","results":[[":schemas/serialize/serializeSchema.test.ts",{"duration":12,"failed":false}]]}
|
package/src/plugin.tsx
CHANGED
|
@@ -45,8 +45,12 @@ export const assist = definePlugin<AssistPluginConfig | void>((config) => {
|
|
|
45
45
|
}
|
|
46
46
|
return prev
|
|
47
47
|
},
|
|
48
|
-
unstable_fieldActions: (prev) => {
|
|
49
|
-
|
|
48
|
+
unstable_fieldActions: (prev, {documentType, schema}) => {
|
|
49
|
+
const docSchema = schema.get(documentType)
|
|
50
|
+
if (docSchema && isSchemaAssistEnabled(docSchema)) {
|
|
51
|
+
return [...prev, assistFieldActions]
|
|
52
|
+
}
|
|
53
|
+
return prev
|
|
50
54
|
},
|
|
51
55
|
unstable_languageFilter: (prev, {documentId, schema, schemaType}) => {
|
|
52
56
|
const docSchema = schema.get(schemaType)
|
|
@@ -23,7 +23,7 @@ const mockStudioTypes = [
|
|
|
23
23
|
]
|
|
24
24
|
|
|
25
25
|
describe('serializeSchema', () => {
|
|
26
|
-
test('should
|
|
26
|
+
test('should serialize excluded document schema to support exclude: false overrides at the field level', () => {
|
|
27
27
|
const schema = Schema.compile({
|
|
28
28
|
name: 'test',
|
|
29
29
|
types: [
|
|
@@ -42,7 +42,20 @@ describe('serializeSchema', () => {
|
|
|
42
42
|
|
|
43
43
|
const serializedTypes = serializeSchema(schema, {leanFormat: true})
|
|
44
44
|
|
|
45
|
-
expect(serializedTypes).toEqual([
|
|
45
|
+
expect(serializedTypes).toEqual([
|
|
46
|
+
{
|
|
47
|
+
fields: [
|
|
48
|
+
{
|
|
49
|
+
name: 'title',
|
|
50
|
+
title: 'Title',
|
|
51
|
+
type: 'string',
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
name: 'article',
|
|
55
|
+
title: 'Article',
|
|
56
|
+
type: 'document',
|
|
57
|
+
},
|
|
58
|
+
])
|
|
46
59
|
})
|
|
47
60
|
|
|
48
61
|
test('should serialize simple schema', () => {
|
|
@@ -29,7 +29,8 @@ export function serializeSchema(schema: Schema, options?: Options): SerializedSc
|
|
|
29
29
|
.filter((t) => !(hiddenTypes.includes(t) || t.startsWith('sanity.')))
|
|
30
30
|
.map((t) => schema.get(t))
|
|
31
31
|
.filter((t): t is SchemaType => !!t)
|
|
32
|
-
|
|
32
|
+
// because a field can override exclude at the type level, we have to also serialize excluded types
|
|
33
|
+
// so don't do this: .filter((t) => isAssistSupported(t))
|
|
33
34
|
.filter((t) => !t.hidden && !t.readOnly)
|
|
34
35
|
.map((t) => getSchemaStub(t, schema, options))
|
|
35
36
|
.filter((t) => {
|