@payloadcms/ui 3.89.0-internal.95c9cba → 3.90.0
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/elements/BulkUpload/FormsManager/createFormData.d.ts +1 -1
- package/dist/elements/BulkUpload/FormsManager/createFormData.d.ts.map +1 -1
- package/dist/elements/BulkUpload/FormsManager/createFormData.js +7 -3
- package/dist/elements/BulkUpload/FormsManager/createFormData.js.map +1 -1
- package/dist/elements/BulkUpload/FormsManager/index.d.ts.map +1 -1
- package/dist/elements/BulkUpload/FormsManager/index.js +4 -2
- package/dist/elements/BulkUpload/FormsManager/index.js.map +1 -1
- package/dist/elements/PublishButton/ScheduleDrawer/buildUpcomingScheduleWhere.d.ts +13 -0
- package/dist/elements/PublishButton/ScheduleDrawer/buildUpcomingScheduleWhere.d.ts.map +1 -0
- package/dist/elements/PublishButton/ScheduleDrawer/buildUpcomingScheduleWhere.js +41 -0
- package/dist/elements/PublishButton/ScheduleDrawer/buildUpcomingScheduleWhere.js.map +1 -0
- package/dist/elements/PublishButton/ScheduleDrawer/index.d.ts.map +1 -1
- package/dist/elements/PublishButton/ScheduleDrawer/index.js +8 -54
- package/dist/elements/PublishButton/ScheduleDrawer/index.js.map +1 -1
- package/dist/elements/PublishButton/ScheduleDrawer/types.d.ts +1 -1
- package/dist/elements/PublishButton/ScheduleDrawer/types.d.ts.map +1 -1
- package/dist/elements/PublishButton/ScheduleDrawer/types.js.map +1 -1
- package/dist/elements/Spinner/index.d.ts +19 -0
- package/dist/elements/Spinner/index.d.ts.map +1 -0
- package/dist/elements/Spinner/index.js +51 -0
- package/dist/elements/Spinner/index.js.map +1 -0
- package/dist/elements/Spinner/index.scss +23 -0
- package/dist/exports/client/index.d.ts +4 -1
- package/dist/exports/client/index.d.ts.map +1 -1
- package/dist/exports/client/index.js +24 -24
- package/dist/exports/client/index.js.map +4 -4
- package/dist/fields/Tabs/index.d.ts.map +1 -1
- package/dist/fields/Tabs/index.js +109 -234
- package/dist/fields/Tabs/index.js.map +1 -1
- package/dist/fields/Tabs/resolveRestoredTabIndex.d.ts +19 -0
- package/dist/fields/Tabs/resolveRestoredTabIndex.d.ts.map +1 -0
- package/dist/fields/Tabs/resolveRestoredTabIndex.js +20 -0
- package/dist/fields/Tabs/resolveRestoredTabIndex.js.map +1 -0
- package/dist/fields/Tabs/resolveRestoredTabIndex.spec.js +53 -0
- package/dist/fields/Tabs/resolveRestoredTabIndex.spec.js.map +1 -0
- package/dist/forms/Form/index.d.ts.map +1 -1
- package/dist/forms/Form/index.js +6 -2
- package/dist/forms/Form/index.js.map +1 -1
- package/dist/forms/fieldSchemasToFormState/renderField.d.ts.map +1 -1
- package/dist/forms/fieldSchemasToFormState/renderField.js +3 -2
- package/dist/forms/fieldSchemasToFormState/renderField.js.map +1 -1
- package/dist/forms/fieldSchemasToFormState/serverFunctions/mergeAllowedFieldOverrides.d.ts +12 -0
- package/dist/forms/fieldSchemasToFormState/serverFunctions/mergeAllowedFieldOverrides.d.ts.map +1 -0
- package/dist/forms/fieldSchemasToFormState/serverFunctions/mergeAllowedFieldOverrides.js +32 -0
- package/dist/forms/fieldSchemasToFormState/serverFunctions/mergeAllowedFieldOverrides.js.map +1 -0
- package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.d.ts +8 -6
- package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.d.ts.map +1 -1
- package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.js +25 -9
- package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.js.map +1 -1
- package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.spec.js +179 -0
- package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.spec.js.map +1 -0
- package/dist/forms/fieldSchemasToFormState/types.d.ts +1 -0
- package/dist/forms/fieldSchemasToFormState/types.d.ts.map +1 -1
- package/dist/forms/fieldSchemasToFormState/types.js.map +1 -1
- package/dist/icons/Eye/index.scss +1 -1
- package/dist/icons/Refresh/index.d.ts +7 -0
- package/dist/icons/Refresh/index.d.ts.map +1 -0
- package/dist/icons/Refresh/index.js +35 -0
- package/dist/icons/Refresh/index.js.map +1 -0
- package/dist/icons/Refresh/index.scss +11 -0
- package/dist/icons/Spinner/index.d.ts +8 -0
- package/dist/icons/Spinner/index.d.ts.map +1 -0
- package/dist/icons/Spinner/index.js +34 -0
- package/dist/icons/Spinner/index.js.map +1 -0
- package/dist/icons/Spinner/index.scss +12 -0
- package/dist/providers/LivePreview/index.d.ts.map +1 -1
- package/dist/providers/LivePreview/index.js +13 -6
- package/dist/providers/LivePreview/index.js.map +1 -1
- package/dist/providers/ServerFunctions/index.d.ts +5 -1
- package/dist/providers/ServerFunctions/index.d.ts.map +1 -1
- package/dist/providers/ServerFunctions/index.js +15 -0
- package/dist/providers/ServerFunctions/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/utilities/buildFormState.d.ts.map +1 -1
- package/dist/utilities/buildFormState.js +6 -2
- package/dist/utilities/buildFormState.js.map +1 -1
- package/dist/utilities/formatAbsoluteURL.d.ts +1 -1
- package/dist/utilities/formatAbsoluteURL.d.ts.map +1 -1
- package/dist/utilities/formatAbsoluteURL.js +18 -8
- package/dist/utilities/formatAbsoluteURL.js.map +1 -1
- package/dist/utilities/formatAbsoluteURL.spec.js +27 -0
- package/dist/utilities/formatAbsoluteURL.spec.js.map +1 -0
- package/dist/utilities/isAbsoluteURL.d.ts +3 -0
- package/dist/utilities/isAbsoluteURL.d.ts.map +1 -0
- package/dist/utilities/isAbsoluteURL.js +15 -0
- package/dist/utilities/isAbsoluteURL.js.map +1 -0
- package/dist/utilities/isAbsoluteURL.spec.js +11 -0
- package/dist/utilities/isAbsoluteURL.spec.js.map +1 -0
- package/dist/utilities/isHttpURL.d.ts +3 -0
- package/dist/utilities/isHttpURL.d.ts.map +1 -0
- package/dist/utilities/isHttpURL.js +12 -0
- package/dist/utilities/isHttpURL.js.map +1 -0
- package/dist/utilities/isHttpURL.spec.js +25 -0
- package/dist/utilities/isHttpURL.spec.js.map +1 -0
- package/dist/utilities/schedulePublishHandler.d.ts +8 -1
- package/dist/utilities/schedulePublishHandler.d.ts.map +1 -1
- package/dist/utilities/schedulePublishHandler.js +78 -5
- package/dist/utilities/schedulePublishHandler.js.map +1 -1
- package/dist/views/Edit/Auth/APIKey.d.ts +1 -1
- package/dist/views/Edit/Auth/APIKey.d.ts.map +1 -1
- package/dist/views/Edit/Auth/APIKey.js +216 -59
- package/dist/views/Edit/Auth/APIKey.js.map +1 -1
- package/dist/views/Edit/Auth/APIKeyGenerationModal.d.ts +11 -0
- package/dist/views/Edit/Auth/APIKeyGenerationModal.d.ts.map +1 -0
- package/dist/views/Edit/Auth/APIKeyGenerationModal.js +113 -0
- package/dist/views/Edit/Auth/APIKeyGenerationModal.js.map +1 -0
- package/dist/views/Edit/Auth/index.d.ts.map +1 -1
- package/dist/views/Edit/Auth/index.js +10 -30
- package/dist/views/Edit/Auth/index.js.map +1 -1
- package/dist/views/Edit/Auth/index.scss +73 -36
- package/dist/views/Edit/Auth/types.d.ts +1 -1
- package/dist/views/Edit/Auth/types.d.ts.map +1 -1
- package/dist/views/Edit/Auth/types.js.map +1 -1
- package/package.json +6 -5
- package/dist/elements/GenerateConfirmation/index.d.ts +0 -7
- package/dist/elements/GenerateConfirmation/index.d.ts.map +0 -1
- package/dist/elements/GenerateConfirmation/index.js +0 -95
- package/dist/elements/GenerateConfirmation/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderFieldServerFn.js","names":["
|
|
1
|
+
{"version":3,"file":"renderFieldServerFn.js","names":["canAccessAdmin","UnauthorizedError","getClientConfig","getClientSchemaMap","getSchemaMap","renderField","mergeAllowedFieldOverrides","_internal_renderFieldHandler","name","hidden","initialValue","label","path","req","schemaPath","user","entityType","entitySlug","fieldPath","split","schemaMap","collectionSlug","undefined","config","payload","globalSlug","i18n","clientSchemaMap","importMap","targetField","get","join","Error","field","overrides","admin","hasPropOverrides","data","fieldState","clientFieldSchemaMap","fieldConfig","fieldSchemaMap","formState","indexPath","lastRenderedPath","operation","parentPath","parentSchemaPath","permissions","preferences","fields","forceCreateClientField","previousFieldState","renderAllFields","siblingData","customComponents"],"sources":["../../../../src/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.ts"],"sourcesContent":["import {\n canAccessAdmin,\n type Field,\n type FieldState,\n type ServerFunction,\n UnauthorizedError,\n} from 'payload'\n\nimport { getClientConfig } from '../../../utilities/getClientConfig.js'\nimport { getClientSchemaMap } from '../../../utilities/getClientSchemaMap.js'\nimport { getSchemaMap } from '../../../utilities/getSchemaMap.js'\nimport { renderField } from '../renderField.js'\nimport { mergeAllowedFieldOverrides } from './mergeAllowedFieldOverrides.js'\n\nexport type RenderFieldServerFnArgs = {\n /** Overrides admin.hidden from the schemaPath lookup. */\n hidden?: boolean\n /**\n * Pass the value this field will receive when rendering it on the server.\n * For richText, this helps provide initial state for sub-fields that are immediately rendered (like blocks)\n * so that we can avoid multiple waterfall requests for each block that renders on the client.\n */\n initialValue?: unknown\n /** Overrides the label from the schemaPath lookup. Use false to hide it. */\n label?: false | Record<string, string> | string\n /** Overrides the form field name from the schemaPath lookup. */\n name?: string\n /**\n * Path to the field to render\n * @default field name\n */\n path?: string\n /**\n * Dot schema path to a richText field declared in your config.\n * Format:\n * \"collection.<collectionSlug>.<fieldPath>\"\n * \"global.<globalSlug>.<fieldPath>\"\n *\n * Examples:\n * \"collection.posts.richText\"\n * \"global.siteSettings.content\"\n */\n schemaPath: string\n}\nexport type RenderFieldServerFnReturnType = {} & FieldState['customComponents']\n\n/**\n * @experimental - may break in minor releases\n */\nexport const _internal_renderFieldHandler: ServerFunction<\n RenderFieldServerFnArgs,\n Promise<RenderFieldServerFnReturnType>\n> = async ({ name, hidden, initialValue, label, path, req, schemaPath, user }) => {\n if (!req.user) {\n throw new UnauthorizedError()\n }\n\n await canAccessAdmin({ req })\n\n const [entityType, entitySlug, ...fieldPath] = schemaPath.split('.')\n\n const schemaMap = getSchemaMap({\n collectionSlug: entityType === 'collection' ? entitySlug : undefined,\n config: req.payload.config,\n globalSlug: entityType === 'global' ? entitySlug : undefined,\n i18n: req.i18n,\n })\n\n // Provide client schema map as it would have been provided if the target editor field would have been rendered.\n // For lexical, only then will it contain all the lexical-internal entries\n const clientSchemaMap = getClientSchemaMap({\n collectionSlug: entityType === 'collection' ? entitySlug : undefined,\n config: getClientConfig({\n config: req.payload.config,\n i18n: req.i18n,\n importMap: req.payload.importMap,\n user: req.user,\n }),\n globalSlug: entityType === 'global' ? entitySlug : undefined,\n i18n: req.i18n,\n payload: req.payload,\n schemaMap,\n })\n\n const targetField = schemaMap.get(`${entitySlug}.${fieldPath.join('.')}`) as Field | undefined\n\n if (!targetField) {\n throw new Error(`Could not find target field at schemaPath: ${schemaPath}`)\n }\n\n const field: Field = mergeAllowedFieldOverrides({\n overrides: { name, admin: { hidden }, label },\n targetField,\n })\n const hasPropOverrides = name !== undefined || label !== undefined || hidden !== undefined\n\n let data = {}\n if (typeof initialValue !== 'undefined') {\n if ('name' in field) {\n data[field.name] = initialValue\n } else {\n data = initialValue\n }\n }\n\n const fieldState: FieldState = {}\n renderField({\n clientFieldSchemaMap: clientSchemaMap,\n collectionSlug: entityType === 'collection' && entitySlug ? entitySlug : '-',\n data,\n fieldConfig: field,\n fieldSchemaMap: schemaMap,\n fieldState, // TODO,\n formState: {}, // TODO,\n indexPath: '',\n lastRenderedPath: '',\n operation: 'create',\n parentPath: '',\n parentSchemaPath: '',\n path: path ?? ('name' in field ? field.name : ''),\n permissions: true,\n preferences: {\n fields: {},\n },\n // Create a new client field when presentation values differ from the schema config.\n forceCreateClientField: hasPropOverrides,\n previousFieldState: undefined,\n renderAllFields: true,\n req,\n schemaPath: `${entitySlug}.${fieldPath.join('.')}`,\n siblingData: data,\n user,\n })\n\n return fieldState.customComponents ?? {}\n}\n"],"mappings":"AAAA,SACEA,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wBf,gBAAA;IACxBgB,kBAAA,EAAoB9B,SAAA;IACpB+B,eAAA,EAAiB;IACjBxC,GAAA;IACAC,UAAA,EAAY,GAAGG,UAAA,IAAcC,SAAA,CAAUa,IAAI,CAAC,MAAM;IAClDuB,WAAA,EAAajB,IAAA;IACbtB;EACF;EAEA,OAAOuB,UAAA,CAAWiB,gBAAgB,IAAI,CAAC;AACzC","ignoreList":[]}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { _internal_renderFieldHandler } from './renderFieldServerFn.js';
|
|
3
|
+
const mocks = vi.hoisted(() => ({
|
|
4
|
+
canAccessAdmin: vi.fn(),
|
|
5
|
+
getClientConfig: vi.fn(),
|
|
6
|
+
getClientSchemaMap: vi.fn(),
|
|
7
|
+
getSchemaMap: vi.fn(),
|
|
8
|
+
renderField: vi.fn()
|
|
9
|
+
}));
|
|
10
|
+
vi.mock('payload', () => ({
|
|
11
|
+
canAccessAdmin: mocks.canAccessAdmin,
|
|
12
|
+
UnauthorizedError: class extends Error {}
|
|
13
|
+
}));
|
|
14
|
+
vi.mock('../../../utilities/getClientConfig.js', () => ({
|
|
15
|
+
getClientConfig: mocks.getClientConfig
|
|
16
|
+
}));
|
|
17
|
+
vi.mock('../../../utilities/getClientSchemaMap.js', () => ({
|
|
18
|
+
getClientSchemaMap: mocks.getClientSchemaMap
|
|
19
|
+
}));
|
|
20
|
+
vi.mock('../../../utilities/getSchemaMap.js', () => ({
|
|
21
|
+
getSchemaMap: mocks.getSchemaMap
|
|
22
|
+
}));
|
|
23
|
+
vi.mock('../renderField.js', () => ({
|
|
24
|
+
renderField: mocks.renderField
|
|
25
|
+
}));
|
|
26
|
+
const args = {
|
|
27
|
+
req: {
|
|
28
|
+
user: {
|
|
29
|
+
collection: 'users'
|
|
30
|
+
},
|
|
31
|
+
payload: {
|
|
32
|
+
config: {},
|
|
33
|
+
importMap: {}
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
schemaPath: 'collection.posts.content'
|
|
37
|
+
};
|
|
38
|
+
describe('renderFieldServerFn', () => {
|
|
39
|
+
beforeEach(() => {
|
|
40
|
+
vi.resetAllMocks();
|
|
41
|
+
});
|
|
42
|
+
it('should accept allowed field props', async () => {
|
|
43
|
+
const targetField = {
|
|
44
|
+
name: 'content',
|
|
45
|
+
type: 'richText',
|
|
46
|
+
admin: {
|
|
47
|
+
hidden: true
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
mocks.getSchemaMap.mockReturnValue(new Map([['posts.content', targetField]]));
|
|
51
|
+
await _internal_renderFieldHandler({
|
|
52
|
+
...args,
|
|
53
|
+
name: 'editor',
|
|
54
|
+
label: 'Editor',
|
|
55
|
+
hidden: false,
|
|
56
|
+
initialValue: 'Initial text'
|
|
57
|
+
});
|
|
58
|
+
expect(mocks.canAccessAdmin).toHaveBeenCalledWith({
|
|
59
|
+
req: args.req
|
|
60
|
+
});
|
|
61
|
+
expect(mocks.renderField).toHaveBeenCalledWith(expect.objectContaining({
|
|
62
|
+
fieldConfig: {
|
|
63
|
+
name: 'editor',
|
|
64
|
+
label: 'Editor',
|
|
65
|
+
type: 'richText',
|
|
66
|
+
admin: {
|
|
67
|
+
hidden: false
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
data: {
|
|
71
|
+
editor: 'Initial text'
|
|
72
|
+
},
|
|
73
|
+
path: 'editor',
|
|
74
|
+
schemaPath: 'posts.content',
|
|
75
|
+
forceCreateClientField: true
|
|
76
|
+
}));
|
|
77
|
+
expect(targetField).toEqual({
|
|
78
|
+
name: 'content',
|
|
79
|
+
type: 'richText',
|
|
80
|
+
admin: {
|
|
81
|
+
hidden: true
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
it('should reject disallowed field props', async () => {
|
|
86
|
+
const components = {
|
|
87
|
+
Field: {
|
|
88
|
+
path: './ConfiguredField',
|
|
89
|
+
serverProps: {
|
|
90
|
+
heading: 'Configured heading'
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
const targetField = {
|
|
95
|
+
name: 'content',
|
|
96
|
+
type: 'richText',
|
|
97
|
+
admin: {
|
|
98
|
+
components,
|
|
99
|
+
hidden: true
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
mocks.getSchemaMap.mockReturnValue(new Map([['posts.content', targetField]]));
|
|
103
|
+
const request = {
|
|
104
|
+
...args,
|
|
105
|
+
field: {
|
|
106
|
+
admin: {
|
|
107
|
+
components: {
|
|
108
|
+
Field: {
|
|
109
|
+
path: './OtherField',
|
|
110
|
+
serverProps: {
|
|
111
|
+
heading: 'Other heading'
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
initialValue: 'Initial text'
|
|
118
|
+
};
|
|
119
|
+
await _internal_renderFieldHandler(request);
|
|
120
|
+
expect(mocks.canAccessAdmin).toHaveBeenCalledWith({
|
|
121
|
+
req: args.req
|
|
122
|
+
});
|
|
123
|
+
expect(mocks.renderField).toHaveBeenCalledWith(expect.objectContaining({
|
|
124
|
+
fieldConfig: {
|
|
125
|
+
...targetField,
|
|
126
|
+
admin: {
|
|
127
|
+
components: {
|
|
128
|
+
Field: {
|
|
129
|
+
path: './ConfiguredField',
|
|
130
|
+
serverProps: {
|
|
131
|
+
heading: 'Configured heading'
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
hidden: true
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
data: {
|
|
139
|
+
content: 'Initial text'
|
|
140
|
+
},
|
|
141
|
+
path: 'content',
|
|
142
|
+
schemaPath: 'posts.content',
|
|
143
|
+
forceCreateClientField: false
|
|
144
|
+
}));
|
|
145
|
+
expect(targetField).toEqual({
|
|
146
|
+
name: 'content',
|
|
147
|
+
type: 'richText',
|
|
148
|
+
admin: {
|
|
149
|
+
components: {
|
|
150
|
+
Field: {
|
|
151
|
+
path: './ConfiguredField',
|
|
152
|
+
serverProps: {
|
|
153
|
+
heading: 'Configured heading'
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
hidden: true
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
it('should deny when admin access is denied', async () => {
|
|
162
|
+
mocks.canAccessAdmin.mockRejectedValue(new Error('Admin access denied'));
|
|
163
|
+
await expect(_internal_renderFieldHandler(args)).rejects.toThrow('Admin access denied');
|
|
164
|
+
expect(mocks.getSchemaMap).not.toHaveBeenCalled();
|
|
165
|
+
expect(mocks.renderField).not.toHaveBeenCalled();
|
|
166
|
+
});
|
|
167
|
+
it('should deny when no user is on the request', async () => {
|
|
168
|
+
await expect(_internal_renderFieldHandler({
|
|
169
|
+
...args,
|
|
170
|
+
req: {
|
|
171
|
+
...args.req,
|
|
172
|
+
user: null
|
|
173
|
+
}
|
|
174
|
+
})).rejects.toThrow();
|
|
175
|
+
expect(mocks.canAccessAdmin).not.toHaveBeenCalled();
|
|
176
|
+
expect(mocks.renderField).not.toHaveBeenCalled();
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
//# sourceMappingURL=renderFieldServerFn.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderFieldServerFn.spec.js","names":["beforeEach","describe","expect","it","vi","_internal_renderFieldHandler","mocks","hoisted","canAccessAdmin","fn","getClientConfig","getClientSchemaMap","getSchemaMap","renderField","mock","UnauthorizedError","Error","args","req","user","collection","payload","config","importMap","schemaPath","resetAllMocks","targetField","name","type","admin","hidden","mockReturnValue","Map","label","initialValue","toHaveBeenCalledWith","objectContaining","fieldConfig","data","editor","path","forceCreateClientField","toEqual","components","Field","serverProps","heading","request","field","content","mockRejectedValue","rejects","toThrow","not","toHaveBeenCalled"],"sources":["../../../../src/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.spec.ts"],"sourcesContent":["import { beforeEach, describe, expect, it, vi } from 'vitest'\n\nimport { _internal_renderFieldHandler } from './renderFieldServerFn.js'\n\nconst mocks = vi.hoisted(() => ({\n canAccessAdmin: vi.fn(),\n getClientConfig: vi.fn(),\n getClientSchemaMap: vi.fn(),\n getSchemaMap: vi.fn(),\n renderField: vi.fn(),\n}))\n\nvi.mock('payload', () => ({\n canAccessAdmin: mocks.canAccessAdmin,\n UnauthorizedError: class extends Error {},\n}))\nvi.mock('../../../utilities/getClientConfig.js', () => ({\n getClientConfig: mocks.getClientConfig,\n}))\nvi.mock('../../../utilities/getClientSchemaMap.js', () => ({\n getClientSchemaMap: mocks.getClientSchemaMap,\n}))\nvi.mock('../../../utilities/getSchemaMap.js', () => ({ getSchemaMap: mocks.getSchemaMap }))\nvi.mock('../renderField.js', () => ({ renderField: mocks.renderField }))\n\ntype HandlerArgs = Parameters<typeof _internal_renderFieldHandler>[0]\n\nconst args = {\n req: { user: { collection: 'users' }, payload: { config: {}, importMap: {} } },\n schemaPath: 'collection.posts.content',\n} as HandlerArgs\n\ndescribe('renderFieldServerFn', () => {\n beforeEach(() => {\n vi.resetAllMocks()\n })\n\n it('should accept allowed field props', async () => {\n const targetField = { name: 'content', type: 'richText', admin: { hidden: true } }\n\n mocks.getSchemaMap.mockReturnValue(new Map([['posts.content', targetField]]))\n\n await _internal_renderFieldHandler({\n ...args,\n name: 'editor',\n label: 'Editor',\n hidden: false,\n initialValue: 'Initial text',\n })\n\n expect(mocks.canAccessAdmin).toHaveBeenCalledWith({ req: args.req })\n expect(mocks.renderField).toHaveBeenCalledWith(\n expect.objectContaining({\n fieldConfig: {\n name: 'editor',\n label: 'Editor',\n type: 'richText',\n admin: { hidden: false },\n },\n data: { editor: 'Initial text' },\n path: 'editor',\n schemaPath: 'posts.content',\n forceCreateClientField: true,\n }),\n )\n expect(targetField).toEqual({ name: 'content', type: 'richText', admin: { hidden: true } })\n })\n\n it('should reject disallowed field props', async () => {\n const components = {\n Field: { path: './ConfiguredField', serverProps: { heading: 'Configured heading' } },\n }\n const targetField = { name: 'content', type: 'richText', admin: { components, hidden: true } }\n\n mocks.getSchemaMap.mockReturnValue(new Map([['posts.content', targetField]]))\n\n const request = {\n ...args,\n field: {\n admin: {\n components: {\n Field: {\n path: './OtherField',\n serverProps: { heading: 'Other heading' },\n },\n },\n },\n },\n initialValue: 'Initial text',\n }\n\n await _internal_renderFieldHandler(request)\n\n expect(mocks.canAccessAdmin).toHaveBeenCalledWith({ req: args.req })\n expect(mocks.renderField).toHaveBeenCalledWith(\n expect.objectContaining({\n fieldConfig: {\n ...targetField,\n admin: {\n components: {\n Field: {\n path: './ConfiguredField',\n serverProps: { heading: 'Configured heading' },\n },\n },\n hidden: true,\n },\n },\n data: { content: 'Initial text' },\n path: 'content',\n schemaPath: 'posts.content',\n forceCreateClientField: false,\n }),\n )\n expect(targetField).toEqual({\n name: 'content',\n type: 'richText',\n admin: {\n components: {\n Field: {\n path: './ConfiguredField',\n serverProps: { heading: 'Configured heading' },\n },\n },\n hidden: true,\n },\n })\n })\n\n it('should deny when admin access is denied', async () => {\n mocks.canAccessAdmin.mockRejectedValue(new Error('Admin access denied'))\n\n await expect(_internal_renderFieldHandler(args)).rejects.toThrow('Admin access denied')\n expect(mocks.getSchemaMap).not.toHaveBeenCalled()\n expect(mocks.renderField).not.toHaveBeenCalled()\n })\n\n it('should deny when no user is on the request', async () => {\n await expect(\n _internal_renderFieldHandler({ ...args, req: { ...args.req, user: null } }),\n ).rejects.toThrow()\n expect(mocks.canAccessAdmin).not.toHaveBeenCalled()\n expect(mocks.renderField).not.toHaveBeenCalled()\n })\n})\n"],"mappings":"AAAA,SAASA,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,EAAE,QAAQ;AAErD,SAASC,4BAA4B,QAAQ;AAE7C,MAAMC,KAAA,GAAQF,EAAA,CAAGG,OAAO,CAAC,OAAO;EAC9BC,cAAA,EAAgBJ,EAAA,CAAGK,EAAE;EACrBC,e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A6B;MAAE,GAAGY,IAAI;MAAEC,GAAA,EAAK;QAAE,GAAGD,IAAA,CAAKC,GAAG;QAAEC,IAAA,EAAM;MAAK;IAAE,IACzEgC,OAAO,CAACC,OAAO;IACjBlD,MAAA,CAAOI,KAAA,CAAME,cAAc,EAAE6C,GAAG,CAACC,gBAAgB;IACjDpD,MAAA,CAAOI,KAAA,CAAMO,WAAW,EAAEwC,GAAG,CAACC,gBAAgB;EAChD;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/forms/fieldSchemasToFormState/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,IAAI,EACJ,mBAAmB,EACnB,KAAK,EACL,cAAc,EACd,UAAU,EACV,SAAS,EACT,SAAS,EACT,cAAc,EACd,yBAAyB,EAC1B,MAAM,SAAS,CAAA;AAEhB,MAAM,MAAM,eAAe,GAAG;IAC5B,oBAAoB,CAAC,EAAE,oBAAoB,CAAA;IAC3C,cAAc,EAAE,MAAM,CAAA;IACtB,IAAI,EAAE,IAAI,CAAA;IACV,WAAW,EAAE,KAAK,CAAA;IAClB,cAAc,EAAE,cAAc,CAAA;IAC9B,UAAU,EAAE,UAAU,CAAA;IACtB;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC,SAAS,EAAE,SAAS,CAAA;IACpB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;IACjB,gBAAgB,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,EAAE,SAAS,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,gBAAgB,EAAE,MAAM,CAAA;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,yBAAyB,CAAA;IACtC,WAAW,EAAE,mBAAmB,CAAA;IAChC,kBAAkB,EA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AA;IAClB,WAAW,EAAE,IAAI,CAAA;IACjB,IAAI,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,CAAA;CAC9B,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,eAAe,KAAK,IAAI,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../src/forms/fieldSchemasToFormState/types.ts"],"sourcesContent":["import type {\n ClientFieldSchemaMap,\n Data,\n DocumentPreferences,\n Field,\n FieldSchemaMap,\n FieldState,\n FormState,\n Operation,\n PayloadRequest,\n SanitizedFieldPermissions,\n} from 'payload'\n\nexport type RenderFieldArgs = {\n clientFieldSchemaMap?: ClientFieldSchemaMap\n collectionSlug: string\n data: Data\n fieldConfig: Field\n fieldSchemaMap: FieldSchemaMap\n fieldState: FieldState\n /**\n * If set to true, it will force creating a clientField based on the passed fieldConfig instead of pulling\n * the client field from the clientFieldSchemaMap. This is useful if the passed fieldConfig differs from the one in the schema map,\n * e.g. when calling the render-field server function and passing a field config override.\n */\n forceCreateClientField?: boolean\n formState: FormState\n id?: number | string\n indexPath: string\n lastRenderedPath: string\n mockRSCs?: boolean\n operation: Operation\n parentPath: string\n parentSchemaPath: string\n path: string\n permissions: SanitizedFieldPermissions\n preferences: DocumentPreferences\n previousFieldState: FieldState\n readOnly?: boolean\n renderAllFields: boolean\n req: PayloadRequest\n schemaPath: string\n siblingData: Data\n}\n\nexport type RenderFieldMethod = (args: RenderFieldArgs) => void\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/forms/fieldSchemasToFormState/types.ts"],"sourcesContent":["import type {\n ClientFieldSchemaMap,\n Data,\n DocumentPreferences,\n Field,\n FieldSchemaMap,\n FieldState,\n FormState,\n Operation,\n PayloadRequest,\n SanitizedFieldPermissions,\n} from 'payload'\n\nexport type RenderFieldArgs = {\n clientFieldSchemaMap?: ClientFieldSchemaMap\n collectionSlug: string\n data: Data\n fieldConfig: Field\n fieldSchemaMap: FieldSchemaMap\n fieldState: FieldState\n /**\n * If set to true, it will force creating a clientField based on the passed fieldConfig instead of pulling\n * the client field from the clientFieldSchemaMap. This is useful if the passed fieldConfig differs from the one in the schema map,\n * e.g. when calling the render-field server function and passing a field config override.\n */\n forceCreateClientField?: boolean\n formState: FormState\n id?: number | string\n indexPath: string\n lastRenderedPath: string\n mockRSCs?: boolean\n operation: Operation\n parentPath: string\n parentSchemaPath: string\n path: string\n permissions: SanitizedFieldPermissions\n preferences: DocumentPreferences\n previousFieldState: FieldState\n readOnly?: boolean\n renderAllFields: boolean\n req: PayloadRequest\n schemaPath: string\n siblingData: Data\n user?: PayloadRequest['user']\n}\n\nexport type RenderFieldMethod = (args: RenderFieldArgs) => void\n"],"mappings":"AA8CA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/icons/Refresh/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,cAAc,CAAA;AAYrB,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC;IACjC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,CAAA;CACxB,CAmBA,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import './index.scss';
|
|
4
|
+
const paths = {
|
|
5
|
+
16: {
|
|
6
|
+
fill: 'M8 3.5a4.5 4.5 0 0 0-4.473 4c-.03.275-.25.5-.527.5a.467.467 0 0 1-.478-.5 5.5 5.5 0 0 1 9.758-2.954.467.467 0 0 1-.12.68c-.23.154-.538.09-.715-.122A4.49 4.49 0 0 0 8 3.5m-4.16 7.274a.467.467 0 0 0-.12.68A5.5 5.5 0 0 0 13.478 8.5.467.467 0 0 0 13 8c-.276 0-.497.225-.527.5a4.5 4.5 0 0 1-7.918 2.396c-.177-.212-.486-.276-.715-.123',
|
|
7
|
+
stroke: 'M12.5 3v2.5H10m-4 5H3.5V13'
|
|
8
|
+
},
|
|
9
|
+
24: {
|
|
10
|
+
fill: 'M17.523 12.036a.5.5 0 0 1 .449.546A5.999 5.999 0 0 1 7 15.315V17.5a.5.5 0 0 1-1 0v-3a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1H8.002q.066.089.137.175a5 5 0 0 0 8.838-2.69.5.5 0 0 1 .546-.45M17.5 6a.5.5 0 0 1 .5.5v3a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1 0-1h1.498a5 5 0 0 0-8.975 2.515.5.5 0 1 1-.995-.097A6 6 0 0 1 17 8.684V6.5a.5.5 0 0 1 .5-.5'
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
export const RefreshIcon = ({
|
|
14
|
+
className,
|
|
15
|
+
size = 16
|
|
16
|
+
}) => /*#__PURE__*/_jsxs("svg", {
|
|
17
|
+
className: ['icon', 'icon--refresh', className].filter(Boolean).join(' '),
|
|
18
|
+
fill: "none",
|
|
19
|
+
height: size,
|
|
20
|
+
viewBox: `0 0 ${size} ${size}`,
|
|
21
|
+
width: size,
|
|
22
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
23
|
+
children: [size === 16 && paths[16].stroke && /*#__PURE__*/_jsx("path", {
|
|
24
|
+
d: paths[16].stroke,
|
|
25
|
+
stroke: "currentColor",
|
|
26
|
+
strokeLinecap: "round",
|
|
27
|
+
strokeLinejoin: "round"
|
|
28
|
+
}), /*#__PURE__*/_jsx("path", {
|
|
29
|
+
clipRule: "evenodd",
|
|
30
|
+
d: paths[size].fill,
|
|
31
|
+
fill: "currentColor",
|
|
32
|
+
fillRule: "evenodd"
|
|
33
|
+
})]
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","paths","fill","stroke","RefreshIcon","className","size","_jsxs","filter","Boolean","join","height","viewBox","width","xmlns","_jsx","d","strokeLinecap","strokeLinejoin","clipRule","fillRule"],"sources":["../../../src/icons/Refresh/index.tsx"],"sourcesContent":["import React from 'react'\n\nimport './index.scss'\n\nconst paths = {\n 16: {\n fill: 'M8 3.5a4.5 4.5 0 0 0-4.473 4c-.03.275-.25.5-.527.5a.467.467 0 0 1-.478-.5 5.5 5.5 0 0 1 9.758-2.954.467.467 0 0 1-.12.68c-.23.154-.538.09-.715-.122A4.49 4.49 0 0 0 8 3.5m-4.16 7.274a.467.467 0 0 0-.12.68A5.5 5.5 0 0 0 13.478 8.5.467.467 0 0 0 13 8c-.276 0-.497.225-.527.5a4.5 4.5 0 0 1-7.918 2.396c-.177-.212-.486-.276-.715-.123',\n stroke: 'M12.5 3v2.5H10m-4 5H3.5V13',\n },\n 24: {\n fill: 'M17.523 12.036a.5.5 0 0 1 .449.546A5.999 5.999 0 0 1 7 15.315V17.5a.5.5 0 0 1-1 0v-3a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1H8.002q.066.089.137.175a5 5 0 0 0 8.838-2.69.5.5 0 0 1 .546-.45M17.5 6a.5.5 0 0 1 .5.5v3a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1 0-1h1.498a5 5 0 0 0-8.975 2.515.5.5 0 1 1-.995-.097A6 6 0 0 1 17 8.684V6.5a.5.5 0 0 1 .5-.5',\n },\n}\n\nexport const RefreshIcon: React.FC<{\n readonly className?: string\n readonly size?: 16 | 24\n}> = ({ className, size = 16 }) => (\n <svg\n className={['icon', 'icon--refresh', className].filter(Boolean).join(' ')}\n fill=\"none\"\n height={size}\n viewBox={`0 0 ${size} ${size}`}\n width={size}\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n {size === 16 && paths[16].stroke && (\n <path\n d={paths[16].stroke}\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n )}\n <path clipRule=\"evenodd\" d={paths[size].fill} fill=\"currentColor\" fillRule=\"evenodd\" />\n </svg>\n)\n"],"mappings":";AAAA,OAAOA,KAAA,MAAW;AAElB,OAAO;AAEP,MAAMC,KAAA,GAAQ;EACZ,IAAI;IACFC,IAAA,EAAM;IACNC,MAAA,EAAQ;EACV;EACA,IAAI;IACFD,IAAA,EAAM;EACR;AACF;AAEA,OAAO,MAAME,WAAA,GAGRA,CAAC;EAAEC,SAAS;EAAEC,IAAA,GAAO;AAAE,CAAE,kBAC5BC,KAAA,CAAC;EACCF,SAAA,EAAW,CAAC,QAAQ,iBAAiBA,SAAA,CAAU,CAACG,MAAM,CAACC,OAAA,EAASC,IAAI,CAAC;EACrER,IAAA,EAAK;EACLS,MAAA,EAAQL,IAAA;EACRM,OAAA,EAAS,OAAON,IAAA,IAAQA,IAAA,EAAM;EAC9BO,KAAA,EAAOP,IAAA;EACPQ,KAAA,EAAM;aAELR,IAAA,KAAS,MAAML,KAAK,CAAC,GAAG,CAACE,MAAM,iBAC9BY,IAAA,CAAC;IACCC,CAAA,EAAGf,KAAK,CAAC,GAAG,CAACE,MAAM;IACnBA,MAAA,EAAO;IACPc,aAAA,EAAc;IACdC,cAAA,EAAe;mBAGnBH,IAAA,CAAC;IAAKI,QAAA,EAAS;IAAUH,CAAA,EAAGf,KAAK,CAACK,IAAA,CAAK,CAACJ,IAAI;IAAEA,IAAA,EAAK;IAAekB,QAAA,EAAS","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/icons/Spinner/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,cAAc,CAAA;AAUrB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;CACnC,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAelD,CAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import './index.scss';
|
|
4
|
+
const paths = {
|
|
5
|
+
lg: 'M16.445 5.348A8 8 0 0 0 12.5 4.016.525.525 0 0 1 12 3.5a.48.48 0 0 1 .5-.486A9 9 0 1 1 3.014 12.5.48.48 0 0 1 3.5 12c.276 0 .498.224.516.5a8 8 0 1 0 12.429-7.152',
|
|
6
|
+
md: 'M15.333 7.011a6 6 0 0 0-2.834-.99A.534.534 0 0 1 12 5.5c0-.276.224-.502.5-.482A7 7 0 1 1 5.018 12.5.473.473 0 0 1 5.5 12c.276 0 .498.224.52.5a6 6 0 1 0 9.313-5.489',
|
|
7
|
+
sm: 'M10.778 3.842a5 5 0 0 0-2.279-.817A.54.54 0 0 1 8 2.5a.47.47 0 0 1 .5-.48A6 6 0 1 1 2.02 8.5.47.47 0 0 1 2.5 8c.276 0 .497.224.525.499a5 5 0 1 0 7.753-4.657'
|
|
8
|
+
};
|
|
9
|
+
const sizes = {
|
|
10
|
+
lg: 24,
|
|
11
|
+
md: 24,
|
|
12
|
+
sm: 16
|
|
13
|
+
};
|
|
14
|
+
export const SpinnerIcon = ({
|
|
15
|
+
className,
|
|
16
|
+
size = 'sm'
|
|
17
|
+
}) => {
|
|
18
|
+
const dimension = sizes[size];
|
|
19
|
+
return /*#__PURE__*/_jsx("svg", {
|
|
20
|
+
className: ['icon icon--spinner', className].filter(Boolean).join(' '),
|
|
21
|
+
fill: "none",
|
|
22
|
+
height: dimension,
|
|
23
|
+
viewBox: `0 0 ${dimension} ${dimension}`,
|
|
24
|
+
width: dimension,
|
|
25
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
26
|
+
children: /*#__PURE__*/_jsx("path", {
|
|
27
|
+
clipRule: "evenodd",
|
|
28
|
+
d: paths[size],
|
|
29
|
+
fill: "currentColor",
|
|
30
|
+
fillRule: "evenodd"
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","paths","lg","md","sm","sizes","SpinnerIcon","className","size","dimension","_jsx","filter","Boolean","join","fill","height","viewBox","width","xmlns","clipRule","d","fillRule"],"sources":["../../../src/icons/Spinner/index.tsx"],"sourcesContent":["import React from 'react'\n\nimport './index.scss'\n\nconst paths = {\n lg: 'M16.445 5.348A8 8 0 0 0 12.5 4.016.525.525 0 0 1 12 3.5a.48.48 0 0 1 .5-.486A9 9 0 1 1 3.014 12.5.48.48 0 0 1 3.5 12c.276 0 .498.224.516.5a8 8 0 1 0 12.429-7.152',\n md: 'M15.333 7.011a6 6 0 0 0-2.834-.99A.534.534 0 0 1 12 5.5c0-.276.224-.502.5-.482A7 7 0 1 1 5.018 12.5.473.473 0 0 1 5.5 12c.276 0 .498.224.52.5a6 6 0 1 0 9.313-5.489',\n sm: 'M10.778 3.842a5 5 0 0 0-2.279-.817A.54.54 0 0 1 8 2.5a.47.47 0 0 1 .5-.48A6 6 0 1 1 2.02 8.5.47.47 0 0 1 2.5 8c.276 0 .497.224.525.499a5 5 0 1 0 7.753-4.657',\n}\n\nconst sizes = { lg: 24, md: 24, sm: 16 }\n\nexport type SpinnerIconProps = {\n readonly className?: string\n readonly size?: 'lg' | 'md' | 'sm'\n}\n\nexport const SpinnerIcon: React.FC<SpinnerIconProps> = ({ className, size = 'sm' }) => {\n const dimension = sizes[size]\n\n return (\n <svg\n className={['icon icon--spinner', className].filter(Boolean).join(' ')}\n fill=\"none\"\n height={dimension}\n viewBox={`0 0 ${dimension} ${dimension}`}\n width={dimension}\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path clipRule=\"evenodd\" d={paths[size]} fill=\"currentColor\" fillRule=\"evenodd\" />\n </svg>\n )\n}\n"],"mappings":";AAAA,OAAOA,KAAA,MAAW;AAElB,OAAO;AAEP,MAAMC,KAAA,GAAQ;EACZC,EAAA,EAAI;EACJC,EAAA,EAAI;EACJC,EAAA,EAAI;AACN;AAEA,MAAMC,KAAA,GAAQ;EAAEH,EAAA,EAAI;EAAIC,EAAA,EAAI;EAAIC,EAAA,EAAI;AAAG;AAOvC,OAAO,MAAME,WAAA,GAA0CA,CAAC;EAAEC,SAAS;EAAEC,IAAA,GAAO;AAAI,CAAE;EAChF,MAAMC,SAAA,GAAYJ,KAAK,CAACG,IAAA,CAAK;EAE7B,oBACEE,IAAA,CAAC;IACCH,SAAA,EAAW,CAAC,sBAAsBA,SAAA,CAAU,CAACI,MAAM,CAACC,OAAA,EAASC,IAAI,CAAC;IAClEC,IAAA,EAAK;IACLC,MAAA,EAAQN,SAAA;IACRO,OAAA,EAAS,OAAOP,SAAA,IAAaA,SAAA,EAAW;IACxCQ,KAAA,EAAOR,SAAA;IACPS,KAAA,EAAM;cAEN,aAAAR,IAAA,CAAC;MAAKS,QAAA,EAAS;MAAUC,CAAA,EAAGnB,KAAK,CAACO,IAAA,CAAK;MAAEM,IAAA,EAAK;MAAeO,QAAA,EAAS;;;AAG5E","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/LivePreview/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAyB,iBAAiB,EAAsB,MAAM,SAAS,CAAA;AAG3F,OAAO,KAAmE,MAAM,OAAO,CAAA;AAEvF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/LivePreview/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAyB,iBAAiB,EAAsB,MAAM,SAAS,CAAA;AAG3F,OAAO,KAAmE,MAAM,OAAO,CAAA;AAEvF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAA;AAW1D,MAAM,MAAM,wBAAwB,GAAG;IACrC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,WAAW,CAAC,EAAE,iBAAiB,CAAC,aAAa,CAAC,CAAA;IAC9C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,UAAU,CAAC,EAAE;QACX,MAAM,EAAE,MAAM,CAAA;QACd,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;IACD,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,gBAAgB,EAAE,OAAO,CAAA;IACzB;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,GAAG,IAAI,CAAC,sBAAsB,EAAE,sBAAsB,GAAG,KAAK,CAAC,CAAA;AAEhE,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAqSlE,CAAA"}
|
|
@@ -7,6 +7,7 @@ import { usePopupWindow } from '../../hooks/usePopupWindow.js';
|
|
|
7
7
|
import { useDocumentInfo } from '../../providers/DocumentInfo/index.js';
|
|
8
8
|
import { usePreferences } from '../../providers/Preferences/index.js';
|
|
9
9
|
import { formatAbsoluteURL } from '../../utilities/formatAbsoluteURL.js';
|
|
10
|
+
import { isHttpURL } from '../../utilities/isHttpURL.js';
|
|
10
11
|
import { customCollisionDetection } from './collisionDetection.js';
|
|
11
12
|
import { LivePreviewContext } from './context.js';
|
|
12
13
|
import { sizeReducer } from './sizeReducer.js';
|
|
@@ -40,7 +41,13 @@ export const LivePreviewProvider = ({
|
|
|
40
41
|
width: '100%'
|
|
41
42
|
}], [incomingBreakpoints]);
|
|
42
43
|
const [url, setURL] = useState('');
|
|
43
|
-
const [previewURL,
|
|
44
|
+
const [previewURL, _setPreviewURL] = useState();
|
|
45
|
+
const setPreviewURL = useCallback(incomingURL => {
|
|
46
|
+
_setPreviewURL(isHttpURL(incomingURL) ? incomingURL : undefined);
|
|
47
|
+
}, []);
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
setPreviewURL(previewURLFromProps);
|
|
50
|
+
}, [previewURLFromProps, setPreviewURL]);
|
|
44
51
|
const {
|
|
45
52
|
isPopupOpen,
|
|
46
53
|
openPopupWindow,
|
|
@@ -82,16 +89,16 @@ export const LivePreviewProvider = ({
|
|
|
82
89
|
* - resets `appIsReady` to `false` while the new URL is loading
|
|
83
90
|
*/
|
|
84
91
|
const setLivePreviewURL = useCallback(_incomingURL => {
|
|
85
|
-
let
|
|
92
|
+
let incomingURL_0;
|
|
86
93
|
if (typeof _incomingURL === 'string') {
|
|
87
|
-
|
|
94
|
+
incomingURL_0 = formatAbsoluteURL(_incomingURL);
|
|
88
95
|
}
|
|
89
|
-
if (!
|
|
96
|
+
if (!incomingURL_0) {
|
|
90
97
|
setIsLivePreviewing(false);
|
|
91
98
|
}
|
|
92
|
-
if (
|
|
99
|
+
if (incomingURL_0 !== url) {
|
|
93
100
|
setAppIsReady(false);
|
|
94
|
-
setURL(
|
|
101
|
+
setURL(incomingURL_0);
|
|
95
102
|
}
|
|
96
103
|
}, [url]);
|
|
97
104
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["DndContext","React","useCallback","useEffect","useId","useMemo","useRef","useState","usePopupWindow","useDocumentInfo","usePreferences","formatAbsoluteURL","customCollisionDetection","LivePreviewContext","sizeReducer","LivePreviewProvider","breakpoints","incomingBreakpoints","children","isLivePreviewEnabled","isLivePreviewing","incomingIsLivePreviewing","isPreviewEnabled","previewURL","previewURLFromProps","typeofLivePreviewURL","url","urlFromProps","previewWindowType","setPreviewWindowType","_setIsLivePreviewing","shouldRenderIframe","setShouldRenderIframe","setIsLivePreviewing","livePreviewing","name","height","label","width","setURL","setPreviewURL","isPopupOpen","openPopupWindow","popupRef","eventType","appIsReady","setAppIsReady","listeningForMessages","setListeningForMessages","collectionSlug","globalSlug","isFirstRender","setPreference","iframeRef","loadedURL","setLoadedURL","zoom","setZoom","position","setPosition","x","y","size","setSize","useReducer","measuredDeviceSize","setMeasuredDeviceSize","breakpoint","setBreakpoint","setLivePreviewURL","_incomingURL","incomingURL","handleDragEnd","ev","over","id","newPos","delta","setWidth","type","value","setHeight","foundBreakpoint","find","bp","handleMessage","event","startsWith","origin","data","ready","window","addEventListener","removeEventListener","handleWindowChange","newPreviewWindowType","current","editViewType","dndContextID","_jsx","setToolbarPosition","toolbarPosition","collisionDetection","onDragEnd"],"sources":["../../../src/providers/LivePreview/index.tsx"],"sourcesContent":["'use client'\nimport type { CollectionPreferences, LivePreviewConfig, LivePreviewURLType } from 'payload'\n\nimport { DndContext } from '@dnd-kit/core'\nimport React, { useCallback, useEffect, useId, useMemo, useRef, useState } from 'react'\n\nimport type { LivePreviewContextType } from './context.js'\n\nimport { usePopupWindow } from '../../hooks/usePopupWindow.js'\nimport { useDocumentInfo } from '../../providers/DocumentInfo/index.js'\nimport { usePreferences } from '../../providers/Preferences/index.js'\nimport { formatAbsoluteURL } from '../../utilities/formatAbsoluteURL.js'\nimport { customCollisionDetection } from './collisionDetection.js'\nimport { LivePreviewContext } from './context.js'\nimport { sizeReducer } from './sizeReducer.js'\n\nexport type LivePreviewProviderProps = {\n appIsReady?: boolean\n breakpoints?: LivePreviewConfig['breakpoints']\n children: React.ReactNode\n deviceSize?: {\n height: number\n width: number\n }\n isLivePreviewEnabled?: boolean\n isLivePreviewing: boolean\n /**\n * This specifically relates to `admin.preview` function in the config instead of live preview.\n */\n isPreviewEnabled?: boolean\n /**\n * This specifically relates to `admin.preview` function in the config instead of live preview.\n */\n previewURL?: string\n} & Pick<LivePreviewContextType, 'typeofLivePreviewURL' | 'url'>\n\nexport const LivePreviewProvider: React.FC<LivePreviewProviderProps> = ({\n breakpoints: incomingBreakpoints,\n children,\n isLivePreviewEnabled,\n isLivePreviewing: incomingIsLivePreviewing,\n isPreviewEnabled,\n previewURL: previewURLFromProps,\n typeofLivePreviewURL,\n url: urlFromProps,\n}) => {\n const [previewWindowType, setPreviewWindowType] = useState<'iframe' | 'popup'>('iframe')\n\n const [isLivePreviewing, _setIsLivePreviewing] =\n useState<LivePreviewContextType['isLivePreviewing']>(incomingIsLivePreviewing)\n\n const [shouldRenderIframe, setShouldRenderIframe] =\n useState<LivePreviewContextType['shouldRenderIframe']>(isLivePreviewing)\n\n /**\n * Rendering the iframe is a one-way event, e.g. defer load and never unmount.\n * This way, subsequent toggles will appear to load instantly.\n */\n const setIsLivePreviewing = useCallback<LivePreviewContextType['setIsLivePreviewing']>(\n (livePreviewing) => {\n if (livePreviewing) {\n setShouldRenderIframe(true)\n }\n\n _setIsLivePreviewing(livePreviewing)\n },\n [],\n )\n\n const breakpoints: LivePreviewConfig['breakpoints'] = useMemo(\n () => [\n ...(incomingBreakpoints || []),\n {\n name: 'responsive',\n height: '100%',\n label: 'Responsive',\n width: '100%',\n },\n ],\n [incomingBreakpoints],\n )\n\n const [url, setURL] = useState<string>('')\n const [previewURL, setPreviewURL] = useState<string>(previewURLFromProps)\n\n const { isPopupOpen, openPopupWindow, popupRef } = usePopupWindow({\n eventType: 'payload-live-preview',\n url,\n })\n\n const [appIsReady, setAppIsReady] = useState(false)\n const [listeningForMessages, setListeningForMessages] = useState(false)\n\n const { collectionSlug, globalSlug } = useDocumentInfo()\n\n const isFirstRender = useRef(true)\n\n const { setPreference } = usePreferences()\n\n const iframeRef = React.useRef<HTMLIFrameElement>(null)\n\n const [loadedURL, setLoadedURL] = useState<string>()\n\n const [zoom, setZoom] = useState(1)\n\n const [position, setPosition] = useState({ x: 0, y: 0 })\n\n const [size, setSize] = React.useReducer(sizeReducer, { height: 0, width: 0 })\n\n const [measuredDeviceSize, setMeasuredDeviceSize] = useState({\n height: 0,\n width: 0,\n })\n\n const [breakpoint, setBreakpoint] =\n React.useState<LivePreviewConfig['breakpoints'][0]['name']>('responsive')\n\n /**\n * A \"middleware\" callback fn that does some additional work before `setURL`.\n * This is what we provide through context, bc it:\n * - ensures the URL is absolute\n * - resets `appIsReady` to `false` while the new URL is loading\n */\n const setLivePreviewURL = useCallback<LivePreviewContextType['setURL']>(\n (_incomingURL) => {\n let incomingURL: LivePreviewURLType\n\n if (typeof _incomingURL === 'string') {\n incomingURL = formatAbsoluteURL(_incomingURL)\n }\n\n if (!incomingURL) {\n setIsLivePreviewing(false)\n }\n\n if (incomingURL !== url) {\n setAppIsReady(false)\n setURL(incomingURL)\n }\n },\n [url],\n )\n\n /**\n * `url` needs to be relative to the window, which cannot be done on initial render.\n */\n useEffect(() => {\n if (typeof urlFromProps === 'string') {\n setURL(formatAbsoluteURL(urlFromProps))\n }\n }, [urlFromProps])\n\n // The toolbar needs to freely drag and drop around the page\n const handleDragEnd = (ev) => {\n // only update position if the toolbar is completely within the preview area\n // otherwise reset it back to the previous position\n // TODO: reset to the nearest edge of the preview area\n if (ev.over && ev.over.id === 'live-preview-area') {\n const newPos = {\n x: position.x + ev.delta.x,\n y: position.y + ev.delta.y,\n }\n\n setPosition(newPos)\n } else {\n // reset\n }\n }\n\n const setWidth = useCallback(\n (width) => {\n setSize({ type: 'width', value: width })\n },\n [setSize],\n )\n\n const setHeight = useCallback(\n (height) => {\n setSize({ type: 'height', value: height })\n },\n [setSize],\n )\n\n // explicitly set new width and height when as new breakpoints are selected\n // exclude `custom` breakpoint as it is handled by the `setWidth` and `setHeight` directly\n useEffect(() => {\n const foundBreakpoint = breakpoints?.find((bp) => bp.name === breakpoint)\n\n if (\n foundBreakpoint &&\n breakpoint !== 'responsive' &&\n breakpoint !== 'custom' &&\n typeof foundBreakpoint?.width === 'number' &&\n typeof foundBreakpoint?.height === 'number'\n ) {\n setSize({\n type: 'reset',\n value: {\n height: foundBreakpoint.height,\n width: foundBreakpoint.width,\n },\n })\n }\n }, [breakpoint, breakpoints])\n\n /**\n * Receive the `ready` message from the popup window\n * This indicates that the app is ready to receive `window.postMessage` events\n * This is also the only cross-origin way of detecting when a popup window has loaded\n * Unlike iframe elements which have an `onLoad` handler, there is no way to access `window.open` on popups\n */\n useEffect(() => {\n const handleMessage = (event: MessageEvent) => {\n if (\n url?.startsWith(event.origin) &&\n event.data &&\n typeof event.data === 'object' &&\n event.data.type === 'payload-live-preview'\n ) {\n if (event.data.ready) {\n setAppIsReady(true)\n }\n }\n }\n\n window.addEventListener('message', handleMessage)\n\n setListeningForMessages(true)\n\n return () => {\n window.removeEventListener('message', handleMessage)\n }\n }, [url, listeningForMessages])\n\n const handleWindowChange = useCallback(\n (type: 'iframe' | 'popup') => {\n setAppIsReady(false)\n setPreviewWindowType(type)\n if (type === 'popup') {\n openPopupWindow()\n }\n },\n [openPopupWindow],\n )\n\n // when the user closes the popup window, switch back to the iframe\n // the `usePopupWindow` reports the `isPopupOpen` state for us to use here\n useEffect(() => {\n const newPreviewWindowType = isPopupOpen ? 'popup' : 'iframe'\n\n if (newPreviewWindowType !== previewWindowType) {\n handleWindowChange('iframe')\n }\n }, [previewWindowType, isPopupOpen, handleWindowChange])\n\n useEffect(() => {\n if (isFirstRender.current) {\n isFirstRender.current = false\n return\n }\n\n void setPreference<CollectionPreferences>(\n collectionSlug ? `collection-${collectionSlug}` : `global-${globalSlug}`,\n {\n editViewType: isLivePreviewing ? 'live-preview' : 'default',\n },\n true,\n )\n }, [isLivePreviewing, setPreference, collectionSlug, globalSlug])\n\n const dndContextID = useId()\n\n return (\n <LivePreviewContext\n value={{\n appIsReady,\n breakpoint,\n breakpoints,\n iframeRef,\n isLivePreviewEnabled,\n isLivePreviewing,\n isPopupOpen,\n isPreviewEnabled,\n listeningForMessages,\n loadedURL,\n measuredDeviceSize,\n openPopupWindow,\n popupRef,\n previewURL,\n previewWindowType,\n setAppIsReady,\n setBreakpoint,\n setHeight,\n setIsLivePreviewing,\n setLoadedURL,\n setMeasuredDeviceSize,\n setPreviewURL,\n setPreviewWindowType: handleWindowChange,\n setSize,\n setToolbarPosition: setPosition,\n setURL: setLivePreviewURL,\n setWidth,\n setZoom,\n shouldRenderIframe,\n size,\n toolbarPosition: position,\n typeofLivePreviewURL,\n url,\n zoom,\n }}\n >\n <DndContext\n collisionDetection={customCollisionDetection}\n // Provide stable ID to fix hydration issues: https://github.com/clauderic/dnd-kit/issues/926\n id={dndContextID}\n onDragEnd={handleDragEnd}\n >\n {children}\n </DndContext>\n </LivePreviewContext>\n )\n}\n"],"mappings":"AAAA;;;AAGA,SAASA,UAAU,QAAQ;AAC3B,OAAOC,KAAA,IAASC,WAAW,EAAEC,SAAS,EAAEC,KAAK,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ;AAIhF,SAASC,cAAc,QAAQ;AAC/B,SAASC,eAAe,QAAQ;AAChC,SAASC,cAAc,QAAQ;AAC/B,SAASC,iBAAiB,QAAQ;AAClC,SAASC,wBAAwB,QAAQ;AACzC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,WAAW,QAAQ;AAsB5B,OAAO,MAAMC,mBAAA,GAA0DA,CAAC;EACtEC,WAAA,EAAaC,mBAAmB;EAChCC,QAAQ;EACRC,oBAAoB;EACpBC,gBAAA,EAAkBC,wBAAwB;EAC1CC,gBAAgB;EAChBC,UAAA,EAAYC,mBAAmB;EAC/BC,oBAAoB;EACpBC,GAAA,EAAKC;AAAY,CAClB;EACC,MAAM,CAACC,iBAAA,EAAmBC,oBAAA,CAAqB,GAAGtB,QAAA,CAA6B;EAE/E,MAAM,CAACa,gBAAA,EAAkBU,oBAAA,CAAqB,GAC5CvB,QAAA,CAAqDc,wBAAA;EAEvD,MAAM,CAACU,kBAAA,EAAoBC,qBAAA,CAAsB,GAC/CzB,QAAA,CAAuDa,gBAAA;EAEzD;;;;EAIA,MAAMa,mBAAA,GAAsB/B,WAAA,CACzBgC,cAAA;IACC,IAAIA,cAAA,EAAgB;MAClBF,qBAAA,CAAsB;IACxB;IAEAF,oBAAA,CAAqBI,cAAA;EACvB,GAC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MACCsG,kBAAA,EAAoB1F,wBAAA;MACpB;MACA+D,EAAA,EAAIuB,YAAA;MACJK,SAAA,EAAW/B,aAAA;gBAEVtD;;;AAIT","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["DndContext","React","useCallback","useEffect","useId","useMemo","useRef","useState","usePopupWindow","useDocumentInfo","usePreferences","formatAbsoluteURL","isHttpURL","customCollisionDetection","LivePreviewContext","sizeReducer","LivePreviewProvider","breakpoints","incomingBreakpoints","children","isLivePreviewEnabled","isLivePreviewing","incomingIsLivePreviewing","isPreviewEnabled","previewURL","previewURLFromProps","typeofLivePreviewURL","url","urlFromProps","previewWindowType","setPreviewWindowType","_setIsLivePreviewing","shouldRenderIframe","setShouldRenderIframe","setIsLivePreviewing","livePreviewing","name","height","label","width","setURL","_setPreviewURL","setPreviewURL","incomingURL","undefined","isPopupOpen","openPopupWindow","popupRef","eventType","appIsReady","setAppIsReady","listeningForMessages","setListeningForMessages","collectionSlug","globalSlug","isFirstRender","setPreference","iframeRef","loadedURL","setLoadedURL","zoom","setZoom","position","setPosition","x","y","size","setSize","useReducer","measuredDeviceSize","setMeasuredDeviceSize","breakpoint","setBreakpoint","setLivePreviewURL","_incomingURL","handleDragEnd","ev","over","id","newPos","delta","setWidth","type","value","setHeight","foundBreakpoint","find","bp","handleMessage","event","startsWith","origin","data","ready","window","addEventListener","removeEventListener","handleWindowChange","newPreviewWindowType","current","editViewType","dndContextID","_jsx","setToolbarPosition","toolbarPosition","collisionDetection","onDragEnd"],"sources":["../../../src/providers/LivePreview/index.tsx"],"sourcesContent":["'use client'\nimport type { CollectionPreferences, LivePreviewConfig, LivePreviewURLType } from 'payload'\n\nimport { DndContext } from '@dnd-kit/core'\nimport React, { useCallback, useEffect, useId, useMemo, useRef, useState } from 'react'\n\nimport type { LivePreviewContextType } from './context.js'\n\nimport { usePopupWindow } from '../../hooks/usePopupWindow.js'\nimport { useDocumentInfo } from '../../providers/DocumentInfo/index.js'\nimport { usePreferences } from '../../providers/Preferences/index.js'\nimport { formatAbsoluteURL } from '../../utilities/formatAbsoluteURL.js'\nimport { isHttpURL } from '../../utilities/isHttpURL.js'\nimport { customCollisionDetection } from './collisionDetection.js'\nimport { LivePreviewContext } from './context.js'\nimport { sizeReducer } from './sizeReducer.js'\n\nexport type LivePreviewProviderProps = {\n appIsReady?: boolean\n breakpoints?: LivePreviewConfig['breakpoints']\n children: React.ReactNode\n deviceSize?: {\n height: number\n width: number\n }\n isLivePreviewEnabled?: boolean\n isLivePreviewing: boolean\n /**\n * This specifically relates to `admin.preview` function in the config instead of live preview.\n */\n isPreviewEnabled?: boolean\n /**\n * This specifically relates to `admin.preview` function in the config instead of live preview.\n */\n previewURL?: string\n} & Pick<LivePreviewContextType, 'typeofLivePreviewURL' | 'url'>\n\nexport const LivePreviewProvider: React.FC<LivePreviewProviderProps> = ({\n breakpoints: incomingBreakpoints,\n children,\n isLivePreviewEnabled,\n isLivePreviewing: incomingIsLivePreviewing,\n isPreviewEnabled,\n previewURL: previewURLFromProps,\n typeofLivePreviewURL,\n url: urlFromProps,\n}) => {\n const [previewWindowType, setPreviewWindowType] = useState<'iframe' | 'popup'>('iframe')\n\n const [isLivePreviewing, _setIsLivePreviewing] =\n useState<LivePreviewContextType['isLivePreviewing']>(incomingIsLivePreviewing)\n\n const [shouldRenderIframe, setShouldRenderIframe] =\n useState<LivePreviewContextType['shouldRenderIframe']>(isLivePreviewing)\n\n /**\n * Rendering the iframe is a one-way event, e.g. defer load and never unmount.\n * This way, subsequent toggles will appear to load instantly.\n */\n const setIsLivePreviewing = useCallback<LivePreviewContextType['setIsLivePreviewing']>(\n (livePreviewing) => {\n if (livePreviewing) {\n setShouldRenderIframe(true)\n }\n\n _setIsLivePreviewing(livePreviewing)\n },\n [],\n )\n\n const breakpoints: LivePreviewConfig['breakpoints'] = useMemo(\n () => [\n ...(incomingBreakpoints || []),\n {\n name: 'responsive',\n height: '100%',\n label: 'Responsive',\n width: '100%',\n },\n ],\n [incomingBreakpoints],\n )\n\n const [url, setURL] = useState<string>('')\n const [previewURL, _setPreviewURL] = useState<string>()\n\n const setPreviewURL = useCallback<LivePreviewContextType['setPreviewURL']>((incomingURL) => {\n _setPreviewURL(isHttpURL(incomingURL) ? incomingURL : undefined)\n }, [])\n\n useEffect(() => {\n setPreviewURL(previewURLFromProps)\n }, [previewURLFromProps, setPreviewURL])\n\n const { isPopupOpen, openPopupWindow, popupRef } = usePopupWindow({\n eventType: 'payload-live-preview',\n url,\n })\n\n const [appIsReady, setAppIsReady] = useState(false)\n const [listeningForMessages, setListeningForMessages] = useState(false)\n\n const { collectionSlug, globalSlug } = useDocumentInfo()\n\n const isFirstRender = useRef(true)\n\n const { setPreference } = usePreferences()\n\n const iframeRef = React.useRef<HTMLIFrameElement>(null)\n\n const [loadedURL, setLoadedURL] = useState<string>()\n\n const [zoom, setZoom] = useState(1)\n\n const [position, setPosition] = useState({ x: 0, y: 0 })\n\n const [size, setSize] = React.useReducer(sizeReducer, { height: 0, width: 0 })\n\n const [measuredDeviceSize, setMeasuredDeviceSize] = useState({\n height: 0,\n width: 0,\n })\n\n const [breakpoint, setBreakpoint] =\n React.useState<LivePreviewConfig['breakpoints'][0]['name']>('responsive')\n\n /**\n * A \"middleware\" callback fn that does some additional work before `setURL`.\n * This is what we provide through context, bc it:\n * - ensures the URL is absolute\n * - resets `appIsReady` to `false` while the new URL is loading\n */\n const setLivePreviewURL = useCallback<LivePreviewContextType['setURL']>(\n (_incomingURL) => {\n let incomingURL: LivePreviewURLType\n\n if (typeof _incomingURL === 'string') {\n incomingURL = formatAbsoluteURL(_incomingURL)\n }\n\n if (!incomingURL) {\n setIsLivePreviewing(false)\n }\n\n if (incomingURL !== url) {\n setAppIsReady(false)\n setURL(incomingURL)\n }\n },\n [url],\n )\n\n /**\n * `url` needs to be relative to the window, which cannot be done on initial render.\n */\n useEffect(() => {\n if (typeof urlFromProps === 'string') {\n setURL(formatAbsoluteURL(urlFromProps))\n }\n }, [urlFromProps])\n\n // The toolbar needs to freely drag and drop around the page\n const handleDragEnd = (ev) => {\n // only update position if the toolbar is completely within the preview area\n // otherwise reset it back to the previous position\n // TODO: reset to the nearest edge of the preview area\n if (ev.over && ev.over.id === 'live-preview-area') {\n const newPos = {\n x: position.x + ev.delta.x,\n y: position.y + ev.delta.y,\n }\n\n setPosition(newPos)\n } else {\n // reset\n }\n }\n\n const setWidth = useCallback(\n (width) => {\n setSize({ type: 'width', value: width })\n },\n [setSize],\n )\n\n const setHeight = useCallback(\n (height) => {\n setSize({ type: 'height', value: height })\n },\n [setSize],\n )\n\n // explicitly set new width and height when as new breakpoints are selected\n // exclude `custom` breakpoint as it is handled by the `setWidth` and `setHeight` directly\n useEffect(() => {\n const foundBreakpoint = breakpoints?.find((bp) => bp.name === breakpoint)\n\n if (\n foundBreakpoint &&\n breakpoint !== 'responsive' &&\n breakpoint !== 'custom' &&\n typeof foundBreakpoint?.width === 'number' &&\n typeof foundBreakpoint?.height === 'number'\n ) {\n setSize({\n type: 'reset',\n value: {\n height: foundBreakpoint.height,\n width: foundBreakpoint.width,\n },\n })\n }\n }, [breakpoint, breakpoints])\n\n /**\n * Receive the `ready` message from the popup window\n * This indicates that the app is ready to receive `window.postMessage` events\n * This is also the only cross-origin way of detecting when a popup window has loaded\n * Unlike iframe elements which have an `onLoad` handler, there is no way to access `window.open` on popups\n */\n useEffect(() => {\n const handleMessage = (event: MessageEvent) => {\n if (\n url?.startsWith(event.origin) &&\n event.data &&\n typeof event.data === 'object' &&\n event.data.type === 'payload-live-preview'\n ) {\n if (event.data.ready) {\n setAppIsReady(true)\n }\n }\n }\n\n window.addEventListener('message', handleMessage)\n\n setListeningForMessages(true)\n\n return () => {\n window.removeEventListener('message', handleMessage)\n }\n }, [url, listeningForMessages])\n\n const handleWindowChange = useCallback(\n (type: 'iframe' | 'popup') => {\n setAppIsReady(false)\n setPreviewWindowType(type)\n if (type === 'popup') {\n openPopupWindow()\n }\n },\n [openPopupWindow],\n )\n\n // when the user closes the popup window, switch back to the iframe\n // the `usePopupWindow` reports the `isPopupOpen` state for us to use here\n useEffect(() => {\n const newPreviewWindowType = isPopupOpen ? 'popup' : 'iframe'\n\n if (newPreviewWindowType !== previewWindowType) {\n handleWindowChange('iframe')\n }\n }, [previewWindowType, isPopupOpen, handleWindowChange])\n\n useEffect(() => {\n if (isFirstRender.current) {\n isFirstRender.current = false\n return\n }\n\n void setPreference<CollectionPreferences>(\n collectionSlug ? `collection-${collectionSlug}` : `global-${globalSlug}`,\n {\n editViewType: isLivePreviewing ? 'live-preview' : 'default',\n },\n true,\n )\n }, [isLivePreviewing, setPreference, collectionSlug, globalSlug])\n\n const dndContextID = useId()\n\n return (\n <LivePreviewContext\n value={{\n appIsReady,\n breakpoint,\n breakpoints,\n iframeRef,\n isLivePreviewEnabled,\n isLivePreviewing,\n isPopupOpen,\n isPreviewEnabled,\n listeningForMessages,\n loadedURL,\n measuredDeviceSize,\n openPopupWindow,\n popupRef,\n previewURL,\n previewWindowType,\n setAppIsReady,\n setBreakpoint,\n setHeight,\n setIsLivePreviewing,\n setLoadedURL,\n setMeasuredDeviceSize,\n setPreviewURL,\n setPreviewWindowType: handleWindowChange,\n setSize,\n setToolbarPosition: setPosition,\n setURL: setLivePreviewURL,\n setWidth,\n setZoom,\n shouldRenderIframe,\n size,\n toolbarPosition: position,\n typeofLivePreviewURL,\n url,\n zoom,\n }}\n >\n <DndContext\n collisionDetection={customCollisionDetection}\n // Provide stable ID to fix hydration issues: https://github.com/clauderic/dnd-kit/issues/926\n id={dndContextID}\n onDragEnd={handleDragEnd}\n >\n {children}\n </DndContext>\n </LivePreviewContext>\n )\n}\n"],"mappings":"AAAA;;;AAGA,SAASA,UAAU,QAAQ;AAC3B,OAAOC,KAAA,IAASC,WAAW,EAAEC,SAAS,EAAEC,KAAK,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ;AAIhF,SAASC,cAAc,QAAQ;AAC/B,SAASC,eAAe,QAAQ;AAChC,SAASC,cAAc,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9F,SAAA,CAAU;IACR,IAAIoD,aAAA,CAAc4C,OAAO,EAAE;MACzB5C,aAAA,CAAc4C,OAAO,GAAG;MACxB;IACF;IAEA,KAAK3C,aAAA,CACHH,cAAA,GAAiB,cAAcA,cAAA,EAAgB,GAAG,UAAUC,UAAA,EAAY,EACxE;MACE8C,YAAA,EAAc/E,gBAAA,GAAmB,iBAAiB;IACpD,GACA;EAEJ,GAAG,CAACA,gBAAA,EAAkBmC,aAAA,EAAeH,cAAA,EAAgBC,UAAA,CAAW;EAEhE,MAAM+C,YAAA,GAAejG,KAAA;EAErB,oBACEkG,IAAA,CAACxF,kBAAA;IACCqE,KAAA,EAAO;MACLlC,UAAA;MACAsB,UAAA;MACAtD,WAAA;MACAwC,SAAA;MACArC,oBAAA;MACAC,gBAAA;MACAwB,WAAA;MACAtB,gBAAA;MACA4B,oBAAA;MACAO,SAAA;MACAW,kBAAA;MACAvB,eAAA;MACAC,QAAA;MACAvB,UAAA;MACAK,iBAAA;MACAqB,aAAA;MACAsB,aAAA;MACAY,SAAA;MACAlD,mBAAA;MACAyB,YAAA;MACAW,qBAAA;MACA5B,aAAA;MACAZ,oBAAA,EAAsBmE,kBAAA;MACtB9B,OAAA;MACAoC,kBAAA,EAAoBxC,WAAA;MACpBvB,MAAA,EAAQiC,iBAAA;MACRQ,QAAA;MACApB,OAAA;MACA7B,kBAAA;MACAkC,IAAA;MACAsC,eAAA,EAAiB1C,QAAA;MACjBpC,oBAAA;MACAC,GAAA;MACAiC;IACF;cAEA,aAAA0C,IAAA,CAACtG,UAAA;MACCyG,kBAAA,EAAoB5F,wBAAA;MACpB;MACAiE,EAAA,EAAIuB,YAAA;MACJK,SAAA,EAAW/B,aAAA;gBAEVxD;;;AAIT","ignoreList":[]}
|
|
@@ -6,13 +6,16 @@ import type { buildFormStateHandler } from '../../utilities/buildFormState.js';
|
|
|
6
6
|
import type { buildTableStateHandler } from '../../utilities/buildTableState.js';
|
|
7
7
|
import type { CopyDataFromLocaleArgs } from '../../utilities/copyDataFromLocale.js';
|
|
8
8
|
import type { getFolderResultsComponentAndDataHandler } from '../../utilities/getFolderResultsComponentAndData.js';
|
|
9
|
-
import type { schedulePublishHandler, SchedulePublishHandlerArgs } from '../../utilities/schedulePublishHandler.js';
|
|
9
|
+
import type { getUpcomingScheduledPublishHandler, GetUpcomingScheduledPublishHandlerArgs, schedulePublishHandler, SchedulePublishHandlerArgs } from '../../utilities/schedulePublishHandler.js';
|
|
10
10
|
type GetFormStateClient = (args: {
|
|
11
11
|
signal?: AbortSignal;
|
|
12
12
|
} & Omit<BuildFormStateArgs, 'clientConfig' | 'req'>) => ReturnType<typeof buildFormStateHandler>;
|
|
13
13
|
type SchedulePublishClient = (args: {
|
|
14
14
|
signal?: AbortSignal;
|
|
15
15
|
} & Omit<SchedulePublishHandlerArgs, 'clientConfig' | 'req'>) => ReturnType<typeof schedulePublishHandler>;
|
|
16
|
+
type GetUpcomingScheduledPublishClient = (args: {
|
|
17
|
+
signal?: AbortSignal;
|
|
18
|
+
} & Omit<GetUpcomingScheduledPublishHandlerArgs, 'clientConfig' | 'req'>) => ReturnType<typeof getUpcomingScheduledPublishHandler>;
|
|
16
19
|
type GetTableStateClient = (args: {
|
|
17
20
|
signal?: AbortSignal;
|
|
18
21
|
} & Omit<BuildTableStateArgs, 'clientConfig' | 'req'>) => ReturnType<typeof buildTableStateHandler>;
|
|
@@ -68,6 +71,7 @@ export type ServerFunctionsContextType = {
|
|
|
68
71
|
getFolderResultsComponentAndData: GetFolderResultsComponentAndDataClient;
|
|
69
72
|
getFormState: GetFormStateClient;
|
|
70
73
|
getTableState: GetTableStateClient;
|
|
74
|
+
getUpcomingScheduledPublish: GetUpcomingScheduledPublishClient;
|
|
71
75
|
renderDocument: RenderDocumentServerFunctionHookFn;
|
|
72
76
|
schedulePublish: SchedulePublishClient;
|
|
73
77
|
serverFunction: ServerFunctionClient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"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