@my-life-buddies/cli 0.11.0 → 0.13.3
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/README.md +21 -3
- package/dist/bin/buddy.js +77 -15
- package/dist/bin/buddy.js.map +2 -2
- package/dist/bin/core.js +708 -287
- package/dist/bin/core.js.map +4 -4
- package/dist/bin/preview.js +152 -1
- package/dist/bin/preview.js.map +4 -4
- package/dist/web/app.css +143 -0
- package/dist/web/app.js +265 -57
- package/dist/web/index.html +14 -16
- package/dist/web/widgets.js +3 -2
- package/package.json +3 -3
package/dist/web/widgets.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* Client reference: my-life-buddies-ios dev 547818d, DadaConversationWidgets / DadaHostedWidgetPage. */
|
|
2
2
|
(() => {
|
|
3
|
+
const previewUrl = path => window.previewApiUrl?.(path) ?? path;
|
|
3
4
|
const el = (tag, className, text) => { const n = document.createElement(tag); n.className = className; if (text !== undefined) n.textContent = text; return n; };
|
|
4
5
|
window.createSimulatorWidgets = ({ api, avatar }) => {
|
|
5
6
|
const shortcut = document.querySelector('#widget-shortcut');
|
|
@@ -77,7 +78,7 @@
|
|
|
77
78
|
for (const child of phone.children) if (child !== overlay) child.inert = true;
|
|
78
79
|
dismiss.focus();
|
|
79
80
|
try {
|
|
80
|
-
const url = `/api/simulator/widgets/${encodeURIComponent(item.id)}
|
|
81
|
+
const url = previewUrl(`/api/simulator/widgets/${encodeURIComponent(item.id)}`);
|
|
81
82
|
// Probe errors in the parent; actual HTML executes only inside the opaque sandbox document.
|
|
82
83
|
const response = await fetch(url, { credentials: 'same-origin' });
|
|
83
84
|
if (!response.ok) { const error = await response.json(); throw new Error(error.error?.message || error.error || '小挂件暂时无法打开'); }
|
|
@@ -117,7 +118,7 @@
|
|
|
117
118
|
card(item) {
|
|
118
119
|
const card = el('div', 'widget-entry'); card.append(el('h4', '', item.title));
|
|
119
120
|
const details = el('div', 'widget-entry-details');
|
|
120
|
-
if (item.type && item.imageMediaId) { const image = el('img', 'widget-entry-photo'); image.alt = `${item.title}的照片`; image.src = `/api/simulator/widgets/${encodeURIComponent(item.id)}/image?mediaId=${encodeURIComponent(item.imageMediaId)}
|
|
121
|
+
if (item.type && item.imageMediaId) { const image = el('img', 'widget-entry-photo'); image.alt = `${item.title}的照片`; image.src = previewUrl(`/api/simulator/widgets/${encodeURIComponent(item.id)}/image?mediaId=${encodeURIComponent(item.imageMediaId)}`); image.addEventListener('error', () => { image.hidden = true; }); details.append(image); }
|
|
121
122
|
details.append(el('p', '', item.type ? item.summary?.trim() || '打开查看最新内容' : '此小挂件已删除或不可用')); card.append(details);
|
|
122
123
|
if (item.type) card.append(button('去查看', () => open(item), 'widget-entry-open'));
|
|
123
124
|
return card;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@my-life-buddies/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "搭搭 Developer Platform 命令行工具",
|
|
6
6
|
"publishConfig": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"ws": "8.21.3"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@buddy/cli-core": "0.
|
|
43
|
-
"@buddy/preview": "0.
|
|
42
|
+
"@buddy/cli-core": "0.13.3",
|
|
43
|
+
"@buddy/preview": "0.13.3"
|
|
44
44
|
}
|
|
45
45
|
}
|