@payloadcms/richtext-lexical 3.0.0-beta.127 → 3.0.0-beta.128
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/LICENSE.md +1 -1
- package/dist/cell/rscEntry.d.ts +12 -0
- package/dist/cell/rscEntry.d.ts.map +1 -0
- package/dist/cell/rscEntry.js +82 -0
- package/dist/cell/rscEntry.js.map +1 -0
- package/dist/exports/client/Field-SHUAQNQD.js +2 -0
- package/dist/exports/client/Field-SHUAQNQD.js.map +7 -0
- package/dist/exports/client/RelationshipComponent-IMM4CFBE.js +2 -0
- package/dist/exports/client/RelationshipComponent-IMM4CFBE.js.map +7 -0
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/{chunk-NEO76RJK.js → chunk-352SHIZR.js} +2 -2
- package/dist/exports/client/chunk-75T7MDBH.js +2 -0
- package/dist/exports/client/chunk-75T7MDBH.js.map +7 -0
- package/dist/exports/client/{chunk-XY4TCSM7.js → chunk-O4IOO4EU.js} +2 -2
- package/dist/exports/client/chunk-OOBB5GCO.js +2 -0
- package/dist/exports/client/chunk-OOBB5GCO.js.map +7 -0
- package/dist/exports/client/chunk-PDAZFJVO.js +2 -0
- package/dist/exports/client/chunk-PDAZFJVO.js.map +7 -0
- package/dist/exports/client/{chunk-32KXGBIQ.js → chunk-ZOYGBIAN.js} +2 -2
- package/dist/exports/client/component-EHTN2BHZ.js +2 -0
- package/dist/exports/client/component-EHTN2BHZ.js.map +7 -0
- package/dist/exports/client/component-YE2TDR5O.js +2 -0
- package/dist/exports/client/component-YE2TDR5O.js.map +7 -0
- package/dist/exports/client/componentInline-N5LJ2LY2.js +2 -0
- package/dist/exports/client/componentInline-N5LJ2LY2.js.map +7 -0
- package/dist/exports/client/index.d.ts +0 -1
- package/dist/exports/client/index.d.ts.map +1 -1
- package/dist/exports/client/index.js +8 -8
- package/dist/exports/client/index.js.map +4 -4
- package/dist/exports/server/rsc.d.ts +3 -0
- package/dist/exports/server/rsc.d.ts.map +1 -0
- package/dist/exports/server/rsc.js +3 -0
- package/dist/exports/server/rsc.js.map +1 -0
- package/dist/features/blocks/client/component/BlockContent.d.ts +1 -0
- package/dist/features/blocks/client/component/BlockContent.d.ts.map +1 -1
- package/dist/features/blocks/client/component/BlockContent.js +15 -15
- package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
- package/dist/features/blocks/client/component/index.d.ts.map +1 -1
- package/dist/features/blocks/client/component/index.js +68 -52
- package/dist/features/blocks/client/component/index.js.map +1 -1
- package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
- package/dist/features/blocks/client/componentInline/index.js +14 -19
- package/dist/features/blocks/client/componentInline/index.js.map +1 -1
- package/dist/features/blocks/client/index.d.ts.map +1 -1
- package/dist/features/blocks/client/index.js +26 -24
- package/dist/features/blocks/client/index.js.map +1 -1
- package/dist/features/blocks/client/plugin/index.d.ts.map +1 -1
- package/dist/features/blocks/client/plugin/index.js +83 -75
- package/dist/features/blocks/client/plugin/index.js.map +1 -1
- package/dist/features/blocks/server/index.d.ts.map +1 -1
- package/dist/features/blocks/server/index.js +20 -10
- package/dist/features/blocks/server/index.js.map +1 -1
- package/dist/features/blocks/server/validate.d.ts.map +1 -1
- package/dist/features/blocks/server/validate.js +8 -5
- package/dist/features/blocks/server/validate.js.map +1 -1
- package/dist/features/debug/testRecorder/client/plugin/index.js +25 -14
- package/dist/features/debug/testRecorder/client/plugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js +19 -7
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js +16 -3
- package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js +58 -19
- package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.d.ts.map +1 -1
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.js +38 -32
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +1 -1
- package/dist/features/experimental_table/server/index.d.ts.map +1 -1
- package/dist/features/experimental_table/server/index.js +3 -1
- package/dist/features/experimental_table/server/index.js.map +1 -1
- package/dist/features/format/bold/feature.client.d.ts.map +1 -1
- package/dist/features/format/bold/feature.client.js +2 -1
- package/dist/features/format/bold/feature.client.js.map +1 -1
- package/dist/features/format/inlineCode/feature.client.d.ts.map +1 -1
- package/dist/features/format/inlineCode/feature.client.js +2 -1
- package/dist/features/format/inlineCode/feature.client.js.map +1 -1
- package/dist/features/format/italic/feature.client.d.ts.map +1 -1
- package/dist/features/format/italic/feature.client.js +2 -1
- package/dist/features/format/italic/feature.client.js.map +1 -1
- package/dist/features/format/strikethrough/feature.client.d.ts.map +1 -1
- package/dist/features/format/strikethrough/feature.client.js +2 -1
- package/dist/features/format/strikethrough/feature.client.js.map +1 -1
- package/dist/features/format/subscript/feature.client.d.ts.map +1 -1
- package/dist/features/format/subscript/feature.client.js +2 -1
- package/dist/features/format/subscript/feature.client.js.map +1 -1
- package/dist/features/format/superscript/feature.client.d.ts.map +1 -1
- package/dist/features/format/superscript/feature.client.js +2 -1
- package/dist/features/format/superscript/feature.client.js.map +1 -1
- package/dist/features/format/underline/feature.client.d.ts.map +1 -1
- package/dist/features/format/underline/feature.client.js +2 -1
- package/dist/features/format/underline/feature.client.js.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +52 -15
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/index.js +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/index.js.map +1 -1
- package/dist/features/link/server/i18n.d.ts.map +1 -1
- package/dist/features/link/server/i18n.js +64 -32
- package/dist/features/link/server/i18n.js.map +1 -1
- package/dist/features/link/server/index.d.ts.map +1 -1
- package/dist/features/link/server/index.js +3 -1
- package/dist/features/link/server/index.js.map +1 -1
- package/dist/features/link/server/validate.d.ts.map +1 -1
- package/dist/features/link/server/validate.js +8 -5
- package/dist/features/link/server/validate.js.map +1 -1
- package/dist/features/relationship/client/components/RelationshipComponent.d.ts.map +1 -1
- package/dist/features/relationship/client/components/RelationshipComponent.js +6 -4
- package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
- package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
- package/dist/features/toolbars/fixed/client/Toolbar/index.js +77 -49
- package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
- package/dist/features/toolbars/inline/client/Toolbar/index.js +93 -52
- package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarButton/index.js +1 -1
- package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +2 -2
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/index.js +25 -22
- package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
- package/dist/features/toolbars/types.d.ts +3 -1
- package/dist/features/toolbars/types.d.ts.map +1 -1
- package/dist/features/toolbars/types.js.map +1 -1
- package/dist/features/typesServer.d.ts +4 -17
- package/dist/features/typesServer.d.ts.map +1 -1
- package/dist/features/typesServer.js.map +1 -1
- package/dist/features/upload/client/component/index.d.ts.map +1 -1
- package/dist/features/upload/client/component/index.js +8 -4
- package/dist/features/upload/client/component/index.js.map +1 -1
- package/dist/features/upload/server/feature.server.d.ts.map +1 -1
- package/dist/features/upload/server/feature.server.js +3 -1
- package/dist/features/upload/server/feature.server.js.map +1 -1
- package/dist/features/upload/server/validate.d.ts.map +1 -1
- package/dist/features/upload/server/validate.js +7 -4
- package/dist/features/upload/server/validate.js.map +1 -1
- package/dist/field/Field.d.ts.map +1 -1
- package/dist/field/Field.js +27 -41
- package/dist/field/Field.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/dist/field/index.d.ts.map +1 -1
- package/dist/field/index.js +26 -27
- package/dist/field/index.js.map +1 -1
- package/dist/field/rscEntry.d.ts +9 -0
- package/dist/field/rscEntry.d.ts.map +1 -0
- package/dist/field/rscEntry.js +37 -0
- package/dist/field/rscEntry.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -14
- package/dist/index.js.map +1 -1
- package/dist/lexical/LexicalProvider.d.ts +1 -1
- package/dist/lexical/LexicalProvider.d.ts.map +1 -1
- package/dist/lexical/LexicalProvider.js +2 -2
- package/dist/lexical/LexicalProvider.js.map +1 -1
- package/dist/lexical/config/client/EditorConfigProvider.d.ts +4 -3
- package/dist/lexical/config/client/EditorConfigProvider.d.ts.map +1 -1
- package/dist/lexical/config/client/EditorConfigProvider.js +5 -5
- package/dist/lexical/config/client/EditorConfigProvider.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts +4 -4
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +14 -5
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.d.ts +2 -2
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.d.ts.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js +5 -5
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts +3 -2
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/index.d.ts.map +1 -1
- package/dist/lexical/plugins/SlashMenu/index.js +15 -24
- package/dist/lexical/plugins/SlashMenu/index.js.map +1 -1
- package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +6 -4
- package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +6 -4
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
- package/dist/lexical/theme/EditorTheme.d.ts.map +1 -1
- package/dist/lexical/theme/EditorTheme.js +0 -2
- package/dist/lexical/theme/EditorTheme.js.map +1 -1
- package/dist/types.d.ts +15 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utilities/fieldsDrawer/Drawer.d.ts +1 -0
- package/dist/utilities/fieldsDrawer/Drawer.d.ts.map +1 -1
- package/dist/utilities/fieldsDrawer/Drawer.js +25 -20
- package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
- package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
- package/dist/utilities/fieldsDrawer/DrawerContent.js +99 -143
- package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
- package/dist/utilities/fieldsDrawer/useLexicalDrawer.js +1 -1
- package/dist/utilities/fieldsDrawer/useLexicalDrawer.js.map +1 -1
- package/dist/utilities/generateImportMap.d.ts.map +1 -1
- package/dist/utilities/generateImportMap.js +2 -3
- package/dist/utilities/generateImportMap.js.map +1 -1
- package/dist/utilities/generateSchemaMap.d.ts.map +1 -1
- package/dist/utilities/generateSchemaMap.js +13 -10
- package/dist/utilities/generateSchemaMap.js.map +1 -1
- package/dist/utilities/initLexicalFeatures.d.ts +18 -0
- package/dist/utilities/initLexicalFeatures.d.ts.map +1 -0
- package/dist/utilities/initLexicalFeatures.js +95 -0
- package/dist/utilities/initLexicalFeatures.js.map +1 -0
- package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.d.ts.map +1 -1
- package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js +5 -1
- package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js.map +1 -1
- package/dist/utilities/useLexicalFeature.d.ts.map +1 -1
- package/dist/utilities/useLexicalFeature.js +12 -4
- package/dist/utilities/useLexicalFeature.js.map +1 -1
- package/dist/validate/index.d.ts.map +1 -1
- package/dist/validate/index.js +1 -1
- package/dist/validate/index.js.map +1 -1
- package/package.json +43 -35
- package/dist/cell/index.d.ts +0 -9
- package/dist/cell/index.d.ts.map +0 -1
- package/dist/cell/index.js +0 -120
- package/dist/cell/index.js.map +0 -1
- package/dist/exports/client/Field-Y47DV2NP.js +0 -2
- package/dist/exports/client/Field-Y47DV2NP.js.map +0 -7
- package/dist/exports/client/RelationshipComponent-LBWKOBGF.js +0 -2
- package/dist/exports/client/RelationshipComponent-LBWKOBGF.js.map +0 -7
- package/dist/exports/client/chunk-7SR2HYD6.js +0 -2
- package/dist/exports/client/chunk-7SR2HYD6.js.map +0 -7
- package/dist/exports/client/chunk-GD6LBQBJ.js +0 -2
- package/dist/exports/client/chunk-GD6LBQBJ.js.map +0 -7
- package/dist/exports/client/chunk-IIWHHN4J.js +0 -2
- package/dist/exports/client/chunk-IIWHHN4J.js.map +0 -7
- package/dist/exports/client/component-4TP4L5EV.js +0 -2
- package/dist/exports/client/component-4TP4L5EV.js.map +0 -7
- package/dist/exports/client/component-XMR5NN36.js +0 -2
- package/dist/exports/client/component-XMR5NN36.js.map +0 -7
- package/dist/exports/client/componentInline-NUDJIIQ4.js +0 -2
- package/dist/exports/client/componentInline-NUDJIIQ4.js.map +0 -7
- package/dist/utilities/generateComponentMap.d.ts +0 -6
- package/dist/utilities/generateComponentMap.d.ts.map +0 -1
- package/dist/utilities/generateComponentMap.js +0 -93
- package/dist/utilities/generateComponentMap.js.map +0 -1
- /package/dist/exports/client/{chunk-NEO76RJK.js.map → chunk-352SHIZR.js.map} +0 -0
- /package/dist/exports/client/{chunk-XY4TCSM7.js.map → chunk-O4IOO4EU.js.map} +0 -0
- /package/dist/exports/client/{chunk-32KXGBIQ.js.map → chunk-ZOYGBIAN.js.map} +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { c as _c } from "react/compiler-runtime";
|
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
-
import { Drawer, useModal } from '@payloadcms/ui';
|
|
5
|
+
import { Drawer, EditDepthProvider, useModal } from '@payloadcms/ui';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import { DrawerContent } from './DrawerContent.js';
|
|
8
8
|
/**
|
|
@@ -11,7 +11,7 @@ import { DrawerContent } from './DrawerContent.js';
|
|
|
11
11
|
* be used if you provide your field schema inside the `generateSchemaMap` prop of your feature.server.ts.
|
|
12
12
|
*/
|
|
13
13
|
export const FieldsDrawer = t0 => {
|
|
14
|
-
const $ = _c(
|
|
14
|
+
const $ = _c(15);
|
|
15
15
|
const {
|
|
16
16
|
className,
|
|
17
17
|
data,
|
|
@@ -21,6 +21,7 @@ export const FieldsDrawer = t0 => {
|
|
|
21
21
|
fieldMapOverride,
|
|
22
22
|
handleDrawerSubmit,
|
|
23
23
|
schemaFieldsPathOverride,
|
|
24
|
+
schemaPath,
|
|
24
25
|
schemaPathSuffix
|
|
25
26
|
} = t0;
|
|
26
27
|
const {
|
|
@@ -43,18 +44,21 @@ export const FieldsDrawer = t0 => {
|
|
|
43
44
|
t2 = $[3];
|
|
44
45
|
}
|
|
45
46
|
let t3;
|
|
46
|
-
if ($[4] !== data || $[5] !== featureKey || $[6] !== fieldMapOverride || $[7] !== t2 || $[8] !== schemaFieldsPathOverride || $[9] !==
|
|
47
|
-
t3 = _jsx(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
47
|
+
if ($[4] !== data || $[5] !== featureKey || $[6] !== fieldMapOverride || $[7] !== t2 || $[8] !== schemaFieldsPathOverride || $[9] !== schemaPath || $[10] !== schemaPathSuffix || $[11] !== className || $[12] !== drawerSlug || $[13] !== t1) {
|
|
48
|
+
t3 = _jsx(EditDepthProvider, {
|
|
49
|
+
children: _jsx(Drawer, {
|
|
50
|
+
className,
|
|
51
|
+
slug: drawerSlug,
|
|
52
|
+
title: t1,
|
|
53
|
+
children: _jsx(DrawerContent, {
|
|
54
|
+
data,
|
|
55
|
+
featureKey,
|
|
56
|
+
fieldMapOverride,
|
|
57
|
+
handleDrawerSubmit: t2,
|
|
58
|
+
schemaFieldsPathOverride,
|
|
59
|
+
schemaPath,
|
|
60
|
+
schemaPathSuffix
|
|
61
|
+
})
|
|
58
62
|
})
|
|
59
63
|
});
|
|
60
64
|
$[4] = data;
|
|
@@ -62,13 +66,14 @@ export const FieldsDrawer = t0 => {
|
|
|
62
66
|
$[6] = fieldMapOverride;
|
|
63
67
|
$[7] = t2;
|
|
64
68
|
$[8] = schemaFieldsPathOverride;
|
|
65
|
-
$[9] =
|
|
66
|
-
$[10] =
|
|
67
|
-
$[11] =
|
|
68
|
-
$[12] =
|
|
69
|
-
$[13] =
|
|
69
|
+
$[9] = schemaPath;
|
|
70
|
+
$[10] = schemaPathSuffix;
|
|
71
|
+
$[11] = className;
|
|
72
|
+
$[12] = drawerSlug;
|
|
73
|
+
$[13] = t1;
|
|
74
|
+
$[14] = t3;
|
|
70
75
|
} else {
|
|
71
|
-
t3 = $[
|
|
76
|
+
t3 = $[14];
|
|
72
77
|
}
|
|
73
78
|
return t3;
|
|
74
79
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.js","names":["c","_c","Drawer","useModal","React","DrawerContent","FieldsDrawer","t0","$","className","data","drawerSlug","drawerTitle","featureKey","fieldMapOverride","handleDrawerSubmit","schemaFieldsPathOverride","schemaPathSuffix","closeModal","t1","t2","args","args2","setTimeout","t3","_jsx","
|
|
1
|
+
{"version":3,"file":"Drawer.js","names":["c","_c","Drawer","EditDepthProvider","useModal","React","DrawerContent","FieldsDrawer","t0","$","className","data","drawerSlug","drawerTitle","featureKey","fieldMapOverride","handleDrawerSubmit","schemaFieldsPathOverride","schemaPath","schemaPathSuffix","closeModal","t1","t2","args","args2","setTimeout","t3","_jsx","children","slug","title"],"sources":["../../../src/utilities/fieldsDrawer/Drawer.tsx"],"sourcesContent":["'use client'\nimport type { ClientField, Data, FormState, JsonObject } from 'payload'\n\nimport { Drawer, EditDepthProvider, useModal } from '@payloadcms/ui'\nimport React from 'react'\n\nimport { DrawerContent } from './DrawerContent.js'\n\nexport type FieldsDrawerProps = {\n readonly className?: string\n readonly data?: Data\n readonly drawerSlug: string\n readonly drawerTitle?: string\n readonly featureKey: string\n readonly fieldMapOverride?: ClientField[]\n readonly handleDrawerSubmit: (fields: FormState, data: JsonObject) => void\n readonly schemaFieldsPathOverride?: string\n readonly schemaPath: string\n readonly schemaPathSuffix?: string\n}\n\n/**\n * This FieldsDrawer component can be used to easily create a Drawer that contains a form with fields within your feature.\n * The fields are taken directly from the schema map based on your `featureKey` and `schemaPathSuffix`. Thus, this can only\n * be used if you provide your field schema inside the `generateSchemaMap` prop of your feature.server.ts.\n */\nexport const FieldsDrawer: React.FC<FieldsDrawerProps> = ({\n className,\n data,\n drawerSlug,\n drawerTitle,\n featureKey,\n fieldMapOverride,\n handleDrawerSubmit,\n schemaFieldsPathOverride,\n schemaPath,\n schemaPathSuffix,\n}) => {\n const { closeModal } = useModal()\n // The Drawer only renders its children (and itself) if it's open. Thus, by extracting the main content\n // to DrawerContent, this should be faster\n return (\n <EditDepthProvider>\n <Drawer className={className} slug={drawerSlug} title={drawerTitle ?? ''}>\n <DrawerContent\n data={data}\n featureKey={featureKey}\n fieldMapOverride={fieldMapOverride}\n handleDrawerSubmit={(args, args2) => {\n // Simply close drawer - no need for useLexicalDrawer here as at this point,\n // we don't need to restore the cursor position. This is handled by the useEffect in useLexicalDrawer.\n closeModal(drawerSlug)\n\n // Actual drawer submit logic needs to be triggered after the drawer is closed.\n // That's because the lexical selection / cursor restore logic that is striggerer by\n // `useLexicalDrawer` neeeds to be triggered before any editor.update calls that may happen\n // in the `handleDrawerSubmit` function.\n setTimeout(() => {\n handleDrawerSubmit(args, args2)\n }, 1)\n }}\n schemaFieldsPathOverride={schemaFieldsPathOverride}\n schemaPath={schemaPath}\n schemaPathSuffix={schemaPathSuffix}\n />\n </Drawer>\n </EditDepthProvider>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,MAAM,EAAEC,iBAAiB,EAAEC,QAAQ,QAAQ;AACpD,OAAOC,KAAA,MAAW;AAElB,SAASC,aAAa,QAAQ;AAe9B;;;;;AAKA,OAAO,MAAMC,YAAA,GAA4CC,EAAA;EAAA,MAAAC,CAAA,GAAAR,EAAA;EAAC;IAAAS,SAAA;IAAAC,IAAA;IAAAC,UAAA;IAAAC,WAAA;IAAAC,UAAA;IAAAC,gBAAA;IAAAC,kBAAA;IAAAC,wBAAA;IAAAC,UAAA;IAAAC;EAAA,IAAAX,EAWzD;EACC;IAAAY;EAAA,IAAuBhB,QAAA;EAKoC,MAAAiB,EAAA,GAAAR,WAAA,IAAe;EAAA,IAAAS,EAAA;EAAA,IAAAb,CAAA,QAAAW,UAAA,IAAAX,CAAA,QAAAG,UAAA,IAAAH,CAAA,QAAAO,kBAAA;IAK9CM,EAAA,GAAAA,CAAAC,IAAA,EAAAC,KAAA;MAGlBJ,UAAA,CAAWR,UAAA;MAMXa,UAAA;QACET,kBAAA,CAAmBO,IAAA,EAAMC,KAAA;MAAA,IACxB;IAAA;IACLf,CAAA,MAAAW,UAAA;IAAAX,CAAA,MAAAG,UAAA;IAAAH,CAAA,MAAAO,kBAAA;IAAAP,CAAA,MAAAa,EAAA;EAAA;IAAAA,EAAA,GAAAb,CAAA;EAAA;EAAA,IAAAiB,EAAA;EAAA,IAAAjB,CAAA,QAAAE,IAAA,IAAAF,CAAA,QAAAK,UAAA,IAAAL,CAAA,QAAAM,gBAAA,IAAAN,CAAA,QAAAa,EAAA,IAAAb,CAAA,QAAAQ,wBAAA,IAAAR,CAAA,QAAAS,UAAA,IAAAT,CAAA,SAAAU,gBAAA,IAAAV,CAAA,SAAAC,SAAA,IAAAD,CAAA,SAAAG,UAAA,IAAAH,CAAA,SAAAY,EAAA;IAlBNK,EAAA,GAAAC,IAAA,CAAAxB,iBAAA;MAAAyB,QAAA,EACED,IAAA,CAAAzB,MAAA;QAAAQ,SAAA;QAAAmB,IAAA,EAAoCjB,UAAA;QAAAkB,KAAA,EAAmBT,EAAe;QAAAO,QAAA,EACpED,IAAA,CAAArB,aAAA;UAAAK,IAAA;UAAAG,UAAA;UAAAC,gBAAA;UAAAC,kBAAA,EAIsBM,EAYpB;UAAAL,wBAAA;UAAAC,UAAA;UAAAC;QAAA,C;;;;;;;;;;;;;;;;;SAlBNO,E;CA0BJ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DrawerContent.d.ts","sourceRoot":"","sources":["../../../src/utilities/fieldsDrawer/DrawerContent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DrawerContent.d.ts","sourceRoot":"","sources":["../../../src/utilities/fieldsDrawer/DrawerContent.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAmD,MAAM,OAAO,CAAA;AAGvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAIpD,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,iBAAiB,EAAE,YAAY,GAAG,aAAa,CAAC,CAqIzF,CAAA"}
|
|
@@ -1,166 +1,122 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { c as _c } from "react/compiler-runtime";
|
|
4
3
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
-
import { Form, FormSubmit, RenderFields,
|
|
6
|
-
import {
|
|
7
|
-
import React, { useCallback, useEffect, useState } from 'react';
|
|
4
|
+
import { Form, FormSubmit, RenderFields, useDocumentInfo, useServerFunctions, useTranslation } from '@payloadcms/ui';
|
|
5
|
+
import { abortAndIgnore } from '@payloadcms/ui/shared';
|
|
6
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
8
7
|
import { v4 as uuid } from 'uuid';
|
|
9
8
|
import { useEditorConfigContext } from '../../lexical/config/client/EditorConfigProvider.js';
|
|
10
|
-
export const DrawerContent =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} = t0;
|
|
9
|
+
export const DrawerContent = ({
|
|
10
|
+
data,
|
|
11
|
+
featureKey,
|
|
12
|
+
fieldMapOverride,
|
|
13
|
+
handleDrawerSubmit,
|
|
14
|
+
schemaFieldsPathOverride,
|
|
15
|
+
schemaPath,
|
|
16
|
+
schemaPathSuffix
|
|
17
|
+
}) => {
|
|
20
18
|
const {
|
|
21
19
|
t
|
|
22
20
|
} = useTranslation();
|
|
23
21
|
const {
|
|
24
|
-
id
|
|
22
|
+
id,
|
|
23
|
+
collectionSlug,
|
|
24
|
+
docPermissions,
|
|
25
|
+
getDocPreferences,
|
|
26
|
+
globalSlug
|
|
25
27
|
} = useDocumentInfo();
|
|
26
|
-
const
|
|
27
|
-
schemaPath
|
|
28
|
-
} = useFieldProps();
|
|
29
|
-
const {
|
|
30
|
-
config
|
|
31
|
-
} = useConfig();
|
|
28
|
+
const onChangeAbortControllerRef = useRef(new AbortController());
|
|
32
29
|
const [initialState, setInitialState] = useState(false);
|
|
33
30
|
const {
|
|
34
|
-
|
|
31
|
+
fieldProps: {
|
|
32
|
+
featureClientSchemaMap,
|
|
33
|
+
permissions
|
|
34
|
+
}
|
|
35
35
|
} = useEditorConfigContext();
|
|
36
36
|
const {
|
|
37
|
-
|
|
38
|
-
} =
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
$[1] = richTextComponentMap;
|
|
46
|
-
$[2] = componentMapRenderedFieldsPath;
|
|
47
|
-
$[3] = t2;
|
|
48
|
-
} else {
|
|
49
|
-
t2 = $[3];
|
|
50
|
-
}
|
|
51
|
-
const fields = t2;
|
|
52
|
-
let t3;
|
|
53
|
-
let t4;
|
|
54
|
-
if ($[4] !== config.routes.api || $[5] !== config.serverURL || $[6] !== id || $[7] !== data || $[8] !== schemaFieldsPath) {
|
|
55
|
-
t3 = () => {
|
|
56
|
-
const awaitInitialState = async () => {
|
|
57
|
-
const {
|
|
58
|
-
state
|
|
59
|
-
} = await getFormState({
|
|
60
|
-
apiRoute: config.routes.api,
|
|
61
|
-
body: {
|
|
62
|
-
id,
|
|
63
|
-
data: data ?? {},
|
|
64
|
-
operation: "update",
|
|
65
|
-
schemaPath: schemaFieldsPath
|
|
66
|
-
},
|
|
67
|
-
serverURL: config.serverURL
|
|
68
|
-
});
|
|
69
|
-
setInitialState(state);
|
|
70
|
-
};
|
|
71
|
-
awaitInitialState();
|
|
72
|
-
};
|
|
73
|
-
t4 = [config.routes.api, config.serverURL, schemaFieldsPath, id, data];
|
|
74
|
-
$[4] = config.routes.api;
|
|
75
|
-
$[5] = config.serverURL;
|
|
76
|
-
$[6] = id;
|
|
77
|
-
$[7] = data;
|
|
78
|
-
$[8] = schemaFieldsPath;
|
|
79
|
-
$[9] = t3;
|
|
80
|
-
$[10] = t4;
|
|
81
|
-
} else {
|
|
82
|
-
t3 = $[9];
|
|
83
|
-
t4 = $[10];
|
|
84
|
-
}
|
|
85
|
-
useEffect(t3, t4);
|
|
86
|
-
let t5;
|
|
87
|
-
if ($[11] !== config.routes.api || $[12] !== config.serverURL || $[13] !== id || $[14] !== schemaFieldsPath) {
|
|
88
|
-
t5 = async t6 => {
|
|
37
|
+
getFormState
|
|
38
|
+
} = useServerFunctions();
|
|
39
|
+
const schemaFieldsPath = schemaFieldsPathOverride ?? `${schemaPath}.lexical_internal_feature.${featureKey}${schemaPathSuffix ? `.${schemaPathSuffix}` : ''}`;
|
|
40
|
+
const fields = fieldMapOverride ?? featureClientSchemaMap[featureKey]?.[schemaFieldsPath] // Field Schema
|
|
41
|
+
;
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
const controller = new AbortController();
|
|
44
|
+
const awaitInitialState = async () => {
|
|
89
45
|
const {
|
|
90
|
-
|
|
91
|
-
} = t6;
|
|
92
|
-
const {
|
|
93
|
-
state: state_0
|
|
46
|
+
state
|
|
94
47
|
} = await getFormState({
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
48
|
+
id,
|
|
49
|
+
collectionSlug,
|
|
50
|
+
data: data ?? {},
|
|
51
|
+
docPermissions,
|
|
52
|
+
docPreferences: await getDocPreferences(),
|
|
53
|
+
globalSlug,
|
|
54
|
+
operation: 'update',
|
|
55
|
+
renderAllFields: true,
|
|
56
|
+
schemaPath: schemaFieldsPath,
|
|
57
|
+
signal: controller.signal
|
|
103
58
|
});
|
|
104
|
-
|
|
59
|
+
setInitialState(state);
|
|
105
60
|
};
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
|
|
61
|
+
void awaitInitialState();
|
|
62
|
+
return () => {
|
|
63
|
+
abortAndIgnore(controller);
|
|
64
|
+
};
|
|
65
|
+
}, [schemaFieldsPath, id, data, getFormState, collectionSlug, globalSlug, docPermissions, getDocPreferences]);
|
|
66
|
+
const onChange = useCallback(async ({
|
|
67
|
+
formState: prevFormState
|
|
68
|
+
}) => {
|
|
69
|
+
abortAndIgnore(onChangeAbortControllerRef.current);
|
|
70
|
+
const controller_0 = new AbortController();
|
|
71
|
+
onChangeAbortControllerRef.current = controller_0;
|
|
72
|
+
const {
|
|
73
|
+
state: state_0
|
|
74
|
+
} = await getFormState({
|
|
75
|
+
id,
|
|
76
|
+
collectionSlug,
|
|
77
|
+
docPermissions,
|
|
78
|
+
docPreferences: await getDocPreferences(),
|
|
79
|
+
formState: prevFormState,
|
|
80
|
+
globalSlug,
|
|
81
|
+
operation: 'update',
|
|
82
|
+
schemaPath: schemaFieldsPath,
|
|
83
|
+
signal: controller_0.signal
|
|
84
|
+
});
|
|
85
|
+
if (!state_0) {
|
|
86
|
+
return prevFormState;
|
|
87
|
+
}
|
|
88
|
+
return state_0;
|
|
89
|
+
}, [getFormState, id, collectionSlug, docPermissions, getDocPreferences, globalSlug, schemaFieldsPath]);
|
|
90
|
+
// cleanup effect
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
return () => {
|
|
93
|
+
abortAndIgnore(onChangeAbortControllerRef.current);
|
|
94
|
+
};
|
|
95
|
+
}, []);
|
|
115
96
|
if (initialState === false) {
|
|
116
97
|
return null;
|
|
117
98
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
initialState,
|
|
141
|
-
onChange: [onChange],
|
|
142
|
-
onSubmit: handleDrawerSubmit,
|
|
143
|
-
uuid: uuid(),
|
|
144
|
-
children: [_jsx(RenderFields, {
|
|
145
|
-
fields: t8,
|
|
146
|
-
forceRender: true,
|
|
147
|
-
path: "",
|
|
148
|
-
readOnly: false,
|
|
149
|
-
schemaPath: schemaFieldsPath
|
|
150
|
-
}), _jsx(FormSubmit, {
|
|
151
|
-
children: t("fields:saveChanges")
|
|
152
|
-
})]
|
|
153
|
-
});
|
|
154
|
-
$[16] = onChange;
|
|
155
|
-
$[17] = fields;
|
|
156
|
-
$[18] = schemaFieldsPath;
|
|
157
|
-
$[19] = t;
|
|
158
|
-
$[20] = initialState;
|
|
159
|
-
$[21] = handleDrawerSubmit;
|
|
160
|
-
$[22] = t6;
|
|
161
|
-
} else {
|
|
162
|
-
t6 = $[22];
|
|
163
|
-
}
|
|
164
|
-
return t6;
|
|
99
|
+
return /*#__PURE__*/_jsxs(Form, {
|
|
100
|
+
beforeSubmit: [onChange],
|
|
101
|
+
disableValidationOnSubmit: true,
|
|
102
|
+
fields: Array.isArray(fields) ? fields : [],
|
|
103
|
+
initialState: initialState,
|
|
104
|
+
onChange: [onChange],
|
|
105
|
+
onSubmit: handleDrawerSubmit,
|
|
106
|
+
uuid: uuid(),
|
|
107
|
+
children: [/*#__PURE__*/_jsx(RenderFields, {
|
|
108
|
+
fields: Array.isArray(fields) ? fields : [],
|
|
109
|
+
forceRender: true,
|
|
110
|
+
parentIndexPath: "",
|
|
111
|
+
parentPath: "" // See Blocks feature path for details as for why this is empty
|
|
112
|
+
,
|
|
113
|
+
|
|
114
|
+
parentSchemaPath: schemaFieldsPath,
|
|
115
|
+
permissions: permissions,
|
|
116
|
+
readOnly: false
|
|
117
|
+
}), /*#__PURE__*/_jsx(FormSubmit, {
|
|
118
|
+
children: t('fields:saveChanges')
|
|
119
|
+
})]
|
|
120
|
+
});
|
|
165
121
|
};
|
|
166
122
|
//# sourceMappingURL=DrawerContent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DrawerContent.js","names":["
|
|
1
|
+
{"version":3,"file":"DrawerContent.js","names":["Form","FormSubmit","RenderFields","useDocumentInfo","useServerFunctions","useTranslation","abortAndIgnore","React","useCallback","useEffect","useRef","useState","v4","uuid","useEditorConfigContext","DrawerContent","data","featureKey","fieldMapOverride","handleDrawerSubmit","schemaFieldsPathOverride","schemaPath","schemaPathSuffix","t","id","collectionSlug","docPermissions","getDocPreferences","globalSlug","onChangeAbortControllerRef","AbortController","initialState","setInitialState","fieldProps","featureClientSchemaMap","permissions","getFormState","schemaFieldsPath","fields","controller","awaitInitialState","state","docPreferences","operation","renderAllFields","signal","onChange","formState","prevFormState","current","_jsxs","beforeSubmit","disableValidationOnSubmit","Array","isArray","onSubmit","_jsx","forceRender","parentIndexPath","parentPath","parentSchemaPath","readOnly"],"sources":["../../../src/utilities/fieldsDrawer/DrawerContent.tsx"],"sourcesContent":["'use client'\nimport type { FormState } from 'payload'\n\nimport {\n Form,\n FormSubmit,\n RenderFields,\n useDocumentInfo,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport React, { useCallback, useEffect, useRef, useState } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { FieldsDrawerProps } from './Drawer.js'\n\nimport { useEditorConfigContext } from '../../lexical/config/client/EditorConfigProvider.js'\n\nexport const DrawerContent: React.FC<Omit<FieldsDrawerProps, 'drawerSlug' | 'drawerTitle'>> = ({\n data,\n featureKey,\n fieldMapOverride,\n handleDrawerSubmit,\n schemaFieldsPathOverride,\n schemaPath,\n schemaPathSuffix,\n}) => {\n const { t } = useTranslation()\n const { id, collectionSlug, docPermissions, getDocPreferences, globalSlug } = useDocumentInfo()\n\n const onChangeAbortControllerRef = useRef(new AbortController())\n\n const [initialState, setInitialState] = useState<false | FormState | undefined>(false)\n\n const {\n fieldProps: { featureClientSchemaMap, permissions },\n } = useEditorConfigContext()\n\n const { getFormState } = useServerFunctions()\n\n const schemaFieldsPath =\n schemaFieldsPathOverride ??\n `${schemaPath}.lexical_internal_feature.${featureKey}${schemaPathSuffix ? `.${schemaPathSuffix}` : ''}`\n\n const fields: any = fieldMapOverride ?? featureClientSchemaMap[featureKey]?.[schemaFieldsPath] // Field Schema\n\n useEffect(() => {\n const controller = new AbortController()\n\n const awaitInitialState = async () => {\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: data ?? {},\n docPermissions,\n docPreferences: await getDocPreferences(),\n globalSlug,\n operation: 'update',\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n setInitialState(state)\n }\n\n void awaitInitialState()\n\n return () => {\n abortAndIgnore(controller)\n }\n }, [\n schemaFieldsPath,\n id,\n data,\n getFormState,\n collectionSlug,\n globalSlug,\n docPermissions,\n getDocPreferences,\n ])\n\n const onChange = useCallback(\n async ({ formState: prevFormState }) => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n\n const controller = new AbortController()\n onChangeAbortControllerRef.current = controller\n\n const { state } = await getFormState({\n id,\n collectionSlug,\n docPermissions,\n docPreferences: await getDocPreferences(),\n formState: prevFormState,\n globalSlug,\n operation: 'update',\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!state) {\n return prevFormState\n }\n\n return state\n },\n [\n getFormState,\n id,\n collectionSlug,\n docPermissions,\n getDocPreferences,\n globalSlug,\n schemaFieldsPath,\n ],\n )\n\n // cleanup effect\n useEffect(() => {\n return () => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [])\n\n if (initialState === false) {\n return null\n }\n\n return (\n <Form\n beforeSubmit={[onChange]}\n disableValidationOnSubmit\n fields={Array.isArray(fields) ? fields : []}\n initialState={initialState}\n onChange={[onChange]}\n onSubmit={handleDrawerSubmit}\n uuid={uuid()}\n >\n <RenderFields\n fields={Array.isArray(fields) ? fields : []}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={perm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A2BoB,OAAO;IACnD;EACF,GAAG,EAAE;EAEL,IAAIlB,YAAA,KAAiB,OAAO;IAC1B,OAAO;EACT;EAEA,oBACEmB,KAAA,CAAClD,IAAA;IACCmD,YAAA,EAAc,CAACL,QAAA,CAAS;IACxBM,yBAAyB;IACzBd,MAAA,EAAQe,KAAA,CAAMC,OAAO,CAAChB,MAAA,IAAUA,MAAA,GAAS,EAAE;IAC3CP,YAAA,EAAcA,YAAA;IACde,QAAA,EAAU,CAACA,QAAA,CAAS;IACpBS,QAAA,EAAUpC,kBAAA;IACVN,IAAA,EAAMA,IAAA;4BAEN2C,IAAA,CAACtD,YAAA;MACCoC,MAAA,EAAQe,KAAA,CAAMC,OAAO,CAAChB,MAAA,IAAUA,MAAA,GAAS,EAAE;MAC3CmB,WAAW;MACXC,eAAA,EAAgB;MAChBC,UAAA,EAAW,GAAG;MAAA;;MACdC,gBAAA,EAAkBvB,gBAAA;MAClBF,WAAA,EAAaA,WAAA;MACb0B,QAAA,EAAU;qBAEZL,IAAA,CAACvD,UAAA;gBAAYsB,CAAA,CAAE;;;AAGrB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLexicalDrawer.js","names":["c","_c","useLexicalComposerContext","useModal","$getPreviousSelection","$getSelection","$setSelection","useCallback","useEffect","useState","useLexicalDrawer","slug","restoreLate","$","editor","selectionState","setSelectionState","wasOpen","setWasOpen","closeModal","closeBaseModal","isModalOpen","isBaseModalOpen","modalState","toggleModal","toggleBaseModal","t0","read","selection","storeSelection","t1","update","clone","discrete","skipTransforms","restoreSelection","t2","closeDrawer","t3","toggleDrawer","t4","t5","thisModalState","isOpen","setTimeout","t6"],"sources":["../../../src/utilities/fieldsDrawer/useLexicalDrawer.tsx"],"sourcesContent":["'use client'\nimport type { BaseSelection } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useModal } from '@payloadcms/ui'\nimport { $getPreviousSelection, $getSelection, $setSelection } from 'lexical'\nimport { useCallback, useEffect, useState } from 'react'\n\n/**\n *\n * Wrapper around useModal that restores and saves selection state (cursor position) when opening and closing the drawer.\n * By default, the lexical cursor position may be lost when opening a drawer and clicking somewhere on that drawer.\n */\nexport const useLexicalDrawer = (slug: string, restoreLate?: boolean) => {\n const [editor] = useLexicalComposerContext()\n const [selectionState, setSelectionState] = useState<BaseSelection | null>(null)\n const [wasOpen, setWasOpen] = useState<boolean>(false)\n\n const {\n closeModal: closeBaseModal,\n isModalOpen: isBaseModalOpen,\n modalState,\n toggleModal: toggleBaseModal,\n } = useModal()\n\n const storeSelection = useCallback(() => {\n editor.read(() => {\n const selection = $getSelection() ?? $getPreviousSelection()\n setSelectionState(selection)\n })\n }, [editor])\n\n const restoreSelection = useCallback(() => {\n if (selectionState) {\n editor.update(\n () => {\n $setSelection(selectionState.clone())\n },\n { discrete: true, skipTransforms: true },\n )\n }\n }, [editor, selectionState])\n\n const closeDrawer = () => {\n //restoreSelection() // Should already be stored by the useEffect below\n closeBaseModal(slug)\n }\n\n const toggleDrawer = () => {\n if (!isBaseModalOpen(slug)) {\n storeSelection()\n } else {\n restoreSelection()\n }\n setWasOpen(true)\n toggleBaseModal(slug)\n }\n\n // We need to handle drawer closing via a useEffect, as toggleDrawer / closeDrawer will not be triggered if the drawer\n // is closed by clicking outside of the drawer. This useEffect will handle everything.\n useEffect(() => {\n if (!wasOpen) {\n return\n }\n\n const thisModalState = modalState[slug]\n // Exists in modalState (thus has opened at least once before) and is closed\n if (thisModalState && !thisModalState?.isOpen) {\n setWasOpen(false)\n\n if (restoreLate) {\n // restoreLate is used for upload extra field drawers. For some reason, the selection is not restored if we call restoreSelection immediately.\n setTimeout(() => {\n restoreSelection()\n },
|
|
1
|
+
{"version":3,"file":"useLexicalDrawer.js","names":["c","_c","useLexicalComposerContext","useModal","$getPreviousSelection","$getSelection","$setSelection","useCallback","useEffect","useState","useLexicalDrawer","slug","restoreLate","$","editor","selectionState","setSelectionState","wasOpen","setWasOpen","closeModal","closeBaseModal","isModalOpen","isBaseModalOpen","modalState","toggleModal","toggleBaseModal","t0","read","selection","storeSelection","t1","update","clone","discrete","skipTransforms","restoreSelection","t2","closeDrawer","t3","toggleDrawer","t4","t5","thisModalState","isOpen","setTimeout","t6"],"sources":["../../../src/utilities/fieldsDrawer/useLexicalDrawer.tsx"],"sourcesContent":["'use client'\nimport type { BaseSelection } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useModal } from '@payloadcms/ui'\nimport { $getPreviousSelection, $getSelection, $setSelection } from 'lexical'\nimport { useCallback, useEffect, useState } from 'react'\n\n/**\n *\n * Wrapper around useModal that restores and saves selection state (cursor position) when opening and closing the drawer.\n * By default, the lexical cursor position may be lost when opening a drawer and clicking somewhere on that drawer.\n */\nexport const useLexicalDrawer = (slug: string, restoreLate?: boolean) => {\n const [editor] = useLexicalComposerContext()\n const [selectionState, setSelectionState] = useState<BaseSelection | null>(null)\n const [wasOpen, setWasOpen] = useState<boolean>(false)\n\n const {\n closeModal: closeBaseModal,\n isModalOpen: isBaseModalOpen,\n modalState,\n toggleModal: toggleBaseModal,\n } = useModal()\n\n const storeSelection = useCallback(() => {\n editor.read(() => {\n const selection = $getSelection() ?? $getPreviousSelection()\n setSelectionState(selection)\n })\n }, [editor])\n\n const restoreSelection = useCallback(() => {\n if (selectionState) {\n editor.update(\n () => {\n $setSelection(selectionState.clone())\n },\n { discrete: true, skipTransforms: true },\n )\n }\n }, [editor, selectionState])\n\n const closeDrawer = () => {\n //restoreSelection() // Should already be stored by the useEffect below\n closeBaseModal(slug)\n }\n\n const toggleDrawer = () => {\n if (!isBaseModalOpen(slug)) {\n storeSelection()\n } else {\n restoreSelection()\n }\n setWasOpen(true)\n toggleBaseModal(slug)\n }\n\n // We need to handle drawer closing via a useEffect, as toggleDrawer / closeDrawer will not be triggered if the drawer\n // is closed by clicking outside of the drawer. This useEffect will handle everything.\n useEffect(() => {\n if (!wasOpen) {\n return\n }\n\n const thisModalState = modalState[slug]\n // Exists in modalState (thus has opened at least once before) and is closed\n if (thisModalState && !thisModalState?.isOpen) {\n setWasOpen(false)\n\n if (restoreLate) {\n // restoreLate is used for upload extra field drawers. For some reason, the selection is not restored if we call restoreSelection immediately.\n setTimeout(() => {\n restoreSelection()\n }, 0)\n } else {\n restoreSelection()\n }\n }\n }, [modalState, slug, restoreSelection, wasOpen, restoreLate])\n\n return {\n closeDrawer,\n toggleDrawer,\n }\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AAGA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,QAAQ,QAAQ;AACzB,SAASC,qBAAqB,EAAEC,aAAa,EAAEC,aAAa,QAAQ;AACpE,SAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ;AAEjD;;;;;AAKA,OAAO,MAAMC,gBAAA,GAAmBA,CAAAC,IAAA,EAAAC,WAAA;EAAA,MAAAC,CAAA,GAAAZ,EAAA;EAC9B,OAAAa,MAAA,IAAiBZ,yBAAA;EACjB,OAAAa,cAAA,EAAAC,iBAAA,IAA4CP,QAAA,KAA+B;EAC3E,OAAAQ,OAAA,EAAAC,UAAA,IAA8BT,QAAA,MAAkB;EAEhD;IAAAU,UAAA,EAAAC,cAAA;IAAAC,WAAA,EAAAC,eAAA;IAAAC,UAAA;IAAAC,WAAA,EAAAC;EAAA,IAKItB,QAAA;EAAA,IAAAuB,EAAA;EAAA,IAAAb,CAAA,QAAAC,MAAA;IAE+BY,EAAA,GAAAA,CAAA;MACjCZ,MAAA,CAAAa,IAAA;QACE,MAAAC,SAAA,GAAkBvB,aAAA,MAAmBD,qBAAA;QACrCY,iBAAA,CAAkBY,SAAA;MAAA,CACpB;IAAA;IACFf,CAAA,MAAAC,MAAA;IAAAD,CAAA,MAAAa,EAAA;EAAA;IAAAA,EAAA,GAAAb,CAAA;EAAA;EALA,MAAAgB,cAAA,GAAuBH,EAKZ;EAAA,IAAAI,EAAA;EAAA,I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ources":["../../src/utilities/generateImportMap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAI9C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AAE1E,eAAO,MAAM,oBAAoB,SACxB;IAAE,kBAAkB,EAAE,wBAAwB,CAAA;CAAE,KAAG,eAAe,CAAC,mBAAmB,
|
|
1
|
+
{"version":3,"file":"generateImportMap.d.ts","sourceRoot":"","sources":["../../src/utilities/generateImportMap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAI9C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AAE1E,eAAO,MAAM,oBAAoB,SACxB;IAAE,kBAAkB,EAAE,wBAAwB,CAAA;CAAE,KAAG,eAAe,CAAC,mBAAmB,CAkD5F,CAAA"}
|
|
@@ -6,9 +6,8 @@ export const getGenerateImportMap = args => ({
|
|
|
6
6
|
importMap,
|
|
7
7
|
imports
|
|
8
8
|
}) => {
|
|
9
|
-
addToImportMap('@payloadcms/richtext-lexical/
|
|
10
|
-
addToImportMap('@payloadcms/richtext-lexical/
|
|
11
|
-
addToImportMap('@payloadcms/richtext-lexical/generateComponentMap#getGenerateComponentMap');
|
|
9
|
+
addToImportMap('@payloadcms/richtext-lexical/rsc#RscEntryLexicalCell');
|
|
10
|
+
addToImportMap('@payloadcms/richtext-lexical/rsc#RscEntryLexicalField');
|
|
12
11
|
// iterate just through args.resolvedFeatureMap.values()
|
|
13
12
|
for (const resolvedFeature of args.resolvedFeatureMap.values()) {
|
|
14
13
|
if ('componentImports' in resolvedFeature) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateImportMap.js","names":["genImportMapIterateFields","getGenerateImportMap","args","addToImportMap","baseDir","config","importMap","imports","resolvedFeature","resolvedFeatureMap","values","componentImports","length","forEach","component","ClientComponent","ClientFeature","nodes","node","getSubFields","subFields","fields"],"sources":["../../src/utilities/generateImportMap.tsx"],"sourcesContent":["import type { RichTextAdapter } from 'payload'\n\nimport { genImportMapIterateFields } from 'payload'\n\nimport type { ResolvedServerFeatureMap } from '../features/typesServer.js'\n\nexport const getGenerateImportMap =\n (args: { resolvedFeatureMap: ResolvedServerFeatureMap }): RichTextAdapter['generateImportMap'] =>\n ({ addToImportMap, baseDir, config, importMap, imports }) => {\n addToImportMap('@payloadcms/richtext-lexical/
|
|
1
|
+
{"version":3,"file":"generateImportMap.js","names":["genImportMapIterateFields","getGenerateImportMap","args","addToImportMap","baseDir","config","importMap","imports","resolvedFeature","resolvedFeatureMap","values","componentImports","length","forEach","component","ClientComponent","ClientFeature","nodes","node","getSubFields","subFields","fields"],"sources":["../../src/utilities/generateImportMap.tsx"],"sourcesContent":["import type { RichTextAdapter } from 'payload'\n\nimport { genImportMapIterateFields } from 'payload'\n\nimport type { ResolvedServerFeatureMap } from '../features/typesServer.js'\n\nexport const getGenerateImportMap =\n (args: { resolvedFeatureMap: ResolvedServerFeatureMap }): RichTextAdapter['generateImportMap'] =>\n ({ addToImportMap, baseDir, config, importMap, imports }) => {\n addToImportMap('@payloadcms/richtext-lexical/rsc#RscEntryLexicalCell')\n addToImportMap('@payloadcms/richtext-lexical/rsc#RscEntryLexicalField')\n\n // iterate just through args.resolvedFeatureMap.values()\n for (const resolvedFeature of args.resolvedFeatureMap.values()) {\n if ('componentImports' in resolvedFeature) {\n if (typeof resolvedFeature.componentImports === 'function') {\n resolvedFeature.componentImports({\n addToImportMap,\n baseDir,\n config,\n importMap,\n imports,\n })\n } else if (resolvedFeature.componentImports?.length) {\n resolvedFeature.componentImports.forEach((component) => {\n addToImportMap(component)\n })\n }\n }\n\n const ClientComponent = resolvedFeature.ClientFeature\n if (ClientComponent) {\n addToImportMap(ClientComponent)\n }\n\n /*\n Now run for all possible sub-fields\n */\n if (resolvedFeature.nodes?.length) {\n for (const node of resolvedFeature.nodes) {\n if (typeof node?.getSubFields !== 'function') {\n continue\n }\n const subFields = node.getSubFields({})\n if (subFields?.length) {\n genImportMapIterateFields({\n addToImportMap,\n baseDir,\n config,\n fields: subFields,\n importMap,\n imports,\n })\n }\n }\n }\n }\n }\n"],"mappings":"AAEA,SAASA,yBAAyB,QAAQ;AAI1C,OAAO,MAAMC,oBAAA,GACVC,IAAA,IACD,CAAC;EAAEC,cAAc;EAAEC,OAAO;EAAEC,MAAM;EAAEC,SAAS;EAAEC;AAAO,CAAE;EACtDJ,cAAA,CAAe;EACfA,cAAA,CAAe;EAEf;EACA,KAAK,MAAMK,eAAA,IAAmBN,IAAA,CAAKO,kBAAkB,CAACC,MAAM,IAAI;IAC9D,IAAI,sBAAsBF,eAAA,EAAiB;MACzC,IAAI,OAAOA,eAAA,CAAgBG,gBAAgB,KAAK,YAAY;QAC1DH,eAAA,CAAgBG,gBAAgB,CAAC;UAC/BR,cAAA;UACAC,OAAA;UACAC,MAAA;UACAC,SAAA;UACAC;QACF;MACF,OAAO,IAAIC,eAAA,CAAgBG,gBAAgB,EAAEC,MAAA,EAAQ;QACnDJ,eAAA,CAAgBG,gBAAgB,CAACE,OAAO,CAAEC,SAAA;UACxCX,cAAA,CAAeW,SAAA;QACjB;MACF;IACF;IAEA,MAAMC,eAAA,GAAkBP,eAAA,CAAgBQ,aAAa;IACrD,IAAID,eAAA,EAAiB;MACnBZ,cAAA,CAAeY,eAAA;IACjB;IAEA;;;IAGA,IAAIP,eAAA,CAAgBS,KAAK,EAAEL,MAAA,EAAQ;MACjC,KAAK,MAAMM,IAAA,IAAQV,eAAA,CAAgBS,KAAK,EAAE;QACxC,IAAI,OAAOC,IAAA,EAAMC,YAAA,KAAiB,YAAY;UAC5C;QACF;QACA,MAAMC,SAAA,GAAYF,IAAA,CAAKC,YAAY,CAAC,CAAC;QACrC,IAAIC,SAAA,EAAWR,MAAA,EAAQ;UACrBZ,yBAAA,CAA0B;YACxBG,cAAA;YACAC,OAAA;YACAC,MAAA;YACAgB,MAAA,EAAQD,SAAA;YACRd,SAAA;YACAC;UACF;QACF;MACF;IACF;EACF;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateSchemaMap.d.ts","sourceRoot":"","sources":["../../src/utilities/generateSchemaMap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAI9C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AAE1E,eAAO,MAAM,oBAAoB,SACxB;IAAE,kBAAkB,EAAE,wBAAwB,CAAA;CAAE,KAAG,eAAe,CAAC,mBAAmB,
|
|
1
|
+
{"version":3,"file":"generateSchemaMap.d.ts","sourceRoot":"","sources":["../../src/utilities/generateSchemaMap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAI9C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AAE1E,eAAO,MAAM,oBAAoB,SACxB;IAAE,kBAAkB,EAAE,wBAAwB,CAAA;CAAE,KAAG,eAAe,CAAC,mBAAmB,CAsC5F,CAAA"}
|
|
@@ -19,16 +19,19 @@ export const getGenerateSchemaMap = args => ({
|
|
|
19
19
|
schemaPath
|
|
20
20
|
});
|
|
21
21
|
if (schemas) {
|
|
22
|
-
for (const [schemaKey,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
for (const [schemaKey, field] of schemas.entries()) {
|
|
23
|
+
if ('fields' in field) {
|
|
24
|
+
// generate schema map entries for sub-fields using traverseFields
|
|
25
|
+
traverseFields({
|
|
26
|
+
config,
|
|
27
|
+
fields: field.fields,
|
|
28
|
+
i18n,
|
|
29
|
+
parentIndexPath: '',
|
|
30
|
+
parentSchemaPath: `${schemaPath}.lexical_internal_feature.${featureKey}.${schemaKey}`,
|
|
31
|
+
schemaMap
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
schemaMap.set(`${schemaPath}.lexical_internal_feature.${featureKey}.${schemaKey}`, field);
|
|
32
35
|
}
|
|
33
36
|
}
|
|
34
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateSchemaMap.js","names":["traverseFields","getGenerateSchemaMap","args","config","field","i18n","schemaMap","schemaPath","featureKey","resolvedFeature","resolvedFeatureMap","entries","generateSchemaMap","schemas","props","sanitizedServerFeatureProps","schemaKey","fields","set"],"sources":["../../src/utilities/generateSchemaMap.ts"],"sourcesContent":["import type { RichTextAdapter } from 'payload'\n\nimport { traverseFields } from '@payloadcms/ui/utilities/buildFieldSchemaMap/traverseFields'\n\nimport type { ResolvedServerFeatureMap } from '../features/typesServer.js'\n\nexport const getGenerateSchemaMap =\n (args: { resolvedFeatureMap: ResolvedServerFeatureMap }): RichTextAdapter['generateSchemaMap'] =>\n ({ config, field, i18n, schemaMap, schemaPath }) => {\n for (const [featureKey, resolvedFeature] of args.resolvedFeatureMap.entries()) {\n if (\n !('generateSchemaMap' in resolvedFeature) ||\n typeof resolvedFeature.generateSchemaMap !== 'function'\n ) {\n continue\n }\n const schemas = resolvedFeature.generateSchemaMap({\n config,\n field,\n i18n,\n props: resolvedFeature.sanitizedServerFeatureProps,\n schemaMap,\n schemaPath,\n })\n\n if (schemas) {\n for (const [schemaKey,
|
|
1
|
+
{"version":3,"file":"generateSchemaMap.js","names":["traverseFields","getGenerateSchemaMap","args","config","field","i18n","schemaMap","schemaPath","featureKey","resolvedFeature","resolvedFeatureMap","entries","generateSchemaMap","schemas","props","sanitizedServerFeatureProps","schemaKey","fields","parentIndexPath","parentSchemaPath","set"],"sources":["../../src/utilities/generateSchemaMap.ts"],"sourcesContent":["import type { RichTextAdapter } from 'payload'\n\nimport { traverseFields } from '@payloadcms/ui/utilities/buildFieldSchemaMap/traverseFields'\n\nimport type { ResolvedServerFeatureMap } from '../features/typesServer.js'\n\nexport const getGenerateSchemaMap =\n (args: { resolvedFeatureMap: ResolvedServerFeatureMap }): RichTextAdapter['generateSchemaMap'] =>\n ({ config, field, i18n, schemaMap, schemaPath }) => {\n for (const [featureKey, resolvedFeature] of args.resolvedFeatureMap.entries()) {\n if (\n !('generateSchemaMap' in resolvedFeature) ||\n typeof resolvedFeature.generateSchemaMap !== 'function'\n ) {\n continue\n }\n const schemas = resolvedFeature.generateSchemaMap({\n config,\n field,\n i18n,\n props: resolvedFeature.sanitizedServerFeatureProps,\n schemaMap,\n schemaPath,\n })\n\n if (schemas) {\n for (const [schemaKey, field] of schemas.entries()) {\n if ('fields' in field) {\n // generate schema map entries for sub-fields using traverseFields\n traverseFields({\n config,\n fields: field.fields,\n i18n,\n parentIndexPath: '',\n parentSchemaPath: `${schemaPath}.lexical_internal_feature.${featureKey}.${schemaKey}`,\n schemaMap,\n })\n }\n\n schemaMap.set(`${schemaPath}.lexical_internal_feature.${featureKey}.${schemaKey}`, field)\n }\n }\n }\n\n return schemaMap\n }\n"],"mappings":"AAEA,SAASA,cAAc,QAAQ;AAI/B,OAAO,MAAMC,oBAAA,GACVC,IAAA,IACD,CAAC;EAAEC,MAAM;EAAEC,KAAK;EAAEC,IAAI;EAAEC,SAAS;EAAEC;AAAU,CAAE;EAC7C,KAAK,MAAM,CAACC,UAAA,EAAYC,eAAA,CAAgB,IAAIP,IAAA,CAAKQ,kBAAkB,CAACC,OAAO,IAAI;IAC7E,IACE,EAAE,uBAAuBF,eAAc,KACvC,OAAOA,eAAA,CAAgBG,iBAAiB,KAAK,YAC7C;MACA;IACF;IACA,MAAMC,OAAA,GAAUJ,eAAA,CAAgBG,iBAAiB,CAAC;MAChDT,MAAA;MACAC,KAAA;MACAC,IAAA;MACAS,KAAA,EAAOL,eAAA,CAAgBM,2BAA2B;MAClDT,SAAA;MACAC;IACF;IAEA,IAAIM,OAAA,EAAS;MACX,KAAK,MAAM,CAACG,SAAA,EAAWZ,KAAA,CAAM,IAAIS,OAAA,CAAQF,OAAO,IAAI;QAClD,IAAI,YAAYP,KAAA,EAAO;UACrB;UACAJ,cAAA,CAAe;YACbG,MAAA;YACAc,MAAA,EAAQb,KAAA,CAAMa,MAAM;YACpBZ,IAAA;YACAa,eAAA,EAAiB;YACjBC,gBAAA,EAAkB,GAAGZ,UAAA,6BAAuCC,UAAA,IAAcQ,SAAA,EAAW;YACrFV;UACF;QACF;QAEAA,SAAA,CAAUc,GAAG,CAAC,GAAGb,UAAA,6BAAuCC,UAAA,IAAcQ,SAAA,EAAW,EAAEZ,KAAA;MACrF;IACF;EACF;EAEA,OAAOE,SAAA;AACT","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { I18nClient } from '@payloadcms/translations';
|
|
2
|
+
import { type FieldSchemaMap, type Payload } from 'payload';
|
|
3
|
+
import type { SanitizedServerEditorConfig } from '../lexical/config/types.js';
|
|
4
|
+
import type { FeatureClientSchemaMap, LexicalRichTextFieldProps } from '../types.js';
|
|
5
|
+
type Args = {
|
|
6
|
+
fieldSchemaMap: FieldSchemaMap;
|
|
7
|
+
i18n: I18nClient;
|
|
8
|
+
path: string;
|
|
9
|
+
payload: Payload;
|
|
10
|
+
sanitizedEditorConfig: SanitizedServerEditorConfig;
|
|
11
|
+
schemaPath: string;
|
|
12
|
+
};
|
|
13
|
+
export declare function initLexicalFeatures(args: Args): {
|
|
14
|
+
clientFeatures: LexicalRichTextFieldProps['clientFeatures'];
|
|
15
|
+
featureClientSchemaMap: FeatureClientSchemaMap;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=initLexicalFeatures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initLexicalFeatures.d.ts","sourceRoot":"","sources":["../../src/utilities/initLexicalFeatures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAG1D,OAAO,EAIL,KAAK,cAAc,EACnB,KAAK,OAAO,EACb,MAAM,SAAS,CAAA;AAGhB,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA;AAC7E,OAAO,KAAK,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AACpF,KAAK,IAAI,GAAG;IACV,cAAc,EAAE,cAAc,CAAA;IAC9B,IAAI,EAAE,UAAU,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,OAAO,CAAA;IAChB,qBAAqB,EAAE,2BAA2B,CAAA;IAClD,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,IAAI,GAAG;IAC/C,cAAc,EAAE,yBAAyB,CAAC,gBAAgB,CAAC,CAAA;IAC3D,sBAAsB,EAAE,sBAAsB,CAAA;CAC/C,CA2HA"}
|