@jseeio/jsee 0.8.2 → 0.8.7
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/CHANGELOG.md +8 -0
- package/README.md +17 -7
- package/dist/jsee.core.js +1 -1
- package/dist/jsee.full.js +1 -1
- package/dist/jsee.runtime.js +1 -1
- package/package.json +1 -1
- package/src/cli.js +651 -47
- package/src/main.js +5 -10
- package/src/utils.js +38 -0
- package/templates/minimal-app.vue +2 -1
package/src/main.js
CHANGED
|
@@ -1010,16 +1010,11 @@ export default class JSEE {
|
|
|
1010
1010
|
|| (output.alias && res[output.alias])
|
|
1011
1011
|
if (typeof r !== 'undefined') {
|
|
1012
1012
|
log(`Updating output: ${output.name} with data: ${typeof r}`)
|
|
1013
|
-
if (output.type === 'file'
|
|
1014
|
-
|
|
1015
|
-
if (typeof
|
|
1016
|
-
if (typeof
|
|
1017
|
-
|
|
1018
|
-
if (Object.prototype.hasOwnProperty.call(r, 'content')) output.value = r.content
|
|
1019
|
-
else if (Object.prototype.hasOwnProperty.call(r, 'value')) output.value = r.value
|
|
1020
|
-
else if (Object.prototype.hasOwnProperty.call(r, 'data')) output.value = r.data
|
|
1021
|
-
else if (Object.prototype.hasOwnProperty.call(r, 'url')) output.value = r.url
|
|
1022
|
-
else output.value = r
|
|
1013
|
+
if (output.type === 'file') {
|
|
1014
|
+
const fileValue = utils.normalizeFileOutputValue(output, r)
|
|
1015
|
+
if (typeof fileValue.filename === 'string') output.filename = fileValue.filename
|
|
1016
|
+
if (typeof fileValue.mime === 'string') output.mime = fileValue.mime
|
|
1017
|
+
output.value = fileValue.value
|
|
1023
1018
|
return
|
|
1024
1019
|
}
|
|
1025
1020
|
// Convert large base64 image data URLs to blob URLs for efficiency
|
package/src/utils.js
CHANGED
|
@@ -5,6 +5,41 @@ function isObject (item) {
|
|
|
5
5
|
return (typeof item === 'object' && !Array.isArray(item) && item !== null)
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
function isBinaryLike (value) {
|
|
9
|
+
if (!value || typeof value !== 'object') return false
|
|
10
|
+
if (typeof Buffer !== 'undefined' && Buffer.isBuffer && Buffer.isBuffer(value)) return true
|
|
11
|
+
if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) return true
|
|
12
|
+
if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView && ArrayBuffer.isView(value)) return true
|
|
13
|
+
return false
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function isRecordObject (item) {
|
|
17
|
+
return isObject(item) && !isBinaryLike(item)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function normalizeFileOutputValue (output, value) {
|
|
21
|
+
const source = output || {}
|
|
22
|
+
const fallback = {
|
|
23
|
+
value,
|
|
24
|
+
filename: source.filename || source.name,
|
|
25
|
+
mime: source.mime || source.contentType
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (!isRecordObject(value)) return fallback
|
|
29
|
+
|
|
30
|
+
let content = value
|
|
31
|
+
if (Object.prototype.hasOwnProperty.call(value, 'content')) content = value.content
|
|
32
|
+
else if (Object.prototype.hasOwnProperty.call(value, 'value')) content = value.value
|
|
33
|
+
else if (Object.prototype.hasOwnProperty.call(value, 'data')) content = value.data
|
|
34
|
+
else if (Object.prototype.hasOwnProperty.call(value, 'url')) content = value.url
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
value: content,
|
|
38
|
+
filename: value.filename || value.name || fallback.filename,
|
|
39
|
+
mime: value.mime || value.contentType || fallback.mime
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
8
43
|
function shouldPreserveWorkerValue (value) {
|
|
9
44
|
if (!value || typeof value !== 'object') {
|
|
10
45
|
return true
|
|
@@ -1291,6 +1326,9 @@ function inferOutputType (key, value) {
|
|
|
1291
1326
|
|
|
1292
1327
|
module.exports = {
|
|
1293
1328
|
isObject,
|
|
1329
|
+
isBinaryLike,
|
|
1330
|
+
isRecordObject,
|
|
1331
|
+
normalizeFileOutputValue,
|
|
1294
1332
|
loadFromDOM,
|
|
1295
1333
|
getModelFuncJS,
|
|
1296
1334
|
getModelFuncAPI,
|
|
@@ -85,9 +85,10 @@
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
.jsee-card {
|
|
88
|
-
border:
|
|
88
|
+
border: 0;
|
|
89
89
|
border-radius: var(--jsee-radius);
|
|
90
90
|
background: var(--jsee-card-bg);
|
|
91
|
+
box-shadow: rgba(14, 63, 126, 0.04) 0 0 0 1px, rgba(42, 51, 69, 0.04) 0 1px 1px -0.5px, rgba(42, 51, 70, 0.04) 0 3px 3px -1.5px, rgba(42, 51, 70, 0.04) 0 6px 6px -3px, rgba(14, 63, 126, 0.04) 0 12px 12px -6px, rgba(14, 63, 126, 0.04) 0 24px 24px -12px;
|
|
91
92
|
position: relative;
|
|
92
93
|
}
|
|
93
94
|
|