@tinkerlandai/indiana-sdk 0.9.5 → 0.10.1
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/CHANGELOG.md +11 -0
- package/README.md +7 -18
- package/README.zh-CN.md +8 -6
- package/dist/{ai-usage-CUTIHAU0.d.ts → ai-usage-Cn7dhvFw.d.ts} +3 -3
- package/dist/{api-BXu6TAoB.d.ts → api-DC44FaTV.d.ts} +6354 -904
- package/dist/chunk-2Y4G5364.js +6 -0
- package/dist/{chunk-XSOEA4A5.js → chunk-ABNSU3ZG.js} +1 -1
- package/dist/chunk-ACF2FBUB.js +1 -0
- package/dist/{chunk-4C3HUZ3B.js → chunk-AHXYGGAA.js} +1 -1
- package/dist/{chunk-MKV726FV.js → chunk-CCPNMQHZ.js} +1 -1
- package/dist/chunk-EDQCH2QS.js +1 -0
- package/dist/chunk-IWWKVNEX.js +1 -0
- package/dist/{chunk-AOGPGUWE.js → chunk-QUWPPZHH.js} +1 -1
- package/dist/chunk-SBPTOOYB.js +1 -0
- package/dist/chunk-WYZI3TNB.js +1 -0
- package/dist/{chunk-M7JWCLYX.js → chunk-X6BCUINI.js} +1 -1
- package/dist/chunk-Y46ALAKP.js +1 -0
- package/dist/{configuration-sync-DuJl4SbM.d.ts → configuration-sync-CXe9Zcng.d.ts} +11 -11
- package/dist/{content-PQJYLAGQ.js → content-ZRWZ26PF.js} +1 -1
- package/dist/{funnel-local-client-BhHdi5_V.d.ts → funnel-local-client-BQsdOjQ7.d.ts} +18474 -2596
- package/dist/funnel-node-evaluation-P5B4fPfJ.d.ts +2054 -0
- package/dist/{funnel-resource-client-BoIhL_my.d.ts → funnel-resource-client-Zof1WLgA.d.ts} +5977 -1126
- package/dist/funnel-runtime-host-N7TX3LWI.js +1 -0
- package/dist/index.d.ts +9924 -1958
- package/dist/index.js +1 -1
- package/dist/openrouter.d.ts +3 -3
- package/dist/openrouter.js +1 -1
- package/dist/page.d.ts +3 -3
- package/dist/page.js +1 -1
- package/dist/paywall-DR65VN2G.js +1 -0
- package/dist/popup.d.ts +1 -1
- package/dist/popup.js +1 -1
- package/dist/react-native.d.ts +19930 -7179
- package/dist/react-native.js +1 -1
- package/dist/{screen-renderer-VAMWY7ID.js → screen-renderer-ZSAR7LPS.js} +1 -1
- package/dist/server.d.ts +2737 -573
- package/dist/server.js +1 -1
- package/dist/visual.d.ts +1 -1
- package/dist/visual.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-5ZWSFE2C.js +0 -1
- package/dist/chunk-HEGNIATD.js +0 -1
- package/dist/chunk-LMO3FXRT.js +0 -1
- package/dist/chunk-QYECMZJJ.js +0 -1
- package/dist/chunk-UBMPFTGE.js +0 -1
- package/dist/chunk-UWFYBRM2.js +0 -6
- package/dist/chunk-XRXI3DMZ.js +0 -1
- package/dist/funnel-node-evaluation-DuPmqIo1.d.ts +0 -998
- package/dist/funnel-runtime-host-3YUGXD3Y.js +0 -1
- package/dist/paywall-CSAGKPCP.js +0 -1
- package/dist/{screen-CvfI_L41.d.ts → screen-D81zCpfi.d.ts} +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as _,j as F}from"./chunk-
|
|
1
|
+
import{f as _,j as F}from"./chunk-X6BCUINI.js";import{b as q}from"./chunk-SSLZKIIU.js";import{L as U}from"./chunk-2Y4G5364.js";import{Y as P,ca as M,ja as z,ka as N,qa as d}from"./chunk-ACF2FBUB.js";import{a as v}from"./chunk-DSPLGTQI.js";import"./chunk-G56XGVMS.js";import"./chunk-IWWKVNEX.js";import{a as O}from"./chunk-7DXL3LHT.js";import"./chunk-3PZ4Y6UD.js";import{z as p}from"zod";var V=new WeakMap;function Q(r){let t={string:p.string(),number:p.number().finite(),boolean:p.boolean(),strings:p.array(p.string()),json:O}[r.type];return r.nullable?t.nullable():t}async function ne(r,t){return W(r,t,!1)}async function re(r,t){return W(r,t,!0)}async function W(r,t,w){t.signal?.throwIfAborted();let T=U.parse(t.content),o=T.document;if(V.has(r))throw new d("CONFLICT","Content is already mounted in this container");let f=p.record(p.string(),O).parse(t.inputs??{});if(Object.keys(f).length>40)throw new d("INVALID_REQUEST","Too many content inputs");for(let[e,s]of Object.entries(f))z.parse({[e]:s});if(Object.keys(f).some(e=>!Object.hasOwn(o.contract.inputs,e)))throw new d("INVALID_REQUEST","Undeclared content input");for(let[e,s]of Object.entries(o.contract.inputs))if(Object.hasOwn(f,e))Q(s).parse(f[e]);else if(s.required)throw new d("INVALID_REQUEST",`Missing content input ${e}`);for(let e of Object.keys(o.contract.outputs))if(typeof t.actions[e]!="function")throw new d("INVALID_REQUEST",`Missing host handler for ${e}`);let $=N.parse(t.bindings??[]),a=r.ownerDocument,L,k=o.kind==="popup",n=k?a.createElement("dialog"):null,i=a.createElement("div");if(i.dataset.indianaContent=o.kind,i.setAttribute("aria-label",o.name),i.style.cssText="width:100%;min-width:0",n){n.setAttribute("aria-label",o.name);let e=o.screen.presentation;n.style.cssText="box-sizing:border-box;padding:0;border:0;max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);overflow:auto",e.type==="modal"||e.type==="sheet"?(n.style.width=`${P[e.size]}px`,e.type==="sheet"&&(n.style.margin="auto auto 0")):n.style.width="100vw",n.append(i),r.append(n)}else r.append(i);let c=!1,C=!1,g=!1;w&&!n&&(i.style.width=`${r.getBoundingClientRect().width||a.defaultView?.innerWidth||800}px`);let B=w?_(n??i):()=>{},H,x,A=new Promise((e,s)=>{H=e,x=s});A.catch(()=>{});let l=null,E=structuredClone(o.screen);E.actions=E.actions.map(e=>e.type==="event"?{...e,close:!1}:e);let b;function m(){c||(c=!0,t.signal?.removeEventListener("abort",m),x(new Error("Content preparation cancelled")),b?.destroy(),n?.close(),n?.remove(),i.remove(),V.delete(r),n&&L?.())}let S=()=>{g&&(m(),v(t.onDismiss))};if(n){let e=a.createElement("button");e.type="button",e.textContent="\xD7",e.setAttribute("aria-label",t.locale?.startsWith("zh")?"\u5173\u95ED":"Close"),e.style.cssText="position:absolute;right:8px;top:8px;width:30px;height:30px;z-index:1",e.addEventListener("click",S),n.prepend(e)}n?.addEventListener("cancel",e=>{e.preventDefault(),S()});async function D(){if(c||!g||C||!l)return;let e=l;C=!0,i.setAttribute("aria-busy","true");try{await t.actions[e.actionId](structuredClone(e)),l=null}catch(s){v(t.onError,s)}finally{C=!1,c||i.removeAttribute("aria-busy")}}function R(){if(c)throw new d("CONFLICT","Content host has been destroyed");g||(L=q(a),B(),w&&!n&&(i.style.width="100%"),n?.showModal(),g=!0)}try{w||R(),b=F(i,{mode:"live",title:o.name,viewportHeight:o.kind==="page"?r.clientHeight||a.defaultView?.innerHeight||800:void 0,onRendered:H,onError:u=>{let I=new Error(u);x(I),v(t.onError,I)},onEscape:k?S:void 0,onAction:(u,I,J)=>{if(c||!g||C||l)return;let h=o.screen.actions.find(y=>y.id===u),j=o.contract.outputs[u];if(!(h?.type!=="event"||!j))try{let y=Q(j).parse(Object.hasOwn(h.properties,"value")?h.properties.value:h.properties);l={requestId:crypto.randomUUID(),contentVersionId:T.id,actionId:u,event:h.event,value:y,selection:I??{},answers:J??{},requestedClose:h.close},D()}catch(y){v(t.onError,y)}}});let e={destroy:m,show:R,get pendingAction(){return l?structuredClone(l):null},retryAction:D,updateCapabilities:u=>b?.updateCapabilities(u)};V.set(r,e),t.signal?.addEventListener("abort",m,{once:!0}),t.signal?.aborted&&(m(),t.signal.throwIfAborted());let s=M(E,[t.locale,...a.defaultView?.navigator.languages??[]]);if(b.update(E,s,{capabilities:t.capabilities,serverInput:{bindings:$,answers:{},values:f}}),await Promise.race([b.ready,A]),w&&await A,c)throw new Error("Content preparation cancelled");return e}catch(e){throw m(),e}}export{ne as mountContent,re as prepareContent};
|