@devvit/ui-renderer 0.9.9 → 0.9.10-next-2023-06-08-62879cbc3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/blocks/attributes.d.ts +2 -0
- package/blocks/attributes.d.ts.map +1 -1
- package/blocks/attributes.js +13 -1
- package/blocks/components/devvit-blocks-renderer.d.ts +1 -1
- package/blocks/components/devvit-blocks-renderer.js +9 -1
- package/blocks/components/devvit-blocks-webview.js +15 -2
- package/blocks/templates/renderAnimationBlock.d.ts +1 -2
- package/blocks/templates/renderAnimationBlock.d.ts.map +1 -1
- package/blocks/templates/renderAnimationBlock.js +3 -3
- package/blocks/templates/renderAvatarBlock.d.ts +1 -1
- package/blocks/templates/renderAvatarBlock.d.ts.map +1 -1
- package/blocks/templates/renderAvatarBlock.js +3 -2
- package/blocks/templates/renderBlock.d.ts +1 -1
- package/blocks/templates/renderBlock.d.ts.map +1 -1
- package/blocks/templates/renderBlock.js +1 -1
- package/blocks/templates/renderButtonBlock.d.ts +1 -1
- package/blocks/templates/renderButtonBlock.d.ts.map +1 -1
- package/blocks/templates/renderButtonBlock.js +3 -2
- package/blocks/templates/renderFullSnooBlock.d.ts +1 -1
- package/blocks/templates/renderFullSnooBlock.d.ts.map +1 -1
- package/blocks/templates/renderFullSnooBlock.js +3 -2
- package/blocks/templates/renderIconBlock.d.ts +1 -1
- package/blocks/templates/renderIconBlock.d.ts.map +1 -1
- package/blocks/templates/renderIconBlock.js +3 -2
- package/blocks/templates/renderImageBlock.d.ts +1 -1
- package/blocks/templates/renderImageBlock.d.ts.map +1 -1
- package/blocks/templates/renderImageBlock.js +3 -2
- package/blocks/templates/renderSpacerBlock.d.ts +1 -1
- package/blocks/templates/renderSpacerBlock.d.ts.map +1 -1
- package/blocks/templates/renderStackBlock.d.ts +1 -1
- package/blocks/templates/renderStackBlock.d.ts.map +1 -1
- package/blocks/templates/renderStackBlock.js +3 -2
- package/blocks/templates/renderTextBlock.d.ts +1 -1
- package/blocks/templates/renderTextBlock.d.ts.map +1 -1
- package/blocks/templates/renderTextBlock.js +5 -3
- package/blocks/templates/renderWebViewBlock.d.ts +1 -2
- package/blocks/templates/renderWebViewBlock.d.ts.map +1 -1
- package/blocks/templates/renderWebViewBlock.js +1 -2
- package/blocks/templates/util.d.ts +4 -4
- package/blocks/templates/util.d.ts.map +1 -1
- package/blocks/templates/util.js +30 -6
- package/client/devvit-animation-player.js +9 -1
- package/client/devvit-custom-post.d.ts +1 -0
- package/client/devvit-custom-post.d.ts.map +1 -1
- package/client/devvit-custom-post.js +22 -2
- package/client/effects/devvit-effect-handler.js +5 -1
- package/client/effects/form-effect-handler.js +11 -1
- package/client/formbuilder/components/devvit-form-selection-dropdown.js +20 -1
- package/client/formbuilder/components/devvit-form-selection-list.js +20 -1
- package/client/formbuilder/devvit-form-dialog.js +20 -1
- package/package.json +7 -7
- package/styles.js +1 -1
package/blocks/attributes.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export declare function radiusClass(radius: BlockRadius | undefined): ClassInfo;
|
|
|
19
19
|
export declare function textSizeClass(size: BlockTextSize | undefined): ClassInfo;
|
|
20
20
|
export declare function textAlignClass(alignment: BlockAlignment | undefined): ClassInfo;
|
|
21
21
|
export declare function textWeightClass(weight: BlockTextWeight | undefined): ClassInfo;
|
|
22
|
+
export declare function textSelectClass(selection: boolean | undefined): ClassInfo;
|
|
22
23
|
export declare function textOutlineClass(outline: BlockTextOutline, _textColor: string | undefined): ClassInfo;
|
|
23
24
|
export declare function colorStyle(color: string | undefined): StyleInfo;
|
|
24
25
|
export declare function spacerSizeClass(size: BlockSpacerSize | undefined, stackDirection: BlockStackDirection): ClassInfo;
|
|
@@ -29,6 +30,7 @@ export declare function facingClass(facing: BlockAvatarFacing | undefined): Clas
|
|
|
29
30
|
export declare function fullSnooSizeClass(size: BlockFullSnooSize | undefined): ClassInfo;
|
|
30
31
|
export declare function buttonAppearance(appearance: BlockButtonAppearance | undefined): ButtonAppearance;
|
|
31
32
|
export declare function buttonSize(size: BlockButtonSize | undefined): ButtonSize;
|
|
33
|
+
export declare function cursorClass(block: Block): ClassInfo;
|
|
32
34
|
export declare function onClickAction(block: Block, ctx: RenderContext): (() => void) | undefined;
|
|
33
35
|
export declare function setTextOutline(thickness: BlockTextOutline | undefined): ReturnType<typeof clientRef>;
|
|
34
36
|
//# sourceMappingURL=attributes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../library/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;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,GAAG,IAAI,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAIzD,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;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1
1
|
import { ButtonSize } from '@reddit/faceplate-ui/templates/button.js';
|
|
2
2
|
import { BlockActionType, BlockAvatarFacing, BlockAvatarSize, BlockBorderWidth, BlockButtonAppearance, BlockButtonSize, BlockFullSnooSize, BlockGap, BlockHorizontalAlignment, BlockIconSize, BlockImageResizeMode, BlockPadding, BlockRadius, BlockSpacerSize, BlockStackDirection, BlockTextOutline, BlockTextSize, BlockTextWeight, BlockType, BlockVerticalAlignment, } from '@devvit/protos';
|
|
3
|
-
import { nothing } from '@reddit/baseplate/html.js';
|
|
4
3
|
import { brightnessByColor, isHTMLElement, ref } from './templates/util.js';
|
|
4
|
+
import { nothing } from 'lit';
|
|
5
5
|
export function defaultClasses(type) {
|
|
6
6
|
return {
|
|
7
7
|
'overflow-hidden': type === BlockType.BLOCK_ROOT || type === BlockType.BLOCK_STACK,
|
|
@@ -143,6 +143,13 @@ export function textWeightClass(weight) {
|
|
|
143
143
|
'font-semibold': weight === BlockTextWeight.TEXT_WEIGHT_BOLD,
|
|
144
144
|
};
|
|
145
145
|
}
|
|
146
|
+
export function textSelectClass(selection) {
|
|
147
|
+
return {
|
|
148
|
+
'select-none': selection === false,
|
|
149
|
+
'select-text': selection === true,
|
|
150
|
+
'select-auto': selection === undefined,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
146
153
|
export function textOutlineClass(outline, _textColor) {
|
|
147
154
|
const thin = outline === BlockTextOutline.TEXT_OUTLINE_THIN;
|
|
148
155
|
const thick = outline === BlockTextOutline.TEXT_OUTLINE_THICK;
|
|
@@ -271,6 +278,11 @@ export function buttonSize(size) {
|
|
|
271
278
|
}
|
|
272
279
|
return buttonSize;
|
|
273
280
|
}
|
|
281
|
+
export function cursorClass(block) {
|
|
282
|
+
return {
|
|
283
|
+
'cursor-pointer': !!block.actions.find((a) => a.type === BlockActionType.ACTION_CLICK),
|
|
284
|
+
};
|
|
285
|
+
}
|
|
274
286
|
export function onClickAction(block, ctx) {
|
|
275
287
|
const clickAction = block.actions.find((a) => a.type === BlockActionType.ACTION_CLICK);
|
|
276
288
|
if (clickAction) {
|
|
@@ -5,7 +5,7 @@ export declare class DevvitBlocksRenderer extends LitElement {
|
|
|
5
5
|
block: Block | undefined;
|
|
6
6
|
renderContext: () => RenderContext;
|
|
7
7
|
static get styles(): import("lit").CSSResult[];
|
|
8
|
-
render(): import("
|
|
8
|
+
render(): import("../templates/util.js").TemplateLike;
|
|
9
9
|
}
|
|
10
10
|
declare global {
|
|
11
11
|
interface HTMLElementTagNameMap {
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
2
10
|
import { html, LitElement } from 'lit';
|
|
3
11
|
import { customElement, property } from 'lit/decorators.js';
|
|
4
12
|
import { localized, msg } from '@lit/localize';
|
|
@@ -1,9 +1,22 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
11
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
12
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
13
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
14
|
+
};
|
|
1
15
|
var _DevvitBlocksWebview_iframe, _DevvitBlocksWebview_handleMessage, _DevvitBlocksWebview_onLoad;
|
|
2
|
-
import { __classPrivateFieldGet, __decorate, __metadata } from "tslib";
|
|
3
16
|
import { css, html, LitElement } from 'lit';
|
|
4
17
|
import { customElement, property } from 'lit/decorators.js';
|
|
18
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
5
19
|
import { createRef, ref } from 'lit/directives/ref.js';
|
|
6
|
-
import { ifDefined } from '@reddit/baseplate/html.js';
|
|
7
20
|
import { customEvent } from '@reddit/faceplate/lib/custom-event.js';
|
|
8
21
|
import { BlockActionType } from '@devvit/protos';
|
|
9
22
|
/**
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Block } from '@devvit/protos';
|
|
2
|
-
import { TemplateLike } from '@reddit/baseplate/html.js';
|
|
3
|
-
import '../../client/devvit-animation-player.js';
|
|
4
2
|
import { RenderContext } from './renderContext.js';
|
|
3
|
+
import { TemplateLike } from './util.js';
|
|
5
4
|
export declare function renderAnimationBlock(block: Block, ctx: RenderContext): TemplateLike;
|
|
6
5
|
//# sourceMappingURL=renderAnimationBlock.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderAnimationBlock.d.ts","sourceRoot":"","sources":["../../../library/src/blocks/templates/renderAnimationBlock.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"renderAnimationBlock.d.ts","sourceRoot":"","sources":["../../../library/src/blocks/templates/renderAnimationBlock.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAYvC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAY,YAAY,EAAE,MAAM,WAAW,CAAC;AAEnD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,GAAG,YAAY,CA8BnF"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { nothing } from '
|
|
1
|
+
import { nothing } from 'lit';
|
|
2
2
|
import { getTemplateRenderingStrategy } from '@reddit/faceplate-ui/faceplateUIConfig.js';
|
|
3
|
-
import '
|
|
4
|
-
import { defaultClasses, onClickAction, sizingClass, sizingStyle, stackChildClass, } from '../attributes.js';
|
|
3
|
+
import { cursorClass, defaultClasses, onClickAction, sizingClass, sizingStyle, stackChildClass, } from '../attributes.js';
|
|
5
4
|
import { classMap } from './util.js';
|
|
6
5
|
export function renderAnimationBlock(block, ctx) {
|
|
7
6
|
const { html, styleMap, ifDefined } = getTemplateRenderingStrategy();
|
|
@@ -14,6 +13,7 @@ export function renderAnimationBlock(block, ctx) {
|
|
|
14
13
|
...defaultClasses(block.type),
|
|
15
14
|
...stackChildClass(ctx.stackDirection),
|
|
16
15
|
...sizingClass(block.size),
|
|
16
|
+
...cursorClass(block),
|
|
17
17
|
};
|
|
18
18
|
const styles = {
|
|
19
19
|
...sizingStyle(block.size),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Block } from '@devvit/protos';
|
|
2
|
-
import { TemplateLike } from '@reddit/baseplate/html.js';
|
|
3
2
|
import { RenderContext } from './renderContext.js';
|
|
3
|
+
import { TemplateLike } from './util.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":["../../../library/src/blocks/templates/renderAvatarBlock.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"renderAvatarBlock.d.ts","sourceRoot":"","sources":["../../../library/src/blocks/templates/renderAvatarBlock.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAcvC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAY,YAAY,EAAE,MAAM,WAAW,CAAC;AAEnD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,GAAG,YAAY,CA8BhF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { nothing } from '
|
|
1
|
+
import { nothing } from 'lit';
|
|
2
2
|
import { getTemplateRenderingStrategy } from '@reddit/faceplate-ui/faceplateUIConfig.js';
|
|
3
|
-
import { avatarSizeClass, defaultClasses, facingClass, onClickAction, sizingClass, sizingStyle, stackChildClass, } from '../attributes.js';
|
|
3
|
+
import { avatarSizeClass, cursorClass, defaultClasses, facingClass, onClickAction, sizingClass, sizingStyle, stackChildClass, } from '../attributes.js';
|
|
4
4
|
import { classMap } from './util.js';
|
|
5
5
|
export function renderAvatarBlock(block, ctx) {
|
|
6
6
|
const { html, styleMap, ifDefined } = getTemplateRenderingStrategy();
|
|
@@ -15,6 +15,7 @@ export function renderAvatarBlock(block, ctx) {
|
|
|
15
15
|
...sizingClass(block.size),
|
|
16
16
|
...avatarSizeClass(size),
|
|
17
17
|
...facingClass(facing),
|
|
18
|
+
...cursorClass(block),
|
|
18
19
|
};
|
|
19
20
|
const styles = {
|
|
20
21
|
...sizingStyle(block.size),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { TemplateLike } from '@reddit/baseplate/html.js';
|
|
2
1
|
import { Block } from '@devvit/protos';
|
|
3
2
|
import { RenderContext } from './renderContext.js';
|
|
3
|
+
import { TemplateLike } from "./util.js";
|
|
4
4
|
export declare function renderBlocks(block: Block, context?: Partial<RenderContext>): TemplateLike;
|
|
5
5
|
export declare function renderBlock(block: Block, ctx: RenderContext): TemplateLike;
|
|
6
6
|
//# sourceMappingURL=renderBlock.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderBlock.d.ts","sourceRoot":"","sources":["../../../library/src/blocks/templates/renderBlock.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"renderBlock.d.ts","sourceRoot":"","sources":["../../../library/src/blocks/templates/renderBlock.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAkC,MAAM,gBAAgB,CAAC;AAYvE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,GAAE,OAAO,CAAC,aAAa,CAAM,GAAG,YAAY,CAsB7F;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,GAAG,YAAY,CA+C1E"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { nothing } from '
|
|
1
|
+
import { nothing } from 'lit';
|
|
2
2
|
import { getTemplateRenderingStrategy } from '@reddit/faceplate-ui/faceplateUIConfig.js';
|
|
3
3
|
import { BlockStackDirection, BlockType } from '@devvit/protos';
|
|
4
4
|
import { renderStackBlock } from './renderStackBlock.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TemplateLike } from '@reddit/baseplate/html.js';
|
|
2
1
|
import { Block } from '@devvit/protos';
|
|
3
2
|
import { RenderContext } from './renderContext.js';
|
|
3
|
+
import { TemplateLike } from './util.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":["../../../library/src/blocks/templates/renderButtonBlock.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"renderButtonBlock.d.ts","sourceRoot":"","sources":["../../../library/src/blocks/templates/renderButtonBlock.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAavC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAyB,YAAY,EAAE,MAAM,WAAW,CAAC;AAEhE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,GAAG,YAAY,CAwChF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getTemplateRenderingStrategy } from '@reddit/faceplate-ui/faceplateUIConfig.js';
|
|
2
2
|
import { button } from '@reddit/faceplate-ui/templates/button.js';
|
|
3
3
|
import { styleMap } from '@reddit/faceplate-ui/templateUtils/styleMap.js';
|
|
4
|
-
import { buttonAppearance, buttonSize, colorStyle, defaultClasses, onClickAction, sizingClass, sizingStyle, stackChildClass, } from '../attributes.js';
|
|
4
|
+
import { buttonAppearance, buttonSize, colorStyle, cursorClass, defaultClasses, onClickAction, sizingClass, sizingStyle, stackChildClass, } from '../attributes.js';
|
|
5
5
|
import { classMap, resolveIcon } from './util.js';
|
|
6
6
|
export function renderButtonBlock(block, ctx) {
|
|
7
7
|
const { html, ifDefined } = getTemplateRenderingStrategy();
|
|
@@ -11,6 +11,7 @@ export function renderButtonBlock(block, ctx) {
|
|
|
11
11
|
...defaultClasses(block.type),
|
|
12
12
|
...stackChildClass(ctx.stackDirection),
|
|
13
13
|
...sizingClass(block.size),
|
|
14
|
+
...cursorClass(block),
|
|
14
15
|
};
|
|
15
16
|
const styles = {
|
|
16
17
|
...colorStyle(block.config?.buttonConfig?.textColor),
|
|
@@ -31,7 +32,7 @@ export function renderButtonBlock(block, ctx) {
|
|
|
31
32
|
disabled,
|
|
32
33
|
// convert from StyleInfo to CSSStyleDeclaration
|
|
33
34
|
style: styleMap(styles).string,
|
|
34
|
-
className: classMap(classes, true)
|
|
35
|
+
className: classMap(classes, true),
|
|
35
36
|
onclick: onClick ?? null,
|
|
36
37
|
'data-debug-block-type': 'button',
|
|
37
38
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TemplateLike } from '@reddit/baseplate/html.js';
|
|
2
1
|
import { Block } from '@devvit/protos';
|
|
3
2
|
import { RenderContext } from './renderContext.js';
|
|
3
|
+
import { TemplateLike } from './util.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":["../../../library/src/blocks/templates/renderFullSnooBlock.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"renderFullSnooBlock.d.ts","sourceRoot":"","sources":["../../../library/src/blocks/templates/renderFullSnooBlock.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAYvC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAY,YAAY,EAAE,MAAM,WAAW,CAAC;AAEnD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,GAAG,YAAY,CA8BlF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { nothing } from '
|
|
1
|
+
import { nothing } from 'lit';
|
|
2
2
|
import { getTemplateRenderingStrategy } from '@reddit/faceplate-ui/faceplateUIConfig.js';
|
|
3
|
-
import { defaultClasses, facingClass, fullSnooSizeClass, onClickAction, sizingClass, sizingStyle, stackChildClass, } from '../attributes.js';
|
|
3
|
+
import { cursorClass, defaultClasses, facingClass, fullSnooSizeClass, onClickAction, sizingClass, sizingStyle, stackChildClass, } from '../attributes.js';
|
|
4
4
|
import { classMap } from './util.js';
|
|
5
5
|
export function renderFullSnooBlock(block, ctx) {
|
|
6
6
|
const { html, styleMap, ifDefined } = getTemplateRenderingStrategy();
|
|
@@ -15,6 +15,7 @@ export function renderFullSnooBlock(block, ctx) {
|
|
|
15
15
|
...sizingClass(block.size),
|
|
16
16
|
...fullSnooSizeClass(size),
|
|
17
17
|
...facingClass(facing),
|
|
18
|
+
...cursorClass(block),
|
|
18
19
|
};
|
|
19
20
|
const styles = {
|
|
20
21
|
...sizingStyle(block.size),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TemplateLike } from '@reddit/baseplate/html.js';
|
|
2
1
|
import { Block } from '@devvit/protos';
|
|
3
2
|
import { RenderContext } from './renderContext.js';
|
|
3
|
+
import { TemplateLike } from './util.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":["../../../library/src/blocks/templates/renderIconBlock.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"renderIconBlock.d.ts","sourceRoot":"","sources":["../../../library/src/blocks/templates/renderIconBlock.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAYvC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAuC,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9E,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,GAAG,YAAY,CAkC9E"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { nothing } from '
|
|
1
|
+
import { nothing } from 'lit';
|
|
2
2
|
import { getTemplateRenderingStrategy } from '@reddit/faceplate-ui/faceplateUIConfig.js';
|
|
3
|
-
import { colorStyle, defaultClasses, iconSizeClass, onClickAction, sizingClass, sizingStyle, stackChildClass, } from '../attributes.js';
|
|
3
|
+
import { colorStyle, cursorClass, defaultClasses, iconSizeClass, onClickAction, sizingClass, sizingStyle, stackChildClass, } from '../attributes.js';
|
|
4
4
|
import { classMap, correctColor, resolveIcon } from './util.js';
|
|
5
5
|
export function renderIconBlock(block, ctx) {
|
|
6
6
|
const { html, styleMap, ifDefined } = getTemplateRenderingStrategy();
|
|
@@ -18,6 +18,7 @@ export function renderIconBlock(block, ctx) {
|
|
|
18
18
|
...stackChildClass(ctx.stackDirection),
|
|
19
19
|
...sizingClass(block.size),
|
|
20
20
|
...iconSizeClass(size),
|
|
21
|
+
...cursorClass(block),
|
|
21
22
|
};
|
|
22
23
|
const onClick = onClickAction(block, ctx);
|
|
23
24
|
return html `<div
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TemplateLike } from '@reddit/baseplate/html.js';
|
|
2
1
|
import { Block } from '@devvit/protos';
|
|
3
2
|
import { RenderContext } from './renderContext.js';
|
|
3
|
+
import { TemplateLike } from './util.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":["../../../library/src/blocks/templates/renderImageBlock.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"renderImageBlock.d.ts","sourceRoot":"","sources":["../../../library/src/blocks/templates/renderImageBlock.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAWvC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAY,YAAY,EAAE,MAAM,WAAW,CAAC;AAEnD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,GAAG,YAAY,CAmC/E"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { nothing } from
|
|
1
|
+
import { nothing } from "lit";
|
|
2
2
|
import { getTemplateRenderingStrategy } from '@reddit/faceplate-ui/faceplateUIConfig.js';
|
|
3
|
-
import { defaultClasses, onClickAction, resizeModeClass, sizingClass, sizingStyle, stackChildClass, } from '../attributes.js';
|
|
3
|
+
import { cursorClass, defaultClasses, onClickAction, resizeModeClass, sizingClass, sizingStyle, stackChildClass, } from '../attributes.js';
|
|
4
4
|
import { classMap } from './util.js';
|
|
5
5
|
export function renderImageBlock(block, ctx) {
|
|
6
6
|
const { html, styleMap, ifDefined } = getTemplateRenderingStrategy();
|
|
@@ -14,6 +14,7 @@ export function renderImageBlock(block, ctx) {
|
|
|
14
14
|
...stackChildClass(ctx.stackDirection),
|
|
15
15
|
...sizingClass(block.size),
|
|
16
16
|
...resizeModeClass(resizeMode),
|
|
17
|
+
...cursorClass(block),
|
|
17
18
|
};
|
|
18
19
|
const styles = {
|
|
19
20
|
...sizingStyle(block.size),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TemplateLike } from '@reddit/baseplate/html.js';
|
|
2
1
|
import { Block } from '@devvit/protos';
|
|
3
2
|
import { RenderContext } from './renderContext.js';
|
|
3
|
+
import { TemplateLike } from './util.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":["../../../library/src/blocks/templates/renderSpacerBlock.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"renderSpacerBlock.d.ts","sourceRoot":"","sources":["../../../library/src/blocks/templates/renderSpacerBlock.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AASvC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAY,YAAY,EAAE,MAAM,WAAW,CAAC;AAEnD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,GAAG,YAAY,CAmBhF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TemplateLike } from '@reddit/baseplate/html.js';
|
|
2
1
|
import { Block } from '@devvit/protos';
|
|
3
2
|
import { RenderContext } from './renderContext.js';
|
|
3
|
+
import { TemplateLike } from './util.js';
|
|
4
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":["../../../library/src/blocks/templates/renderStackBlock.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"renderStackBlock.d.ts","sourceRoot":"","sources":["../../../library/src/blocks/templates/renderStackBlock.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAuB,MAAM,gBAAgB,CAAC;AAkB5D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAA0B,YAAY,EAAE,MAAM,WAAW,CAAC;AAEjE,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,KAAK,EACZ,GAAG,2BAAsE,EACzE,WAAW,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,KAAK,YAAY,GAC9D,YAAY,CAuEd"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { nothing } from '
|
|
1
|
+
import { nothing } from 'lit';
|
|
2
2
|
import { getTemplateRenderingStrategy } from '@reddit/faceplate-ui/faceplateUIConfig.js';
|
|
3
3
|
import { BlockStackDirection } from '@devvit/protos';
|
|
4
|
-
import { alignmentClass, backgroundStyle, borderClass, borderStyle, defaultClasses, gapClass, onClickAction, paddingClass, radiusClass, sizingClass, sizingStyle, stackChildClass, stackDirectionClass, } from '../attributes.js';
|
|
4
|
+
import { alignmentClass, backgroundStyle, borderClass, borderStyle, cursorClass, defaultClasses, gapClass, onClickAction, paddingClass, radiusClass, sizingClass, sizingStyle, stackChildClass, stackDirectionClass, } from '../attributes.js';
|
|
5
5
|
import { classMap, correctColor } from './util.js';
|
|
6
6
|
export function renderStackBlock(block, ctx = { stackDirection: BlockStackDirection.UNRECOGNIZED }, renderBlock) {
|
|
7
7
|
const { html, repeat, styleMap, ifDefined } = getTemplateRenderingStrategy();
|
|
@@ -20,6 +20,7 @@ export function renderStackBlock(block, ctx = { stackDirection: BlockStackDirect
|
|
|
20
20
|
...alignmentClass(direction, alignment),
|
|
21
21
|
...borderClass(border),
|
|
22
22
|
...radiusClass(cornerRadius),
|
|
23
|
+
...cursorClass(block),
|
|
23
24
|
};
|
|
24
25
|
const styles = {
|
|
25
26
|
...sizingStyle(block.size),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TemplateLike } from '@reddit/baseplate/html.js';
|
|
2
1
|
import { Block } from '@devvit/protos';
|
|
3
2
|
import { RenderContext } from './renderContext.js';
|
|
3
|
+
import { TemplateLike } from './util.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":["../../../library/src/blocks/templates/renderTextBlock.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"renderTextBlock.d.ts","sourceRoot":"","sources":["../../../library/src/blocks/templates/renderTextBlock.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAkD,MAAM,gBAAgB,CAAC;AAgBvF,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAA0B,YAAY,EAAE,MAAM,WAAW,CAAC;AAEjE,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,GAAG,YAAY,CAgE9E"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { nothing } from '
|
|
1
|
+
import { nothing } from 'lit';
|
|
2
2
|
import { getTemplateRenderingStrategy } from '@reddit/faceplate-ui/faceplateUIConfig.js';
|
|
3
3
|
import { BlockTextSize, BlockTextStyle, BlockTextWeight } from '@devvit/protos';
|
|
4
|
-
import { colorStyle, defaultClasses, onClickAction, setTextOutline, sizingClass, sizingStyle, stackChildClass, textAlignClass, textSizeClass, textWeightClass, } from '../attributes.js';
|
|
4
|
+
import { colorStyle, cursorClass, defaultClasses, onClickAction, setTextOutline, sizingClass, sizingStyle, stackChildClass, textAlignClass, textSelectClass, textSizeClass, textWeightClass, } from '../attributes.js';
|
|
5
5
|
import { classMap, correctColor } from './util.js';
|
|
6
6
|
export function renderTextBlock(block, ctx) {
|
|
7
7
|
const { html, styleMap, ifDefined } = getTemplateRenderingStrategy();
|
|
@@ -9,7 +9,7 @@ export function renderTextBlock(block, ctx) {
|
|
|
9
9
|
console.error('Invalid block: Text missing TextConfig');
|
|
10
10
|
return nothing;
|
|
11
11
|
}
|
|
12
|
-
const { text, color, size, alignment, weight, style, outline } = block.config.textConfig;
|
|
12
|
+
const { text, color, size, alignment, weight, style, outline, selectable } = block.config.textConfig;
|
|
13
13
|
let textColor;
|
|
14
14
|
let textSize;
|
|
15
15
|
let textWeight;
|
|
@@ -46,6 +46,8 @@ export function renderTextBlock(block, ctx) {
|
|
|
46
46
|
...textSizeClass(textSize),
|
|
47
47
|
...textAlignClass(alignment),
|
|
48
48
|
...textWeightClass(textWeight),
|
|
49
|
+
...textSelectClass(selectable),
|
|
50
|
+
...cursorClass(block),
|
|
49
51
|
};
|
|
50
52
|
const onClick = onClickAction(block, ctx);
|
|
51
53
|
return html `<span
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { TemplateLike } from '@reddit/baseplate/html.js';
|
|
2
1
|
import { Block } from '@devvit/protos';
|
|
3
2
|
import { RenderContext } from './renderContext.js';
|
|
4
|
-
import '
|
|
3
|
+
import { TemplateLike } from './util.js';
|
|
5
4
|
export declare function renderWebViewBlock(block: Block, ctx: RenderContext): TemplateLike;
|
|
6
5
|
//# sourceMappingURL=renderWebViewBlock.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderWebViewBlock.d.ts","sourceRoot":"","sources":["../../../library/src/blocks/templates/renderWebViewBlock.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"renderWebViewBlock.d.ts","sourceRoot":"","sources":["../../../library/src/blocks/templates/renderWebViewBlock.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGvC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAY,YAAY,EAAE,MAAM,WAAW,CAAC;AAEnD,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,aAAa,GACjB,YAAY,CA2Bd"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { nothing } from '
|
|
1
|
+
import { nothing } from 'lit';
|
|
2
2
|
import { getTemplateRenderingStrategy } from '@reddit/faceplate-ui/faceplateUIConfig.js';
|
|
3
3
|
import { defaultClasses, sizingClass, sizingStyle, stackChildClass } from '../attributes.js';
|
|
4
4
|
import { classMap } from './util.js';
|
|
5
|
-
import '../components/devvit-blocks-webview.js';
|
|
6
5
|
export function renderWebViewBlock(block, ctx) {
|
|
7
6
|
const { html, styleMap } = getTemplateRenderingStrategy();
|
|
8
7
|
if (!block.config?.webviewConfig) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ClassInfo, classMap as clientClassMap } from 'lit/directives/class-map.js';
|
|
2
|
-
import {
|
|
3
|
-
import { TemplateResult } from 'lit';
|
|
4
|
-
|
|
5
|
-
export declare function classMap(classInfo: ClassInfo, forceString?: boolean):
|
|
2
|
+
import { ref as clientRef, RefOrCallback } from 'lit/directives/ref.js';
|
|
3
|
+
import { nothing, TemplateResult } from 'lit';
|
|
4
|
+
export type TemplateLike = TemplateResult | typeof nothing;
|
|
5
|
+
export declare function classMap(classInfo: ClassInfo, forceString?: boolean): string | ReturnType<typeof clientClassMap>;
|
|
6
6
|
export declare function unsafeHTML(input: string): import("lit-html/directive.js").DirectiveResult<typeof import("lit-html/directives/unsafe-html.js").UnsafeHTMLDirective>;
|
|
7
7
|
export declare function ref(ref: RefOrCallback): ReturnType<typeof clientRef> | string;
|
|
8
8
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../library/src/blocks/templates/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,IAAI,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAEpF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../library/src/blocks/templates/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,IAAI,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAEpF,OAAO,EAAE,GAAG,IAAI,SAAS,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAQ9C,MAAM,MAAM,YAAY,GAAG,cAAc,GAAG,OAAO,OAAO,CAAC;AAE3D,wBAAgB,QAAQ,CACtB,SAAS,EAAE,SAAS,EACpB,WAAW,CAAC,EAAE,OAAO,GACpB,MAAM,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAW5C;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,4HAMvC;AAED,wBAAgB,GAAG,CAAC,GAAG,EAAE,aAAa,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,GAAG,MAAM,CAM7E;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,IAAI,EAAE,MAAM,GACX,UAAU,CAAC,OAAO,SAAS,CAAC,GAAG,MAAM,CAuBvC;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CA4BvD;AAED,wBAAgB,aAAa,CAAC,EAAE,EAAE,WAAW,GAAG,OAAO,GAAG,SAAS,GAAG,EAAE,IAAI,WAAW,CAEtF;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAYxD"}
|
package/blocks/templates/util.js
CHANGED
|
@@ -4,6 +4,7 @@ import { ref as clientRef } from 'lit/directives/ref.js';
|
|
|
4
4
|
import { unsafeHTML as serverUnsafeHTML } from '@reddit/baseplate/html.js';
|
|
5
5
|
import { getTemplateRenderingStrategy } from '@reddit/faceplate-ui/faceplateUIConfig.js';
|
|
6
6
|
import faceplateIcons from '@reddit/faceplate-ui/svgs/svg-manifest.js';
|
|
7
|
+
const colorCache = {};
|
|
7
8
|
export function classMap(classInfo, forceString) {
|
|
8
9
|
const { getType } = getTemplateRenderingStrategy();
|
|
9
10
|
if (getType() === 'client' && forceString !== true) {
|
|
@@ -12,7 +13,7 @@ export function classMap(classInfo, forceString) {
|
|
|
12
13
|
const result = Object.keys(classInfo)
|
|
13
14
|
.filter((className) => classInfo[className])
|
|
14
15
|
.join(' ');
|
|
15
|
-
return serverUnsafeHTML(result);
|
|
16
|
+
return serverUnsafeHTML(result).string;
|
|
16
17
|
}
|
|
17
18
|
export function unsafeHTML(input) {
|
|
18
19
|
const { getType } = getTemplateRenderingStrategy();
|
|
@@ -38,11 +39,19 @@ export function ref(ref) {
|
|
|
38
39
|
export function correctColor(color, attr) {
|
|
39
40
|
return ref((el) => {
|
|
40
41
|
if (isHTMLElement(el)) {
|
|
41
|
-
if (color
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
if (
|
|
45
|
-
|
|
42
|
+
if (color) {
|
|
43
|
+
const computedColor = getComputedColor(el.shadowRoot, color) ||
|
|
44
|
+
getComputedColor(el.shadowRoot, `var(--color-${color})`);
|
|
45
|
+
if (computedColor) {
|
|
46
|
+
if (el.style.getPropertyValue(attr) !== computedColor) {
|
|
47
|
+
el.style.setProperty(attr, computedColor);
|
|
48
|
+
if (el.style.getPropertyValue(attr) !== computedColor) {
|
|
49
|
+
// unset to ensure an old color doesn't stick around if the element was reused
|
|
50
|
+
el.style.setProperty(attr, '');
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
46
55
|
el.style.setProperty(attr, '');
|
|
47
56
|
}
|
|
48
57
|
}
|
|
@@ -104,3 +113,18 @@ export function resolveIcon(name) {
|
|
|
104
113
|
return html ``;
|
|
105
114
|
}
|
|
106
115
|
}
|
|
116
|
+
function getComputedColor(root, color) {
|
|
117
|
+
if (!color.startsWith('var(') && colorCache[color]) {
|
|
118
|
+
return colorCache[color];
|
|
119
|
+
}
|
|
120
|
+
const doc = root ?? document.body;
|
|
121
|
+
const div = document.createElement('div');
|
|
122
|
+
div.style.color = color;
|
|
123
|
+
doc.appendChild(div);
|
|
124
|
+
const computed = window.getComputedStyle(div).color;
|
|
125
|
+
doc.removeChild(div);
|
|
126
|
+
if (!color.startsWith('var(')) {
|
|
127
|
+
colorCache[color] = computed;
|
|
128
|
+
}
|
|
129
|
+
return computed;
|
|
130
|
+
}
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
2
10
|
import { html, LitElement } from 'lit';
|
|
3
11
|
import { customElement, property } from 'lit/decorators.js';
|
|
4
12
|
import { BlockAnimationType } from '@devvit/protos';
|
|
@@ -6,6 +6,7 @@ import type { ActorRef } from '@devvit/runtimes/common/runtime/ActorRef.js';
|
|
|
6
6
|
import { BrowserLiteClient } from '@devvit/runtime-lite/BrowserLiteClient.js';
|
|
7
7
|
import './devvit-animation-player.js';
|
|
8
8
|
import '../blocks/components/devvit-blocks-renderer.js';
|
|
9
|
+
import '../blocks/components/devvit-blocks-webview.js';
|
|
9
10
|
declare global {
|
|
10
11
|
interface HTMLElementTagNameMap {
|
|
11
12
|
'devvit-custom-post': DevvitCustomPost;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devvit-custom-post.d.ts","sourceRoot":"","sources":["../../library/src/client/devvit-custom-post.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,UAAU,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAIvD,OAAO,kEAAkE,CAAC;AAG1E,OAAO,KAAK,EAOV,YAAY,EACZ,QAAQ,EAIT,MAAM,gBAAgB,CA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