@plitzi/sdk-elements 0.38.13 → 0.38.15
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 +263 -0
- package/dist/components/MarkdownDocument/components/CodeBlock/CodeBlock.mjs +23 -17
- package/dist/elements/advanced/PlitziSdk/Settings.mjs +42 -27
- package/dist/elements/advanced/PlitziSdk/declaration.d.ts +39 -0
- package/dist/elements/advanced/PlitziSdk/declaration.mjs +22 -0
- package/dist/elements/basic/Dropdown/Dropdown.d.ts +1 -1
- package/dist/elements/basic/Dropdown/Dropdown.mjs +65 -51
- package/dist/elements/basic/Dropdown/DropdownContext.d.ts +2 -0
- package/dist/elements/basic/Dropdown/DropdownPopup/DropdownPopup.mjs +13 -10
- package/dist/elements/basic/Dropdown/useDropdownTrigger.d.ts +3 -1
- package/dist/elements/basic/Dropdown/useDropdownTrigger.mjs +12 -14
- package/dist/elements/declarations/index.d.ts +30 -1
- package/dist/elements/declarations/index.mjs +77 -75
- package/dist/elements/internal/Page/Page.d.ts +12 -1
- package/dist/elements/internal/Page/Page.mjs +29 -22
- package/dist/elements/internal/Page/Settings.d.ts +3 -1
- package/dist/elements/internal/Page/Settings.mjs +65 -33
- package/dist/elements/internal/Page/declaration.d.ts +11 -0
- package/dist/elements/internal/Page/declaration.mjs +3 -2
- package/dist/elements/internal/Page/index.d.ts +4 -0
- package/dist/elements/provider/Channel/Channel.mjs +3 -1
- package/dist/elements/provider/Channel/declaration.mjs +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/realtime/useChannel.d.ts +7 -1
- package/dist/realtime/useChannel.mjs +43 -35
- package/package.json +11 -7
|
@@ -12,39 +12,39 @@ import m from "@plitzi/plitzi-ui/TextArea";
|
|
|
12
12
|
import h from "@plitzi/plitzi-ui/Select";
|
|
13
13
|
import g from "@plitzi/plitzi-ui/Select2";
|
|
14
14
|
//#region src/elements/internal/Page/Settings.tsx
|
|
15
|
-
var _ = ({ id: _ = "", seoEnabled: v = !1, enabled: y = !0, name: b = "", folder: x = "", seoPageTitle: S = "Title", seoPageDescription: C = "Description", slug: w = "", layout: T = "", layoutContainer: E = "", accessLevel: D = "", unauthorizedBehaviour: O = "", unauthorizedPageRedirect: k = "",
|
|
16
|
-
let [[
|
|
15
|
+
var _ = ({ id: _ = "", seoEnabled: v = !1, enabled: y = !0, name: b = "", folder: x = "", seoPageTitle: S = "Title", seoPageDescription: C = "Description", slug: w = "", layout: T = "", layoutContainer: E = "", accessLevel: D = "", unauthorizedBehaviour: O = "", unauthorizedPageRedirect: k = "", documentScroll: A = "", onUpdate: j }) => {
|
|
16
|
+
let [[M, N, P]] = i([
|
|
17
17
|
"schema.flat",
|
|
18
18
|
"schema.pages",
|
|
19
19
|
"schema.pageFolders"
|
|
20
|
-
]),
|
|
21
|
-
|
|
20
|
+
]), F = r(() => Object.values(o(M, N.filter((e) => e !== _))), [
|
|
21
|
+
M,
|
|
22
22
|
_,
|
|
23
|
-
|
|
24
|
-
]),
|
|
25
|
-
|
|
23
|
+
N
|
|
24
|
+
]), I = e(j), L = n((e) => {
|
|
25
|
+
j?.("name", e);
|
|
26
26
|
let t = b.replaceAll(" ", "-").toLowerCase().replaceAll(/([^a-z0-9]+)/gi, "");
|
|
27
|
-
(!w || w === t) &&
|
|
27
|
+
(!w || w === t) && j?.("slug", e.replaceAll(" ", "-").toLowerCase().replaceAll(/([^a-z0-9-]+)/gi, ""));
|
|
28
28
|
}, [
|
|
29
|
-
|
|
29
|
+
j,
|
|
30
30
|
w,
|
|
31
31
|
b
|
|
32
|
-
]),
|
|
32
|
+
]), R = n((e) => {
|
|
33
33
|
if (/^[a-zA-Z0-9:*/_-]+$/gim.test(e) || !e) {
|
|
34
34
|
let t = e.replaceAll("//", "/");
|
|
35
|
-
|
|
35
|
+
j?.("slug", t);
|
|
36
36
|
}
|
|
37
|
-
}, [
|
|
38
|
-
|
|
39
|
-
}, [
|
|
37
|
+
}, [j]), z = n((e) => {
|
|
38
|
+
j?.("accessLevel", e), j?.("unauthorizedBehaviour", ""), j?.("unauthorizedPageRedirect", "");
|
|
39
|
+
}, [j]), B = n((e) => j?.("seoEnabled", e.target.checked), [j]), V = n((e) => j?.("enabled", e.target.checked), [j]), H = n((e) => j?.("folder", e?.value ?? ""), [j]), U = r(() => [{
|
|
40
40
|
value: "",
|
|
41
41
|
label: "None"
|
|
42
|
-
}, ...
|
|
42
|
+
}, ...P.map(({ id: e, name: t }) => ({
|
|
43
43
|
value: e,
|
|
44
44
|
label: t
|
|
45
|
-
}))], [
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
}))], [P]), W = r(() => u(M, P, _, !0), [
|
|
46
|
+
M,
|
|
47
|
+
P,
|
|
48
48
|
_
|
|
49
49
|
]);
|
|
50
50
|
return /* @__PURE__ */ l("div", {
|
|
@@ -62,13 +62,13 @@ var _ = ({ id: _ = "", seoEnabled: v = !1, enabled: y = !0, name: b = "", folder
|
|
|
62
62
|
/* @__PURE__ */ c(f, {
|
|
63
63
|
label: " Page Enabled",
|
|
64
64
|
checked: y,
|
|
65
|
-
onChange:
|
|
65
|
+
onChange: V,
|
|
66
66
|
size: "xs"
|
|
67
67
|
}),
|
|
68
68
|
/* @__PURE__ */ c(p, {
|
|
69
69
|
value: b,
|
|
70
70
|
label: "Page Name",
|
|
71
|
-
onChange:
|
|
71
|
+
onChange: L,
|
|
72
72
|
size: "xs"
|
|
73
73
|
}),
|
|
74
74
|
/* @__PURE__ */ c(d, {
|
|
@@ -84,36 +84,36 @@ var _ = ({ id: _ = "", seoEnabled: v = !1, enabled: y = !0, name: b = "", folder
|
|
|
84
84
|
className: "flex flex-col",
|
|
85
85
|
children: [/* @__PURE__ */ c(p, {
|
|
86
86
|
value: w,
|
|
87
|
-
onChange:
|
|
87
|
+
onChange: R,
|
|
88
88
|
label: "Slug / Path",
|
|
89
89
|
className: { inputContainer: "rounded-none rounded-tl rounded-tr" },
|
|
90
90
|
size: "xs"
|
|
91
91
|
}), /* @__PURE__ */ l("div", {
|
|
92
92
|
className: "truncate rounded-b border-x border-b border-gray-200 px-1 py-0.5 text-xs",
|
|
93
|
-
title:
|
|
93
|
+
title: W,
|
|
94
94
|
children: ["Full Path: ", /* @__PURE__ */ c("span", {
|
|
95
95
|
className: "font-bold",
|
|
96
|
-
children:
|
|
96
|
+
children: W
|
|
97
97
|
})]
|
|
98
98
|
})]
|
|
99
99
|
}),
|
|
100
100
|
/* @__PURE__ */ c(g, {
|
|
101
101
|
label: "Folder",
|
|
102
102
|
value: x,
|
|
103
|
-
options:
|
|
103
|
+
options: U,
|
|
104
104
|
placeholder: "None",
|
|
105
|
-
onChange:
|
|
105
|
+
onChange: H,
|
|
106
106
|
size: "xs"
|
|
107
107
|
}),
|
|
108
108
|
/* @__PURE__ */ c(t, {
|
|
109
109
|
layout: T,
|
|
110
110
|
layoutContainer: E,
|
|
111
|
-
onUpdate:
|
|
111
|
+
onUpdate: j
|
|
112
112
|
}),
|
|
113
113
|
/* @__PURE__ */ l(h, {
|
|
114
114
|
value: D,
|
|
115
115
|
label: "Restrict Access",
|
|
116
|
-
onChange:
|
|
116
|
+
onChange: z,
|
|
117
117
|
placeholder: "None",
|
|
118
118
|
size: "xs",
|
|
119
119
|
children: [/* @__PURE__ */ c("option", {
|
|
@@ -145,7 +145,7 @@ var _ = ({ id: _ = "", seoEnabled: v = !1, enabled: y = !0, name: b = "", folder
|
|
|
145
145
|
D !== "" && /* @__PURE__ */ c(h, {
|
|
146
146
|
label: "Unauthorized Behaviour",
|
|
147
147
|
value: O,
|
|
148
|
-
onChange:
|
|
148
|
+
onChange: I.text("unauthorizedBehaviour"),
|
|
149
149
|
placeholder: "None",
|
|
150
150
|
size: "xs",
|
|
151
151
|
children: /* @__PURE__ */ c("option", {
|
|
@@ -156,31 +156,63 @@ var _ = ({ id: _ = "", seoEnabled: v = !1, enabled: y = !0, name: b = "", folder
|
|
|
156
156
|
O === "redirect" && /* @__PURE__ */ c(h, {
|
|
157
157
|
value: k,
|
|
158
158
|
label: "Redirect Page",
|
|
159
|
-
onChange:
|
|
159
|
+
onChange: I.text("unauthorizedPageRedirect"),
|
|
160
160
|
placeholder: "None",
|
|
161
161
|
size: "xs",
|
|
162
|
-
children:
|
|
162
|
+
children: F.map((e) => /* @__PURE__ */ c("option", {
|
|
163
163
|
value: e.id,
|
|
164
164
|
children: a(e, "attributes.name")
|
|
165
165
|
}, e.id))
|
|
166
166
|
}),
|
|
167
|
+
/* @__PURE__ */ l(h, {
|
|
168
|
+
value: A,
|
|
169
|
+
label: "Document Scroll",
|
|
170
|
+
onChange: I.text("documentScroll"),
|
|
171
|
+
placeholder: "Scrolls",
|
|
172
|
+
size: "xs",
|
|
173
|
+
children: [/* @__PURE__ */ c("option", {
|
|
174
|
+
value: "noBounce",
|
|
175
|
+
children: "No bounce"
|
|
176
|
+
}), /* @__PURE__ */ c("option", {
|
|
177
|
+
value: "locked",
|
|
178
|
+
children: "Locked"
|
|
179
|
+
})]
|
|
180
|
+
}),
|
|
181
|
+
A === "noBounce" && /* @__PURE__ */ c(d, {
|
|
182
|
+
intent: "info",
|
|
183
|
+
solid: !1,
|
|
184
|
+
size: "xs",
|
|
185
|
+
children: /* @__PURE__ */ c("span", {
|
|
186
|
+
className: "text-xs",
|
|
187
|
+
children: "The page scrolls, but a finger pulled past either end no longer bounces it or reloads it"
|
|
188
|
+
})
|
|
189
|
+
}),
|
|
190
|
+
A === "locked" && /* @__PURE__ */ c(d, {
|
|
191
|
+
intent: "info",
|
|
192
|
+
solid: !1,
|
|
193
|
+
size: "xs",
|
|
194
|
+
children: /* @__PURE__ */ c("span", {
|
|
195
|
+
className: "text-xs",
|
|
196
|
+
children: "The page holds still: only the parts set to scroll on their own (overflow auto) move. For a screen that fills the window — a dashboard, a board"
|
|
197
|
+
})
|
|
198
|
+
}),
|
|
167
199
|
/* @__PURE__ */ c(f, {
|
|
168
200
|
label: " SEO Enabled",
|
|
169
201
|
checked: v,
|
|
170
|
-
onChange:
|
|
202
|
+
onChange: B,
|
|
171
203
|
size: "xs"
|
|
172
204
|
}),
|
|
173
205
|
v && /* @__PURE__ */ l(s, { children: [
|
|
174
206
|
/* @__PURE__ */ c(p, {
|
|
175
207
|
value: S,
|
|
176
208
|
label: "SEO Title",
|
|
177
|
-
onChange:
|
|
209
|
+
onChange: I.text("seoPageTitle"),
|
|
178
210
|
size: "xs"
|
|
179
211
|
}),
|
|
180
212
|
/* @__PURE__ */ c(m, {
|
|
181
213
|
label: "SEO Description",
|
|
182
214
|
value: C,
|
|
183
|
-
onChange:
|
|
215
|
+
onChange: I.text("seoPageDescription"),
|
|
184
216
|
rows: 3,
|
|
185
217
|
size: "xs"
|
|
186
218
|
}),
|
|
@@ -2,9 +2,19 @@ import { PageProps } from './Page';
|
|
|
2
2
|
import { AuthorableAttributes } from '@plitzi/sdk-shared/authoring/declare';
|
|
3
3
|
/** What this element can be authored with — its component's own props, minus what the runtime supplies. */
|
|
4
4
|
export type PageAttributes = AuthorableAttributes<PageProps>;
|
|
5
|
+
/**
|
|
6
|
+
* How the document holding a page moves under a finger or a wheel, when the page says so — see
|
|
7
|
+
* `PageProps.documentScroll`. Read by the authoring surface to refuse anything else.
|
|
8
|
+
*/
|
|
9
|
+
export declare const DOCUMENT_SCROLLS: readonly ["locked", "noBounce"];
|
|
10
|
+
export type DocumentScroll = (typeof DOCUMENT_SCROLLS)[number];
|
|
11
|
+
export declare const isDocumentScroll: (value: unknown) => value is DocumentScroll;
|
|
5
12
|
declare const declaration: import('@plitzi/sdk-shared/authoring/declare').DeclaredElement<{
|
|
6
13
|
readonly type: "page";
|
|
7
14
|
readonly serverTemplates: readonly ["seoPageTitle", "seoPageDescription", "notFound"];
|
|
15
|
+
readonly attributeValues: {
|
|
16
|
+
readonly documentScroll: readonly ["locked", "noBounce"];
|
|
17
|
+
};
|
|
8
18
|
readonly triggers: {
|
|
9
19
|
readonly onPageLoad: {
|
|
10
20
|
readonly action: "onPageLoad";
|
|
@@ -70,5 +80,6 @@ declare const declaration: import('@plitzi/sdk-shared/authoring/declare').Declar
|
|
|
70
80
|
seoEnabled?: boolean | undefined;
|
|
71
81
|
seoPageTitle?: string | undefined;
|
|
72
82
|
seoPageDescription?: string | undefined;
|
|
83
|
+
documentScroll?: (DocumentScroll | "") | undefined;
|
|
73
84
|
}>>;
|
|
74
85
|
export default declaration;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { elementDeclaration as e } from "@plitzi/sdk-shared/authoring/declare";
|
|
2
2
|
//#region src/elements/internal/Page/declaration.ts
|
|
3
|
-
var t = e()({
|
|
3
|
+
var t = ["locked", "noBounce"], n = (e) => t.some((t) => t === e), r = e()({
|
|
4
4
|
type: "page",
|
|
5
5
|
serverTemplates: [
|
|
6
6
|
"seoPageTitle",
|
|
7
7
|
"seoPageDescription",
|
|
8
8
|
"notFound"
|
|
9
9
|
],
|
|
10
|
+
attributeValues: { documentScroll: t },
|
|
10
11
|
triggers: { onPageLoad: {
|
|
11
12
|
action: "onPageLoad",
|
|
12
13
|
title: "On Page Load",
|
|
@@ -59,4 +60,4 @@ var t = e()({
|
|
|
59
60
|
}
|
|
60
61
|
});
|
|
61
62
|
//#endregion
|
|
62
|
-
export { t as default };
|
|
63
|
+
export { t as DOCUMENT_SCROLLS, r as default, n as isDocumentScroll };
|
|
@@ -4,6 +4,9 @@ declare const Page: {
|
|
|
4
4
|
} & {
|
|
5
5
|
readonly type: "page";
|
|
6
6
|
readonly serverTemplates: readonly ["seoPageTitle", "seoPageDescription", "notFound"];
|
|
7
|
+
readonly attributeValues: {
|
|
8
|
+
readonly documentScroll: readonly ["locked", "noBounce"];
|
|
9
|
+
};
|
|
7
10
|
readonly triggers: {
|
|
8
11
|
readonly onPageLoad: {
|
|
9
12
|
readonly action: "onPageLoad";
|
|
@@ -71,5 +74,6 @@ declare const Page: {
|
|
|
71
74
|
seoEnabled?: boolean | undefined;
|
|
72
75
|
seoPageTitle?: string | undefined;
|
|
73
76
|
seoPageDescription?: string | undefined;
|
|
77
|
+
documentScroll?: (import('./declaration').DocumentScroll | "") | undefined;
|
|
74
78
|
}>>;
|
|
75
79
|
export default Page;
|
|
@@ -62,11 +62,13 @@ var S = (e) => {
|
|
|
62
62
|
me: R.me ?? "",
|
|
63
63
|
members: R.members,
|
|
64
64
|
messages: N,
|
|
65
|
-
last: N.at(-1) ?? null
|
|
65
|
+
last: N.at(-1) ?? null,
|
|
66
|
+
retained: R.retained
|
|
66
67
|
}), [
|
|
67
68
|
R.connected,
|
|
68
69
|
R.me,
|
|
69
70
|
R.members,
|
|
71
|
+
R.retained,
|
|
70
72
|
N
|
|
71
73
|
]), H = c(() => i(V), [V]);
|
|
72
74
|
_({
|
|
@@ -93,7 +93,7 @@ var n = e()({
|
|
|
93
93
|
},
|
|
94
94
|
definition: {
|
|
95
95
|
label: "Channel",
|
|
96
|
-
description: "A realtime channel: every OTHER page on the same `topic` hears what one publishes, within milliseconds — the page that sent it too with `echo` (its `from` is then the `me` of the channel). The topic must match a channel the space declares in its settings (`channels`), e.g. `board:{{ id }}` under `board:{id}`. A topic of a private channel (`grant: true`) opens only with `grant`, bound to the grant the action that let this visitor in returned (its `realtime.grant` step). ITS DESCENDANTS bind to its source `channel_<id>`: `connected`, `members` (with the state each announced), `messages` (the last `keep`) and `
|
|
96
|
+
description: "A realtime channel: every OTHER page on the same `topic` hears what one publishes, within milliseconds — the page that sent it too with `echo` (its `from` is then the `me` of the channel). The topic must match a channel the space declares in its settings (`channels`), e.g. `board:{{ id }}` under `board:{id}`. A topic of a private channel (`grant: true`) opens only with `grant`, bound to the grant the action that let this visitor in returned (its `realtime.grant` step). ITS DESCENDANTS bind to its source `channel_<id>`: `connected`, `members` (with the state each announced), `messages` (the last `keep`), `last` and — on a `retain: true` channel — `retained`, the latest data the server said of each type, there as the page joins (`retained.lists`). It fires `onMessage`; `onJoin` when somebody who came after this page has announced who they are, and `onLeave` when somebody goes — each with `from`, `user` and the `state` they announced; and answers `publish({ type, data, echo })` and `setPresence({ data })`; `presence` is the state this page announces (a name, a colour). Closed in the builder and anywhere without a server.",
|
|
97
97
|
items: []
|
|
98
98
|
},
|
|
99
99
|
market: {
|
package/dist/index.d.ts
CHANGED
|
@@ -647,6 +647,9 @@ export declare const defaultElements: {
|
|
|
647
647
|
} & {
|
|
648
648
|
readonly type: "page";
|
|
649
649
|
readonly serverTemplates: readonly ["seoPageTitle", "seoPageDescription", "notFound"];
|
|
650
|
+
readonly attributeValues: {
|
|
651
|
+
readonly documentScroll: readonly ["locked", "noBounce"];
|
|
652
|
+
};
|
|
650
653
|
readonly triggers: {
|
|
651
654
|
readonly onPageLoad: {
|
|
652
655
|
readonly action: "onPageLoad";
|
|
@@ -714,6 +717,7 @@ export declare const defaultElements: {
|
|
|
714
717
|
seoEnabled?: boolean | undefined;
|
|
715
718
|
seoPageTitle?: string | undefined;
|
|
716
719
|
seoPageDescription?: string | undefined;
|
|
720
|
+
documentScroll?: (import('./elements/internal/Page/declaration').DocumentScroll | "") | undefined;
|
|
717
721
|
}>>;
|
|
718
722
|
container: {
|
|
719
723
|
(props: import('./Element/hocs/withElement').WithElementProps<import('./elements/structure/Container/Container').ContainerProps>): import('react').JSX.Element;
|
|
@@ -20,6 +20,11 @@ export type ChannelHandle = {
|
|
|
20
20
|
/** This page's name on the channel — the `from` of what it sends. */
|
|
21
21
|
me: string | undefined;
|
|
22
22
|
members: RealtimeMember[];
|
|
23
|
+
/**
|
|
24
|
+
* What a `retain: true` channel keeps, by type: the latest data the server said of each — there as the page joins,
|
|
25
|
+
* and changed as it is said again. Empty on any other channel.
|
|
26
|
+
*/
|
|
27
|
+
retained: Record<string, unknown>;
|
|
23
28
|
/** Heard by every other page on the topic — and by this one too with `{ echo: true }`, once the server took it. */
|
|
24
29
|
publish: (type: string, data: unknown, options?: RealtimePublishOptions) => Promise<boolean>;
|
|
25
30
|
setPresence: (state: unknown) => void;
|
|
@@ -29,7 +34,8 @@ export type ChannelHandle = {
|
|
|
29
34
|
* the speed of a cursor reads directly.
|
|
30
35
|
*
|
|
31
36
|
* Messages arrive through `onMessage` rather than as state, so a canvas redrawing sixty cursors a second does not
|
|
32
|
-
* re-render the component sixty times a second
|
|
37
|
+
* re-render the component sixty times a second — all but what a `retain: true` channel keeps, which is state
|
|
38
|
+
* (`retained`): a page that joins hears each kept message as if it had just been said. Closed — no connection, no members — where the page has no server to
|
|
33
39
|
* connect to (the builder, an embed), and on the server.
|
|
34
40
|
*/
|
|
35
41
|
declare const useChannel: (asked: string | undefined, { grant, presence, onMessage, onJoin, onLeave }?: UseChannelOptions) => ChannelHandle;
|
|
@@ -2,56 +2,64 @@ import { useCallback as e, useEffect as t, useMemo as n, useRef as r, useState a
|
|
|
2
2
|
import { useCommonStore as a } from "@plitzi/sdk-shared/store";
|
|
3
3
|
import { REVOKED_TYPE as o, isValidTopic as s, matchChannel as c, realtimeClientFor as l, trackPresence as u } from "@plitzi/sdk-shared/realtime";
|
|
4
4
|
//#region src/realtime/useChannel.ts
|
|
5
|
-
var d = (
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
var d = (e, t) => {
|
|
6
|
+
if (Object.hasOwn(e, t.type) && e[t.type].at > t.at) return e;
|
|
7
|
+
let n = Object.fromEntries(Object.entries(e).filter(([e]) => e !== t.type));
|
|
8
|
+
return t.data === null ? n : {
|
|
9
|
+
...n,
|
|
10
|
+
[t.type]: t
|
|
11
|
+
};
|
|
12
|
+
}, f = (f, { grant: p, presence: m, onMessage: h, onJoin: g, onLeave: _ } = {}) => {
|
|
13
|
+
let [v] = a("schema.settings.channels"), y = f && (v ? c(f, v) : s(f)) ? f : void 0, [b] = a("realtime.endpoint"), [x] = a("realtime.transport"), S = n(() => b && typeof window < "u" ? l(b, x) : void 0, [b, x]), [C, w] = i(!1), [T, E] = i([]), [D, O] = i({}), k = r(void 0), A = r({
|
|
14
|
+
onMessage: h,
|
|
15
|
+
onJoin: g,
|
|
16
|
+
onLeave: _
|
|
10
17
|
});
|
|
11
18
|
t(() => {
|
|
12
|
-
|
|
13
|
-
onMessage:
|
|
14
|
-
onJoin:
|
|
15
|
-
onLeave:
|
|
19
|
+
A.current = {
|
|
20
|
+
onMessage: h,
|
|
21
|
+
onJoin: g,
|
|
22
|
+
onLeave: _
|
|
16
23
|
};
|
|
17
24
|
}), t(() => {
|
|
18
|
-
|
|
25
|
+
S && y && p && S.grant(y, p);
|
|
19
26
|
}, [
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
27
|
+
S,
|
|
28
|
+
y,
|
|
29
|
+
p
|
|
23
30
|
]), t(() => {
|
|
24
|
-
if (!
|
|
25
|
-
let e = u(
|
|
26
|
-
onChange:
|
|
31
|
+
if (!S || !y) return;
|
|
32
|
+
let e = u(S, y, {
|
|
33
|
+
onChange: E,
|
|
27
34
|
onMessage: (e) => {
|
|
28
|
-
e.type === o && e.from === "server" &&
|
|
35
|
+
e.type === o && e.from === "server" && w(!1), e.retained === !0 && e.from === "server" && O((t) => d(t, e)), A.current.onMessage?.(e);
|
|
29
36
|
},
|
|
30
|
-
onArrive: (e) =>
|
|
31
|
-
onDepart: (e) =>
|
|
37
|
+
onArrive: (e) => A.current.onJoin?.(e),
|
|
38
|
+
onDepart: (e) => A.current.onLeave?.(e)
|
|
32
39
|
});
|
|
33
|
-
|
|
34
|
-
let t =
|
|
40
|
+
k.current = e, w(S.status === "open" && !S.refusal(y));
|
|
41
|
+
let t = S.onStatus((e) => w(e === "open" && !S.refusal(y)));
|
|
35
42
|
return () => {
|
|
36
|
-
t(), e.stop(),
|
|
43
|
+
t(), e.stop(), k.current = void 0, E([]), O({}), w(!1);
|
|
37
44
|
};
|
|
38
|
-
}, [
|
|
39
|
-
let
|
|
45
|
+
}, [S, y]);
|
|
46
|
+
let j = m === void 0 ? void 0 : JSON.stringify(m);
|
|
40
47
|
t(() => {
|
|
41
|
-
|
|
48
|
+
j !== void 0 && k.current?.set(JSON.parse(j));
|
|
42
49
|
}, [
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
50
|
+
j,
|
|
51
|
+
S,
|
|
52
|
+
y
|
|
46
53
|
]);
|
|
47
|
-
let
|
|
54
|
+
let M = e((e, t, n) => S && y ? S.publish(y, e, t, n) : Promise.resolve(!1), [S, y]), N = e((e) => k.current?.set(e), []), P = n(() => Object.fromEntries(Object.entries(D).map(([e, t]) => [e, t.data])), [D]);
|
|
48
55
|
return {
|
|
49
|
-
connected:
|
|
50
|
-
me:
|
|
51
|
-
members:
|
|
52
|
-
|
|
53
|
-
|
|
56
|
+
connected: C,
|
|
57
|
+
me: C ? S?.me : void 0,
|
|
58
|
+
members: T,
|
|
59
|
+
retained: P,
|
|
60
|
+
publish: M,
|
|
61
|
+
setPresence: N
|
|
54
62
|
};
|
|
55
63
|
};
|
|
56
64
|
//#endregion
|
|
57
|
-
export {
|
|
65
|
+
export { f as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plitzi/sdk-elements",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.15",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -394,6 +394,10 @@
|
|
|
394
394
|
"types": "./dist/elements/advanced/PlitziSdk/Settings.d.ts",
|
|
395
395
|
"import": "./dist/elements/advanced/PlitziSdk/Settings.mjs"
|
|
396
396
|
},
|
|
397
|
+
"./elements/advanced/PlitziSdk/declaration": {
|
|
398
|
+
"types": "./dist/elements/advanced/PlitziSdk/declaration.d.ts",
|
|
399
|
+
"import": "./dist/elements/advanced/PlitziSdk/declaration.mjs"
|
|
400
|
+
},
|
|
397
401
|
"./elements/advanced/Reference": {
|
|
398
402
|
"types": "./dist/elements/advanced/Reference/index.d.ts",
|
|
399
403
|
"import": "./dist/elements/advanced/Reference/index.mjs"
|
|
@@ -1419,12 +1423,12 @@
|
|
|
1419
1423
|
"@dr.pogodin/react-helmet": "^3.3.2",
|
|
1420
1424
|
"@plitzi/nexus": "^1.4.0",
|
|
1421
1425
|
"@plitzi/plitzi-ui": "^1.6.33",
|
|
1422
|
-
"@plitzi/sdk-auth": "0.38.
|
|
1423
|
-
"@plitzi/sdk-event-bridge": "0.38.
|
|
1424
|
-
"@plitzi/sdk-interactions": "0.38.
|
|
1425
|
-
"@plitzi/sdk-navigation": "0.38.
|
|
1426
|
-
"@plitzi/sdk-schema": "0.38.
|
|
1427
|
-
"@plitzi/sdk-shared": "0.38.
|
|
1426
|
+
"@plitzi/sdk-auth": "0.38.15",
|
|
1427
|
+
"@plitzi/sdk-event-bridge": "0.38.15",
|
|
1428
|
+
"@plitzi/sdk-interactions": "0.38.15",
|
|
1429
|
+
"@plitzi/sdk-navigation": "0.38.15",
|
|
1430
|
+
"@plitzi/sdk-schema": "0.38.15",
|
|
1431
|
+
"@plitzi/sdk-shared": "0.38.15",
|
|
1428
1432
|
"clsx": "^2.1.1",
|
|
1429
1433
|
"immer": "^11.1.21",
|
|
1430
1434
|
"react-markdown": "^10.1.0",
|