@jswork/react-pwa-promotion 1.0.17 → 1.0.18
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/llms.txt +38 -0
- package/package.json +5 -1
- package/src/constants.ts +0 -18
- package/src/index.ts +0 -2
- package/src/index.tsx +0 -92
- package/src/pwa-update-prompt.tsx +0 -54
- package/src/style.css +0 -135
- package/src/types.ts +0 -28
- package/src/utils.ts +0 -16
package/llms.txt
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# @jswork/react-pwa-promotion
|
|
2
|
+
|
|
3
|
+
> 极简 React PWA 新版本更新提示组件:纯 UI、不绑定构建工具,由宿主(如 vite-plugin-pwa)提供 Service Worker 状态,共同完成"发现新版本 → 立即更新 / 稍后"的升级提示流程。
|
|
4
|
+
|
|
5
|
+
组件不往 DOM 注入 `<style>`,样式全部由独立 CSS 文件控制,使用方需在入口引入一次 `@jswork/react-pwa-promotion/dist/style.css`。主题定制通过覆盖 `.react-pwa-promotion` 上的 `--rpwa-*` CSS 自定义属性实现(背景、文字、圆角、阴影、按钮配色等)。支持中英文默认文案(`lang` prop,未传时跟随 `navigator.language`),并内置无障碍属性(`role="dialog"`、`aria-live="polite"`)与 `prefers-reduced-motion` 动画降级。
|
|
6
|
+
|
|
7
|
+
唯一导出:默认组件 `PwaUpdatePrompt`,Props(定义于 `src/types.ts`):
|
|
8
|
+
|
|
9
|
+
- `open: boolean` — 是否有新版本待更新,由宿主 SW 状态提供
|
|
10
|
+
- `onUpdate: () => void` — 点击「立即更新」,宿主负责让新 SW 接管并刷新
|
|
11
|
+
- `onDismiss: () => void` — 点击「稍后」
|
|
12
|
+
- `position?: PwaUpdatePosition | CSSProperties` — 四角预设(`'top-right'`(默认)| `'bottom-right'` | `'bottom-left'` | `'top-left'`)或传样式对象自定义坐标
|
|
13
|
+
- `className?: string` — 追加根类名
|
|
14
|
+
- `texts?: Partial<PwaUpdateTexts>` — 覆盖标题 / 描述 / 两个按钮文案
|
|
15
|
+
- `lang?: PwaUpdateLang` — `'zh-CN' | 'en-US'`,决定默认文案与 aria lang
|
|
16
|
+
|
|
17
|
+
## Documentation
|
|
18
|
+
|
|
19
|
+
- [README](README.md): 安装、与 vite-plugin-pwa 配合的完整用法示例、Props 表、特性说明
|
|
20
|
+
|
|
21
|
+
## Source
|
|
22
|
+
|
|
23
|
+
- [构建入口 index.tsx](src/index.tsx): 自包含单文件实现,tsup 的打包入口(`src/index.ts` 是等价的模块化重组出入口)
|
|
24
|
+
- [组件实现](src/pwa-update-prompt.tsx): 模块化版本的 PwaUpdatePrompt 组件
|
|
25
|
+
- [类型定义](src/types.ts): PwaUpdatePromptProps 及所有导出类型
|
|
26
|
+
- [常量](src/constants.ts): 根类名 `react-pwa-promotion` 与中英文默认文案
|
|
27
|
+
- [工具函数](src/utils.ts): resolveLang / mergeTexts / joinClasses
|
|
28
|
+
- [样式](src/style.css): 原生 CSS Nesting 编写,含全部 `--rpwa-*` 主题变量;构建时由 Lightning CSS 编译为扁平选择器输出到 `dist/style.css`
|
|
29
|
+
|
|
30
|
+
## Configuration
|
|
31
|
+
|
|
32
|
+
- [package.json](package.json): 包元信息,双格式产物入口(cjs / esm / d.ts)
|
|
33
|
+
- [tsup 构建配置](tsup.config.ts): cjs + esm + d.ts 产物,`@jswork/tsup-plugin-lightningcss` 在同一次构建中产出 `dist/style.css`
|
|
34
|
+
|
|
35
|
+
## Optional
|
|
36
|
+
|
|
37
|
+
- [示例应用](../example/README.md): Vite + vite-plugin-pwa(`registerType: 'prompt'`)完整示例,演示真实 SW 更新链路
|
|
38
|
+
- [仓库根 README](../../README.md): monorepo 结构与 pnpm 命令说明
|
package/package.json
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jswork/react-pwa-promotion",
|
|
3
3
|
"description": "A tiny React update prompt for Vite PWA (vite-plugin-pwa).",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.18",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"homepage": "https://js.work",
|
|
9
9
|
"license": "MIT",
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"llms.txt"
|
|
13
|
+
],
|
|
10
14
|
"scripts": {
|
|
11
15
|
"build": "tsup",
|
|
12
16
|
"release": "release-it --ci --npm.skipChecks"
|
package/src/constants.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { PwaUpdateLang, PwaUpdateTexts } from './types';
|
|
2
|
-
|
|
3
|
-
export const CLASS_NAME = 'react-pwa-promotion';
|
|
4
|
-
|
|
5
|
-
export const defaultTextsByLang: Record<PwaUpdateLang, PwaUpdateTexts> = {
|
|
6
|
-
'zh-CN': {
|
|
7
|
-
title: '发现新版本',
|
|
8
|
-
description: '新版本已就绪,刷新即可使用。',
|
|
9
|
-
update: '立即更新',
|
|
10
|
-
dismiss: '稍后'
|
|
11
|
-
},
|
|
12
|
-
'en-US': {
|
|
13
|
-
title: 'Update available',
|
|
14
|
-
description: 'A new version is ready. Refresh to use it.',
|
|
15
|
-
update: 'Update now',
|
|
16
|
-
dismiss: 'Later'
|
|
17
|
-
}
|
|
18
|
-
};
|
package/src/index.ts
DELETED
package/src/index.tsx
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import type { CSSProperties } from 'react';
|
|
2
|
-
|
|
3
|
-
export type PwaUpdatePosition = 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
|
4
|
-
|
|
5
|
-
export type PwaUpdateTexts = {
|
|
6
|
-
title: string;
|
|
7
|
-
description: string;
|
|
8
|
-
update: string;
|
|
9
|
-
dismiss: string;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export interface PwaUpdatePromptProps {
|
|
13
|
-
/** 是否有新版本待更新,由宿主的 Service Worker 状态提供 */
|
|
14
|
-
open: boolean;
|
|
15
|
-
/** 点击「立即更新」:宿主负责让新 SW 接管并刷新页面 */
|
|
16
|
-
onUpdate: () => void;
|
|
17
|
-
/** 点击「稍后」 */
|
|
18
|
-
onDismiss: () => void;
|
|
19
|
-
/** 四个角,或传样式对象自定义坐标(如 { left: 40, top: 40 }) */
|
|
20
|
-
position?: PwaUpdatePosition | CSSProperties;
|
|
21
|
-
className?: string;
|
|
22
|
-
/** 覆盖默认文案 */
|
|
23
|
-
texts?: Partial<PwaUpdateTexts>;
|
|
24
|
-
/** 提示框语言:决定默认文案与 aria lang;未传时跟随 <html> 的 lang */
|
|
25
|
-
lang?: 'zh-CN' | 'en-US';
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const CLASS_NAME = 'react-pwa-promotion';
|
|
29
|
-
|
|
30
|
-
const defaultTextsByLang: Record<'zh-CN' | 'en-US', PwaUpdateTexts> = {
|
|
31
|
-
'zh-CN': {
|
|
32
|
-
title: '发现新版本',
|
|
33
|
-
description: '新版本已就绪,刷新即可使用。',
|
|
34
|
-
update: '立即更新',
|
|
35
|
-
dismiss: '稍后'
|
|
36
|
-
},
|
|
37
|
-
'en-US': {
|
|
38
|
-
title: 'Update available',
|
|
39
|
-
description: 'A new version is ready. Refresh to use it.',
|
|
40
|
-
update: 'Update now',
|
|
41
|
-
dismiss: 'Later'
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
// 样式独立在 src/style.css(构建时用 Lightning CSS 编译到 dist/style.css),
|
|
46
|
-
// 使用方需引入一次 CSS,组件本身不往 DOM 注入 <style>。
|
|
47
|
-
export default function PwaUpdatePrompt({
|
|
48
|
-
open,
|
|
49
|
-
onUpdate,
|
|
50
|
-
onDismiss,
|
|
51
|
-
position = 'top-right',
|
|
52
|
-
className,
|
|
53
|
-
texts,
|
|
54
|
-
lang
|
|
55
|
-
}: PwaUpdatePromptProps) {
|
|
56
|
-
if (!open) return null;
|
|
57
|
-
|
|
58
|
-
const resolvedLang =
|
|
59
|
-
lang ?? (typeof navigator !== 'undefined' && navigator.language.startsWith('zh') ? 'zh-CN' : 'en-US');
|
|
60
|
-
const t = { ...defaultTextsByLang[resolvedLang], ...texts };
|
|
61
|
-
const preset = typeof position === 'string';
|
|
62
|
-
const classes = [CLASS_NAME, preset ? `${CLASS_NAME}--${position}` : '', className]
|
|
63
|
-
.filter(Boolean)
|
|
64
|
-
.join(' ');
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
<div
|
|
68
|
-
className={classes}
|
|
69
|
-
style={typeof position === 'string' ? undefined : position}
|
|
70
|
-
lang={resolvedLang}
|
|
71
|
-
role="dialog"
|
|
72
|
-
aria-live="polite"
|
|
73
|
-
aria-label={t.title}>
|
|
74
|
-
<div className={`${CLASS_NAME}__title`}>{t.title}</div>
|
|
75
|
-
<div className={`${CLASS_NAME}__desc`}>{t.description}</div>
|
|
76
|
-
<div className={`${CLASS_NAME}__actions`}>
|
|
77
|
-
<button
|
|
78
|
-
type="button"
|
|
79
|
-
className={`${CLASS_NAME}__btn ${CLASS_NAME}__btn--ghost`}
|
|
80
|
-
onClick={onDismiss}>
|
|
81
|
-
{t.dismiss}
|
|
82
|
-
</button>
|
|
83
|
-
<button
|
|
84
|
-
type="button"
|
|
85
|
-
className={`${CLASS_NAME}__btn ${CLASS_NAME}__btn--primary`}
|
|
86
|
-
onClick={onUpdate}>
|
|
87
|
-
{t.update}
|
|
88
|
-
</button>
|
|
89
|
-
</div>
|
|
90
|
-
</div>
|
|
91
|
-
);
|
|
92
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import type { CSSProperties } from 'react';
|
|
2
|
-
import type { PwaUpdateLang, PwaUpdatePromptProps } from './types';
|
|
3
|
-
import { CLASS_NAME } from './constants';
|
|
4
|
-
import { joinClasses, mergeTexts, resolveLang } from './utils';
|
|
5
|
-
|
|
6
|
-
// 样式独立在 src/style.css(构建时用 Lightning CSS 编译到 dist/style.css),
|
|
7
|
-
// 使用方需引入一次 CSS,组件本身不往 DOM 注入 <style>。
|
|
8
|
-
export default function PwaUpdatePrompt({
|
|
9
|
-
open,
|
|
10
|
-
onUpdate,
|
|
11
|
-
onDismiss,
|
|
12
|
-
position = 'top-right',
|
|
13
|
-
className,
|
|
14
|
-
texts,
|
|
15
|
-
lang
|
|
16
|
-
}: PwaUpdatePromptProps) {
|
|
17
|
-
if (!open) return null;
|
|
18
|
-
|
|
19
|
-
const resolvedLang: PwaUpdateLang = resolveLang(lang);
|
|
20
|
-
const t = mergeTexts(resolvedLang, texts);
|
|
21
|
-
const preset = typeof position === 'string';
|
|
22
|
-
const classes = joinClasses(
|
|
23
|
-
CLASS_NAME,
|
|
24
|
-
preset && `${CLASS_NAME}--${position}`,
|
|
25
|
-
className
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<div
|
|
30
|
-
className={classes}
|
|
31
|
-
style={typeof position === 'string' ? undefined : (position as CSSProperties)}
|
|
32
|
-
lang={resolvedLang}
|
|
33
|
-
role="dialog"
|
|
34
|
-
aria-live="polite"
|
|
35
|
-
aria-label={t.title}>
|
|
36
|
-
<div className={`${CLASS_NAME}__title`}>{t.title}</div>
|
|
37
|
-
<div className={`${CLASS_NAME}__desc`}>{t.description}</div>
|
|
38
|
-
<div className={`${CLASS_NAME}__actions`}>
|
|
39
|
-
<button
|
|
40
|
-
type="button"
|
|
41
|
-
className={`${CLASS_NAME}__btn ${CLASS_NAME}__btn--ghost`}
|
|
42
|
-
onClick={onDismiss}>
|
|
43
|
-
{t.dismiss}
|
|
44
|
-
</button>
|
|
45
|
-
<button
|
|
46
|
-
type="button"
|
|
47
|
-
className={`${CLASS_NAME}__btn ${CLASS_NAME}__btn--primary`}
|
|
48
|
-
onClick={onUpdate}>
|
|
49
|
-
{t.update}
|
|
50
|
-
</button>
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
53
|
-
);
|
|
54
|
-
}
|
package/src/style.css
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
/* 源码用原生 CSS Nesting 组织,构建时由 Lightning CSS 按 targets 展开成扁平选择器。
|
|
2
|
-
注意:这里不能用 Sass 风格的 &__xxx 后缀拼接(Lightning CSS 不支持)。
|
|
3
|
-
主题定制:覆盖 .react-pwa-promotion 上的 --rpwa-* 变量即可。 */
|
|
4
|
-
|
|
5
|
-
.react-pwa-promotion {
|
|
6
|
-
/* 主题变量 */
|
|
7
|
-
--rpwa-bg: #fff;
|
|
8
|
-
--rpwa-color: #111827;
|
|
9
|
-
--rpwa-muted: #6b7280;
|
|
10
|
-
--rpwa-border: #e5e7eb;
|
|
11
|
-
--rpwa-radius: 8px;
|
|
12
|
-
--rpwa-radius-sm: 4px;
|
|
13
|
-
--rpwa-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
|
|
14
|
-
--rpwa-accent: #6366f1;
|
|
15
|
-
--rpwa-btn-ghost-bg: #fff;
|
|
16
|
-
--rpwa-btn-ghost-color: #374151;
|
|
17
|
-
--rpwa-btn-ghost-bg-hover: #f3f4f6;
|
|
18
|
-
--rpwa-btn-primary-bg: #111827;
|
|
19
|
-
--rpwa-btn-primary-color: #fff;
|
|
20
|
-
--rpwa-btn-primary-bg-hover: #374151;
|
|
21
|
-
|
|
22
|
-
position: fixed;
|
|
23
|
-
z-index: 9999;
|
|
24
|
-
box-sizing: border-box;
|
|
25
|
-
width: 240px;
|
|
26
|
-
padding: 8px 12px;
|
|
27
|
-
border-radius: var(--rpwa-radius);
|
|
28
|
-
border: 1px solid var(--rpwa-border);
|
|
29
|
-
background: var(--rpwa-bg);
|
|
30
|
-
color: var(--rpwa-color);
|
|
31
|
-
box-shadow: var(--rpwa-shadow);
|
|
32
|
-
font: 12px/1.35 system-ui, sans-serif;
|
|
33
|
-
animation: react-pwa-promotion-in 0.18s ease-out both;
|
|
34
|
-
|
|
35
|
-
/* 位置变体:& 后接完整类选择器,展开后根类与变体类同时命中 */
|
|
36
|
-
&.react-pwa-promotion--bottom-right {
|
|
37
|
-
right: 16px;
|
|
38
|
-
bottom: 16px;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
&.react-pwa-promotion--bottom-left {
|
|
42
|
-
left: 16px;
|
|
43
|
-
bottom: 16px;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
&.react-pwa-promotion--top-right {
|
|
47
|
-
right: 16px;
|
|
48
|
-
top: 16px;
|
|
49
|
-
animation-name: react-pwa-promotion-in-top;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
&.react-pwa-promotion--top-left {
|
|
53
|
-
left: 16px;
|
|
54
|
-
top: 16px;
|
|
55
|
-
animation-name: react-pwa-promotion-in-top;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
& .react-pwa-promotion__title {
|
|
59
|
-
font-size: 13px;
|
|
60
|
-
font-weight: 600;
|
|
61
|
-
margin-bottom: 2px;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
& .react-pwa-promotion__desc {
|
|
65
|
-
color: var(--rpwa-muted);
|
|
66
|
-
margin-bottom: 6px;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
& .react-pwa-promotion__actions {
|
|
70
|
-
display: flex;
|
|
71
|
-
gap: 4px;
|
|
72
|
-
justify-content: flex-end;
|
|
73
|
-
|
|
74
|
-
& .react-pwa-promotion__btn {
|
|
75
|
-
padding: 3px 8px;
|
|
76
|
-
border-radius: var(--rpwa-radius-sm);
|
|
77
|
-
font: inherit;
|
|
78
|
-
font-size: 11px;
|
|
79
|
-
cursor: pointer;
|
|
80
|
-
transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s,
|
|
81
|
-
transform 0.15s;
|
|
82
|
-
|
|
83
|
-
&:active {
|
|
84
|
-
transform: translateY(1px);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
&:focus-visible {
|
|
88
|
-
outline: 2px solid var(--rpwa-accent);
|
|
89
|
-
outline-offset: 2px;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
&.react-pwa-promotion__btn--ghost {
|
|
93
|
-
border: 1px solid var(--rpwa-border);
|
|
94
|
-
background: var(--rpwa-btn-ghost-bg);
|
|
95
|
-
color: var(--rpwa-btn-ghost-color);
|
|
96
|
-
|
|
97
|
-
&:hover {
|
|
98
|
-
background: var(--rpwa-btn-ghost-bg-hover);
|
|
99
|
-
border-color: #d1d5db;
|
|
100
|
-
color: var(--rpwa-color);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
&.react-pwa-promotion__btn--primary {
|
|
105
|
-
border: 1px solid var(--rpwa-btn-primary-bg);
|
|
106
|
-
background: var(--rpwa-btn-primary-bg);
|
|
107
|
-
color: var(--rpwa-btn-primary-color);
|
|
108
|
-
|
|
109
|
-
&:hover {
|
|
110
|
-
background: var(--rpwa-btn-primary-bg-hover);
|
|
111
|
-
border-color: var(--rpwa-btn-primary-bg-hover);
|
|
112
|
-
box-shadow: 0 3px 10px rgba(17, 24, 39, 0.25);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
@media (prefers-reduced-motion: reduce) {
|
|
119
|
-
animation: none;
|
|
120
|
-
|
|
121
|
-
& .react-pwa-promotion__btn {
|
|
122
|
-
transition: none;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
@keyframes react-pwa-promotion-in {
|
|
128
|
-
from { opacity: 0; transform: translateY(6px); }
|
|
129
|
-
to { opacity: 1; transform: none; }
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
@keyframes react-pwa-promotion-in-top {
|
|
133
|
-
from { opacity: 0; transform: translateY(-6px); }
|
|
134
|
-
to { opacity: 1; transform: none; }
|
|
135
|
-
}
|
package/src/types.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { CSSProperties } from 'react';
|
|
2
|
-
|
|
3
|
-
export type PwaUpdatePosition = 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
|
4
|
-
|
|
5
|
-
export type PwaUpdateLang = 'zh-CN' | 'en-US';
|
|
6
|
-
|
|
7
|
-
export type PwaUpdateTexts = {
|
|
8
|
-
title: string;
|
|
9
|
-
description: string;
|
|
10
|
-
update: string;
|
|
11
|
-
dismiss: string;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export interface PwaUpdatePromptProps {
|
|
15
|
-
/** 是否有新版本待更新,由宿主的 Service Worker 状态提供 */
|
|
16
|
-
open: boolean;
|
|
17
|
-
/** 点击「立即更新」:宿主负责让新 SW 接管并刷新页面 */
|
|
18
|
-
onUpdate: () => void;
|
|
19
|
-
/** 点击「稍后」 */
|
|
20
|
-
onDismiss: () => void;
|
|
21
|
-
/** 四个角,或传样式对象自定义坐标(如 { left: 40, top: 40 }) */
|
|
22
|
-
position?: PwaUpdatePosition | CSSProperties;
|
|
23
|
-
className?: string;
|
|
24
|
-
/** 覆盖默认文案 */
|
|
25
|
-
texts?: Partial<PwaUpdateTexts>;
|
|
26
|
-
/** 提示框语言:决定默认文案与 aria lang;未传时跟随 <html> 的 lang */
|
|
27
|
-
lang?: PwaUpdateLang;
|
|
28
|
-
}
|
package/src/utils.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { PwaUpdateLang, PwaUpdateTexts } from './types';
|
|
2
|
-
import { defaultTextsByLang } from './constants';
|
|
3
|
-
|
|
4
|
-
export function resolveLang(lang?: PwaUpdateLang): PwaUpdateLang {
|
|
5
|
-
if (lang) return lang;
|
|
6
|
-
if (typeof navigator !== 'undefined' && navigator.language.startsWith('zh')) return 'zh-CN';
|
|
7
|
-
return 'en-US';
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function mergeTexts(lang: PwaUpdateLang, texts?: Partial<PwaUpdateTexts>) {
|
|
11
|
-
return { ...defaultTextsByLang[lang], ...texts };
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function joinClasses(...parts: Array<string | false | undefined>) {
|
|
15
|
-
return parts.filter(Boolean).join(' ');
|
|
16
|
-
}
|