@devvit/ui-renderer 0.10.19-next-2024-04-18-f099533a2.0 → 0.10.19-next-2024-04-18-87d0d5b9f.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/client/devvit-custom-post.d.ts +2 -3
- package/client/devvit-custom-post.d.ts.map +1 -1
- package/client/devvit-custom-post.js +5 -9
- package/client/dispatcher.d.ts +2 -2
- package/client/dispatcher.d.ts.map +1 -1
- package/client/remote-app.d.ts +33 -0
- package/client/remote-app.d.ts.map +1 -0
- package/client/remote-app.js +71 -0
- package/package.json +9 -8
- package/client/ui-app.d.ts +0 -18
- package/client/ui-app.d.ts.map +0 -1
- package/client/ui-app.js +0 -39
|
@@ -2,11 +2,10 @@ import '@reddit/faceplate-ui/templateRenderingStrategy/clientStrategy.js';
|
|
|
2
2
|
import type { BlockAction, Effect, LinkedBundle, Metadata, RealtimeEvent, RenderPostResponse, Struct, UIEvent } from '@devvit/protos';
|
|
3
3
|
import { Dimensions } from '@devvit/protos';
|
|
4
4
|
import type { WorkerErrorType } from '@devvit/runtime-lite/client/BrowserLiteClient.js';
|
|
5
|
-
import type { ActorRef } from '@devvit/runtimes/common/runtime/ActorRef.js';
|
|
6
5
|
import type { FaceplateEvent } from '@reddit/faceplate/event-types.js';
|
|
7
6
|
import type { PropertyValues } from 'lit';
|
|
8
7
|
import { LitElement } from 'lit';
|
|
9
|
-
import type {
|
|
8
|
+
import type { RemoteApp } from './remote-app.js';
|
|
10
9
|
import '../blocks/components/devvit-blocks-renderer.js';
|
|
11
10
|
import '../blocks/components/devvit-blocks-webview.js';
|
|
12
11
|
import './devvit-animation-player.js';
|
|
@@ -61,7 +60,7 @@ export declare class DevvitCustomPost extends LitElement {
|
|
|
61
60
|
#private;
|
|
62
61
|
static get styles(): import("lit").CSSResult[];
|
|
63
62
|
/** Probably a wrapper around the remote runtime (compute-go). */
|
|
64
|
-
|
|
63
|
+
remoteApp?: RemoteApp | undefined;
|
|
65
64
|
bundle?: LinkedBundle | undefined;
|
|
66
65
|
localRuntimeCode?: Blob | undefined;
|
|
67
66
|
metadata?: Metadata | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devvit-custom-post.d.ts","sourceRoot":"","sources":["../../library/src/client/devvit-custom-post.ts"],"names":[],"mappings":"AAAA,OAAO,kEAAkE,CAAC;AAE1E,OAAO,KAAK,EACV,WAAW,EAEX,MAAM,EACN,YAAY,EACZ,QAAQ,EACR,aAAa,EAEb,kBAAkB,EAClB,MAAM,EACN,OAAO,
|
|
1
|
+
{"version":3,"file":"devvit-custom-post.d.ts","sourceRoot":"","sources":["../../library/src/client/devvit-custom-post.ts"],"names":[],"mappings":"AAAA,OAAO,kEAAkE,CAAC;AAE1E,OAAO,KAAK,EACV,WAAW,EAEX,MAAM,EACN,YAAY,EACZ,QAAQ,EACR,aAAa,EAEb,kBAAkB,EAClB,MAAM,EACN,OAAO,EAER,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAKL,UAAU,EAEX,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAEV,eAAe,EAChB,MAAM,kDAAkD,CAAC;AAK1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAGvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAiB,MAAM,KAAK,CAAC;AAOhD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,gDAAgD,CAAC;AACxD,OAAO,+CAA+C,CAAC;AACvD,OAAO,8BAA8B,CAAC;AAEtC,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,oBAAoB,EAAE,gBAAgB,CAAC;KACxC;IACD,UAAU,mBAAmB;QAC3B,sBAAsB,EAAE,uBAAuB,CAAC;QAChD,kBAAkB,EAAE,mBAAmB,CAAC;QACxC,iBAAiB,EAAE,cAAc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AC;IAEhE,mBAAmB,EAAE,OAAO,CAAS;IACF,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IAEzE,qBAAqB,EAAE,OAAO,CAAS;IAGgB,UAAU,EAAE,OAAO,CAAQ;IACzE,cAAc,CAAC,EAAE,kBAAkB,GAAG,SAAS,CAAC;IAChD,UAAU,CAAC,EAAE,UAAU,CAAC;IAEA,OAAO,CAAC,eAAe,CAAwB;IACvE,OAAO,CAAC,YAAY,CAAkB;IACtC,OAAO,CAAC,UAAU,CAAC,CAAoB;;IAehD,IAAI,YAAY,IAAI,MAAM,CAGzB;IACc,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAoBxC,oBAAoB,IAAI,IAAI;IASrC,QAAQ,IAAI,IAAI;cAIG,MAAM;cAoBA,UAAU,CAAC,KAAK,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAmHhF"}
|
|
@@ -32,7 +32,6 @@ import { DevvitBlocksRenderer } from '../blocks/components/devvit-blocks-rendere
|
|
|
32
32
|
import { DEFAULT_ROOT_HEIGHT } from '../blocks/templates/renderBlock.js';
|
|
33
33
|
import { styles } from '../styles.js';
|
|
34
34
|
import { Dispatcher } from './dispatcher.js';
|
|
35
|
-
import { RemoteApp } from './ui-app.js';
|
|
36
35
|
import '../blocks/components/devvit-blocks-renderer.js';
|
|
37
36
|
import '../blocks/components/devvit-blocks-webview.js';
|
|
38
37
|
import './devvit-animation-player.js';
|
|
@@ -174,13 +173,10 @@ let DevvitCustomPost = class DevvitCustomPost extends LitElement {
|
|
|
174
173
|
if (props.has('runtimeDebugLogging')) {
|
|
175
174
|
__classPrivateFieldGet(this, _DevvitCustomPost_dispatcher, "f").runtimeDebugLogging = this.runtimeDebugLogging;
|
|
176
175
|
}
|
|
177
|
-
if (props.has('
|
|
178
|
-
if (!this.
|
|
179
|
-
__classPrivateFieldGet(this, _DevvitCustomPost_dispatcher, "f").remote = undefined;
|
|
180
|
-
|
|
181
|
-
__classPrivateFieldGet(this, _DevvitCustomPost_dispatcher, "f").remote = new RemoteApp(this.actorRef); // to-do: delete ActorRef.
|
|
182
|
-
else
|
|
183
|
-
__classPrivateFieldGet(this, _DevvitCustomPost_dispatcher, "f").remote = this.actorRef;
|
|
176
|
+
if (props.has('remoteApp')) {
|
|
177
|
+
if (!this.remoteApp) {
|
|
178
|
+
__classPrivateFieldGet(this, _DevvitCustomPost_dispatcher, "f").remote = this.remoteApp ?? undefined;
|
|
179
|
+
}
|
|
184
180
|
}
|
|
185
181
|
if (props.has('localRuntimeCode'))
|
|
186
182
|
__classPrivateFieldGet(this, _DevvitCustomPost_dispatcher, "f").setLocalSrc(this.localRuntimeCode);
|
|
@@ -229,7 +225,7 @@ _DevvitCustomPost_bubble = function _DevvitCustomPost_bubble(type, detail) {
|
|
|
229
225
|
__decorate([
|
|
230
226
|
property({ attribute: false }),
|
|
231
227
|
__metadata("design:type", Object)
|
|
232
|
-
], DevvitCustomPost.prototype, "
|
|
228
|
+
], DevvitCustomPost.prototype, "remoteApp", void 0);
|
|
233
229
|
__decorate([
|
|
234
230
|
property({ attribute: false }),
|
|
235
231
|
__metadata("design:type", Object)
|
package/client/dispatcher.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { BlockRenderEventType } from '@devvit/protos';
|
|
|
3
3
|
import type { ErrorCallback, LiteClient } from '@devvit/runtime-lite/client/BrowserLiteClient.js';
|
|
4
4
|
import type { PluginCallback } from '@devvit/runtime-lite/runtime/RuntimeLite.js';
|
|
5
5
|
import type { T3ID, TID } from '@devvit/shared-types/tid.js';
|
|
6
|
-
import type {
|
|
6
|
+
import type { RemoteApp } from './remote-app.js';
|
|
7
7
|
type AppState = {
|
|
8
8
|
__postData?: {
|
|
9
9
|
thingId: TID | undefined;
|
|
@@ -38,7 +38,7 @@ export declare class Dispatcher {
|
|
|
38
38
|
postConfig?: Struct['fields'] | undefined;
|
|
39
39
|
postID?: T3ID | undefined;
|
|
40
40
|
/** A client to the remote runtime. */
|
|
41
|
-
remote?:
|
|
41
|
+
remote?: RemoteApp | undefined;
|
|
42
42
|
/** Dimensions that describe layout information for the custom post entry point */
|
|
43
43
|
dimensions: Dimensions;
|
|
44
44
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatcher.d.ts","sourceRoot":"","sources":["../../library/src/client/dispatcher.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,EACV,MAAM,EAGN,YAAY,EACZ,QAAQ,EACR,iBAAiB,EACjB,kBAAkB,EAClB,MAAM,EACN,OAAO,EACR,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAsB,MAAM,gBAAgB,CAAC;AAC1E,OAAO,KAAK,EACV,aAAa,EACb,UAAU,EAEX,MAAM,kDAAkD,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAC;AAGlF,OAAO,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,6BAA6B,CAAC;AAG7D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"dispatcher.d.ts","sourceRoot":"","sources":["../../library/src/client/dispatcher.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,EACV,MAAM,EAGN,YAAY,EACZ,QAAQ,EACR,iBAAiB,EACjB,kBAAkB,EAClB,MAAM,EACN,OAAO,EACR,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAsB,MAAM,gBAAgB,CAAC;AAC1E,OAAO,KAAK,EACV,aAAa,EACb,UAAU,EAEX,MAAM,kDAAkD,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAC;AAGlF,OAAO,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,6BAA6B,CAAC;AAG7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAQjD,KAAK,QAAQ,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EAAE,oBAAoB,EAAE,EAAE,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI;IAK1F,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED;;;OAGG;IACH,aAAa,IAAI,IAAI;IAKrB,IAAI,mBAAmB,CAAC,EAAE,EAAE,OAAO,EAGlC;IAED,mCAAmC;IACnC,WAAW,CAAC,GAAG,EAAE,IAAI,GAAG,SAAS,GAAG,IAAI;IAWxC,mDAAmD;IACnD,MAAM,IAAI,IAAI;CAiHf"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ContextAction, ContextActionList, ContextActionRequest, ContextActionResponse, CustomPost, Empty, UIEventHandler } from '@devvit/protos';
|
|
2
|
+
import { type HandleUIEventRequest, type HandleUIEventResponse, type Metadata, type RenderPostRequest, type RenderPostResponse, type UIRequest, type UIResponse } from '@devvit/protos';
|
|
3
|
+
import { type CallOptions } from 'nice-grpc-web';
|
|
4
|
+
type CustomPostNiceClient = {
|
|
5
|
+
renderPost(req: Readonly<RenderPostRequest>, opts: Readonly<CallOptions>): Promise<RenderPostResponse>;
|
|
6
|
+
renderPostComposer(req: Readonly<UIRequest>, opts: Readonly<CallOptions>): Promise<UIResponse>;
|
|
7
|
+
renderPostContent(req: Readonly<UIRequest>, opts: Readonly<CallOptions>): Promise<UIResponse>;
|
|
8
|
+
};
|
|
9
|
+
type UIEventHandlerNiceClient = {
|
|
10
|
+
handleUIEvent(req: Readonly<HandleUIEventRequest>, opts: Readonly<CallOptions>): Promise<HandleUIEventResponse>;
|
|
11
|
+
};
|
|
12
|
+
type ContextActionNiceClient = {
|
|
13
|
+
getActions(req: Readonly<Empty>, opts: Readonly<CallOptions>): Promise<ContextActionList>;
|
|
14
|
+
onAction(req: Readonly<ContextActionRequest>, opts: Readonly<CallOptions>): Promise<ContextActionResponse>;
|
|
15
|
+
};
|
|
16
|
+
type UIApp = UIEventHandler & CustomPost & ContextAction;
|
|
17
|
+
type Meta = {
|
|
18
|
+
installation: string;
|
|
19
|
+
actor: string;
|
|
20
|
+
};
|
|
21
|
+
export declare class RemoteApp implements UIApp {
|
|
22
|
+
#private;
|
|
23
|
+
static new(gatewayOrigin: string, meta: Meta): RemoteApp;
|
|
24
|
+
constructor(contextAction: ContextActionNiceClient, customPost: CustomPostNiceClient, uiEventHandler: UIEventHandlerNiceClient, meta: Meta);
|
|
25
|
+
GetActions(req: Readonly<Empty>, meta?: Readonly<Metadata> | undefined): Promise<ContextActionList>;
|
|
26
|
+
HandleUIEvent(req: Readonly<HandleUIEventRequest>, meta: Readonly<Metadata> | undefined): Promise<HandleUIEventResponse>;
|
|
27
|
+
OnAction(req: Readonly<ContextActionRequest>, meta?: Readonly<Metadata> | undefined): Promise<ContextActionResponse>;
|
|
28
|
+
RenderPost(req: Readonly<RenderPostRequest>, meta: Readonly<Metadata> | undefined): Promise<RenderPostResponse>;
|
|
29
|
+
RenderPostContent(req: Readonly<UIRequest>, meta: Readonly<Metadata> | undefined): Promise<UIResponse>;
|
|
30
|
+
RenderPostComposer(req: Readonly<UIRequest>, meta: Readonly<Metadata> | undefined): Promise<UIResponse>;
|
|
31
|
+
}
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=remote-app.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-app.d.ts","sourceRoot":"","sources":["../../library/src/client/remote-app.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,UAAU,EACV,KAAK,EACL,cAAc,EACf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAIL,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,QAAQ,EACb,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,SAAS,EACd,KAAK,UAAU,EAChB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAIL,KAAK,WAAW,EAEjB,MA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G,SAAS;gBAmBtD,aAAa,EAAE,uBAAuB,EACtC,UAAU,EAAE,oBAAoB,EAChC,cAAc,EAAE,wBAAwB,EACxC,IAAI,EAAE,IAAI;IAkBN,UAAU,CACd,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,EACpB,IAAI,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,SAAS,GACpC,OAAO,CAAC,iBAAiB,CAAC;IAMvB,aAAa,CACjB,GAAG,EAAE,QAAQ,CAAC,oBAAoB,CAAC,EACnC,IAAI,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,SAAS,GACnC,OAAO,CAAC,qBAAqB,CAAC;IAM3B,QAAQ,CACZ,GAAG,EAAE,QAAQ,CAAC,oBAAoB,CAAC,EACnC,IAAI,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,SAAS,GACpC,OAAO,CAAC,qBAAqB,CAAC;IAM3B,UAAU,CACd,GAAG,EAAE,QAAQ,CAAC,iBAAiB,CAAC,EAChC,IAAI,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,SAAS,GACnC,OAAO,CAAC,kBAAkB,CAAC;IAMxB,iBAAiB,CACrB,GAAG,EAAE,QAAQ,CAAC,SAAS,CAAC,EACxB,IAAI,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,SAAS,GACnC,OAAO,CAAC,UAAU,CAAC;IAMhB,kBAAkB,CACtB,GAAG,EAAE,QAAQ,CAAC,SAAS,CAAC,EACxB,IAAI,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,SAAS,GACnC,OAAO,CAAC,UAAU,CAAC;CAKvB"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _RemoteApp_instances, _RemoteApp_contextAction, _RemoteApp_customPost, _RemoteApp_meta, _RemoteApp_uiEventHandler, _RemoteApp_newNiceMeta;
|
|
13
|
+
import { ContextActionDefinition, CustomPostDefinition, UIEventHandlerDefinition, } from '@devvit/protos';
|
|
14
|
+
import { Metadata as NiceMeta, createChannel, createClient, FetchTransport, } from 'nice-grpc-web';
|
|
15
|
+
import { Header } from '@devvit/shared-types/Header.js';
|
|
16
|
+
export class RemoteApp {
|
|
17
|
+
static new(gatewayOrigin, meta) {
|
|
18
|
+
const channel = createChannel(gatewayOrigin, FetchTransport({ credentials: 'include' }));
|
|
19
|
+
const contextAction = createClient(ContextActionDefinition, channel);
|
|
20
|
+
const customPost = createClient(CustomPostDefinition, channel);
|
|
21
|
+
const uiEventHandler = createClient(UIEventHandlerDefinition, channel);
|
|
22
|
+
return new RemoteApp(contextAction, customPost, uiEventHandler, meta);
|
|
23
|
+
}
|
|
24
|
+
constructor(contextAction, customPost, uiEventHandler, meta) {
|
|
25
|
+
_RemoteApp_instances.add(this);
|
|
26
|
+
_RemoteApp_contextAction.set(this, void 0);
|
|
27
|
+
_RemoteApp_customPost.set(this, void 0);
|
|
28
|
+
_RemoteApp_meta.set(this, void 0);
|
|
29
|
+
_RemoteApp_uiEventHandler.set(this, void 0);
|
|
30
|
+
__classPrivateFieldSet(this, _RemoteApp_contextAction, contextAction, "f");
|
|
31
|
+
__classPrivateFieldSet(this, _RemoteApp_customPost, customPost, "f");
|
|
32
|
+
__classPrivateFieldSet(this, _RemoteApp_meta, {
|
|
33
|
+
[Header.Installation]: { values: [meta.installation] },
|
|
34
|
+
[Header.Actor]: { values: [meta.actor] },
|
|
35
|
+
}, "f");
|
|
36
|
+
__classPrivateFieldSet(this, _RemoteApp_uiEventHandler, uiEventHandler, "f");
|
|
37
|
+
}
|
|
38
|
+
async GetActions(req, meta) {
|
|
39
|
+
return __classPrivateFieldGet(this, _RemoteApp_contextAction, "f").getActions(req, {
|
|
40
|
+
metadata: __classPrivateFieldGet(this, _RemoteApp_instances, "m", _RemoteApp_newNiceMeta).call(this, meta),
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
async HandleUIEvent(req, meta) {
|
|
44
|
+
return __classPrivateFieldGet(this, _RemoteApp_uiEventHandler, "f").handleUIEvent(req, {
|
|
45
|
+
metadata: __classPrivateFieldGet(this, _RemoteApp_instances, "m", _RemoteApp_newNiceMeta).call(this, meta),
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
async OnAction(req, meta) {
|
|
49
|
+
return __classPrivateFieldGet(this, _RemoteApp_contextAction, "f").onAction(req, {
|
|
50
|
+
metadata: __classPrivateFieldGet(this, _RemoteApp_instances, "m", _RemoteApp_newNiceMeta).call(this, meta),
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
async RenderPost(req, meta) {
|
|
54
|
+
return __classPrivateFieldGet(this, _RemoteApp_customPost, "f").renderPost(req, {
|
|
55
|
+
metadata: __classPrivateFieldGet(this, _RemoteApp_instances, "m", _RemoteApp_newNiceMeta).call(this, meta),
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
async RenderPostContent(req, meta) {
|
|
59
|
+
return __classPrivateFieldGet(this, _RemoteApp_customPost, "f").renderPostContent(req, {
|
|
60
|
+
metadata: __classPrivateFieldGet(this, _RemoteApp_instances, "m", _RemoteApp_newNiceMeta).call(this, meta),
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
async RenderPostComposer(req, meta) {
|
|
64
|
+
return __classPrivateFieldGet(this, _RemoteApp_customPost, "f").renderPostComposer(req, {
|
|
65
|
+
metadata: __classPrivateFieldGet(this, _RemoteApp_instances, "m", _RemoteApp_newNiceMeta).call(this, meta),
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
_RemoteApp_contextAction = new WeakMap(), _RemoteApp_customPost = new WeakMap(), _RemoteApp_meta = new WeakMap(), _RemoteApp_uiEventHandler = new WeakMap(), _RemoteApp_instances = new WeakSet(), _RemoteApp_newNiceMeta = function _RemoteApp_newNiceMeta(meta) {
|
|
70
|
+
return new NiceMeta(Object.entries({ ...__classPrivateFieldGet(this, _RemoteApp_meta, "f"), ...meta }).map(([key, { values }]) => [key, values.join()]));
|
|
71
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devvit/ui-renderer",
|
|
3
|
-
"version": "0.10.19-next-2024-04-18-
|
|
3
|
+
"version": "0.10.19-next-2024-04-18-87d0d5b9f.0",
|
|
4
4
|
"license": "BSD-3-Clause",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -55,11 +55,12 @@
|
|
|
55
55
|
},
|
|
56
56
|
"types": "./index.d.ts",
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@devvit/protos": "0.10.19-next-2024-04-18-
|
|
59
|
-
"@devvit/runtime-lite": "0.10.19-next-2024-04-18-
|
|
60
|
-
"@devvit/runtimes": "0.10.19-next-2024-04-18-
|
|
61
|
-
"@devvit/shared-types": "0.10.19-next-2024-04-18-
|
|
58
|
+
"@devvit/protos": "0.10.19-next-2024-04-18-87d0d5b9f.0",
|
|
59
|
+
"@devvit/runtime-lite": "0.10.19-next-2024-04-18-87d0d5b9f.0",
|
|
60
|
+
"@devvit/runtimes": "0.10.19-next-2024-04-18-87d0d5b9f.0",
|
|
61
|
+
"@devvit/shared-types": "0.10.19-next-2024-04-18-87d0d5b9f.0",
|
|
62
62
|
"@dotlottie/player-component": "2.7.2",
|
|
63
|
+
"nice-grpc-web": "3.3.3",
|
|
63
64
|
"p-queue": "7.3.4",
|
|
64
65
|
"rxjs": "7.8.1"
|
|
65
66
|
},
|
|
@@ -84,9 +85,9 @@
|
|
|
84
85
|
},
|
|
85
86
|
"devDependencies": {
|
|
86
87
|
"@devvit/eslint-config": "0.10.18",
|
|
87
|
-
"@devvit/public-api": "0.10.19-next-2024-04-18-
|
|
88
|
+
"@devvit/public-api": "0.10.19-next-2024-04-18-87d0d5b9f.0",
|
|
88
89
|
"@devvit/repo-tools": "0.10.18",
|
|
89
|
-
"@devvit/tsconfig": "0.10.19-next-2024-04-18-
|
|
90
|
+
"@devvit/tsconfig": "0.10.19-next-2024-04-18-87d0d5b9f.0",
|
|
90
91
|
"@lit-labs/ssr": "^2.2.3",
|
|
91
92
|
"@lit/localize": "0.11.4",
|
|
92
93
|
"@open-wc/testing-helpers": "2.3.0",
|
|
@@ -119,5 +120,5 @@
|
|
|
119
120
|
"directory": "dist"
|
|
120
121
|
},
|
|
121
122
|
"source": "./src/index.ts",
|
|
122
|
-
"gitHead": "
|
|
123
|
+
"gitHead": "10a35c2f82449f2a266879b1e3afd4e9ce007490"
|
|
123
124
|
}
|
package/client/ui-app.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { CustomPost, HandleUIEventRequest, HandleUIEventResponse, Metadata, RenderPostRequest, RenderPostResponse, UIEventHandler, UIRequest, UIResponse } from '@devvit/protos';
|
|
2
|
-
import type { ActorRef } from '@devvit/runtimes/common/runtime/ActorRef.js';
|
|
3
|
-
/** An app that can render a custom post and respond to events. */
|
|
4
|
-
export type UIApp = CustomPost & UIEventHandler;
|
|
5
|
-
/**
|
|
6
|
-
* Adapts an ActorRef (usually provided by the deprecated BrowserRuntime) to the
|
|
7
|
-
* APIs implemented by a UIApp.
|
|
8
|
-
* @deprecated
|
|
9
|
-
*/
|
|
10
|
-
export declare class RemoteApp implements UIApp {
|
|
11
|
-
#private;
|
|
12
|
-
constructor(ref: ActorRef);
|
|
13
|
-
HandleUIEvent(req: HandleUIEventRequest, meta: Metadata | undefined): Promise<HandleUIEventResponse>;
|
|
14
|
-
RenderPost(req: RenderPostRequest, meta: Metadata | undefined): Promise<RenderPostResponse>;
|
|
15
|
-
RenderPostContent(req: UIRequest, meta: Metadata | undefined): Promise<UIResponse>;
|
|
16
|
-
RenderPostComposer(req: UIRequest, meta: Metadata | undefined): Promise<UIResponse>;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=ui-app.d.ts.map
|
package/client/ui-app.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ui-app.d.ts","sourceRoot":"","sources":["../../library/src/client/ui-app.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,oBAAoB,EACpB,qBAAqB,EACrB,QAAQ,EACR,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,SAAS,EACT,UAAU,EACX,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAC;AAE5E,kEAAkE;AAClE,MAAM,MAAM,KAAK,GAAG,UAAU,GAAG,cAAc,CAAC;AAEhD;;;;GAIG;AACH,qBAAa,SAAU,YAAW,KAAK;;gBAIzB,GAAG,EAAE,QAAQ;IAKzB,aAAa,CACX,GAAG,EAAE,oBAAoB,EACzB,IAAI,EAAE,QAAQ,GAAG,SAAS,GACzB,OAAO,CAAC,qBAAqB,CAAC;IAIjC,UAAU,CAAC,GAAG,EAAE,iBAAiB,EAAE,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAI3F,iBAAiB,CAAC,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC;IAIlF,kBAAkB,CAAC,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC;CAGpF"}
|
package/client/ui-app.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
-
};
|
|
7
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
-
};
|
|
12
|
-
var _RemoteApp_customPost, _RemoteApp_uiEventHandler;
|
|
13
|
-
import { CustomPostDefinition, UIEventHandlerDefinition } from '@devvit/protos';
|
|
14
|
-
/**
|
|
15
|
-
* Adapts an ActorRef (usually provided by the deprecated BrowserRuntime) to the
|
|
16
|
-
* APIs implemented by a UIApp.
|
|
17
|
-
* @deprecated
|
|
18
|
-
*/
|
|
19
|
-
export class RemoteApp {
|
|
20
|
-
constructor(ref) {
|
|
21
|
-
_RemoteApp_customPost.set(this, void 0);
|
|
22
|
-
_RemoteApp_uiEventHandler.set(this, void 0);
|
|
23
|
-
__classPrivateFieldSet(this, _RemoteApp_customPost, ref.As(CustomPostDefinition), "f");
|
|
24
|
-
__classPrivateFieldSet(this, _RemoteApp_uiEventHandler, ref.As(UIEventHandlerDefinition), "f");
|
|
25
|
-
}
|
|
26
|
-
HandleUIEvent(req, meta) {
|
|
27
|
-
return __classPrivateFieldGet(this, _RemoteApp_uiEventHandler, "f").HandleUIEvent(req, meta);
|
|
28
|
-
}
|
|
29
|
-
RenderPost(req, meta) {
|
|
30
|
-
return __classPrivateFieldGet(this, _RemoteApp_customPost, "f").RenderPost(req, meta);
|
|
31
|
-
}
|
|
32
|
-
RenderPostContent(req, meta) {
|
|
33
|
-
return __classPrivateFieldGet(this, _RemoteApp_customPost, "f").RenderPostContent(req, meta);
|
|
34
|
-
}
|
|
35
|
-
RenderPostComposer(req, meta) {
|
|
36
|
-
return __classPrivateFieldGet(this, _RemoteApp_customPost, "f").RenderPostComposer(req, meta);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
_RemoteApp_customPost = new WeakMap(), _RemoteApp_uiEventHandler = new WeakMap();
|