lupine.components 1.1.11 → 1.1.13

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lupine.components",
3
- "version": "1.1.11",
3
+ "version": "1.1.13",
4
4
  "license": "MIT",
5
5
  "author": "uuware.com",
6
6
  "homepage": "https://github.com/uuware/lupine.js",
@@ -100,7 +100,7 @@ export class ActionSheet {
100
100
  borderRadius: '8px',
101
101
  backgroundColor: 'var(--cover-bg-color)', //'#fefefe',
102
102
  width: '100%',
103
- maxWidth: contentMaxWidth ? contentMaxWidth : `clamp(200px, 70%, 800px)`,
103
+ maxWidth: contentMaxWidth ? contentMaxWidth : `clamp(200px, 90%, 600px)`,
104
104
  margin: '0 auto',
105
105
  },
106
106
  '.act-sheet-bottom-item, .act-sheet-item': {
@@ -109,7 +109,7 @@ export class ActionSheet {
109
109
  cursor: 'pointer',
110
110
  transition: 'all 0.3s ease',
111
111
  width: '100%',
112
- maxWidth: contentMaxWidth ? contentMaxWidth : `clamp(200px, 70%, 800px)`,
112
+ maxWidth: contentMaxWidth ? contentMaxWidth : `clamp(200px, 90%, 600px)`,
113
113
  borderTop: '1px solid var(--primary-border-color)',
114
114
  },
115
115
  '.act-sheet-bottom-item': {
@@ -28,9 +28,12 @@ export interface MobileHeaderTitleIconProps {
28
28
  onBack?: (event: Event) => void;
29
29
  left?: VNode<any> | HtmlVar;
30
30
  right?: VNode<any> | HtmlVar;
31
+ background?: string;
32
+ color?: string;
33
+ noShadow?: boolean;
31
34
  }
32
35
  // there may have a few MobileHeaderTitleIcon for different pages
33
- export const MobileHeaderTitleIcon = ({ title, onBack, left, right }: MobileHeaderTitleIconProps) => {
36
+ export const MobileHeaderTitleIcon = ({ title, onBack, left, right, background, color, noShadow }: MobileHeaderTitleIconProps) => {
34
37
  // const processBack = (event: Event) => {
35
38
  // if (onBack) {
36
39
  // onBack(event);
@@ -43,8 +46,11 @@ export const MobileHeaderTitleIcon = ({ title, onBack, left, right }: MobileHead
43
46
  flexDirection: 'row',
44
47
  width: '100vw',
45
48
  padding: '6px 0',
46
- backgroundColor: 'var(--activatable-bg-color-normal)',
47
- boxShadow: 'var(--mobile-header-shadow)',
49
+ // backgroundColor: 'var(--activatable-bg-color-normal)',
50
+ // boxShadow: 'var(--mobile-header-shadow)',
51
+ color: color || 'var(--primary-color)',
52
+ background: background || 'var(--activatable-bg-color-normal)',
53
+ boxShadow: noShadow ? 'unset' : 'var(--mobile-header-shadow)',
48
54
  zIndex: 'var(--layer-inside)', // bring boxShadow to front
49
55
  '.mhti-title': {
50
56
  display: 'flex',
@@ -32,6 +32,11 @@ export const HeaderWithBackFrame = ({
32
32
  left,
33
33
  right,
34
34
  noHeader = false,
35
+ background,
36
+ color,
37
+ noShadow,
38
+ contentColor,
39
+ contentBackground,
35
40
  }: {
36
41
  children: VNode<any>;
37
42
  title: VNode<any> | string | HtmlVar;
@@ -39,6 +44,11 @@ export const HeaderWithBackFrame = ({
39
44
  left?: VNode<any> | HtmlVar;
40
45
  right?: VNode<any> | HtmlVar;
41
46
  noHeader?: boolean;
47
+ color?: string;
48
+ background?: string;
49
+ noShadow?: boolean;
50
+ contentColor?: string;
51
+ contentBackground?: string;
42
52
  }) => {
43
53
  left = left || <HeaderWithBackFrameLeft onClick={onBack} />;
44
54
  right = right || <HeaderWithBackFrameRight onClick={onBack} />;
@@ -48,6 +58,7 @@ export const HeaderWithBackFrame = ({
48
58
  width: '100%',
49
59
  height: '100%',
50
60
  minHeight: '100%',
61
+ background: background || 'var(--activatable-bg-color-normal)',
51
62
  '.header-back-top': {
52
63
  display: 'flex',
53
64
  flexDirection: 'row',
@@ -63,6 +74,8 @@ export const HeaderWithBackFrame = ({
63
74
  overflowY: 'auto',
64
75
  scrollbarWidth: 'none',
65
76
  position: 'relative',
77
+ color: contentColor || 'var(--primary-color)',
78
+ background: contentBackground || 'var(--activatable-bg-color-normal)',
66
79
  '&::-webkit-scrollbar': {
67
80
  display: 'none',
68
81
  // height: '0',
@@ -97,7 +110,7 @@ export const HeaderWithBackFrame = ({
97
110
  const ref: RefProps = {};
98
111
  return (
99
112
  <div ref={ref} css={css} class='header-back-frame'>
100
- {!noHeader && <MobileHeaderTitleIcon onBack={onBack} left={domLeft} title={domCenter} right={domRight} />}
113
+ {!noHeader && <MobileHeaderTitleIcon onBack={onBack} left={domLeft} title={domCenter} right={domRight} background={background} color={color} noShadow={noShadow} />}
101
114
  <div class='header-back-content'>{children}</div>
102
115
  </div>
103
116
  );
@@ -1,7 +1,7 @@
1
- export const blobToBase64 = (blob: Blob): Promise<string> => {
1
+ export const blobToBase64 = (blob: Blob, removeMeta?: boolean): Promise<string> => {
2
2
  return new Promise((resolve, reject) => {
3
3
  const reader = new FileReader();
4
- reader.onloadend = () => resolve(reader.result as string); // data:audio/mpeg;base64,...
4
+ reader.onloadend = () => resolve(removeMeta ? (reader.result as string).split(',')[1] : reader.result as string); // data:audio/mpeg;base64,...
5
5
  reader.onerror = reject;
6
6
  reader.readAsDataURL(blob);
7
7
  });
@@ -0,0 +1,27 @@
1
+ export const encodeHtml = (str: string): string => {
2
+ return str.replace(
3
+ /[&<>'"]/g,
4
+ (tag) =>
5
+ ({
6
+ '&': '&amp;',
7
+ '<': '&lt;',
8
+ '>': '&gt;',
9
+ "'": '&#39;',
10
+ '"': '&quot;',
11
+ }[tag] || '')
12
+ );
13
+ };
14
+
15
+ export const decodeHtml = (str: string): string => {
16
+ return str.replace(
17
+ /&(\D+);/gi,
18
+ (tag) =>
19
+ ({
20
+ '&amp;': '&',
21
+ '&lt;': '<',
22
+ '&gt;': '>',
23
+ '&#39;': "'",
24
+ '&quot;': '"',
25
+ }[tag] || '')
26
+ );
27
+ };
package/src/lib/index.ts CHANGED
@@ -11,7 +11,7 @@ export * from './download-link';
11
11
  export * from './download-stream';
12
12
  export * from './drag-util';
13
13
  export * from './dynamical-load';
14
- export * from './escape-html';
14
+ export * from './encode-html';
15
15
  export * from './find-parent-tag';
16
16
  export * from './format-bytes';
17
17
  export * from './lite-dom';
@@ -1,9 +0,0 @@
1
- export const escapeHtml = (str: string | number | boolean) => {
2
- if (!str || typeof str !== 'string') return str;
3
- return str
4
- .replace(/&/g, '&amp;')
5
- .replace(/</g, '&lt;')
6
- .replace(/>/g, '&gt;')
7
- .replace(/"/g, '&quot;')
8
- .replace(/'/g, '&#39;');
9
- };