@puckeditor/core 0.22.1 → 0.23.0-canary.7ca16bcb

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.
@@ -60,6 +60,89 @@ type FieldsSlice = {
60
60
  id: string | undefined;
61
61
  };
62
62
 
63
+ /**
64
+ * Default messages for every hard-coded string shown in the Puck editor UI.
65
+ *
66
+ * Tokens follow a `{area}-{name}-{variant}` structure, where hyphens only
67
+ * separate segments (compound words within a segment are concatenated, e.g.
68
+ * `field-arrayitem-summary`).
69
+ */
70
+ declare const defaultDictionary: {
71
+ readonly "header-publish": "Publish";
72
+ readonly "header-undo": "undo";
73
+ readonly "header-redo": "redo";
74
+ readonly "header-toggle-leftsidebar": "Toggle left sidebar";
75
+ readonly "header-toggle-rightsidebar": "Toggle right sidebar";
76
+ readonly "header-toggle-menubar": "Toggle menu bar";
77
+ readonly "action-selectparent": "Select parent";
78
+ readonly "action-duplicate": "Duplicate";
79
+ readonly "action-delete": "Delete";
80
+ readonly "label-page": "Page";
81
+ readonly "label-component": "Component";
82
+ readonly "outline-empty": "No items";
83
+ readonly "outline-collapse": "Collapse";
84
+ readonly "outline-expand": "Expand";
85
+ readonly "drawer-category-collapse": "Collapse {title}";
86
+ readonly "drawer-category-expand": "Expand {title}";
87
+ readonly "drawer-category-other": "Other";
88
+ readonly "canvas-noconfig": "No configuration for {type}";
89
+ readonly "field-readonly": "Read-only";
90
+ readonly "field-arrayitem-summary": "Item #{index}";
91
+ readonly "field-arrayitem-duplicate": "Duplicate";
92
+ readonly "field-arrayitem-delete": "Delete";
93
+ readonly "field-external-selectdata": "Select data";
94
+ readonly "field-external-search": "Search";
95
+ readonly "field-external-togglefilters": "Toggle filters";
96
+ readonly "field-external-item": "External item";
97
+ readonly "field-external-result-singular": "{count} result";
98
+ readonly "field-external-result-plural": "{count} results";
99
+ readonly "field-richtext-bold": "Bold";
100
+ readonly "field-richtext-italic": "Italic";
101
+ readonly "field-richtext-underline": "Underline";
102
+ readonly "field-richtext-strikethrough": "Strikethrough";
103
+ readonly "field-richtext-blockquote": "Blockquote";
104
+ readonly "field-richtext-code-inline": "Inline code";
105
+ readonly "field-richtext-code-block": "Code block";
106
+ readonly "field-richtext-list-bullet": "Bullet list";
107
+ readonly "field-richtext-list-ordered": "Ordered list";
108
+ readonly "field-richtext-horizontalrule": "Horizontal rule";
109
+ readonly "field-richtext-align-left": "Align left";
110
+ readonly "field-richtext-align-center": "Align center";
111
+ readonly "field-richtext-align-right": "Align right";
112
+ readonly "field-richtext-align-justify": "Justify";
113
+ readonly "field-richtext-select": "Select";
114
+ readonly "field-richtext-headingselect-1": "Heading 1";
115
+ readonly "field-richtext-headingselect-2": "Heading 2";
116
+ readonly "field-richtext-headingselect-3": "Heading 3";
117
+ readonly "field-richtext-headingselect-4": "Heading 4";
118
+ readonly "field-richtext-headingselect-5": "Heading 5";
119
+ readonly "field-richtext-headingselect-6": "Heading 6";
120
+ readonly "field-richtext-alignselect-left": "Left";
121
+ readonly "field-richtext-alignselect-center": "Center";
122
+ readonly "field-richtext-alignselect-right": "Right";
123
+ readonly "field-richtext-alignselect-justify": "Justify";
124
+ readonly "field-richtext-listselect-bullet": "Bullet list";
125
+ readonly "field-richtext-listselect-ordered": "Ordered list";
126
+ readonly "viewport-zoom-in": "Zoom viewport in";
127
+ readonly "viewport-zoom-out": "Zoom viewport out";
128
+ readonly "viewport-zoom-auto": "{zoom}% (Auto)";
129
+ readonly "viewport-toggle-menu": "Toggle viewport menu";
130
+ readonly "viewport-switch": "Switch to {label} viewport";
131
+ readonly "viewport-switch-default": "Switch viewport";
132
+ readonly "plugin-blocks": "Blocks";
133
+ readonly "plugin-outline": "Outline";
134
+ readonly "plugin-fields": "Fields";
135
+ readonly "plugin-components": "Components";
136
+ readonly "layout-maximize": "maximize";
137
+ readonly "layout-minimize": "minimize";
138
+ readonly "loader-loading": "loading";
139
+ };
140
+ type DictionaryKey = keyof typeof defaultDictionary;
141
+ /**
142
+ * Override any of Puck's built-in UI strings, or provide your own custom strings.
143
+ */
144
+ type Dictionary = Partial<Record<DictionaryKey, string> & Record<string, string>>;
145
+
63
146
  type Status = "LOADING" | "MOUNTED" | "READY";
64
147
  type ZoomConfig = {
65
148
  autoZoom: number;
@@ -100,6 +183,7 @@ type AppStore<UserConfig extends Config = Config, G extends UserGenerics<UserCon
100
183
  getComponentConfig: (type?: string) => ComponentConfig | null | undefined;
101
184
  onAction?: (action: PuckAction, newState: AppState, state: AppState) => void;
102
185
  metadata: Metadata;
186
+ dictionary: Dictionary;
103
187
  fields: FieldsSlice;
104
188
  history: HistorySlice;
105
189
  nodes: NodesSlice;
@@ -114,4 +198,4 @@ type AppStore<UserConfig extends Config = Config, G extends UserGenerics<UserCon
114
198
  } | null;
115
199
  };
116
200
 
117
- export type { AppStore as A, GetPermissions as G, HistorySlice as H, RefreshPermissions as R };
201
+ export type { AppStore as A, Dictionary as D, GetPermissions as G, HistorySlice as H, RefreshPermissions as R };
package/dist/index.d.mts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { H as Field, J as FieldProps, y as DropZoneProps, m as Config, am as UserGenerics, D as Data, al as UiState, Y as OnAction, $ as Permissions, a0 as Plugin, _ as Overrides, N as FieldTransforms, a3 as PuckAction, ao as Viewports, Q as IframeConfig, R as InitialHistory, V as Metadata, a8 as ResolveDataTrigger, S as ItemSelector, i as ComponentData, a1 as PluginInternal } from './actions-Csn3gOP8.mjs';
2
2
  export { A as Adaptor, a as AppState, b as ArrayField, c as ArrayState, d as AsFieldProps, B as BaseData, e as BaseField, C as CacheOpts, f as ComponentConfig, g as ComponentConfigExtensions, h as ComponentConfigParams, j as ComponentDataMap, k as ComponentDataOptionalId, l as ComponentMetadata, n as ConfigParams, o as Content, p as CustomField, q as CustomFieldRender, r as DefaultComponentProps, s as DefaultComponents, t as DefaultRootFieldProps, u as DefaultRootProps, v as DefaultRootRenderProps, w as Direction, x as DragAxis, E as ExternalField, z as ExternalFieldWithAdaptor, F as ExtractConfigParams, G as ExtractField, I as FieldMetadata, K as FieldRenderFunctions, L as FieldTransformFn, M as FieldTransformFnParams, O as Fields, P as History, T as ItemWithId, U as MappedItem, W as NumberField, X as ObjectField, Z as OverrideKey, a4 as PuckComponent, a5 as PuckContext, a6 as PuckMetadata, a7 as RadioField, a9 as RichText, aa as RichtextField, ab as RootConfig, ac as RootData, ad as RootDataWithProps, ae as RootDataWithoutProps, af as SelectField, ag as Slot, ah as SlotComponent, ai as SlotField, aj as TextField, ak as TextareaField, an as Viewport, ap as WithChildren, aq as WithId, ar as WithPuckProps, as as WithSlotProps, at as overrideKeys } from './actions-Csn3gOP8.mjs';
3
+ import { D as Dictionary, A as AppStore, G as GetPermissions, R as RefreshPermissions, H as HistorySlice } from './index-De5Tn61v.mjs';
3
4
  export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-BrW9VQ_t.mjs';
4
5
  import * as react from 'react';
5
6
  import react__default, { ReactNode, SyntheticEvent, ReactElement, CSSProperties } from 'react';
6
7
  import * as react_jsx_runtime from 'react/jsx-runtime';
7
- import { A as AppStore, G as GetPermissions, R as RefreshPermissions, H as HistorySlice } from './index-ClzBCbx_.mjs';
8
8
  import '@tiptap/react';
9
9
  import '@tiptap/extension-blockquote';
10
10
  import '@tiptap/extension-bold';
@@ -150,6 +150,7 @@ type PuckProps<UserConfig extends Config = Config, G extends UserGenerics<UserCo
150
150
  };
151
151
  initialHistory?: InitialHistory;
152
152
  metadata?: Metadata;
153
+ dictionary?: Dictionary;
153
154
  height?: CSSProperties["height"];
154
155
  _experimentalFullScreenCanvas?: boolean;
155
156
  _experimentalVirtualization?: boolean;
@@ -276,6 +277,7 @@ type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<User
276
277
  hasPast: boolean;
277
278
  hasFuture: boolean;
278
279
  };
280
+ dictionary: Dictionary;
279
281
  };
280
282
  type PuckApi<UserConfig extends Config = Config> = UsePuckData<UserConfig>;
281
283
  type UsePuckStore<UserConfig extends Config = Config> = PuckApi<UserConfig>;
@@ -297,14 +299,27 @@ declare function usePuck<UserConfig extends Config = Config>(): UsePuckStore<Use
297
299
  */
298
300
  declare function useGetPuck(): () => UsePuckStore<Config>;
299
301
 
300
- declare const blocksPlugin: () => Plugin;
302
+ type BlocksPluginProps = {
303
+ label?: string;
304
+ icon?: ReactNode;
305
+ };
306
+ declare const blocksPlugin: (props?: BlocksPluginProps) => Plugin;
301
307
 
302
308
  declare const fieldsPlugin: (params?: {
303
309
  desktopSideBar?: "left" | "right";
310
+ label?: string;
311
+ icon?: ReactNode;
304
312
  }) => PluginInternal;
305
313
 
306
- declare const outlinePlugin: () => Plugin;
314
+ type OutlinePluginProps = {
315
+ label?: string;
316
+ icon?: ReactNode;
317
+ };
318
+ declare const outlinePlugin: (props?: OutlinePluginProps) => Plugin;
307
319
 
308
- declare const legacySideBarPlugin: () => Plugin;
320
+ declare const legacySideBarPlugin: (props?: {
321
+ outlineLabel?: string;
322
+ componentsLabel?: string;
323
+ }) => Plugin;
309
324
 
310
- export { Action, ActionBar, AutoField, Button, ComponentData, Config, Data, Drawer, DropZone, Field, FieldLabel, FieldProps, FieldTransforms, Group, IconButton, IframeConfig, InitialHistory, Label, Metadata, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, type PuckApi, Render, ResolveDataTrigger, RichTextMenu, Separator, UiState, type UsePuckData, UserGenerics, Viewports, blocksPlugin, createUsePuck, fieldsPlugin, legacySideBarPlugin, outlinePlugin, registerOverlayPortal, renderContext, setDeep, useGetPuck, usePuck };
325
+ export { Action, ActionBar, AutoField, type BlocksPluginProps, Button, ComponentData, Config, Data, Dictionary, Drawer, DropZone, Field, FieldLabel, FieldProps, FieldTransforms, Group, IconButton, IframeConfig, InitialHistory, Label, Metadata, OnAction, type OutlinePluginProps, Overrides, Permissions, Plugin, Puck, PuckAction, type PuckApi, Render, ResolveDataTrigger, RichTextMenu, Separator, UiState, type UsePuckData, UserGenerics, Viewports, blocksPlugin, createUsePuck, fieldsPlugin, legacySideBarPlugin, outlinePlugin, registerOverlayPortal, renderContext, setDeep, useGetPuck, usePuck };
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { H as Field, J as FieldProps, y as DropZoneProps, m as Config, am as UserGenerics, D as Data, al as UiState, Y as OnAction, $ as Permissions, a0 as Plugin, _ as Overrides, N as FieldTransforms, a3 as PuckAction, ao as Viewports, Q as IframeConfig, R as InitialHistory, V as Metadata, a8 as ResolveDataTrigger, S as ItemSelector, i as ComponentData, a1 as PluginInternal } from './actions-Csn3gOP8.js';
2
2
  export { A as Adaptor, a as AppState, b as ArrayField, c as ArrayState, d as AsFieldProps, B as BaseData, e as BaseField, C as CacheOpts, f as ComponentConfig, g as ComponentConfigExtensions, h as ComponentConfigParams, j as ComponentDataMap, k as ComponentDataOptionalId, l as ComponentMetadata, n as ConfigParams, o as Content, p as CustomField, q as CustomFieldRender, r as DefaultComponentProps, s as DefaultComponents, t as DefaultRootFieldProps, u as DefaultRootProps, v as DefaultRootRenderProps, w as Direction, x as DragAxis, E as ExternalField, z as ExternalFieldWithAdaptor, F as ExtractConfigParams, G as ExtractField, I as FieldMetadata, K as FieldRenderFunctions, L as FieldTransformFn, M as FieldTransformFnParams, O as Fields, P as History, T as ItemWithId, U as MappedItem, W as NumberField, X as ObjectField, Z as OverrideKey, a4 as PuckComponent, a5 as PuckContext, a6 as PuckMetadata, a7 as RadioField, a9 as RichText, aa as RichtextField, ab as RootConfig, ac as RootData, ad as RootDataWithProps, ae as RootDataWithoutProps, af as SelectField, ag as Slot, ah as SlotComponent, ai as SlotField, aj as TextField, ak as TextareaField, an as Viewport, ap as WithChildren, aq as WithId, ar as WithPuckProps, as as WithSlotProps, at as overrideKeys } from './actions-Csn3gOP8.js';
3
+ import { D as Dictionary, A as AppStore, G as GetPermissions, R as RefreshPermissions, H as HistorySlice } from './index-t7c1w81O.js';
3
4
  export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CWrsBHHe.js';
4
5
  import * as react from 'react';
5
6
  import react__default, { ReactNode, SyntheticEvent, ReactElement, CSSProperties } from 'react';
6
7
  import * as react_jsx_runtime from 'react/jsx-runtime';
7
- import { A as AppStore, G as GetPermissions, R as RefreshPermissions, H as HistorySlice } from './index-B1b1cFug.js';
8
8
  import '@tiptap/react';
9
9
  import '@tiptap/extension-blockquote';
10
10
  import '@tiptap/extension-bold';
@@ -150,6 +150,7 @@ type PuckProps<UserConfig extends Config = Config, G extends UserGenerics<UserCo
150
150
  };
151
151
  initialHistory?: InitialHistory;
152
152
  metadata?: Metadata;
153
+ dictionary?: Dictionary;
153
154
  height?: CSSProperties["height"];
154
155
  _experimentalFullScreenCanvas?: boolean;
155
156
  _experimentalVirtualization?: boolean;
@@ -276,6 +277,7 @@ type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<User
276
277
  hasPast: boolean;
277
278
  hasFuture: boolean;
278
279
  };
280
+ dictionary: Dictionary;
279
281
  };
280
282
  type PuckApi<UserConfig extends Config = Config> = UsePuckData<UserConfig>;
281
283
  type UsePuckStore<UserConfig extends Config = Config> = PuckApi<UserConfig>;
@@ -297,14 +299,27 @@ declare function usePuck<UserConfig extends Config = Config>(): UsePuckStore<Use
297
299
  */
298
300
  declare function useGetPuck(): () => UsePuckStore<Config>;
299
301
 
300
- declare const blocksPlugin: () => Plugin;
302
+ type BlocksPluginProps = {
303
+ label?: string;
304
+ icon?: ReactNode;
305
+ };
306
+ declare const blocksPlugin: (props?: BlocksPluginProps) => Plugin;
301
307
 
302
308
  declare const fieldsPlugin: (params?: {
303
309
  desktopSideBar?: "left" | "right";
310
+ label?: string;
311
+ icon?: ReactNode;
304
312
  }) => PluginInternal;
305
313
 
306
- declare const outlinePlugin: () => Plugin;
314
+ type OutlinePluginProps = {
315
+ label?: string;
316
+ icon?: ReactNode;
317
+ };
318
+ declare const outlinePlugin: (props?: OutlinePluginProps) => Plugin;
307
319
 
308
- declare const legacySideBarPlugin: () => Plugin;
320
+ declare const legacySideBarPlugin: (props?: {
321
+ outlineLabel?: string;
322
+ componentsLabel?: string;
323
+ }) => Plugin;
309
324
 
310
- export { Action, ActionBar, AutoField, Button, ComponentData, Config, Data, Drawer, DropZone, Field, FieldLabel, FieldProps, FieldTransforms, Group, IconButton, IframeConfig, InitialHistory, Label, Metadata, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, type PuckApi, Render, ResolveDataTrigger, RichTextMenu, Separator, UiState, type UsePuckData, UserGenerics, Viewports, blocksPlugin, createUsePuck, fieldsPlugin, legacySideBarPlugin, outlinePlugin, registerOverlayPortal, renderContext, setDeep, useGetPuck, usePuck };
325
+ export { Action, ActionBar, AutoField, type BlocksPluginProps, Button, ComponentData, Config, Data, Dictionary, Drawer, DropZone, Field, FieldLabel, FieldProps, FieldTransforms, Group, IconButton, IframeConfig, InitialHistory, Label, Metadata, OnAction, type OutlinePluginProps, Overrides, Permissions, Plugin, Puck, PuckAction, type PuckApi, Render, ResolveDataTrigger, RichTextMenu, Separator, UiState, type UsePuckData, UserGenerics, Viewports, blocksPlugin, createUsePuck, fieldsPlugin, legacySideBarPlugin, outlinePlugin, registerOverlayPortal, renderContext, setDeep, useGetPuck, usePuck };