@glasshome/widget-sdk 1.15.1 → 1.17.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/data.d.ts +1 -1
- package/dist/deprecations.js +16 -0
- package/dist/framework/backgrounds/WidgetSliderFill.d.ts +1 -1
- package/dist/framework/components/WidgetContent.d.ts +7 -1
- package/dist/framework/components/anatomy.d.ts +78 -0
- package/dist/framework/config/index.d.ts +18 -9
- package/dist/framework/core/Widget.d.ts +15 -2
- package/dist/framework/dialogs/WidgetDialog.d.ts +16 -1
- package/dist/framework/dialogs/debug-view.d.ts +27 -0
- package/dist/framework/dialogs/index.d.ts +2 -1
- package/dist/framework/gestures/use-widget-gestures.d.ts +12 -1
- package/dist/framework/hooks/index.d.ts +1 -0
- package/dist/framework/hooks/use-confirm.d.ts +13 -0
- package/dist/framework/hooks/use-daylight.d.ts +25 -0
- package/dist/framework/hooks/use-widget-context.d.ts +4 -0
- package/dist/framework/hooks/use-widget-dialog.d.ts +5 -3
- package/dist/framework/hooks/widget-registry.d.ts +19 -0
- package/dist/framework/image-src.d.ts +3 -0
- package/dist/framework/index.d.ts +10 -10
- package/dist/framework/panel/panel-entity.d.ts +18 -0
- package/dist/framework/panel/panel.d.ts +55 -0
- package/dist/framework/types.d.ts +1 -1
- package/dist/framework/utils/clipboard.d.ts +9 -0
- package/dist/framework/utils/index.d.ts +1 -0
- package/dist/framework/variants/variant-utils.d.ts +5 -5
- package/dist/host/index.js +42 -24
- package/dist/index.js +2073 -751
- package/dist/ui.d.ts +1 -1
- package/dist/vite/index.d.ts +25 -0
- package/dist/vite/index.js +159 -129
- package/package.json +5 -5
package/dist/host/index.js
CHANGED
|
@@ -1,51 +1,69 @@
|
|
|
1
1
|
import { ErrorBoundary as e, createComponent as t } from "solid-js";
|
|
2
|
-
import {
|
|
3
|
-
import { WidgetCtx as
|
|
2
|
+
import { DelegatedEvents as n, clearDelegatedEvents as r, delegateEvents as i, render as a } from "solid-js/web";
|
|
3
|
+
import { WidgetCtx as o, injectTokens as s } from "@glasshome/widget-sdk";
|
|
4
4
|
//#region src/host/instantiate-widget.ts
|
|
5
|
-
var
|
|
6
|
-
function
|
|
7
|
-
let t =
|
|
5
|
+
var c = /* @__PURE__ */ new Map();
|
|
6
|
+
function l(e) {
|
|
7
|
+
let t = c.get(e);
|
|
8
8
|
if (t) return t;
|
|
9
9
|
let n = new CSSStyleSheet();
|
|
10
|
-
return n.replaceSync(e),
|
|
10
|
+
return n.replaceSync(e), c.set(e, n), n;
|
|
11
11
|
}
|
|
12
|
-
var
|
|
13
|
-
function
|
|
12
|
+
var u = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Map(), f = !1;
|
|
13
|
+
function p(e, t) {
|
|
14
14
|
for (let n of t) e.classList.toggle(n, document.documentElement.classList.contains(n));
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
for (let e of t)
|
|
18
|
-
return
|
|
19
|
-
for (let [e, t] of
|
|
16
|
+
function m(e, t) {
|
|
17
|
+
for (let e of t) u.add(e);
|
|
18
|
+
return d.set(e, t), p(e, t), f || (f = !0, new MutationObserver(() => {
|
|
19
|
+
for (let [e, t] of d) p(e, t);
|
|
20
20
|
}).observe(document.documentElement, {
|
|
21
21
|
attributes: !0,
|
|
22
22
|
attributeFilter: ["class"]
|
|
23
23
|
})), () => {
|
|
24
|
-
|
|
24
|
+
d.delete(e);
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
var h = (e) => {
|
|
28
|
+
Reflect.deleteProperty(e, "target"), Reflect.deleteProperty(e, "currentTarget");
|
|
29
|
+
};
|
|
30
|
+
if (typeof document < "u") {
|
|
31
|
+
let e = [...n];
|
|
32
|
+
i(e);
|
|
33
|
+
for (let t of e) document.addEventListener(t, h);
|
|
34
|
+
}
|
|
35
|
+
function g(e) {
|
|
36
|
+
if (e.mode !== "closed") return () => {};
|
|
37
|
+
let t = [...n], a = e;
|
|
38
|
+
i(t, a);
|
|
39
|
+
for (let n of t) e.addEventListener(n, h);
|
|
40
|
+
return () => {
|
|
41
|
+
r(a);
|
|
42
|
+
for (let n of t) e.removeEventListener(n, h);
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function _(n, r) {
|
|
46
|
+
let i = n.attachShadow({ mode: "closed" }), c = g(i), u = m(n, r.mirrorClasses ?? ["dark"]);
|
|
47
|
+
s(i), r.cssText !== null && (i.adoptedStyleSheets = [...i.adoptedStyleSheets, l(r.cssText)]), r.extraSheets?.length && (i.adoptedStyleSheets = [...i.adoptedStyleSheets, ...r.extraSheets]);
|
|
48
|
+
let d = a(() => t(o.Provider, {
|
|
49
|
+
value: r.ctx,
|
|
32
50
|
get children() {
|
|
33
51
|
return t(e, {
|
|
34
52
|
fallback: (e) => {
|
|
35
53
|
let t = e instanceof Error ? e : Error(String(e));
|
|
36
|
-
return queueMicrotask(() =>
|
|
54
|
+
return queueMicrotask(() => r.onCrash(t)), null;
|
|
37
55
|
},
|
|
38
56
|
get children() {
|
|
39
|
-
return t(
|
|
40
|
-
return
|
|
57
|
+
return t(r.definition.component, { get config() {
|
|
58
|
+
return r.config();
|
|
41
59
|
} });
|
|
42
60
|
}
|
|
43
61
|
});
|
|
44
62
|
}
|
|
45
|
-
}),
|
|
63
|
+
}), i);
|
|
46
64
|
return { dispose: () => {
|
|
47
|
-
|
|
65
|
+
u(), d(), c();
|
|
48
66
|
} };
|
|
49
67
|
}
|
|
50
68
|
//#endregion
|
|
51
|
-
export {
|
|
69
|
+
export { _ as instantiateWidget };
|