lupine.components 1.1.38 → 1.1.40
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/package.json +1 -1
- package/src/component-pool/i-editor/i-editor-demo.tsx +2 -1
- package/src/component-pool/index.ts +3 -0
- package/src/components/float-window.tsx +2 -0
- package/src/components/html-var.tsx +3 -3
- package/src/frames/responsive-frame.tsx +5 -2
- package/src/frames/top-frame.tsx +16 -3
- package/src/lib/encode-html.ts +5 -3
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@ import { CssProps, RefProps } from 'lupine.web';
|
|
|
2
2
|
import { DemoStory } from '../../demo/demo-types';
|
|
3
3
|
import { IEditor } from './i-editor';
|
|
4
4
|
|
|
5
|
-
export const IEditorDemoPage = () => {
|
|
5
|
+
export const IEditorDemoPage = (props: { css?: CssProps }) => {
|
|
6
6
|
let editor: IEditor | undefined;
|
|
7
7
|
|
|
8
8
|
const ref: RefProps = {
|
|
@@ -42,6 +42,7 @@ export const IEditorDemoPage = () => {
|
|
|
42
42
|
width: '100%',
|
|
43
43
|
height: '100%',
|
|
44
44
|
},
|
|
45
|
+
...props.css,
|
|
45
46
|
};
|
|
46
47
|
|
|
47
48
|
return (
|
|
@@ -146,6 +146,8 @@ export class FloatWindow {
|
|
|
146
146
|
padding: '15px',
|
|
147
147
|
maxHeight: contentMaxHeight ? `min(${contentMaxHeight}, calc(100% - 100px))` : 'calc(100% - 100px)',
|
|
148
148
|
overflowY: contentOverflowY,
|
|
149
|
+
boxSizing: 'border-box',
|
|
150
|
+
width: '100%',
|
|
149
151
|
},
|
|
150
152
|
'.fwin-bottom': {
|
|
151
153
|
display: 'flex',
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { RefProps, VNode } from 'lupine.web';
|
|
2
2
|
|
|
3
|
-
export type HtmlVarValueProps = string | VNode<any> | (() => Promise<VNode<any>>);
|
|
3
|
+
export type HtmlVarValueProps = string | null | undefined | VNode<any> | (() => Promise<VNode<any>>);
|
|
4
4
|
export type HtmlVarResult = { value: HtmlVarValueProps; ref: RefProps; node: VNode<any> };
|
|
5
5
|
export class HtmlVar implements HtmlVarResult {
|
|
6
|
-
private _value:
|
|
6
|
+
private _value: string | VNode<any> | (() => Promise<VNode<any>>);
|
|
7
7
|
private _dirty = false;
|
|
8
8
|
private _ref: RefProps;
|
|
9
9
|
private resolve!: () => void;
|
|
@@ -54,7 +54,7 @@ export class HtmlVar implements HtmlVarResult {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
set value(value: HtmlVarValueProps) {
|
|
57
|
-
this._value = value;
|
|
57
|
+
this._value = value || '';
|
|
58
58
|
if (this._dirty) {
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
@@ -22,6 +22,7 @@ export interface ResponsiveFrameProps {
|
|
|
22
22
|
maxWidth?: string;
|
|
23
23
|
autoExtendSidemenu?: boolean;
|
|
24
24
|
onLoad?: () => Promise<void>;
|
|
25
|
+
noSafeAreaTop?: boolean;
|
|
25
26
|
}
|
|
26
27
|
export const ResponsiveFrame = (props: ResponsiveFrameProps) => {
|
|
27
28
|
const cssContainer: CssProps = {
|
|
@@ -35,8 +36,10 @@ export const ResponsiveFrame = (props: ResponsiveFrameProps) => {
|
|
|
35
36
|
borderLeft: props.maxWidth ? '1px solid var(--primary-border-color)' : 'none',
|
|
36
37
|
margin: '0 auto',
|
|
37
38
|
overflowX: 'hidden',
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
...(!props.noSafeAreaTop ? {
|
|
40
|
+
'padding-top ': 'constant(safe-area-inset-top)',
|
|
41
|
+
'padding-top': 'env(safe-area-inset-top)',
|
|
42
|
+
} : {}),
|
|
40
43
|
'.frame-top-menu': {
|
|
41
44
|
display: 'flex',
|
|
42
45
|
flexDirection: 'column',
|
package/src/frames/top-frame.tsx
CHANGED
|
@@ -3,7 +3,16 @@ place to set safe-area-inset-top and other common styles
|
|
|
3
3
|
*/
|
|
4
4
|
import { VNode, CssProps } from 'lupine.components';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// TopFrame and ResponsiveFrame both contain safe-area-inset-top, so can't use them togother
|
|
7
|
+
export const TopFrame = async ({
|
|
8
|
+
placeholderClassname,
|
|
9
|
+
vnode,
|
|
10
|
+
noSafeAreaTop,
|
|
11
|
+
}: {
|
|
12
|
+
placeholderClassname: string;
|
|
13
|
+
vnode: VNode<any>;
|
|
14
|
+
noSafeAreaTop?: boolean;
|
|
15
|
+
}) => {
|
|
7
16
|
const cssContainer: CssProps = {
|
|
8
17
|
display: 'flex',
|
|
9
18
|
flexDirection: 'column',
|
|
@@ -16,8 +25,12 @@ export const TopFrame = async (placeholderClassname: string, vnode: VNode<any>)
|
|
|
16
25
|
flexDirection: 'column',
|
|
17
26
|
height: '100%',
|
|
18
27
|
// trick: to put two padding-top properties
|
|
19
|
-
|
|
20
|
-
|
|
28
|
+
...(!noSafeAreaTop
|
|
29
|
+
? {
|
|
30
|
+
'padding-top ': 'constant(safe-area-inset-top)',
|
|
31
|
+
'padding-top': 'env(safe-area-inset-top)',
|
|
32
|
+
}
|
|
33
|
+
: {}),
|
|
21
34
|
},
|
|
22
35
|
};
|
|
23
36
|
|
package/src/lib/encode-html.ts
CHANGED
|
@@ -6,8 +6,9 @@ const htmlEscapes: Record<string, string> = {
|
|
|
6
6
|
'"': '"',
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
export const encodeHtml = (str:
|
|
10
|
-
|
|
9
|
+
export const encodeHtml = (str: any): string => {
|
|
10
|
+
if (str === null || str === undefined) return '';
|
|
11
|
+
return String(str).replace(/[&<>'"]/g, (tag) => htmlEscapes[tag]);
|
|
11
12
|
};
|
|
12
13
|
|
|
13
14
|
const htmlUnescapes: Record<string, string> = {
|
|
@@ -19,5 +20,6 @@ const htmlUnescapes: Record<string, string> = {
|
|
|
19
20
|
};
|
|
20
21
|
|
|
21
22
|
export const decodeHtml = (str: string): string => {
|
|
22
|
-
|
|
23
|
+
if (str === null || str === undefined) return '';
|
|
24
|
+
return String(str).replace(/&(?:amp|lt|gt|quot|#39);/g, (tag) => htmlUnescapes[tag]);
|
|
23
25
|
};
|