@wordpress/lazy-editor 1.1.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.
Files changed (55) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/LICENSE.md +788 -0
  3. package/README.md +65 -0
  4. package/build/component.js +100 -0
  5. package/build/component.js.map +7 -0
  6. package/build/hooks/use-editor-assets.js +84 -0
  7. package/build/hooks/use-editor-assets.js.map +7 -0
  8. package/build/hooks/use-editor-settings.js +68 -0
  9. package/build/hooks/use-editor-settings.js.map +7 -0
  10. package/build/hooks/use-global-styles.js +81 -0
  11. package/build/hooks/use-global-styles.js.map +7 -0
  12. package/build/hooks/use-styles-id.js +50 -0
  13. package/build/hooks/use-styles-id.js.map +7 -0
  14. package/build/index.js +31 -0
  15. package/build/index.js.map +7 -0
  16. package/build/lock-unlock.js +35 -0
  17. package/build/lock-unlock.js.map +7 -0
  18. package/build-module/component.js +75 -0
  19. package/build-module/component.js.map +7 -0
  20. package/build-module/hooks/use-editor-assets.js +48 -0
  21. package/build-module/hooks/use-editor-assets.js.map +7 -0
  22. package/build-module/hooks/use-editor-settings.js +43 -0
  23. package/build-module/hooks/use-editor-settings.js.map +7 -0
  24. package/build-module/hooks/use-global-styles.js +56 -0
  25. package/build-module/hooks/use-global-styles.js.map +7 -0
  26. package/build-module/hooks/use-styles-id.js +25 -0
  27. package/build-module/hooks/use-styles-id.js.map +7 -0
  28. package/build-module/index.js +6 -0
  29. package/build-module/index.js.map +7 -0
  30. package/build-module/lock-unlock.js +10 -0
  31. package/build-module/lock-unlock.js.map +7 -0
  32. package/build-types/component.d.ts +23 -0
  33. package/build-types/component.d.ts.map +1 -0
  34. package/build-types/hooks/use-editor-assets.d.ts +11 -0
  35. package/build-types/hooks/use-editor-assets.d.ts.map +1 -0
  36. package/build-types/hooks/use-editor-settings.d.ts +14 -0
  37. package/build-types/hooks/use-editor-settings.d.ts.map +1 -0
  38. package/build-types/hooks/use-global-styles.d.ts +10 -0
  39. package/build-types/hooks/use-global-styles.d.ts.map +1 -0
  40. package/build-types/hooks/use-styles-id.d.ts +13 -0
  41. package/build-types/hooks/use-styles-id.d.ts.map +1 -0
  42. package/build-types/index.d.ts +5 -0
  43. package/build-types/index.d.ts.map +1 -0
  44. package/build-types/lock-unlock.d.ts +2 -0
  45. package/build-types/lock-unlock.d.ts.map +1 -0
  46. package/package.json +55 -0
  47. package/src/component.tsx +110 -0
  48. package/src/hooks/use-editor-assets.tsx +65 -0
  49. package/src/hooks/use-editor-settings.tsx +56 -0
  50. package/src/hooks/use-global-styles.tsx +75 -0
  51. package/src/hooks/use-styles-id.tsx +45 -0
  52. package/src/index.tsx +4 -0
  53. package/src/lock-unlock.ts +9 -0
  54. package/tsconfig.json +18 -0
  55. package/tsconfig.tsbuildinfo +1 -0
package/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # Lazy Editor
2
+
3
+ Lazy-loading editor component with automatic asset and settings management.
4
+
5
+ ## Overview
6
+
7
+ This package provides a single `<Editor>` component that handles all the complexity of loading and initializing the WordPress block editor. It automatically:
8
+
9
+ - **Loads editor assets** - Fetches and injects scripts and styles with proper dependency resolution
10
+ - **Loads editor settings** - Retrieves editor configuration from the REST API
11
+ - **Resolves global styles** - Applies theme.json styles based on the current template
12
+ - **Manages template contexts** - Automatically determines the correct template for the post being edited
13
+ - **Shows loading states** - Displays a spinner while assets and settings are being loaded
14
+
15
+ ## Installation
16
+
17
+ Install the module:
18
+
19
+ ```bash
20
+ npm install @wordpress/lazy-editor --save
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ ### Basic Usage
26
+
27
+ ```tsx
28
+ import { Editor } from '@wordpress/lazy-editor';
29
+
30
+ function App() {
31
+ return <Editor postType="page" postId="123" />;
32
+ }
33
+ ```
34
+
35
+ That's it! The component handles everything internally:
36
+ 1. Resolves the template ID from the post type and ID
37
+ 2. Resolves the styles ID from the template
38
+ 3. Loads editor settings from `/wp-block-editor/v1/settings`
39
+ 4. Loads editor assets from `/wp-block-editor/v1/assets`
40
+ 5. Injects scripts and styles into the DOM
41
+ 6. Renders the editor when ready
42
+
43
+ ### With Different Post Types
44
+
45
+ ```tsx
46
+ // Edit a post
47
+ <Editor postType="post" postId="42" />
48
+
49
+ // Edit a page
50
+ <Editor postType="page" postId="123" />
51
+
52
+ // Edit a template
53
+ <Editor postType="wp_template" postId="index" />
54
+
55
+ // Edit a custom post type
56
+ <Editor postType="product" postId="789" />
57
+ ```
58
+
59
+ ## Contributing
60
+
61
+ See [CONTRIBUTING.md](../../CONTRIBUTING.md).
62
+
63
+ ## License
64
+
65
+ GPL-2.0-or-later
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/lazy-editor/src/component.tsx
21
+ var component_exports = {};
22
+ __export(component_exports, {
23
+ Editor: () => Editor
24
+ });
25
+ module.exports = __toCommonJS(component_exports);
26
+ var import_editor = require("@wordpress/editor");
27
+ var import_core_data = require("@wordpress/core-data");
28
+ var import_data = require("@wordpress/data");
29
+ var import_components = require("@wordpress/components");
30
+ var import_element = require("@wordpress/element");
31
+ var import_use_styles_id = require("./hooks/use-styles-id");
32
+ var import_use_editor_settings = require("./hooks/use-editor-settings");
33
+ var import_use_editor_assets = require("./hooks/use-editor-assets");
34
+ var import_lock_unlock = require("./lock-unlock");
35
+ var import_jsx_runtime = require("react/jsx-runtime");
36
+ var { Editor: PrivateEditor, BackButton } = (0, import_lock_unlock.unlock)(import_editor.privateApis);
37
+ function Editor({
38
+ postType,
39
+ postId,
40
+ settings,
41
+ backButton
42
+ }) {
43
+ const templateId = (0, import_data.useSelect)(
44
+ (select) => {
45
+ if (!postType || !postId) {
46
+ return void 0;
47
+ }
48
+ if (postType === "wp_template") {
49
+ return postId;
50
+ }
51
+ return (0, import_lock_unlock.unlock)(select(import_core_data.store)).getTemplateId(
52
+ postType,
53
+ postId
54
+ );
55
+ },
56
+ [postType, postId]
57
+ );
58
+ const stylesId = (0, import_use_styles_id.useStylesId)({ templateId });
59
+ const { isReady: settingsReady, editorSettings } = (0, import_use_editor_settings.useEditorSettings)({
60
+ stylesId
61
+ });
62
+ const { isReady: assetsReady } = (0, import_use_editor_assets.useEditorAssets)();
63
+ const finalSettings = (0, import_element.useMemo)(
64
+ () => ({
65
+ ...editorSettings,
66
+ ...settings
67
+ }),
68
+ [editorSettings, settings]
69
+ );
70
+ if (!settingsReady || !assetsReady) {
71
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
72
+ "div",
73
+ {
74
+ style: {
75
+ display: "flex",
76
+ justifyContent: "center",
77
+ alignItems: "center",
78
+ height: "100vh"
79
+ },
80
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Spinner, {})
81
+ }
82
+ );
83
+ }
84
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
85
+ PrivateEditor,
86
+ {
87
+ postType,
88
+ postId,
89
+ templateId,
90
+ settings: finalSettings,
91
+ styles: finalSettings.styles,
92
+ children: backButton && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BackButton, { children: backButton })
93
+ }
94
+ );
95
+ }
96
+ // Annotate the CommonJS export names for ESM import in node:
97
+ 0 && (module.exports = {
98
+ Editor
99
+ });
100
+ //# sourceMappingURL=component.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/component.tsx"],
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport type { ReactNode } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { Spinner } from '@wordpress/components';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useStylesId } from './hooks/use-styles-id';\nimport { useEditorSettings } from './hooks/use-editor-settings';\nimport { useEditorAssets } from './hooks/use-editor-assets';\nimport { unlock } from './lock-unlock';\n\nconst { Editor: PrivateEditor, BackButton } = unlock( editorPrivateApis );\n\ninterface EditorProps {\n\tpostType: string;\n\tpostId: string;\n\tsettings?: Record< string, any >;\n\tbackButton?: ReactNode;\n}\n\n/**\n * Lazy-loading editor component that handles asset loading and settings initialization.\n *\n * @param {Object} props Component props\n * @param {string} props.postType The post type to edit\n * @param {string} props.postId The post ID to edit\n * @param {Object} props.settings Optional extra settings to merge with editor settings\n * @param {ReactNode} props.backButton Optional back button to render in editor header\n * @return The editor component with loading states\n */\nexport function Editor( {\n\tpostType,\n\tpostId,\n\tsettings,\n\tbackButton,\n}: EditorProps ) {\n\t// Resolve template ID from post type/ID\n\tconst templateId = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! postType || ! postId ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tif ( postType === 'wp_template' ) {\n\t\t\t\treturn postId;\n\t\t\t}\n\t\t\t// Use private API to get template ID for this post\n\t\t\treturn unlock( select( coreDataStore ) ).getTemplateId(\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\t// Resolve styles ID from template\n\tconst stylesId = useStylesId( { templateId } );\n\n\t// Load editor settings and assets\n\tconst { isReady: settingsReady, editorSettings } = useEditorSettings( {\n\t\tstylesId,\n\t} );\n\tconst { isReady: assetsReady } = useEditorAssets();\n\tconst finalSettings = useMemo(\n\t\t() => ( {\n\t\t\t...editorSettings,\n\t\t\t...settings,\n\t\t} ),\n\t\t[ editorSettings, settings ]\n\t);\n\n\t// Show loading spinner while assets or settings are loading\n\tif ( ! settingsReady || ! assetsReady ) {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tstyle={ {\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\tjustifyContent: 'center',\n\t\t\t\t\talignItems: 'center',\n\t\t\t\t\theight: '100vh',\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<Spinner />\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Render the editor when ready\n\treturn (\n\t\t<PrivateEditor\n\t\t\tpostType={ postType }\n\t\t\tpostId={ postId }\n\t\t\ttemplateId={ templateId }\n\t\t\tsettings={ finalSettings }\n\t\t\tstyles={ finalSettings.styles }\n\t\t>\n\t\t\t{ backButton && <BackButton>{ backButton }</BackButton> }\n\t\t</PrivateEditor>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,oBAAiD;AACjD,uBAAuC;AACvC,kBAA0B;AAC1B,wBAAwB;AACxB,qBAAwB;AAKxB,2BAA4B;AAC5B,iCAAkC;AAClC,+BAAgC;AAChC,yBAAuB;AAwEnB;AAtEJ,IAAM,EAAE,QAAQ,eAAe,WAAW,QAAI,2BAAQ,cAAAA,WAAkB;AAmBjE,SAAS,OAAQ;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAiB;AAEhB,QAAM,iBAAa;AAAA,IAClB,CAAE,WAAY;AACb,UAAK,CAAE,YAAY,CAAE,QAAS;AAC7B,eAAO;AAAA,MACR;AACA,UAAK,aAAa,eAAgB;AACjC,eAAO;AAAA,MACR;AAEA,iBAAO,2BAAQ,OAAQ,iBAAAC,KAAc,CAAE,EAAE;AAAA,QACxC;AAAA,QACA;AAAA,MACD;AAAA,IACD;AAAA,IACA,CAAE,UAAU,MAAO;AAAA,EACpB;AAGA,QAAM,eAAW,kCAAa,EAAE,WAAW,CAAE;AAG7C,QAAM,EAAE,SAAS,eAAe,eAAe,QAAI,8CAAmB;AAAA,IACrE;AAAA,EACD,CAAE;AACF,QAAM,EAAE,SAAS,YAAY,QAAI,0CAAgB;AACjD,QAAM,oBAAgB;AAAA,IACrB,OAAQ;AAAA,MACP,GAAG;AAAA,MACH,GAAG;AAAA,IACJ;AAAA,IACA,CAAE,gBAAgB,QAAS;AAAA,EAC5B;AAGA,MAAK,CAAE,iBAAiB,CAAE,aAAc;AACvC,WACC;AAAA,MAAC;AAAA;AAAA,QACA,OAAQ;AAAA,UACP,SAAS;AAAA,UACT,gBAAgB;AAAA,UAChB,YAAY;AAAA,UACZ,QAAQ;AAAA,QACT;AAAA,QAEA,sDAAC,6BAAQ;AAAA;AAAA,IACV;AAAA,EAEF;AAGA,SACC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAW;AAAA,MACX,QAAS,cAAc;AAAA,MAErB,wBAAc,4CAAC,cAAa,sBAAY;AAAA;AAAA,EAC3C;AAEF;",
6
+ "names": ["editorPrivateApis", "coreDataStore"]
7
+ }
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // packages/lazy-editor/src/hooks/use-editor-assets.tsx
31
+ var use_editor_assets_exports = {};
32
+ __export(use_editor_assets_exports, {
33
+ loadEditorAssets: () => loadEditorAssets,
34
+ useEditorAssets: () => useEditorAssets
35
+ });
36
+ module.exports = __toCommonJS(use_editor_assets_exports);
37
+ var import_asset_loader = __toESM(require("@wordpress/asset-loader"));
38
+ var import_core_data = require("@wordpress/core-data");
39
+ var import_element = require("@wordpress/element");
40
+ var import_data = require("@wordpress/data");
41
+ var import_lock_unlock = require("../lock-unlock");
42
+ var loadAssetsPromise;
43
+ async function loadEditorAssets() {
44
+ const load = async () => {
45
+ const editorAssets = await (0, import_lock_unlock.unlock)(
46
+ (0, import_data.resolveSelect)(import_core_data.store)
47
+ ).getEditorAssets();
48
+ await (0, import_asset_loader.default)(
49
+ editorAssets.scripts || {},
50
+ editorAssets.inline_scripts || { before: {}, after: {} },
51
+ editorAssets.styles || {},
52
+ editorAssets.inline_styles || { before: {}, after: {} }
53
+ );
54
+ };
55
+ if (!loadAssetsPromise) {
56
+ loadAssetsPromise = load();
57
+ }
58
+ return loadAssetsPromise;
59
+ }
60
+ function useEditorAssets() {
61
+ const editorAssets = (0, import_data.useSelect)((select) => {
62
+ return (0, import_lock_unlock.unlock)(select(import_core_data.store)).getEditorAssets();
63
+ }, []);
64
+ const [assetsLoaded, setAssetsLoaded] = (0, import_element.useState)(false);
65
+ (0, import_element.useEffect)(() => {
66
+ if (editorAssets && !assetsLoaded) {
67
+ loadEditorAssets().then(() => {
68
+ setAssetsLoaded(true);
69
+ }).catch((error) => {
70
+ console.error("Failed to load editor assets:", error);
71
+ });
72
+ }
73
+ }, [editorAssets, assetsLoaded]);
74
+ return {
75
+ isReady: !!editorAssets && assetsLoaded,
76
+ assetsLoaded
77
+ };
78
+ }
79
+ // Annotate the CommonJS export names for ESM import in node:
80
+ 0 && (module.exports = {
81
+ loadEditorAssets,
82
+ useEditorAssets
83
+ });
84
+ //# sourceMappingURL=use-editor-assets.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/hooks/use-editor-assets.tsx"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport loadAssets from '@wordpress/asset-loader';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { useState, useEffect } from '@wordpress/element';\nimport { resolveSelect, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\nlet loadAssetsPromise: Promise< void >;\n\nexport async function loadEditorAssets() {\n\tconst load = async () => {\n\t\tconst editorAssets = await unlock(\n\t\t\tresolveSelect( coreDataStore )\n\t\t).getEditorAssets();\n\t\tawait loadAssets(\n\t\t\teditorAssets.scripts || {},\n\t\t\teditorAssets.inline_scripts || { before: {}, after: {} },\n\t\t\teditorAssets.styles || {},\n\t\t\teditorAssets.inline_styles || { before: {}, after: {} }\n\t\t);\n\t};\n\n\tif ( ! loadAssetsPromise ) {\n\t\tloadAssetsPromise = load();\n\t}\n\n\treturn loadAssetsPromise;\n}\n\n/**\n * This is a React hook that handles loading editor assets from the REST API.\n *\n * @return Editor assets loading state.\n */\nexport function useEditorAssets() {\n\tconst editorAssets = useSelect( ( select ) => {\n\t\treturn unlock( select( coreDataStore ) ).getEditorAssets();\n\t}, [] );\n\n\tconst [ assetsLoaded, setAssetsLoaded ] = useState( false );\n\n\tuseEffect( () => {\n\t\tif ( editorAssets && ! assetsLoaded ) {\n\t\t\tloadEditorAssets()\n\t\t\t\t.then( () => {\n\t\t\t\t\tsetAssetsLoaded( true );\n\t\t\t\t} )\n\t\t\t\t.catch( ( error: Error ) => {\n\t\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\t\tconsole.error( 'Failed to load editor assets:', error );\n\t\t\t\t} );\n\t\t}\n\t}, [ editorAssets, assetsLoaded ] );\n\n\treturn {\n\t\tisReady: !! editorAssets && assetsLoaded,\n\t\tassetsLoaded,\n\t};\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAAuB;AACvB,uBAAuC;AACvC,qBAAoC;AACpC,kBAAyC;AAKzC,yBAAuB;AAEvB,IAAI;AAEJ,eAAsB,mBAAmB;AACxC,QAAM,OAAO,YAAY;AACxB,UAAM,eAAe,UAAM;AAAA,UAC1B,2BAAe,iBAAAA,KAAc;AAAA,IAC9B,EAAE,gBAAgB;AAClB,cAAM,oBAAAC;AAAA,MACL,aAAa,WAAW,CAAC;AAAA,MACzB,aAAa,kBAAkB,EAAE,QAAQ,CAAC,GAAG,OAAO,CAAC,EAAE;AAAA,MACvD,aAAa,UAAU,CAAC;AAAA,MACxB,aAAa,iBAAiB,EAAE,QAAQ,CAAC,GAAG,OAAO,CAAC,EAAE;AAAA,IACvD;AAAA,EACD;AAEA,MAAK,CAAE,mBAAoB;AAC1B,wBAAoB,KAAK;AAAA,EAC1B;AAEA,SAAO;AACR;AAOO,SAAS,kBAAkB;AACjC,QAAM,mBAAe,uBAAW,CAAE,WAAY;AAC7C,eAAO,2BAAQ,OAAQ,iBAAAD,KAAc,CAAE,EAAE,gBAAgB;AAAA,EAC1D,GAAG,CAAC,CAAE;AAEN,QAAM,CAAE,cAAc,eAAgB,QAAI,yBAAU,KAAM;AAE1D,gCAAW,MAAM;AAChB,QAAK,gBAAgB,CAAE,cAAe;AACrC,uBAAiB,EACf,KAAM,MAAM;AACZ,wBAAiB,IAAK;AAAA,MACvB,CAAE,EACD,MAAO,CAAE,UAAkB;AAE3B,gBAAQ,MAAO,iCAAiC,KAAM;AAAA,MACvD,CAAE;AAAA,IACJ;AAAA,EACD,GAAG,CAAE,cAAc,YAAa,CAAE;AAElC,SAAO;AAAA,IACN,SAAS,CAAC,CAAE,gBAAgB;AAAA,IAC5B;AAAA,EACD;AACD;",
6
+ "names": ["coreDataStore", "loadAssets"]
7
+ }
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/lazy-editor/src/hooks/use-editor-settings.tsx
21
+ var use_editor_settings_exports = {};
22
+ __export(use_editor_settings_exports, {
23
+ useEditorSettings: () => useEditorSettings
24
+ });
25
+ module.exports = __toCommonJS(use_editor_settings_exports);
26
+ var import_global_styles_engine = require("@wordpress/global-styles-engine");
27
+ var import_core_data = require("@wordpress/core-data");
28
+ var import_element = require("@wordpress/element");
29
+ var import_data = require("@wordpress/data");
30
+ var import_use_global_styles = require("./use-global-styles");
31
+ var import_lock_unlock = require("../lock-unlock");
32
+ function useEditorSettings({ stylesId }) {
33
+ const { editorSettings } = (0, import_data.useSelect)(
34
+ (select) => ({
35
+ editorSettings: (0, import_lock_unlock.unlock)(
36
+ select(import_core_data.store)
37
+ ).getEditorSettings()
38
+ }),
39
+ []
40
+ );
41
+ const { user: globalStyles } = (0, import_use_global_styles.useUserGlobalStyles)(stylesId);
42
+ const [globalStylesCSS] = (0, import_global_styles_engine.generateGlobalStyles)(globalStyles);
43
+ const hasEditorSettings = !!editorSettings;
44
+ const styles = (0, import_element.useMemo)(() => {
45
+ if (!hasEditorSettings) {
46
+ return [];
47
+ }
48
+ return [
49
+ ...editorSettings?.styles ?? [],
50
+ ...globalStylesCSS
51
+ ];
52
+ }, [hasEditorSettings, editorSettings?.styles, globalStylesCSS]);
53
+ return {
54
+ isReady: hasEditorSettings,
55
+ editorSettings: (0, import_element.useMemo)(
56
+ () => ({
57
+ ...editorSettings ?? {},
58
+ styles
59
+ }),
60
+ [editorSettings, styles]
61
+ )
62
+ };
63
+ }
64
+ // Annotate the CommonJS export names for ESM import in node:
65
+ 0 && (module.exports = {
66
+ useEditorSettings
67
+ });
68
+ //# sourceMappingURL=use-editor-settings.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/hooks/use-editor-settings.tsx"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { generateGlobalStyles } from '@wordpress/global-styles-engine';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useUserGlobalStyles } from './use-global-styles';\nimport { unlock } from '../lock-unlock';\n\n/**\n * This is a React hook that provides the editor settings from the REST API.\n *\n * @param {Object} props - The props object.\n * @param {string} [props.stylesId] - The ID of the user's global styles to use.\n * @return Editor settings.\n */\nexport function useEditorSettings( { stylesId }: { stylesId: string } ) {\n\tconst { editorSettings } = useSelect(\n\t\t( select ) => ( {\n\t\t\teditorSettings: unlock(\n\t\t\t\tselect( coreDataStore )\n\t\t\t).getEditorSettings(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst { user: globalStyles } = useUserGlobalStyles( stylesId );\n\tconst [ globalStylesCSS ] = generateGlobalStyles( globalStyles );\n\n\tconst hasEditorSettings = !! editorSettings;\n\tconst styles = useMemo( () => {\n\t\tif ( ! hasEditorSettings ) {\n\t\t\treturn [];\n\t\t}\n\t\treturn [\n\t\t\t...( ( editorSettings?.styles as Array< any > ) ?? [] ),\n\t\t\t...globalStylesCSS,\n\t\t];\n\t}, [ hasEditorSettings, editorSettings?.styles, globalStylesCSS ] );\n\n\treturn {\n\t\tisReady: hasEditorSettings,\n\t\teditorSettings: useMemo(\n\t\t\t() => ( {\n\t\t\t\t...( editorSettings ?? {} ),\n\t\t\t\tstyles,\n\t\t\t} ),\n\t\t\t[ editorSettings, styles ]\n\t\t),\n\t};\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kCAAqC;AACrC,uBAAuC;AACvC,qBAAwB;AACxB,kBAA0B;AAK1B,+BAAoC;AACpC,yBAAuB;AAShB,SAAS,kBAAmB,EAAE,SAAS,GAA0B;AACvE,QAAM,EAAE,eAAe,QAAI;AAAA,IAC1B,CAAE,YAAc;AAAA,MACf,oBAAgB;AAAA,QACf,OAAQ,iBAAAA,KAAc;AAAA,MACvB,EAAE,kBAAkB;AAAA,IACrB;AAAA,IACA,CAAC;AAAA,EACF;AAEA,QAAM,EAAE,MAAM,aAAa,QAAI,8CAAqB,QAAS;AAC7D,QAAM,CAAE,eAAgB,QAAI,kDAAsB,YAAa;AAE/D,QAAM,oBAAoB,CAAC,CAAE;AAC7B,QAAM,aAAS,wBAAS,MAAM;AAC7B,QAAK,CAAE,mBAAoB;AAC1B,aAAO,CAAC;AAAA,IACT;AACA,WAAO;AAAA,MACN,GAAO,gBAAgB,UAA4B,CAAC;AAAA,MACpD,GAAG;AAAA,IACJ;AAAA,EACD,GAAG,CAAE,mBAAmB,gBAAgB,QAAQ,eAAgB,CAAE;AAElE,SAAO;AAAA,IACN,SAAS;AAAA,IACT,oBAAgB;AAAA,MACf,OAAQ;AAAA,QACP,GAAK,kBAAkB,CAAC;AAAA,QACxB;AAAA,MACD;AAAA,MACA,CAAE,gBAAgB,MAAO;AAAA,IAC1B;AAAA,EACD;AACD;",
6
+ "names": ["coreDataStore"]
7
+ }
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/lazy-editor/src/hooks/use-global-styles.tsx
21
+ var use_global_styles_exports = {};
22
+ __export(use_global_styles_exports, {
23
+ useUserGlobalStyles: () => useUserGlobalStyles
24
+ });
25
+ module.exports = __toCommonJS(use_global_styles_exports);
26
+ var import_core_data = require("@wordpress/core-data");
27
+ var import_data = require("@wordpress/data");
28
+ var import_element = require("@wordpress/element");
29
+ function useUserGlobalStyles(id) {
30
+ const { userGlobalStyles } = (0, import_data.useSelect)(
31
+ (select) => {
32
+ const { getEntityRecord, getEditedEntityRecord, canUser } = select(import_core_data.store);
33
+ const userCanEditGlobalStyles = canUser("update", {
34
+ kind: "root",
35
+ name: "globalStyles",
36
+ id
37
+ });
38
+ let record;
39
+ if (
40
+ /*
41
+ * Test that the OPTIONS request for user capabilities is complete
42
+ * before fetching the global styles entity record.
43
+ * This is to avoid fetching the global styles entity unnecessarily.
44
+ */
45
+ typeof userCanEditGlobalStyles === "boolean"
46
+ ) {
47
+ if (userCanEditGlobalStyles) {
48
+ record = getEditedEntityRecord(
49
+ "root",
50
+ "globalStyles",
51
+ id
52
+ );
53
+ } else {
54
+ record = getEntityRecord("root", "globalStyles", id, {
55
+ context: "view"
56
+ });
57
+ }
58
+ }
59
+ return {
60
+ userGlobalStyles: record
61
+ };
62
+ },
63
+ [id]
64
+ );
65
+ return (0, import_element.useMemo)(() => {
66
+ if (!userGlobalStyles) {
67
+ return {
68
+ user: void 0
69
+ };
70
+ }
71
+ const user = userGlobalStyles;
72
+ return {
73
+ user
74
+ };
75
+ }, [userGlobalStyles]);
76
+ }
77
+ // Annotate the CommonJS export names for ESM import in node:
78
+ 0 && (module.exports = {
79
+ useUserGlobalStyles
80
+ });
81
+ //# sourceMappingURL=use-global-styles.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/hooks/use-global-styles.tsx"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport type { GlobalStylesConfig } from '@wordpress/global-styles-engine';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\n\nexport function useUserGlobalStyles( id: string ) {\n\tconst { userGlobalStyles } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, getEditedEntityRecord, canUser } =\n\t\t\t\tselect( coreStore );\n\n\t\t\t/*\n\t\t\t * Ensure that the global styles ID request is complete by testing `_globalStylesId`,\n\t\t\t * before firing off the `canUser` OPTIONS request for user capabilities, otherwise it will\n\t\t\t * fetch `/wp/v2/global-styles` instead of `/wp/v2/global-styles/{id}`.\n\t\t\t * NOTE: Please keep in sync any preload paths sent to `block_editor_rest_api_preload()`,\n\t\t\t * or set using the `block_editor_rest_api_preload_paths` filter, if this changes.\n\t\t\t */\n\t\t\tconst userCanEditGlobalStyles = canUser( 'update', {\n\t\t\t\tkind: 'root',\n\t\t\t\tname: 'globalStyles',\n\t\t\t\tid,\n\t\t\t} );\n\n\t\t\tlet record;\n\t\t\tif (\n\t\t\t\t/*\n\t\t\t\t * Test that the OPTIONS request for user capabilities is complete\n\t\t\t\t * before fetching the global styles entity record.\n\t\t\t\t * This is to avoid fetching the global styles entity unnecessarily.\n\t\t\t\t */\n\t\t\t\ttypeof userCanEditGlobalStyles === 'boolean'\n\t\t\t) {\n\t\t\t\t/*\n\t\t\t\t * Fetch the global styles entity record based on the user's capabilities.\n\t\t\t\t * The default context is `edit` for users who can edit global styles.\n\t\t\t\t * Otherwise, the context is `view`.\n\t\t\t\t */\n\t\t\t\tif ( userCanEditGlobalStyles ) {\n\t\t\t\t\trecord = getEditedEntityRecord(\n\t\t\t\t\t\t'root',\n\t\t\t\t\t\t'globalStyles',\n\t\t\t\t\t\tid\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\trecord = getEntityRecord( 'root', 'globalStyles', id, {\n\t\t\t\t\t\tcontext: 'view',\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tuserGlobalStyles: record,\n\t\t\t};\n\t\t},\n\t\t[ id ]\n\t);\n\n\treturn useMemo( () => {\n\t\tif ( ! userGlobalStyles ) {\n\t\t\treturn {\n\t\t\t\tuser: undefined,\n\t\t\t};\n\t\t}\n\n\t\tconst user = userGlobalStyles as GlobalStylesConfig;\n\n\t\treturn {\n\t\t\tuser,\n\t\t};\n\t}, [ userGlobalStyles ] );\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,uBAAmC;AACnC,kBAA0B;AAC1B,qBAAwB;AAEjB,SAAS,oBAAqB,IAAa;AACjD,QAAM,EAAE,iBAAiB,QAAI;AAAA,IAC5B,CAAE,WAAY;AACb,YAAM,EAAE,iBAAiB,uBAAuB,QAAQ,IACvD,OAAQ,iBAAAA,KAAU;AASnB,YAAM,0BAA0B,QAAS,UAAU;AAAA,QAClD,MAAM;AAAA,QACN,MAAM;AAAA,QACN;AAAA,MACD,CAAE;AAEF,UAAI;AACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAMC,OAAO,4BAA4B;AAAA,QAClC;AAMD,YAAK,yBAA0B;AAC9B,mBAAS;AAAA,YACR;AAAA,YACA;AAAA,YACA;AAAA,UACD;AAAA,QACD,OAAO;AACN,mBAAS,gBAAiB,QAAQ,gBAAgB,IAAI;AAAA,YACrD,SAAS;AAAA,UACV,CAAE;AAAA,QACH;AAAA,MACD;AAEA,aAAO;AAAA,QACN,kBAAkB;AAAA,MACnB;AAAA,IACD;AAAA,IACA,CAAE,EAAG;AAAA,EACN;AAEA,aAAO,wBAAS,MAAM;AACrB,QAAK,CAAE,kBAAmB;AACzB,aAAO;AAAA,QACN,MAAM;AAAA,MACP;AAAA,IACD;AAEA,UAAM,OAAO;AAEb,WAAO;AAAA,MACN;AAAA,IACD;AAAA,EACD,GAAG,CAAE,gBAAiB,CAAE;AACzB;",
6
+ "names": ["coreStore"]
7
+ }
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/lazy-editor/src/hooks/use-styles-id.tsx
21
+ var use_styles_id_exports = {};
22
+ __export(use_styles_id_exports, {
23
+ useStylesId: () => useStylesId
24
+ });
25
+ module.exports = __toCommonJS(use_styles_id_exports);
26
+ var import_core_data = require("@wordpress/core-data");
27
+ var import_data = require("@wordpress/data");
28
+ function useStylesId({ templateId }) {
29
+ const { globalStylesId, stylesId } = (0, import_data.useSelect)(
30
+ (select) => {
31
+ const coreDataSelect = select(import_core_data.store);
32
+ const template = templateId ? coreDataSelect.getEntityRecord(
33
+ "postType",
34
+ "wp_template",
35
+ templateId
36
+ ) : null;
37
+ return {
38
+ globalStylesId: coreDataSelect.__experimentalGetCurrentGlobalStylesId(),
39
+ stylesId: template?.styles_id
40
+ };
41
+ },
42
+ [templateId]
43
+ );
44
+ return stylesId || globalStylesId;
45
+ }
46
+ // Annotate the CommonJS export names for ESM import in node:
47
+ 0 && (module.exports = {
48
+ useStylesId
49
+ });
50
+ //# sourceMappingURL=use-styles-id.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/hooks/use-styles-id.tsx"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\n\n// Define interface for template with optional styles_id\ninterface Template {\n\tstyles_id?: string;\n\t[ key: string ]: any;\n}\n\n/**\n * This is a React hook that provides the styles ID.\n * Styles ID can be associated with a template.\n * If a template has a styles ID, it will be used otherwise the global styles ID will be used.\n *\n * @param {Object} props - The props object.\n * @param {string} [props.templateId] - The ID of the template to use.\n * @return The styles ID.\n */\nexport function useStylesId( { templateId }: { templateId?: string } ) {\n\tconst { globalStylesId, stylesId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst coreDataSelect = select( coreStore );\n\t\t\tconst template = templateId\n\t\t\t\t? ( coreDataSelect.getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'wp_template',\n\t\t\t\t\t\ttemplateId\n\t\t\t\t ) as Template | null )\n\t\t\t\t: null;\n\n\t\t\treturn {\n\t\t\t\tglobalStylesId:\n\t\t\t\t\tcoreDataSelect.__experimentalGetCurrentGlobalStylesId(),\n\t\t\t\tstylesId: template?.styles_id,\n\t\t\t};\n\t\t},\n\t\t[ templateId ]\n\t);\n\n\t// Otherwise, fall back to the global styles ID\n\treturn stylesId || globalStylesId;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uBAAmC;AACnC,kBAA0B;AAiBnB,SAAS,YAAa,EAAE,WAAW,GAA6B;AACtE,QAAM,EAAE,gBAAgB,SAAS,QAAI;AAAA,IACpC,CAAE,WAAY;AACb,YAAM,iBAAiB,OAAQ,iBAAAA,KAAU;AACzC,YAAM,WAAW,aACZ,eAAe;AAAA,QACjB;AAAA,QACA;AAAA,QACA;AAAA,MACA,IACA;AAEH,aAAO;AAAA,QACN,gBACC,eAAe,uCAAuC;AAAA,QACvD,UAAU,UAAU;AAAA,MACrB;AAAA,IACD;AAAA,IACA,CAAE,UAAW;AAAA,EACd;AAGA,SAAO,YAAY;AACpB;",
6
+ "names": ["coreStore"]
7
+ }
package/build/index.js ADDED
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/lazy-editor/src/index.tsx
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ Editor: () => import_component.Editor
24
+ });
25
+ module.exports = __toCommonJS(index_exports);
26
+ var import_component = require("./component");
27
+ // Annotate the CommonJS export names for ESM import in node:
28
+ 0 && (module.exports = {
29
+ Editor
30
+ });
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.tsx"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nexport { Editor } from './component';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uBAAuB;",
6
+ "names": []
7
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/lazy-editor/src/lock-unlock.ts
21
+ var lock_unlock_exports = {};
22
+ __export(lock_unlock_exports, {
23
+ unlock: () => unlock
24
+ });
25
+ module.exports = __toCommonJS(lock_unlock_exports);
26
+ var import_private_apis = require("@wordpress/private-apis");
27
+ var { unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
28
+ "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
29
+ "@wordpress/lazy-editor"
30
+ );
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
33
+ unlock
34
+ });
35
+ //# sourceMappingURL=lock-unlock.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/lock-unlock.ts"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { unlock } = __dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',\n\t'@wordpress/lazy-editor'\n);\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAAiE;AAE1D,IAAM,EAAE,OAAO,QAAI;AAAA,EACzB;AAAA,EACA;AACD;",
6
+ "names": []
7
+ }