@devvit/ui-renderer 0.10.15-next-2024-02-09-7a37b6b0f.0 → 0.10.15-next-2024-02-12-3ee5af35d.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-animation-player.d.ts +2 -2
- package/client/devvit-animation-player.d.ts.map +1 -1
- package/client/devvit-animation-player.js +1 -1
- package/client/devvit-custom-post.d.ts +38 -18
- package/client/devvit-custom-post.d.ts.map +1 -1
- package/client/devvit-custom-post.js +200 -205
- package/client/effects/devvit-effect-handler.d.ts +16 -1
- package/client/effects/devvit-effect-handler.d.ts.map +1 -1
- package/client/effects/form-effect-handler.d.ts +2 -1
- package/client/effects/form-effect-handler.d.ts.map +1 -1
- package/client/effects/navigate-to-url-handler.d.ts +2 -1
- package/client/effects/navigate-to-url-handler.d.ts.map +1 -1
- package/client/effects/navigate-to-url-handler.js +6 -3
- package/client/effects/realtime-effect-handler.d.ts +1 -1
- package/client/effects/realtime-effect-handler.d.ts.map +1 -1
- package/client/effects/realtime-effect-handler.js +1 -1
- package/client/effects/toast-effect-handler.d.ts +2 -1
- package/client/effects/toast-effect-handler.d.ts.map +1 -1
- package/client/effects/toast-effect-handler.js +1 -1
- package/client/formbuilder/components/devvit-form-selection-dropdown.d.ts +1 -1
- package/client/formbuilder/components/devvit-form-selection-dropdown.d.ts.map +1 -1
- package/client/formbuilder/components/devvit-form-selection-dropdown.js +2 -2
- package/client/formbuilder/components/devvit-form-selection-list.d.ts +2 -2
- package/client/formbuilder/components/devvit-form-selection-list.d.ts.map +1 -1
- package/client/formbuilder/components/devvit-form-selection-list.js +1 -1
- package/package.json +7 -7
- package/types/parent-window.d.ts +5 -0
- package/types/parent-window.d.ts.map +1 -0
- package/types/events.d.ts +0 -49
- package/types/events.d.ts.map +0 -1
- /package/types/{events.js → parent-window.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LitElement, PropertyValues } from 'lit';
|
|
2
1
|
import { BlockAnimationDirection, BlockAnimationLoopMode, BlockAnimationType } from '@devvit/protos';
|
|
2
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
3
3
|
import '@dotlottie/player-component';
|
|
4
4
|
/**
|
|
5
5
|
* @description a simple wrapper for lottie-player
|
|
@@ -17,7 +17,7 @@ export declare class DevvitAnimationPlayer extends LitElement {
|
|
|
17
17
|
$lottieAnimation?: HTMLDivElement;
|
|
18
18
|
loopModeStr: string;
|
|
19
19
|
directionNum?: number | undefined;
|
|
20
|
-
updated(changedProperties: PropertyValues): void;
|
|
20
|
+
updated(changedProperties: PropertyValues<this>): void;
|
|
21
21
|
render(): import("lit-html").TemplateResult<1>;
|
|
22
22
|
}
|
|
23
23
|
//# sourceMappingURL=devvit-animation-player.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devvit-animation-player.d.ts","sourceRoot":"","sources":["../../library/src/client/devvit-animation-player.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"devvit-animation-player.d.ts","sourceRoot":"","sources":["../../library/src/client/devvit-animation-player.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAQ,UAAU,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAIvD,OAAO,6BAA6B,CAAC;AAGrC;;GAEG;AACH,qBACa,qBAAsB,SAAQ,UAAU;IACvB,GAAG,EAAE,MAAM,CAAM;IACjB,UAAU,EAAE,MAAM,CAAM;IACxB,WAAW,EAAE,MAAM,CAAM;IACxB,QAAQ,EAAE,OAAO,CAAQ;IACzB,IAAI,EAAE,OAAO,CAAQ;IACtB,QAAQ,EAAE,sBAAsB,CAClB;IACd,IAAI,CAAC,EAAE,kBAAkB,CAAC;IAC1B,SAAS,CAAC,EAAE,uBAAuB,CAAC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IAElB,gBAAgB,CAAC,EAAE,cAAc,CAAC;IAElD,WAAW,EAAE,MAAM,CAAY;IAC/B,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAElC,OAAO,CAAC,iBAAiB,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI;IAyBtD,MAAM;CAyBhB"}
|
|
@@ -7,10 +7,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
|
+
import { BlockAnimationDirection, BlockAnimationLoopMode, BlockAnimationType, } from '@devvit/protos';
|
|
10
11
|
import { html, LitElement } from 'lit';
|
|
11
12
|
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
12
13
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
13
|
-
import { BlockAnimationDirection, BlockAnimationLoopMode, BlockAnimationType, } from '@devvit/protos';
|
|
14
14
|
import '@dotlottie/player-component';
|
|
15
15
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
16
16
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { LitElement, PropertyValues } from 'lit';
|
|
2
1
|
import '@reddit/faceplate-ui/templateRenderingStrategy/clientStrategy.js';
|
|
3
|
-
import type {
|
|
4
|
-
import {
|
|
2
|
+
import type { BlockAction, Effect, LinkedBundle, Metadata, RenderPostResponse, Struct, UIEvent } from '@devvit/protos';
|
|
3
|
+
import { RealtimeEvent } from '@devvit/protos';
|
|
5
4
|
import type { ActorRef } from '@devvit/runtimes/common/runtime/ActorRef.js';
|
|
6
|
-
import {
|
|
5
|
+
import { FaceplateEvent } from '@reddit/faceplate/event-types.js';
|
|
6
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
7
7
|
import '../blocks/components/devvit-blocks-renderer.js';
|
|
8
8
|
import '../blocks/components/devvit-blocks-webview.js';
|
|
9
9
|
import './devvit-animation-player.js';
|
|
@@ -11,30 +11,50 @@ declare global {
|
|
|
11
11
|
interface HTMLElementTagNameMap {
|
|
12
12
|
'devvit-custom-post': DevvitCustomPost;
|
|
13
13
|
}
|
|
14
|
+
interface HTMLElementEventMap {
|
|
15
|
+
'devvit-ui-effect': DevvitUIEffectEvent;
|
|
16
|
+
'devvit-user-action': DevvitUserAction;
|
|
17
|
+
'devvit-realtime-send': DevvitRealtimeSend;
|
|
18
|
+
}
|
|
14
19
|
}
|
|
20
|
+
export type DevvitRealtimeSend = FaceplateEvent<'devvit-realtime-send'> & {
|
|
21
|
+
detail: Readonly<{
|
|
22
|
+
event: RealtimeEvent;
|
|
23
|
+
}>;
|
|
24
|
+
};
|
|
25
|
+
export type DevvitUserAction = FaceplateEvent<'devvit-user-action'> & {
|
|
26
|
+
detail: Readonly<{
|
|
27
|
+
action: BlockAction;
|
|
28
|
+
}>;
|
|
29
|
+
};
|
|
30
|
+
export type DevvitUIEffectEvent = FaceplateEvent<'devvit-ui-effect'> & {
|
|
31
|
+
detail: Readonly<{
|
|
32
|
+
effect: Effect;
|
|
33
|
+
onEvent(event: UIEvent): void;
|
|
34
|
+
}>;
|
|
35
|
+
};
|
|
15
36
|
export declare class DevvitCustomPost extends LitElement {
|
|
16
37
|
#private;
|
|
17
38
|
/** Probably a wrapper around the remote runtime (compute-go). */
|
|
18
39
|
actorRef?: ActorRef;
|
|
40
|
+
bundle?: LinkedBundle;
|
|
41
|
+
forceColorScheme?: string;
|
|
42
|
+
localRuntimeCode?: Blob;
|
|
19
43
|
metadata: Metadata | undefined;
|
|
20
|
-
postId?: string;
|
|
21
44
|
postConfig?: Struct['fields'];
|
|
22
|
-
|
|
23
|
-
bundle?: LinkedBundle;
|
|
24
|
-
useSandbox: boolean;
|
|
45
|
+
postId?: string;
|
|
25
46
|
useExperimentalBlocks: boolean;
|
|
26
|
-
|
|
27
|
-
blocksRenderer?: DevvitBlocksRenderer;
|
|
47
|
+
useSandbox: boolean;
|
|
28
48
|
renderResponse?: RenderPostResponse;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
static get styles(): import("lit").CSSResult[];
|
|
33
|
-
rerender(): void;
|
|
49
|
+
private _blocksRenderer;
|
|
50
|
+
private _isSuspended;
|
|
51
|
+
private _rootBlock?;
|
|
34
52
|
connectedCallback(): void;
|
|
35
|
-
suspendPost(): void;
|
|
36
53
|
disconnectedCallback(): void;
|
|
37
|
-
|
|
38
|
-
|
|
54
|
+
rerender(): void;
|
|
55
|
+
static get styles(): import("lit").CSSResult[];
|
|
56
|
+
suspendPost(): void;
|
|
57
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
58
|
+
protected willUpdate(props: PropertyValues<this>): Promise<void>;
|
|
39
59
|
}
|
|
40
60
|
//# sourceMappingURL=devvit-custom-post.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devvit-custom-post.d.ts","sourceRoot":"","sources":["../../library/src/client/devvit-custom-post.ts"],"names":[],"mappings":"AAAA,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,EAEV,WAAW,EAGX,MAAM,EAGN,YAAY,EACZ,QAAQ,EAER,kBAAkB,EAClB,MAAM,EACN,OAAO,EAER,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAOL,aAAa,EAEd,MAAM,gBAAgB,CAAC;AAIxB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAElE,OAAO,EAAE,UAAU,EAAE,cAAc,EAAQ,MAAM,KAAK,CAAC;AASvD,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,kBAAkB,EAAE,mBAAmB,CAAC;QACxC,oBAAoB,EAAE,gBAAgB,CAAC;QACvC,sBAAsB,EAAE,kBAAkB,CAAC;KAC5C;CACF;AAED,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,sBAAsB,CAAC,GAAG;IACxE,MAAM,EAAE,QAAQ,CAAC;QAAE,KAAK,EAAE,aAAa,CAAA;KAAE,CAAC,CAAC;CAC5C,CAAC;AACF,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC,oBAAoB,CAAC,GAAG;IACpE,MAAM,EAAE,QAAQ,CAAC;QAAE,MAAM,EAAE,WAAW,CAAA;KAAE,CAAC,CAAC;CAC3C,CAAC;AACF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,kBAAkB,CAAC,GAAG;IACrE,MAAM,EAAE,QAAQ,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;CACrE,CAAC;AAiBF,qBACa,gBAAiB,SAAQ,UAAU;;IAC9C,iEAAiE;IACjC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,MAAM,CAAC,EAAE,YAAY,CAAC;IACP,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACzC,gBAAgB,CAAC,EAAE,IAAI,CAAC;IACxB,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAEpD,qBAAqB,EAAE,OAAO,CAAS;IACgB,UAAU,EAAE,OAAO,CAAQ;IACzE,cAAc,CAAC,EAAE,kBAAkB,CAAC;IAGZ,OAAO,CAAC,eAAe,CAAwB;IAGvE,OAAO,CAAC,YAAY,CAAkB;IAItC,OAAO,CAAC,UAAU,CAAC,CAAQ;IAK3B,iBAAiB,IAAI,IAAI;IAMzB,oBAAoB,IAAI,IAAI;IAOrC,QAAQ,IAAI,IAAI;IAIhB,WAAoB,MAAM,8BAEzB;IAED,WAAW,IAAI,IAAI;cAQA,MAAM;cAoBA,UAAU,CAAC,KAAK,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAwNhF"}
|
|
@@ -18,15 +18,15 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
18
18
|
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");
|
|
19
19
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
20
20
|
};
|
|
21
|
-
var _DevvitCustomPost_instances, _DevvitCustomPost_appState, _DevvitCustomPost_lastRequest,
|
|
22
|
-
import { html, LitElement } from 'lit';
|
|
23
|
-
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
24
|
-
import PQueue from 'p-queue';
|
|
21
|
+
var _DevvitCustomPost_instances, _DevvitCustomPost_appState, _DevvitCustomPost_customPostActor, _DevvitCustomPost_hasInitialRender, _DevvitCustomPost_lastRequest, _DevvitCustomPost_localClient, _DevvitCustomPost_rerenderTimeout, _DevvitCustomPost_rootHeight, _DevvitCustomPost_rpcQueue, _DevvitCustomPost_uiEventHandlerActor, _DevvitCustomPost_effectEventRender, _DevvitCustomPost_handleEffects, _DevvitCustomPost_handleUserAction, _DevvitCustomPost_initialRender, _DevvitCustomPost_makeRenderContext, _DevvitCustomPost_newRenderRequest, _DevvitCustomPost_onPluginCall, _DevvitCustomPost_processEvent, _DevvitCustomPost_queueEvent, _DevvitCustomPost_queueRenderPost, _DevvitCustomPost_renderPost, _DevvitCustomPost_state_get, _DevvitCustomPost_userActionRender;
|
|
25
22
|
import '@reddit/faceplate-ui/templateRenderingStrategy/clientStrategy.js';
|
|
26
|
-
import { customEvent } from '@reddit/faceplate/lib/custom-event.js';
|
|
27
23
|
import { BlockConfig_Root, BlockRenderEventType, BlockStackDirection, CustomPostDefinition, EffectType, RealtimeDefinition, UIEventHandlerDefinition, } from '@devvit/protos';
|
|
28
24
|
import { BrowserLiteClient } from '@devvit/runtime-lite/client/BrowserLiteClient.js';
|
|
29
25
|
import { isCircuitBreaker } from '@devvit/runtime-lite/types/CircuitBreaker.js';
|
|
26
|
+
import { customEvent } from '@reddit/faceplate/lib/custom-event.js';
|
|
27
|
+
import { LitElement, html } from 'lit';
|
|
28
|
+
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
29
|
+
import PQueue from 'p-queue';
|
|
30
30
|
import { DevvitBlocksRenderer } from '../blocks/components/devvit-blocks-renderer.js';
|
|
31
31
|
import { DEFAULT_ROOT_HEIGHT } from '../blocks/templates/renderBlock.js';
|
|
32
32
|
import { styles } from '../styles.js';
|
|
@@ -45,240 +45,132 @@ let DevvitCustomPost = class DevvitCustomPost extends LitElement {
|
|
|
45
45
|
constructor() {
|
|
46
46
|
super(...arguments);
|
|
47
47
|
_DevvitCustomPost_instances.add(this);
|
|
48
|
-
this.useSandbox = true;
|
|
49
48
|
this.useExperimentalBlocks = false;
|
|
50
|
-
this.
|
|
49
|
+
this.useSandbox = true;
|
|
51
50
|
_DevvitCustomPost_appState.set(this, {});
|
|
51
|
+
_DevvitCustomPost_customPostActor.set(this, void 0);
|
|
52
|
+
_DevvitCustomPost_hasInitialRender.set(this, false);
|
|
53
|
+
this._isSuspended = false; // eslint-disable-line @typescript-eslint/naming-convention
|
|
52
54
|
_DevvitCustomPost_lastRequest.set(this, void 0);
|
|
55
|
+
_DevvitCustomPost_localClient.set(this, void 0);
|
|
56
|
+
_DevvitCustomPost_rerenderTimeout.set(this, void 0);
|
|
53
57
|
_DevvitCustomPost_rootHeight.set(this, void 0);
|
|
54
|
-
_DevvitCustomPost_hasInitialRender.set(this, false);
|
|
55
|
-
_DevvitCustomPost_hostname.set(this, void 0);
|
|
56
|
-
_DevvitCustomPost_customPostActor.set(this, void 0);
|
|
57
|
-
_DevvitCustomPost_uiEventHandlerActor.set(this, void 0);
|
|
58
58
|
_DevvitCustomPost_rpcQueue.set(this, new PQueue({ concurrency: 1 }));
|
|
59
|
-
|
|
59
|
+
_DevvitCustomPost_uiEventHandlerActor.set(this, void 0);
|
|
60
|
+
_DevvitCustomPost_handleUserAction.set(this, async (event) => {
|
|
61
|
+
await __classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_userActionRender).call(this, event.detail.action.id, event.detail.action.data);
|
|
62
|
+
});
|
|
60
63
|
_DevvitCustomPost_makeRenderContext.set(this, () => ({
|
|
61
64
|
request: __classPrivateFieldGet(this, _DevvitCustomPost_lastRequest, "f"),
|
|
62
65
|
state: __classPrivateFieldGet(this, _DevvitCustomPost_instances, "a", _DevvitCustomPost_state_get),
|
|
63
66
|
stackDirection: BlockStackDirection.UNRECOGNIZED,
|
|
64
|
-
onAction: (action) =>
|
|
65
|
-
__classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_userActionRender).call(this, action.id, action.data);
|
|
66
|
-
},
|
|
67
|
+
onAction: (action) => void __classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_userActionRender).call(this, action.id, action.data),
|
|
67
68
|
experimental: this.useExperimentalBlocks,
|
|
68
69
|
}));
|
|
69
|
-
|
|
70
|
-
void __classPrivateFieldGet(this, _DevvitCustomPost_rpcQueue, "f").add(async () => {
|
|
71
|
-
const req = {
|
|
72
|
-
event,
|
|
73
|
-
state: __classPrivateFieldGet(this, _DevvitCustomPost_instances, "a", _DevvitCustomPost_state_get),
|
|
74
|
-
};
|
|
75
|
-
let call;
|
|
76
|
-
try {
|
|
77
|
-
call = (await this.localClient?.call('HandleUIEvent', req, this.metadata));
|
|
78
|
-
}
|
|
79
|
-
catch (e) {
|
|
80
|
-
if (!isCircuitBreaker(e) && this.localClient?.ready) {
|
|
81
|
-
console.error(e);
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
if (devvit?.logCircuitBreaks)
|
|
85
|
-
console.warn('remote call triggered at', e);
|
|
86
|
-
}
|
|
87
|
-
// Call remote runtime.
|
|
88
|
-
call = await __classPrivateFieldGet(this, _DevvitCustomPost_uiEventHandlerActor, "f")?.HandleUIEvent(req, this.metadata);
|
|
89
|
-
}
|
|
90
|
-
if (call) {
|
|
91
|
-
const res = await call;
|
|
92
|
-
__classPrivateFieldSet(this, _DevvitCustomPost_appState, res.state ?? {}, "f");
|
|
93
|
-
const renderType = event.realtimeEvent
|
|
94
|
-
? BlockRenderEventType.RENDER_EFFECT_EVENT
|
|
95
|
-
: BlockRenderEventType.RENDER_USER_ACTION;
|
|
96
|
-
await __classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_handleEffects).call(this, renderType, res.effects);
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
_DevvitCustomPost_handleUserAction.set(this, (event) => {
|
|
101
|
-
__classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_userActionRender).call(this, event.detail.action.id, event.detail.action.data);
|
|
102
|
-
});
|
|
103
|
-
_DevvitCustomPost_renderRequest.set(this, (type, id, data = {}) => ({
|
|
70
|
+
_DevvitCustomPost_newRenderRequest.set(this, (type, id, data = {}) => ({
|
|
104
71
|
blocks: { type, id, data },
|
|
105
72
|
}));
|
|
106
73
|
_DevvitCustomPost_onPluginCall.set(this, (id, serviceName, method, args) => {
|
|
107
74
|
if (serviceName === RealtimeDefinition.fullName &&
|
|
108
75
|
method === RealtimeDefinition.methods.send.name) {
|
|
109
76
|
this.dispatchEvent(customEvent('devvit-realtime-send', { event: args }));
|
|
110
|
-
this
|
|
77
|
+
__classPrivateFieldGet(this, _DevvitCustomPost_localClient, "f")?.onPluginResponse(id, { error: undefined, success: true, value: {} });
|
|
111
78
|
}
|
|
112
79
|
});
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
rerender() {
|
|
118
|
-
this.blocksRenderer?.requestUpdate();
|
|
80
|
+
_DevvitCustomPost_queueEvent.set(this, async (ev) => {
|
|
81
|
+
await __classPrivateFieldGet(this, _DevvitCustomPost_rpcQueue, "f").add(() => __classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_processEvent).call(this, ev));
|
|
82
|
+
});
|
|
119
83
|
}
|
|
120
84
|
connectedCallback() {
|
|
121
85
|
super.connectedCallback();
|
|
86
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
122
87
|
this.addEventListener('devvit-user-action', __classPrivateFieldGet(this, _DevvitCustomPost_handleUserAction, "f"));
|
|
123
88
|
}
|
|
89
|
+
disconnectedCallback() {
|
|
90
|
+
super.disconnectedCallback();
|
|
91
|
+
this.suspendPost();
|
|
92
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
93
|
+
this.removeEventListener('devvit-user-action', __classPrivateFieldGet(this, _DevvitCustomPost_handleUserAction, "f"));
|
|
94
|
+
}
|
|
95
|
+
rerender() {
|
|
96
|
+
this._blocksRenderer?.requestUpdate();
|
|
97
|
+
}
|
|
98
|
+
static get styles() {
|
|
99
|
+
return [styles];
|
|
100
|
+
}
|
|
124
101
|
suspendPost() {
|
|
125
|
-
this.
|
|
102
|
+
this._isSuspended = true;
|
|
126
103
|
if (__classPrivateFieldGet(this, _DevvitCustomPost_rerenderTimeout, "f") !== undefined) {
|
|
127
104
|
window.clearTimeout(__classPrivateFieldGet(this, _DevvitCustomPost_rerenderTimeout, "f"));
|
|
128
105
|
}
|
|
129
|
-
this
|
|
106
|
+
__classPrivateFieldGet(this, _DevvitCustomPost_localClient, "f")?.quit();
|
|
130
107
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
108
|
+
render() {
|
|
109
|
+
if (!this.renderResponse) {
|
|
110
|
+
// The slot content is considered the loading state.
|
|
111
|
+
return html `<slot></slot>`;
|
|
112
|
+
}
|
|
113
|
+
return html `<div class="relative">
|
|
114
|
+
<devvit-blocks-renderer
|
|
115
|
+
class="${this.forceColorScheme ?? ''}"
|
|
116
|
+
.block="${this._rootBlock}"
|
|
117
|
+
.renderContext="${__classPrivateFieldGet(this, _DevvitCustomPost_makeRenderContext, "f")}"
|
|
118
|
+
>
|
|
119
|
+
<slot slot="empty-state-image" name="empty-state-image"></slot>
|
|
120
|
+
</devvit-blocks-renderer>
|
|
121
|
+
${this._isSuspended
|
|
122
|
+
? html `<div class="absolute top-0 left-0 w-full h-full bg-transparent border-none"></div>`
|
|
123
|
+
: html ``}
|
|
124
|
+
</div>`;
|
|
135
125
|
}
|
|
136
|
-
async willUpdate(
|
|
137
|
-
if (
|
|
138
|
-
this
|
|
139
|
-
this
|
|
126
|
+
async willUpdate(props) {
|
|
127
|
+
if (props.has('localRuntimeCode') && this.localRuntimeCode) {
|
|
128
|
+
__classPrivateFieldGet(this, _DevvitCustomPost_localClient, "f")?.quit();
|
|
129
|
+
__classPrivateFieldSet(this, _DevvitCustomPost_localClient, new BrowserLiteClient(this.localRuntimeCode, undefined, {
|
|
140
130
|
callback: __classPrivateFieldGet(this, _DevvitCustomPost_onPluginCall, "f"),
|
|
141
131
|
plugins: [RealtimeDefinition.fullName],
|
|
142
|
-
});
|
|
132
|
+
}), "f");
|
|
143
133
|
}
|
|
144
|
-
const actorRefChanged =
|
|
134
|
+
const actorRefChanged = props.has('actorRef');
|
|
145
135
|
if (actorRefChanged) {
|
|
146
136
|
__classPrivateFieldSet(this, _DevvitCustomPost_customPostActor, this.actorRef?.As(CustomPostDefinition), "f");
|
|
147
137
|
__classPrivateFieldSet(this, _DevvitCustomPost_uiEventHandlerActor, this.actorRef?.As(UIEventHandlerDefinition), "f");
|
|
148
138
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
if (
|
|
152
|
-
this.localClient?.quit();
|
|
153
|
-
if (this.bundle?.hostname !== __classPrivateFieldGet(this, _DevvitCustomPost_hostname, "f")) {
|
|
154
|
-
appChanged = true;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
const experimentalChanged = changedProperties.has('useExperimentalBlocks');
|
|
158
|
-
const sandboxChanged = changedProperties.has('useSandbox');
|
|
159
|
-
if (sandboxChanged) {
|
|
160
|
-
this.localClient?.quit();
|
|
161
|
-
}
|
|
162
|
-
if ((this.actorRef && (actorRefChanged || bundleChanged)) || sandboxChanged) {
|
|
139
|
+
if (props.has('bundle') || props.has('useSandbox'))
|
|
140
|
+
__classPrivateFieldGet(this, _DevvitCustomPost_localClient, "f")?.quit();
|
|
141
|
+
if ((this.actorRef && (actorRefChanged || props.has('bundle'))) || props.has('useSandbox')) {
|
|
163
142
|
if (this.bundle) {
|
|
164
143
|
// offline/online, defer initialRender for offline client
|
|
165
|
-
await this
|
|
144
|
+
await __classPrivateFieldGet(this, _DevvitCustomPost_localClient, "f")?.loadBundle(this.bundle, this.useSandbox);
|
|
166
145
|
}
|
|
167
|
-
else if (
|
|
146
|
+
else if ((this.bundle && props.has('bundle')) || !__classPrivateFieldGet(this, _DevvitCustomPost_hasInitialRender, "f")) {
|
|
168
147
|
// online only
|
|
169
148
|
__classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_initialRender).call(this);
|
|
170
149
|
}
|
|
171
150
|
}
|
|
172
|
-
else if (
|
|
151
|
+
else if (props.has('useExperimentalBlocks')) {
|
|
173
152
|
__classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_initialRender).call(this);
|
|
174
153
|
}
|
|
175
154
|
}
|
|
176
|
-
render() {
|
|
177
|
-
if (!this.renderResponse) {
|
|
178
|
-
return html `<slot></slot>`;
|
|
179
|
-
}
|
|
180
|
-
return html `<div class="relative">
|
|
181
|
-
<devvit-blocks-renderer
|
|
182
|
-
class="${this.forceColorScheme ?? ''}"
|
|
183
|
-
.block="${this.rootBlock}"
|
|
184
|
-
.renderContext="${__classPrivateFieldGet(this, _DevvitCustomPost_makeRenderContext, "f")}"
|
|
185
|
-
>
|
|
186
|
-
<slot slot="empty-state-image" name="empty-state-image"></slot>
|
|
187
|
-
</devvit-blocks-renderer>
|
|
188
|
-
${this.isSuspended
|
|
189
|
-
? html `<div class="absolute top-0 left-0 w-full h-full bg-transparent border-none"></div>`
|
|
190
|
-
: html ``}
|
|
191
|
-
</div>`;
|
|
192
|
-
}
|
|
193
155
|
};
|
|
194
156
|
_DevvitCustomPost_appState = new WeakMap();
|
|
157
|
+
_DevvitCustomPost_customPostActor = new WeakMap();
|
|
158
|
+
_DevvitCustomPost_hasInitialRender = new WeakMap();
|
|
195
159
|
_DevvitCustomPost_lastRequest = new WeakMap();
|
|
160
|
+
_DevvitCustomPost_localClient = new WeakMap();
|
|
161
|
+
_DevvitCustomPost_rerenderTimeout = new WeakMap();
|
|
196
162
|
_DevvitCustomPost_rootHeight = new WeakMap();
|
|
197
|
-
_DevvitCustomPost_hasInitialRender = new WeakMap();
|
|
198
|
-
_DevvitCustomPost_hostname = new WeakMap();
|
|
199
|
-
_DevvitCustomPost_customPostActor = new WeakMap();
|
|
200
|
-
_DevvitCustomPost_uiEventHandlerActor = new WeakMap();
|
|
201
163
|
_DevvitCustomPost_rpcQueue = new WeakMap();
|
|
202
|
-
|
|
203
|
-
_DevvitCustomPost_makeRenderContext = new WeakMap();
|
|
204
|
-
_DevvitCustomPost_handleUIEvent = new WeakMap();
|
|
164
|
+
_DevvitCustomPost_uiEventHandlerActor = new WeakMap();
|
|
205
165
|
_DevvitCustomPost_handleUserAction = new WeakMap();
|
|
206
|
-
|
|
166
|
+
_DevvitCustomPost_makeRenderContext = new WeakMap();
|
|
167
|
+
_DevvitCustomPost_newRenderRequest = new WeakMap();
|
|
207
168
|
_DevvitCustomPost_onPluginCall = new WeakMap();
|
|
169
|
+
_DevvitCustomPost_queueEvent = new WeakMap();
|
|
208
170
|
_DevvitCustomPost_instances = new WeakSet();
|
|
209
|
-
_DevvitCustomPost_state_get = function _DevvitCustomPost_state_get() {
|
|
210
|
-
const data = { __postData: { thingId: this.postId, config: this.postConfig } };
|
|
211
|
-
return Object.assign({}, __classPrivateFieldGet(this, _DevvitCustomPost_appState, "f"), data);
|
|
212
|
-
};
|
|
213
|
-
_DevvitCustomPost_initialRender = function _DevvitCustomPost_initialRender() {
|
|
214
|
-
if (this.isSuspended) {
|
|
215
|
-
this.isSuspended = false;
|
|
216
|
-
}
|
|
217
|
-
__classPrivateFieldSet(this, _DevvitCustomPost_rootHeight, undefined, "f");
|
|
218
|
-
__classPrivateFieldSet(this, _DevvitCustomPost_hasInitialRender, true, "f");
|
|
219
|
-
__classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_renderPost).call(this, __classPrivateFieldGet(this, _DevvitCustomPost_renderRequest, "f").call(this, BlockRenderEventType.RENDER_INITIAL));
|
|
220
|
-
};
|
|
221
|
-
_DevvitCustomPost_userActionRender = function _DevvitCustomPost_userActionRender(actionId, data = {}) {
|
|
222
|
-
__classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_renderPost).call(this, __classPrivateFieldGet(this, _DevvitCustomPost_renderRequest, "f").call(this, BlockRenderEventType.RENDER_USER_ACTION, actionId, data));
|
|
223
|
-
};
|
|
224
171
|
_DevvitCustomPost_effectEventRender = function _DevvitCustomPost_effectEventRender(effectType, effectData) {
|
|
225
|
-
__classPrivateFieldGet(this, _DevvitCustomPost_instances, "m",
|
|
226
|
-
|
|
227
|
-
_DevvitCustomPost_renderPost = function _DevvitCustomPost_renderPost(req, circuitBreak = false) {
|
|
228
|
-
void __classPrivateFieldGet(this, _DevvitCustomPost_rpcQueue, "f").add(async () => {
|
|
229
|
-
var _a, _b;
|
|
230
|
-
let call;
|
|
231
|
-
req.state = __classPrivateFieldGet(this, _DevvitCustomPost_instances, "a", _DevvitCustomPost_state_get);
|
|
232
|
-
try {
|
|
233
|
-
if (circuitBreak) {
|
|
234
|
-
throw new Error();
|
|
235
|
-
}
|
|
236
|
-
call = (await this.localClient?.call('RenderPost', req, this.metadata));
|
|
237
|
-
}
|
|
238
|
-
catch (e) {
|
|
239
|
-
if (isCircuitBreaker(e)) {
|
|
240
|
-
if (e.response) {
|
|
241
|
-
call = e.response;
|
|
242
|
-
}
|
|
243
|
-
// queue up follow-up call
|
|
244
|
-
__classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_renderPost).call(this, req, true);
|
|
245
|
-
}
|
|
246
|
-
else {
|
|
247
|
-
if (!circuitBreak && this.localClient?.ready) {
|
|
248
|
-
console.error(e);
|
|
249
|
-
}
|
|
250
|
-
else {
|
|
251
|
-
if (devvit?.logCircuitBreaks)
|
|
252
|
-
console.warn('remote call triggered at', e);
|
|
253
|
-
}
|
|
254
|
-
// Call remote runtime.
|
|
255
|
-
call = await __classPrivateFieldGet(this, _DevvitCustomPost_customPostActor, "f")?.RenderPost(req, this.metadata);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
if (call) {
|
|
259
|
-
this.renderResponse = call;
|
|
260
|
-
if (this.renderResponse.state) {
|
|
261
|
-
__classPrivateFieldSet(this, _DevvitCustomPost_appState, this.renderResponse.state, "f");
|
|
262
|
-
}
|
|
263
|
-
if (this.renderResponse?.blocks?.ui) {
|
|
264
|
-
__classPrivateFieldSet(this, _DevvitCustomPost_lastRequest, req.blocks, "f");
|
|
265
|
-
this.rootBlock = this.renderResponse.blocks.ui;
|
|
266
|
-
if (!__classPrivateFieldGet(this, _DevvitCustomPost_rootHeight, "f")) {
|
|
267
|
-
// Lock in the initial height
|
|
268
|
-
__classPrivateFieldSet(this, _DevvitCustomPost_rootHeight, this.rootBlock.config?.rootConfig?.height || DEFAULT_ROOT_HEIGHT, "f");
|
|
269
|
-
}
|
|
270
|
-
else {
|
|
271
|
-
(_a = this.rootBlock).config ?? (_a.config = {});
|
|
272
|
-
(_b = this.rootBlock.config).rootConfig ?? (_b.rootConfig = BlockConfig_Root.fromPartial({}));
|
|
273
|
-
this.rootBlock.config.rootConfig.height = __classPrivateFieldGet(this, _DevvitCustomPost_rootHeight, "f");
|
|
274
|
-
}
|
|
275
|
-
await this.updateComplete;
|
|
276
|
-
}
|
|
277
|
-
await __classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_handleEffects).call(this, req.blocks.type, this.renderResponse.effects);
|
|
278
|
-
}
|
|
279
|
-
},
|
|
280
|
-
// Cut in line to re-render from server response immediately
|
|
281
|
-
circuitBreak ? { priority: 100 } : {});
|
|
172
|
+
__classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_queueRenderPost).call(this, __classPrivateFieldGet(this, _DevvitCustomPost_newRenderRequest, "f").call(this, BlockRenderEventType.RENDER_EFFECT_EVENT, effectType, effectData), 'CircuitClose' // eslint-disable-line @reddit/i18n-shreddit/no-unwrapped-strings
|
|
173
|
+
);
|
|
282
174
|
};
|
|
283
175
|
_DevvitCustomPost_handleEffects = async function _DevvitCustomPost_handleEffects(renderType, effects) {
|
|
284
176
|
effects.forEach((effect) => {
|
|
@@ -293,11 +185,114 @@ _DevvitCustomPost_handleEffects = async function _DevvitCustomPost_handleEffects
|
|
|
293
185
|
else {
|
|
294
186
|
if (renderType !== BlockRenderEventType.RENDER_USER_ACTION ||
|
|
295
187
|
USER_ACTION_EFFECTS.includes(effect.type)) {
|
|
296
|
-
this.dispatchEvent(customEvent('devvit-ui-effect', { effect, onEvent: __classPrivateFieldGet(this,
|
|
188
|
+
this.dispatchEvent(customEvent('devvit-ui-effect', { effect, onEvent: __classPrivateFieldGet(this, _DevvitCustomPost_queueEvent, "f") }));
|
|
297
189
|
}
|
|
298
190
|
}
|
|
299
191
|
});
|
|
300
192
|
};
|
|
193
|
+
_DevvitCustomPost_initialRender = function _DevvitCustomPost_initialRender() {
|
|
194
|
+
if (this._isSuspended) {
|
|
195
|
+
this._isSuspended = false;
|
|
196
|
+
}
|
|
197
|
+
__classPrivateFieldSet(this, _DevvitCustomPost_rootHeight, undefined, "f");
|
|
198
|
+
__classPrivateFieldSet(this, _DevvitCustomPost_hasInitialRender, true, "f");
|
|
199
|
+
__classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_queueRenderPost).call(this, __classPrivateFieldGet(this, _DevvitCustomPost_newRenderRequest, "f").call(this, BlockRenderEventType.RENDER_INITIAL), 'CircuitClose' // eslint-disable-line @reddit/i18n-shreddit/no-unwrapped-strings
|
|
200
|
+
);
|
|
201
|
+
};
|
|
202
|
+
_DevvitCustomPost_processEvent = async function _DevvitCustomPost_processEvent(ev) {
|
|
203
|
+
const req = {
|
|
204
|
+
event: ev,
|
|
205
|
+
state: __classPrivateFieldGet(this, _DevvitCustomPost_instances, "a", _DevvitCustomPost_state_get),
|
|
206
|
+
};
|
|
207
|
+
let call;
|
|
208
|
+
try {
|
|
209
|
+
call = (await __classPrivateFieldGet(this, _DevvitCustomPost_localClient, "f")?.call('HandleUIEvent', req, this.metadata));
|
|
210
|
+
}
|
|
211
|
+
catch (e) {
|
|
212
|
+
if (!isCircuitBreaker(e) && __classPrivateFieldGet(this, _DevvitCustomPost_localClient, "f")?.ready) {
|
|
213
|
+
console.error(e);
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
if (devvit?.logCircuitBreaks)
|
|
217
|
+
console.warn('remote call triggered at', e);
|
|
218
|
+
}
|
|
219
|
+
// Call remote runtime.
|
|
220
|
+
call = await __classPrivateFieldGet(this, _DevvitCustomPost_uiEventHandlerActor, "f")?.HandleUIEvent(req, this.metadata);
|
|
221
|
+
}
|
|
222
|
+
if (call) {
|
|
223
|
+
const res = await call;
|
|
224
|
+
__classPrivateFieldSet(this, _DevvitCustomPost_appState, res.state ?? {}, "f");
|
|
225
|
+
const renderType = ev.realtimeEvent
|
|
226
|
+
? BlockRenderEventType.RENDER_EFFECT_EVENT
|
|
227
|
+
: BlockRenderEventType.RENDER_USER_ACTION;
|
|
228
|
+
await __classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_handleEffects).call(this, renderType, res.effects);
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
_DevvitCustomPost_queueRenderPost = function _DevvitCustomPost_queueRenderPost(req, circuit) {
|
|
232
|
+
void __classPrivateFieldGet(this, _DevvitCustomPost_rpcQueue, "f").add(() => __classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_renderPost).call(this, req, circuit),
|
|
233
|
+
// Cut in line to re-render from server response immediately
|
|
234
|
+
circuit === 'CircuitBreak' ? { priority: 100 } : {});
|
|
235
|
+
};
|
|
236
|
+
_DevvitCustomPost_renderPost = async function _DevvitCustomPost_renderPost(req, circuit) {
|
|
237
|
+
var _a, _b;
|
|
238
|
+
let call;
|
|
239
|
+
req.state = __classPrivateFieldGet(this, _DevvitCustomPost_instances, "a", _DevvitCustomPost_state_get);
|
|
240
|
+
try {
|
|
241
|
+
if (circuit === 'CircuitBreak') {
|
|
242
|
+
throw new Error();
|
|
243
|
+
}
|
|
244
|
+
call = (await __classPrivateFieldGet(this, _DevvitCustomPost_localClient, "f")?.call('RenderPost', req, this.metadata));
|
|
245
|
+
}
|
|
246
|
+
catch (e) {
|
|
247
|
+
if (isCircuitBreaker(e)) {
|
|
248
|
+
if (e.response) {
|
|
249
|
+
call = e.response;
|
|
250
|
+
}
|
|
251
|
+
__classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_queueRenderPost).call(this, req, 'CircuitBreak' // eslint-disable-line @reddit/i18n-shreddit/no-unwrapped-strings
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
if (circuit === 'CircuitClose' && __classPrivateFieldGet(this, _DevvitCustomPost_localClient, "f")?.ready) {
|
|
256
|
+
console.error(e);
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
if (devvit?.logCircuitBreaks)
|
|
260
|
+
console.warn('remote call triggered at', e);
|
|
261
|
+
}
|
|
262
|
+
// Call remote runtime.
|
|
263
|
+
call = await __classPrivateFieldGet(this, _DevvitCustomPost_customPostActor, "f")?.RenderPost(req, this.metadata);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
if (call) {
|
|
267
|
+
this.renderResponse = call;
|
|
268
|
+
if (this.renderResponse.state) {
|
|
269
|
+
__classPrivateFieldSet(this, _DevvitCustomPost_appState, this.renderResponse.state, "f");
|
|
270
|
+
}
|
|
271
|
+
if (this.renderResponse?.blocks?.ui) {
|
|
272
|
+
__classPrivateFieldSet(this, _DevvitCustomPost_lastRequest, req.blocks, "f");
|
|
273
|
+
this._rootBlock = this.renderResponse.blocks.ui;
|
|
274
|
+
if (!__classPrivateFieldGet(this, _DevvitCustomPost_rootHeight, "f")) {
|
|
275
|
+
// Lock in the initial height
|
|
276
|
+
__classPrivateFieldSet(this, _DevvitCustomPost_rootHeight, this._rootBlock.config?.rootConfig?.height || DEFAULT_ROOT_HEIGHT, "f");
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
(_a = this._rootBlock).config ?? (_a.config = {});
|
|
280
|
+
(_b = this._rootBlock.config).rootConfig ?? (_b.rootConfig = BlockConfig_Root.fromPartial({}));
|
|
281
|
+
this._rootBlock.config.rootConfig.height = __classPrivateFieldGet(this, _DevvitCustomPost_rootHeight, "f");
|
|
282
|
+
}
|
|
283
|
+
await this.updateComplete;
|
|
284
|
+
}
|
|
285
|
+
await __classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_handleEffects).call(this, req.blocks.type, this.renderResponse.effects);
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
_DevvitCustomPost_state_get = function _DevvitCustomPost_state_get() {
|
|
289
|
+
const data = { __postData: { thingId: this.postId, config: this.postConfig } };
|
|
290
|
+
return Object.assign({}, __classPrivateFieldGet(this, _DevvitCustomPost_appState, "f"), data);
|
|
291
|
+
};
|
|
292
|
+
_DevvitCustomPost_userActionRender = function _DevvitCustomPost_userActionRender(actionId, data = {}) {
|
|
293
|
+
__classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_queueRenderPost).call(this, __classPrivateFieldGet(this, _DevvitCustomPost_newRenderRequest, "f").call(this, BlockRenderEventType.RENDER_USER_ACTION, actionId, data), 'CircuitClose' // eslint-disable-line @reddit/i18n-shreddit/no-unwrapped-strings
|
|
294
|
+
);
|
|
295
|
+
};
|
|
301
296
|
__decorate([
|
|
302
297
|
property({ attribute: false }),
|
|
303
298
|
__metadata("design:type", Object)
|
|
@@ -305,15 +300,11 @@ __decorate([
|
|
|
305
300
|
__decorate([
|
|
306
301
|
property({ attribute: false }),
|
|
307
302
|
__metadata("design:type", Object)
|
|
308
|
-
], DevvitCustomPost.prototype, "
|
|
303
|
+
], DevvitCustomPost.prototype, "bundle", void 0);
|
|
309
304
|
__decorate([
|
|
310
|
-
property({ attribute:
|
|
305
|
+
property({ attribute: 'force-color-scheme' }),
|
|
311
306
|
__metadata("design:type", String)
|
|
312
|
-
], DevvitCustomPost.prototype, "
|
|
313
|
-
__decorate([
|
|
314
|
-
property({ attribute: false }),
|
|
315
|
-
__metadata("design:type", Object)
|
|
316
|
-
], DevvitCustomPost.prototype, "postConfig", void 0);
|
|
307
|
+
], DevvitCustomPost.prototype, "forceColorScheme", void 0);
|
|
317
308
|
__decorate([
|
|
318
309
|
property({ attribute: false }),
|
|
319
310
|
__metadata("design:type", Blob)
|
|
@@ -321,35 +312,39 @@ __decorate([
|
|
|
321
312
|
__decorate([
|
|
322
313
|
property({ attribute: false }),
|
|
323
314
|
__metadata("design:type", Object)
|
|
324
|
-
], DevvitCustomPost.prototype, "
|
|
315
|
+
], DevvitCustomPost.prototype, "metadata", void 0);
|
|
325
316
|
__decorate([
|
|
326
317
|
property({ attribute: false }),
|
|
327
|
-
__metadata("design:type",
|
|
328
|
-
], DevvitCustomPost.prototype, "
|
|
318
|
+
__metadata("design:type", Object)
|
|
319
|
+
], DevvitCustomPost.prototype, "postConfig", void 0);
|
|
329
320
|
__decorate([
|
|
330
|
-
property({ attribute:
|
|
321
|
+
property({ attribute: 'post-id' }),
|
|
322
|
+
__metadata("design:type", String)
|
|
323
|
+
], DevvitCustomPost.prototype, "postId", void 0);
|
|
324
|
+
__decorate([
|
|
325
|
+
property({ attribute: 'use-experimental-blocks', type: Boolean }),
|
|
331
326
|
__metadata("design:type", Boolean)
|
|
332
327
|
], DevvitCustomPost.prototype, "useExperimentalBlocks", void 0);
|
|
333
328
|
__decorate([
|
|
334
|
-
property({ attribute:
|
|
329
|
+
property({ attribute: 'use-sandbox', type: Boolean }),
|
|
330
|
+
__metadata("design:type", Boolean)
|
|
331
|
+
], DevvitCustomPost.prototype, "useSandbox", void 0);
|
|
332
|
+
__decorate([
|
|
333
|
+
state(),
|
|
335
334
|
__metadata("design:type", Object)
|
|
336
|
-
], DevvitCustomPost.prototype, "
|
|
335
|
+
], DevvitCustomPost.prototype, "renderResponse", void 0);
|
|
337
336
|
__decorate([
|
|
338
337
|
query('devvit-blocks-renderer'),
|
|
339
338
|
__metadata("design:type", DevvitBlocksRenderer)
|
|
340
|
-
], DevvitCustomPost.prototype, "
|
|
339
|
+
], DevvitCustomPost.prototype, "_blocksRenderer", void 0);
|
|
341
340
|
__decorate([
|
|
342
341
|
state(),
|
|
343
|
-
__metadata("design:type",
|
|
344
|
-
], DevvitCustomPost.prototype, "
|
|
342
|
+
__metadata("design:type", Boolean)
|
|
343
|
+
], DevvitCustomPost.prototype, "_isSuspended", void 0);
|
|
345
344
|
__decorate([
|
|
346
345
|
state(),
|
|
347
346
|
__metadata("design:type", Object)
|
|
348
|
-
], DevvitCustomPost.prototype, "
|
|
349
|
-
__decorate([
|
|
350
|
-
state(),
|
|
351
|
-
__metadata("design:type", Boolean)
|
|
352
|
-
], DevvitCustomPost.prototype, "isSuspended", void 0);
|
|
347
|
+
], DevvitCustomPost.prototype, "_rootBlock", void 0);
|
|
353
348
|
DevvitCustomPost = __decorate([
|
|
354
349
|
customElement('devvit-custom-post')
|
|
355
350
|
], DevvitCustomPost);
|
|
@@ -1,5 +1,20 @@
|
|
|
1
|
-
import { ReactiveController, ReactiveElement } from 'lit';
|
|
2
1
|
import { Effect, Form, NavigateToUrlEffect, RealtimeSubscriptionsEffect, ReloadPartEffect, Toast, UIEvent } from '@devvit/protos';
|
|
2
|
+
import { Severity } from '@reddit/faceplate/types.js';
|
|
3
|
+
import { ReactiveController, ReactiveElement } from 'lit';
|
|
4
|
+
import { ParentWindowInfo } from '../../types/parent-window.js';
|
|
5
|
+
export type DevvitPostMessageEffectDetail = {
|
|
6
|
+
onEvent?(event: UIEvent): void;
|
|
7
|
+
} & ({
|
|
8
|
+
effectName: 'devvit:navigateToEffect';
|
|
9
|
+
url: string;
|
|
10
|
+
} | {
|
|
11
|
+
effectName: 'devvit:toastEffect';
|
|
12
|
+
message: string;
|
|
13
|
+
level: Severity;
|
|
14
|
+
} | {
|
|
15
|
+
effectName: 'devvit:formEffect';
|
|
16
|
+
form: Form;
|
|
17
|
+
});
|
|
3
18
|
export declare abstract class DevvitEffectHandler implements ReactiveController {
|
|
4
19
|
#private;
|
|
5
20
|
protected host: ReactiveElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devvit-effect-handler.d.ts","sourceRoot":"","sources":["../../../library/src/client/effects/devvit-effect-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,KAAK,CAAC;AAC1D,OAAO,
|
|
1
|
+
{"version":3,"file":"devvit-effect-handler.d.ts","sourceRoot":"","sources":["../../../library/src/client/effects/devvit-effect-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EAEN,IAAI,EACJ,mBAAmB,EACnB,2BAA2B,EAC3B,gBAAgB,EAChB,KAAK,EACL,OAAO,EACR,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,KAAK,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAGhE,MAAM,MAAM,6BAA6B,GAAG;IAC1C,OAAO,CAAC,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CAChC,GAAG,CACA;IAAE,UAAU,EAAE,yBAAyB,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GACtD;IAAE,UAAU,EAAE,oBAAoB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,QAAQ,CAAA;CAAE,GACtE;IAAE,UAAU,EAAE,mBAAmB,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,CAClD,CAAC;AAEF,8BAAsB,mBAAoB,YAAW,kBAAkB;;IACrE,SAAS,CAAC,IAAI,EAAE,eAAe,CAAC;gBAEpB,IAAI,EAAE,eAAe;IAKjC,SAAS,CAAC,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI;IAE9E,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI;IAE3E,SAAS,CAAC,YAAY,CAAC,MAAM,EAAE,gBAAgB,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI;IAE1F,SAAS,CAAC,eAAe,CACvB,WAAW,EAAE,mBAAmB,EAChC,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GACjC,IAAI;IAEP,SAAS,CAAC,uBAAuB,CAC/B,cAAc,EAAE,2BAA2B,EAC3C,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GACjC,IAAI;IAEP,aAAa,IAAI,IAAI;IAIrB,gBAAgB,IAAI,IAAI;IAIxB,UAAU,IAAI,IAAI;IAElB,WAAW,IAAI,IAAI;IAOnB,mBAAmB,qBACC,gBAAgB,eACrB,6BAA6B,KACzC,IAAI,CASL;IAEF,MAAM,WAAY,MAAM,mBAAmB,OAAO,KAAK,IAAI,KAAG,IAAI,CA8BhE;CACH"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { DevvitEffectHandler } from './devvit-effect-handler.js';
|
|
2
1
|
import { Form, UIEvent } from '@devvit/protos';
|
|
3
2
|
import { ReactiveElement } from 'lit';
|
|
3
|
+
import { ParentWindowInfo } from '../../types/parent-window.js';
|
|
4
|
+
import { DevvitEffectHandler } from './devvit-effect-handler.js';
|
|
4
5
|
export declare class FormEffectHandler extends DevvitEffectHandler {
|
|
5
6
|
#private;
|
|
6
7
|
constructor(host: ReactiveElement, queryString?: string, parentWindowInfo?: ParentWindowInfo | undefined);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-effect-handler.d.ts","sourceRoot":"","sources":["../../../library/src/client/effects/form-effect-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"form-effect-handler.d.ts","sourceRoot":"","sources":["../../../library/src/client/effects/form-effect-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,KAAK,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,qBAAa,iBAAkB,SAAQ,mBAAmB;;gBAOtD,IAAI,EAAE,eAAe,EACrB,WAAW,GAAE,MAA6B,EAC1C,gBAAgB,CAAC,EAAE,gBAAgB,GAAG,SAAS;IAOxC,WAAW,IAAI,IAAI;cAKT,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI;CAYnF"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { DevvitEffectHandler } from './devvit-effect-handler.js';
|
|
2
1
|
import { NavigateToUrlEffect, UIEvent } from '@devvit/protos';
|
|
3
2
|
import { ReactiveElement } from 'lit';
|
|
3
|
+
import { ParentWindowInfo } from '../../types/parent-window.js';
|
|
4
|
+
import { DevvitEffectHandler } from './devvit-effect-handler.js';
|
|
4
5
|
export declare class NavigateToUrlEffectHandler extends DevvitEffectHandler {
|
|
5
6
|
#private;
|
|
6
7
|
constructor(host: ReactiveElement, queryString?: string, parentWindowInfo?: ParentWindowInfo | undefined);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigate-to-url-handler.d.ts","sourceRoot":"","sources":["../../../library/src/client/effects/navigate-to-url-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"navigate-to-url-handler.d.ts","sourceRoot":"","sources":["../../../library/src/client/effects/navigate-to-url-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,KAAK,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AASjE,qBAAa,0BAA2B,SAAQ,mBAAmB;;gBAO/D,IAAI,EAAE,eAAe,EACrB,WAAW,GAAE,MAAyC,EACtD,gBAAgB,CAAC,EAAE,gBAAgB,GAAG,SAAS;IAOxC,WAAW,IAAI,IAAI;cAOT,eAAe,CAChC,UAAU,EAAE,mBAAmB,EAC/B,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GACjC,IAAI;CA2CR"}
|
|
@@ -11,9 +11,12 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
11
11
|
};
|
|
12
12
|
var _NavigateToUrlEffectHandler_queryString, _NavigateToUrlEffectHandler_parentWindowInfo, _NavigateToUrlEffectHandler_dialog;
|
|
13
13
|
import { DevvitEffectHandler } from './devvit-effect-handler.js';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
const IPV4_PATTERN =
|
|
15
|
+
// eslint-disable-next-line security/detect-unsafe-regex
|
|
16
|
+
/((25[0-5]|(2[0-4]|1?[0-9])?[0-9])\.){3}(25[0-5]|(2[0-4]|1?[0-9])?[0-9])/;
|
|
17
|
+
const IPV6_PATTERN =
|
|
18
|
+
// eslint-disable-next-line security/detect-unsafe-regex
|
|
19
|
+
/(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]+|::(ffff(:0{1,4})?:)?((25[0-5]|(2[0-4]|1?[0-9])?[0-9])\.){3}(25[0-5]|(2[0-4]|1?[0-9])?[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1?[0-9])?[0-9])\.){3}(25[0-5]|(2[0-4]|1?[0-9])?[0-9]))/;
|
|
17
20
|
export class NavigateToUrlEffectHandler extends DevvitEffectHandler {
|
|
18
21
|
constructor(host, queryString = 'devvit-navigate-offsite-dialog', parentWindowInfo) {
|
|
19
22
|
super(host);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RealtimeSubscriptionsEffect, UIEvent } from '@devvit/protos';
|
|
2
|
-
import { DevvitEffectHandler } from './devvit-effect-handler.js';
|
|
3
2
|
import { ReactiveElement } from 'lit';
|
|
3
|
+
import { DevvitEffectHandler } from './devvit-effect-handler.js';
|
|
4
4
|
export declare abstract class RealtimeEffectHandler extends DevvitEffectHandler {
|
|
5
5
|
#private;
|
|
6
6
|
protected constructor(host: ReactiveElement);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"realtime-effect-handler.d.ts","sourceRoot":"","sources":["../../../library/src/client/effects/realtime-effect-handler.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"realtime-effect-handler.d.ts","sourceRoot":"","sources":["../../../library/src/client/effects/realtime-effect-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAA8B,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAClG,OAAO,EAAE,eAAe,EAAE,MAAM,KAAK,CAAC;AAEtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,8BAAsB,qBAAsB,SAAQ,mBAAmB;;IAGrE,SAAS,aAAa,IAAI,EAAE,eAAe;IAI3C,QAAQ,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI;IAE5C,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAEvE,aAAa,IAAI,IAAI;IAK9B,SAAS,KAAK,OAAO,IAAI,CAAC,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,SAAS,CAE9D;IAED,SAAS,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAM5C,SAAS,CAAC,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IASrC,uBAAuB,CAC9B,aAAa,EAAE,2BAA2B,EAC1C,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAChC,IAAI;CASR"}
|
|
@@ -10,7 +10,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
10
10
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
11
|
};
|
|
12
12
|
var _RealtimeEffectHandler_instances, _RealtimeEffectHandler_onEvent, _RealtimeEffectHandler_sendEvent;
|
|
13
|
-
import { RealtimeSubscriptionStatus
|
|
13
|
+
import { RealtimeSubscriptionStatus } from '@devvit/protos';
|
|
14
14
|
import { DevvitEffectHandler } from './devvit-effect-handler.js';
|
|
15
15
|
export class RealtimeEffectHandler extends DevvitEffectHandler {
|
|
16
16
|
constructor(host) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Toast } from '@devvit/protos';
|
|
2
|
-
import { DevvitEffectHandler } from './devvit-effect-handler.js';
|
|
3
2
|
import { ReactiveElement } from 'lit';
|
|
3
|
+
import { ParentWindowInfo } from '../../types/parent-window.js';
|
|
4
|
+
import { DevvitEffectHandler } from './devvit-effect-handler.js';
|
|
4
5
|
export declare class ToastEffectHandler extends DevvitEffectHandler {
|
|
5
6
|
#private;
|
|
6
7
|
constructor(host: ReactiveElement, parentWindowInfo?: ParentWindowInfo | undefined);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast-effect-handler.d.ts","sourceRoot":"","sources":["../../../library/src/client/effects/toast-effect-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAmB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"toast-effect-handler.d.ts","sourceRoot":"","sources":["../../../library/src/client/effects/toast-effect-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAmB,MAAM,gBAAgB,CAAC;AAGxD,OAAO,EAAE,eAAe,EAAE,MAAM,KAAK,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,qBAAa,kBAAmB,SAAQ,mBAAmB;;gBAG7C,IAAI,EAAE,eAAe,EAAE,gBAAgB,CAAC,EAAE,gBAAgB,GAAG,SAAS;IAKzE,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;CAgBzC"}
|
|
@@ -11,9 +11,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
11
11
|
};
|
|
12
12
|
var _ToastEffectHandler_parentWindowInfo;
|
|
13
13
|
import { ToastAppearance } from '@devvit/protos';
|
|
14
|
-
import { DevvitEffectHandler } from './devvit-effect-handler.js';
|
|
15
14
|
import { customEvent } from '@reddit/faceplate/lib/custom-event.js';
|
|
16
15
|
import { Severity } from '@reddit/faceplate/types.js';
|
|
16
|
+
import { DevvitEffectHandler } from './devvit-effect-handler.js';
|
|
17
17
|
export class ToastEffectHandler extends DevvitEffectHandler {
|
|
18
18
|
constructor(host, parentWindowInfo) {
|
|
19
19
|
super(host);
|
|
@@ -11,7 +11,7 @@ export declare class DevvitFormSelectionDropdown extends InputElement {
|
|
|
11
11
|
currentLabel: string;
|
|
12
12
|
static get styles(): import("lit").CSSResultGroup[];
|
|
13
13
|
get value(): string;
|
|
14
|
-
willUpdate(changedProperties: PropertyValues): void;
|
|
14
|
+
willUpdate(changedProperties: PropertyValues<this>): void;
|
|
15
15
|
render(): TemplateResult<1>;
|
|
16
16
|
}
|
|
17
17
|
//# sourceMappingURL=devvit-form-selection-dropdown.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devvit-form-selection-dropdown.d.ts","sourceRoot":"","sources":["../../../../library/src/client/formbuilder/components/devvit-form-selection-dropdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"devvit-form-selection-dropdown.d.ts","sourceRoot":"","sources":["../../../../library/src/client/formbuilder/components/devvit-form-selection-dropdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAQ1D,OAAO,EAAE,YAAY,EAAE,MAAM,iDAAiD,CAAC;AAG/E,OAAO,EAGL,SAAS,EAEV,MAAM,gBAAgB,CAAC;AAIxB,OAAO,4DAA4D,CAAC;AACpE,OAAO,mDAAmD,CAAC;AAC3D,OAAO,2DAA2D,CAAC;AAGnE,qBAAa,2BAA4B,SAAQ,YAAY;;IAE3D,KAAK,EAAE,SAAS,GAAG,SAAS,CAAC;IAG7B,YAAY,UAAS;IAGrB,YAAY,SAAM;IAKlB,WAAoB,MAAM,mCAWzB;IAED,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,UAAU,CAAC,iBAAiB,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI;IAwDhD,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC;CAoDrC"}
|
|
@@ -23,10 +23,10 @@ import { css } from 'lit';
|
|
|
23
23
|
import { property, state } from 'lit/decorators.js';
|
|
24
24
|
import { classMap } from 'lit/directives/class-map.js';
|
|
25
25
|
import { html, ifDefined } from '@reddit/faceplate-ui/templateRenderingStrategy/clientStrategy.js';
|
|
26
|
-
import { listItem } from '@reddit/faceplate-ui/templates/list-item.js';
|
|
27
26
|
import { dropdownButton } from '@reddit/faceplate-ui/templates/dropdownButton.js';
|
|
28
|
-
import {
|
|
27
|
+
import { listItem } from '@reddit/faceplate-ui/templates/list-item.js';
|
|
29
28
|
import { InputElement } from '@reddit/faceplate/base-classes/input-element.js';
|
|
29
|
+
import { msg } from '@reddit/faceplate/lib/i18n/localize.js';
|
|
30
30
|
import { FieldConfig_Selection, FormFieldValue_SelectionValue, } from '@devvit/protos';
|
|
31
31
|
import { styles } from '../../../styles.js';
|
|
32
32
|
import '@reddit/faceplate-ui/components/faceplate-dropdown-menu.js';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { PropertyValues, TemplateResult } from 'lit';
|
|
2
2
|
import { InputElement } from '@reddit/faceplate/base-classes/input-element.js';
|
|
3
3
|
import { FormField } from '@devvit/protos';
|
|
4
|
-
import '@reddit/faceplate-ui/components/faceplate-radio-input.js';
|
|
5
4
|
import '@reddit/faceplate-ui/components/faceplate-checkbox-input.js';
|
|
5
|
+
import '@reddit/faceplate-ui/components/faceplate-radio-input.js';
|
|
6
6
|
export declare class DevvitFormSelectionList extends InputElement {
|
|
7
7
|
#private;
|
|
8
8
|
field: FormField | undefined;
|
|
9
9
|
static get styles(): import("lit").CSSResultGroup[];
|
|
10
10
|
get value(): string;
|
|
11
|
-
willUpdate(changedProperties: PropertyValues): void;
|
|
11
|
+
willUpdate(changedProperties: PropertyValues<this>): void;
|
|
12
12
|
render(): TemplateResult<1>;
|
|
13
13
|
}
|
|
14
14
|
//# sourceMappingURL=devvit-form-selection-list.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devvit-form-selection-list.d.ts","sourceRoot":"","sources":["../../../../library/src/client/formbuilder/components/devvit-form-selection-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAKrD,OAAO,EAAE,YAAY,EAAE,MAAM,iDAAiD,CAAC;AAE/E,OAAO,EAGL,SAAS,EAEV,MAAM,gBAAgB,CAAC;AAMxB,OAAO,
|
|
1
|
+
{"version":3,"file":"devvit-form-selection-list.d.ts","sourceRoot":"","sources":["../../../../library/src/client/formbuilder/components/devvit-form-selection-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAKrD,OAAO,EAAE,YAAY,EAAE,MAAM,iDAAiD,CAAC;AAE/E,OAAO,EAGL,SAAS,EAEV,MAAM,gBAAgB,CAAC;AAMxB,OAAO,6DAA6D,CAAC;AACrE,OAAO,0DAA0D,CAAC;AAElE,qBAAa,uBAAwB,SAAQ,YAAY;;IAEvD,KAAK,EAAE,SAAS,GAAG,SAAS,CAAC;IAK7B,WAAoB,MAAM,mCAEzB;IAED,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,UAAU,CAAC,iBAAiB,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI;IAsBhD,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC;CAgDrC"}
|
|
@@ -25,8 +25,8 @@ import { InputElement } from '@reddit/faceplate/base-classes/input-element.js';
|
|
|
25
25
|
import { FieldConfig_Selection, FormFieldValue_SelectionValue, } from '@devvit/protos';
|
|
26
26
|
import { renderFieldLabel } from '../fields/renderFieldLabel.js';
|
|
27
27
|
import { styles } from '../../../styles.js';
|
|
28
|
-
import '@reddit/faceplate-ui/components/faceplate-radio-input.js';
|
|
29
28
|
import '@reddit/faceplate-ui/components/faceplate-checkbox-input.js';
|
|
29
|
+
import '@reddit/faceplate-ui/components/faceplate-radio-input.js';
|
|
30
30
|
export class DevvitFormSelectionList extends InputElement {
|
|
31
31
|
constructor() {
|
|
32
32
|
super(...arguments);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devvit/ui-renderer",
|
|
3
|
-
"version": "0.10.15-next-2024-02-
|
|
3
|
+
"version": "0.10.15-next-2024-02-12-3ee5af35d.0",
|
|
4
4
|
"license": "BSD-3-Clause",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -54,10 +54,10 @@
|
|
|
54
54
|
},
|
|
55
55
|
"types": "./index.d.ts",
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@devvit/protos": "0.10.15-next-2024-02-
|
|
58
|
-
"@devvit/runtime-lite": "0.10.15-next-2024-02-
|
|
59
|
-
"@devvit/runtimes": "0.10.15-next-2024-02-
|
|
60
|
-
"@devvit/shared-types": "0.10.15-next-2024-02-
|
|
57
|
+
"@devvit/protos": "0.10.15-next-2024-02-12-3ee5af35d.0",
|
|
58
|
+
"@devvit/runtime-lite": "0.10.15-next-2024-02-12-3ee5af35d.0",
|
|
59
|
+
"@devvit/runtimes": "0.10.15-next-2024-02-12-3ee5af35d.0",
|
|
60
|
+
"@devvit/shared-types": "0.10.15-next-2024-02-12-3ee5af35d.0",
|
|
61
61
|
"@dotlottie/player-component": "2.7.2",
|
|
62
62
|
"p-queue": "7.3.4",
|
|
63
63
|
"rxjs": "7.5.7"
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"devDependencies": {
|
|
85
85
|
"@devvit/eslint-config": "0.10.14",
|
|
86
86
|
"@devvit/repo-tools": "0.10.14",
|
|
87
|
-
"@devvit/tsconfig": "0.10.15-next-2024-02-
|
|
87
|
+
"@devvit/tsconfig": "0.10.15-next-2024-02-12-3ee5af35d.0",
|
|
88
88
|
"@lit-labs/ssr": "^2.2.3",
|
|
89
89
|
"@lit/localize": "0.11.4",
|
|
90
90
|
"@open-wc/testing-helpers": "2.3.0",
|
|
@@ -116,5 +116,5 @@
|
|
|
116
116
|
"directory": "dist"
|
|
117
117
|
},
|
|
118
118
|
"source": "./src/index.ts",
|
|
119
|
-
"gitHead": "
|
|
119
|
+
"gitHead": "1110a505e1eb63e02364e2e8d0f42dce32ad09a9"
|
|
120
120
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parent-window.d.ts","sourceRoot":"","sources":["../../library/src/types/parent-window.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,qBAAqB,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
package/types/events.d.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { BlockAction, Effect, Form, RealtimeEvent, UIEvent } from '@devvit/protos';
|
|
2
|
-
import { FaceplateEvent } from '@reddit/faceplate/event-types.js';
|
|
3
|
-
import { Severity } from '@reddit/faceplate/types.js';
|
|
4
|
-
declare global {
|
|
5
|
-
type DevvitUIEffectEvent = FaceplateEvent<'devvit-ui-effect'> & {
|
|
6
|
-
detail: Readonly<{
|
|
7
|
-
effect: Effect;
|
|
8
|
-
onEvent: (event: UIEvent) => void;
|
|
9
|
-
}>;
|
|
10
|
-
};
|
|
11
|
-
type DevvitUserAction = FaceplateEvent<'devvit-user-action'> & {
|
|
12
|
-
detail: Readonly<{
|
|
13
|
-
action: BlockAction;
|
|
14
|
-
}>;
|
|
15
|
-
};
|
|
16
|
-
type DevvitRealtimeSubscriptions = FaceplateEvent<'devvit-realtime-subs'> & {
|
|
17
|
-
detail: Readonly<{
|
|
18
|
-
channels: string[];
|
|
19
|
-
}>;
|
|
20
|
-
};
|
|
21
|
-
type DevvitRealtimeSend = FaceplateEvent<'devvit-realtime-send'> & {
|
|
22
|
-
detail: Readonly<{
|
|
23
|
-
event: RealtimeEvent;
|
|
24
|
-
}>;
|
|
25
|
-
};
|
|
26
|
-
type ParentWindowInfo = {
|
|
27
|
-
windowTop: Window;
|
|
28
|
-
postMessageHostOrigin: string;
|
|
29
|
-
};
|
|
30
|
-
type DevvitPostMessageEffectDetail = {
|
|
31
|
-
onEvent?: (event: UIEvent) => void;
|
|
32
|
-
} & ({
|
|
33
|
-
effectName: 'devvit:navigateToEffect';
|
|
34
|
-
url: string;
|
|
35
|
-
} | {
|
|
36
|
-
effectName: 'devvit:toastEffect';
|
|
37
|
-
message: string;
|
|
38
|
-
level: Severity;
|
|
39
|
-
} | {
|
|
40
|
-
effectName: 'devvit:formEffect';
|
|
41
|
-
form: Form;
|
|
42
|
-
});
|
|
43
|
-
interface HTMLElementEventMap {
|
|
44
|
-
'devvit-ui-effect': DevvitUIEffectEvent;
|
|
45
|
-
'devvit-user-action': DevvitUserAction;
|
|
46
|
-
'devvit-realtime-send': DevvitRealtimeSend;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
//# sourceMappingURL=events.d.ts.map
|
package/types/events.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../library/src/types/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,CAAC,MAAM,CAAC;IACb,KAAK,mBAAmB,GAAG,cAAc,CAAC,kBAAkB,CAAC,GAAG;QAC9D,MAAM,EAAE,QAAQ,CAAC;YACf,MAAM,EAAE,MAAM,CAAC;YACf,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;SACnC,CAAC,CAAC;KACJ,CAAC;IAEF,KAAK,gBAAgB,GAAG,cAAc,CAAC,oBAAoB,CAAC,GAAG;QAC7D,MAAM,EAAE,QAAQ,CAAC;YACf,MAAM,EAAE,WAAW,CAAC;SACrB,CAAC,CAAC;KACJ,CAAC;IAEF,KAAK,2BAA2B,GAAG,cAAc,CAAC,sBAAsB,CAAC,GAAG;QAC1E,MAAM,EAAE,QAAQ,CAAC;YACf,QAAQ,EAAE,MAAM,EAAE,CAAC;SACpB,CAAC,CAAC;KACJ,CAAC;IAEF,KAAK,kBAAkB,GAAG,cAAc,CAAC,sBAAsB,CAAC,GAAG;QACjE,MAAM,EAAE,QAAQ,CAAC;YACf,KAAK,EAAE,aAAa,CAAC;SACtB,CAAC,CAAC;KACJ,CAAC;IAEF,KAAK,gBAAgB,GAAG;QACtB,SAAS,EAAE,MAAM,CAAC;QAClB,qBAAqB,EAAE,MAAM,CAAC;KAC/B,CAAC;IAEF,KAAK,6BAA6B,GAAG;QACnC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;KACpC,GAAG,CACA;QACE,UAAU,EAAE,yBAAyB,CAAC;QACtC,GAAG,EAAE,MAAM,CAAC;KACb,GACD;QACE,UAAU,EAAE,oBAAoB,CAAC;QACjC,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,QAAQ,CAAC;KACjB,GACD;QACE,UAAU,EAAE,mBAAmB,CAAC;QAChC,IAAI,EAAE,IAAI,CAAC;KACZ,CACJ,CAAC;IAEF,UAAU,mBAAmB;QAC3B,kBAAkB,EAAE,mBAAmB,CAAC;QACxC,oBAAoB,EAAE,gBAAgB,CAAC;QACvC,sBAAsB,EAAE,kBAAkB,CAAC;KAC5C;CACF"}
|
|
File without changes
|