@pallasoft/ps-core-components 2.41.0 → 2.43.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.
- package/dist/components/ps-button.js +3 -1
- package/dist/components/ps-portable-text-image.d.ts +7 -0
- package/dist/components/ps-portable-text-image.js +15 -0
- package/dist/components/ps-portable-text-message.d.ts +2 -0
- package/dist/components/ps-portable-text-message.js +49 -0
- package/dist/components/ps-portable-text.d.ts +6 -1
- package/dist/components/ps-portable-text.js +8 -3
- package/dist/components/ps-reflective-app-shell.d.ts +3 -1
- package/dist/components/ps-reflective-app-shell.js +10 -3
- package/dist/components/ps-scroll-restoration.d.ts +6 -0
- package/dist/components/ps-scroll-restoration.js +9 -0
- package/dist/constants/ps-portable-text-message-config.d.ts +32 -0
- package/dist/constants/ps-portable-text-message-config.js +35 -0
- package/dist/constants/ps-portable-text-variant.d.ts +4 -0
- package/dist/constants/ps-portable-text-variant.js +8 -0
- package/dist/constants/ps-scroll-restoration-config.d.ts +10 -0
- package/dist/constants/ps-scroll-restoration-config.js +13 -0
- package/dist/constants/ps-text-link-gap.d.ts +4 -0
- package/dist/constants/ps-text-link-gap.js +7 -0
- package/dist/esm/components/ps-button.js +3 -1
- package/dist/esm/components/ps-portable-text-image.js +11 -0
- package/dist/esm/components/ps-portable-text-message.js +45 -0
- package/dist/esm/components/ps-portable-text.js +8 -3
- package/dist/esm/components/ps-reflective-app-shell.js +10 -3
- package/dist/esm/components/ps-scroll-restoration.js +5 -0
- package/dist/esm/constants/ps-portable-text-message-config.js +32 -0
- package/dist/esm/constants/ps-portable-text-variant.js +5 -0
- package/dist/esm/constants/ps-scroll-restoration-config.js +10 -0
- package/dist/esm/constants/ps-text-link-gap.js +4 -0
- package/dist/esm/hooks/use-ps-browser-layout-effect.js +2 -0
- package/dist/esm/hooks/use-ps-scroll-restoration.js +103 -0
- package/dist/esm/index.js +17 -0
- package/dist/esm/models/ps-portable-text-image-data.js +1 -0
- package/dist/esm/models/ps-portable-text-image-labels.js +1 -0
- package/dist/esm/models/ps-portable-text-message-props.js +1 -0
- package/dist/esm/models/ps-scroll-offsets-data.js +1 -0
- package/dist/esm/models/ps-scroll-pending-save-data.js +1 -0
- package/dist/esm/models/ps-scroll-restoration-options.js +1 -0
- package/dist/esm/services/ps-portable-text-link-service.js +19 -0
- package/dist/esm/services/ps-scroll-restore-service.js +52 -0
- package/dist/esm/services/ps-scroll-storage-service.js +66 -0
- package/dist/esm/services/ps-scroll-target-service.js +29 -0
- package/dist/esm/services/ps-text-link-service.js +9 -0
- package/dist/hooks/use-ps-browser-layout-effect.d.ts +2 -0
- package/dist/hooks/use-ps-browser-layout-effect.js +5 -0
- package/dist/hooks/use-ps-scroll-restoration.d.ts +2 -0
- package/dist/hooks/use-ps-scroll-restoration.js +107 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +17 -0
- package/dist/models/ps-portable-text-image-data.d.ts +5 -0
- package/dist/models/ps-portable-text-image-data.js +2 -0
- package/dist/models/ps-portable-text-image-labels.d.ts +5 -0
- package/dist/models/ps-portable-text-image-labels.js +2 -0
- package/dist/models/ps-portable-text-message-props.d.ts +19 -0
- package/dist/models/ps-portable-text-message-props.js +2 -0
- package/dist/models/ps-scroll-offsets-data.d.ts +1 -0
- package/dist/models/ps-scroll-offsets-data.js +2 -0
- package/dist/models/ps-scroll-pending-save-data.d.ts +4 -0
- package/dist/models/ps-scroll-pending-save-data.js +2 -0
- package/dist/models/ps-scroll-restoration-options.d.ts +7 -0
- package/dist/models/ps-scroll-restoration-options.js +2 -0
- package/dist/services/ps-portable-text-link-service.d.ts +3 -0
- package/dist/services/ps-portable-text-link-service.js +19 -0
- package/dist/services/ps-scroll-restore-service.d.ts +3 -0
- package/dist/services/ps-scroll-restore-service.js +56 -0
- package/dist/services/ps-scroll-storage-service.d.ts +11 -0
- package/dist/services/ps-scroll-storage-service.js +70 -0
- package/dist/services/ps-scroll-target-service.d.ts +8 -0
- package/dist/services/ps-scroll-target-service.js +33 -0
- package/dist/services/ps-text-link-service.d.ts +1 -0
- package/dist/services/ps-text-link-service.js +9 -0
- package/package.json +2 -2
|
@@ -5,5 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const ps_design_system_1 = require("@pallasoft/ps-design-system");
|
|
6
6
|
const ps_button_classes_1 = require("../constants/ps-button-classes");
|
|
7
7
|
const ps_spinner_1 = require("./ps-spinner");
|
|
8
|
-
const PsButton = ({ children, className, disabled, isLabelHiddenOnMobile = false, isLoading = false, leadingIcon, loadingLabel, size = 'default', trailingIcon, type = 'button', variant = 'secondary', ...props }) => ((0, jsx_runtime_1.jsxs)("button", { className: ps_design_system_1.PallasoftClassNameService.merge(ps_button_classes_1.PsButtonBaseClassName,
|
|
8
|
+
const PsButton = ({ children, className, disabled, isLabelHiddenOnMobile = false, isLoading = false, leadingIcon, loadingLabel, size = 'default', trailingIcon, type = 'button', variant = 'secondary', ...props }) => ((0, jsx_runtime_1.jsxs)("button", { className: ps_design_system_1.PallasoftClassNameService.merge(ps_button_classes_1.PsButtonBaseClassName, isLoading && disabled !== true
|
|
9
|
+
? 'cursor-progress'
|
|
10
|
+
: 'disabled:cursor-not-allowed disabled:opacity-50', ps_button_classes_1.PsButtonSizeClassNames[size], isLabelHiddenOnMobile && leadingIcon ? 'min-w-11 max-sm:px-0' : '', ps_button_classes_1.PsButtonVariantClassNames[variant], className), "aria-busy": isLoading || undefined, disabled: disabled || isLoading, type: type, ...props, children: [isLoading ? ((0, jsx_runtime_1.jsx)(ps_spinner_1.PsSpinner, { className: 'absolute inset-0 m-auto', color: 'current', label: loadingLabel !== null && loadingLabel !== undefined ? loadingLabel : 'Loading', size: 'small' })) : null, (0, jsx_runtime_1.jsxs)("span", { "aria-hidden": isLoading || undefined, className: ps_design_system_1.PallasoftClassNameService.merge('inline-flex min-w-0 items-center gap-2', isLoading ? 'invisible' : ''), children: [leadingIcon ? (0, jsx_runtime_1.jsx)("span", { className: 'shrink-0', children: leadingIcon }) : null, (0, jsx_runtime_1.jsx)("span", { className: isLabelHiddenOnMobile && leadingIcon ? 'sr-only sm:not-sr-only sm:truncate' : 'truncate', children: children }), trailingIcon ? (0, jsx_runtime_1.jsx)("span", { className: 'shrink-0', children: trailingIcon }) : null] })] }));
|
|
9
11
|
exports.PsButton = PsButton;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PortableTextTypeComponentProps } from '@portabletext/react';
|
|
2
|
+
import type { PsPortableTextImageData } from '../models/ps-portable-text-image-data';
|
|
3
|
+
export interface PsPortableTextImageProps extends PortableTextTypeComponentProps<PsPortableTextImageData> {
|
|
4
|
+
hiddenLabel: string;
|
|
5
|
+
isShown: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const PsPortableTextImage: ({ hiddenLabel, isShown, value }: PsPortableTextImageProps) => import("react").JSX.Element | null;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PsPortableTextImage = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const ps_portable_text_message_config_1 = require("../constants/ps-portable-text-message-config");
|
|
6
|
+
const ps_portable_text_link_service_1 = require("../services/ps-portable-text-link-service");
|
|
7
|
+
const PsPortableTextImage = ({ hiddenLabel, isShown, value }) => {
|
|
8
|
+
if (typeof value.src !== 'string' || !ps_portable_text_link_service_1.PsPortableTextLinkService.isSafeImage(value.src))
|
|
9
|
+
return null;
|
|
10
|
+
const alt = typeof value.alt === 'string' ? value.alt : '';
|
|
11
|
+
if (!isShown)
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: ps_portable_text_message_config_1.PsPortableTextMessageConfig.placeholderClassName, children: alt === '' ? hiddenLabel : alt }));
|
|
13
|
+
return ((0, jsx_runtime_1.jsx)("img", { alt: alt, className: ps_portable_text_message_config_1.PsPortableTextMessageConfig.imageClassName, decoding: ps_portable_text_message_config_1.PsPortableTextMessageConfig.imageDecoding, loading: ps_portable_text_message_config_1.PsPortableTextMessageConfig.imageLoading, referrerPolicy: ps_portable_text_message_config_1.PsPortableTextMessageConfig.imageReferrerPolicy, src: value.src }));
|
|
14
|
+
};
|
|
15
|
+
exports.PsPortableTextImage = PsPortableTextImage;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { PsPortableTextMessageProps } from '../models/ps-portable-text-message-props';
|
|
2
|
+
export declare const PsPortableTextMessage: ({ containerClasses, containerStyles, imageLabels, isImagesShown, linkClassName, LinkComponent, text, }: PsPortableTextMessageProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PsPortableTextMessage = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const ps_design_system_1 = require("@pallasoft/ps-design-system");
|
|
7
|
+
const react_2 = require("@portabletext/react");
|
|
8
|
+
const ps_linked_text_link_rel_1 = require("../constants/ps-linked-text-link-rel");
|
|
9
|
+
const ps_portable_text_auto_link_type_1 = require("../constants/ps-portable-text-auto-link-type");
|
|
10
|
+
const ps_portable_text_message_config_1 = require("../constants/ps-portable-text-message-config");
|
|
11
|
+
const ps_portable_text_link_service_1 = require("../services/ps-portable-text-link-service");
|
|
12
|
+
const ps_portable_text_image_1 = require("./ps-portable-text-image");
|
|
13
|
+
const ps_text_link_1 = require("./ps-text-link");
|
|
14
|
+
const PsPortableTextMessage = ({ containerClasses, containerStyles, imageLabels, isImagesShown, linkClassName, LinkComponent, text, }) => {
|
|
15
|
+
const config = ps_portable_text_message_config_1.PsPortableTextMessageConfig;
|
|
16
|
+
const [isShown, setIsShown] = (0, react_1.useState)(isImagesShown);
|
|
17
|
+
const labels = { ...config.defaultLabels, ...imageLabels };
|
|
18
|
+
const linkClasses = linkClassName === undefined ? config.linkClassName : linkClassName;
|
|
19
|
+
const components = {
|
|
20
|
+
types: {
|
|
21
|
+
[config.imageType]: ({ value, ...props }) => ((0, jsx_runtime_1.jsx)(ps_portable_text_image_1.PsPortableTextImage, { ...props, hiddenLabel: labels.imageHidden, isShown: isShown, value: value })),
|
|
22
|
+
},
|
|
23
|
+
marks: {
|
|
24
|
+
code: ({ children }) => (0, jsx_runtime_1.jsx)("code", { className: config.codeClassName, children: children }),
|
|
25
|
+
em: ({ children }) => (0, jsx_runtime_1.jsx)("em", { children: children }),
|
|
26
|
+
strong: ({ children }) => (0, jsx_runtime_1.jsx)("strong", { children: children }),
|
|
27
|
+
underline: ({ children }) => (0, jsx_runtime_1.jsx)("u", { children: children }),
|
|
28
|
+
[ps_portable_text_auto_link_type_1.PsPortableTextAutoLinkType]: ({ children, value }) => ((0, jsx_runtime_1.jsx)("a", { className: linkClasses, href: value.href, rel: ps_linked_text_link_rel_1.PsLinkedTextLinkRel, target: config.linkTarget, children: children })),
|
|
29
|
+
link: ({ children, value }) => typeof value?.href === 'string' && ps_portable_text_link_service_1.PsPortableTextLinkService.isSafeLink(value.href) ? ((0, jsx_runtime_1.jsx)(LinkComponent, { className: linkClasses, href: value.href, rel: config.linkRel, target: config.linkTarget, children: children })) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children })),
|
|
30
|
+
},
|
|
31
|
+
list: {
|
|
32
|
+
bullet: ({ children }) => (0, jsx_runtime_1.jsx)("ul", { className: config.bulletListClassName, children: children }),
|
|
33
|
+
number: ({ children }) => (0, jsx_runtime_1.jsx)("ol", { className: config.numberListClassName, children: children }),
|
|
34
|
+
},
|
|
35
|
+
listItem: {
|
|
36
|
+
bullet: ({ children }) => (0, jsx_runtime_1.jsx)("li", { className: config.listItemClassName, children: children }),
|
|
37
|
+
number: ({ children }) => (0, jsx_runtime_1.jsx)("li", { className: config.listItemClassName, children: children }),
|
|
38
|
+
},
|
|
39
|
+
block: {
|
|
40
|
+
normal: ({ children }) => (0, jsx_runtime_1.jsx)("p", { className: config.paragraphClassName, children: children }),
|
|
41
|
+
blockquote: ({ children }) => ((0, jsx_runtime_1.jsx)("blockquote", { className: config.quoteClassName, children: children })),
|
|
42
|
+
h1: ({ children }) => (0, jsx_runtime_1.jsx)("h3", { className: config.headingClassNames.h1, children: children }),
|
|
43
|
+
h2: ({ children }) => (0, jsx_runtime_1.jsx)("h4", { className: config.headingClassNames.h2, children: children }),
|
|
44
|
+
h3: ({ children }) => (0, jsx_runtime_1.jsx)("h5", { className: config.headingClassNames.h3, children: children }),
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: ps_design_system_1.PallasoftClassNameService.merge(config.rootClassName, containerClasses), style: containerStyles, children: [!isShown && ps_portable_text_link_service_1.PsPortableTextLinkService.hasImages(text) ? ((0, jsx_runtime_1.jsxs)("p", { className: config.imageBarClassName, children: [(0, jsx_runtime_1.jsx)("span", { children: labels.imagesHidden }), (0, jsx_runtime_1.jsx)(ps_text_link_1.PsTextLink, { onClick: () => setIsShown(true), size: 'compact', children: labels.showImages })] })) : null, (0, jsx_runtime_1.jsx)(react_2.PortableText, { components: components, value: ps_portable_text_link_service_1.PsPortableTextLinkService.linkify(text) })] }));
|
|
48
|
+
};
|
|
49
|
+
exports.PsPortableTextMessage = PsPortableTextMessage;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import type { CSSProperties, ElementType, ReactNode } from 'react';
|
|
2
2
|
import { TypedObject } from '@portabletext/types';
|
|
3
|
+
import { PsPortableTextVariant } from '../constants/ps-portable-text-variant';
|
|
4
|
+
import type { PsPortableTextImageLabels } from '../models/ps-portable-text-image-labels';
|
|
3
5
|
export interface PsPortableTextProps {
|
|
4
6
|
bodyClasses?: string;
|
|
5
7
|
containerClasses?: string;
|
|
6
8
|
containerStyles?: CSSProperties;
|
|
7
9
|
headerClasses?: string;
|
|
10
|
+
imageLabels?: Partial<PsPortableTextImageLabels>;
|
|
11
|
+
isImagesShown?: boolean;
|
|
8
12
|
isLargeBodyFont?: boolean;
|
|
9
13
|
linkClassName?: string;
|
|
10
14
|
LinkComponent?: ElementType<{
|
|
@@ -16,5 +20,6 @@ export interface PsPortableTextProps {
|
|
|
16
20
|
}>;
|
|
17
21
|
listClasses?: string;
|
|
18
22
|
text: TypedObject[];
|
|
23
|
+
variant?: PsPortableTextVariant;
|
|
19
24
|
}
|
|
20
|
-
export declare const PsPortableText: ({ bodyClasses, containerClasses, containerStyles, headerClasses, isLargeBodyFont, linkClassName, LinkComponent, listClasses, text, }: PsPortableTextProps) => import("react").JSX.Element;
|
|
25
|
+
export declare const PsPortableText: ({ bodyClasses, containerClasses, containerStyles, headerClasses, imageLabels, isImagesShown, isLargeBodyFont, linkClassName, LinkComponent, listClasses, text, variant, }: PsPortableTextProps) => import("react").JSX.Element;
|
|
@@ -7,19 +7,24 @@ const react_1 = require("@portabletext/react");
|
|
|
7
7
|
const ps_linked_text_link_rel_1 = require("../constants/ps-linked-text-link-rel");
|
|
8
8
|
const ps_portable_text_auto_link_type_1 = require("../constants/ps-portable-text-auto-link-type");
|
|
9
9
|
const ps_portable_text_link_class_name_1 = require("../constants/ps-portable-text-link-class-name");
|
|
10
|
+
const ps_portable_text_variant_1 = require("../constants/ps-portable-text-variant");
|
|
10
11
|
const ps_text_wrap_class_name_1 = require("../constants/ps-text-wrap-class-name");
|
|
11
12
|
const ps_portable_text_link_service_1 = require("../services/ps-portable-text-link-service");
|
|
12
|
-
const
|
|
13
|
+
const ps_portable_text_message_1 = require("./ps-portable-text-message");
|
|
14
|
+
const PsPortableText = ({ bodyClasses = 'text-ink', containerClasses = '', containerStyles = {}, headerClasses = 'text-ink', imageLabels, isImagesShown = false, isLargeBodyFont = false, linkClassName, LinkComponent = 'a', listClasses = 'text-ink', text, variant = ps_portable_text_variant_1.PsPortableTextVariant.Article, }) => {
|
|
15
|
+
if (variant === ps_portable_text_variant_1.PsPortableTextVariant.Message)
|
|
16
|
+
return ((0, jsx_runtime_1.jsx)(ps_portable_text_message_1.PsPortableTextMessage, { containerClasses: containerClasses, containerStyles: containerStyles, imageLabels: imageLabels, isImagesShown: isImagesShown, linkClassName: linkClassName, LinkComponent: LinkComponent, text: text }));
|
|
17
|
+
const articleLinkClassName = linkClassName === undefined ? ps_portable_text_link_class_name_1.PsPortableTextLinkClassName : linkClassName;
|
|
13
18
|
const hasContainerStyles = Object.keys(containerStyles).length > 0;
|
|
14
19
|
const getBodyClass = hasContainerStyles ? '' : bodyClasses;
|
|
15
20
|
const getHeaderClass = hasContainerStyles ? '' : headerClasses;
|
|
16
21
|
const getListClass = hasContainerStyles ? '' : listClasses;
|
|
17
22
|
const components = {
|
|
18
23
|
marks: {
|
|
19
|
-
[ps_portable_text_auto_link_type_1.PsPortableTextAutoLinkType]: ({ children, value }) => ((0, jsx_runtime_1.jsx)("a", { href: value.href, target: '_blank', rel: ps_linked_text_link_rel_1.PsLinkedTextLinkRel, className:
|
|
24
|
+
[ps_portable_text_auto_link_type_1.PsPortableTextAutoLinkType]: ({ children, value }) => ((0, jsx_runtime_1.jsx)("a", { href: value.href, target: '_blank', rel: ps_linked_text_link_rel_1.PsLinkedTextLinkRel, className: articleLinkClassName, children: children })),
|
|
20
25
|
link: ({ children, value }) => {
|
|
21
26
|
const rel = !value.href.startsWith('/') ? 'noreferrer noopener' : undefined;
|
|
22
|
-
return ((0, jsx_runtime_1.jsx)(LinkComponent, { href: value.href, rel: rel, className:
|
|
27
|
+
return ((0, jsx_runtime_1.jsx)(LinkComponent, { href: value.href, rel: rel, className: articleLinkClassName, "aria-label": value.children, children: children }));
|
|
23
28
|
},
|
|
24
29
|
},
|
|
25
30
|
list: {
|
|
@@ -4,9 +4,11 @@ export interface PsReflectiveAppShellProps {
|
|
|
4
4
|
className?: string;
|
|
5
5
|
contentClassName?: string;
|
|
6
6
|
frameClassName?: string;
|
|
7
|
+
scrollPreventReset?: boolean;
|
|
7
8
|
scrollResetKey?: string;
|
|
9
|
+
scrollRestoreKey?: string;
|
|
8
10
|
sidebar: ReactNode;
|
|
9
11
|
sidebarWidth?: string;
|
|
10
12
|
topbar: ReactNode;
|
|
11
13
|
}
|
|
12
|
-
export declare const PsReflectiveAppShell: ({ children, className, contentClassName, frameClassName, scrollResetKey, sidebar, sidebarWidth, topbar, }: PsReflectiveAppShellProps) => import("react").JSX.Element;
|
|
14
|
+
export declare const PsReflectiveAppShell: ({ children, className, contentClassName, frameClassName, scrollPreventReset, scrollResetKey, scrollRestoreKey, sidebar, sidebarWidth, topbar, }: PsReflectiveAppShellProps) => import("react").JSX.Element;
|
|
@@ -4,14 +4,21 @@ exports.PsReflectiveAppShell = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const ps_design_system_1 = require("@pallasoft/ps-design-system");
|
|
7
|
-
const
|
|
7
|
+
const use_ps_scroll_restoration_1 = require("../hooks/use-ps-scroll-restoration");
|
|
8
|
+
const PsReflectiveAppShell = ({ children, className, contentClassName, frameClassName, scrollPreventReset, scrollResetKey, scrollRestoreKey, sidebar, sidebarWidth = '17rem', topbar, }) => {
|
|
8
9
|
const contentRef = (0, react_1.useRef)(null);
|
|
10
|
+
(0, use_ps_scroll_restoration_1.usePsScrollRestoration)({
|
|
11
|
+
elementRef: contentRef,
|
|
12
|
+
preventScrollReset: scrollPreventReset,
|
|
13
|
+
resetKey: scrollResetKey,
|
|
14
|
+
restoreKey: scrollRestoreKey,
|
|
15
|
+
});
|
|
9
16
|
(0, react_1.useLayoutEffect)(() => {
|
|
10
|
-
if (scrollResetKey === undefined)
|
|
17
|
+
if (scrollResetKey === undefined || scrollRestoreKey !== undefined)
|
|
11
18
|
return;
|
|
12
19
|
contentRef.current?.scrollTo({ top: 0, left: 0 });
|
|
13
20
|
window.scrollTo({ top: 0, left: 0 });
|
|
14
|
-
}, [scrollResetKey]);
|
|
21
|
+
}, [scrollResetKey, scrollRestoreKey]);
|
|
15
22
|
return ((0, jsx_runtime_1.jsx)("section", { className: ps_design_system_1.PallasoftClassNameService.merge('ps-reflective-frame h-[100dvh] overflow-hidden text-ink', className), children: (0, jsx_runtime_1.jsxs)("div", { className: ps_design_system_1.PallasoftClassNameService.merge('ps-liquid-strong grid h-full min-h-0 w-full overflow-hidden border-line/70 bg-white/70 backdrop-blur-2xl transition-[grid-template-columns] duration-200 dark:border-white/10 dark:bg-surface/70 md:grid-cols-[var(--ps-sidebar-width)_minmax(0,1fr)]', frameClassName), style: { ['--ps-sidebar-width']: sidebarWidth }, children: [sidebar, (0, jsx_runtime_1.jsxs)("div", { className: 'flex min-h-0 min-w-0 flex-col bg-white/32 dark:bg-white/[0.02]', children: [topbar, (0, jsx_runtime_1.jsx)("main", { ref: contentRef, className: ps_design_system_1.PallasoftClassNameService.merge('ps-scrollbar min-h-0 flex-1 overflow-y-auto px-4 ps-page-enter sm:px-5 lg:px-6 xl:px-7', contentClassName), children: (0, jsx_runtime_1.jsx)("div", { className: 'py-5', children: children }) })] })] }) }));
|
|
16
23
|
};
|
|
17
24
|
exports.PsReflectiveAppShell = PsReflectiveAppShell;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PsScrollRestoration = void 0;
|
|
4
|
+
const use_ps_scroll_restoration_1 = require("../hooks/use-ps-scroll-restoration");
|
|
5
|
+
const PsScrollRestoration = ({ preventScrollReset, resetKey, restoreKey, }) => {
|
|
6
|
+
(0, use_ps_scroll_restoration_1.usePsScrollRestoration)({ preventScrollReset, resetKey, restoreKey });
|
|
7
|
+
return null;
|
|
8
|
+
};
|
|
9
|
+
exports.PsScrollRestoration = PsScrollRestoration;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare const PsPortableTextMessageConfig: {
|
|
2
|
+
readonly rootClassName: "flex min-w-0 flex-col gap-3 text-sm leading-6 text-inherit [overflow-wrap:anywhere]";
|
|
3
|
+
readonly paragraphClassName: "whitespace-pre-line";
|
|
4
|
+
readonly quoteClassName: "whitespace-pre-line border-l-2 border-line pl-3 opacity-80";
|
|
5
|
+
readonly linkClassName: "underline underline-offset-2";
|
|
6
|
+
readonly codeClassName: "rounded bg-ink/10 px-1 font-mono text-[0.85em]";
|
|
7
|
+
readonly bulletListClassName: "flex list-disc flex-col gap-1 pl-5";
|
|
8
|
+
readonly numberListClassName: "flex list-decimal flex-col gap-1 pl-5";
|
|
9
|
+
readonly listItemClassName: "whitespace-pre-line";
|
|
10
|
+
readonly defaultLabels: {
|
|
11
|
+
imageHidden: string;
|
|
12
|
+
imagesHidden: string;
|
|
13
|
+
showImages: string;
|
|
14
|
+
};
|
|
15
|
+
readonly imageBarClassName: "flex flex-wrap items-center gap-x-2 gap-y-1 text-xs opacity-70";
|
|
16
|
+
readonly placeholderClassName: "flex min-h-10 items-center rounded-ps-control border border-dashed border-line px-3 py-2 text-xs opacity-70";
|
|
17
|
+
readonly imageClassName: "h-auto max-w-full rounded-ps-control border border-line";
|
|
18
|
+
readonly headingClassNames: {
|
|
19
|
+
readonly h1: "mt-1 text-lg font-semibold leading-snug";
|
|
20
|
+
readonly h2: "mt-1 text-base font-semibold leading-snug";
|
|
21
|
+
readonly h3: "mt-1 text-sm font-semibold leading-snug";
|
|
22
|
+
};
|
|
23
|
+
readonly linkRel: "noopener noreferrer";
|
|
24
|
+
readonly linkTarget: "_blank";
|
|
25
|
+
readonly imageLoading: "lazy";
|
|
26
|
+
readonly imageDecoding: "async";
|
|
27
|
+
readonly imageReferrerPolicy: "no-referrer";
|
|
28
|
+
readonly imageType: "image";
|
|
29
|
+
readonly imageProtocolPattern: RegExp;
|
|
30
|
+
readonly relativePrefix: "/";
|
|
31
|
+
readonly protocolRelativePrefix: "//";
|
|
32
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PsPortableTextMessageConfig = void 0;
|
|
4
|
+
exports.PsPortableTextMessageConfig = {
|
|
5
|
+
rootClassName: 'flex min-w-0 flex-col gap-3 text-sm leading-6 text-inherit [overflow-wrap:anywhere]',
|
|
6
|
+
paragraphClassName: 'whitespace-pre-line',
|
|
7
|
+
quoteClassName: 'whitespace-pre-line border-l-2 border-line pl-3 opacity-80',
|
|
8
|
+
linkClassName: 'underline underline-offset-2',
|
|
9
|
+
codeClassName: 'rounded bg-ink/10 px-1 font-mono text-[0.85em]',
|
|
10
|
+
bulletListClassName: 'flex list-disc flex-col gap-1 pl-5',
|
|
11
|
+
numberListClassName: 'flex list-decimal flex-col gap-1 pl-5',
|
|
12
|
+
listItemClassName: 'whitespace-pre-line',
|
|
13
|
+
defaultLabels: {
|
|
14
|
+
imageHidden: 'Image not shown',
|
|
15
|
+
imagesHidden: 'Images are hidden to protect your privacy.',
|
|
16
|
+
showImages: 'Show images',
|
|
17
|
+
},
|
|
18
|
+
imageBarClassName: 'flex flex-wrap items-center gap-x-2 gap-y-1 text-xs opacity-70',
|
|
19
|
+
placeholderClassName: 'flex min-h-10 items-center rounded-ps-control border border-dashed border-line px-3 py-2 text-xs opacity-70',
|
|
20
|
+
imageClassName: 'h-auto max-w-full rounded-ps-control border border-line',
|
|
21
|
+
headingClassNames: {
|
|
22
|
+
h1: 'mt-1 text-lg font-semibold leading-snug',
|
|
23
|
+
h2: 'mt-1 text-base font-semibold leading-snug',
|
|
24
|
+
h3: 'mt-1 text-sm font-semibold leading-snug',
|
|
25
|
+
},
|
|
26
|
+
linkRel: 'noopener noreferrer',
|
|
27
|
+
linkTarget: '_blank',
|
|
28
|
+
imageLoading: 'lazy',
|
|
29
|
+
imageDecoding: 'async',
|
|
30
|
+
imageReferrerPolicy: 'no-referrer',
|
|
31
|
+
imageType: 'image',
|
|
32
|
+
imageProtocolPattern: /^https?:\/\//i,
|
|
33
|
+
relativePrefix: '/',
|
|
34
|
+
protocolRelativePrefix: '//',
|
|
35
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PsPortableTextVariant = void 0;
|
|
4
|
+
var PsPortableTextVariant;
|
|
5
|
+
(function (PsPortableTextVariant) {
|
|
6
|
+
PsPortableTextVariant["Article"] = "article";
|
|
7
|
+
PsPortableTextVariant["Message"] = "message";
|
|
8
|
+
})(PsPortableTextVariant || (exports.PsPortableTextVariant = PsPortableTextVariant = {}));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const PsScrollRestorationConfig: {
|
|
2
|
+
readonly elementScope: "element:";
|
|
3
|
+
readonly inputEvents: readonly ["wheel", "touchstart", "keydown", "mousedown"];
|
|
4
|
+
readonly maxEntries: 100;
|
|
5
|
+
readonly persistThrottleMs: 150;
|
|
6
|
+
readonly restoreTimeoutMs: 4000;
|
|
7
|
+
readonly storageKey: "ps-scroll-restoration";
|
|
8
|
+
readonly tolerancePx: 2;
|
|
9
|
+
readonly windowScope: "window:";
|
|
10
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PsScrollRestorationConfig = void 0;
|
|
4
|
+
exports.PsScrollRestorationConfig = {
|
|
5
|
+
elementScope: 'element:',
|
|
6
|
+
inputEvents: ['wheel', 'touchstart', 'keydown', 'mousedown'],
|
|
7
|
+
maxEntries: 100,
|
|
8
|
+
persistThrottleMs: 150,
|
|
9
|
+
restoreTimeoutMs: 4000,
|
|
10
|
+
storageKey: 'ps-scroll-restoration',
|
|
11
|
+
tolerancePx: 2,
|
|
12
|
+
windowScope: 'window:',
|
|
13
|
+
};
|
|
@@ -2,4 +2,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { PallasoftClassNameService } from '@pallasoft/ps-design-system';
|
|
3
3
|
import { PsButtonBaseClassName, PsButtonSizeClassNames, PsButtonVariantClassNames, } from '../constants/ps-button-classes.js';
|
|
4
4
|
import { PsSpinner } from './ps-spinner.js';
|
|
5
|
-
export const PsButton = ({ children, className, disabled, isLabelHiddenOnMobile = false, isLoading = false, leadingIcon, loadingLabel, size = 'default', trailingIcon, type = 'button', variant = 'secondary', ...props }) => (_jsxs("button", { className: PallasoftClassNameService.merge(PsButtonBaseClassName,
|
|
5
|
+
export const PsButton = ({ children, className, disabled, isLabelHiddenOnMobile = false, isLoading = false, leadingIcon, loadingLabel, size = 'default', trailingIcon, type = 'button', variant = 'secondary', ...props }) => (_jsxs("button", { className: PallasoftClassNameService.merge(PsButtonBaseClassName, isLoading && disabled !== true
|
|
6
|
+
? 'cursor-progress'
|
|
7
|
+
: 'disabled:cursor-not-allowed disabled:opacity-50', PsButtonSizeClassNames[size], isLabelHiddenOnMobile && leadingIcon ? 'min-w-11 max-sm:px-0' : '', PsButtonVariantClassNames[variant], className), "aria-busy": isLoading || undefined, disabled: disabled || isLoading, type: type, ...props, children: [isLoading ? (_jsx(PsSpinner, { className: 'absolute inset-0 m-auto', color: 'current', label: loadingLabel !== null && loadingLabel !== undefined ? loadingLabel : 'Loading', size: 'small' })) : null, _jsxs("span", { "aria-hidden": isLoading || undefined, className: PallasoftClassNameService.merge('inline-flex min-w-0 items-center gap-2', isLoading ? 'invisible' : ''), children: [leadingIcon ? _jsx("span", { className: 'shrink-0', children: leadingIcon }) : null, _jsx("span", { className: isLabelHiddenOnMobile && leadingIcon ? 'sr-only sm:not-sr-only sm:truncate' : 'truncate', children: children }), trailingIcon ? _jsx("span", { className: 'shrink-0', children: trailingIcon }) : null] })] }));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { PsPortableTextMessageConfig } from '../constants/ps-portable-text-message-config.js';
|
|
3
|
+
import { PsPortableTextLinkService } from '../services/ps-portable-text-link-service.js';
|
|
4
|
+
export const PsPortableTextImage = ({ hiddenLabel, isShown, value }) => {
|
|
5
|
+
if (typeof value.src !== 'string' || !PsPortableTextLinkService.isSafeImage(value.src))
|
|
6
|
+
return null;
|
|
7
|
+
const alt = typeof value.alt === 'string' ? value.alt : '';
|
|
8
|
+
if (!isShown)
|
|
9
|
+
return (_jsx("div", { className: PsPortableTextMessageConfig.placeholderClassName, children: alt === '' ? hiddenLabel : alt }));
|
|
10
|
+
return (_jsx("img", { alt: alt, className: PsPortableTextMessageConfig.imageClassName, decoding: PsPortableTextMessageConfig.imageDecoding, loading: PsPortableTextMessageConfig.imageLoading, referrerPolicy: PsPortableTextMessageConfig.imageReferrerPolicy, src: value.src }));
|
|
11
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { PallasoftClassNameService } from '@pallasoft/ps-design-system';
|
|
4
|
+
import { PortableText as Text } from '@portabletext/react';
|
|
5
|
+
import { PsLinkedTextLinkRel } from '../constants/ps-linked-text-link-rel.js';
|
|
6
|
+
import { PsPortableTextAutoLinkType } from '../constants/ps-portable-text-auto-link-type.js';
|
|
7
|
+
import { PsPortableTextMessageConfig } from '../constants/ps-portable-text-message-config.js';
|
|
8
|
+
import { PsPortableTextLinkService } from '../services/ps-portable-text-link-service.js';
|
|
9
|
+
import { PsPortableTextImage } from './ps-portable-text-image.js';
|
|
10
|
+
import { PsTextLink } from './ps-text-link.js';
|
|
11
|
+
export const PsPortableTextMessage = ({ containerClasses, containerStyles, imageLabels, isImagesShown, linkClassName, LinkComponent, text, }) => {
|
|
12
|
+
const config = PsPortableTextMessageConfig;
|
|
13
|
+
const [isShown, setIsShown] = useState(isImagesShown);
|
|
14
|
+
const labels = { ...config.defaultLabels, ...imageLabels };
|
|
15
|
+
const linkClasses = linkClassName === undefined ? config.linkClassName : linkClassName;
|
|
16
|
+
const components = {
|
|
17
|
+
types: {
|
|
18
|
+
[config.imageType]: ({ value, ...props }) => (_jsx(PsPortableTextImage, { ...props, hiddenLabel: labels.imageHidden, isShown: isShown, value: value })),
|
|
19
|
+
},
|
|
20
|
+
marks: {
|
|
21
|
+
code: ({ children }) => _jsx("code", { className: config.codeClassName, children: children }),
|
|
22
|
+
em: ({ children }) => _jsx("em", { children: children }),
|
|
23
|
+
strong: ({ children }) => _jsx("strong", { children: children }),
|
|
24
|
+
underline: ({ children }) => _jsx("u", { children: children }),
|
|
25
|
+
[PsPortableTextAutoLinkType]: ({ children, value }) => (_jsx("a", { className: linkClasses, href: value.href, rel: PsLinkedTextLinkRel, target: config.linkTarget, children: children })),
|
|
26
|
+
link: ({ children, value }) => typeof value?.href === 'string' && PsPortableTextLinkService.isSafeLink(value.href) ? (_jsx(LinkComponent, { className: linkClasses, href: value.href, rel: config.linkRel, target: config.linkTarget, children: children })) : (_jsx(_Fragment, { children: children })),
|
|
27
|
+
},
|
|
28
|
+
list: {
|
|
29
|
+
bullet: ({ children }) => _jsx("ul", { className: config.bulletListClassName, children: children }),
|
|
30
|
+
number: ({ children }) => _jsx("ol", { className: config.numberListClassName, children: children }),
|
|
31
|
+
},
|
|
32
|
+
listItem: {
|
|
33
|
+
bullet: ({ children }) => _jsx("li", { className: config.listItemClassName, children: children }),
|
|
34
|
+
number: ({ children }) => _jsx("li", { className: config.listItemClassName, children: children }),
|
|
35
|
+
},
|
|
36
|
+
block: {
|
|
37
|
+
normal: ({ children }) => _jsx("p", { className: config.paragraphClassName, children: children }),
|
|
38
|
+
blockquote: ({ children }) => (_jsx("blockquote", { className: config.quoteClassName, children: children })),
|
|
39
|
+
h1: ({ children }) => _jsx("h3", { className: config.headingClassNames.h1, children: children }),
|
|
40
|
+
h2: ({ children }) => _jsx("h4", { className: config.headingClassNames.h2, children: children }),
|
|
41
|
+
h3: ({ children }) => _jsx("h5", { className: config.headingClassNames.h3, children: children }),
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
return (_jsxs("div", { className: PallasoftClassNameService.merge(config.rootClassName, containerClasses), style: containerStyles, children: [!isShown && PsPortableTextLinkService.hasImages(text) ? (_jsxs("p", { className: config.imageBarClassName, children: [_jsx("span", { children: labels.imagesHidden }), _jsx(PsTextLink, { onClick: () => setIsShown(true), size: 'compact', children: labels.showImages })] })) : null, _jsx(Text, { components: components, value: PsPortableTextLinkService.linkify(text) })] }));
|
|
45
|
+
};
|
|
@@ -4,19 +4,24 @@ import { PortableText as Text } from '@portabletext/react';
|
|
|
4
4
|
import { PsLinkedTextLinkRel } from '../constants/ps-linked-text-link-rel.js';
|
|
5
5
|
import { PsPortableTextAutoLinkType } from '../constants/ps-portable-text-auto-link-type.js';
|
|
6
6
|
import { PsPortableTextLinkClassName } from '../constants/ps-portable-text-link-class-name.js';
|
|
7
|
+
import { PsPortableTextVariant } from '../constants/ps-portable-text-variant.js';
|
|
7
8
|
import { PsTextWrapClassName } from '../constants/ps-text-wrap-class-name.js';
|
|
8
9
|
import { PsPortableTextLinkService } from '../services/ps-portable-text-link-service.js';
|
|
9
|
-
|
|
10
|
+
import { PsPortableTextMessage } from './ps-portable-text-message.js';
|
|
11
|
+
export const PsPortableText = ({ bodyClasses = 'text-ink', containerClasses = '', containerStyles = {}, headerClasses = 'text-ink', imageLabels, isImagesShown = false, isLargeBodyFont = false, linkClassName, LinkComponent = 'a', listClasses = 'text-ink', text, variant = PsPortableTextVariant.Article, }) => {
|
|
12
|
+
if (variant === PsPortableTextVariant.Message)
|
|
13
|
+
return (_jsx(PsPortableTextMessage, { containerClasses: containerClasses, containerStyles: containerStyles, imageLabels: imageLabels, isImagesShown: isImagesShown, linkClassName: linkClassName, LinkComponent: LinkComponent, text: text }));
|
|
14
|
+
const articleLinkClassName = linkClassName === undefined ? PsPortableTextLinkClassName : linkClassName;
|
|
10
15
|
const hasContainerStyles = Object.keys(containerStyles).length > 0;
|
|
11
16
|
const getBodyClass = hasContainerStyles ? '' : bodyClasses;
|
|
12
17
|
const getHeaderClass = hasContainerStyles ? '' : headerClasses;
|
|
13
18
|
const getListClass = hasContainerStyles ? '' : listClasses;
|
|
14
19
|
const components = {
|
|
15
20
|
marks: {
|
|
16
|
-
[PsPortableTextAutoLinkType]: ({ children, value }) => (_jsx("a", { href: value.href, target: '_blank', rel: PsLinkedTextLinkRel, className:
|
|
21
|
+
[PsPortableTextAutoLinkType]: ({ children, value }) => (_jsx("a", { href: value.href, target: '_blank', rel: PsLinkedTextLinkRel, className: articleLinkClassName, children: children })),
|
|
17
22
|
link: ({ children, value }) => {
|
|
18
23
|
const rel = !value.href.startsWith('/') ? 'noreferrer noopener' : undefined;
|
|
19
|
-
return (_jsx(LinkComponent, { href: value.href, rel: rel, className:
|
|
24
|
+
return (_jsx(LinkComponent, { href: value.href, rel: rel, className: articleLinkClassName, "aria-label": value.children, children: children }));
|
|
20
25
|
},
|
|
21
26
|
},
|
|
22
27
|
list: {
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useLayoutEffect, useRef } from 'react';
|
|
3
3
|
import { PallasoftClassNameService } from '@pallasoft/ps-design-system';
|
|
4
|
-
|
|
4
|
+
import { usePsScrollRestoration } from '../hooks/use-ps-scroll-restoration.js';
|
|
5
|
+
export const PsReflectiveAppShell = ({ children, className, contentClassName, frameClassName, scrollPreventReset, scrollResetKey, scrollRestoreKey, sidebar, sidebarWidth = '17rem', topbar, }) => {
|
|
5
6
|
const contentRef = useRef(null);
|
|
7
|
+
usePsScrollRestoration({
|
|
8
|
+
elementRef: contentRef,
|
|
9
|
+
preventScrollReset: scrollPreventReset,
|
|
10
|
+
resetKey: scrollResetKey,
|
|
11
|
+
restoreKey: scrollRestoreKey,
|
|
12
|
+
});
|
|
6
13
|
useLayoutEffect(() => {
|
|
7
|
-
if (scrollResetKey === undefined)
|
|
14
|
+
if (scrollResetKey === undefined || scrollRestoreKey !== undefined)
|
|
8
15
|
return;
|
|
9
16
|
contentRef.current?.scrollTo({ top: 0, left: 0 });
|
|
10
17
|
window.scrollTo({ top: 0, left: 0 });
|
|
11
|
-
}, [scrollResetKey]);
|
|
18
|
+
}, [scrollResetKey, scrollRestoreKey]);
|
|
12
19
|
return (_jsx("section", { className: PallasoftClassNameService.merge('ps-reflective-frame h-[100dvh] overflow-hidden text-ink', className), children: _jsxs("div", { className: PallasoftClassNameService.merge('ps-liquid-strong grid h-full min-h-0 w-full overflow-hidden border-line/70 bg-white/70 backdrop-blur-2xl transition-[grid-template-columns] duration-200 dark:border-white/10 dark:bg-surface/70 md:grid-cols-[var(--ps-sidebar-width)_minmax(0,1fr)]', frameClassName), style: { ['--ps-sidebar-width']: sidebarWidth }, children: [sidebar, _jsxs("div", { className: 'flex min-h-0 min-w-0 flex-col bg-white/32 dark:bg-white/[0.02]', children: [topbar, _jsx("main", { ref: contentRef, className: PallasoftClassNameService.merge('ps-scrollbar min-h-0 flex-1 overflow-y-auto px-4 ps-page-enter sm:px-5 lg:px-6 xl:px-7', contentClassName), children: _jsx("div", { className: 'py-5', children: children }) })] })] }) }));
|
|
13
20
|
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export const PsPortableTextMessageConfig = {
|
|
2
|
+
rootClassName: 'flex min-w-0 flex-col gap-3 text-sm leading-6 text-inherit [overflow-wrap:anywhere]',
|
|
3
|
+
paragraphClassName: 'whitespace-pre-line',
|
|
4
|
+
quoteClassName: 'whitespace-pre-line border-l-2 border-line pl-3 opacity-80',
|
|
5
|
+
linkClassName: 'underline underline-offset-2',
|
|
6
|
+
codeClassName: 'rounded bg-ink/10 px-1 font-mono text-[0.85em]',
|
|
7
|
+
bulletListClassName: 'flex list-disc flex-col gap-1 pl-5',
|
|
8
|
+
numberListClassName: 'flex list-decimal flex-col gap-1 pl-5',
|
|
9
|
+
listItemClassName: 'whitespace-pre-line',
|
|
10
|
+
defaultLabels: {
|
|
11
|
+
imageHidden: 'Image not shown',
|
|
12
|
+
imagesHidden: 'Images are hidden to protect your privacy.',
|
|
13
|
+
showImages: 'Show images',
|
|
14
|
+
},
|
|
15
|
+
imageBarClassName: 'flex flex-wrap items-center gap-x-2 gap-y-1 text-xs opacity-70',
|
|
16
|
+
placeholderClassName: 'flex min-h-10 items-center rounded-ps-control border border-dashed border-line px-3 py-2 text-xs opacity-70',
|
|
17
|
+
imageClassName: 'h-auto max-w-full rounded-ps-control border border-line',
|
|
18
|
+
headingClassNames: {
|
|
19
|
+
h1: 'mt-1 text-lg font-semibold leading-snug',
|
|
20
|
+
h2: 'mt-1 text-base font-semibold leading-snug',
|
|
21
|
+
h3: 'mt-1 text-sm font-semibold leading-snug',
|
|
22
|
+
},
|
|
23
|
+
linkRel: 'noopener noreferrer',
|
|
24
|
+
linkTarget: '_blank',
|
|
25
|
+
imageLoading: 'lazy',
|
|
26
|
+
imageDecoding: 'async',
|
|
27
|
+
imageReferrerPolicy: 'no-referrer',
|
|
28
|
+
imageType: 'image',
|
|
29
|
+
imageProtocolPattern: /^https?:\/\//i,
|
|
30
|
+
relativePrefix: '/',
|
|
31
|
+
protocolRelativePrefix: '//',
|
|
32
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const PsScrollRestorationConfig = {
|
|
2
|
+
elementScope: 'element:',
|
|
3
|
+
inputEvents: ['wheel', 'touchstart', 'keydown', 'mousedown'],
|
|
4
|
+
maxEntries: 100,
|
|
5
|
+
persistThrottleMs: 150,
|
|
6
|
+
restoreTimeoutMs: 4000,
|
|
7
|
+
storageKey: 'ps-scroll-restoration',
|
|
8
|
+
tolerancePx: 2,
|
|
9
|
+
windowScope: 'window:',
|
|
10
|
+
};
|