@lax-wp/editor 0.3.3 → 0.3.4

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.
@@ -0,0 +1,18 @@
1
+ import type { ReactNode } from "react";
2
+ import type { EditorProviderConfig } from "./EditorProviderContext";
3
+ /**
4
+ * Wraps `<Editor>` with external state supplied by the consumer.
5
+ *
6
+ * Usage in lax-web-portal (same pattern as DesignSystemProvider in Root.tsx):
7
+ * ```tsx
8
+ * const { isDarkMode } = useTheme();
9
+ *
10
+ * <EditorProvider config={{ theme: { isDarkMode } }}>
11
+ * <Editor config={editorConfig} />
12
+ * </EditorProvider>
13
+ * ```
14
+ */
15
+ export declare const EditorProvider: ({ config, children, }: {
16
+ config?: EditorProviderConfig;
17
+ children: ReactNode;
18
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Configuration the consumer (e.g. lax-web-portal) can inject into the editor.
3
+ *
4
+ * Pattern mirrors lax-wp-design-system's DesignSystemConfig:
5
+ * - The library defines the shape.
6
+ * - The consumer passes values (from Redux, context, etc.) once at the top level.
7
+ * - Any editor component reads them via `useEditorProvider()` without prop drilling.
8
+ */
9
+ export type EditorProviderConfig = {
10
+ /**
11
+ * Theme config. If `isDarkMode` is omitted the editor falls back to reading
12
+ * the `dark` class on `<html>` — the same contract used by lax-wp-design-system.
13
+ */
14
+ theme?: {
15
+ /** Explicit dark-mode flag passed from the consumer's ThemeContext / Redux state. */
16
+ isDarkMode?: boolean;
17
+ };
18
+ };
19
+ export type EditorProviderContextValue = {
20
+ config: EditorProviderConfig;
21
+ /** Resolved dark-mode: explicit prop takes priority, then DOM class detection. */
22
+ isDarkMode: boolean;
23
+ };
24
+ export declare const EditorProviderContext: import("react").Context<EditorProviderContextValue | undefined>;
25
+ /**
26
+ * Read the editor provider context inside any editor component.
27
+ *
28
+ * Falls back gracefully when the consumer hasn't wrapped with EditorProvider
29
+ * (e.g. standalone / Storybook usage) so nothing breaks.
30
+ */
31
+ export declare const useEditorProvider: () => EditorProviderContextValue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lax-wp/editor",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "A modern, feature-rich editor built with React and TipTap",
5
5
  "keywords": [
6
6
  "editor",
@@ -39,7 +39,10 @@
39
39
  "build:types": "tsc --project tsconfig.build.json",
40
40
  "lint": "eslint .",
41
41
  "preview": "vite preview",
42
- "prepublishOnly": "npm run build"
42
+ "prepublishOnly": "npm run build",
43
+ "link:register": "npm run build && npm link",
44
+ "dev:link": "npm run build:types && vite build --watch",
45
+ "link:editor": "npm run link:register && npm run dev:link"
43
46
  },
44
47
  "dependencies": {
45
48
  "@emotion/react": "^11.14.0",