@stacksjs/stx 0.2.605 → 0.2.607
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/dist/{chunk-38mt83wa.js → chunk-06wv8qwy.js} +6 -6
- package/dist/{chunk-sqq6kpve.js → chunk-0cb00ys2.js} +6 -6
- package/dist/chunk-0d6b3eeb.js +2 -0
- package/dist/chunk-0mgth7cm.js +2 -0
- package/dist/{chunk-9cgga2aw.js → chunk-0v89nfz1.js} +2 -2
- package/dist/{chunk-813wwkap.js → chunk-1dd4qefr.js} +2 -2
- package/dist/chunk-1fdrhfc0.js +2 -0
- package/dist/{chunk-htcptqtn.js → chunk-1jxdkp8x.js} +6 -6
- package/dist/{chunk-6eg9a3mt.js → chunk-20k77e2a.js} +4 -4
- package/dist/chunk-2n59ahd9.js +2 -0
- package/dist/chunk-2pwjnydp.js +2 -0
- package/dist/chunk-2r4an7bh.js +2 -0
- package/dist/chunk-304vaxnk.js +2 -0
- package/dist/chunk-32hr3qq7.js +2 -0
- package/dist/chunk-36n8yz6t.js +2 -0
- package/dist/chunk-39pgf5z3.js +2 -0
- package/dist/chunk-3xwzd9wp.js +2845 -0
- package/dist/chunk-3yttgk0s.js +2 -0
- package/dist/chunk-4ck2xc8m.js +2 -0
- package/dist/chunk-4jasfhh6.js +2 -0
- package/dist/chunk-4szajb1z.js +2 -0
- package/dist/{chunk-axz1x4r9.js → chunk-4tj0ap61.js} +5 -5
- package/dist/{chunk-9nt3q23a.js → chunk-53y4z4p2.js} +3 -3
- package/dist/{chunk-j1dmkt29.js → chunk-5e182xqt.js} +1 -1
- package/dist/{chunk-afnj003j.js → chunk-5j29466h.js} +2 -2
- package/dist/{chunk-67m2prah.js → chunk-5s47qfp6.js} +2 -2
- package/dist/{chunk-h5cgm4hy.js → chunk-60wedefh.js} +2 -2
- package/dist/chunk-61ztfana.js +127 -0
- package/dist/{chunk-1944jgb2.js → chunk-67tpacz0.js} +1 -1
- package/dist/{chunk-9h1ytsgm.js → chunk-6by8dtan.js} +2 -2
- package/dist/{chunk-k71e38fk.js → chunk-6xsm53pz.js} +4 -4
- package/dist/{chunk-tc3ne706.js → chunk-7095f0hb.js} +9 -9
- package/dist/{chunk-jg8w43n0.js → chunk-77kpsnf6.js} +39 -39
- package/dist/{chunk-f49nnf8v.js → chunk-79edpvb2.js} +6 -6
- package/dist/chunk-7f63z4xx.js +2 -0
- package/dist/chunk-7renf4zp.js +2 -0
- package/dist/{chunk-9wtb959p.js → chunk-81qmj3sd.js} +7 -7
- package/dist/chunk-8bzx0r0x.js +2 -0
- package/dist/{chunk-dnnc0m92.js → chunk-8fq6bvnw.js} +13 -13
- package/dist/chunk-974dxazw.js +2 -0
- package/dist/chunk-9fpnnfr3.js +2 -0
- package/dist/chunk-9sgt7v77.js +2 -0
- package/dist/chunk-9zzhpp2a.js +2 -0
- package/dist/chunk-aan7601v.js +2 -0
- package/dist/{chunk-h8a8y1wh.js → chunk-aestp72s.js} +2 -2
- package/dist/{chunk-tt1p6zt8.js → chunk-azpkje69.js} +4 -4
- package/dist/chunk-b4tbqz8r.js +2 -0
- package/dist/chunk-bakxqwnz.js +2 -0
- package/dist/chunk-be2kmw0p.js +2 -0
- package/dist/{chunk-48s1nprc.js → chunk-bhf9yt2w.js} +2 -2
- package/dist/chunk-bnpb6ez9.js +2 -0
- package/dist/{chunk-btbdp4fg.js → chunk-bspryr4a.js} +5 -5
- package/dist/{chunk-jtq8e3b0.js → chunk-bsy8v1xj.js} +2 -2
- package/dist/{chunk-fkh9zshs.js → chunk-c48mh4d6.js} +5 -5
- package/dist/{chunk-x7epxhsz.js → chunk-c65q0svd.js} +5 -5
- package/dist/{chunk-zrw1zf54.js → chunk-cfpenvc7.js} +3 -3
- package/dist/{chunk-rc7wmbnz.js → chunk-cp901m61.js} +1 -1
- package/dist/{chunk-4st1qw62.js → chunk-dmdhbwmn.js} +3 -3
- package/dist/{chunk-t19th11m.js → chunk-dnqq1ze0.js} +3 -3
- package/dist/{chunk-279b1228.js → chunk-dxqwm8tr.js} +3 -3
- package/dist/chunk-dzbkgsv8.js +4 -0
- package/dist/{chunk-bfbmdjh4.js → chunk-efy3038a.js} +2 -2
- package/dist/{chunk-gbe53zv3.js → chunk-ev6w9c69.js} +1 -1
- package/dist/chunk-ewkza45r.js +2 -0
- package/dist/chunk-exd1h9sd.js +2 -0
- package/dist/chunk-fcgf8d5k.js +2 -0
- package/dist/{chunk-kty4k2jq.js → chunk-g04y5wyn.js} +3 -3
- package/dist/chunk-g63ye3fe.js +3 -0
- package/dist/{chunk-9x4r15mv.js → chunk-ghdyqt98.js} +2 -2
- package/dist/chunk-gw2dvp35.js +2 -0
- package/dist/chunk-h9drxwva.js +2 -0
- package/dist/chunk-hrr7k1qc.js +2 -0
- package/dist/chunk-j04brkj0.js +2 -0
- package/dist/chunk-jbvwg4gs.js +2 -0
- package/dist/{chunk-wkxzzdzs.js → chunk-jpxekhdh.js} +3 -3
- package/dist/chunk-jshj69dy.js +2 -0
- package/dist/{chunk-y09g63k0.js → chunk-jsktg3ab.js} +5 -5
- package/dist/{chunk-zvs13kgh.js → chunk-k3f4044e.js} +2 -2
- package/dist/chunk-k4wkfhvz.js +2 -0
- package/dist/chunk-km9a5gp4.js +2 -0
- package/dist/{chunk-4h58as2c.js → chunk-kxjd6e2h.js} +2 -2
- package/dist/{chunk-nb0ytx70.js → chunk-m95zjk91.js} +2 -2
- package/dist/{chunk-h7atbtds.js → chunk-m9h7pmkh.js} +5 -5
- package/dist/chunk-mgj0ngyq.js +2 -0
- package/dist/{chunk-8s7zbhdd.js → chunk-mvwcf4xy.js} +4 -4
- package/dist/chunk-myqhdz1w.js +2 -0
- package/dist/chunk-n35yc890.js +3 -0
- package/dist/chunk-n39ezmxz.js +2 -0
- package/dist/chunk-n8eavnxf.js +2 -0
- package/dist/chunk-p8sv5fqs.js +2 -0
- package/dist/chunk-pghtgep5.js +2 -0
- package/dist/chunk-pt7e0be5.js +2 -0
- package/dist/chunk-q40ahbjs.js +2 -0
- package/dist/{chunk-gzpxvca7.js → chunk-qh07a85k.js} +3 -3
- package/dist/chunk-qjxxhdv7.js +2 -0
- package/dist/{chunk-18ws9heh.js → chunk-r4h8fg1x.js} +1 -1
- package/dist/{chunk-tnafnb23.js → chunk-r69jfs59.js} +1 -1
- package/dist/{chunk-82bttwqm.js → chunk-rmv35cx0.js} +2 -2
- package/dist/chunk-rp93n4z7.js +3 -0
- package/dist/chunk-rrw2jg26.js +2 -0
- package/dist/chunk-rxja040z.js +2 -0
- package/dist/{chunk-tds3d65g.js → chunk-s4pjf2pc.js} +2 -2
- package/dist/{chunk-b3c1gggs.js → chunk-sswjv8p9.js} +2 -2
- package/dist/chunk-sx0qbekt.js +2 -0
- package/dist/chunk-t83acmv2.js +2 -0
- package/dist/{chunk-bsy10tz6.js → chunk-t9t66sz4.js} +6 -6
- package/dist/{chunk-pb7vste8.js → chunk-tbsjg23k.js} +4 -4
- package/dist/chunk-tc176d93.js +2 -0
- package/dist/{chunk-q6h6yjg4.js → chunk-tcd2zez3.js} +2 -2
- package/dist/{chunk-f17rcvdb.js → chunk-td30jg06.js} +2 -2
- package/dist/{chunk-qf39z0hg.js → chunk-td5100fz.js} +7 -7
- package/dist/{chunk-navkh35g.js → chunk-tfjcs55e.js} +3 -3
- package/dist/{chunk-a8n6mt7s.js → chunk-tydv84gj.js} +2 -2
- package/dist/{chunk-hsy9rhct.js → chunk-vehtypx0.js} +2 -2
- package/dist/{chunk-y3wdf7v7.js → chunk-vntpfbwy.js} +1 -1
- package/dist/{chunk-25zpd110.js → chunk-vp3fzjsc.js} +2 -2
- package/dist/{chunk-q1cvef6b.js → chunk-vw62fjpv.js} +3 -3
- package/dist/{chunk-shnsvsg4.js → chunk-w8g2ppnr.js} +2 -2
- package/dist/chunk-wjhhb6dn.js +2 -0
- package/dist/chunk-wm8w2721.js +2 -0
- package/dist/{chunk-v3dnfv5g.js → chunk-wqmm1qsz.js} +5 -5
- package/dist/chunk-wtax276j.js +2 -0
- package/dist/{chunk-g6ew2drc.js → chunk-wy53pys4.js} +5 -5
- package/dist/{chunk-v8ze2q95.js → chunk-wzjf33es.js} +2 -2
- package/dist/chunk-x49qdt4c.js +2 -0
- package/dist/{chunk-gh181dnr.js → chunk-x8q5przn.js} +10 -10
- package/dist/{chunk-vn6h03nq.js → chunk-xjxc4q3w.js} +27 -27
- package/dist/chunk-y0zyzbjf.js +2 -0
- package/dist/{chunk-kx52xt96.js → chunk-y54fz9rk.js} +2 -2
- package/dist/{chunk-y0qjpcc8.js → chunk-yzj55rfs.js} +3 -3
- package/dist/{chunk-hrv206vt.js → chunk-z2xrwmjr.js} +10 -10
- package/dist/{chunk-hz11wmx9.js → chunk-z8fhtym2.js} +2 -2
- package/dist/chunk-z8mdsjzw.js +2 -0
- package/dist/chunk-zg87pybq.js +2 -0
- package/dist/chunk-zq345s76.js +2 -0
- package/dist/chunk-zs3ezqy3.js +2 -0
- package/dist/cli.js +20 -20
- package/dist/component-renderer.js +62 -9
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/expressions.js +7 -1
- package/dist/native/accessibility.d.ts +12 -0
- package/dist/native/accessibility.js +19 -0
- package/dist/native/compiler/headwind-to-style.js +23 -29
- package/dist/native/compiler/html-to-ir.js +18 -7
- package/dist/native/compiler/inline-style.d.ts +7 -0
- package/dist/native/compiler/inline-style.js +8 -1
- package/dist/native/compiler/ir.d.ts +4 -2
- package/dist/native/compiler/render-screen.js +1 -1
- package/dist/native/components/primitives.d.ts +49 -25
- package/dist/native/components/primitives.js +1 -0
- package/dist/native/event-names.js +1 -0
- package/dist/native/index.d.ts +1 -0
- package/dist/native/primitives/Link.stx +5 -0
- package/dist/native/prop-names.js +9 -1
- package/dist/native/runtime/binding-tree.js +2 -1
- package/dist/native/runtime/browser-renderer.js +63 -4
- package/dist/native/runtime/craft-bridge.js +8 -2
- package/dist/native/runtime/craft.d.ts +4 -0
- package/dist/native/runtime/native-host.js +20 -14
- package/dist/native/runtime/overlay-presenter.d.ts +2 -0
- package/dist/native/runtime/overlay-presenter.js +10 -5
- package/dist/native/runtime/view-operations.d.ts +1 -1
- package/dist/native/runtime/view-operations.js +5 -1
- package/dist/pwa.js +3 -3
- package/dist/server-bindings.js +5 -2
- package/dist/slot-scopes.d.ts +7 -0
- package/dist/slot-scopes.js +19 -0
- package/dist/slots.js +23 -7
- package/dist/ssg.js +12 -12
- package/dist/stx-virtual-ts.js +6 -5
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/package.json +5 -5
- package/dist/chunk-04gt67sv.js +0 -2
- package/dist/chunk-0hpw65yr.js +0 -2
- package/dist/chunk-0jsg0z9j.js +0 -127
- package/dist/chunk-122y2fkw.js +0 -3
- package/dist/chunk-138zjhwa.js +0 -2
- package/dist/chunk-1548a62z.js +0 -2
- package/dist/chunk-214w9gst.js +0 -2
- package/dist/chunk-2c7ysn9s.js +0 -2
- package/dist/chunk-2h99p36p.js +0 -2
- package/dist/chunk-2qt63502.js +0 -2
- package/dist/chunk-2rzcy4yg.js +0 -2
- package/dist/chunk-2wb1w0p6.js +0 -2
- package/dist/chunk-3q312svf.js +0 -2
- package/dist/chunk-5ajbkx0a.js +0 -2
- package/dist/chunk-6djvj6hg.js +0 -2
- package/dist/chunk-6kmqb08x.js +0 -2
- package/dist/chunk-7dkwf9h5.js +0 -2
- package/dist/chunk-8992smwz.js +0 -2
- package/dist/chunk-9j6hk72q.js +0 -2
- package/dist/chunk-9nct3gsy.js +0 -2
- package/dist/chunk-a2pd13yw.js +0 -2
- package/dist/chunk-acm2tym9.js +0 -2
- package/dist/chunk-atqnvmea.js +0 -2845
- package/dist/chunk-ax5t83f4.js +0 -2
- package/dist/chunk-bc8rzjnh.js +0 -2
- package/dist/chunk-bvczk7xr.js +0 -2
- package/dist/chunk-c88e6w5r.js +0 -2
- package/dist/chunk-ce2d0hz9.js +0 -2
- package/dist/chunk-cg3vfr6b.js +0 -2
- package/dist/chunk-d81h4mxd.js +0 -2
- package/dist/chunk-dgtxj56t.js +0 -3
- package/dist/chunk-ej1erz2c.js +0 -2
- package/dist/chunk-eqa0wdv9.js +0 -4
- package/dist/chunk-erb1bc49.js +0 -2
- package/dist/chunk-esj49jvz.js +0 -2
- package/dist/chunk-ffykng6w.js +0 -2
- package/dist/chunk-fwt5fh5w.js +0 -2
- package/dist/chunk-gqm3w433.js +0 -2
- package/dist/chunk-hhwnd24n.js +0 -2
- package/dist/chunk-hjh1a3ga.js +0 -2
- package/dist/chunk-hq4mtcp0.js +0 -2
- package/dist/chunk-jhswy523.js +0 -2
- package/dist/chunk-jyqanvwp.js +0 -2
- package/dist/chunk-k229zdjh.js +0 -2
- package/dist/chunk-khdvzjzd.js +0 -2
- package/dist/chunk-knngjd2r.js +0 -2
- package/dist/chunk-makn68zy.js +0 -2
- package/dist/chunk-mnwf9yde.js +0 -2
- package/dist/chunk-n06xznty.js +0 -2
- package/dist/chunk-n633zv27.js +0 -3
- package/dist/chunk-nzpthbe1.js +0 -2
- package/dist/chunk-p973efbe.js +0 -2
- package/dist/chunk-pyj4ashw.js +0 -2
- package/dist/chunk-qhxf7pxh.js +0 -2
- package/dist/chunk-qjmqp5z7.js +0 -2
- package/dist/chunk-qq59xzwc.js +0 -2
- package/dist/chunk-r0e743c3.js +0 -2
- package/dist/chunk-shzesarq.js +0 -2
- package/dist/chunk-tcddr6dx.js +0 -2
- package/dist/chunk-v4gepwh9.js +0 -2
- package/dist/chunk-wn2gzwmv.js +0 -2
- package/dist/chunk-wr6gw263.js +0 -2
- package/dist/chunk-xfe2nzxd.js +0 -2
- package/dist/chunk-xjwgzp6s.js +0 -2
- package/dist/chunk-y6909jm7.js +0 -2
- package/dist/chunk-zfrpjaxw.js +0 -2
package/dist/craft-entry.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{ss,Go,Ko}from"./chunk-53y4z4p2.js";import"./chunk-06wv8qwy.js";import"./chunk-wzjf33es.js";import"./chunk-azpkje69.js";import"./chunk-sswjv8p9.js";import"./chunk-bsy8v1xj.js";import"./chunk-3xwzd9wp.js";import"./chunk-x8q5przn.js";import"./chunk-td5100fz.js";import"./chunk-bhf9yt2w.js";import"./chunk-1dd4qefr.js";import"./chunk-rmv35cx0.js";import"./chunk-6xsm53pz.js";import"./chunk-yzj55rfs.js";import{ju,Fo,Bu,Fu,zo,rs,Ho,zu,Vo,Hu,Vu,Uo,Wo,qo}from"./chunk-8fq6bvnw.js";import"./chunk-c48mh4d6.js";import"./chunk-dnqq1ze0.js";var m=new Map,d=new Map;function R(t,e){let n=e?.id||E(t),r=I(t),a=m.get(n);if(a&&a.hash===r)return a;let i=M(t),s=L(t),o=W(t),c=O(i),{staticParts:p,dynamicParts:l}=A(i),f=_(t),g={id:n,hash:r,tree:i,scripts:s,styles:o,staticParts:p,dynamicParts:l,dependencies:f,metadata:c};return m.set(n,g),g}async function Q(t,e={},n={}){let r=performance.now();if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`,c=d.get(o);if(c&&Date.now()-c.timestamp<(n.cacheTTL||60000))return{html:c.html,styles:t.styles.join(`
|
|
3
3
|
`),scripts:t.scripts.join(`
|
|
4
4
|
`),metadata:{renderTime:0,cacheHit:!0,totalSize:c.html.length,componentCount:t.metadata.componentCount}}}let a;if(n.streaming)a=await H(t.tree,e);else a=h(t.tree,e);let i;if(n.hydrate){let o=j(a,t,e);a=o.html,i=o.data}if(n.minify)a=D(a);if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`;d.set(o,{html:a,timestamp:Date.now()})}let s=performance.now()-r;return{html:a,styles:t.styles.join(`
|
|
5
5
|
`),scripts:t.scripts.join(`
|
|
6
6
|
`),hydrationData:i,metadata:{renderTime:s,cacheHit:!1,totalSize:a.length,componentCount:t.metadata.componentCount}}}function V(t,e){let n=[],r=[],a=[],i=new Map,s=[];return y(t.tree,(o,c)=>{if(o.type==="component"&&o.componentName){if(T(o.componentName))n.push(o.componentName)}if(o.type==="element"&&o.tag){let p=J(o);if(p)s.push(p);if(o.props){for(let[l,f]of Object.entries(o.props))if(l.startsWith("on")&&typeof f==="string"){let g=`handler_${i.size}`;i.set(g,f)}}}if(o.isStatic&&o.type==="element")r.push(b(o));else if(!o.isStatic&&o.type!=="text")a.push(o.tag||o.componentName||"unknown")}),{nativeComponents:n,staticHTML:r,dynamicParts:a,eventHandlers:i,nativeWidgets:s}}function Y(t,e={}){let n=R(t),r=P(n,e),a=new Map,i=[];return y(n.tree,(s)=>{if(s.type==="component"&&s.componentName){if(T(s.componentName)){i.push(s.componentName);let o=`<!--craft:${s.componentName}:${s.hydrationKey||"default"}-->`;a.set(s.hydrationKey||s.componentName,o)}}}),{staticHTML:r,dynamicPlaceholders:a,craftComponents:i}}function M(t){let e={type:"fragment",children:[]},n=e,r=[e],a=t,i=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);while(a.length>0){let s=a.match(/^<(@?[\w-]+)([^>]*)>/);if(s){let[p,l,f]=s,g=z(f),u=l.startsWith("@craft-"),C=u?l:l.toLowerCase(),S={type:u?"component":"element",tag:C,props:g,children:[],componentName:u?C.slice(1):void 0,isStatic:!v(f),hydrationKey:F()};if(n.children=n.children||[],n.children.push(S),!i.has(C)&&!f.endsWith("/"))r.push(S),n=S;a=a.slice(p.length);continue}let o=a.match(/^<\/(@?[\w-]+)>/);if(o){let[p,l]=o,g=l.startsWith("@craft-")?l:l.toLowerCase();while(r.length>1){let u=r.pop();if(n=r[r.length-1],u.tag===g)break}a=a.slice(p.length);continue}let c=a.match(/^[^<]+/);if(c){let p=c[0];if(p.trim()){let l={type:"text",text:p,isStatic:!v(p)};n.children=n.children||[],n.children.push(l)}a=a.slice(p.length);continue}a=a.slice(1)}return e}function z(t){let e={},n=/([\w-:@]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S+)))?/g,r;while((r=n.exec(t))!==null){let[,a,i,s,o]=r,c=i??s??o??!0;e[a]=c}return e}function y(t,e,n=[]){if(e(t,n),t.children)t.children.forEach((r,a)=>{y(r,e,[...n,`${a}`])})}function h(t,e){switch(t.type){case"text":return x(t.text||"",e);case"element":case"component":{let n=t.tag||"div",r=N(t.props||{},e),a=(t.children||[]).map((i)=>h(i,e)).join("");if(!t.children||t.children.length===0){if(["input","br","hr","img","meta","link"].includes(n))return`<${n}${r} />`}return`<${n}${r}>${a}</${n}>`}case"fragment":return(t.children||[]).map((n)=>h(n,e)).join("");case"slot":return`<!--slot:${t.slotName||"default"}-->`;default:return""}}function b(t){if(t.type==="text")return t.text||"";let e=t.tag||"div",n=N(t.props||{},{});return`<${e}${n}></${e}>`}function N(t,e){let n=[];for(let[r,a]of Object.entries(t))if(a===!0)n.push(` ${r}`);else if(a!==!1&&a!==null&&a!==void 0){let i=x(String(a),e);n.push(` ${r}="${k(i)}"`)}return n.join("")}async function H(t,e){return h(t,e)}function P(t,e){let n=[];return y(t.tree,(r)=>{if(r.isStatic)n.push(h(r,e))}),n.join("")}function j(t,e,n){let r={templateId:e.id,context:n,dynamicParts:Array.from(e.dynamicParts.entries())},a=`
|
|
7
7
|
<script data-craft-hydration>
|
|
8
8
|
window.__CRAFT_HYDRATION__ = ${JSON.stringify(r)};
|
|
9
|
-
</script>`;return{html:t+a,data:r}}function O(t){let e=!1,n=!1,r=!1,a=!1,i=0,s=0;function o(c,p){if(s=Math.max(s,p),c.type==="slot")e=!0;if(c.type==="component")i++;if(!c.isStatic)n=!0;if(c.props)for(let l of Object.keys(c.props)){if(l.startsWith("on"))r=!0;if(l==="@async"||l==="data-async")a=!0}if(c.children)c.children.forEach((l)=>o(l,p+1))}return o(t,0),{hasSlots:e,hasDynamicContent:n,hasEventHandlers:r,hasAsyncContent:a,componentCount:i,maxDepth:s,estimatedSize:JSON.stringify(t).length}}function A(t){let e=new Map,n=new Map;return y(t,(r,a)=>{let i=a.join(".");if(r.isStatic)e.set(i,b(r));else n.set(i,r.tag||r.componentName||"dynamic")}),{staticParts:e,dynamicParts:n}}function L(t){let e=[],n=/<script[^>]*>([\s\S]*?)<\/script>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function W(t){let e=[],n=/<style[^>]*>([\s\S]*?)<\/style>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function _(t){let e=[],n=/@include\s*\(\s*['"]([^'"]+)['"]/g,r;while((r=n.exec(t))!==null)e.push(r[1]);let a=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((r=a.exec(t))!==null)e.push(r[1]);let i=/<@craft-[\w-]+/g;while((r=i.exec(t))!==null)e.push(r[0].slice(2));return[...new Set(e)]}function v(t){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test(t)}function x(t,e){let n=t.replace(/\{\{\s*(.+?)\s*\}\}/g,(r,a)=>{try{let i=w(a.trim(),e);return k(String(i??""))}catch{return""}});return n=n.replace(/\{!!\s*(.+?)\s*!!\}/g,(r,a)=>{try{let i=w(a.trim(),e);return String(i??"")}catch{return""}}),n}function w(t,e){if(/^[\w.]+$/.test(t)){let n=t.split("."),r=e;for(let a of n)if(r&&typeof r==="object"&&a in r)r=r[a];else return;return r}try{return Function(...Object.keys(e),`return ${t}`)(...Object.values(e))}catch{return}}function k(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function D(t){return t.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function E(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return`tpl_${Math.abs(e).toString(36)}`}function I(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return Math.abs(e).toString(36)}var K=0;function F(){return`h_${++K}`}function T(t){return["craft-button","craft-text-input","craft-textarea","craft-checkbox","craft-radio","craft-select","craft-slider","craft-toggle","craft-date-picker","craft-time-picker","craft-color-picker","craft-file-input","craft-modal","craft-alert","craft-toast","craft-progress","craft-spinner","craft-avatar","craft-badge","craft-card","craft-accordion","craft-tabs","craft-tooltip","craft-popover","craft-dropdown","craft-context-menu","craft-data-table","craft-virtual-list","craft-tree-view","craft-map","craft-chart","craft-video","craft-audio","craft-webview","craft-canvas","craft-image-viewer","craft-pdf-viewer","craft-code-editor","craft-rich-editor"].includes(t)}function J(t){let e=t.tag?.toLowerCase(),n=t.props?.type,r={button:{component:"craft-button",confidence:0.95,reason:"Native button provides better touch feedback"},"input:text":{component:"craft-text-input",confidence:0.9,reason:"Native text input has better keyboard handling"},"input:checkbox":{component:"craft-checkbox",confidence:0.95,reason:"Native checkbox follows platform conventions"},"input:range":{component:"craft-slider",confidence:0.9,reason:"Native slider provides smooth interaction"},"input:date":{component:"craft-date-picker",confidence:0.95,reason:"Native date picker provides platform-specific UI"},"input:time":{component:"craft-time-picker",confidence:0.95,reason:"Native time picker provides platform-specific UI"},"input:color":{component:"craft-color-picker",confidence:0.9,reason:"Native color picker provides platform-specific UI"},textarea:{component:"craft-textarea",confidence:0.85,reason:"Native textarea handles multiline input better"},select:{component:"craft-select",confidence:0.9,reason:"Native select provides platform dropdown UI"},progress:{component:"craft-progress",confidence:0.95,reason:"Native progress bar matches platform style"},video:{component:"craft-video",confidence:0.95,reason:"Native video provides hardware acceleration"},audio:{component:"craft-audio",confidence:0.95,reason:"Native audio provides system integration"},dialog:{component:"craft-modal",confidence:0.9,reason:"Native modal provides proper layering and focus"}},a=n?`${e}:${n}`:e,i=r[a||""]||r[e||""];if(i)return{htmlSelector:a||e||"",nativeComponent:i.component,confidence:i.confidence,reason:i.reason};return null}function U(){m.clear()}function q(){d.clear()}function B(){U(),q()}function G(){return{templateCacheSize:m.size,renderCacheSize:d.size,totalEntries:m.size+d.size}}export{
|
|
9
|
+
</script>`;return{html:t+a,data:r}}function O(t){let e=!1,n=!1,r=!1,a=!1,i=0,s=0;function o(c,p){if(s=Math.max(s,p),c.type==="slot")e=!0;if(c.type==="component")i++;if(!c.isStatic)n=!0;if(c.props)for(let l of Object.keys(c.props)){if(l.startsWith("on"))r=!0;if(l==="@async"||l==="data-async")a=!0}if(c.children)c.children.forEach((l)=>o(l,p+1))}return o(t,0),{hasSlots:e,hasDynamicContent:n,hasEventHandlers:r,hasAsyncContent:a,componentCount:i,maxDepth:s,estimatedSize:JSON.stringify(t).length}}function A(t){let e=new Map,n=new Map;return y(t,(r,a)=>{let i=a.join(".");if(r.isStatic)e.set(i,b(r));else n.set(i,r.tag||r.componentName||"dynamic")}),{staticParts:e,dynamicParts:n}}function L(t){let e=[],n=/<script[^>]*>([\s\S]*?)<\/script>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function W(t){let e=[],n=/<style[^>]*>([\s\S]*?)<\/style>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function _(t){let e=[],n=/@include\s*\(\s*['"]([^'"]+)['"]/g,r;while((r=n.exec(t))!==null)e.push(r[1]);let a=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((r=a.exec(t))!==null)e.push(r[1]);let i=/<@craft-[\w-]+/g;while((r=i.exec(t))!==null)e.push(r[0].slice(2));return[...new Set(e)]}function v(t){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test(t)}function x(t,e){let n=t.replace(/\{\{\s*(.+?)\s*\}\}/g,(r,a)=>{try{let i=w(a.trim(),e);return k(String(i??""))}catch{return""}});return n=n.replace(/\{!!\s*(.+?)\s*!!\}/g,(r,a)=>{try{let i=w(a.trim(),e);return String(i??"")}catch{return""}}),n}function w(t,e){if(/^[\w.]+$/.test(t)){let n=t.split("."),r=e;for(let a of n)if(r&&typeof r==="object"&&a in r)r=r[a];else return;return r}try{return Function(...Object.keys(e),`return ${t}`)(...Object.values(e))}catch{return}}function k(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function D(t){return t.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function E(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return`tpl_${Math.abs(e).toString(36)}`}function I(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return Math.abs(e).toString(36)}var K=0;function F(){return`h_${++K}`}function T(t){return["craft-button","craft-text-input","craft-textarea","craft-checkbox","craft-radio","craft-select","craft-slider","craft-toggle","craft-date-picker","craft-time-picker","craft-color-picker","craft-file-input","craft-modal","craft-alert","craft-toast","craft-progress","craft-spinner","craft-avatar","craft-badge","craft-card","craft-accordion","craft-tabs","craft-tooltip","craft-popover","craft-dropdown","craft-context-menu","craft-data-table","craft-virtual-list","craft-tree-view","craft-map","craft-chart","craft-video","craft-audio","craft-webview","craft-canvas","craft-image-viewer","craft-pdf-viewer","craft-code-editor","craft-rich-editor"].includes(t)}function J(t){let e=t.tag?.toLowerCase(),n=t.props?.type,r={button:{component:"craft-button",confidence:0.95,reason:"Native button provides better touch feedback"},"input:text":{component:"craft-text-input",confidence:0.9,reason:"Native text input has better keyboard handling"},"input:checkbox":{component:"craft-checkbox",confidence:0.95,reason:"Native checkbox follows platform conventions"},"input:range":{component:"craft-slider",confidence:0.9,reason:"Native slider provides smooth interaction"},"input:date":{component:"craft-date-picker",confidence:0.95,reason:"Native date picker provides platform-specific UI"},"input:time":{component:"craft-time-picker",confidence:0.95,reason:"Native time picker provides platform-specific UI"},"input:color":{component:"craft-color-picker",confidence:0.9,reason:"Native color picker provides platform-specific UI"},textarea:{component:"craft-textarea",confidence:0.85,reason:"Native textarea handles multiline input better"},select:{component:"craft-select",confidence:0.9,reason:"Native select provides platform dropdown UI"},progress:{component:"craft-progress",confidence:0.95,reason:"Native progress bar matches platform style"},video:{component:"craft-video",confidence:0.95,reason:"Native video provides hardware acceleration"},audio:{component:"craft-audio",confidence:0.95,reason:"Native audio provides system integration"},dialog:{component:"craft-modal",confidence:0.9,reason:"Native modal provides proper layering and focus"}},a=n?`${e}:${n}`:e,i=r[a||""]||r[e||""];if(i)return{htmlSelector:a||e||"",nativeComponent:i.component,confidence:i.confidence,reason:i.reason};return null}function U(){m.clear()}function q(){d.clear()}function B(){U(),q()}function G(){return{templateCacheSize:m.size,renderCacheSize:d.size,totalEntries:m.size+d.size}}export{ju as CRAFT_BRIDGE_SCRIPT,rs as CRAFT_COMPONENTS,zu as CRAFT_COMPONENT_RUNTIME,Ho as CRAFT_COMPONENT_STYLES,ss as NATIVE_COMPONENTS,Uo as buildNative,B as clearAllCaches,q as clearRenderCache,U as clearTemplateCache,R as compileTemplate,Go as compileToNative,Ko as createHotReloadServer,Fo as generateCraftBridgeScript,V as generateCraftOptimizations,qo as getAvailableFormats,Wo as getAvailableTargets,Vu as getCraftComponents,G as getSSRCacheStats,zo as injectCraftBridge,Bu as isCraftEnvironment,Y as prerenderForCraft,Vo as processCraftComponents,Fu as processCraftDirective,Hu as registerCraftComponent,Q as renderSSR};
|
package/dist/craft.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{ss,Go,Ko}from"./chunk-53y4z4p2.js";import"./chunk-06wv8qwy.js";import"./chunk-wzjf33es.js";import"./chunk-azpkje69.js";import"./chunk-sswjv8p9.js";import"./chunk-bsy8v1xj.js";import"./chunk-3xwzd9wp.js";import"./chunk-x8q5przn.js";import"./chunk-td5100fz.js";import"./chunk-bhf9yt2w.js";import"./chunk-1dd4qefr.js";import"./chunk-rmv35cx0.js";import"./chunk-6xsm53pz.js";import"./chunk-yzj55rfs.js";import{ju,Fo,Bu,Fu,zo,rs,Ho,zu,Vo,Hu,Vu,Uo,Wo,qo}from"./chunk-8fq6bvnw.js";import"./chunk-c48mh4d6.js";import"./chunk-dnqq1ze0.js";var m=new Map,d=new Map;function R(t,e){let n=e?.id||E(t),r=I(t),a=m.get(n);if(a&&a.hash===r)return a;let i=M(t),s=L(t),o=W(t),c=O(i),{staticParts:p,dynamicParts:l}=A(i),f=_(t),g={id:n,hash:r,tree:i,scripts:s,styles:o,staticParts:p,dynamicParts:l,dependencies:f,metadata:c};return m.set(n,g),g}async function Q(t,e={},n={}){let r=performance.now();if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`,c=d.get(o);if(c&&Date.now()-c.timestamp<(n.cacheTTL||60000))return{html:c.html,styles:t.styles.join(`
|
|
3
3
|
`),scripts:t.scripts.join(`
|
|
4
4
|
`),metadata:{renderTime:0,cacheHit:!0,totalSize:c.html.length,componentCount:t.metadata.componentCount}}}let a;if(n.streaming)a=await H(t.tree,e);else a=h(t.tree,e);let i;if(n.hydrate){let o=j(a,t,e);a=o.html,i=o.data}if(n.minify)a=D(a);if(n.cache){let o=`${t.id}:${JSON.stringify(e)}`;d.set(o,{html:a,timestamp:Date.now()})}let s=performance.now()-r;return{html:a,styles:t.styles.join(`
|
|
5
5
|
`),scripts:t.scripts.join(`
|
|
6
6
|
`),hydrationData:i,metadata:{renderTime:s,cacheHit:!1,totalSize:a.length,componentCount:t.metadata.componentCount}}}function V(t,e){let n=[],r=[],a=[],i=new Map,s=[];return y(t.tree,(o,c)=>{if(o.type==="component"&&o.componentName){if(T(o.componentName))n.push(o.componentName)}if(o.type==="element"&&o.tag){let p=J(o);if(p)s.push(p);if(o.props){for(let[l,f]of Object.entries(o.props))if(l.startsWith("on")&&typeof f==="string"){let g=`handler_${i.size}`;i.set(g,f)}}}if(o.isStatic&&o.type==="element")r.push(b(o));else if(!o.isStatic&&o.type!=="text")a.push(o.tag||o.componentName||"unknown")}),{nativeComponents:n,staticHTML:r,dynamicParts:a,eventHandlers:i,nativeWidgets:s}}function Y(t,e={}){let n=R(t),r=P(n,e),a=new Map,i=[];return y(n.tree,(s)=>{if(s.type==="component"&&s.componentName){if(T(s.componentName)){i.push(s.componentName);let o=`<!--craft:${s.componentName}:${s.hydrationKey||"default"}-->`;a.set(s.hydrationKey||s.componentName,o)}}}),{staticHTML:r,dynamicPlaceholders:a,craftComponents:i}}function M(t){let e={type:"fragment",children:[]},n=e,r=[e],a=t,i=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);while(a.length>0){let s=a.match(/^<(@?[\w-]+)([^>]*)>/);if(s){let[p,l,f]=s,g=z(f),u=l.startsWith("@craft-"),C=u?l:l.toLowerCase(),S={type:u?"component":"element",tag:C,props:g,children:[],componentName:u?C.slice(1):void 0,isStatic:!v(f),hydrationKey:F()};if(n.children=n.children||[],n.children.push(S),!i.has(C)&&!f.endsWith("/"))r.push(S),n=S;a=a.slice(p.length);continue}let o=a.match(/^<\/(@?[\w-]+)>/);if(o){let[p,l]=o,g=l.startsWith("@craft-")?l:l.toLowerCase();while(r.length>1){let u=r.pop();if(n=r[r.length-1],u.tag===g)break}a=a.slice(p.length);continue}let c=a.match(/^[^<]+/);if(c){let p=c[0];if(p.trim()){let l={type:"text",text:p,isStatic:!v(p)};n.children=n.children||[],n.children.push(l)}a=a.slice(p.length);continue}a=a.slice(1)}return e}function z(t){let e={},n=/([\w-:@]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S+)))?/g,r;while((r=n.exec(t))!==null){let[,a,i,s,o]=r,c=i??s??o??!0;e[a]=c}return e}function y(t,e,n=[]){if(e(t,n),t.children)t.children.forEach((r,a)=>{y(r,e,[...n,`${a}`])})}function h(t,e){switch(t.type){case"text":return x(t.text||"",e);case"element":case"component":{let n=t.tag||"div",r=N(t.props||{},e),a=(t.children||[]).map((i)=>h(i,e)).join("");if(!t.children||t.children.length===0){if(["input","br","hr","img","meta","link"].includes(n))return`<${n}${r} />`}return`<${n}${r}>${a}</${n}>`}case"fragment":return(t.children||[]).map((n)=>h(n,e)).join("");case"slot":return`<!--slot:${t.slotName||"default"}-->`;default:return""}}function b(t){if(t.type==="text")return t.text||"";let e=t.tag||"div",n=N(t.props||{},{});return`<${e}${n}></${e}>`}function N(t,e){let n=[];for(let[r,a]of Object.entries(t))if(a===!0)n.push(` ${r}`);else if(a!==!1&&a!==null&&a!==void 0){let i=x(String(a),e);n.push(` ${r}="${k(i)}"`)}return n.join("")}async function H(t,e){return h(t,e)}function P(t,e){let n=[];return y(t.tree,(r)=>{if(r.isStatic)n.push(h(r,e))}),n.join("")}function j(t,e,n){let r={templateId:e.id,context:n,dynamicParts:Array.from(e.dynamicParts.entries())},a=`
|
|
7
7
|
<script data-craft-hydration>
|
|
8
8
|
window.__CRAFT_HYDRATION__ = ${JSON.stringify(r)};
|
|
9
|
-
</script>`;return{html:t+a,data:r}}function O(t){let e=!1,n=!1,r=!1,a=!1,i=0,s=0;function o(c,p){if(s=Math.max(s,p),c.type==="slot")e=!0;if(c.type==="component")i++;if(!c.isStatic)n=!0;if(c.props)for(let l of Object.keys(c.props)){if(l.startsWith("on"))r=!0;if(l==="@async"||l==="data-async")a=!0}if(c.children)c.children.forEach((l)=>o(l,p+1))}return o(t,0),{hasSlots:e,hasDynamicContent:n,hasEventHandlers:r,hasAsyncContent:a,componentCount:i,maxDepth:s,estimatedSize:JSON.stringify(t).length}}function A(t){let e=new Map,n=new Map;return y(t,(r,a)=>{let i=a.join(".");if(r.isStatic)e.set(i,b(r));else n.set(i,r.tag||r.componentName||"dynamic")}),{staticParts:e,dynamicParts:n}}function L(t){let e=[],n=/<script[^>]*>([\s\S]*?)<\/script>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function W(t){let e=[],n=/<style[^>]*>([\s\S]*?)<\/style>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function _(t){let e=[],n=/@include\s*\(\s*['"]([^'"]+)['"]/g,r;while((r=n.exec(t))!==null)e.push(r[1]);let a=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((r=a.exec(t))!==null)e.push(r[1]);let i=/<@craft-[\w-]+/g;while((r=i.exec(t))!==null)e.push(r[0].slice(2));return[...new Set(e)]}function v(t){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test(t)}function x(t,e){let n=t.replace(/\{\{\s*(.+?)\s*\}\}/g,(r,a)=>{try{let i=w(a.trim(),e);return k(String(i??""))}catch{return""}});return n=n.replace(/\{!!\s*(.+?)\s*!!\}/g,(r,a)=>{try{let i=w(a.trim(),e);return String(i??"")}catch{return""}}),n}function w(t,e){if(/^[\w.]+$/.test(t)){let n=t.split("."),r=e;for(let a of n)if(r&&typeof r==="object"&&a in r)r=r[a];else return;return r}try{return Function(...Object.keys(e),`return ${t}`)(...Object.values(e))}catch{return}}function k(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function D(t){return t.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function E(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return`tpl_${Math.abs(e).toString(36)}`}function I(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return Math.abs(e).toString(36)}var K=0;function F(){return`h_${++K}`}function T(t){return["craft-button","craft-text-input","craft-textarea","craft-checkbox","craft-radio","craft-select","craft-slider","craft-toggle","craft-date-picker","craft-time-picker","craft-color-picker","craft-file-input","craft-modal","craft-alert","craft-toast","craft-progress","craft-spinner","craft-avatar","craft-badge","craft-card","craft-accordion","craft-tabs","craft-tooltip","craft-popover","craft-dropdown","craft-context-menu","craft-data-table","craft-virtual-list","craft-tree-view","craft-map","craft-chart","craft-video","craft-audio","craft-webview","craft-canvas","craft-image-viewer","craft-pdf-viewer","craft-code-editor","craft-rich-editor"].includes(t)}function J(t){let e=t.tag?.toLowerCase(),n=t.props?.type,r={button:{component:"craft-button",confidence:0.95,reason:"Native button provides better touch feedback"},"input:text":{component:"craft-text-input",confidence:0.9,reason:"Native text input has better keyboard handling"},"input:checkbox":{component:"craft-checkbox",confidence:0.95,reason:"Native checkbox follows platform conventions"},"input:range":{component:"craft-slider",confidence:0.9,reason:"Native slider provides smooth interaction"},"input:date":{component:"craft-date-picker",confidence:0.95,reason:"Native date picker provides platform-specific UI"},"input:time":{component:"craft-time-picker",confidence:0.95,reason:"Native time picker provides platform-specific UI"},"input:color":{component:"craft-color-picker",confidence:0.9,reason:"Native color picker provides platform-specific UI"},textarea:{component:"craft-textarea",confidence:0.85,reason:"Native textarea handles multiline input better"},select:{component:"craft-select",confidence:0.9,reason:"Native select provides platform dropdown UI"},progress:{component:"craft-progress",confidence:0.95,reason:"Native progress bar matches platform style"},video:{component:"craft-video",confidence:0.95,reason:"Native video provides hardware acceleration"},audio:{component:"craft-audio",confidence:0.95,reason:"Native audio provides system integration"},dialog:{component:"craft-modal",confidence:0.9,reason:"Native modal provides proper layering and focus"}},a=n?`${e}:${n}`:e,i=r[a||""]||r[e||""];if(i)return{htmlSelector:a||e||"",nativeComponent:i.component,confidence:i.confidence,reason:i.reason};return null}function U(){m.clear()}function q(){d.clear()}function B(){U(),q()}function G(){return{templateCacheSize:m.size,renderCacheSize:d.size,totalEntries:m.size+d.size}}export{
|
|
9
|
+
</script>`;return{html:t+a,data:r}}function O(t){let e=!1,n=!1,r=!1,a=!1,i=0,s=0;function o(c,p){if(s=Math.max(s,p),c.type==="slot")e=!0;if(c.type==="component")i++;if(!c.isStatic)n=!0;if(c.props)for(let l of Object.keys(c.props)){if(l.startsWith("on"))r=!0;if(l==="@async"||l==="data-async")a=!0}if(c.children)c.children.forEach((l)=>o(l,p+1))}return o(t,0),{hasSlots:e,hasDynamicContent:n,hasEventHandlers:r,hasAsyncContent:a,componentCount:i,maxDepth:s,estimatedSize:JSON.stringify(t).length}}function A(t){let e=new Map,n=new Map;return y(t,(r,a)=>{let i=a.join(".");if(r.isStatic)e.set(i,b(r));else n.set(i,r.tag||r.componentName||"dynamic")}),{staticParts:e,dynamicParts:n}}function L(t){let e=[],n=/<script[^>]*>([\s\S]*?)<\/script>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function W(t){let e=[],n=/<style[^>]*>([\s\S]*?)<\/style>/gi,r;while((r=n.exec(t))!==null)e.push(r[1]);return e}function _(t){let e=[],n=/@include\s*\(\s*['"]([^'"]+)['"]/g,r;while((r=n.exec(t))!==null)e.push(r[1]);let a=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((r=a.exec(t))!==null)e.push(r[1]);let i=/<@craft-[\w-]+/g;while((r=i.exec(t))!==null)e.push(r[0].slice(2));return[...new Set(e)]}function v(t){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test(t)}function x(t,e){let n=t.replace(/\{\{\s*(.+?)\s*\}\}/g,(r,a)=>{try{let i=w(a.trim(),e);return k(String(i??""))}catch{return""}});return n=n.replace(/\{!!\s*(.+?)\s*!!\}/g,(r,a)=>{try{let i=w(a.trim(),e);return String(i??"")}catch{return""}}),n}function w(t,e){if(/^[\w.]+$/.test(t)){let n=t.split("."),r=e;for(let a of n)if(r&&typeof r==="object"&&a in r)r=r[a];else return;return r}try{return Function(...Object.keys(e),`return ${t}`)(...Object.values(e))}catch{return}}function k(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function D(t){return t.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function E(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return`tpl_${Math.abs(e).toString(36)}`}function I(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return Math.abs(e).toString(36)}var K=0;function F(){return`h_${++K}`}function T(t){return["craft-button","craft-text-input","craft-textarea","craft-checkbox","craft-radio","craft-select","craft-slider","craft-toggle","craft-date-picker","craft-time-picker","craft-color-picker","craft-file-input","craft-modal","craft-alert","craft-toast","craft-progress","craft-spinner","craft-avatar","craft-badge","craft-card","craft-accordion","craft-tabs","craft-tooltip","craft-popover","craft-dropdown","craft-context-menu","craft-data-table","craft-virtual-list","craft-tree-view","craft-map","craft-chart","craft-video","craft-audio","craft-webview","craft-canvas","craft-image-viewer","craft-pdf-viewer","craft-code-editor","craft-rich-editor"].includes(t)}function J(t){let e=t.tag?.toLowerCase(),n=t.props?.type,r={button:{component:"craft-button",confidence:0.95,reason:"Native button provides better touch feedback"},"input:text":{component:"craft-text-input",confidence:0.9,reason:"Native text input has better keyboard handling"},"input:checkbox":{component:"craft-checkbox",confidence:0.95,reason:"Native checkbox follows platform conventions"},"input:range":{component:"craft-slider",confidence:0.9,reason:"Native slider provides smooth interaction"},"input:date":{component:"craft-date-picker",confidence:0.95,reason:"Native date picker provides platform-specific UI"},"input:time":{component:"craft-time-picker",confidence:0.95,reason:"Native time picker provides platform-specific UI"},"input:color":{component:"craft-color-picker",confidence:0.9,reason:"Native color picker provides platform-specific UI"},textarea:{component:"craft-textarea",confidence:0.85,reason:"Native textarea handles multiline input better"},select:{component:"craft-select",confidence:0.9,reason:"Native select provides platform dropdown UI"},progress:{component:"craft-progress",confidence:0.95,reason:"Native progress bar matches platform style"},video:{component:"craft-video",confidence:0.95,reason:"Native video provides hardware acceleration"},audio:{component:"craft-audio",confidence:0.95,reason:"Native audio provides system integration"},dialog:{component:"craft-modal",confidence:0.9,reason:"Native modal provides proper layering and focus"}},a=n?`${e}:${n}`:e,i=r[a||""]||r[e||""];if(i)return{htmlSelector:a||e||"",nativeComponent:i.component,confidence:i.confidence,reason:i.reason};return null}function U(){m.clear()}function q(){d.clear()}function B(){U(),q()}function G(){return{templateCacheSize:m.size,renderCacheSize:d.size,totalEntries:m.size+d.size}}export{ju as CRAFT_BRIDGE_SCRIPT,rs as CRAFT_COMPONENTS,zu as CRAFT_COMPONENT_RUNTIME,Ho as CRAFT_COMPONENT_STYLES,ss as NATIVE_COMPONENTS,Uo as buildNative,B as clearAllCaches,q as clearRenderCache,U as clearTemplateCache,R as compileTemplate,Go as compileToNative,Ko as createHotReloadServer,Fo as generateCraftBridgeScript,V as generateCraftOptimizations,qo as getAvailableFormats,Wo as getAvailableTargets,Vu as getCraftComponents,G as getSSRCacheStats,zo as injectCraftBridge,Bu as isCraftEnvironment,Y as prerenderForCraft,Vo as processCraftComponents,Fu as processCraftDirective,Hu as registerCraftComponent,Q as renderSSR};
|
package/dist/expressions.js
CHANGED
|
@@ -10,6 +10,7 @@ import { isDangerousUrl, sanitizeSubstitutedUrl, schemeWindow, UNSAFE_URL_PREFIX
|
|
|
10
10
|
import { maskAtElementPosition, matchScriptElement, matchStyleElement, restoreStashedScripts, stashScriptElements } from "./html-masking.js";
|
|
11
11
|
import { importsSignalDeclarations } from "./imported-signals.js";
|
|
12
12
|
import { inheritedClientLoopNames, loopBoundNames, readsAnyName } from "./loop-binding.js";
|
|
13
|
+
import { collectSlotScopes } from "./slot-scopes.js";
|
|
13
14
|
const customFilters = {}, translateRegexCache = new Map;
|
|
14
15
|
function getTranslateRegex(key) {
|
|
15
16
|
let re = translateRegexCache.get(key);
|
|
@@ -589,9 +590,14 @@ export function processExpressions(template, context, filePath) {
|
|
|
589
590
|
});
|
|
590
591
|
output = maskInto(output, matchScriptElement, scriptBlocks, (n) => `<!--__STX_SCRIPT_EXPR_${n}__-->`);
|
|
591
592
|
output = maskInto(output, styleMatcher, styleBlocks, (n) => `<!--__STX_STYLE_${n}__-->`);
|
|
592
|
-
const loopScopes = hasSignals ? clientLoopScopes(output) : [],
|
|
593
|
+
const loopScopes = hasSignals ? clientLoopScopes(output) : [], slotScopes = collectSlotScopes(output).map((scope) => ({
|
|
594
|
+
...scope,
|
|
595
|
+
names: new Set(loopBoundNames(`${scope.binding} in __slot`))
|
|
596
|
+
})), enclosingLoopNames = new Set(inheritedClientLoopNames(context));
|
|
593
597
|
output = replaceInterpolations(output, (match, expr, offset) => {
|
|
594
598
|
const trimmedExpr = expr.trim();
|
|
599
|
+
if (readsEnclosingLoopVariable(slotScopes, offset, trimmedExpr))
|
|
600
|
+
return match;
|
|
595
601
|
if (readsAnyName(trimmedExpr, enclosingLoopNames))
|
|
596
602
|
return match;
|
|
597
603
|
if (loopScopes.length > 0 && readsEnclosingLoopVariable(loopScopes, offset, trimmedExpr))
|
|
@@ -16,3 +16,15 @@ export declare function accessibilityPatch(name: string, value: unknown, props:
|
|
|
16
16
|
* `accessibilityState` keeps its keys while ARIA fills in the rest.
|
|
17
17
|
*/
|
|
18
18
|
export declare function applyStaticAccessibility(props: Record<string, unknown>): void;
|
|
19
|
+
/**
|
|
20
|
+
* Keep authored props separate from this projection: an ARIA attribute may
|
|
21
|
+
* disappear later, and explicit native props must still take precedence.
|
|
22
|
+
* Reuse the compiler's role/state vocabulary rather than a second mapping.
|
|
23
|
+
*/
|
|
24
|
+
export declare function projectAccessibility(props: Record<string, unknown>): Record<string, unknown>;
|
|
25
|
+
/** Patch derived fields including removals; native prop patches merge by key. */
|
|
26
|
+
export declare function accessibilityChanges(props: Record<string, unknown>, before: Record<string, unknown>, changedField: string): Record<string, unknown>;
|
|
27
|
+
/** Recover authored native fields from compiler IR before reactive updates. */
|
|
28
|
+
export declare function authoredAccessibilityProps(props: Record<string, unknown>, source?: Record<string, unknown>): Record<string, unknown>;
|
|
29
|
+
/** Fields derived from web semantics at the native transport boundary. */
|
|
30
|
+
export declare const ACCESSIBILITY_FIELDS: readonly ['accessibilityLabel', 'accessibilityRole', 'accessibilityState', 'accessibilityValue'];
|
|
@@ -87,3 +87,22 @@ export function applyStaticAccessibility(props) {
|
|
|
87
87
|
if (state)
|
|
88
88
|
props.accessibilityState = { ...state, ...authoredState };
|
|
89
89
|
}
|
|
90
|
+
export const ACCESSIBILITY_FIELDS = ["accessibilityLabel", "accessibilityRole", "accessibilityState", "accessibilityValue"];
|
|
91
|
+
export function projectAccessibility(props) {
|
|
92
|
+
const projected = { ...props };
|
|
93
|
+
applyStaticAccessibility(projected);
|
|
94
|
+
return Object.fromEntries(ACCESSIBILITY_FIELDS.filter((name) => (name in projected)).map((name) => [name, projected[name]]));
|
|
95
|
+
}
|
|
96
|
+
export function accessibilityChanges(props, before, changedField) {
|
|
97
|
+
const projected = projectAccessibility(props);
|
|
98
|
+
return Object.fromEntries(ACCESSIBILITY_FIELDS.filter((name) => name === changedField || JSON.stringify(before[name]) !== JSON.stringify(projected[name])).map((name) => [name, projected[name] ?? null]));
|
|
99
|
+
}
|
|
100
|
+
export function authoredAccessibilityProps(props, source) {
|
|
101
|
+
const result = { ...props };
|
|
102
|
+
if (source) {
|
|
103
|
+
for (const name of ACCESSIBILITY_FIELDS)
|
|
104
|
+
delete result[name];
|
|
105
|
+
Object.assign(result, source);
|
|
106
|
+
}
|
|
107
|
+
return result;
|
|
108
|
+
}
|
|
@@ -1010,37 +1010,31 @@ function parseBorderRadius(className, style) {
|
|
|
1010
1010
|
return !0;
|
|
1011
1011
|
}
|
|
1012
1012
|
function parseBorderWidth(className, style) {
|
|
1013
|
-
|
|
1013
|
+
const match = /^border(?:-([trblxy]))?(?:-(\d+|\[[^\]]+\]))?$/.exec(className);
|
|
1014
|
+
if (!match)
|
|
1014
1015
|
return !1;
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
return !0;
|
|
1023
|
-
}
|
|
1024
|
-
const sideMatch = className.match(/^border-(t|r|b|l)-?(\d*)$/);
|
|
1025
|
-
if (sideMatch) {
|
|
1026
|
-
const [, side, width] = sideMatch, w = width ? Number.parseInt(width) : 1;
|
|
1027
|
-
switch (side) {
|
|
1028
|
-
case "t":
|
|
1029
|
-
style.borderTopWidth = w;
|
|
1030
|
-
break;
|
|
1031
|
-
case "r":
|
|
1032
|
-
style.borderRightWidth = w;
|
|
1033
|
-
break;
|
|
1034
|
-
case "b":
|
|
1035
|
-
style.borderBottomWidth = w;
|
|
1036
|
-
break;
|
|
1037
|
-
case "l":
|
|
1038
|
-
style.borderLeftWidth = w;
|
|
1039
|
-
break;
|
|
1040
|
-
}
|
|
1041
|
-
return !0;
|
|
1016
|
+
const [, side = "", value] = match;
|
|
1017
|
+
let width = value === void 0 ? 1 : Number(value);
|
|
1018
|
+
if (value?.startsWith("[")) {
|
|
1019
|
+
const length = /^\[(\d+(?:\.\d+)?|\.\d+)(px|rem)?\]$/.exec(value);
|
|
1020
|
+
if (!length)
|
|
1021
|
+
return !1;
|
|
1022
|
+
width = Number(length[1]) * (length[2] === "rem" ? 16 : 1);
|
|
1042
1023
|
}
|
|
1043
|
-
|
|
1024
|
+
if (!Number.isFinite(width) || width < 0)
|
|
1025
|
+
return !1;
|
|
1026
|
+
const keys = {
|
|
1027
|
+
"": ["borderWidth"],
|
|
1028
|
+
t: ["borderTopWidth"],
|
|
1029
|
+
r: ["borderRightWidth"],
|
|
1030
|
+
b: ["borderBottomWidth"],
|
|
1031
|
+
l: ["borderLeftWidth"],
|
|
1032
|
+
x: ["borderLeftWidth", "borderRightWidth"],
|
|
1033
|
+
y: ["borderTopWidth", "borderBottomWidth"]
|
|
1034
|
+
};
|
|
1035
|
+
for (const key of keys[side])
|
|
1036
|
+
style[key] = width;
|
|
1037
|
+
return !0;
|
|
1044
1038
|
}
|
|
1045
1039
|
function parseBorderColor(className, style) {
|
|
1046
1040
|
if (!className.startsWith("border-"))
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { ACCESSIBILITY_FIELDS, projectAccessibility } from "../accessibility.js";
|
|
1
2
|
import { NATIVE_EVENT_NAMES as EVENT_NAMES } from "../event-names.js";
|
|
2
|
-
import { applyStaticAccessibility } from "../accessibility.js";
|
|
3
3
|
import { NATIVE_BOOLEAN_PROPS, nativePropName } from "../prop-names.js";
|
|
4
4
|
import { mapToNativeComponent } from "./component-mapping.js";
|
|
5
5
|
import { resolveIconName } from "./icons.js";
|
|
6
|
-
import { parseNativeStyle } from "./inline-style.js";
|
|
6
|
+
import { applyNativeLayoutDefaults, parseNativeStyle } from "./inline-style.js";
|
|
7
7
|
import { createStyleVariables } from "./style-variables.js";
|
|
8
8
|
import { extractStylesheetTheme } from "./stylesheet-theme.js";
|
|
9
9
|
import { parseViewBox, SVG_DROPPED, SVG_NODE_TYPES, SVG_TYPES, svgGeometry } from "./svg.js";
|
|
@@ -12,6 +12,7 @@ import { createDocument, createNode } from "./ir.js";
|
|
|
12
12
|
const DROP_SUBTREE = new Set(["script", "style", "head", "meta", "link", "title", "base", "noscript"]), UNWRAP = new Set(["template", "body", "html", "main", "fragment"]), BOX_ONLY = new Set;
|
|
13
13
|
export const NATIVE_EVENTS = new Set([
|
|
14
14
|
"onBlur",
|
|
15
|
+
"onChange",
|
|
15
16
|
"onChangeText",
|
|
16
17
|
"onDismiss",
|
|
17
18
|
"onEnd",
|
|
@@ -55,6 +56,7 @@ const NATIVE_TYPES = new Set([
|
|
|
55
56
|
"Text",
|
|
56
57
|
"TextInput",
|
|
57
58
|
"Button",
|
|
59
|
+
"Link",
|
|
58
60
|
"TouchableOpacity",
|
|
59
61
|
"TouchableHighlight",
|
|
60
62
|
"Pressable",
|
|
@@ -82,8 +84,7 @@ const NATIVE_TYPES = new Set([
|
|
|
82
84
|
["sections", "sections"],
|
|
83
85
|
["renderitem", "renderItem"],
|
|
84
86
|
["rendersectionheader", "renderSectionHeader"],
|
|
85
|
-
["keyextractor", "keyExtractor"]
|
|
86
|
-
["listrole", "listRole"]
|
|
87
|
+
["keyextractor", "keyExtractor"]
|
|
87
88
|
]), CONTAINER_TYPES = new Set(["View", "SafeAreaView", "ScrollView", "KeyboardAvoidingView"]), ENTITIES = {
|
|
88
89
|
amp: "&",
|
|
89
90
|
lt: "<",
|
|
@@ -156,7 +157,7 @@ function readAttributes(tag, attributes, diagnostics, styleContext = {}) {
|
|
|
156
157
|
const compiledClasses = classes ? compileClassStyles(classes, variables) : void 0;
|
|
157
158
|
for (const name of new Set(compiledClasses?.unknown ?? []))
|
|
158
159
|
diagnostics.push({ kind: "unknown-class", tag, name });
|
|
159
|
-
const style = { ...compiledClasses?.style, ...inline };
|
|
160
|
+
const style = applyNativeLayoutDefaults({ ...compiledClasses?.style, ...inline });
|
|
160
161
|
return { props, style, events, bindings, classes, inline };
|
|
161
162
|
}
|
|
162
163
|
function inlineStyle(tag, css, diagnostics, context) {
|
|
@@ -169,7 +170,7 @@ function settle(frame, diagnostics) {
|
|
|
169
170
|
const node = frame.node, elements = node.children.filter((child) => typeof child !== "string"), text = node.children.filter((child) => typeof child === "string").join("").trim();
|
|
170
171
|
if (frame.tag === "button" && node.type === "Button" && !frame.declaredNative && elements.length > 0) {
|
|
171
172
|
node.type = "Pressable";
|
|
172
|
-
node.props.
|
|
173
|
+
node.props.role ??= "button";
|
|
173
174
|
node.children = node.children.flatMap((child) => typeof child === "string" ? child.trim() ? [createNode("Text", {}, {}, {}, [child.trim()])] : [] : [child]);
|
|
174
175
|
return node;
|
|
175
176
|
}
|
|
@@ -318,7 +319,6 @@ export async function translateHtmlToIR(html, options = {}) {
|
|
|
318
319
|
if (names.has(lowerName))
|
|
319
320
|
diagnostics.push({ kind: "unsupported-list-prop", tag: type, name: publicName });
|
|
320
321
|
}
|
|
321
|
-
applyStaticAccessibility(props);
|
|
322
322
|
const node = createNode(type, props, style, events);
|
|
323
323
|
node._inlineStyle = inline;
|
|
324
324
|
node._styleSource = decodeEntities(attributes.find(([name]) => name === "style")?.[1] ?? "");
|
|
@@ -430,6 +430,17 @@ export async function translateHtmlToIR(html, options = {}) {
|
|
|
430
430
|
const root = roots.length === 1 ? roots[0] : createNode("View", {}, {}, {}, roots);
|
|
431
431
|
if (stylesheetTheme.light.length || stylesheetTheme.dark.length)
|
|
432
432
|
root._stylesheetTheme = stylesheetTheme;
|
|
433
|
+
const project = (node) => {
|
|
434
|
+
const projected = projectAccessibility(node.props);
|
|
435
|
+
if (Object.keys(projected).length) {
|
|
436
|
+
node._accessibilitySource = Object.fromEntries(ACCESSIBILITY_FIELDS.filter((name) => (name in node.props)).map((name) => [name, node.props[name]]));
|
|
437
|
+
Object.assign(node.props, projected);
|
|
438
|
+
}
|
|
439
|
+
for (const child of node.children)
|
|
440
|
+
if (typeof child !== "string")
|
|
441
|
+
project(child);
|
|
442
|
+
};
|
|
443
|
+
project(root);
|
|
433
444
|
return { root, diagnostics };
|
|
434
445
|
}
|
|
435
446
|
export async function translateHtmlToDocument(html, options = {}) {
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { type NativeStyleVariables } from './style-variables';
|
|
2
2
|
import type { STXStyle } from './ir';
|
|
3
|
+
/**
|
|
4
|
+
* CSS flex containers default to row; native stacks default to column.
|
|
5
|
+
* Apply only after all authored style layers have been combined: adding a
|
|
6
|
+
* default to an inline display declaration would override a class direction.
|
|
7
|
+
* Views without an explicit flex display retain the native stack default.
|
|
8
|
+
*/
|
|
9
|
+
export declare function applyNativeLayoutDefaults(style: STXStyle): STXStyle;
|
|
3
10
|
export declare function parseNativeStyle(input: unknown, report?: (diagnostic: NativeStyleDiagnostic) => void, context?: NativeStyleContext): STXStyle;
|
|
4
11
|
/** Resolve all same-element variable declarations before evaluating any style layer. */
|
|
5
12
|
export declare function parseNativeStyleLayers(inputs: unknown[], inheritedVariables: NativeStyleVariables | undefined, report: (diagnostic: NativeStyleDiagnostic) => void): { variables: NativeStyleVariables, styles: STXStyle[] };
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { createStyleVariables } from "./style-variables.js";
|
|
2
|
+
export function applyNativeLayoutDefaults(style) {
|
|
3
|
+
if (style.display === "flex" && style.flexDirection == null)
|
|
4
|
+
return { ...style, flexDirection: "row" };
|
|
5
|
+
return style;
|
|
6
|
+
}
|
|
2
7
|
const STYLE_KEYS = new Set([
|
|
3
8
|
"display",
|
|
4
9
|
"gridColumns",
|
|
@@ -265,7 +270,9 @@ function parseEntries(entries, variables, report) {
|
|
|
265
270
|
translated = numericValue(value);
|
|
266
271
|
if (!finite(translated) && !(DIMENSION_STYLE_KEYS.has(property) && typeof translated === "string" && translated.endsWith("%") && NUMBER.test(translated.slice(0, -1)) && Number.isFinite(Number(translated.slice(0, -1)))))
|
|
267
272
|
translated = void 0;
|
|
268
|
-
} else if (property === "
|
|
273
|
+
} else if (property === "display" && value === "inline-flex")
|
|
274
|
+
translated = "flex";
|
|
275
|
+
else if (property === "shadowOffset" || property === "transform")
|
|
269
276
|
translated = structuredStyle(property, value);
|
|
270
277
|
else if (property === "gridTemplateColumns" || property === "gridTemplateRows")
|
|
271
278
|
translated = finite(value) || typeof value === "string" ? value : void 0;
|
|
@@ -10,6 +10,7 @@ export declare interface STXNode {
|
|
|
10
10
|
bindingId?: number
|
|
11
11
|
key?: string
|
|
12
12
|
props: Record<string, unknown>
|
|
13
|
+
_accessibilitySource?: Record<string, unknown>
|
|
13
14
|
style: STXStyle
|
|
14
15
|
events: Record<string, string>
|
|
15
16
|
bindings?: Record<string, string>
|
|
@@ -56,7 +57,7 @@ export declare interface STXStyle {
|
|
|
56
57
|
justifyContent?: 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly'
|
|
57
58
|
alignItems?: 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline'
|
|
58
59
|
alignSelf?: 'auto' | 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline'
|
|
59
|
-
alignContent?: 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'space-between' | 'space-around'
|
|
60
|
+
alignContent?: 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'space-between' | 'space-around' | 'space-evenly'
|
|
60
61
|
position?: 'relative' | 'absolute'
|
|
61
62
|
top?: number | string
|
|
62
63
|
right?: number | string
|
|
@@ -129,7 +130,7 @@ export declare interface STXStyle {
|
|
|
129
130
|
textDecorationLine?: 'none' | 'underline' | 'line-through' | 'underline line-through'
|
|
130
131
|
textDecorationColor?: string
|
|
131
132
|
textTransform?: 'none' | 'uppercase' | 'lowercase' | 'capitalize'
|
|
132
|
-
resizeMode?: 'cover' | 'contain' | 'stretch' | 'center'
|
|
133
|
+
resizeMode?: 'cover' | 'contain' | 'stretch' | 'center'
|
|
133
134
|
tintColor?: string
|
|
134
135
|
transform?: Array<
|
|
135
136
|
| { perspective: number }
|
|
@@ -203,6 +204,7 @@ export type STXComponentType = | 'Sidebar'
|
|
|
203
204
|
| 'TextInput'
|
|
204
205
|
// Interactive
|
|
205
206
|
| 'Button'
|
|
207
|
+
| 'Link'
|
|
206
208
|
| 'TouchableOpacity'
|
|
207
209
|
| 'TouchableHighlight'
|
|
208
210
|
| 'Pressable'
|
|
@@ -25,7 +25,7 @@ export async function compileScreenSource(source, filePath, options = {}) {
|
|
|
25
25
|
buildMode: "serve",
|
|
26
26
|
cache: !1,
|
|
27
27
|
_targetComponentDirs: [nativePrimitivesDir()],
|
|
28
|
-
_targetComponentFallbackNames: ["Button"],
|
|
28
|
+
_targetComponentFallbackNames: ["Button", "Checkbox", "Switch"],
|
|
29
29
|
_nativeHostAttrs: !0,
|
|
30
30
|
skipEventDirectives: !0,
|
|
31
31
|
_pluginComponentDirs: loaded._pluginComponentDirs ?? []
|
|
@@ -8,6 +8,7 @@ export declare const ComponentRegistry: {
|
|
|
8
8
|
Text: 'Text';
|
|
9
9
|
TextInput: 'TextInput';
|
|
10
10
|
Button: 'Button';
|
|
11
|
+
Link: 'Link';
|
|
11
12
|
TouchableOpacity: 'TouchableOpacity';
|
|
12
13
|
TouchableHighlight: 'TouchableHighlight';
|
|
13
14
|
Pressable: 'Pressable';
|
|
@@ -40,9 +41,17 @@ export declare interface BaseProps {
|
|
|
40
41
|
testID?: string
|
|
41
42
|
accessibilityLabel?: string
|
|
42
43
|
accessibilityHint?: string
|
|
44
|
+
accessibilityValue?: string | number
|
|
45
|
+
accessibilityState?: AccessibilityState
|
|
43
46
|
accessibilityRole?: AccessibilityRole
|
|
47
|
+
listRole?: 'header' | 'item' | 'separator' | 'empty' | 'footer'
|
|
44
48
|
transitionID?: string
|
|
45
49
|
}
|
|
50
|
+
export declare interface AccessibilityState {
|
|
51
|
+
disabled?: boolean
|
|
52
|
+
selected?: boolean
|
|
53
|
+
checked?: boolean
|
|
54
|
+
}
|
|
46
55
|
// ============================================================================
|
|
47
56
|
// Layout Components
|
|
48
57
|
// ============================================================================
|
|
@@ -50,18 +59,20 @@ export declare interface ViewProps extends BaseProps {
|
|
|
50
59
|
onPress?: () => void
|
|
51
60
|
onLongPress?: () => void
|
|
52
61
|
onLayout?: (event: LayoutEvent) => void
|
|
53
|
-
pointerEvents?: 'auto' | 'none' | 'box-none' | 'box-only'
|
|
54
62
|
}
|
|
55
63
|
export declare interface ScrollViewProps extends ViewProps {
|
|
56
64
|
horizontal?: boolean
|
|
57
65
|
showsHorizontalScrollIndicator?: boolean
|
|
58
66
|
showsVerticalScrollIndicator?: boolean
|
|
59
67
|
bounces?: boolean
|
|
68
|
+
alwaysBounceHorizontal?: boolean
|
|
69
|
+
alwaysBounceVertical?: boolean
|
|
60
70
|
onScroll?: (event: ScrollEvent) => void
|
|
61
71
|
onScrollEndDrag?: () => void
|
|
62
72
|
onMomentumScrollEnd?: () => void
|
|
63
73
|
contentContainerStyle?: STXStyle
|
|
64
74
|
keyboardDismissMode?: 'none' | 'on-drag' | 'interactive'
|
|
75
|
+
keyboardShouldPersistTaps?: 'always' | 'handled' | 'never'
|
|
65
76
|
refreshControl?: RefreshControlProps
|
|
66
77
|
stickyHeaderIndices?: number[]
|
|
67
78
|
scrollTarget?: string | { id: string, key?: string | number, animated?: boolean } | null
|
|
@@ -91,9 +102,11 @@ export declare interface TextInputProps extends BaseProps {
|
|
|
91
102
|
placeholder?: string
|
|
92
103
|
placeholderTextColor?: string
|
|
93
104
|
onChangeText?: (text: string) => void
|
|
105
|
+
onChange?: (text: string) => void
|
|
94
106
|
onFocus?: () => void
|
|
95
107
|
onBlur?: () => void
|
|
96
108
|
onSubmitEditing?: () => void
|
|
109
|
+
onEndEditing?: () => void
|
|
97
110
|
keyboardType?: KeyboardType
|
|
98
111
|
returnKeyType?: ReturnKeyType
|
|
99
112
|
autoCapitalize?: 'none' | 'sentences' | 'words' | 'characters'
|
|
@@ -102,6 +115,7 @@ export declare interface TextInputProps extends BaseProps {
|
|
|
102
115
|
secureTextEntry?: boolean
|
|
103
116
|
maxLength?: number
|
|
104
117
|
multiline?: boolean
|
|
118
|
+
numberOfLines?: number
|
|
105
119
|
editable?: boolean
|
|
106
120
|
selectionColor?: string
|
|
107
121
|
textContentType?: string
|
|
@@ -117,6 +131,15 @@ export declare interface ButtonProps extends BaseProps {
|
|
|
117
131
|
disabled?: boolean
|
|
118
132
|
color?: string
|
|
119
133
|
}
|
|
134
|
+
/** An underlined navigation action. Craft resolves `href`/`to` in the host. */
|
|
135
|
+
export declare interface LinkProps extends BaseProps {
|
|
136
|
+
href?: string
|
|
137
|
+
to?: string
|
|
138
|
+
title?: string
|
|
139
|
+
onPress?: () => void
|
|
140
|
+
disabled?: boolean
|
|
141
|
+
color?: string
|
|
142
|
+
}
|
|
120
143
|
export declare interface TouchableOpacityProps extends ViewProps {
|
|
121
144
|
activeOpacity?: number
|
|
122
145
|
disabled?: boolean
|
|
@@ -132,17 +155,11 @@ export declare interface PressableProps extends ViewProps {
|
|
|
132
155
|
disabled?: boolean
|
|
133
156
|
onPressIn?: () => void
|
|
134
157
|
onPressOut?: () => void
|
|
135
|
-
hitSlop?: number | { top?: number; right?: number; bottom?: number; left?: number }
|
|
136
|
-
pressRetentionOffset?: number | { top?: number; right?: number; bottom?: number; left?: number }
|
|
137
|
-
android_ripple?: {
|
|
138
|
-
color?: string
|
|
139
|
-
borderless?: boolean
|
|
140
|
-
radius?: number
|
|
141
|
-
}
|
|
142
158
|
}
|
|
143
159
|
export declare interface SwitchProps extends BaseProps {
|
|
144
160
|
value?: boolean
|
|
145
161
|
onValueChange?: (value: boolean) => void
|
|
162
|
+
onChange?: (value: boolean) => void
|
|
146
163
|
disabled?: boolean
|
|
147
164
|
trackColor?: { false?: string; true?: string }
|
|
148
165
|
thumbColor?: string
|
|
@@ -155,6 +172,7 @@ export declare interface CheckboxProps extends BaseProps {
|
|
|
155
172
|
indeterminate?: boolean
|
|
156
173
|
label?: string
|
|
157
174
|
onValueChange?: (value: boolean) => void
|
|
175
|
+
onChange?: (value: boolean) => void
|
|
158
176
|
disabled?: boolean
|
|
159
177
|
color?: string
|
|
160
178
|
}
|
|
@@ -164,6 +182,7 @@ export declare interface SliderProps extends BaseProps {
|
|
|
164
182
|
maximumValue?: number
|
|
165
183
|
step?: number
|
|
166
184
|
onValueChange?: (value: number) => void
|
|
185
|
+
onChange?: (value: number) => void
|
|
167
186
|
onSlidingComplete?: (value: number) => void
|
|
168
187
|
disabled?: boolean
|
|
169
188
|
minimumTrackTintColor?: string
|
|
@@ -178,6 +197,7 @@ export declare interface PickerProps extends BaseProps {
|
|
|
178
197
|
items: PickerOption[]
|
|
179
198
|
selectedValue?: string | number
|
|
180
199
|
onValueChange?: (value: string | number, index: number) => void
|
|
200
|
+
onChange?: (value: string | number, index: number) => void
|
|
181
201
|
disabled?: boolean
|
|
182
202
|
}
|
|
183
203
|
/** A value as `<input type="date|time|datetime-local">` writes it. */
|
|
@@ -194,6 +214,7 @@ export declare interface DatePickerProps extends BaseProps {
|
|
|
194
214
|
minuteInterval?: number
|
|
195
215
|
display?: 'compact' | 'inline' | 'wheels'
|
|
196
216
|
onValueChange?: (event: DatePickerChange) => void
|
|
217
|
+
onChange?: (event: DatePickerChange) => void
|
|
197
218
|
disabled?: boolean
|
|
198
219
|
}
|
|
199
220
|
/** Iconify or SF Symbol rendered by the platform's native icon view. */
|
|
@@ -204,26 +225,38 @@ export declare interface IconProps extends BaseProps {
|
|
|
204
225
|
}
|
|
205
226
|
export declare interface ImageProps extends BaseProps {
|
|
206
227
|
source: ImageSource
|
|
207
|
-
|
|
228
|
+
alt?: string
|
|
229
|
+
resizeMode?: 'cover' | 'contain' | 'stretch' | 'center'
|
|
208
230
|
onLoad?: () => void
|
|
209
231
|
onLoadStart?: () => void
|
|
210
232
|
onLoadEnd?: () => void
|
|
211
|
-
onError?: (
|
|
233
|
+
onError?: (event: ImageErrorEvent) => void
|
|
212
234
|
blurRadius?: number
|
|
213
235
|
fadeDuration?: number
|
|
214
236
|
defaultSource?: ImageSource
|
|
215
237
|
}
|
|
238
|
+
export declare interface ImageErrorEvent {
|
|
239
|
+
nativeEvent: {
|
|
240
|
+
error: {
|
|
241
|
+
message: string
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
216
245
|
/** A video drawn by the platform's player (AVPlayer on iOS). */
|
|
217
246
|
export declare interface VideoProps extends BaseProps {
|
|
218
247
|
source?: string | { uri: string }
|
|
219
248
|
src?: string
|
|
220
249
|
controls?: boolean
|
|
250
|
+
autoPlay?: boolean
|
|
221
251
|
autoplay?: boolean
|
|
222
252
|
loop?: boolean
|
|
223
253
|
muted?: boolean
|
|
254
|
+
currentTime?: number
|
|
224
255
|
paused?: boolean
|
|
225
256
|
resizeMode?: 'contain' | 'cover' | 'stretch'
|
|
226
257
|
onLoad?: (event: { duration: number }) => void
|
|
258
|
+
onLoadStart?: () => void
|
|
259
|
+
onLoadEnd?: () => void
|
|
227
260
|
onPlay?: () => void
|
|
228
261
|
onPause?: () => void
|
|
229
262
|
onEnd?: () => void
|
|
@@ -295,32 +328,22 @@ export declare interface MapMarkerProps extends BaseProps {
|
|
|
295
328
|
// List Components
|
|
296
329
|
// ============================================================================
|
|
297
330
|
export declare interface FlatListProps<T> extends ScrollViewProps {
|
|
298
|
-
data: T[]
|
|
299
|
-
renderItem: (info: { item: T; index: number }) => unknown
|
|
300
|
-
keyExtractor?: (item: T, index: number) => string
|
|
301
|
-
ItemSeparatorComponent?: () => unknown
|
|
302
|
-
ListHeaderComponent?: () => unknown
|
|
303
|
-
ListFooterComponent?: () => unknown
|
|
304
|
-
ListEmptyComponent?: () => unknown
|
|
305
331
|
numColumns?: number
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
windowSize?: number
|
|
332
|
+
onRefresh?: () => void
|
|
333
|
+
refreshing?: boolean
|
|
309
334
|
onEndReached?: () => void
|
|
310
335
|
onEndReachedThreshold?: number
|
|
311
336
|
inverted?: boolean
|
|
312
337
|
}
|
|
313
338
|
export declare interface SectionListProps<T> extends ScrollViewProps {
|
|
314
|
-
sections: Array<{ title?: string; data: T[] }>
|
|
315
|
-
renderItem: (info: { item: T; index: number; section: { title?: string; data: T[] } }) => unknown
|
|
316
|
-
renderSectionHeader?: (info: { section: { title?: string; data: T[] } }) => unknown
|
|
317
|
-
keyExtractor?: (item: T, index: number) => string
|
|
318
339
|
}
|
|
319
340
|
// ============================================================================
|
|
320
341
|
// Overlay Components
|
|
321
342
|
// ============================================================================
|
|
322
343
|
export declare interface ModalProps extends BaseProps {
|
|
323
344
|
visible?: boolean
|
|
345
|
+
nonModal?: boolean
|
|
346
|
+
dismissOnOutsideTap?: boolean
|
|
324
347
|
animationType?: 'none' | 'slide' | 'fade'
|
|
325
348
|
presentationStyle?: 'fullScreen' | 'pageSheet' | 'formSheet' | 'overFullScreen'
|
|
326
349
|
transparent?: boolean
|
|
@@ -392,6 +415,7 @@ export type AccessibilityRole = | 'none'
|
|
|
392
415
|
| 'progressbar'
|
|
393
416
|
| 'radio'
|
|
394
417
|
| 'radiogroup'
|
|
418
|
+
| 'list'
|
|
395
419
|
| 'scrollbar'
|
|
396
420
|
| 'spinbutton'
|
|
397
421
|
| 'switch'
|
|
@@ -423,5 +447,5 @@ export type ReturnKeyType = | 'done'
|
|
|
423
447
|
| 'emergency-call'
|
|
424
448
|
| 'default';
|
|
425
449
|
export type ImageSource = | { uri: string; width?: number; height?: number; headers?: Record<string, string> }
|
|
426
|
-
|
|
|
450
|
+
| string;
|
|
427
451
|
export type ComponentName = keyof typeof ComponentRegistry;
|