@janbox/storefront-builder 2.0.10 → 2.0.11
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/README.md +26 -1
- package/dist/editor/components/color-picker-popover.d.ts +2 -1
- package/dist/editor/constants/index.d.ts +2 -3
- package/dist/editor/hooks/use-editor.d.ts +1 -0
- package/dist/editor/lib/sidebar/theme-action.d.ts +1 -0
- package/dist/editor/toolbars/color-variant/color-variant.d.ts +2 -2
- package/dist/editor/toolbars/index.d.ts +1 -1
- package/dist/editor/toolbars/visibility/index.d.ts +1 -0
- package/dist/editor/toolbars/visibility/visibility.d.ts +1 -0
- package/dist/editor.js +1719 -1534
- package/dist/hooks/use-node-props.d.ts +0 -1
- package/dist/index-fErSlbD2.js +206 -0
- package/dist/index.js +2 -2
- package/dist/lib/button/README.md +2 -2
- package/dist/types/index.d.ts +2 -3
- package/package.json +2 -2
- package/dist/editor/toolbars/display-on/display-on.d.ts +0 -5
- package/dist/editor/toolbars/display-on/index.d.ts +0 -1
- package/dist/index-3PtMdwiC.js +0 -188
package/README.md
CHANGED
|
@@ -60,6 +60,9 @@ export default function BuilderPage() {
|
|
|
60
60
|
await savePage(data);
|
|
61
61
|
},
|
|
62
62
|
close: () => navigateBack(),
|
|
63
|
+
saveTheme: async (theme) => {
|
|
64
|
+
await api.saveTheme(theme); // optional: enables theme editing
|
|
65
|
+
},
|
|
63
66
|
}}
|
|
64
67
|
insert={{
|
|
65
68
|
groups: [HERO_SECTION_GROUP, FAQS_SECTION_GROUP],
|
|
@@ -344,6 +347,29 @@ const { id, connectors, actions } = useNode();
|
|
|
344
347
|
|
|
345
348
|
---
|
|
346
349
|
|
|
350
|
+
## Theme Editor
|
|
351
|
+
|
|
352
|
+
Sidebar tích hợp sẵn tab Theme cho phép xem và chỉnh sửa palette. Tính năng chỉnh sửa được kích hoạt khi truyền `handlers.saveTheme`:
|
|
353
|
+
|
|
354
|
+
```tsx
|
|
355
|
+
<Editor
|
|
356
|
+
theme={myTheme}
|
|
357
|
+
handlers={{
|
|
358
|
+
// ...
|
|
359
|
+
saveTheme: async (theme) => {
|
|
360
|
+
await api.updateTheme(theme);
|
|
361
|
+
},
|
|
362
|
+
}}
|
|
363
|
+
/>
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
- Không truyền `saveTheme` → tab Theme chỉ hiển thị palette (view only)
|
|
367
|
+
- Truyền `saveTheme` → hiện color picker cho primary/secondary + nút Save/Cancel
|
|
368
|
+
- Cancel hoặc rời tab → reset về theme ban đầu
|
|
369
|
+
- Save → gọi `saveTheme(theme)` async, có loading state
|
|
370
|
+
|
|
371
|
+
---
|
|
372
|
+
|
|
347
373
|
## Stylesheet
|
|
348
374
|
|
|
349
375
|
Import stylesheet một lần ở entry của app:
|
|
@@ -388,7 +414,6 @@ import type {
|
|
|
388
414
|
NodeTree, // cây node
|
|
389
415
|
Resolver, // map resolvedName → component
|
|
390
416
|
NodeConfig, // config truyền vào defineNode()
|
|
391
|
-
DisplayOnValue, // responsive visibility: Partial<Record<Screen, boolean>>
|
|
392
417
|
} from '@janbox/storefront-builder';
|
|
393
418
|
```
|
|
394
419
|
|
|
@@ -3,8 +3,9 @@ import { WbPopoverProps } from '../ui';
|
|
|
3
3
|
type ColorPickerContentProps = {
|
|
4
4
|
color?: string;
|
|
5
5
|
onChange?: (color: string) => void;
|
|
6
|
+
hidePalette?: boolean;
|
|
6
7
|
};
|
|
7
8
|
export declare const ColorPickerContent: ({ color, onChange }: ColorPickerContentProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
8
9
|
export type ColorPickerPopoverProps = ShallowMerge<WbPopoverProps, ColorPickerContentProps>;
|
|
9
|
-
export declare const ColorPickerPopover: ({ color, onChange, children, placement, ...props }: ColorPickerPopoverProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const ColorPickerPopover: ({ color, onChange, hidePalette, children, placement, ...props }: ColorPickerPopoverProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
10
11
|
export {};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { CssUnit } from '../types';
|
|
2
|
-
import { Screen } from '@janbox/storefront-ui/theme';
|
|
3
|
-
import { ColorVariant } from '@janbox/storefront-ui/types';
|
|
2
|
+
import { Screen, ColorScale } from '@janbox/storefront-ui/theme';
|
|
4
3
|
export type ColorVariantOption = {
|
|
5
|
-
value:
|
|
4
|
+
value: ColorScale;
|
|
6
5
|
label: string;
|
|
7
6
|
};
|
|
8
7
|
export declare const colorVariantOptions: ColorVariantOption[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ThemeAction: () => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ColorVariantOption } from '../../constants';
|
|
2
2
|
import { WbSelectProps } from '../../ui';
|
|
3
|
-
import {
|
|
4
|
-
export type ColorVariantToolbarProps = Partial<WbSelectProps<
|
|
3
|
+
import { ColorScale } from '@janbox/storefront-ui/theme';
|
|
4
|
+
export type ColorVariantToolbarProps = Partial<WbSelectProps<ColorScale, ColorVariantOption>>;
|
|
5
5
|
export declare const ColorVariantToolbar: (props: ColorVariantToolbarProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -24,7 +24,7 @@ export * from './color-variant';
|
|
|
24
24
|
export * from './flex';
|
|
25
25
|
export * from './number-field';
|
|
26
26
|
export * from './number-field-mix-options';
|
|
27
|
-
export * from './
|
|
27
|
+
export * from './visibility';
|
|
28
28
|
export * from './justify-items';
|
|
29
29
|
export * from './grid-align-items';
|
|
30
30
|
export * from './aspect-ratio';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './visibility';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const VisibilityToolbar: () => import("@emotion/react/jsx-runtime").JSX.Element;
|