@devvit/ui-renderer 0.9.3 → 0.9.4

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 (67) 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/templates/index.d.ts +1 -11
  5. package/blocks/templates/index.d.ts.map +1 -1
  6. package/blocks/templates/index.js +1 -38
  7. package/blocks/templates/renderAnimationBlock.d.ts +1 -1
  8. package/blocks/templates/renderAnimationBlock.d.ts.map +1 -1
  9. package/blocks/templates/renderAnimationBlock.js +1 -1
  10. package/blocks/templates/renderAvatarBlock.d.ts +1 -1
  11. package/blocks/templates/renderAvatarBlock.d.ts.map +1 -1
  12. package/blocks/templates/renderAvatarBlock.js +1 -1
  13. package/blocks/templates/renderBlock.d.ts +2 -1
  14. package/blocks/templates/renderBlock.d.ts.map +1 -1
  15. package/blocks/templates/renderBlock.js +22 -3
  16. package/blocks/templates/renderButtonBlock.d.ts +1 -1
  17. package/blocks/templates/renderButtonBlock.d.ts.map +1 -1
  18. package/blocks/templates/renderButtonBlock.js +1 -1
  19. package/blocks/templates/renderContext.d.ts +8 -0
  20. package/blocks/templates/renderContext.d.ts.map +1 -0
  21. package/blocks/templates/renderContext.js +1 -0
  22. package/blocks/templates/renderFullSnooBlock.d.ts +1 -1
  23. package/blocks/templates/renderFullSnooBlock.d.ts.map +1 -1
  24. package/blocks/templates/renderFullSnooBlock.js +1 -1
  25. package/blocks/templates/renderIconBlock.d.ts +1 -1
  26. package/blocks/templates/renderIconBlock.d.ts.map +1 -1
  27. package/blocks/templates/renderIconBlock.js +1 -1
  28. package/blocks/templates/renderImageBlock.d.ts +1 -1
  29. package/blocks/templates/renderImageBlock.d.ts.map +1 -1
  30. package/blocks/templates/renderImageBlock.js +1 -1
  31. package/blocks/templates/renderSpacerBlock.d.ts +1 -1
  32. package/blocks/templates/renderSpacerBlock.d.ts.map +1 -1
  33. package/blocks/templates/renderSpacerBlock.js +1 -1
  34. package/blocks/templates/renderStackBlock.d.ts +2 -2
  35. package/blocks/templates/renderStackBlock.d.ts.map +1 -1
  36. package/blocks/templates/renderStackBlock.js +2 -3
  37. package/blocks/templates/renderTextBlock.d.ts +1 -1
  38. package/blocks/templates/renderTextBlock.d.ts.map +1 -1
  39. package/blocks/templates/renderTextBlock.js +19 -21
  40. package/blocks/templates/renderWebViewBlock.d.ts +1 -1
  41. package/blocks/templates/renderWebViewBlock.d.ts.map +1 -1
  42. package/blocks/templates/renderWebViewBlock.js +1 -1
  43. package/blocks/templates/util.d.ts +4 -0
  44. package/blocks/templates/util.d.ts.map +1 -0
  45. package/blocks/templates/util.js +17 -0
  46. package/client/devvit-custom-post.js +3 -3
  47. package/client/formbuilder/components/devvit-form-selection-dropdown.d.ts +1 -1
  48. package/client/formbuilder/components/devvit-form-selection-dropdown.d.ts.map +1 -1
  49. package/client/formbuilder/components/devvit-form-selection-dropdown.js +2 -2
  50. package/client/formbuilder/components/devvit-form-selection-list.d.ts +1 -1
  51. package/client/formbuilder/components/devvit-form-selection-list.d.ts.map +1 -1
  52. package/client/formbuilder/components/devvit-form-selection-list.js +2 -2
  53. package/client/formbuilder/devvit-form-dialog.d.ts.map +1 -1
  54. package/client/formbuilder/fields/index.d.ts +0 -10
  55. package/client/formbuilder/fields/index.d.ts.map +1 -1
  56. package/client/formbuilder/fields/index.js +0 -9
  57. package/client/formbuilder/fields/renderFormFields.d.ts.map +1 -1
  58. package/client/formbuilder/fields/renderFormFields.js +7 -2
  59. package/client/formbuilder/fields/renderGroupField.d.ts +2 -1
  60. package/client/formbuilder/fields/renderGroupField.d.ts.map +1 -1
  61. package/client/formbuilder/fields/renderGroupField.js +1 -2
  62. package/client/formbuilder/fields/renderNumberField.d.ts.map +1 -1
  63. package/client/formbuilder/fields/renderParagraphField.d.ts.map +1 -1
  64. package/client/formbuilder/fields/renderSelectionField.d.ts.map +1 -1
  65. package/client/formbuilder/fields/renderSelectionField.js +1 -1
  66. package/client/formbuilder/fields/renderStringField.d.ts.map +1 -1
  67. package/package.json +11 -9
@@ -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":"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"}
1
+ {"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../src/blocks/attributes.ts"],"names":[],"mappings":"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"}
@@ -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;
@@ -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":["../../../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,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 renderAnimationBlock(block: Block, ctx: RenderContext): TemplateLike;
5
5
  //# 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":["../../../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,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,GAAG,YAAY,CA6BnF"}
@@ -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, sizingClass, sizingStyle, stackChildClass, } from '../attributes.js';
4
- import { classMap } from './index.js';
4
+ import { classMap } from './util.js';
5
5
  export function renderAnimationBlock(block, ctx) {
6
6
  const { html, styleMap, ifDefined } = getTemplateRenderingStrategy();
7
7
  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":["../../../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":["../../../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":["../../../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,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,GAAG,YAAY,CAkChF"}
@@ -2,7 +2,7 @@ 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 } from './util.js';
6
6
  export function renderButtonBlock(block, ctx) {
7
7
  const { html, ifDefined } = getTemplateRenderingStrategy();
8
8
  // let buttonIcon = block.config?.buttonConfig?.icon;
@@ -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":["../../../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":["../../../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":["../../../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,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,GAAG,YAAY,CAsB9E"}
@@ -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, iconSizeClass, onClickAction, sizingClass, stackChildClass, } from '../attributes.js';
4
- import { classMap } from './index.js';
4
+ import { classMap } from './util.js';
5
5
  export function renderIconBlock(block, ctx) {
6
6
  const { html } = getTemplateRenderingStrategy();
7
7
  if (!block.config?.iconConfig) {
@@ -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":["../../../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":["../../../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":["../../../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":["../../../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":["../../../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"}
@@ -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, sizingClass, sizingStyle, stackChildClass } from '../attributes.js';
4
- import { classMap } from './index.js';
4
+ import { classMap } from './util.js';
5
5
  import '../components/devvit-blocks-webview.js';
6
6
  export function renderWebViewBlock(block, ctx) {
7
7
  const { html, styleMap } = getTemplateRenderingStrategy();
@@ -0,0 +1,4 @@
1
+ import { ClassInfo, classMap as clientClassMap } from 'lit/directives/class-map.js';
2
+ import { UnsafeString } from '@reddit/baseplate/html.js';
3
+ export declare function classMap(classInfo: ClassInfo, forceString?: boolean): UnsafeString | ReturnType<typeof clientClassMap>;
4
+ //# sourceMappingURL=util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/blocks/templates/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,IAAI,cAAc,EAAE,MAAM,6BAA6B,CAAC;AACpF,OAAO,EAAU,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGjE,wBAAgB,QAAQ,CACtB,SAAS,EAAE,SAAS,EACpB,WAAW,CAAC,EAAE,OAAO,GACpB,YAAY,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAgBlD"}
@@ -0,0 +1,17 @@
1
+ import { classMap as clientClassMap } from 'lit/directives/class-map.js';
2
+ import { unsafe } from '@reddit/baseplate/html.js';
3
+ import { getTemplateRenderingStrategy } from '@reddit/faceplate-ui/faceplateUIConfig.js';
4
+ export function classMap(classInfo, forceString) {
5
+ const { getType } = getTemplateRenderingStrategy();
6
+ if (getType() === 'client' && forceString !== true) {
7
+ return clientClassMap(classInfo);
8
+ }
9
+ let result = '';
10
+ for (const name in classInfo) {
11
+ if (classInfo[name]) {
12
+ result += `${name} `;
13
+ }
14
+ }
15
+ // eslint-disable-next-line @reddit/no-unsafe/no-unsafe-function-usage
16
+ return unsafe(result);
17
+ }
@@ -60,14 +60,14 @@ let DevvitCustomPost = class DevvitCustomPost extends LitElement {
60
60
  this.removeEventListener('devvit-user-action', __classPrivateFieldGet(this, _DevvitCustomPost_handleUserAction, "f"));
61
61
  }
62
62
  willUpdate(changedProperties) {
63
+ if (changedProperties.has('postId')) {
64
+ __classPrivateFieldSet(this, _DevvitCustomPost_postData, this.postId !== undefined ? { __postData: { thingId: this.postId } } : undefined, "f");
65
+ }
63
66
  if (changedProperties.has('actorRef')) {
64
67
  __classPrivateFieldSet(this, _DevvitCustomPost_customPostActor, this.actorRef?.As(CustomPostDefinition), "f");
65
68
  __classPrivateFieldSet(this, _DevvitCustomPost_uiEventHandlerActor, this.actorRef?.As(UIEventHandlerDefinition), "f");
66
69
  __classPrivateFieldGet(this, _DevvitCustomPost_instances, "m", _DevvitCustomPost_initialRender).call(this);
67
70
  }
68
- if (changedProperties.has('postId')) {
69
- __classPrivateFieldSet(this, _DevvitCustomPost_postData, this.postId !== undefined ? { __postData: { thingId: this.postId } } : undefined, "f");
70
- }
71
71
  }
72
72
  render() {
73
73
  if (!this.renderResponse) {
@@ -1,9 +1,9 @@
1
1
  import { PropertyValues, TemplateResult } from 'lit';
2
+ import { InputElement } from '@reddit/faceplate/base-classes/input-element.js';
2
3
  import { FormField } from '@devvit/protos';
3
4
  import '@reddit/faceplate-ui/components/faceplate-dropdown-menu.js';
4
5
  import '@reddit/faceplate-ui/components/faceplate-menu.js';
5
6
  import '@reddit/faceplate-ui/components/faceplate-switch-input.js';
6
- import { InputElement } from '@reddit/faceplate/base-classes/input-element.js';
7
7
  export declare class DevvitFormSelectionDropdown extends InputElement {
8
8
  #private;
9
9
  field: FormField | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"devvit-form-selection-dropdown.d.ts","sourceRoot":"","sources":["../../../../src/client/formbuilder/components/devvit-form-selection-dropdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AASjE,OAAO,EAGL,SAAS,EAEV,MAAM,gBAAgB,CAAC;AAIxB,OAAO,4DAA4D,CAAC;AACpE,OAAO,mDAAmD,CAAC;AAC3D,OAAO,2DAA2D,CAAC;AAEnE,OAAO,EAAE,YAAY,EAAE,MAAM,iDAAiD,CAAC;AAE/E,qBAAa,2BAA4B,SAAQ,YAAY;;IAE3D,KAAK,EAAE,SAAS,GAAG,SAAS,CAAC;IAG7B,YAAY,UAAS;IAGrB,YAAY,SAAM;IAKlB,WAAoB,MAAM,mCAEzB;IAED,IAAI,KAAK,WAER;IAED,UAAU,CAAC,iBAAiB,EAAE,cAAc;IAwDnC,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC;CAgDrC"}
1
+ {"version":3,"file":"devvit-form-selection-dropdown.d.ts","sourceRoot":"","sources":["../../../../src/client/formbuilder/components/devvit-form-selection-dropdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AASrD,OAAO,EAAE,YAAY,EAAE,MAAM,iDAAiD,CAAC;AAE/E,OAAO,EAGL,SAAS,EAEV,MAAM,gBAAgB,CAAC;AAIxB,OAAO,4DAA4D,CAAC;AACpE,OAAO,mDAAmD,CAAC;AAC3D,OAAO,2DAA2D,CAAC;AAEnE,qBAAa,2BAA4B,SAAQ,YAAY;;IAE3D,KAAK,EAAE,SAAS,GAAG,SAAS,CAAC;IAG7B,YAAY,UAAS;IAGrB,YAAY,SAAM;IAKlB,WAAoB,MAAM,mCAEzB;IAED,IAAI,KAAK,WAER;IAED,UAAU,CAAC,iBAAiB,EAAE,cAAc;IAwDnC,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC;CAgDrC"}
@@ -1,17 +1,17 @@
1
1
  var _DevvitFormSelectionDropdown_selection, _DevvitFormSelectionDropdown_config, _DevvitFormSelectionDropdown_updateSelection, _DevvitFormSelectionDropdown_singleSelectListItem, _DevvitFormSelectionDropdown_multiSelectListItem;
2
2
  import { __classPrivateFieldGet, __classPrivateFieldSet, __decorate, __metadata } from "tslib";
3
3
  import { property, state } from 'lit/decorators.js';
4
+ import { classMap } from 'lit/directives/class-map.js';
4
5
  import { html, ifDefined } from '@reddit/faceplate-ui/templateRenderingStrategy/clientStrategy.js';
5
6
  import { listItem } from '@reddit/faceplate-ui/templates/list-item.js';
6
7
  import { button } from '@reddit/faceplate-ui/templates/button.js';
7
8
  import { msg } from '@reddit/faceplate/lib/i18n/localize.js';
9
+ import { InputElement } from '@reddit/faceplate/base-classes/input-element.js';
8
10
  import { FieldConfig_Selection, FormFieldValue_SelectionValue, } from '@devvit/protos';
9
11
  import { styles } from '../../../styles.js';
10
12
  import '@reddit/faceplate-ui/components/faceplate-dropdown-menu.js';
11
13
  import '@reddit/faceplate-ui/components/faceplate-menu.js';
12
14
  import '@reddit/faceplate-ui/components/faceplate-switch-input.js';
13
- import { classMap } from 'lit/directives/class-map.js';
14
- import { InputElement } from '@reddit/faceplate/base-classes/input-element.js';
15
15
  export class DevvitFormSelectionDropdown extends InputElement {
16
16
  constructor() {
17
17
  super(...arguments);
@@ -1,8 +1,8 @@
1
1
  import { PropertyValues, TemplateResult } from 'lit';
2
+ import { InputElement } from '@reddit/faceplate/base-classes/input-element.js';
2
3
  import { FormField } from '@devvit/protos';
3
4
  import '@reddit/faceplate-ui/components/faceplate-radio-input.js';
4
5
  import '@reddit/faceplate-ui/components/faceplate-checkbox-input.js';
5
- import { InputElement } from '@reddit/faceplate/base-classes/input-element.js';
6
6
  export declare class DevvitFormSelectionList extends InputElement {
7
7
  #private;
8
8
  field: FormField | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"devvit-form-selection-list.d.ts","sourceRoot":"","sources":["../../../../src/client/formbuilder/components/devvit-form-selection-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAMjE,OAAO,EAGL,SAAS,EAEV,MAAM,gBAAgB,CAAC;AAKxB,OAAO,0DAA0D,CAAC;AAClE,OAAO,6DAA6D,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,iDAAiD,CAAC;AAE/E,qBAAa,uBAAwB,SAAQ,YAAY;;IAEvD,KAAK,EAAE,SAAS,GAAG,SAAS,CAAC;IAK7B,WAAoB,MAAM,mCAEzB;IAED,IAAI,KAAK,WAER;IAED,UAAU,CAAC,iBAAiB,EAAE,cAAc;IAsBnC,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC;CA6CrC"}
1
+ {"version":3,"file":"devvit-form-selection-list.d.ts","sourceRoot":"","sources":["../../../../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,0DAA0D,CAAC;AAClE,OAAO,6DAA6D,CAAC;AAErE,qBAAa,uBAAwB,SAAQ,YAAY;;IAEvD,KAAK,EAAE,SAAS,GAAG,SAAS,CAAC;IAK7B,WAAoB,MAAM,mCAEzB;IAED,IAAI,KAAK,WAER;IAED,UAAU,CAAC,iBAAiB,EAAE,cAAc;IAsBnC,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC;CA6CrC"}
@@ -2,12 +2,12 @@ var _DevvitFormSelectionList_config, _DevvitFormSelectionList_selection, _Devvit
2
2
  import { __classPrivateFieldGet, __classPrivateFieldSet, __decorate, __metadata } from "tslib";
3
3
  import { property } from 'lit/decorators.js';
4
4
  import { html, repeat } from '@reddit/faceplate-ui/templateRenderingStrategy/clientStrategy.js';
5
+ import { InputElement } from '@reddit/faceplate/base-classes/input-element.js';
5
6
  import { FieldConfig_Selection, FormFieldValue_SelectionValue, } from '@devvit/protos';
6
- import { renderFieldLabel } from '../fields/index.js';
7
+ import { renderFieldLabel } from '../fields/renderFieldLabel.js';
7
8
  import { styles } from '../../../styles.js';
8
9
  import '@reddit/faceplate-ui/components/faceplate-radio-input.js';
9
10
  import '@reddit/faceplate-ui/components/faceplate-checkbox-input.js';
10
- import { InputElement } from '@reddit/faceplate/base-classes/input-element.js';
11
11
  export class DevvitFormSelectionList extends InputElement {
12
12
  constructor() {
13
13
  super(...arguments);
@@ -1 +1 @@
1
- {"version":3,"file":"devvit-form-dialog.d.ts","sourceRoot":"","sources":["../../../src/client/formbuilder/devvit-form-dialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,UAAU,EAAE,MAAM,KAAK,CAAC;AAIvC,OAAO,kEAAkE,CAAC;AAE1E,OAAO,EAAE,eAAe,EAAE,MAAM,qDAAqD,CAAC;AAItF,OAAO,EAAE,aAAa,EAAoB,MAAM,gDAAgD,CAAC;AAEjG,OAAO,EAAE,IAAI,EAA4C,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAKzF,OAAO,kDAAkD,CAAC;AAC1D,OAAO,gDAAgD,CAAC;AAKxD,qBACa,gBAAiB,SAAQ,UAAU;;IAE9C,IAAI,EAAE,IAAI,GAAG,SAAS,CAAC;IAGvB,OAAO,CAAC,EAAE,eAAe,CAAC;IAG1B,KAAK,CAAC,EAAE,aAAa,CAAC;IAKtB,WAAoB,MAAM,8BAEzB;IAED,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI;IAgF7C,MAAM;CA+ChB"}
1
+ {"version":3,"file":"devvit-form-dialog.d.ts","sourceRoot":"","sources":["../../../src/client/formbuilder/devvit-form-dialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,UAAU,EAAE,MAAM,KAAK,CAAC;AAIvC,OAAO,kEAAkE,CAAC;AAE1E,OAAO,EAAE,eAAe,EAAE,MAAM,qDAAqD,CAAC;AAGtF,OAAO,EAAE,aAAa,EAAoB,MAAM,gDAAgD,CAAC;AAEjG,OAAO,EAAE,IAAI,EAA4C,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAKzF,OAAO,kDAAkD,CAAC;AAC1D,OAAO,gDAAgD,CAAC;AAKxD,qBACa,gBAAiB,SAAQ,UAAU;;IAE9C,IAAI,EAAE,IAAI,GAAG,SAAS,CAAC;IAGvB,OAAO,CAAC,EAAE,eAAe,CAAC;IAG1B,KAAK,CAAC,EAAE,aAAa,CAAC;IAKtB,WAAoB,MAAM,8BAEzB;IAED,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI;IAgF7C,MAAM;CA+ChB"}
@@ -1,12 +1,2 @@
1
- export * from './renderBooleanField.js';
2
- export * from './renderFieldLabel.js';
3
1
  export * from './renderFormFields.js';
4
- export * from './renderGroupField.js';
5
- export * from './renderHelpText.js';
6
- export * from './renderListField.js';
7
- export * from './renderNumberField.js';
8
- export * from './renderParagraphField.js';
9
- export * from './renderSelectionField.js';
10
- export * from './renderStringField.js';
11
- export type OnInputDelegate = (event: InputEvent | CustomEvent) => void;
12
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/client/formbuilder/fields/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AAEvC,MAAM,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,UAAU,GAAG,WAAW,KAAK,IAAI,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/client/formbuilder/fields/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
@@ -1,10 +1 @@
1
- export * from './renderBooleanField.js';
2
- export * from './renderFieldLabel.js';
3
1
  export * from './renderFormFields.js';
4
- export * from './renderGroupField.js';
5
- export * from './renderHelpText.js';
6
- export * from './renderListField.js';
7
- export * from './renderNumberField.js';
8
- export * from './renderParagraphField.js';
9
- export * from './renderSelectionField.js';
10
- export * from './renderStringField.js';
@@ -1 +1 @@
1
- {"version":3,"file":"renderFormFields.d.ts","sourceRoot":"","sources":["../../../../src/client/formbuilder/fields/renderFormFields.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAKrC,OAAO,EAAE,SAAS,EAAiB,MAAM,gBAAgB,CAAC;AAuB1D,eAAO,MAAM,gBAAgB,WAAY,SAAS,EAAE,KAAG,cAEtD,CAAC"}
1
+ {"version":3,"file":"renderFormFields.d.ts","sourceRoot":"","sources":["../../../../src/client/formbuilder/fields/renderFormFields.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAKrC,OAAO,EAAE,SAAS,EAAiB,MAAM,gBAAgB,CAAC;AAqB1D,eAAO,MAAM,gBAAgB,WAAY,SAAS,EAAE,KAAG,cAEtD,CAAC"}
@@ -1,7 +1,12 @@
1
1
  import { choose } from 'lit/directives/choose.js';
2
2
  import { html, repeat } from '@reddit/faceplate-ui/templateRenderingStrategy/clientStrategy.js';
3
3
  import { FormFieldType } from '@devvit/protos';
4
- import { renderBooleanField, renderGroupField, renderNumberField, renderParagraphField, renderSelectionField, renderStringField, } from './index.js';
4
+ import { renderStringField } from './renderStringField.js';
5
+ import { renderBooleanField } from './renderBooleanField.js';
6
+ import { renderGroupField } from './renderGroupField.js';
7
+ import { renderSelectionField } from './renderSelectionField.js';
8
+ import { renderNumberField } from './renderNumberField.js';
9
+ import { renderParagraphField } from './renderParagraphField.js';
5
10
  const renderFormField = (field) => html `
6
11
  ${choose(field.fieldType, [
7
12
  [FormFieldType.STRING, () => renderStringField(field)],
@@ -10,7 +15,7 @@ const renderFormField = (field) => html `
10
15
  [FormFieldType.BOOLEAN, () => renderBooleanField(field)],
11
16
  // [FormFieldType.LIST, () => renderListField(field)],
12
17
  [FormFieldType.SELECTION, () => renderSelectionField(field)],
13
- [FormFieldType.GROUP, () => renderGroupField(field)],
18
+ [FormFieldType.GROUP, () => renderGroupField(field, renderFormFields)],
14
19
  ])}
15
20
  `;
16
21
  export const renderFormFields = (fields) => {
@@ -1,3 +1,4 @@
1
1
  import { FormField } from '@devvit/protos';
2
- export declare const renderGroupField: (field: FormField) => import("lit-html").TemplateResult<1>;
2
+ import { TemplateResult } from 'lit';
3
+ export declare const renderGroupField: (field: FormField, renderFormFields: (fields: FormField[]) => TemplateResult) => TemplateResult<1>;
3
4
  //# sourceMappingURL=renderGroupField.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderGroupField.d.ts","sourceRoot":"","sources":["../../../../src/client/formbuilder/fields/renderGroupField.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAK3C,eAAO,MAAM,gBAAgB,UAAW,SAAS,yCAShD,CAAC"}
1
+ {"version":3,"file":"renderGroupField.d.ts","sourceRoot":"","sources":["../../../../src/client/formbuilder/fields/renderGroupField.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAG3C,OAAO,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAErC,eAAO,MAAM,gBAAgB,UACpB,SAAS,6BACW,SAAS,EAAE,KAAK,cAAc,sBAU1D,CAAC"}
@@ -1,7 +1,6 @@
1
1
  import { html } from '@reddit/faceplate-ui/templateRenderingStrategy/clientStrategy.js';
2
- import { renderFormFields } from './renderFormFields.js';
3
2
  import { renderFieldLabel } from './renderFieldLabel.js';
4
- export const renderGroupField = (field) => {
3
+ export const renderGroupField = (field, renderFormFields) => {
5
4
  return html `
6
5
  <div class="flex flex-col py-xs border-0 gap-y-xs">
7
6
  ${renderFieldLabel(field)}
@@ -1 +1 @@
1
- {"version":3,"file":"renderNumberField.d.ts","sourceRoot":"","sources":["../../../../src/client/formbuilder/fields/renderNumberField.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsB,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAI/D,OAAO,yDAAyD,CAAC;AAEjE,eAAO,MAAM,iBAAiB,UAAW,SAAS,yCAmBjD,CAAC"}
1
+ {"version":3,"file":"renderNumberField.d.ts","sourceRoot":"","sources":["../../../../src/client/formbuilder/fields/renderNumberField.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsB,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE/D,OAAO,yDAAyD,CAAC;AAEjE,eAAO,MAAM,iBAAiB,UAAW,SAAS,yCAmBjD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"renderParagraphField.d.ts","sourceRoot":"","sources":["../../../../src/client/formbuilder/fields/renderParagraphField.ts"],"names":[],"mappings":"AAIA,OAAO,EAAyB,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAIlE,OAAO,6DAA6D,CAAC;AACrE,OAAO,+DAA+D,CAAC;AAGvE,eAAO,MAAM,oBAAoB,UAAW,SAAS,yCAoBpD,CAAC"}
1
+ {"version":3,"file":"renderParagraphField.d.ts","sourceRoot":"","sources":["../../../../src/client/formbuilder/fields/renderParagraphField.ts"],"names":[],"mappings":"AAIA,OAAO,EAAyB,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAElE,OAAO,6DAA6D,CAAC;AACrE,OAAO,+DAA+D,CAAC;AAGvE,eAAO,MAAM,oBAAoB,UAAW,SAAS,yCAoBpD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"renderSelectionField.d.ts","sourceRoot":"","sources":["../../../../src/client/formbuilder/fields/renderSelectionField.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAG3C,OAAO,iDAAiD,CAAC;AACzD,OAAO,6CAA6C,CAAC;AAErD,eAAO,MAAM,oBAAoB,UAAW,SAAS,yCAapD,CAAC"}
1
+ {"version":3,"file":"renderSelectionField.d.ts","sourceRoot":"","sources":["../../../../src/client/formbuilder/fields/renderSelectionField.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAK3C,OAAO,iDAAiD,CAAC;AACzD,OAAO,6CAA6C,CAAC;AAErD,eAAO,MAAM,oBAAoB,UAAW,SAAS,yCAapD,CAAC"}
@@ -1,5 +1,5 @@
1
- import { renderFieldLabel } from './index.js';
2
1
  import { html } from '@reddit/faceplate-ui/templateRenderingStrategy/clientStrategy.js';
2
+ import { renderFieldLabel } from './renderFieldLabel.js';
3
3
  import '../components/devvit-form-selection-dropdown.js';
4
4
  import '../components/devvit-form-selection-list.js';
5
5
  export const renderSelectionField = (field) => {
@@ -1 +1 @@
1
- {"version":3,"file":"renderStringField.d.ts","sourceRoot":"","sources":["../../../../src/client/formbuilder/fields/renderStringField.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsB,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAI/D,OAAO,yDAAyD,CAAC;AAEjE,eAAO,MAAM,iBAAiB,UAAW,SAAS,yCAqBjD,CAAC"}
1
+ {"version":3,"file":"renderStringField.d.ts","sourceRoot":"","sources":["../../../../src/client/formbuilder/fields/renderStringField.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsB,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE/D,OAAO,yDAAyD,CAAC;AAEjE,eAAO,MAAM,iBAAiB,UAAW,SAAS,yCAqBjD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devvit/ui-renderer",
3
- "version": "0.9.3",
3
+ "version": "0.9.4",
4
4
  "license": "BSD-3-Clause",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,7 +16,8 @@
16
16
  "clean": "rm -rf .turbo coverage dist",
17
17
  "clobber": "yarn clean && rm -rf node_modules",
18
18
  "dev": "concurrently -n 'styles,styles-dist,typescript' 'yarn watch:styles' 'yarn watch:styles-dist' 'yarn watch:typescript'",
19
- "lint": "redlint .",
19
+ "lint": "redlint . && yarn lint:circular-deps",
20
+ "lint:circular-deps": "yarn madge --circular dist/**/*.js",
20
21
  "lint:fix": "yarn lint --fix",
21
22
  "prepublishOnly": "publish-package-json",
22
23
  "test": "yarn test:unit && yarn test:types && yarn lint",
@@ -29,8 +30,8 @@
29
30
  },
30
31
  "types": "./index.d.ts",
31
32
  "dependencies": {
32
- "@devvit/protos": "0.9.3",
33
- "@devvit/runtimes": "0.9.3",
33
+ "@devvit/protos": "0.9.4",
34
+ "@devvit/runtimes": "0.9.4",
34
35
  "@lottiefiles/lottie-player": "1.7.1",
35
36
  "p-queue": "7.3.4",
36
37
  "rxjs": "7.5.7"
@@ -55,10 +56,10 @@
55
56
  "lit": "^2.0.0"
56
57
  },
57
58
  "devDependencies": {
58
- "@devvit/eslint-config": "0.9.3",
59
- "@devvit/public-api": "0.9.3",
60
- "@devvit/repo-tools": "0.9.3",
61
- "@devvit/tsconfig": "0.9.3",
59
+ "@devvit/eslint-config": "0.9.4",
60
+ "@devvit/public-api": "0.9.4",
61
+ "@devvit/repo-tools": "0.9.4",
62
+ "@devvit/tsconfig": "0.9.4",
62
63
  "@lit/localize": "0.11.4",
63
64
  "@reddit/baseplate": "0.14.0",
64
65
  "@reddit/eslint-plugin-i18n-shreddit": "0.1.0",
@@ -68,6 +69,7 @@
68
69
  "debounce": "1.2.1",
69
70
  "eslint": "8.9.0",
70
71
  "lit": "^2.0.0",
72
+ "madge": "6.0.0",
71
73
  "postcss": "8.4.22",
72
74
  "postcss-cli": "10.1.0",
73
75
  "postcss-import": "15.1.0",
@@ -79,5 +81,5 @@
79
81
  "directory": "dist"
80
82
  },
81
83
  "source": "./src/index.ts",
82
- "gitHead": "40b7a04ef208bc233775977a5a3a819875a153c1"
84
+ "gitHead": "27a5a627334932929b427700f6d6686683689a4f"
83
85
  }