@devvit/ui-renderer 0.9.3 → 0.9.5

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.
Files changed (94) hide show
  1. package/blocks/attributes.d.ts +1 -1
  2. package/blocks/attributes.d.ts.map +1 -1
  3. package/blocks/attributes.js +3 -3
  4. package/blocks/components/devvit-blocks-renderer.d.ts +15 -0
  5. package/blocks/components/devvit-blocks-renderer.d.ts.map +1 -0
  6. package/blocks/components/devvit-blocks-renderer.js +42 -0
  7. package/blocks/components/devvit-blocks-webview.d.ts.map +1 -1
  8. package/blocks/index.d.ts.map +1 -1
  9. package/blocks/templates/index.d.ts +1 -11
  10. package/blocks/templates/index.d.ts.map +1 -1
  11. package/blocks/templates/index.js +1 -38
  12. package/blocks/templates/renderAnimationBlock.d.ts +2 -1
  13. package/blocks/templates/renderAnimationBlock.d.ts.map +1 -1
  14. package/blocks/templates/renderAnimationBlock.js +2 -1
  15. package/blocks/templates/renderAvatarBlock.d.ts +1 -1
  16. package/blocks/templates/renderAvatarBlock.d.ts.map +1 -1
  17. package/blocks/templates/renderAvatarBlock.js +1 -1
  18. package/blocks/templates/renderBlock.d.ts +2 -1
  19. package/blocks/templates/renderBlock.d.ts.map +1 -1
  20. package/blocks/templates/renderBlock.js +22 -3
  21. package/blocks/templates/renderButtonBlock.d.ts +1 -1
  22. package/blocks/templates/renderButtonBlock.d.ts.map +1 -1
  23. package/blocks/templates/renderButtonBlock.js +5 -3
  24. package/blocks/templates/renderContext.d.ts +8 -0
  25. package/blocks/templates/renderContext.d.ts.map +1 -0
  26. package/blocks/templates/renderContext.js +1 -0
  27. package/blocks/templates/renderFullSnooBlock.d.ts +1 -1
  28. package/blocks/templates/renderFullSnooBlock.d.ts.map +1 -1
  29. package/blocks/templates/renderFullSnooBlock.js +1 -1
  30. package/blocks/templates/renderIconBlock.d.ts +1 -1
  31. package/blocks/templates/renderIconBlock.d.ts.map +1 -1
  32. package/blocks/templates/renderIconBlock.js +14 -5
  33. package/blocks/templates/renderImageBlock.d.ts +1 -1
  34. package/blocks/templates/renderImageBlock.d.ts.map +1 -1
  35. package/blocks/templates/renderImageBlock.js +1 -1
  36. package/blocks/templates/renderSpacerBlock.d.ts +1 -1
  37. package/blocks/templates/renderSpacerBlock.d.ts.map +1 -1
  38. package/blocks/templates/renderSpacerBlock.js +1 -1
  39. package/blocks/templates/renderStackBlock.d.ts +2 -2
  40. package/blocks/templates/renderStackBlock.d.ts.map +1 -1
  41. package/blocks/templates/renderStackBlock.js +2 -3
  42. package/blocks/templates/renderTextBlock.d.ts +1 -1
  43. package/blocks/templates/renderTextBlock.d.ts.map +1 -1
  44. package/blocks/templates/renderTextBlock.js +19 -21
  45. package/blocks/templates/renderWebViewBlock.d.ts +1 -1
  46. package/blocks/templates/renderWebViewBlock.d.ts.map +1 -1
  47. package/blocks/templates/renderWebViewBlock.js +1 -1
  48. package/blocks/templates/util.d.ts +7 -0
  49. package/blocks/templates/util.d.ts.map +1 -0
  50. package/blocks/templates/util.js +36 -0
  51. package/client/blocks.d.ts.map +1 -1
  52. package/client/devvit-animation-player.d.ts.map +1 -1
  53. package/client/devvit-custom-post.d.ts +7 -2
  54. package/client/devvit-custom-post.d.ts.map +1 -1
  55. package/client/devvit-custom-post.js +21 -32
  56. package/client/effects/devvit-effect-handler.d.ts.map +1 -1
  57. package/client/effects/form-effect-handler.d.ts.map +1 -1
  58. package/client/effects/toast-effect-handler.d.ts.map +1 -1
  59. package/client/formbuilder/components/devvit-form-selection-dropdown.d.ts +1 -1
  60. package/client/formbuilder/components/devvit-form-selection-dropdown.d.ts.map +1 -1
  61. package/client/formbuilder/components/devvit-form-selection-dropdown.js +13 -3
  62. package/client/formbuilder/components/devvit-form-selection-list.d.ts +1 -1
  63. package/client/formbuilder/components/devvit-form-selection-list.d.ts.map +1 -1
  64. package/client/formbuilder/components/devvit-form-selection-list.js +2 -2
  65. package/client/formbuilder/devvit-form-dialog.d.ts.map +1 -1
  66. package/client/formbuilder/fields/index.d.ts +0 -10
  67. package/client/formbuilder/fields/index.d.ts.map +1 -1
  68. package/client/formbuilder/fields/index.js +0 -9
  69. package/client/formbuilder/fields/renderBooleanField.d.ts.map +1 -1
  70. package/client/formbuilder/fields/renderFieldLabel.d.ts.map +1 -1
  71. package/client/formbuilder/fields/renderFormFields.d.ts.map +1 -1
  72. package/client/formbuilder/fields/renderFormFields.js +7 -2
  73. package/client/formbuilder/fields/renderGroupField.d.ts +2 -1
  74. package/client/formbuilder/fields/renderGroupField.d.ts.map +1 -1
  75. package/client/formbuilder/fields/renderGroupField.js +1 -2
  76. package/client/formbuilder/fields/renderHelpText.d.ts.map +1 -1
  77. package/client/formbuilder/fields/renderListField.d.ts.map +1 -1
  78. package/client/formbuilder/fields/renderNumberField.d.ts.map +1 -1
  79. package/client/formbuilder/fields/renderParagraphField.d.ts.map +1 -1
  80. package/client/formbuilder/fields/renderSelectionField.d.ts.map +1 -1
  81. package/client/formbuilder/fields/renderSelectionField.js +1 -1
  82. package/client/formbuilder/fields/renderStringField.d.ts.map +1 -1
  83. package/client/formbuilder/index.d.ts.map +1 -1
  84. package/custom-styles.css +36 -0
  85. package/index.d.ts.map +1 -1
  86. package/package.json +43 -22
  87. package/server/blocks.d.ts.map +1 -1
  88. package/styles.d.ts.map +1 -1
  89. package/styles.js +1 -1
  90. package/types/events.d.ts.map +1 -1
  91. package/client/assets/snooBlocks.d.ts +0 -2
  92. package/client/assets/snooBlocks.d.ts.map +0 -1
  93. package/client/assets/snooBlocks.js +0 -2
  94. package/styles.css +0 -804
@@ -2,7 +2,7 @@ import { ClassInfo } from 'lit/directives/class-map.js';
2
2
  import { StyleInfo } from 'lit/directives/style-map.js';
3
3
  import { ButtonAppearance, ButtonSize } from '@reddit/faceplate-ui/templates/button.js';
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
- import { RenderContext } from './templates/index.js';
5
+ import { RenderContext } from './templates/renderContext.js';
6
6
  export declare function defaultClasses(type: BlockType): ClassInfo;
7
7
  export declare function stackDirectionClass(direction: BlockStackDirection, reverse: boolean | undefined): ClassInfo;
8
8
  export declare function stackChildClass(parentDirection: BlockStackDirection): ClassInfo;
@@ -1 +1 @@
1
- {"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../src/blocks/attributes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExD,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAExF,OAAO,EACL,KAAK,EAEL,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,WAAW,EAEX,qBAAqB,EACrB,eAAe,EACf,iBAAiB,EACjB,QAAQ,EAER,aAAa,EACb,oBAAoB,EACpB,YAAY,EACZ,WAAW,EACX,SAAS,EACT,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,SAAS,EAEV,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAQrD,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,CAKzD;AAED,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,mBAAmB,EAC9B,OAAO,EAAE,OAAO,GAAG,SAAS,GAC3B,SAAS,CAaX;AAED,wBAAgB,eAAe,CAAC,eAAe,EAAE,mBAAmB,GAAG,SAAS,CAM/E;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,CAKpE;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS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AE,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,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CASxF"}
@@ -125,7 +125,7 @@ export function textSizeClass(size) {
125
125
  return {
126
126
  'text-10': size === BlockTextSize.TEXT_SIZE_XSMALL,
127
127
  'text-12': size === BlockTextSize.TEXT_SIZE_SMALL,
128
- 'text-14': size === undefined || size === BlockTextSize.TEXT_SIZE_MEDIUM,
128
+ 'text-14': size === BlockTextSize.TEXT_SIZE_MEDIUM,
129
129
  'text-16': size === BlockTextSize.TEXT_SIZE_LARGE,
130
130
  'text-18': size === BlockTextSize.TEXT_SIZE_XLARGE,
131
131
  'text-24': size === BlockTextSize.TEXT_SIZE_XXLARGE,
@@ -142,7 +142,7 @@ export function textAlignClass(alignment) {
142
142
  }
143
143
  export function textWeightClass(weight) {
144
144
  return {
145
- 'font-normal': weight === undefined || weight === BlockTextWeight.TEXT_WEIGHT_REGULAR,
145
+ 'font-normal': weight === BlockTextWeight.TEXT_WEIGHT_REGULAR,
146
146
  'font-semibold': weight === BlockTextWeight.TEXT_WEIGHT_BOLD,
147
147
  };
148
148
  }
@@ -162,7 +162,7 @@ export function colorStyle(color) {
162
162
  }
163
163
  export function spacerSizeClass(size, stackDirection) {
164
164
  const xsmall = size === BlockSpacerSize.SPACER_XSMALL;
165
- const small = size === BlockSpacerSize.SPACER_SMALL;
165
+ const small = size === undefined || size === BlockSpacerSize.SPACER_SMALL;
166
166
  const medium = size === BlockSpacerSize.SPACER_MEDIUM;
167
167
  const large = size === BlockSpacerSize.SPACER_LARGE;
168
168
  const vstack = stackDirection === BlockStackDirection.STACK_VERTICAL;
@@ -0,0 +1,15 @@
1
+ import { LitElement } from 'lit';
2
+ import { Block } from '@devvit/protos';
3
+ import type { RenderContext } from '../templates/renderContext.js';
4
+ export declare class DevvitBlocksRenderer extends LitElement {
5
+ block: Block | undefined;
6
+ renderContext: () => RenderContext;
7
+ static get styles(): import("lit").CSSResult[];
8
+ render(): import("@reddit/baseplate/html.js").TemplateLike;
9
+ }
10
+ declare global {
11
+ interface HTMLElementTagNameMap {
12
+ 'devvit-blocks-renderer': DevvitBlocksRenderer;
13
+ }
14
+ }
15
+ //# sourceMappingURL=devvit-blocks-renderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devvit-blocks-renderer.d.ts","sourceRoot":"","sources":["../../../library/src/blocks/components/devvit-blocks-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,UAAU,EAAE,MAAM,KAAK,CAAC;AAMvC,OAAO,EAAE,KAAK,EAAkC,MAAM,gBAAgB,CAAC;AAGvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAInE,qBAEa,oBAAqB,SAAQ,UAAU;IAElD,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;IAGzB,aAAa,EAAE,MAAM,aAAa,CAAgE;IAElG,WAAoB,MAAM,8BAEzB;IAEQ,MAAM;CAahB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,wBAAwB,EAAE,oBAAoB,CAAC;KAChD;CACF"}
@@ -0,0 +1,42 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import { html, LitElement } from 'lit';
3
+ import { customElement, property } from 'lit/decorators.js';
4
+ import { localized, msg } from '@lit/localize';
5
+ import { emptyState } from '@reddit/faceplate-ui/templates/empty-state.js';
6
+ import { BlockStackDirection, BlockType } from '@devvit/protos';
7
+ import { renderBlocks } from '../templates/index.js';
8
+ import { styles } from '../../styles.js';
9
+ let DevvitBlocksRenderer = class DevvitBlocksRenderer extends LitElement {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.renderContext = () => ({ stackDirection: BlockStackDirection.UNRECOGNIZED });
13
+ }
14
+ static get styles() {
15
+ return [styles];
16
+ }
17
+ render() {
18
+ if (this.block && this.block.type === BlockType.BLOCK_ROOT) {
19
+ return renderBlocks(this.block, this.renderContext());
20
+ }
21
+ return html `${emptyState({
22
+ creative: html `<slot name="empty-state-image"></slot>`,
23
+ title: msg('Whoops!', { desc: 'Header for message to display when rendering fails' }),
24
+ description: msg('Something went wrong while attempting to display this content.', {
25
+ desc: 'Message for users to display when rendering fails',
26
+ }),
27
+ })}`;
28
+ }
29
+ };
30
+ __decorate([
31
+ property({ attribute: false }),
32
+ __metadata("design:type", Object)
33
+ ], DevvitBlocksRenderer.prototype, "block", void 0);
34
+ __decorate([
35
+ property({ attribute: false }),
36
+ __metadata("design:type", Function)
37
+ ], DevvitBlocksRenderer.prototype, "renderContext", void 0);
38
+ DevvitBlocksRenderer = __decorate([
39
+ localized(),
40
+ customElement('devvit-blocks-renderer')
41
+ ], DevvitBlocksRenderer);
42
+ export { DevvitBlocksRenderer };
@@ -1 +1 @@
1
- {"version":3,"file":"devvit-blocks-webview.d.ts","sourceRoot":"","sources":["../../../src/blocks/components/devvit-blocks-webview.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"devvit-blocks-webview.d.ts","sourceRoot":"","sources":["../../../library/src/blocks/components/devvit-blocks-webview.ts"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/blocks/index.ts"],"names":[],"mappings":";AAEA,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../library/src/blocks/index.ts"],"names":[],"mappings":";AAEA,cAAc,sBAAsB,CAAC"}
@@ -1,12 +1,2 @@
1
- import { ClassInfo, classMap as clientClassMap } from 'lit/directives/class-map.js';
2
- import { TemplateLike, UnsafeString } from '@reddit/baseplate/html.js';
3
- import { Block, BlockAction, BlockRenderRequest, BlockStackDirection } from '@devvit/protos';
4
- export interface RenderContext {
5
- request?: BlockRenderRequest | undefined;
6
- state?: unknown | undefined;
7
- stackDirection: BlockStackDirection;
8
- onAction?: ((action: BlockAction) => void) | undefined;
9
- }
10
- export declare function renderBlocks(block: Block, context?: Partial<RenderContext>): TemplateLike;
11
- export declare function classMap(classInfo: ClassInfo, forceString?: boolean): UnsafeString | ReturnType<typeof clientClassMap>;
1
+ export { renderBlocks } from './renderBlock.js';
12
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/blocks/templates/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,IAAI,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAEpF,OAAO,EAAW,YAAY,EAAU,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAExF,OAAO,EACL,KAAK,EACL,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EAEpB,MAAM,gBAAgB,CAAC;AAKxB,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,kBAAkB,GAAG,SAAS,CAAC;IACzC,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B,cAAc,EAAE,mBAAmB,CAAC;IACpC,QAAQ,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CACxD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,GAAE,OAAO,CAAC,aAAa,CAAM,GAAG,YAAY,CAsB7F;AAED,wBAAgB,QAAQ,CACtB,SAAS,EAAE,SAAS,EACpB,WAAW,CAAC,EAAE,OAAO,GACpB,YAAY,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAgBlD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../library/src/blocks/templates/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1,38 +1 @@
1
- import { classMap as clientClassMap } from 'lit/directives/class-map.js';
2
- import { nothing, unsafe } from '@reddit/baseplate/html.js';
3
- import { BlockStackDirection, BlockType, } from '@devvit/protos';
4
- import { renderBlock } from './renderBlock.js';
5
- import { getTemplateRenderingStrategy } from '@reddit/faceplate-ui/faceplateUIConfig.js';
6
- export function renderBlocks(block, context = {}) {
7
- if (block.type !== BlockType.BLOCK_ROOT) {
8
- console.error('Invalid root block');
9
- return nothing;
10
- }
11
- return renderBlock({
12
- type: BlockType.BLOCK_STACK,
13
- config: {
14
- stackConfig: {
15
- direction: BlockStackDirection.STACK_VERTICAL,
16
- children: block.config?.rootConfig?.children ?? [],
17
- },
18
- },
19
- actions: [],
20
- }, {
21
- ...context,
22
- stackDirection: BlockStackDirection.UNRECOGNIZED,
23
- });
24
- }
25
- export function classMap(classInfo, forceString) {
26
- const { getType } = getTemplateRenderingStrategy();
27
- if (getType() === 'client' && forceString !== true) {
28
- return clientClassMap(classInfo);
29
- }
30
- let result = '';
31
- for (const name in classInfo) {
32
- if (classInfo[name]) {
33
- result += `${name} `;
34
- }
35
- }
36
- // eslint-disable-next-line @reddit/no-unsafe/no-unsafe-function-usage
37
- return unsafe(result);
38
- }
1
+ export { renderBlocks } from './renderBlock.js';
@@ -1,5 +1,6 @@
1
1
  import { Block } from '@devvit/protos';
2
2
  import { TemplateLike } from '@reddit/baseplate/html.js';
3
- import { RenderContext } from './index.js';
3
+ import '../../client/devvit-animation-player.js';
4
+ import { RenderContext } from './renderContext.js';
4
5
  export declare function renderAnimationBlock(block: Block, ctx: RenderContext): TemplateLike;
5
6
  //# sourceMappingURL=renderAnimationBlock.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderAnimationBlock.d.ts","sourceRoot":"","sources":["../../../src/blocks/templates/renderAnimationBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC,OAAO,EAAW,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAUlE,OAAO,EAAY,aAAa,EAAE,MAAM,YAAY,CAAC;AAErD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,GAAG,YAAY,CA6BnF"}
1
+ {"version":3,"file":"renderAnimationBlock.d.ts","sourceRoot":"","sources":["../../../library/src/blocks/templates/renderAnimationBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC,OAAO,EAAW,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGlE,OAAO,yCAAyC,CAAC;AASjD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,GAAG,YAAY,CA6BnF"}
@@ -1,7 +1,8 @@
1
1
  import { nothing } from '@reddit/baseplate/html.js';
2
2
  import { getTemplateRenderingStrategy } from '@reddit/faceplate-ui/faceplateUIConfig.js';
3
+ import '../../client/devvit-animation-player.js';
3
4
  import { defaultClasses, onClickAction, sizingClass, sizingStyle, stackChildClass, } from '../attributes.js';
4
- import { classMap } from './index.js';
5
+ import { classMap } from './util.js';
5
6
  export function renderAnimationBlock(block, ctx) {
6
7
  const { html, styleMap, ifDefined } = getTemplateRenderingStrategy();
7
8
  if (!block.config?.animationConfig) {
@@ -1,5 +1,5 @@
1
1
  import { Block } from '@devvit/protos';
2
2
  import { TemplateLike } from '@reddit/baseplate/html.js';
3
- import { RenderContext } from './index.js';
3
+ import { RenderContext } from './renderContext.js';
4
4
  export declare function renderAvatarBlock(block: Block, ctx: RenderContext): TemplateLike;
5
5
  //# sourceMappingURL=renderAvatarBlock.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderAvatarBlock.d.ts","sourceRoot":"","sources":["../../../src/blocks/templates/renderAvatarBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC,OAAO,EAAW,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAYlE,OAAO,EAAY,aAAa,EAAE,MAAM,YAAY,CAAC;AAErD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,GAAG,YAAY,CA6BhF"}
1
+ {"version":3,"file":"renderAvatarBlock.d.ts","sourceRoot":"","sources":["../../../library/src/blocks/templates/renderAvatarBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC,OAAO,EAAW,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAYlE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,GAAG,YAAY,CA6BhF"}
@@ -1,7 +1,7 @@
1
1
  import { nothing } from '@reddit/baseplate/html.js';
2
2
  import { getTemplateRenderingStrategy } from '@reddit/faceplate-ui/faceplateUIConfig.js';
3
3
  import { avatarSizeClass, defaultClasses, facingClass, onClickAction, sizingClass, sizingStyle, stackChildClass, } from '../attributes.js';
4
- import { classMap } from './index.js';
4
+ import { classMap } from './util.js';
5
5
  export function renderAvatarBlock(block, ctx) {
6
6
  const { html, styleMap, ifDefined } = getTemplateRenderingStrategy();
7
7
  if (!block.config?.avatarConfig) {
@@ -1,5 +1,6 @@
1
1
  import { TemplateLike } from '@reddit/baseplate/html.js';
2
2
  import { Block } from '@devvit/protos';
3
- import { RenderContext } from './index.js';
3
+ import { RenderContext } from './renderContext.js';
4
+ export declare function renderBlocks(block: Block, context?: Partial<RenderContext>): TemplateLike;
4
5
  export declare function renderBlock(block: Block, ctx: RenderContext): TemplateLike;
5
6
  //# sourceMappingURL=renderBlock.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderBlock.d.ts","sourceRoot":"","sources":["../../../src/blocks/templates/renderBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,EAAE,KAAK,EAAa,MAAM,gBAAgB,CAAC;AAYlD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAG3C,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,GAAG,YAAY,CA+C1E"}
1
+ {"version":3,"file":"renderBlock.d.ts","sourceRoot":"","sources":["../../../library/src/blocks/templates/renderBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGlE,OAAO,EAAE,KAAK,EAAkC,MAAM,gBAAgB,CAAC;AAYvE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,GAAE,OAAO,CAAC,aAAa,CAAM,GAAG,YAAY,CAsB7F;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,GAAG,YAAY,CA+C1E"}
@@ -1,5 +1,6 @@
1
1
  import { nothing } from '@reddit/baseplate/html.js';
2
- import { BlockType } from '@devvit/protos';
2
+ import { getTemplateRenderingStrategy } from '@reddit/faceplate-ui/faceplateUIConfig.js';
3
+ import { BlockStackDirection, BlockType } from '@devvit/protos';
3
4
  import { renderStackBlock } from './renderStackBlock.js';
4
5
  import { renderSpacerBlock } from './renderSpacerBlock.js';
5
6
  import { renderTextBlock } from './renderTextBlock.js';
@@ -10,13 +11,31 @@ import { renderWebViewBlock } from './renderWebViewBlock.js';
10
11
  import { renderAnimationBlock } from './renderAnimationBlock.js';
11
12
  import { renderAvatarBlock } from './renderAvatarBlock.js';
12
13
  import { renderFullSnooBlock } from './renderFullSnooBlock.js';
13
- import { getTemplateRenderingStrategy } from '@reddit/faceplate-ui/faceplateUIConfig.js';
14
+ export function renderBlocks(block, context = {}) {
15
+ if (block.type !== BlockType.BLOCK_ROOT) {
16
+ console.error('Invalid root block');
17
+ return nothing;
18
+ }
19
+ return renderBlock({
20
+ type: BlockType.BLOCK_STACK,
21
+ config: {
22
+ stackConfig: {
23
+ direction: BlockStackDirection.STACK_VERTICAL,
24
+ children: block.config?.rootConfig?.children ?? [],
25
+ },
26
+ },
27
+ actions: [],
28
+ }, {
29
+ ...context,
30
+ stackDirection: BlockStackDirection.UNRECOGNIZED,
31
+ });
32
+ }
14
33
  export function renderBlock(block, ctx) {
15
34
  const { html } = getTemplateRenderingStrategy();
16
35
  let render;
17
36
  switch (block.type) {
18
37
  case BlockType.BLOCK_STACK:
19
- render = renderStackBlock(block, ctx);
38
+ render = renderStackBlock(block, ctx, renderBlock);
20
39
  break;
21
40
  case BlockType.BLOCK_SPACER:
22
41
  render = renderSpacerBlock(block, ctx);
@@ -1,5 +1,5 @@
1
1
  import { TemplateLike } from '@reddit/baseplate/html.js';
2
2
  import { Block } from '@devvit/protos';
3
- import { RenderContext } from './index.js';
3
+ import { RenderContext } from './renderContext.js';
4
4
  export declare function renderButtonBlock(block: Block, ctx: RenderContext): TemplateLike;
5
5
  //# sourceMappingURL=renderButtonBlock.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderButtonBlock.d.ts","sourceRoot":"","sources":["../../../src/blocks/templates/renderButtonBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAgB,MAAM,2BAA2B,CAAC;AAKvE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAYvC,OAAO,EAAY,aAAa,EAAE,MAAM,YAAY,CAAC;AAErD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,GAAG,YAAY,CAkChF"}
1
+ {"version":3,"file":"renderButtonBlock.d.ts","sourceRoot":"","sources":["../../../library/src/blocks/templates/renderButtonBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAgB,MAAM,2BAA2B,CAAC;AAKvE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAWvC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,GAAG,YAAY,CAqChF"}
@@ -2,10 +2,10 @@ import { getTemplateRenderingStrategy } from '@reddit/faceplate-ui/faceplateUICo
2
2
  import { button } from '@reddit/faceplate-ui/templates/button.js';
3
3
  import { styleMap } from '@reddit/faceplate-ui/templateUtils/styleMap.js';
4
4
  import { buttonAppearance, buttonSize, colorStyle, defaultClasses, onClickAction, sizingClass, stackChildClass, } from '../attributes.js';
5
- import { classMap } from './index.js';
5
+ import { classMap, resolveIcon } from './util.js';
6
6
  export function renderButtonBlock(block, ctx) {
7
7
  const { html, ifDefined } = getTemplateRenderingStrategy();
8
- // let buttonIcon = block.config?.buttonConfig?.icon;
8
+ const buttonIcon = block.config?.buttonConfig?.icon;
9
9
  const disabled = block.config?.buttonConfig?.disabled === true;
10
10
  const classes = {
11
11
  ...defaultClasses(block.type),
@@ -18,10 +18,12 @@ export function renderButtonBlock(block, ctx) {
18
18
  // ...backgroundStyle(block.config?.buttonConfig?.backgroundColor),
19
19
  };
20
20
  const onClick = onClickAction(block, ctx);
21
+ const iconSvg = buttonIcon ? resolveIcon(buttonIcon) : undefined;
22
+ const icon = iconSvg ? { leadingIcon: iconSvg } : {};
21
23
  return html `${button({
22
24
  size: buttonSize(block.config?.buttonConfig?.buttonSize),
23
25
  appearance: buttonAppearance(block.config?.buttonConfig?.buttonAppearance),
24
- // leadingIcon: findIcon(buttonIcon),
26
+ ...icon,
25
27
  children: ifDefined(block.config?.buttonConfig?.text),
26
28
  attributes: {
27
29
  disabled,
@@ -0,0 +1,8 @@
1
+ import { BlockAction, BlockRenderRequest, BlockStackDirection } from '@devvit/protos';
2
+ export interface RenderContext {
3
+ request?: BlockRenderRequest | undefined;
4
+ state?: unknown | undefined;
5
+ stackDirection: BlockStackDirection;
6
+ onAction?: ((action: BlockAction) => void) | undefined;
7
+ }
8
+ //# sourceMappingURL=renderContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderContext.d.ts","sourceRoot":"","sources":["../../../library/src/blocks/templates/renderContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAEtF,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,kBAAkB,GAAG,SAAS,CAAC;IACzC,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B,cAAc,EAAE,mBAAmB,CAAC;IACpC,QAAQ,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CACxD"}
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { TemplateLike } from '@reddit/baseplate/html.js';
2
2
  import { Block } from '@devvit/protos';
3
- import { RenderContext } from './index.js';
3
+ import { RenderContext } from './renderContext.js';
4
4
  export declare function renderFullSnooBlock(block: Block, ctx: RenderContext): TemplateLike;
5
5
  //# sourceMappingURL=renderFullSnooBlock.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderFullSnooBlock.d.ts","sourceRoot":"","sources":["../../../src/blocks/templates/renderFullSnooBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGlE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAWvC,OAAO,EAAY,aAAa,EAAE,MAAM,YAAY,CAAC;AAErD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,GAAG,YAAY,CA6BlF"}
1
+ {"version":3,"file":"renderFullSnooBlock.d.ts","sourceRoot":"","sources":["../../../library/src/blocks/templates/renderFullSnooBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGlE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAWvC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,GAAG,YAAY,CA6BlF"}
@@ -1,7 +1,7 @@
1
1
  import { nothing } from '@reddit/baseplate/html.js';
2
2
  import { getTemplateRenderingStrategy } from '@reddit/faceplate-ui/faceplateUIConfig.js';
3
3
  import { defaultClasses, facingClass, fullSnooSizeClass, onClickAction, sizingClass, sizingStyle, stackChildClass, } from '../attributes.js';
4
- import { classMap } from './index.js';
4
+ import { classMap } from './util.js';
5
5
  export function renderFullSnooBlock(block, ctx) {
6
6
  const { html, styleMap, ifDefined } = getTemplateRenderingStrategy();
7
7
  if (!block.config?.fullsnooConfig) {
@@ -1,5 +1,5 @@
1
1
  import { TemplateLike } from '@reddit/baseplate/html.js';
2
2
  import { Block } from '@devvit/protos';
3
- import { RenderContext } from './index.js';
3
+ import { RenderContext } from './renderContext.js';
4
4
  export declare function renderIconBlock(block: Block, ctx: RenderContext): TemplateLike;
5
5
  //# sourceMappingURL=renderIconBlock.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderIconBlock.d.ts","sourceRoot":"","sources":["../../../src/blocks/templates/renderIconBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGlE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AASvC,OAAO,EAAY,aAAa,EAAE,MAAM,YAAY,CAAC;AAErD,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,GAAG,YAAY,CAsB9E"}
1
+ {"version":3,"file":"renderIconBlock.d.ts","sourceRoot":"","sources":["../../../library/src/blocks/templates/renderIconBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGlE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAUvC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,GAAG,YAAY,CA+B9E"}
@@ -1,15 +1,17 @@
1
1
  import { nothing } from '@reddit/baseplate/html.js';
2
2
  import { getTemplateRenderingStrategy } from '@reddit/faceplate-ui/faceplateUIConfig.js';
3
- import { defaultClasses, iconSizeClass, onClickAction, sizingClass, stackChildClass, } from '../attributes.js';
4
- import { classMap } from './index.js';
3
+ import { colorStyle, defaultClasses, iconSizeClass, onClickAction, sizingClass, stackChildClass, } from '../attributes.js';
4
+ import { classMap, resolveIcon } from './util.js';
5
5
  export function renderIconBlock(block, ctx) {
6
- const { html } = getTemplateRenderingStrategy();
6
+ const { html, styleMap, ifDefined } = getTemplateRenderingStrategy();
7
7
  if (!block.config?.iconConfig) {
8
8
  console.error('Invalid block: Icon missing IconConfig');
9
9
  return nothing;
10
10
  }
11
11
  const { icon, size, color } = block.config.iconConfig;
12
- // adopt `icons-all.ts` from faceplate-ui storybook
12
+ const styles = {
13
+ ...colorStyle(color),
14
+ };
13
15
  const classes = {
14
16
  ...defaultClasses(block.type),
15
17
  ...stackChildClass(ctx.stackDirection),
@@ -17,5 +19,12 @@ export function renderIconBlock(block, ctx) {
17
19
  ...iconSizeClass(size),
18
20
  };
19
21
  const onClick = onClickAction(block, ctx);
20
- return html `<div class="${classMap(classes)}" data-debug-block-type="icon"></div>`;
22
+ return html `<div
23
+ class="${classMap(classes)}"
24
+ style="${styleMap(styles)}"
25
+ @click="${ifDefined(onClick)}"
26
+ data-debug-block-type="icon"
27
+ >
28
+ ${resolveIcon(icon)}
29
+ </div>`;
21
30
  }
@@ -1,5 +1,5 @@
1
1
  import { TemplateLike } from '@reddit/baseplate/html.js';
2
2
  import { Block } from '@devvit/protos';
3
- import { RenderContext } from './index.js';
3
+ import { RenderContext } from './renderContext.js';
4
4
  export declare function renderImageBlock(block: Block, ctx: RenderContext): TemplateLike;
5
5
  //# sourceMappingURL=renderImageBlock.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderImageBlock.d.ts","sourceRoot":"","sources":["../../../src/blocks/templates/renderImageBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGlE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAUvC,OAAO,EAAY,aAAa,EAAE,MAAM,YAAY,CAAC;AAErD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,GAAG,YAAY,CAkC/E"}
1
+ {"version":3,"file":"renderImageBlock.d.ts","sourceRoot":"","sources":["../../../library/src/blocks/templates/renderImageBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGlE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAUvC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,GAAG,YAAY,CAkC/E"}
@@ -1,7 +1,7 @@
1
1
  import { nothing } from '@reddit/baseplate/html.js';
2
2
  import { getTemplateRenderingStrategy } from '@reddit/faceplate-ui/faceplateUIConfig.js';
3
3
  import { defaultClasses, onClickAction, resizeModeClass, sizingClass, sizingStyle, stackChildClass, } from '../attributes.js';
4
- import { classMap } from './index.js';
4
+ import { classMap } from './util.js';
5
5
  export function renderImageBlock(block, ctx) {
6
6
  const { html, styleMap, ifDefined } = getTemplateRenderingStrategy();
7
7
  if (!block.config?.imageConfig) {
@@ -1,5 +1,5 @@
1
1
  import { TemplateLike } from '@reddit/baseplate/html.js';
2
2
  import { Block } from '@devvit/protos';
3
- import { RenderContext } from './index.js';
3
+ import { RenderContext } from './renderContext.js';
4
4
  export declare function renderSpacerBlock(block: Block, ctx: RenderContext): TemplateLike;
5
5
  //# sourceMappingURL=renderSpacerBlock.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderSpacerBlock.d.ts","sourceRoot":"","sources":["../../../src/blocks/templates/renderSpacerBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AASvC,OAAO,EAAY,aAAa,EAAE,MAAM,YAAY,CAAC;AAErD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,GAAG,YAAY,CAmBhF"}
1
+ {"version":3,"file":"renderSpacerBlock.d.ts","sourceRoot":"","sources":["../../../library/src/blocks/templates/renderSpacerBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AASvC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,GAAG,YAAY,CAmBhF"}
@@ -1,6 +1,6 @@
1
1
  import { getTemplateRenderingStrategy } from '@reddit/faceplate-ui/faceplateUIConfig.js';
2
2
  import { defaultClasses, sizingClass, sizingStyle, spacerSizeClass, stackChildClass, } from '../attributes.js';
3
- import { classMap } from './index.js';
3
+ import { classMap } from './util.js';
4
4
  export function renderSpacerBlock(block, ctx) {
5
5
  const { html, styleMap } = getTemplateRenderingStrategy();
6
6
  const classes = {
@@ -1,5 +1,5 @@
1
1
  import { TemplateLike } from '@reddit/baseplate/html.js';
2
2
  import { Block } from '@devvit/protos';
3
- import { RenderContext } from './index.js';
4
- export declare function renderStackBlock(block: Block, ctx?: RenderContext): TemplateLike;
3
+ import { RenderContext } from './renderContext.js';
4
+ export declare function renderStackBlock(block: Block, ctx: RenderContext | undefined, renderBlock: (block: Block, ctx: RenderContext) => TemplateLike): TemplateLike;
5
5
  //# sourceMappingURL=renderStackBlock.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderStackBlock.d.ts","sourceRoot":"","sources":["../../../src/blocks/templates/renderStackBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGlE,OAAO,EAAE,KAAK,EAAuB,MAAM,gBAAgB,CAAC;AAkB5D,OAAO,EAAY,aAAa,EAAE,MAAM,YAAY,CAAC;AAErD,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,KAAK,EACZ,GAAG,GAAE,aAAoE,GACxE,YAAY,CAoEd"}
1
+ {"version":3,"file":"renderStackBlock.d.ts","sourceRoot":"","sources":["../../../library/src/blocks/templates/renderStackBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGlE,OAAO,EAAE,KAAK,EAAuB,MAAM,gBAAgB,CAAC;AAiB5D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,KAAK,EACZ,GAAG,2BAAsE,EACzE,WAAW,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,KAAK,YAAY,GAC9D,YAAY,CAoEd"}
@@ -2,9 +2,8 @@ import { nothing } from '@reddit/baseplate/html.js';
2
2
  import { getTemplateRenderingStrategy } from '@reddit/faceplate-ui/faceplateUIConfig.js';
3
3
  import { BlockStackDirection } from '@devvit/protos';
4
4
  import { alignmentClass, backgroundStyle, borderClass, borderStyle, defaultClasses, gapClass, onClickAction, paddingClass, radiusClass, sizingClass, sizingStyle, stackChildClass, stackDirectionClass, } from '../attributes.js';
5
- import { renderBlock } from './renderBlock.js';
6
- import { classMap } from './index.js';
7
- export function renderStackBlock(block, ctx = { stackDirection: BlockStackDirection.UNRECOGNIZED }) {
5
+ import { classMap } from './util.js';
6
+ export function renderStackBlock(block, ctx = { stackDirection: BlockStackDirection.UNRECOGNIZED }, renderBlock) {
8
7
  const { html, repeat, styleMap, ifDefined } = getTemplateRenderingStrategy();
9
8
  if (block.config?.stackConfig === undefined) {
10
9
  console.error('Invalid block: Stack missing StackConfig');
@@ -1,5 +1,5 @@
1
1
  import { TemplateLike } from '@reddit/baseplate/html.js';
2
2
  import { Block } from '@devvit/protos';
3
- import { RenderContext } from './index.js';
3
+ import { RenderContext } from './renderContext.js';
4
4
  export declare function renderTextBlock(block: Block, ctx: RenderContext): TemplateLike;
5
5
  //# sourceMappingURL=renderTextBlock.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderTextBlock.d.ts","sourceRoot":"","sources":["../../../src/blocks/templates/renderTextBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGlE,OAAO,EAAE,KAAK,EAAkD,MAAM,gBAAgB,CAAC;AAavF,OAAO,EAAY,aAAa,EAAE,MAAM,YAAY,CAAC;AAErD,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,GAAG,YAAY,CA+D9E"}
1
+ {"version":3,"file":"renderTextBlock.d.ts","sourceRoot":"","sources":["../../../library/src/blocks/templates/renderTextBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGlE,OAAO,EAAE,KAAK,EAAkD,MAAM,gBAAgB,CAAC;AAavF,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,GAAG,YAAY,CA8D9E"}
@@ -2,7 +2,7 @@ import { nothing } from '@reddit/baseplate/html.js';
2
2
  import { getTemplateRenderingStrategy } from '@reddit/faceplate-ui/faceplateUIConfig.js';
3
3
  import { BlockTextSize, BlockTextStyle, BlockTextWeight } from '@devvit/protos';
4
4
  import { colorStyle, defaultClasses, onClickAction, sizingClass, stackChildClass, textAlignClass, textOutlineClass, textSizeClass, textWeightClass, } from '../attributes.js';
5
- import { classMap } from './index.js';
5
+ import { classMap } from './util.js';
6
6
  export function renderTextBlock(block, ctx) {
7
7
  const { html, styleMap, ifDefined } = getTemplateRenderingStrategy();
8
8
  if (!block.config?.textConfig) {
@@ -10,43 +10,41 @@ export function renderTextBlock(block, ctx) {
10
10
  return nothing;
11
11
  }
12
12
  const { text, color, size, alignment, weight, style, outline } = block.config.textConfig;
13
- let textColor = 'neutral-content';
14
- let baseStyle = {};
13
+ let textColor;
14
+ let textSize;
15
+ let textWeight;
15
16
  switch (style) {
16
17
  case BlockTextStyle.TEXT_STYLE_METADATA:
17
18
  textColor = 'neutral-content-weak';
18
- baseStyle = {
19
- ...textSizeClass(BlockTextSize.TEXT_SIZE_SMALL),
20
- ...textWeightClass(BlockTextWeight.TEXT_WEIGHT_REGULAR),
21
- };
22
- break;
23
- case BlockTextStyle.TEXT_STYLE_BODY:
24
- textColor = 'neutral-content';
25
- baseStyle = {
26
- ...textSizeClass(BlockTextSize.TEXT_SIZE_MEDIUM),
27
- ...textWeightClass(BlockTextWeight.TEXT_WEIGHT_REGULAR),
28
- };
19
+ textSize = BlockTextSize.TEXT_SIZE_SMALL;
20
+ textWeight = BlockTextWeight.TEXT_WEIGHT_REGULAR;
29
21
  break;
30
22
  case BlockTextStyle.TEXT_STYLE_HEADING:
31
23
  textColor = 'neutral-content-strong';
32
- baseStyle = {
33
- ...textSizeClass(BlockTextSize.TEXT_SIZE_LARGE),
34
- ...textWeightClass(BlockTextWeight.TEXT_WEIGHT_BOLD),
35
- };
24
+ textSize = BlockTextSize.TEXT_SIZE_LARGE;
25
+ textWeight = BlockTextWeight.TEXT_WEIGHT_BOLD;
26
+ break;
27
+ case BlockTextStyle.TEXT_STYLE_BODY:
28
+ case undefined:
29
+ default:
30
+ textColor = 'neutral-content';
31
+ textSize = BlockTextSize.TEXT_SIZE_MEDIUM;
32
+ textWeight = BlockTextWeight.TEXT_WEIGHT_REGULAR;
36
33
  break;
37
34
  }
38
35
  textColor = color ?? textColor;
36
+ textSize = size ?? textSize;
37
+ textWeight = weight ?? textWeight;
39
38
  const styles = {
40
39
  ...colorStyle(textColor),
41
40
  };
42
41
  const classes = {
43
42
  ...defaultClasses(block.type),
44
- ...baseStyle,
45
43
  ...stackChildClass(ctx.stackDirection),
46
44
  ...sizingClass(block.size),
47
- ...textSizeClass(size),
45
+ ...textSizeClass(textSize),
48
46
  ...textAlignClass(alignment),
49
- ...textWeightClass(weight),
47
+ ...textWeightClass(textWeight),
50
48
  };
51
49
  if (outline !== undefined) {
52
50
  Object.assign(classes, textOutlineClass(outline, textColor));
@@ -1,6 +1,6 @@
1
1
  import { TemplateLike } from '@reddit/baseplate/html.js';
2
2
  import { Block } from '@devvit/protos';
3
- import { RenderContext } from './index.js';
3
+ import { RenderContext } from './renderContext.js';
4
4
  import '../components/devvit-blocks-webview.js';
5
5
  export declare function renderWebViewBlock(block: Block, ctx: RenderContext): TemplateLike;
6
6
  //# sourceMappingURL=renderWebViewBlock.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderWebViewBlock.d.ts","sourceRoot":"","sources":["../../../src/blocks/templates/renderWebViewBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGlE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGvC,OAAO,EAAY,aAAa,EAAE,MAAM,YAAY,CAAC;AAErD,OAAO,wCAAwC,CAAC;AAEhD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,GAAG,YAAY,CA2BjF"}
1
+ {"version":3,"file":"renderWebViewBlock.d.ts","sourceRoot":"","sources":["../../../library/src/blocks/templates/renderWebViewBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGlE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGvC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,OAAO,wCAAwC,CAAC;AAEhD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,GAAG,YAAY,CA2BjF"}