@janbox/storefront-builder 2.0.25 → 2.0.26
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/dist/components/composer/composer.d.ts +4 -0
- package/dist/components/composer/index.d.ts +1 -4
- package/dist/{index-C9gD44fK.js → composer-DBRKIqu7.js} +1 -1
- package/dist/editor/components/image-gallery-dialog.d.ts +9 -0
- package/dist/editor/components/image-source-selection.d.ts +3 -2
- package/dist/editor/components/index.d.ts +1 -0
- package/dist/editor/hooks/use-editor.d.ts +3 -0
- package/dist/editor/lib/index.d.ts +4 -1
- package/dist/editor/related/button/index.d.ts +1 -0
- package/dist/editor/related/image/index.d.ts +1 -0
- package/dist/editor/types/index.d.ts +11 -0
- package/dist/editor/ui/cascader/cascader.d.ts +41 -0
- package/dist/editor/ui/cascader/index.d.ts +1 -0
- package/dist/editor/ui/date-picker/date-picker.d.ts +7 -18
- package/dist/editor/ui/index.d.ts +1 -0
- package/dist/editor.js +1106 -966
- package/dist/hooks/use-toggle.d.ts +2 -0
- package/dist/index-CpLNXUi2.js +4 -0
- package/dist/index.js +69 -70
- package/dist/lib/inline/index.d.ts +0 -1
- package/dist/style.css +1 -1
- package/dist/templates.js +80 -92
- package/dist/{toaster-CzSp838P.js → toaster-Bx7Helq-.js} +8952 -8725
- package/dist/utils/internal.d.ts +0 -0
- package/package.json +2 -5
- package/dist/index-CglXRxzd.js +0 -4
- /package/dist/{lib → editor/related}/accordion-group/accordion-group.inspector/accordion-group.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/accordion-group/accordion-group.inspector/accordion-items-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/accordion-group/accordion-group.inspector/expand-icon-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/accordion-group/accordion-group.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/accordion-group/accordion-group.inspector/open-mode-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/box/box.inspector/box.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/box/box.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/button/button.inspector/button.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/button/button.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/button/button.inspector/link-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/button/button.inspector/size-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/button/button.inspector/variant-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/cell/cell.inspector/cell.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/cell/cell.inspector/col-span-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/cell/cell.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/container/container.inspector/container.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/container/container.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/count-up/count-up.inspector/count-up.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/count-up/count-up.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/countdown-timer/countdown-timer.inspector/caption-style-fields.d.ts +0 -0
- /package/dist/{lib → editor/related}/countdown-timer/countdown-timer.inspector/countdown-timer.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/countdown-timer/countdown-timer.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/countdown-timer/countdown-timer.inspector/time-style-fields.d.ts +0 -0
- /package/dist/{lib → editor/related}/countdown-timer/countdown-timer.inspector/unit-item-style-fields.d.ts +0 -0
- /package/dist/{lib → editor/related}/countdown-timer/countdown-timer.inspector/units-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/flex-item/flex-item.inspector/auto-grow-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/flex-item/flex-item.inspector/auto-shrink-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/flex-item/flex-item.inspector/flex-item.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/flex-item/flex-item.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/flexbox/flexbox.inspector/direction-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/flexbox/flexbox.inspector/flexbox.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/flexbox/flexbox.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/grid/grid.inspector/grid.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/grid/grid.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/heading/heading.inspector/heading.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/heading/heading.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/heading/heading.toolbar/heading.toolbar.d.ts +0 -0
- /package/dist/{lib → editor/related}/heading/heading.toolbar/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/icon/icon.inspector/icon.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/icon/icon.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/image/image.inspector/alt-text-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/image/image.inspector/image.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/image/image.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/image/image.inspector/preload-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/image/image.inspector/proportion-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/image/image.inspector/source-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/inline/inline.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/inline/inline.inspector/inline.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/link/link.inspector/destination-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/link/link.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/link/link.inspector/link.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/link/link.inspector/rel-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/link/link.toolbar/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/link/link.toolbar/link.toolbar.d.ts +0 -0
- /package/dist/{lib → editor/related}/marquee/marquee.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/marquee/marquee.inspector/marquee.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/marquee/marquee.inspector/play-state-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/paragraph/paragraph.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/paragraph/paragraph.inspector/paragraph.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/paragraph/paragraph.toolbar/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/paragraph/paragraph.toolbar/paragraph.toolbar.d.ts +0 -0
- /package/dist/{lib → editor/related}/rating/rating.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/rating/rating.inspector/rating.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/swiper/swiper.inspector/autoplay-delay-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/swiper/swiper.inspector/autoplay-loop-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/swiper/swiper.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/swiper/swiper.inspector/slides-per-view-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/swiper/swiper.inspector/swiper.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/tabs/tabs.inspector/child-tabs-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/tabs/tabs.inspector/default-active-field.d.ts +0 -0
- /package/dist/{lib → editor/related}/tabs/tabs.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/tabs/tabs.inspector/tabs.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/unordered-list/unordered-list.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/unordered-list/unordered-list.inspector/unordered-list.inspector.d.ts +0 -0
- /package/dist/{lib → editor/related}/video/video.inspector/index.d.ts +0 -0
- /package/dist/{lib → editor/related}/video/video.inspector/video.inspector.d.ts +0 -0
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
import { Editor } from '@craftjs/core';
|
|
3
|
+
export type ComposerProps = ComponentProps<typeof Editor>;
|
|
4
|
+
export declare const Composer: ({ resolver, children, ...props }: ComposerProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { Editor } from '@craftjs/core';
|
|
3
|
-
export type ComposerProps = ComponentProps<typeof Editor>;
|
|
4
|
-
export declare const Composer: ({ resolver, children, ...props }: ComposerProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
1
|
+
export * from './composer';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as i } from "@emotion/react/jsx-runtime";
|
|
2
2
|
import { useMemo as m, useEffect as f } from "react";
|
|
3
|
-
import { u as c, C as v, D as p, a as N, d as h, N as E, g as b, r as D, b as y, B as l } from "./toaster-
|
|
3
|
+
import { u as c, C as v, D as p, a as N, d as h, N as E, g as b, r as D, b as y, B as l } from "./toaster-Bx7Helq-.js";
|
|
4
4
|
import { isNil as u, isString as d } from "lodash-es";
|
|
5
5
|
import "flat";
|
|
6
6
|
const k = ({ children: t, data: e }) => {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ImageSource } from '../types';
|
|
2
|
+
interface ImageGalleryDialogProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
onOpenChange: (open: boolean) => void;
|
|
5
|
+
images?: ImageSource[];
|
|
6
|
+
onSelect?: (source: ImageSource) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const ImageGalleryDialog: ({ open, onOpenChange, images, onSelect }: ImageGalleryDialogProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
import { ImageSource } from '../types';
|
|
2
3
|
interface ImageSourceSelectionProps {
|
|
3
|
-
source?:
|
|
4
|
-
onChange?: (source?:
|
|
4
|
+
source?: ImageSource;
|
|
5
|
+
onChange?: (source?: ImageSource) => void;
|
|
5
6
|
previewStyle?: React.CSSProperties;
|
|
6
7
|
}
|
|
7
8
|
export declare const ImageSourceSelection: ({ source, onChange, previewStyle }: ImageSourceSelectionProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -3,6 +3,7 @@ export * from './color-picker-popover';
|
|
|
3
3
|
export * from './color-preview';
|
|
4
4
|
export * from './css-size-input';
|
|
5
5
|
export * from './degree-picker';
|
|
6
|
+
export * from './image-gallery-dialog';
|
|
6
7
|
export * from './image-source-selection';
|
|
7
8
|
export * from './toolbar-field';
|
|
8
9
|
export * from './toolbar-group';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Screen, Theme } from '@janbox/storefront-ui/theme';
|
|
2
2
|
import { SerializedNodes } from '../../types';
|
|
3
|
+
import { EditorResources } from '../types';
|
|
3
4
|
export type EditorMode = 'full' | 'compact';
|
|
4
5
|
export type VariableOption = {
|
|
5
6
|
label: string;
|
|
@@ -23,6 +24,8 @@ export type EditorState = {
|
|
|
23
24
|
screen: Screen;
|
|
24
25
|
action?: string;
|
|
25
26
|
variableDefinitions?: VariableDefinition[];
|
|
27
|
+
/** Tài nguyên edit-time do consumer cấp. Truyền một lần lúc init, bất biến. */
|
|
28
|
+
resources?: EditorResources;
|
|
26
29
|
};
|
|
27
30
|
type MutableEditorState = Pick<EditorState, 'theme' | 'mode' | 'screen' | 'action' | 'variableDefinitions'>;
|
|
28
31
|
type EditorStateValue = EditorState & {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Theme } from '@janbox/storefront-ui/theme';
|
|
2
2
|
import { SidebarProps } from './sidebar';
|
|
3
3
|
import { Resolver } from '../../types';
|
|
4
|
+
import { EditorResources } from '../types';
|
|
4
5
|
import { EditorHandlers, VariableDefinition } from '../hooks/use-editor';
|
|
5
6
|
import { PropsWithChildren, ReactNode } from 'react';
|
|
6
7
|
export type EditorProps = PropsWithChildren<{
|
|
@@ -10,7 +11,9 @@ export type EditorProps = PropsWithChildren<{
|
|
|
10
11
|
handlers: EditorHandlers;
|
|
11
12
|
variableDefinitions?: VariableDefinition[];
|
|
12
13
|
headerActions?: ReactNode;
|
|
14
|
+
resources?: EditorResources;
|
|
13
15
|
}>;
|
|
14
16
|
export type { EditorHandlers, VariableDefinition, VariableOption } from '../hooks/use-editor';
|
|
17
|
+
export type { EditorResources, ImageSource } from '../types';
|
|
15
18
|
export type { InsertTemplate, InsertTemplateGroup } from './sidebar/insert-action';
|
|
16
|
-
export declare const Editor: ({ theme, insert, resolver, handlers, variableDefinitions, headerActions, children, }: EditorProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare const Editor: ({ theme, insert, resolver, handlers, variableDefinitions, headerActions, resources, children, }: EditorProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './button.inspector';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './image.inspector';
|
|
@@ -1 +1,12 @@
|
|
|
1
1
|
export type CssUnit = 'px' | '%';
|
|
2
|
+
export type ImageSource = {
|
|
3
|
+
src: string;
|
|
4
|
+
alt?: string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Tài nguyên edit-time do consumer cấp cho Editor (prop `resources`).
|
|
8
|
+
* Flat, không gắn riêng node nào — dùng chung ở nhiều nơi (image inspector, background, ...).
|
|
9
|
+
*/
|
|
10
|
+
export type EditorResources = {
|
|
11
|
+
imageSources?: ImageSource[];
|
|
12
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { JSX, Ref } from 'react';
|
|
2
|
+
import { Placement, UseFloatingOptions, UseDismissProps } from '@floating-ui/react';
|
|
3
|
+
import { ShallowMerge } from '@janbox/storefront-ui/types';
|
|
4
|
+
export interface WbCascaderOption {
|
|
5
|
+
label: React.ReactNode;
|
|
6
|
+
value: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
children?: WbCascaderOption[];
|
|
9
|
+
}
|
|
10
|
+
interface WbCascaderExtendedProps {
|
|
11
|
+
innerRef?: Ref<HTMLDivElement>;
|
|
12
|
+
placement?: Placement;
|
|
13
|
+
contentWidth?: number | 'fit-parent';
|
|
14
|
+
onOpenChange?: UseFloatingOptions['onOpenChange'];
|
|
15
|
+
visible?: boolean;
|
|
16
|
+
dissmiss?: UseDismissProps;
|
|
17
|
+
defaultValue?: string[];
|
|
18
|
+
value?: string[] | null;
|
|
19
|
+
options: WbCascaderOption[];
|
|
20
|
+
/** Fires with the full value path and matching option path. */
|
|
21
|
+
onChange?: (value: string[], options: WbCascaderOption[]) => void;
|
|
22
|
+
/** How each column expands to reveal its children. Default: `click` */
|
|
23
|
+
expandTrigger?: 'click' | 'hover';
|
|
24
|
+
/** Allow committing a value at any level, not just leaves. Default: `false` */
|
|
25
|
+
changeOnSelect?: boolean;
|
|
26
|
+
placeholder?: string;
|
|
27
|
+
/** Show a clear button when a value is selected. Default: `false` */
|
|
28
|
+
allowClear?: boolean;
|
|
29
|
+
/** Renders the selected path in the trigger. Defaults to labels joined by `separator`. */
|
|
30
|
+
displayRender?: (labels: React.ReactNode[], options: WbCascaderOption[]) => React.ReactNode;
|
|
31
|
+
separator?: React.ReactNode;
|
|
32
|
+
prefix?: React.ReactNode;
|
|
33
|
+
suffix?: React.ReactNode;
|
|
34
|
+
size?: '28' | '32' | '36';
|
|
35
|
+
columnWidth?: number;
|
|
36
|
+
columnMaxHeight?: number;
|
|
37
|
+
emptyText?: React.ReactNode;
|
|
38
|
+
}
|
|
39
|
+
export type WbCascaderProps = ShallowMerge<JSX.IntrinsicElements['button'], WbCascaderExtendedProps>;
|
|
40
|
+
export declare const WbCascader: (props: WbCascaderProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './cascader';
|
|
@@ -1,21 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
type
|
|
4
|
-
|
|
5
|
-
placement?: Placement;
|
|
6
|
-
contentWidth?: number | 'fit-parent';
|
|
7
|
-
onOpenChange?: UseFloatingOptions['onOpenChange'];
|
|
8
|
-
open?: boolean;
|
|
9
|
-
dissmiss?: UseDismissProps;
|
|
10
|
-
value?: Date | null;
|
|
1
|
+
import { HTMLInputTypeAttribute } from 'react';
|
|
2
|
+
import { WbInputProps } from '../input';
|
|
3
|
+
type InputDateType = Extract<HTMLInputTypeAttribute, 'date' | 'datetime-local'>;
|
|
4
|
+
type WbDatePickerProps = Omit<WbInputProps, 'value' | 'defaultValue' | 'type'> & {
|
|
11
5
|
defaultValue?: Date;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
prefix?: React.ReactNode;
|
|
15
|
-
suffix?: React.ReactNode;
|
|
16
|
-
size?: '28' | '32' | '36';
|
|
17
|
-
referenceProps?: JSX.IntrinsicElements['button'];
|
|
18
|
-
showTimeInput?: boolean;
|
|
6
|
+
value?: Date;
|
|
7
|
+
type?: InputDateType;
|
|
19
8
|
};
|
|
20
|
-
export declare const WbDatePicker: (props: WbDatePickerProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const WbDatePicker: ({ type, ...props }: WbDatePickerProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
21
10
|
export {};
|