@payloadcms/richtext-lexical 3.73.0 → 3.74.0-internal.097fb57

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.
Files changed (87) hide show
  1. package/dist/exports/client/Field-OX545XLB.js +2 -0
  2. package/dist/exports/client/Field-OX545XLB.js.map +7 -0
  3. package/dist/exports/client/bundled.css +1 -1
  4. package/dist/exports/client/chunk-3KBZSLPR.js +12 -0
  5. package/dist/exports/client/chunk-3KBZSLPR.js.map +7 -0
  6. package/dist/exports/client/index.d.ts +1 -0
  7. package/dist/exports/client/index.d.ts.map +1 -1
  8. package/dist/exports/client/index.js +20 -20
  9. package/dist/exports/client/index.js.map +3 -3
  10. package/dist/exports/client/internal-client.d.ts +3 -0
  11. package/dist/exports/client/internal-client.d.ts.map +1 -0
  12. package/dist/exports/react/index.d.ts +1 -1
  13. package/dist/exports/react/index.d.ts.map +1 -1
  14. package/dist/exports/react/index.js.map +1 -1
  15. package/dist/features/converters/lexicalToJSX/Component/index.d.ts +2 -14
  16. package/dist/features/converters/lexicalToJSX/Component/index.d.ts.map +1 -1
  17. package/dist/features/converters/lexicalToJSX/Component/index.js +4 -2
  18. package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
  19. package/dist/features/converters/lexicalToJSX/converter/index.d.ts +16 -1
  20. package/dist/features/converters/lexicalToJSX/converter/index.d.ts.map +1 -1
  21. package/dist/features/converters/lexicalToJSX/converter/index.js +76 -4
  22. package/dist/features/converters/lexicalToJSX/converter/index.js.map +1 -1
  23. package/dist/features/converters/lexicalToJSX/converter/types.d.ts +14 -10
  24. package/dist/features/converters/lexicalToJSX/converter/types.d.ts.map +1 -1
  25. package/dist/features/converters/lexicalToJSX/converter/types.js.map +1 -1
  26. package/dist/features/debug/jsxConverter/client/plugin/index.js +1 -1
  27. package/dist/features/debug/jsxConverter/client/plugin/index.js.map +1 -1
  28. package/dist/field/Field.d.ts.map +1 -1
  29. package/dist/field/Field.js +11 -6
  30. package/dist/field/Field.js.map +1 -1
  31. package/dist/field/RichTextViewProvider.d.ts +83 -0
  32. package/dist/field/RichTextViewProvider.d.ts.map +1 -0
  33. package/dist/field/RichTextViewProvider.js +87 -0
  34. package/dist/field/RichTextViewProvider.js.map +1 -0
  35. package/dist/field/ViewSelector.d.ts +4 -0
  36. package/dist/field/ViewSelector.d.ts.map +1 -0
  37. package/dist/field/ViewSelector.js +89 -0
  38. package/dist/field/ViewSelector.js.map +1 -0
  39. package/dist/field/bundled.css +1 -1
  40. package/dist/field/index.d.ts +1 -0
  41. package/dist/field/index.d.ts.map +1 -1
  42. package/dist/field/index.js +47 -29
  43. package/dist/field/index.js.map +1 -1
  44. package/dist/field/rscEntry.d.ts +1 -1
  45. package/dist/field/rscEntry.d.ts.map +1 -1
  46. package/dist/field/rscEntry.js +12 -0
  47. package/dist/field/rscEntry.js.map +1 -1
  48. package/dist/index.d.ts +1 -1
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +3 -1
  51. package/dist/index.js.map +1 -1
  52. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  53. package/dist/lexical/LexicalEditor.js +2 -1
  54. package/dist/lexical/LexicalEditor.js.map +1 -1
  55. package/dist/lexical/LexicalProvider.d.ts.map +1 -1
  56. package/dist/lexical/LexicalProvider.js +12 -3
  57. package/dist/lexical/LexicalProvider.js.map +1 -1
  58. package/dist/lexical/config/client/sanitize.d.ts +1 -1
  59. package/dist/lexical/config/client/sanitize.d.ts.map +1 -1
  60. package/dist/lexical/config/client/sanitize.js +3 -2
  61. package/dist/lexical/config/client/sanitize.js.map +1 -1
  62. package/dist/lexical/config/types.d.ts +4 -0
  63. package/dist/lexical/config/types.d.ts.map +1 -1
  64. package/dist/lexical/config/types.js.map +1 -1
  65. package/dist/lexical/nodes/index.d.ts +12 -2
  66. package/dist/lexical/nodes/index.d.ts.map +1 -1
  67. package/dist/lexical/nodes/index.js +195 -2
  68. package/dist/lexical/nodes/index.js.map +1 -1
  69. package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts +2 -0
  70. package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts.map +1 -0
  71. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js +48 -0
  72. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js.map +1 -0
  73. package/dist/types.d.ts +152 -2
  74. package/dist/types.d.ts.map +1 -1
  75. package/dist/types.js.map +1 -1
  76. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  77. package/dist/utilities/generateImportMap.js +1 -0
  78. package/dist/utilities/generateImportMap.js.map +1 -1
  79. package/dist/validate/hasText.d.ts +6 -1
  80. package/dist/validate/hasText.d.ts.map +1 -1
  81. package/dist/validate/hasText.js +10 -4
  82. package/dist/validate/hasText.js.map +1 -1
  83. package/package.json +11 -6
  84. package/dist/exports/client/Field-HJGV32KA.js +0 -2
  85. package/dist/exports/client/Field-HJGV32KA.js.map +0 -7
  86. package/dist/exports/client/chunk-EZX4YW7S.js +0 -12
  87. package/dist/exports/client/chunk-EZX4YW7S.js.map +0 -7
@@ -0,0 +1,83 @@
1
+ import React from 'react';
2
+ import type { LexicalEditorNodeMap, LexicalEditorViewMap } from '../types.js';
3
+ /**
4
+ * Context type for rich text view management.
5
+ */
6
+ type RichTextViewContextType = {
7
+ /**
8
+ * The name of the currently active view (e.g., 'default', 'frontend', 'debug')
9
+ */
10
+ currentView: string;
11
+ /**
12
+ * The node map for the currently active view, containing rendering overrides for each node type.
13
+ * This is the resolved view from the views map based on currentView.
14
+ */
15
+ currentViewMap?: LexicalEditorNodeMap;
16
+ /**
17
+ * If true, the current view will be inherited by nested richtext editors.
18
+ */
19
+ inheritable?: boolean;
20
+ /**
21
+ * Function to change the current view.
22
+ */
23
+ setCurrentView: (view: string) => void;
24
+ /**
25
+ * The complete map of all available views for this field.
26
+ */
27
+ views?: LexicalEditorViewMap;
28
+ };
29
+ /**
30
+ * Provider component for rich text view context.
31
+ *
32
+ * This provider manages the current view state internally and makes it accessible to child components
33
+ * via the useRichTextView hook. It automatically resolves the current view's node map
34
+ * based on the active view name.
35
+ *
36
+ * @example
37
+ * ```tsx
38
+ * <RichTextViewProvider
39
+ * currentView="frontend"
40
+ * views={myViews}
41
+ * >
42
+ * <MyEditor />
43
+ * </RichTextViewProvider>
44
+ * ```
45
+ */
46
+ export declare const RichTextViewProvider: React.FC<{
47
+ children: React.ReactNode;
48
+ currentView?: string;
49
+ inheritable?: boolean;
50
+ views?: LexicalEditorViewMap;
51
+ }>;
52
+ /**
53
+ * Hook to access the current rich text view context.
54
+ *
55
+ * Use this hook to access the currently active view and its node map,
56
+ * or to programmatically switch between views.
57
+ *
58
+ * @returns An object containing:
59
+ * - `currentView`: The name of the active view
60
+ * - `currentViewMap`: The node overrides for the current view
61
+ * - `setCurrentView`: Function to change views
62
+ * - `views`: All available views
63
+ *
64
+ * @example
65
+ * ```tsx
66
+ * function MyComponent() {
67
+ * const { currentView, currentViewMap, setCurrentView } = useRichTextView()
68
+ *
69
+ * return (
70
+ * <div>
71
+ * <p>Current view: {currentView}</p>
72
+ * {currentViewMap?.heading && <p>Heading overrides are active</p>}
73
+ * <button onClick={() => setCurrentView('frontend')}>
74
+ * Switch to frontend view
75
+ * </button>
76
+ * </div>
77
+ * )
78
+ * }
79
+ * ```
80
+ */
81
+ export declare function useRichTextView(): RichTextViewContextType;
82
+ export {};
83
+ //# sourceMappingURL=RichTextViewProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RichTextViewProvider.d.ts","sourceRoot":"","sources":["../../src/field/RichTextViewProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAA;AAE1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAE7E;;GAEG;AACH,KAAK,uBAAuB,GAAG;IAC7B;;OAEG;IACH,WAAW,EAAE,MAAM,CAAA;IACnB;;;OAGG;IACH,cAAc,CAAC,EAAE,oBAAoB,CAAA;IACrC;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;OAEG;IACH,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACtC;;OAEG;IACH,KAAK,CAAC,EAAE,oBAAoB,CAAA;CAC7B,CAAA;AAQD;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC;IAC1C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,KAAK,CAAC,EAAE,oBAAoB,CAAA;CAC7B,CA6BA,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,eAAe,IAAI,uBAAuB,CAEzD"}
@@ -0,0 +1,87 @@
1
+ 'use client';
2
+
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ import { useControllableState } from '@payloadcms/ui';
5
+ import React, { createContext, use, useMemo } from 'react';
6
+ const RichTextViewContext = /*#__PURE__*/createContext({
7
+ currentView: 'default',
8
+ inheritable: false,
9
+ setCurrentView: () => {}
10
+ });
11
+ /**
12
+ * Provider component for rich text view context.
13
+ *
14
+ * This provider manages the current view state internally and makes it accessible to child components
15
+ * via the useRichTextView hook. It automatically resolves the current view's node map
16
+ * based on the active view name.
17
+ *
18
+ * @example
19
+ * ```tsx
20
+ * <RichTextViewProvider
21
+ * currentView="frontend"
22
+ * views={myViews}
23
+ * >
24
+ * <MyEditor />
25
+ * </RichTextViewProvider>
26
+ * ```
27
+ */
28
+ export const RichTextViewProvider = args => {
29
+ const parentContext = useRichTextView();
30
+ const {
31
+ children,
32
+ currentView: currentViewFromProps,
33
+ inheritable,
34
+ views
35
+ } = parentContext.inheritable ? {
36
+ ...parentContext,
37
+ ...args
38
+ } : args;
39
+ const [currentView, setCurrentView] = useControllableState(currentViewFromProps, 'default');
40
+ const value = useMemo(() => {
41
+ const currentViewMap = views ? views[currentView] || views.default : undefined;
42
+ return {
43
+ currentView,
44
+ currentViewMap,
45
+ inheritable,
46
+ setCurrentView,
47
+ views
48
+ };
49
+ }, [currentView, inheritable, setCurrentView, views]);
50
+ return /*#__PURE__*/_jsx(RichTextViewContext, {
51
+ value: value,
52
+ children: children
53
+ });
54
+ };
55
+ /**
56
+ * Hook to access the current rich text view context.
57
+ *
58
+ * Use this hook to access the currently active view and its node map,
59
+ * or to programmatically switch between views.
60
+ *
61
+ * @returns An object containing:
62
+ * - `currentView`: The name of the active view
63
+ * - `currentViewMap`: The node overrides for the current view
64
+ * - `setCurrentView`: Function to change views
65
+ * - `views`: All available views
66
+ *
67
+ * @example
68
+ * ```tsx
69
+ * function MyComponent() {
70
+ * const { currentView, currentViewMap, setCurrentView } = useRichTextView()
71
+ *
72
+ * return (
73
+ * <div>
74
+ * <p>Current view: {currentView}</p>
75
+ * {currentViewMap?.heading && <p>Heading overrides are active</p>}
76
+ * <button onClick={() => setCurrentView('frontend')}>
77
+ * Switch to frontend view
78
+ * </button>
79
+ * </div>
80
+ * )
81
+ * }
82
+ * ```
83
+ */
84
+ export function useRichTextView() {
85
+ return use(RichTextViewContext);
86
+ }
87
+ //# sourceMappingURL=RichTextViewProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RichTextViewProvider.js","names":["useControllableState","React","createContext","use","useMemo","RichTextViewContext","currentView","inheritable","setCurrentView","RichTextViewProvider","args","parentContext","useRichTextView","children","currentViewFromProps","views","value","currentViewMap","default","undefined","_jsx"],"sources":["../../src/field/RichTextViewProvider.tsx"],"sourcesContent":["'use client'\nimport { useControllableState } from '@payloadcms/ui'\nimport React, { createContext, use, useMemo } from 'react'\n\nimport type { LexicalEditorNodeMap, LexicalEditorViewMap } from '../types.js'\n\n/**\n * Context type for rich text view management.\n */\ntype RichTextViewContextType = {\n /**\n * The name of the currently active view (e.g., 'default', 'frontend', 'debug')\n */\n currentView: string\n /**\n * The node map for the currently active view, containing rendering overrides for each node type.\n * This is the resolved view from the views map based on currentView.\n */\n currentViewMap?: LexicalEditorNodeMap\n /**\n * If true, the current view will be inherited by nested richtext editors.\n */\n inheritable?: boolean\n /**\n * Function to change the current view.\n */\n setCurrentView: (view: string) => void\n /**\n * The complete map of all available views for this field.\n */\n views?: LexicalEditorViewMap\n}\n\nconst RichTextViewContext = createContext<RichTextViewContextType>({\n currentView: 'default',\n inheritable: false,\n setCurrentView: () => {},\n})\n\n/**\n * Provider component for rich text view context.\n *\n * This provider manages the current view state internally and makes it accessible to child components\n * via the useRichTextView hook. It automatically resolves the current view's node map\n * based on the active view name.\n *\n * @example\n * ```tsx\n * <RichTextViewProvider\n * currentView=\"frontend\"\n * views={myViews}\n * >\n * <MyEditor />\n * </RichTextViewProvider>\n * ```\n */\nexport const RichTextViewProvider: React.FC<{\n children: React.ReactNode\n currentView?: string\n inheritable?: boolean\n views?: LexicalEditorViewMap\n}> = (args) => {\n const parentContext = useRichTextView()\n\n const {\n children,\n currentView: currentViewFromProps,\n inheritable,\n views,\n } = parentContext.inheritable\n ? {\n ...parentContext,\n ...args,\n }\n : args\n\n const [currentView, setCurrentView] = useControllableState(currentViewFromProps, 'default')\n\n const value = useMemo(() => {\n const currentViewMap = views ? views[currentView] || views.default : undefined\n return {\n currentView,\n currentViewMap,\n inheritable,\n setCurrentView,\n views,\n }\n }, [currentView, inheritable, setCurrentView, views])\n\n return <RichTextViewContext value={value}>{children}</RichTextViewContext>\n}\n\n/**\n * Hook to access the current rich text view context.\n *\n * Use this hook to access the currently active view and its node map,\n * or to programmatically switch between views.\n *\n * @returns An object containing:\n * - `currentView`: The name of the active view\n * - `currentViewMap`: The node overrides for the current view\n * - `setCurrentView`: Function to change views\n * - `views`: All available views\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const { currentView, currentViewMap, setCurrentView } = useRichTextView()\n *\n * return (\n * <div>\n * <p>Current view: {currentView}</p>\n * {currentViewMap?.heading && <p>Heading overrides are active</p>}\n * <button onClick={() => setCurrentView('frontend')}>\n * Switch to frontend view\n * </button>\n * </div>\n * )\n * }\n * ```\n */\nexport function useRichTextView(): RichTextViewContextType {\n return use(RichTextViewContext)\n}\n"],"mappings":"AAAA;;;AACA,SAASA,oBAAoB,QAAQ;AACrC,OAAOC,KAAA,IAASC,aAAa,EAAEC,GAAG,EAAEC,OAAO,QAAQ;AA+BnD,MAAMC,mBAAA,gBAAsBH,aAAA,CAAuC;EACjEI,WAAA,EAAa;EACbC,WAAA,EAAa;EACbC,cAAA,EAAgBA,CAAA,MAAO;AACzB;AAEA;;;;;;;;;;;;;;;;;AAiBA,OAAO,MAAMC,oBAAA,GAKPC,IAAA;EACJ,MAAMC,aAAA,GAAgBC,eAAA;EAEtB,MAAM;IACJC,QAAQ;IACRP,WAAA,EAAaQ,oBAAoB;IACjCP,WAAW;IACXQ;EAAK,CACN,GAAGJ,aAAA,CAAcJ,WAAW,GACzB;IACE,GAAGI,aAAa;IAChB,GAAGD;EACL,IACAA,IAAA;EAEJ,MAAM,CAACJ,WAAA,EAAaE,cAAA,CAAe,GAAGR,oBAAA,CAAqBc,oBAAA,EAAsB;EAEjF,MAAME,KAAA,GAAQZ,OAAA,CAAQ;IACpB,MAAMa,cAAA,GAAiBF,KAAA,GAAQA,KAAK,CAACT,WAAA,CAAY,IAAIS,KAAA,CAAMG,OAAO,GAAGC,SAAA;IACrE,OAAO;MACLb,WAAA;MACAW,cAAA;MACAV,WAAA;MACAC,cAAA;MACAO;IACF;EACF,GAAG,CAACT,WAAA,EAAaC,WAAA,EAAaC,cAAA,EAAgBO,KAAA,CAAM;EAEpD,oBAAOK,IAAA,CAACf,mBAAA;IAAoBW,KAAA,EAAOA,KAAA;cAAQH;;AAC7C;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,OAAO,SAASD,gBAAA;EACd,OAAOT,GAAA,CAAIE,mBAAA;AACb","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import './ViewSelector.scss';
3
+ export declare function ViewSelector(): null | React.ReactElement;
4
+ //# sourceMappingURL=ViewSelector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ViewSelector.d.ts","sourceRoot":"","sources":["../../src/field/ViewSelector.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,qBAAqB,CAAA;AAE5B,wBAAgB,YAAY,IAAI,IAAI,GAAG,KAAK,CAAC,YAAY,CAyDxD"}
@@ -0,0 +1,89 @@
1
+ 'use client';
2
+
3
+ import { c as _c } from "react/compiler-runtime";
4
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
+ import { ChevronIcon, Popup, PopupList } from '@payloadcms/ui';
6
+ import React from 'react';
7
+ import { useRichTextView } from './RichTextViewProvider.js';
8
+ export function ViewSelector() {
9
+ const $ = _c(5);
10
+ const {
11
+ currentView,
12
+ setCurrentView,
13
+ views
14
+ } = useRichTextView();
15
+ if (!views || Object.keys(views).length === 0) {
16
+ return null;
17
+ }
18
+ let t0;
19
+ let t1;
20
+ if ($[0] !== currentView || $[1] !== setCurrentView || $[2] !== views) {
21
+ t1 = Symbol.for("react.early_return_sentinel");
22
+ bb0: {
23
+ const viewKeys = Object.keys(views);
24
+ const hasNonDefaultViews = viewKeys.some(_temp);
25
+ if (!hasNonDefaultViews) {
26
+ t1 = null;
27
+ break bb0;
28
+ }
29
+ const allViews = ["default", ...viewKeys.filter(_temp2)];
30
+ const currentViewLabel = currentView.charAt(0).toUpperCase() + currentView.slice(1);
31
+ t0 = _jsx("div", {
32
+ className: "lexical-view-selector",
33
+ children: _jsx(Popup, {
34
+ button: _jsxs("button", {
35
+ className: "lexical-view-selector__button",
36
+ type: "button",
37
+ children: [_jsx("span", {
38
+ className: "lexical-view-selector__label",
39
+ children: currentViewLabel
40
+ }), _jsx(ChevronIcon, {
41
+ className: "lexical-view-selector__icon"
42
+ })]
43
+ }),
44
+ buttonType: "custom",
45
+ horizontalAlign: "left",
46
+ render: t2 => {
47
+ const {
48
+ close
49
+ } = t2;
50
+ return _jsx(PopupList.ButtonGroup, {
51
+ children: allViews.map(viewName => {
52
+ const viewLabel = viewName.charAt(0).toUpperCase() + viewName.slice(1);
53
+ return _jsx(PopupList.Button, {
54
+ active: viewName === currentView,
55
+ disabled: viewName === currentView,
56
+ onClick: () => {
57
+ setCurrentView?.(viewName);
58
+ close();
59
+ },
60
+ children: viewLabel
61
+ }, viewName);
62
+ })
63
+ });
64
+ },
65
+ size: "large"
66
+ })
67
+ });
68
+ }
69
+ $[0] = currentView;
70
+ $[1] = setCurrentView;
71
+ $[2] = views;
72
+ $[3] = t0;
73
+ $[4] = t1;
74
+ } else {
75
+ t0 = $[3];
76
+ t1 = $[4];
77
+ }
78
+ if (t1 !== Symbol.for("react.early_return_sentinel")) {
79
+ return t1;
80
+ }
81
+ return t0;
82
+ }
83
+ function _temp2(key_0) {
84
+ return key_0 !== "default";
85
+ }
86
+ function _temp(key) {
87
+ return key !== "default";
88
+ }
89
+ //# sourceMappingURL=ViewSelector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ViewSelector.js","names":["c","_c","ChevronIcon","Popup","PopupList","React","useRichTextView","ViewSelector","$","currentView","setCurrentView","views","Object","keys","length","t0","t1","Symbol","for","bb0","viewKeys","hasNonDefaultViews","some","_temp","allViews","filter","_temp2","currentViewLabel","charAt","toUpperCase","slice","_jsx","className","children","button","_jsxs","type","horizontalAlign","render","t2","close","ButtonGroup","map","viewName","viewLabel","Button","active","disabled","onClick","key_0","key"],"sources":["../../src/field/ViewSelector.tsx"],"sourcesContent":["'use client'\nimport { ChevronIcon, Popup, PopupList } from '@payloadcms/ui'\nimport React from 'react'\n\nimport { useRichTextView } from './RichTextViewProvider.js'\nimport './ViewSelector.scss'\n\nexport function ViewSelector(): null | React.ReactElement {\n const { currentView, setCurrentView, views } = useRichTextView()\n\n // Don't show if no views or only default exists\n if (!views || Object.keys(views).length === 0) {\n return null\n }\n\n const viewKeys = Object.keys(views)\n const hasNonDefaultViews = viewKeys.some((key) => key !== 'default')\n\n // If only 'default' exists, no need to show selector\n if (!hasNonDefaultViews) {\n return null\n }\n\n // Build list of available views\n const allViews = ['default', ...viewKeys.filter((key) => key !== 'default')]\n\n const currentViewLabel = currentView.charAt(0).toUpperCase() + currentView.slice(1)\n\n return (\n <div className=\"lexical-view-selector\">\n <Popup\n button={\n <button className=\"lexical-view-selector__button\" type=\"button\">\n <span className=\"lexical-view-selector__label\">{currentViewLabel}</span>\n <ChevronIcon className=\"lexical-view-selector__icon\" />\n </button>\n }\n buttonType=\"custom\"\n horizontalAlign=\"left\"\n render={({ close }) => (\n <PopupList.ButtonGroup>\n {allViews.map((viewName) => {\n const viewLabel = viewName.charAt(0).toUpperCase() + viewName.slice(1)\n\n return (\n <PopupList.Button\n active={viewName === currentView}\n disabled={viewName === currentView}\n key={viewName}\n onClick={() => {\n setCurrentView?.(viewName)\n close()\n }}\n >\n {viewLabel}\n </PopupList.Button>\n )\n })}\n </PopupList.ButtonGroup>\n )}\n size=\"large\"\n />\n </div>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,SAASC,WAAW,EAAEC,KAAK,EAAEC,SAAS,QAAQ;AAC9C,OAAOC,KAAA,MAAW;AAElB,SAASC,eAAe,QAAQ;AAGhC,OAAO,SAAAC,aAAA;EAAA,MAAAC,CAAA,GAAAP,EAAA;EACL;IAAAQ,WAAA;IAAAC,cAAA;IAAAC;EAAA,IAA+CL,eAAA;EAAA,IAG3C,CAACK,KAAA,IAASC,MAAA,CAAAC,IAAA,CAAYF,KAAA,EAAAG,MAAA,MAAkB;IAAA;EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAR,CAAA,QAAAC,WAAA,IAAAD,CAAA,QAAAE,cAAA,IAAAF,CAAA,QAAAG,KAAA;IASnCK,EAAA,GAAAC,MAAA,CAAAC,GAAA;IAAAC,GAAA;MALT,MAAAC,QAAA,GAAiBR,MAAA,CAAAC,IAAA,CAAYF,KAAA;MAC7B,MAAAU,kBAAA,GAA2BD,QAAA,CAAAE,IAAA,CAAAC,KAA+B;MAAA,KAGrDF,kBAAA;QACIL,EAAA;QAAA,MAAAG,GAAA;MAAA;MAIT,MAAAK,QAAA,IAAkB,cAAcJ,QAAA,CAAAK,MAAA,CAAAC,MAAiC;MAEjE,MAAAC,gBAAA,GAAyBlB,WAAA,CAAAmB,MAAA,EAAmB,EAAAC,WAAA,CAAc,IAAKpB,WAAA,CAAAqB,KAAA,EAAkB;MAG/Ef,EAAA,GAAAgB,IAAA,CAAC;QAAAC,SAAA,EAAc;QAAAC,QAAA,EACbF,IAAA,CAAA5B,KAAA;UAAA+B,MAAA,EAEIC,KAAA,CAAC;YAAAH,SAAA,EAAiB;YAAAI,IAAA,EAAqC;YAAAH,QAAA,GACrDF,IAAA,CAAC;cAAAC,SAAA,EAAe;cAAAC,QAAA,EAAgCN;YAAA,C,GAChDI,IAAA,CAAA7B,WAAA;cAAA8B,SAAA,EAAuB;YAAA,C;;sBAGhB;UAAAK,eAAA,EACK;UAAAC,MAAA,EAAAC,EAAA;YACP;cAAAC;YAAA,IAAAD,EAAS;YAAA,OAChBR,IAAA,CAAA3B,SAAA,CAAAqC,WAAA;cAAAR,QAAA,EACGT,QAAA,CAAAkB,GAAA,CAAAC,QAAA;gBACC,MAAAC,SAAA,GAAkBD,QAAA,CAAAf,MAAA,EAAgB,EAAAC,WAAA,CAAc,IAAKc,QAAA,CAAAb,KAAA,EAAe;gBAAA,OAGlEC,IAAA,CAAA3B,SAAA,CAAAyC,MAAA;kBAAAC,MAAA,EACUH,QAAA,KAAalC,WAAA;kBAAAsC,QAAA,EACXJ,QAAA,KAAalC,WAAA;kBAAAuC,OAAA,EAAAA,CAAA;oBAGrBtC,cAAA,GAAiBiC,QAAA;oBACjBH,KAAA;kBAAA;kBAAAP,QAAA,EAGDW;gBAAA,GANID,QAAA;cAAA,CASX;YAAA,C;;gBAGC;QAAA,C;;;;;;;;;;;;;;;SA/BT5B,E;;AAtBG,SAAAW,OAAAuB,KAAA;EAAA,OAiBoDC,KAAA,KAAQ;AAAA;AAjB5D,SAAA3B,MAAA2B,GAAA;EAAA,OAS6CA,GAAA,KAAQ;AAAA","ignoreList":[]}