@devvit/ui-renderer 0.9.10-next-2023-06-26-b1101d64c.0 → 0.9.10-next-2023-06-27-1ce71ae3b.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/blocks/attributes.d.ts +4 -0
- package/blocks/attributes.d.ts.map +1 -1
- package/blocks/templates/renderBlock.d.ts +1 -0
- package/blocks/templates/renderBlock.d.ts.map +1 -1
- package/blocks/templates/renderBlock.js +10 -1
- package/blocks/templates/renderStackBlock.d.ts +2 -1
- package/blocks/templates/renderStackBlock.d.ts.map +1 -1
- package/blocks/templates/renderStackBlock.js +3 -1
- package/client/devvit-custom-post.d.ts.map +1 -1
- package/client/devvit-custom-post.js +16 -3
- package/package.json +7 -7
package/blocks/attributes.d.ts
CHANGED
|
@@ -4,6 +4,10 @@ import { ButtonAppearance, ButtonSize } from '@reddit/faceplate-ui/templates/but
|
|
|
4
4
|
import { Block, BlockAlignment, BlockAvatarFacing, BlockAvatarSize, BlockBorder, BlockButtonAppearance, BlockButtonSize, BlockFullSnooSize, BlockGap, BlockIconSize, BlockImageResizeMode, BlockPadding, BlockRadius, BlockSize, BlockSpacerSize, BlockStackDirection, BlockTextOutline, BlockTextSize, BlockTextWeight, BlockType } from '@devvit/protos';
|
|
5
5
|
import { RenderContext } from './templates/renderContext.js';
|
|
6
6
|
import { ref as clientRef } from 'lit/directives/ref.js';
|
|
7
|
+
export interface AttributeOverrides {
|
|
8
|
+
styles?: StyleInfo | undefined;
|
|
9
|
+
classes?: ClassInfo | undefined;
|
|
10
|
+
}
|
|
7
11
|
export declare function defaultClasses(type: BlockType): ClassInfo;
|
|
8
12
|
export declare function stackDirectionClass(direction: BlockStackDirection, reverse: boolean | undefined): ClassInfo;
|
|
9
13
|
export declare function stackChildClass(parentDirection: BlockStackDirection): ClassInfo;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../library/src/blocks/attributes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AED,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,gBAAgB,EACzB,UAAU,EAAE,MAAM,GAAG,SAAS,GAC7B,SAAS,CAOX;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAI/D;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE,eAAe,GAAG,SAAS,EACjC,cAAc,EAAE,mBAAmB,GAClC,SAAS,CAiBX;AAED,wBAAgB,eAAe,CAAC,UAAU,EAAE,oBAAoB,GAAG,SAAS,GAAG,SAAS,CASvF;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,aAAa,GAAG,SAAS,GAAG,SAAS,CAOxE;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,eAAe,GAAG,SAAS,GAAG,SAAS,CAY5E;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,SAAS,GAAG,SAAS,CAK5E;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,iBAAiB,GAAG,SAAS,GAAG,SAAS,CAgBhF;AAED,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,qBAAqB,GAAG,SAAS,GAAG,gBAAgB,CA2BhG;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,SAAS,GAAG,UAAU,CAexE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,CAInD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CASxF;AAED,wBAAgB,cAAc,CAC5B,SAAS,EAAE,gBAAgB,GAAG,SAAS,GACtC,UAAU,CAAC,OAAO,SAAS,CAAC,CAqC9B"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Block } from '@devvit/protos';
|
|
2
2
|
import { RenderContext } from './renderContext.js';
|
|
3
3
|
import { TemplateLike } from './util.js';
|
|
4
|
+
export declare const DEFAULT_ROOT_HEIGHT = 320;
|
|
4
5
|
export declare function renderBlocks(block: Block, context?: Partial<RenderContext>): TemplateLike;
|
|
5
6
|
export declare function renderBlock(block: Block, ctx: RenderContext): TemplateLike;
|
|
6
7
|
//# sourceMappingURL=renderBlock.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderBlock.d.ts","sourceRoot":"","sources":["../../../library/src/blocks/templates/renderBlock.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAkC,MAAM,gBAAgB,CAAC;AAYvE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,GAAE,OAAO,CAAC,aAAa,CAAM,GAAG,YAAY,
|
|
1
|
+
{"version":3,"file":"renderBlock.d.ts","sourceRoot":"","sources":["../../../library/src/blocks/templates/renderBlock.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAkC,MAAM,gBAAgB,CAAC;AAYvE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,GAAE,OAAO,CAAC,aAAa,CAAM,GAAG,YAAY,CAgC7F;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,GAAG,YAAY,CA+C1E"}
|
|
@@ -11,12 +11,14 @@ import { renderWebViewBlock } from './renderWebViewBlock.js';
|
|
|
11
11
|
import { renderAnimationBlock } from './renderAnimationBlock.js';
|
|
12
12
|
import { renderAvatarBlock } from './renderAvatarBlock.js';
|
|
13
13
|
import { renderFullSnooBlock } from './renderFullSnooBlock.js';
|
|
14
|
+
export const DEFAULT_ROOT_HEIGHT = 320;
|
|
14
15
|
export function renderBlocks(block, context = {}) {
|
|
15
16
|
if (block.type !== BlockType.BLOCK_ROOT) {
|
|
16
17
|
console.error('Invalid root block');
|
|
17
18
|
return nothing;
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
+
const height = `${block.config?.rootConfig?.height ?? DEFAULT_ROOT_HEIGHT}px`;
|
|
21
|
+
return renderStackBlock({
|
|
20
22
|
type: BlockType.BLOCK_STACK,
|
|
21
23
|
config: {
|
|
22
24
|
stackConfig: {
|
|
@@ -28,6 +30,13 @@ export function renderBlocks(block, context = {}) {
|
|
|
28
30
|
}, {
|
|
29
31
|
...context,
|
|
30
32
|
stackDirection: BlockStackDirection.UNRECOGNIZED,
|
|
33
|
+
}, renderBlock, {
|
|
34
|
+
styles: {
|
|
35
|
+
height,
|
|
36
|
+
minHeight: height,
|
|
37
|
+
maxHeight: height,
|
|
38
|
+
overflow: 'hidden',
|
|
39
|
+
},
|
|
31
40
|
});
|
|
32
41
|
}
|
|
33
42
|
export function renderBlock(block, ctx) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Block } from '@devvit/protos';
|
|
2
|
+
import { AttributeOverrides } from '../attributes.js';
|
|
2
3
|
import { RenderContext } from './renderContext.js';
|
|
3
4
|
import { TemplateLike } from './util.js';
|
|
4
|
-
export declare function renderStackBlock(block: Block, ctx: RenderContext | undefined, renderBlock: (block: Block, ctx: RenderContext) => TemplateLike): TemplateLike;
|
|
5
|
+
export declare function renderStackBlock(block: Block, ctx: RenderContext | undefined, renderBlock: (block: Block, ctx: RenderContext) => TemplateLike, attributeOverrides?: AttributeOverrides | undefined): TemplateLike;
|
|
5
6
|
//# sourceMappingURL=renderStackBlock.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderStackBlock.d.ts","sourceRoot":"","sources":["../../../library/src/blocks/templates/renderStackBlock.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAuB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"renderStackBlock.d.ts","sourceRoot":"","sources":["../../../library/src/blocks/templates/renderStackBlock.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAuB,MAAM,gBAAgB,CAAC;AAE5D,OAAO,EAEL,kBAAkB,EAcnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAA0B,YAAY,EAAE,MAAM,WAAW,CAAC;AAEjE,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,KAAK,EACZ,GAAG,2BAAsE,EACzE,WAAW,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,KAAK,YAAY,EAC/D,kBAAkB,GAAE,kBAAkB,GAAG,SAAqB,GAC7D,YAAY,CAyEd"}
|
|
@@ -3,7 +3,7 @@ import { getTemplateRenderingStrategy } from '@reddit/faceplate-ui/faceplateUICo
|
|
|
3
3
|
import { BlockStackDirection } from '@devvit/protos';
|
|
4
4
|
import { alignmentClass, backgroundStyle, borderClass, borderStyle, cursorClass, defaultClasses, gapClass, onClickAction, paddingClass, radiusClass, sizingClass, sizingStyle, stackChildClass, stackDirectionClass, } from '../attributes.js';
|
|
5
5
|
import { classMap, correctColor } from './util.js';
|
|
6
|
-
export function renderStackBlock(block, ctx = { stackDirection: BlockStackDirection.UNRECOGNIZED }, renderBlock) {
|
|
6
|
+
export function renderStackBlock(block, ctx = { stackDirection: BlockStackDirection.UNRECOGNIZED }, renderBlock, attributeOverrides = undefined) {
|
|
7
7
|
const { html, repeat, styleMap, ifDefined } = getTemplateRenderingStrategy();
|
|
8
8
|
if (block.config?.stackConfig === undefined) {
|
|
9
9
|
console.error('Invalid block: Stack missing StackConfig');
|
|
@@ -21,11 +21,13 @@ export function renderStackBlock(block, ctx = { stackDirection: BlockStackDirect
|
|
|
21
21
|
...borderClass(border),
|
|
22
22
|
...radiusClass(cornerRadius),
|
|
23
23
|
...cursorClass(block),
|
|
24
|
+
...attributeOverrides?.classes,
|
|
24
25
|
};
|
|
25
26
|
const styles = {
|
|
26
27
|
...sizingStyle(block.size),
|
|
27
28
|
...backgroundStyle(backgroundColor),
|
|
28
29
|
...borderStyle(border),
|
|
30
|
+
...attributeOverrides?.styles,
|
|
29
31
|
};
|
|
30
32
|
const newCtx = {
|
|
31
33
|
...ctx,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devvit-custom-post.d.ts","sourceRoot":"","sources":["../../library/src/client/devvit-custom-post.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,UAAU,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAIvD,OAAO,kEAAkE,CAAC;AAG1E,OAAO,KAAK,EAOV,YAAY,EACZ,QAAQ,EAER,MAAM,EAGP,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,
|
|
1
|
+
{"version":3,"file":"devvit-custom-post.d.ts","sourceRoot":"","sources":["../../library/src/client/devvit-custom-post.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,UAAU,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAIvD,OAAO,kEAAkE,CAAC;AAG1E,OAAO,KAAK,EAOV,YAAY,EACZ,QAAQ,EAER,MAAM,EAGP,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,EAML,kBAAkB,EAEnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAM9E,OAAO,8BAA8B,CAAC;AACtC,OAAO,gDAAgD,CAAC;AACxD,OAAO,+CAA+C,CAAC;AAEvD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,oBAAoB,EAAE,gBAAgB,CAAC;KACxC;CACF;AASD,qBACa,gBAAiB,SAAQ,UAAU;;IAE9C,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAGpB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAGpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAGhB,UAAU,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;IAG9B,gBAAgB,CAAC,EAAE,IAAI,CAAC;IAGxB,MAAM,CAAC,EAAE,YAAY,CAAC;IAGtB,UAAU,EAAE,OAAO,CAAQ;IAG3B,cAAc,CAAC,EAAE,kBAAkB,CAAC;IAGpC,SAAS,CAAC,EAAE,KAAK,CAAC;IAalB,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAQvB,iBAAiB;IAKjB,oBAAoB;cASJ,UAAU,CAAC,iBAAiB,EAAE,cAAc;IA8B5D,MAAM;CAkJhB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,oBAAoB,EAAE,gBAAgB,CAAC;KACxC;CACF"}
|
|
@@ -18,15 +18,16 @@ 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, _DevvitCustomPost_customPostActor, _DevvitCustomPost_uiEventHandlerActor, _DevvitCustomPost_rpcQueue, _DevvitCustomPost_rerenderTimeout, _DevvitCustomPost_state_get, _DevvitCustomPost_makeRenderContext, _DevvitCustomPost_handleUIEvent, _DevvitCustomPost_handleUserAction, _DevvitCustomPost_renderRequest, _DevvitCustomPost_initialRender, _DevvitCustomPost_userActionRender, _DevvitCustomPost_effectEventRender, _DevvitCustomPost_renderPost, _DevvitCustomPost_handleEffects;
|
|
21
|
+
var _DevvitCustomPost_instances, _DevvitCustomPost_appState, _DevvitCustomPost_lastRequest, _DevvitCustomPost_rootHeight, _DevvitCustomPost_customPostActor, _DevvitCustomPost_uiEventHandlerActor, _DevvitCustomPost_rpcQueue, _DevvitCustomPost_rerenderTimeout, _DevvitCustomPost_state_get, _DevvitCustomPost_makeRenderContext, _DevvitCustomPost_handleUIEvent, _DevvitCustomPost_handleUserAction, _DevvitCustomPost_renderRequest, _DevvitCustomPost_initialRender, _DevvitCustomPost_userActionRender, _DevvitCustomPost_effectEventRender, _DevvitCustomPost_renderPost, _DevvitCustomPost_handleEffects;
|
|
22
22
|
import { html, LitElement } from 'lit';
|
|
23
23
|
import { customElement, property, state } from 'lit/decorators.js';
|
|
24
24
|
import PQueue from 'p-queue';
|
|
25
25
|
import '@reddit/faceplate-ui/templateRenderingStrategy/clientStrategy.js';
|
|
26
26
|
import { customEvent } from '@reddit/faceplate/lib/custom-event.js';
|
|
27
|
-
import { Block, BlockRenderEventType, BlockStackDirection, CustomPostDefinition, EffectType, RenderPostResponse, UIEventHandlerDefinition, } from '@devvit/protos';
|
|
27
|
+
import { Block, BlockConfig_Root, BlockRenderEventType, BlockStackDirection, CustomPostDefinition, EffectType, RenderPostResponse, UIEventHandlerDefinition, } from '@devvit/protos';
|
|
28
28
|
import { BrowserLiteClient } from '@devvit/runtime-lite/BrowserLiteClient.js';
|
|
29
29
|
import { isCircuitBreaker } from '@devvit/runtime-lite/CircuitBreaker.js';
|
|
30
|
+
import { DEFAULT_ROOT_HEIGHT } from '../blocks/templates/renderBlock.js';
|
|
30
31
|
import './devvit-animation-player.js';
|
|
31
32
|
import '../blocks/components/devvit-blocks-renderer.js';
|
|
32
33
|
import '../blocks/components/devvit-blocks-webview.js';
|
|
@@ -37,6 +38,7 @@ let DevvitCustomPost = class DevvitCustomPost extends LitElement {
|
|
|
37
38
|
this.useSandbox = true;
|
|
38
39
|
_DevvitCustomPost_appState.set(this, {});
|
|
39
40
|
_DevvitCustomPost_lastRequest.set(this, void 0);
|
|
41
|
+
_DevvitCustomPost_rootHeight.set(this, void 0);
|
|
40
42
|
_DevvitCustomPost_customPostActor.set(this, void 0);
|
|
41
43
|
_DevvitCustomPost_uiEventHandlerActor.set(this, void 0);
|
|
42
44
|
_DevvitCustomPost_rpcQueue.set(this, new PQueue({ concurrency: 1 }));
|
|
@@ -131,11 +133,12 @@ let DevvitCustomPost = class DevvitCustomPost extends LitElement {
|
|
|
131
133
|
</devvit-blocks-renderer>`;
|
|
132
134
|
}
|
|
133
135
|
};
|
|
134
|
-
_DevvitCustomPost_appState = new WeakMap(), _DevvitCustomPost_lastRequest = new WeakMap(), _DevvitCustomPost_customPostActor = new WeakMap(), _DevvitCustomPost_uiEventHandlerActor = new WeakMap(), _DevvitCustomPost_rpcQueue = new WeakMap(), _DevvitCustomPost_rerenderTimeout = new WeakMap(), _DevvitCustomPost_makeRenderContext = new WeakMap(), _DevvitCustomPost_handleUIEvent = new WeakMap(), _DevvitCustomPost_handleUserAction = new WeakMap(), _DevvitCustomPost_renderRequest = new WeakMap(), _DevvitCustomPost_instances = new WeakSet(), _DevvitCustomPost_state_get = function _DevvitCustomPost_state_get() {
|
|
136
|
+
_DevvitCustomPost_appState = new WeakMap(), _DevvitCustomPost_lastRequest = new WeakMap(), _DevvitCustomPost_rootHeight = new WeakMap(), _DevvitCustomPost_customPostActor = new WeakMap(), _DevvitCustomPost_uiEventHandlerActor = new WeakMap(), _DevvitCustomPost_rpcQueue = new WeakMap(), _DevvitCustomPost_rerenderTimeout = new WeakMap(), _DevvitCustomPost_makeRenderContext = new WeakMap(), _DevvitCustomPost_handleUIEvent = new WeakMap(), _DevvitCustomPost_handleUserAction = new WeakMap(), _DevvitCustomPost_renderRequest = new WeakMap(), _DevvitCustomPost_instances = new WeakSet(), _DevvitCustomPost_state_get = function _DevvitCustomPost_state_get() {
|
|
135
137
|
return Object.assign({}, __classPrivateFieldGet(this, _DevvitCustomPost_appState, "f"), {
|
|
136
138
|
__postData: { thingId: this.postId, config: this.postConfig },
|
|
137
139
|
});
|
|
138
140
|
}, _DevvitCustomPost_initialRender = function _DevvitCustomPost_initialRender() {
|
|
141
|
+
__classPrivateFieldSet(this, _DevvitCustomPost_rootHeight, undefined, "f");
|
|
139
142
|
__classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_renderPost).call(this, __classPrivateFieldGet(this, _DevvitCustomPost_renderRequest, "f").call(this, BlockRenderEventType.RENDER_INITIAL));
|
|
140
143
|
}, _DevvitCustomPost_userActionRender = function _DevvitCustomPost_userActionRender(actionId, data = {}) {
|
|
141
144
|
__classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_renderPost).call(this, __classPrivateFieldGet(this, _DevvitCustomPost_renderRequest, "f").call(this, BlockRenderEventType.RENDER_USER_ACTION, actionId, data));
|
|
@@ -143,6 +146,7 @@ _DevvitCustomPost_appState = new WeakMap(), _DevvitCustomPost_lastRequest = new
|
|
|
143
146
|
__classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_renderPost).call(this, __classPrivateFieldGet(this, _DevvitCustomPost_renderRequest, "f").call(this, BlockRenderEventType.RENDER_EFFECT_EVENT, effectType, effectData));
|
|
144
147
|
}, _DevvitCustomPost_renderPost = function _DevvitCustomPost_renderPost(req, circuitBreak = false) {
|
|
145
148
|
void __classPrivateFieldGet(this, _DevvitCustomPost_rpcQueue, "f").add(async () => {
|
|
149
|
+
var _a, _b;
|
|
146
150
|
let call;
|
|
147
151
|
try {
|
|
148
152
|
if (circuitBreak) {
|
|
@@ -173,6 +177,15 @@ _DevvitCustomPost_appState = new WeakMap(), _DevvitCustomPost_lastRequest = new
|
|
|
173
177
|
if (this.renderResponse?.blocks?.ui) {
|
|
174
178
|
__classPrivateFieldSet(this, _DevvitCustomPost_lastRequest, req.blocks, "f");
|
|
175
179
|
this.rootBlock = this.renderResponse.blocks.ui;
|
|
180
|
+
if (!__classPrivateFieldGet(this, _DevvitCustomPost_rootHeight, "f")) {
|
|
181
|
+
// Lock in the initial height
|
|
182
|
+
__classPrivateFieldSet(this, _DevvitCustomPost_rootHeight, this.rootBlock.config?.rootConfig?.height ?? DEFAULT_ROOT_HEIGHT, "f");
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
(_a = this.rootBlock).config ?? (_a.config = {});
|
|
186
|
+
(_b = this.rootBlock.config).rootConfig ?? (_b.rootConfig = BlockConfig_Root.fromPartial({}));
|
|
187
|
+
this.rootBlock.config.rootConfig.height = __classPrivateFieldGet(this, _DevvitCustomPost_rootHeight, "f");
|
|
188
|
+
}
|
|
176
189
|
await this.updateComplete;
|
|
177
190
|
}
|
|
178
191
|
await __classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_handleEffects).call(this, this.renderResponse.effects);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devvit/ui-renderer",
|
|
3
|
-
"version": "0.9.10-next-2023-06-
|
|
3
|
+
"version": "0.9.10-next-2023-06-27-1ce71ae3b.0",
|
|
4
4
|
"license": "BSD-3-Clause",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
},
|
|
48
48
|
"types": "./index.d.ts",
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@devvit/protos": "0.9.10-next-2023-06-
|
|
51
|
-
"@devvit/runtime-lite": "0.9.10-next-2023-06-
|
|
52
|
-
"@devvit/runtimes": "0.9.10-next-2023-06-
|
|
50
|
+
"@devvit/protos": "0.9.10-next-2023-06-27-1ce71ae3b.0",
|
|
51
|
+
"@devvit/runtime-lite": "0.9.10-next-2023-06-27-1ce71ae3b.0",
|
|
52
|
+
"@devvit/runtimes": "0.9.10-next-2023-06-27-1ce71ae3b.0",
|
|
53
53
|
"@lottiefiles/lottie-player": "1.7.1",
|
|
54
54
|
"p-queue": "7.3.4",
|
|
55
55
|
"rxjs": "7.5.7"
|
|
@@ -75,9 +75,9 @@
|
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@devvit/eslint-config": "0.9.9",
|
|
78
|
-
"@devvit/public-api": "0.9.10-next-2023-06-
|
|
78
|
+
"@devvit/public-api": "0.9.10-next-2023-06-27-1ce71ae3b.0",
|
|
79
79
|
"@devvit/repo-tools": "0.9.9",
|
|
80
|
-
"@devvit/tsconfig": "0.9.10-next-2023-06-
|
|
80
|
+
"@devvit/tsconfig": "0.9.10-next-2023-06-27-1ce71ae3b.0",
|
|
81
81
|
"@lit/localize": "0.11.4",
|
|
82
82
|
"@reddit/baseplate": "0.14.0",
|
|
83
83
|
"@reddit/eslint-plugin-i18n-shreddit": "0.1.0",
|
|
@@ -101,5 +101,5 @@
|
|
|
101
101
|
"directory": "dist"
|
|
102
102
|
},
|
|
103
103
|
"source": "./src/index.ts",
|
|
104
|
-
"gitHead": "
|
|
104
|
+
"gitHead": "b66826244a92379cb5270c05a7e1666f2eecb20f"
|
|
105
105
|
}
|