@devvit/ui-renderer 0.10.22-next-2024-05-30-0afee29bb.0 → 0.10.22-next-2024-05-30-f71f50a4b.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.
@@ -1,5 +1,5 @@
1
1
  import '@reddit/faceplate-ui/templateRenderingStrategy/clientStrategy.js';
2
- import type { Effect, LinkedBundle, Metadata, RealtimeEvent, UIEvent } from '@devvit/protos';
2
+ import type { Effect, LinkedBundle, Metadata, RealtimeEvent, UIEvent, UIResponse } from '@devvit/protos';
3
3
  import { UIDimensions } from '@devvit/protos';
4
4
  import { type WorkerErrorType } from '@devvit/runtime-lite/client/BrowserLiteClient.js';
5
5
  import type { FaceplateEvent } from '@reddit/faceplate/event-types.js';
@@ -70,6 +70,7 @@ export declare class DevvitSurface extends LitElement {
70
70
  /** Enabled the use of experimental blocks that are not production ready */
71
71
  useExperimentalBlocks: boolean;
72
72
  disableAssetSandbox: boolean;
73
+ renderResponse?: UIResponse;
73
74
  /** Width, height, and scale of this element, stays in sync as dimensions of element changes */
74
75
  dimensions?: UIDimensions;
75
76
  private _rootBlock?;
@@ -1 +1 @@
1
- {"version":3,"file":"devvit-surface.d.ts","sourceRoot":"","sources":["../../library/src/client/devvit-surface.ts"],"names":[],"mappings":"AAAA,OAAO,kEAAkE,CAAC;AAE1E,OAAO,KAAK,EAEV,MAAM,EACN,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,OAAO,EAER,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAyC,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACrF,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,kDAAkD,CAAC;AAExF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAC1C,OAAO,EAAQ,UAAU,EAAE,MAAM,KAAK,CAAC;AAKvC,OAAO,KAAK,EAAE,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G,SAAS,CAAC;IAKpE,4GAA4G;IAC5E,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAChE,mEAAmE;IACZ,YAAY,CAAC,EAAE,OAAO,CAAC;IAC9E,kDAAkD;IAElD,mBAAmB,EAAE,OAAO,CAAS;IACrC,4DAA4D;IACzB,MAAM,CAAC,EAAE,WAAW,CAAC;IACxD,2EAA2E;IAE3E,qBAAqB,EAAE,OAAO,CAAS;IAEvC,mBAAmB,EAAE,OAAO,CAAS;IACrC,cAAc,CAAC,EAAE,UAAU,CAAC;IAC5B,+FAA+F;IACtF,UAAU,CAAC,EAAE,YAAY,CAAC;IAE1B,OAAO,CAAC,UAAU,CAAC,CAAoB;;IAwBjC,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAiCxC,oBAAoB,IAAI,IAAI;cAYlB,MAAM;cAYA,UAAU,CAAC,KAAK,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAqGhF"}
@@ -80,6 +80,7 @@ let DevvitSurface = class DevvitSurface extends LitElement {
80
80
  // };
81
81
  _DevvitSurface_onRender.set(this, (response) => {
82
82
  var _a, _b;
83
+ this.renderResponse = response;
83
84
  if (response?.blocks) {
84
85
  this._rootBlock = response.blocks;
85
86
  if (!__classPrivateFieldGet(this, _DevvitSurface_rootHeight, "f")) {
@@ -11097,7 +11097,7 @@
11097
11097
  "format": "esm"
11098
11098
  },
11099
11099
  "library/src/client/devvit-surface.ts": {
11100
- "bytes": 10064,
11100
+ "bytes": 10132,
11101
11101
  "imports": [
11102
11102
  {
11103
11103
  "path": "../../node_modules/@reddit/faceplate-ui/templateRenderingStrategy/clientStrategy.js",
@@ -11178,7 +11178,7 @@
11178
11178
  "imports": [],
11179
11179
  "exports": [],
11180
11180
  "inputs": {},
11181
- "bytes": 12336656
11181
+ "bytes": 12336745
11182
11182
  },
11183
11183
  "dist/devvit-surface.min.js": {
11184
11184
  "imports": [
@@ -12072,10 +12072,10 @@
12072
12072
  "bytesInOutput": 1710
12073
12073
  },
12074
12074
  "library/src/client/devvit-surface.ts": {
12075
- "bytesInOutput": 3608
12075
+ "bytesInOutput": 3630
12076
12076
  }
12077
12077
  },
12078
- "bytes": 4442623
12078
+ "bytes": 4442645
12079
12079
  }
12080
12080
  }
12081
12081
  }
@@ -1453,7 +1453,7 @@ button inline-flex items-center justify-center`},OH=e=>{let{createElement:t}=Qn(
1453
1453
  style="${xk(i)}"
1454
1454
  class="max-w-100 max-h-100"
1455
1455
  light
1456
- ></dotlottie-player>`:td`<div>Unsupported animation format</div>`}};En([gr({type:String})],Xs.prototype,"src",2),En([gr({type:Number})],Xs.prototype,"imageWidth",2),En([gr({type:Number})],Xs.prototype,"imageHeight",2),En([gr({type:Boolean})],Xs.prototype,"autoplay",2),En([gr({type:Boolean})],Xs.prototype,"loop",2),En([gr({type:Number})],Xs.prototype,"loopMode",2),En([gr({type:Number})],Xs.prototype,"type",2),En([gr({type:Number})],Xs.prototype,"direction",2),En([gr({type:Number})],Xs.prototype,"speed",2),En([NH("#lottie",!1)],Xs.prototype,"$lottieAnimation",2),En([Q3()],Xs.prototype,"loopModeStr",2),En([Q3()],Xs.prototype,"directionNum",2),Xs=En([T2("devvit-animation-player")],Xs);var a3,o3,s3,ds,$b,Hb,kd=class extends Ed{constructor(){super();this.runtimeDebugLogging=!1;this.useExperimentalBlocks=!1;this.disableAssetSandbox=!1;Yn(this,a3,void 0);Yn(this,o3,void 0);Yn(this,s3,void 0);Yn(this,ds,void 0);Yn(this,$b,()=>({experimental:this.useExperimentalBlocks,onAction:i=>Ht(this,ds).submit([{userAction:{actionId:i.id,data:i.data??{}},hook:i.id}]),stackDirection:ln.UNRECOGNIZED,disableAssetSandbox:this.disableAssetSandbox}));Yn(this,Hb,i=>{var a,r;i?.blocks&&(this._rootBlock=i.blocks,Ht(this,a3)?((a=this._rootBlock).config??(a.config={}),(r=this._rootBlock.config).rootConfig??(r.rootConfig=Hc.fromPartial({})),this._rootBlock.config.rootConfig.height=Ht(this,a3)):_a(this,a3,this._rootBlock.config?.rootConfig?.height||Ox))});console.log("Using devvit-surface and KMP!"),_a(this,ds,new X8({},{colorScheme:this.scheme,dimensions:this.dimensions,locale:void 0,timezone:void 0}))}static get styles(){return[y8]}async connectedCallback(){super.connectedCallback(),Ht(this,ds).subscribe(i=>{Ht(this,Hb).call(this,{request:i.request,response:i.response})}),_a(this,o3,new ResizeObserver(MH(i=>{if(i.length===0)return;let a=i[0],{contentRect:{width:r,height:n}}=a,o=window.devicePixelRatio;this.dimensions={width:Math.round(r),height:Math.round(n),scale:o}},600))),Ht(this,o3).observe(this,{box:"content-box"}),_a(this,s3,new IntersectionObserver(i=>{i.forEach(a=>{Ht(this,ds).togglePause(!a.isIntersecting)})})),Ht(this,s3).observe(this)}disconnectedCallback(){Ht(this,o3)?.unobserve(this),Ht(this,o3)?.disconnect(),Ht(this,s3)?.unobserve(this),Ht(this,s3)?.disconnect(),Ht(this,ds)?.unsubscribe(),super.disconnectedCallback()}render(){return td`<div class="relative">
1456
+ ></dotlottie-player>`:td`<div>Unsupported animation format</div>`}};En([gr({type:String})],Xs.prototype,"src",2),En([gr({type:Number})],Xs.prototype,"imageWidth",2),En([gr({type:Number})],Xs.prototype,"imageHeight",2),En([gr({type:Boolean})],Xs.prototype,"autoplay",2),En([gr({type:Boolean})],Xs.prototype,"loop",2),En([gr({type:Number})],Xs.prototype,"loopMode",2),En([gr({type:Number})],Xs.prototype,"type",2),En([gr({type:Number})],Xs.prototype,"direction",2),En([gr({type:Number})],Xs.prototype,"speed",2),En([NH("#lottie",!1)],Xs.prototype,"$lottieAnimation",2),En([Q3()],Xs.prototype,"loopModeStr",2),En([Q3()],Xs.prototype,"directionNum",2),Xs=En([T2("devvit-animation-player")],Xs);var a3,o3,s3,ds,$b,Hb,kd=class extends Ed{constructor(){super();this.runtimeDebugLogging=!1;this.useExperimentalBlocks=!1;this.disableAssetSandbox=!1;Yn(this,a3,void 0);Yn(this,o3,void 0);Yn(this,s3,void 0);Yn(this,ds,void 0);Yn(this,$b,()=>({experimental:this.useExperimentalBlocks,onAction:i=>Ht(this,ds).submit([{userAction:{actionId:i.id,data:i.data??{}},hook:i.id}]),stackDirection:ln.UNRECOGNIZED,disableAssetSandbox:this.disableAssetSandbox}));Yn(this,Hb,i=>{var a,r;this.renderResponse=i,i?.blocks&&(this._rootBlock=i.blocks,Ht(this,a3)?((a=this._rootBlock).config??(a.config={}),(r=this._rootBlock.config).rootConfig??(r.rootConfig=Hc.fromPartial({})),this._rootBlock.config.rootConfig.height=Ht(this,a3)):_a(this,a3,this._rootBlock.config?.rootConfig?.height||Ox))});console.log("Using devvit-surface and KMP!"),_a(this,ds,new X8({},{colorScheme:this.scheme,dimensions:this.dimensions,locale:void 0,timezone:void 0}))}static get styles(){return[y8]}async connectedCallback(){super.connectedCallback(),Ht(this,ds).subscribe(i=>{Ht(this,Hb).call(this,{request:i.request,response:i.response})}),_a(this,o3,new ResizeObserver(MH(i=>{if(i.length===0)return;let a=i[0],{contentRect:{width:r,height:n}}=a,o=window.devicePixelRatio;this.dimensions={width:Math.round(r),height:Math.round(n),scale:o}},600))),Ht(this,o3).observe(this,{box:"content-box"}),_a(this,s3,new IntersectionObserver(i=>{i.forEach(a=>{Ht(this,ds).togglePause(!a.isIntersecting)})})),Ht(this,s3).observe(this)}disconnectedCallback(){Ht(this,o3)?.unobserve(this),Ht(this,o3)?.disconnect(),Ht(this,s3)?.unobserve(this),Ht(this,s3)?.disconnect(),Ht(this,ds)?.unsubscribe(),super.disconnectedCallback()}render(){return td`<div class="relative">
1457
1457
  <devvit-blocks-renderer
1458
1458
  class="${this.scheme??""}"
1459
1459
  .block="${this._rootBlock}"