@glasshome/widget-sdk 1.14.3 → 1.15.0
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/dist/deprecations.js +8 -0
- package/dist/framework/config/index.d.ts +14 -0
- package/dist/framework/hooks/index.d.ts +3 -1
- package/dist/framework/hooks/use-widget-context.d.ts +13 -0
- package/dist/framework/hooks/use-widget-dashboard.d.ts +2 -0
- package/dist/framework/hooks/use-widget-viewer.d.ts +4 -0
- package/dist/framework/index.d.ts +1 -1
- package/dist/index.js +286 -258
- package/dist/ui.d.ts +3 -2
- package/dist/vite/index.js +55 -51
- package/package.json +4 -4
package/dist/ui.d.ts
CHANGED
|
@@ -9,9 +9,10 @@
|
|
|
9
9
|
*
|
|
10
10
|
* The set is exactly what shipped widgets use; extending it is an additive
|
|
11
11
|
* SDK minor. Direct `@glasshome/ui` imports keep working but are deprecated
|
|
12
|
-
* (`direct-ui-import` in the registry), removed in 2.0.0.
|
|
12
|
+
* (`direct-ui-import` in the registry), removed in 2.0.0. `Icon` is the
|
|
13
|
+
* replacement for the `iconify-icon` element (`iconify-icon` in the registry).
|
|
13
14
|
*
|
|
14
15
|
* `@glasshome/ui/solid` is a vite external of this package: these re-exports
|
|
15
16
|
* resolve to the host-provided singleton at runtime, never a bundled copy.
|
|
16
17
|
*/
|
|
17
|
-
export { Badge, Button, Carousel, type CarouselApi, CarouselContent, CarouselDots, CarouselItem, CarouselNext, CarouselPrevious, type CarouselTransition, type Color, ColorSlider, ColorWheel, imageUrl, Input, Label, mediaUrl, parseColor, ResponsiveDialog, ResponsiveDialogBody, ResponsiveDialogClose, ResponsiveDialogContent, ResponsiveDialogDescription, ResponsiveDialogFooter, ResponsiveDialogHeader, ResponsiveDialogTitle, SchemaForm, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Slider, Switch, Tabs, TabsContent, TabsList, TabsTrigger, } from "@glasshome/ui/solid";
|
|
18
|
+
export { Badge, Button, Carousel, type CarouselApi, CarouselContent, CarouselDots, CarouselItem, CarouselNext, CarouselPrevious, type CarouselTransition, type Color, ColorSlider, ColorWheel, CountPill, Icon, imageUrl, Input, Label, mediaUrl, parseColor, ResponsiveDialog, ResponsiveDialogBody, ResponsiveDialogClose, ResponsiveDialogContent, ResponsiveDialogDescription, ResponsiveDialogFooter, ResponsiveDialogHeader, ResponsiveDialogTitle, SchemaForm, SectionIcon, SectionTitle, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Slider, Switch, Tabs, TabsContent, TabsList, TabsTrigger, } from "@glasshome/ui/solid";
|
package/dist/vite/index.js
CHANGED
|
@@ -57,40 +57,35 @@ function re() {
|
|
|
57
57
|
}
|
|
58
58
|
function ie(e) {
|
|
59
59
|
if (process.env.GLASSHOME_WIDGET_NO_WORKER === "1") return re();
|
|
60
|
-
let t = e?.rssLimitBytes ?? ne, n = e?.timeoutMs ?? x, r = e?.slowMs ?? S, i = null, a =
|
|
61
|
-
function
|
|
62
|
-
for (let
|
|
60
|
+
let t = e?.rssLimitBytes ?? ne, n = e?.timeoutMs ?? x, r = e?.slowMs ?? S, i = null, a = !1, o = 0, s = Promise.resolve();
|
|
61
|
+
function c(e, t) {
|
|
62
|
+
for (let n of e.pending.values()) n({
|
|
63
63
|
ok: !1,
|
|
64
|
-
reason:
|
|
64
|
+
reason: t
|
|
65
65
|
});
|
|
66
|
-
|
|
66
|
+
e.pending.clear();
|
|
67
67
|
}
|
|
68
|
-
function
|
|
69
|
-
|
|
70
|
-
i = null, a = null, o = !1, d(e), t?.kill();
|
|
68
|
+
function l(e, t) {
|
|
69
|
+
i === e && (i = null), c(e, t), e.proc.kill();
|
|
71
70
|
}
|
|
72
|
-
function
|
|
73
|
-
let
|
|
71
|
+
function u(e, n) {
|
|
72
|
+
let i;
|
|
74
73
|
try {
|
|
75
|
-
|
|
74
|
+
i = JSON.parse(n);
|
|
76
75
|
} catch {
|
|
77
76
|
return;
|
|
78
77
|
}
|
|
79
|
-
if (typeof
|
|
80
|
-
let
|
|
81
|
-
|
|
78
|
+
if (typeof i.id != "number") return;
|
|
79
|
+
let a = e.pending.get(i.id);
|
|
80
|
+
a && (e.pending.delete(i.id), (i.rss ?? 0) > t && (e.retireAfterRequest = !0), (i.importMs ?? 0) > r && console.warn(`[widget-sdk] introspection took ${i.importMs}ms`), a(i.ok ? {
|
|
82
81
|
ok: !0,
|
|
83
|
-
value:
|
|
82
|
+
value: i.value
|
|
84
83
|
} : {
|
|
85
84
|
ok: !1,
|
|
86
|
-
reason:
|
|
85
|
+
reason: i.reason ?? "introspection failed"
|
|
87
86
|
}));
|
|
88
87
|
}
|
|
89
|
-
function
|
|
90
|
-
if (i && a && !o) return a;
|
|
91
|
-
(o || i) && f("worker was replaced");
|
|
92
|
-
let e = C("introspect-worker");
|
|
93
|
-
if (!e) return Promise.reject(/* @__PURE__ */ Error("introspect-worker not found next to the sdk"));
|
|
88
|
+
function d(e) {
|
|
94
89
|
let t = Date.now(), n = te(process.execPath, [
|
|
95
90
|
"--conditions",
|
|
96
91
|
"browser",
|
|
@@ -99,68 +94,77 @@ function ie(e) {
|
|
|
99
94
|
"pipe",
|
|
100
95
|
"pipe",
|
|
101
96
|
"inherit"
|
|
102
|
-
] })
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
97
|
+
] }), a = {
|
|
98
|
+
proc: n,
|
|
99
|
+
ready: Promise.resolve(),
|
|
100
|
+
pending: /* @__PURE__ */ new Map(),
|
|
101
|
+
retireAfterRequest: !1
|
|
102
|
+
};
|
|
103
|
+
return a.ready = new Promise((e, o) => {
|
|
104
|
+
let s = "", l = !1;
|
|
106
105
|
n.stdout?.setEncoding("utf-8"), n.stdout?.on("data", (n) => {
|
|
107
106
|
s += n;
|
|
108
107
|
let i = s.indexOf("\n");
|
|
109
108
|
for (; i >= 0;) {
|
|
110
109
|
let n = s.slice(0, i).trim();
|
|
111
110
|
if (s = s.slice(i + 1), n) {
|
|
112
|
-
if (!
|
|
113
|
-
|
|
111
|
+
if (!l && n.includes("\"ready\"")) {
|
|
112
|
+
l = !0;
|
|
114
113
|
let n = Date.now() - t;
|
|
115
114
|
n > r && console.warn(`[widget-sdk] introspect worker took ${n}ms to boot`), e();
|
|
116
|
-
} else
|
|
115
|
+
} else u(a, n);
|
|
117
116
|
}
|
|
118
117
|
i = s.indexOf("\n");
|
|
119
118
|
}
|
|
120
119
|
});
|
|
121
|
-
let
|
|
122
|
-
i ===
|
|
120
|
+
let d = (e) => {
|
|
121
|
+
l || o(Error(e)), i === a && (i = null), c(a, e);
|
|
123
122
|
};
|
|
124
|
-
n.on("error", (e) =>
|
|
125
|
-
});
|
|
126
|
-
return a = s, s;
|
|
123
|
+
n.on("error", (e) => d(e.message)), n.on("exit", (e, t) => d(`introspect worker exited (${t ?? `code ${e}`})`));
|
|
124
|
+
}), a;
|
|
127
125
|
}
|
|
128
|
-
async function
|
|
129
|
-
if (
|
|
126
|
+
async function f(e) {
|
|
127
|
+
if (a) return {
|
|
130
128
|
ok: !1,
|
|
131
129
|
reason: "introspect session disposed"
|
|
132
130
|
};
|
|
131
|
+
let t = C("introspect-worker");
|
|
132
|
+
if (!t) return {
|
|
133
|
+
ok: !1,
|
|
134
|
+
reason: "introspect-worker not found next to the sdk"
|
|
135
|
+
};
|
|
136
|
+
i?.retireAfterRequest && l(i, "worker was replaced");
|
|
137
|
+
let r = i ??= d(t);
|
|
133
138
|
try {
|
|
134
|
-
await
|
|
139
|
+
await r.ready;
|
|
135
140
|
} catch (e) {
|
|
136
141
|
return {
|
|
137
142
|
ok: !1,
|
|
138
143
|
reason: e instanceof Error ? e.message : String(e)
|
|
139
144
|
};
|
|
140
145
|
}
|
|
141
|
-
|
|
142
|
-
if (!t?.stdin?.writable) return {
|
|
146
|
+
if (!r.proc.stdin?.writable) return {
|
|
143
147
|
ok: !1,
|
|
144
148
|
reason: "introspect worker is not writable"
|
|
145
149
|
};
|
|
146
|
-
let
|
|
147
|
-
return new Promise((
|
|
148
|
-
let
|
|
149
|
-
|
|
150
|
+
let s = ++o;
|
|
151
|
+
return new Promise((t) => {
|
|
152
|
+
let i = setTimeout(() => {
|
|
153
|
+
r.pending.delete(s), l(r, `introspection timed out after ${n}ms`), t({
|
|
150
154
|
ok: !1,
|
|
151
155
|
reason: `introspection timed out after ${n}ms`
|
|
152
156
|
});
|
|
153
157
|
}, n);
|
|
154
|
-
|
|
155
|
-
clearTimeout(
|
|
158
|
+
r.pending.set(s, (e) => {
|
|
159
|
+
clearTimeout(i), t(e);
|
|
156
160
|
});
|
|
157
161
|
try {
|
|
158
|
-
|
|
159
|
-
id:
|
|
162
|
+
r.proc.stdin?.write(`${JSON.stringify({
|
|
163
|
+
id: s,
|
|
160
164
|
outFile: e
|
|
161
165
|
})}\n`);
|
|
162
166
|
} catch (e) {
|
|
163
|
-
clearTimeout(
|
|
167
|
+
clearTimeout(i), r.pending.delete(s), r.retireAfterRequest = !0, t({
|
|
164
168
|
ok: !1,
|
|
165
169
|
reason: e instanceof Error ? e.message : String(e)
|
|
166
170
|
});
|
|
@@ -169,14 +173,14 @@ function ie(e) {
|
|
|
169
173
|
}
|
|
170
174
|
return {
|
|
171
175
|
introspect(e) {
|
|
172
|
-
let t =
|
|
173
|
-
return
|
|
176
|
+
let t = s.then(() => f(e));
|
|
177
|
+
return s = t.catch(() => void 0), t;
|
|
174
178
|
},
|
|
175
179
|
async dispose() {
|
|
176
|
-
|
|
180
|
+
a = !0, i && l(i, "introspect session disposed");
|
|
177
181
|
},
|
|
178
182
|
get childPid() {
|
|
179
|
-
return i?.pid ?? null;
|
|
183
|
+
return i?.proc.pid ?? null;
|
|
180
184
|
}
|
|
181
185
|
};
|
|
182
186
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glasshome/widget-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.0",
|
|
4
4
|
"description": "SDK for building GlassHome dashboard widgets with SolidJS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"glasshome",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
62
|
"@glasshome/sync-layer": "0.8.1",
|
|
63
|
-
"@glasshome/ui": "1.
|
|
63
|
+
"@glasshome/ui": "1.14.0",
|
|
64
64
|
"solid-js": "^1.9.11"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
@@ -75,9 +75,9 @@
|
|
|
75
75
|
"zod": "^4.1.13"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
|
-
"@glasshome/ui": "1.
|
|
78
|
+
"@glasshome/ui": "1.14.0",
|
|
79
79
|
"@solidjs/testing-library": "^0.8.10",
|
|
80
|
-
"@types/bun": "
|
|
80
|
+
"@types/bun": "^1.4.0",
|
|
81
81
|
"@types/node": "^25.2.2",
|
|
82
82
|
"typescript": "^7.0.2",
|
|
83
83
|
"vite": "^8.1.0",
|