@learnpack/learnpack 5.0.350 → 5.0.352
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/lib/commands/serve.js +6 -0
- package/lib/utils/export/scorm.js +5 -0
- package/lib/utils/export/zip.js +4 -0
- package/lib/utils/packageManifest.d.ts +58 -0
- package/lib/utils/packageManifest.js +250 -0
- package/lib/utils/s3/packageManifestBackfill.d.ts +82 -0
- package/lib/utils/s3/packageManifestBackfill.js +485 -0
- package/lib/utils/titlefy.d.ts +2 -0
- package/lib/utils/titlefy.js +25 -0
- package/package.json +4 -1
- package/src/commands/serve.ts +7 -0
- package/src/ui/_app/app.css +1 -1
- package/src/ui/_app/app.js +2097 -2097
- package/src/ui/app.tar.gz +0 -0
- package/src/utils/export/README.md +3 -2
- package/src/utils/export/scorm.ts +6 -0
- package/src/utils/export/zip.ts +6 -1
- package/src/utils/packageManifest.ts +433 -0
- package/src/utils/s3/packageManifestBackfill.ts +776 -0
- package/src/utils/titlefy.ts +26 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const SLUG_PATTERN = /^\d+(?:\.\d+)?-/
|
|
2
|
+
|
|
3
|
+
export function titlefy(str: string): string {
|
|
4
|
+
const arr = str.split("-")
|
|
5
|
+
arr.shift()
|
|
6
|
+
const result = arr.join(" ")
|
|
7
|
+
if (!result) {
|
|
8
|
+
return ""
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return result.charAt(0).toUpperCase() + result.slice(1)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function formatSidebarTitle(value: string): string | null {
|
|
15
|
+
const trimmed = value.trim()
|
|
16
|
+
if (!trimmed) {
|
|
17
|
+
return null
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (/^\d+(?:\.\d+)?$/.test(trimmed)) {
|
|
21
|
+
return null
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const formatted = SLUG_PATTERN.test(trimmed) ? titlefy(trimmed) : trimmed
|
|
25
|
+
return formatted.trim() || null
|
|
26
|
+
}
|