flexium 0.8.14
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/README.md +219 -0
- package/dist/DrawText-CeXBL8Ev.d.ts +309 -0
- package/dist/DrawText-JB58mpQT.d.cts +309 -0
- package/dist/Motion-BrOAJzgH.d.cts +87 -0
- package/dist/Motion-BrOAJzgH.d.ts +87 -0
- package/dist/advanced.d.cts +30 -0
- package/dist/advanced.d.ts +30 -0
- package/dist/advanced.js +2 -0
- package/dist/advanced.js.map +1 -0
- package/dist/advanced.mjs +2 -0
- package/dist/advanced.mjs.map +1 -0
- package/dist/canvas.d.cts +22 -0
- package/dist/canvas.d.ts +22 -0
- package/dist/canvas.js +2 -0
- package/dist/canvas.js.map +1 -0
- package/dist/canvas.mjs +2 -0
- package/dist/canvas.mjs.map +1 -0
- package/dist/chunk-2MVKTSFR.mjs +3 -0
- package/dist/chunk-2MVKTSFR.mjs.map +1 -0
- package/dist/chunk-2U4DW375.mjs +2 -0
- package/dist/chunk-2U4DW375.mjs.map +1 -0
- package/dist/chunk-3P6DMEGB.js +2 -0
- package/dist/chunk-3P6DMEGB.js.map +1 -0
- package/dist/chunk-5S3ZQ2LB.mjs +3 -0
- package/dist/chunk-5S3ZQ2LB.mjs.map +1 -0
- package/dist/chunk-CNY6FPKJ.js +2 -0
- package/dist/chunk-CNY6FPKJ.js.map +1 -0
- package/dist/chunk-CZYIK6FD.mjs +2 -0
- package/dist/chunk-CZYIK6FD.mjs.map +1 -0
- package/dist/chunk-DOGIWSDA.js +2 -0
- package/dist/chunk-DOGIWSDA.js.map +1 -0
- package/dist/chunk-EX2GURH5.mjs +3 -0
- package/dist/chunk-EX2GURH5.mjs.map +1 -0
- package/dist/chunk-GDBJ322I.js +2 -0
- package/dist/chunk-GDBJ322I.js.map +1 -0
- package/dist/chunk-I7UCVARB.js +2 -0
- package/dist/chunk-I7UCVARB.js.map +1 -0
- package/dist/chunk-KNF5ERPK.mjs +2 -0
- package/dist/chunk-KNF5ERPK.mjs.map +1 -0
- package/dist/chunk-MLZTCKTH.mjs +2 -0
- package/dist/chunk-MLZTCKTH.mjs.map +1 -0
- package/dist/chunk-OPAQ4R4M.mjs +2 -0
- package/dist/chunk-OPAQ4R4M.mjs.map +1 -0
- package/dist/chunk-Q7IWDVJ4.js +2 -0
- package/dist/chunk-Q7IWDVJ4.js.map +1 -0
- package/dist/chunk-R5CS7UZG.mjs +2 -0
- package/dist/chunk-R5CS7UZG.mjs.map +1 -0
- package/dist/chunk-REETNY2Z.js +3 -0
- package/dist/chunk-REETNY2Z.js.map +1 -0
- package/dist/chunk-ROYFUJN5.js +3 -0
- package/dist/chunk-ROYFUJN5.js.map +1 -0
- package/dist/chunk-U6C6VDVZ.js +2 -0
- package/dist/chunk-U6C6VDVZ.js.map +1 -0
- package/dist/chunk-V4K6WOXN.js +3 -0
- package/dist/chunk-V4K6WOXN.js.map +1 -0
- package/dist/chunk-WQFQO5LK.js +2 -0
- package/dist/chunk-WQFQO5LK.js.map +1 -0
- package/dist/chunk-WVEJT7HD.mjs +2 -0
- package/dist/chunk-WVEJT7HD.mjs.map +1 -0
- package/dist/chunk-ZNPYN2TZ.mjs +2 -0
- package/dist/chunk-ZNPYN2TZ.mjs.map +1 -0
- package/dist/core.d.cts +24 -0
- package/dist/core.d.ts +24 -0
- package/dist/core.js +2 -0
- package/dist/core.js.map +1 -0
- package/dist/core.mjs +2 -0
- package/dist/core.mjs.map +1 -0
- package/dist/dom.d.cts +36 -0
- package/dist/dom.d.ts +36 -0
- package/dist/dom.js +2 -0
- package/dist/dom.js.map +1 -0
- package/dist/dom.mjs +2 -0
- package/dist/dom.mjs.map +1 -0
- package/dist/index.d.cts +26 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -0
- package/dist/interactive.d.cts +161 -0
- package/dist/interactive.d.ts +161 -0
- package/dist/interactive.js +2 -0
- package/dist/interactive.js.map +1 -0
- package/dist/interactive.mjs +2 -0
- package/dist/interactive.mjs.map +1 -0
- package/dist/jsx-dev-runtime.d.cts +2 -0
- package/dist/jsx-dev-runtime.d.ts +2 -0
- package/dist/jsx-dev-runtime.js +2 -0
- package/dist/jsx-dev-runtime.js.map +1 -0
- package/dist/jsx-dev-runtime.mjs +2 -0
- package/dist/jsx-dev-runtime.mjs.map +1 -0
- package/dist/jsx-runtime.d.cts +78 -0
- package/dist/jsx-runtime.d.ts +78 -0
- package/dist/jsx-runtime.js +2 -0
- package/dist/jsx-runtime.js.map +1 -0
- package/dist/jsx-runtime.mjs +2 -0
- package/dist/jsx-runtime.mjs.map +1 -0
- package/dist/metafile-cjs.json +1 -0
- package/dist/metafile-esm.json +1 -0
- package/dist/portal-BpcIlK9y.d.cts +206 -0
- package/dist/portal-DBwz7gD0.d.ts +206 -0
- package/dist/primitives/layout.d.cts +295 -0
- package/dist/primitives/layout.d.ts +295 -0
- package/dist/primitives/layout.js +2 -0
- package/dist/primitives/layout.js.map +1 -0
- package/dist/primitives/layout.mjs +2 -0
- package/dist/primitives/layout.mjs.map +1 -0
- package/dist/primitives/motion.d.cts +230 -0
- package/dist/primitives/motion.d.ts +230 -0
- package/dist/primitives/motion.js +2 -0
- package/dist/primitives/motion.js.map +1 -0
- package/dist/primitives/motion.mjs +2 -0
- package/dist/primitives/motion.mjs.map +1 -0
- package/dist/primitives/ui.d.cts +81 -0
- package/dist/primitives/ui.d.ts +81 -0
- package/dist/primitives/ui.js +2 -0
- package/dist/primitives/ui.js.map +1 -0
- package/dist/primitives/ui.mjs +2 -0
- package/dist/primitives/ui.mjs.map +1 -0
- package/dist/primitives.d.cts +92 -0
- package/dist/primitives.d.ts +92 -0
- package/dist/primitives.js +2 -0
- package/dist/primitives.js.map +1 -0
- package/dist/primitives.mjs +2 -0
- package/dist/primitives.mjs.map +1 -0
- package/dist/renderer-DSLb-FGg.d.cts +135 -0
- package/dist/renderer-DSLb-FGg.d.ts +135 -0
- package/dist/router.d.cts +126 -0
- package/dist/router.d.ts +126 -0
- package/dist/router.js +2 -0
- package/dist/router.js.map +1 -0
- package/dist/router.mjs +2 -0
- package/dist/router.mjs.map +1 -0
- package/dist/server.d.cts +3 -0
- package/dist/server.d.ts +3 -0
- package/dist/server.js +2 -0
- package/dist/server.js.map +1 -0
- package/dist/server.mjs +2 -0
- package/dist/server.mjs.map +1 -0
- package/dist/signal-PWBIM6JV.mjs +2 -0
- package/dist/signal-PWBIM6JV.mjs.map +1 -0
- package/dist/signal-XZXQ4VYQ.js +2 -0
- package/dist/signal-XZXQ4VYQ.js.map +1 -0
- package/dist/signal-mNtlF8-v.d.cts +158 -0
- package/dist/signal-mNtlF8-v.d.ts +158 -0
- package/dist/state-kK9sQh9s.d.cts +73 -0
- package/dist/state-kK9sQh9s.d.ts +73 -0
- package/dist/test-exports.d.cts +17 -0
- package/dist/test-exports.d.ts +17 -0
- package/dist/test-exports.js +2 -0
- package/dist/test-exports.js.map +1 -0
- package/dist/test-exports.mjs +2 -0
- package/dist/test-exports.mjs.map +1 -0
- package/package.json +173 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
export { e as effect, r as root } from './signal-mNtlF8-v.js';
|
|
2
|
+
export { _ as state } from './state-kK9sQh9s.js';
|
|
3
|
+
export { CommonStyle as BaseStyleProps, Column, ColumnProps, CommonStyle, Grid, GridProps, Row, RowProps, Spacer, SpacerProps, Stack, StackProps } from './primitives/layout.js';
|
|
4
|
+
import { T as TextProps, F as FNode, I as ImageProps, P as PressableProps, S as ScrollViewProps, m as CommonStyle, n as TextStyle } from './DrawText-CeXBL8Ev.js';
|
|
5
|
+
export { C as Canvas, f as CanvasProps, b as DrawArc, i as DrawArcProps, a as DrawCircle, h as DrawCircleProps, c as DrawLine, j as DrawLineProps, d as DrawPath, k as DrawPathProps, D as DrawRect, g as DrawRectProps, e as DrawText, l as DrawTextProps } from './DrawText-CeXBL8Ev.js';
|
|
6
|
+
import './renderer-DSLb-FGg.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Text - Universal text display component
|
|
10
|
+
*
|
|
11
|
+
* Maps to:
|
|
12
|
+
* - Web: <span>
|
|
13
|
+
* - React Native: <Text>
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <Text style={{ color: 'blue', fontSize: 16 }}>
|
|
18
|
+
* Hello World
|
|
19
|
+
* </Text>
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
declare function Text(props: TextProps): FNode;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Image - Universal image component
|
|
27
|
+
*
|
|
28
|
+
* Maps to:
|
|
29
|
+
* - Web: <img>
|
|
30
|
+
* - React Native: <Image>
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```tsx
|
|
34
|
+
* <Image
|
|
35
|
+
* src="/logo.png"
|
|
36
|
+
* alt="Logo"
|
|
37
|
+
* width={100}
|
|
38
|
+
* height={100}
|
|
39
|
+
* />
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
declare function Image(props: ImageProps): FNode;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Pressable - Universal touchable/clickable component
|
|
47
|
+
*
|
|
48
|
+
* Maps to:
|
|
49
|
+
* - Web: <button>
|
|
50
|
+
* - React Native: <Pressable>
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```tsx
|
|
54
|
+
* <Pressable
|
|
55
|
+
* onPress={() => console.log('pressed')}
|
|
56
|
+
* style={{ padding: 10 }}
|
|
57
|
+
* >
|
|
58
|
+
* <Text>Click Me</Text>
|
|
59
|
+
* </Pressable>
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
declare function Pressable(props: PressableProps): FNode;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* ScrollView - Universal scrollable container
|
|
67
|
+
*
|
|
68
|
+
* Maps to:
|
|
69
|
+
* - Web: <div style="overflow: scroll">
|
|
70
|
+
* - React Native: <ScrollView>
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```tsx
|
|
74
|
+
* <ScrollView style={{ height: 300 }}>
|
|
75
|
+
* <Column>...</Column>
|
|
76
|
+
* <Column>...</Column>
|
|
77
|
+
* </ScrollView>
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
|
|
81
|
+
declare function ScrollView(props: ScrollViewProps): FNode;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Primitive utilities
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Normalize CommonStyle to CSS properties
|
|
89
|
+
*/
|
|
90
|
+
declare function normalizeStyle(style?: CommonStyle | TextStyle): Record<string, any>;
|
|
91
|
+
|
|
92
|
+
export { Image, ImageProps, Pressable, PressableProps, ScrollView, ScrollViewProps, Text, TextProps, TextStyle, normalizeStyle };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunk3P6DMEGB_js=require('./chunk-3P6DMEGB.js'),chunkI7UCVARB_js=require('./chunk-I7UCVARB.js'),chunkGDBJ322I_js=require('./chunk-GDBJ322I.js');require('./chunk-Q7IWDVJ4.js'),require('./chunk-WQFQO5LK.js');var chunkROYFUJN5_js=require('./chunk-ROYFUJN5.js');function A(p){let{children:r,style:a,onPress:e,class:s,...o}=p;return {type:"span",props:{...o,class:s,style:chunkGDBJ322I_js.a(a),onclick:e},children:Array.isArray(r)?r:r?[r]:[]}}function N(p){let{src:r,alt:a,width:e,height:s,style:o,onLoad:n,onError:i,...l}=p,m={...o,width:e||o?.width,height:s||o?.height};return {type:"img",props:{...l,src:r,alt:a||"",style:chunkGDBJ322I_js.a(m),onload:n,onerror:i},children:[]}}function T(p){let{children:r,onPress:a,onPressIn:e,onPressOut:s,disabled:o,style:n,activeOpacity:i=.7,...l}=p,m={...n,cursor:o?"not-allowed":"pointer",opacity:o?.5:n?.opacity,border:"none",background:"none",padding:0};return {type:"button",props:{...l,disabled:o,style:chunkGDBJ322I_js.a(m),onclick:o?void 0:a,onmousedown:e,onmouseup:s,ontouchstart:e,ontouchend:s},children:Array.isArray(r)?r:r?[r]:[]}}function F(p){let{children:r,style:a,horizontal:e=false,showScrollbarX:s=true,showScrollbarY:o=true,...n}=p,i={...a,overflowX:e?"auto":"hidden",overflowY:e?"hidden":"auto",display:"flex",flexDirection:e?"row":"column"};return (!s||!o)&&(i.scrollbarWidth="none"),{type:"div",props:{...n,style:chunkGDBJ322I_js.a(i)},children:Array.isArray(r)?r:r?[r]:[]}}Object.defineProperty(exports,"Column",{enumerable:true,get:function(){return chunk3P6DMEGB_js.h}});Object.defineProperty(exports,"Grid",{enumerable:true,get:function(){return chunk3P6DMEGB_js.j}});Object.defineProperty(exports,"Row",{enumerable:true,get:function(){return chunk3P6DMEGB_js.g}});Object.defineProperty(exports,"Spacer",{enumerable:true,get:function(){return chunk3P6DMEGB_js.i}});Object.defineProperty(exports,"Stack",{enumerable:true,get:function(){return chunk3P6DMEGB_js.k}});Object.defineProperty(exports,"state",{enumerable:true,get:function(){return chunkI7UCVARB_js.f}});Object.defineProperty(exports,"Canvas",{enumerable:true,get:function(){return chunkGDBJ322I_js.d}});Object.defineProperty(exports,"DrawArc",{enumerable:true,get:function(){return chunkGDBJ322I_js.g}});Object.defineProperty(exports,"DrawCircle",{enumerable:true,get:function(){return chunkGDBJ322I_js.f}});Object.defineProperty(exports,"DrawLine",{enumerable:true,get:function(){return chunkGDBJ322I_js.h}});Object.defineProperty(exports,"DrawPath",{enumerable:true,get:function(){return chunkGDBJ322I_js.i}});Object.defineProperty(exports,"DrawRect",{enumerable:true,get:function(){return chunkGDBJ322I_js.e}});Object.defineProperty(exports,"DrawText",{enumerable:true,get:function(){return chunkGDBJ322I_js.j}});Object.defineProperty(exports,"normalizeStyle",{enumerable:true,get:function(){return chunkGDBJ322I_js.a}});Object.defineProperty(exports,"effect",{enumerable:true,get:function(){return chunkROYFUJN5_js.j}});Object.defineProperty(exports,"root",{enumerable:true,get:function(){return chunkROYFUJN5_js.m}});exports.Image=N;exports.Pressable=T;exports.ScrollView=F;exports.Text=A;//# sourceMappingURL=primitives.js.map
|
|
2
|
+
//# sourceMappingURL=primitives.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/primitives/Text.ts","../src/primitives/Image.ts","../src/primitives/Pressable.ts","../src/primitives/ScrollView.ts"],"names":["Text","props","children","style","onPress","className","rest","normalizeStyle","Image","src","alt","width","height","onLoad","onError","imageStyle","Pressable","onPressIn","onPressOut","disabled","_activeOpacity","buttonStyle","ScrollView","horizontal","showScrollbarX","showScrollbarY","scrollStyle"],"mappings":"mRAmBO,SAASA,CAAAA,CAAKC,CAAAA,CAAyB,CAC5C,GAAM,CAAE,QAAA,CAAAC,CAAAA,CAAU,KAAA,CAAAC,CAAAA,CAAO,OAAA,CAAAC,CAAAA,CAAS,KAAA,CAAOC,EAAW,GAAGC,CAAK,CAAA,CAAIL,CAAAA,CAEhE,OAAO,CACL,IAAA,CAAM,MAAA,CACN,KAAA,CAAO,CACL,GAAGK,CAAAA,CACH,KAAA,CAAOD,CAAAA,CACP,KAAA,CAAOE,kBAAAA,CAAeJ,CAAK,CAAA,CAC3B,OAAA,CAASC,CACX,CAAA,CACA,QAAA,CAAU,KAAA,CAAM,OAAA,CAAQF,CAAQ,CAAA,CAAIA,CAAAA,CAAWA,CAAAA,CAAW,CAACA,CAAQ,CAAA,CAAI,EACzE,CACF,CCVO,SAASM,CAAAA,CAAMP,CAAAA,CAA0B,CAC9C,GAAM,CAAE,GAAA,CAAAQ,EAAK,GAAA,CAAAC,CAAAA,CAAK,KAAA,CAAAC,CAAAA,CAAO,MAAA,CAAAC,CAAAA,CAAQ,KAAA,CAAAT,CAAAA,CAAO,OAAAU,CAAAA,CAAQ,OAAA,CAAAC,CAAAA,CAAS,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C,CACd,CAAA,CACA,SAAU,KAAA,CAAM,OAAA,CAAQhB,CAAQ,CAAA,CAAIA,CAAAA,CAAWA,CAAAA,CAAW,CAACA,CAAQ,EAAI,EACzE,CACF,CCrCO,SAASoB,CAAAA,CAAWrB,CAAAA,CAA+B,CACxD,GAAM,CACJ,QAAA,CAAAC,CAAAA,CACA,KAAA,CAAAC,CAAAA,CACA,UAAA,CAAAoB,CAAAA,CAAa,KAAA,CACb,cAAA,CAAAC,CAAAA,CAAiB,IAAA,CACjB,cAAA,CAAAC,CAAAA,CAAiB,IAAA,CACjB,GAAGnB,CACL,EAAIL,CAAAA,CAEEyB,CAAAA,CAAuC,CAC3C,GAAGvB,CAAAA,CACH,SAAA,CAAWoB,CAAAA,CAAa,MAAA,CAAS,QAAA,CACjC,SAAA,CAAWA,CAAAA,CAAa,QAAA,CAAW,MAAA,CACnC,OAAA,CAAS,MAAA,CACT,aAAA,CAAeA,EAAa,KAAA,CAAQ,QACtC,CAAA,CAGA,OAAA,CAAI,CAACC,CAAAA,EAAkB,CAACC,CAAAA,IACtBC,CAAAA,CAAY,cAAA,CAAiB,MAAA,CAAA,CAGxB,CACL,IAAA,CAAM,KAAA,CACN,KAAA,CAAO,CACL,GAAGpB,CAAAA,CACH,KAAA,CAAOC,kBAAAA,CAAemB,CAAmD,CAC3E,CAAA,CACA,QAAA,CAAU,KAAA,CAAM,QAAQxB,CAAQ,CAAA,CAAIA,CAAAA,CAAWA,CAAAA,CAAW,CAACA,CAAQ,CAAA,CAAI,EACzE,CACF","file":"primitives.js","sourcesContent":["/**\n * Text - Universal text display component\n *\n * Maps to:\n * - Web: <span>\n * - React Native: <Text>\n *\n * @example\n * ```tsx\n * <Text style={{ color: 'blue', fontSize: 16 }}>\n * Hello World\n * </Text>\n * ```\n */\n\nimport type { FNode } from '../types'\nimport type { TextProps } from './types'\nimport { normalizeStyle } from './utils'\n\nexport function Text(props: TextProps): FNode {\n const { children, style, onPress, class: className, ...rest } = props\n\n return {\n type: 'span',\n props: {\n ...rest,\n class: className,\n style: normalizeStyle(style),\n onclick: onPress,\n },\n children: Array.isArray(children) ? children : children ? [children] : [],\n }\n}\n","/**\n * Image - Universal image component\n *\n * Maps to:\n * - Web: <img>\n * - React Native: <Image>\n *\n * @example\n * ```tsx\n * <Image\n * src=\"/logo.png\"\n * alt=\"Logo\"\n * width={100}\n * height={100}\n * />\n * ```\n */\n\nimport type { FNode } from '../types'\nimport type { ImageProps } from './types'\nimport { normalizeStyle } from './utils'\n\nexport function Image(props: ImageProps): FNode {\n const { src, alt, width, height, style, onLoad, onError, ...rest } = props\n\n const imageStyle = {\n ...style,\n width: width || style?.width,\n height: height || style?.height,\n }\n\n return {\n type: 'img',\n props: {\n ...rest,\n src,\n alt: alt || '',\n style: normalizeStyle(imageStyle),\n onload: onLoad,\n onerror: onError,\n },\n children: [],\n }\n}\n","/**\n * Pressable - Universal touchable/clickable component\n *\n * Maps to:\n * - Web: <button>\n * - React Native: <Pressable>\n *\n * @example\n * ```tsx\n * <Pressable\n * onPress={() => console.log('pressed')}\n * style={{ padding: 10 }}\n * >\n * <Text>Click Me</Text>\n * </Pressable>\n * ```\n */\n\nimport type { FNode } from '../types'\nimport type { PressableProps } from './types'\nimport { normalizeStyle } from './utils'\n\nexport function Pressable(props: PressableProps): FNode {\n const {\n children,\n onPress,\n onPressIn,\n onPressOut,\n disabled,\n style,\n activeOpacity: _activeOpacity = 0.7,\n ...rest\n } = props\n\n const buttonStyle = {\n ...style,\n cursor: disabled ? 'not-allowed' : 'pointer',\n opacity: disabled ? 0.5 : style?.opacity,\n border: 'none',\n background: 'none',\n padding: 0,\n }\n\n return {\n type: 'button',\n props: {\n ...rest,\n disabled,\n style: normalizeStyle(buttonStyle),\n onclick: disabled ? undefined : onPress,\n onmousedown: onPressIn,\n onmouseup: onPressOut,\n ontouchstart: onPressIn,\n ontouchend: onPressOut,\n },\n children: Array.isArray(children) ? children : children ? [children] : [],\n }\n}\n","/**\n * ScrollView - Universal scrollable container\n *\n * Maps to:\n * - Web: <div style=\"overflow: scroll\">\n * - React Native: <ScrollView>\n *\n * @example\n * ```tsx\n * <ScrollView style={{ height: 300 }}>\n * <Column>...</Column>\n * <Column>...</Column>\n * </ScrollView>\n * ```\n */\n\nimport type { FNode } from '../types'\nimport type { ScrollViewProps } from './types'\nimport { normalizeStyle } from './utils'\n\nexport function ScrollView(props: ScrollViewProps): FNode {\n const {\n children,\n style,\n horizontal = false,\n showScrollbarX = true,\n showScrollbarY = true,\n ...rest\n } = props\n\n const scrollStyle: Record<string, unknown> = {\n ...style,\n overflowX: horizontal ? 'auto' : 'hidden',\n overflowY: horizontal ? 'hidden' : 'auto',\n display: 'flex',\n flexDirection: horizontal ? 'row' : 'column',\n }\n\n // Hide scrollbars if requested (CSS scrollbar-width for Firefox/modern browsers)\n if (!showScrollbarX || !showScrollbarY) {\n scrollStyle.scrollbarWidth = 'none'\n }\n\n return {\n type: 'div',\n props: {\n ...rest,\n style: normalizeStyle(scrollStyle as Parameters<typeof normalizeStyle>[0]),\n },\n children: Array.isArray(children) ? children : children ? [children] : [],\n }\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export{h as Column,j as Grid,g as Row,i as Spacer,k as Stack}from'./chunk-R5CS7UZG.mjs';export{f as state}from'./chunk-2U4DW375.mjs';import {a}from'./chunk-ZNPYN2TZ.mjs';export{d as Canvas,g as DrawArc,f as DrawCircle,h as DrawLine,i as DrawPath,e as DrawRect,j as DrawText,a as normalizeStyle}from'./chunk-ZNPYN2TZ.mjs';import'./chunk-WVEJT7HD.mjs';import'./chunk-KNF5ERPK.mjs';export{j as effect,m as root}from'./chunk-5S3ZQ2LB.mjs';function A(p){let{children:r,style:a$1,onPress:e,class:s,...o}=p;return {type:"span",props:{...o,class:s,style:a(a$1),onclick:e},children:Array.isArray(r)?r:r?[r]:[]}}function N(p){let{src:r,alt:a$1,width:e,height:s,style:o,onLoad:n,onError:i,...l}=p,m={...o,width:e||o?.width,height:s||o?.height};return {type:"img",props:{...l,src:r,alt:a$1||"",style:a(m),onload:n,onerror:i},children:[]}}function T(p){let{children:r,onPress:a$1,onPressIn:e,onPressOut:s,disabled:o,style:n,activeOpacity:i=.7,...l}=p,m={...n,cursor:o?"not-allowed":"pointer",opacity:o?.5:n?.opacity,border:"none",background:"none",padding:0};return {type:"button",props:{...l,disabled:o,style:a(m),onclick:o?void 0:a$1,onmousedown:e,onmouseup:s,ontouchstart:e,ontouchend:s},children:Array.isArray(r)?r:r?[r]:[]}}function F(p){let{children:r,style:a$1,horizontal:e=false,showScrollbarX:s=true,showScrollbarY:o=true,...n}=p,i={...a$1,overflowX:e?"auto":"hidden",overflowY:e?"hidden":"auto",display:"flex",flexDirection:e?"row":"column"};return (!s||!o)&&(i.scrollbarWidth="none"),{type:"div",props:{...n,style:a(i)},children:Array.isArray(r)?r:r?[r]:[]}}export{N as Image,T as Pressable,F as ScrollView,A as Text};//# sourceMappingURL=primitives.mjs.map
|
|
2
|
+
//# sourceMappingURL=primitives.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/primitives/Text.ts","../src/primitives/Image.ts","../src/primitives/Pressable.ts","../src/primitives/ScrollView.ts"],"names":["Text","props","children","style","onPress","className","rest","normalizeStyle","Image","src","alt","width","height","onLoad","onError","imageStyle","Pressable","onPressIn","onPressOut","disabled","_activeOpacity","buttonStyle","ScrollView","horizontal","showScrollbarX","showScrollbarY","scrollStyle"],"mappings":"mbAmBO,SAASA,CAAAA,CAAKC,CAAAA,CAAyB,CAC5C,GAAM,CAAE,QAAA,CAAAC,CAAAA,CAAU,KAAA,CAAAC,GAAAA,CAAO,OAAA,CAAAC,CAAAA,CAAS,KAAA,CAAOC,EAAW,GAAGC,CAAK,CAAA,CAAIL,CAAAA,CAEhE,OAAO,CACL,IAAA,CAAM,MAAA,CACN,KAAA,CAAO,CACL,GAAGK,CAAAA,CACH,KAAA,CAAOD,CAAAA,CACP,KAAA,CAAOE,CAAAA,CAAe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ACA,QAAA,CAAU,KAAA,CAAM,QAAQxB,CAAQ,CAAA,CAAIA,CAAAA,CAAWA,CAAAA,CAAW,CAACA,CAAQ,CAAA,CAAI,EACzE,CACF","file":"primitives.mjs","sourcesContent":["/**\n * Text - Universal text display component\n *\n * Maps to:\n * - Web: <span>\n * - React Native: <Text>\n *\n * @example\n * ```tsx\n * <Text style={{ color: 'blue', fontSize: 16 }}>\n * Hello World\n * </Text>\n * ```\n */\n\nimport type { FNode } from '../types'\nimport type { TextProps } from './types'\nimport { normalizeStyle } from './utils'\n\nexport function Text(props: TextProps): FNode {\n const { children, style, onPress, class: className, ...rest } = props\n\n return {\n type: 'span',\n props: {\n ...rest,\n class: className,\n style: normalizeStyle(style),\n onclick: onPress,\n },\n children: Array.isArray(children) ? children : children ? [children] : [],\n }\n}\n","/**\n * Image - Universal image component\n *\n * Maps to:\n * - Web: <img>\n * - React Native: <Image>\n *\n * @example\n * ```tsx\n * <Image\n * src=\"/logo.png\"\n * alt=\"Logo\"\n * width={100}\n * height={100}\n * />\n * ```\n */\n\nimport type { FNode } from '../types'\nimport type { ImageProps } from './types'\nimport { normalizeStyle } from './utils'\n\nexport function Image(props: ImageProps): FNode {\n const { src, alt, width, height, style, onLoad, onError, ...rest } = props\n\n const imageStyle = {\n ...style,\n width: width || style?.width,\n height: height || style?.height,\n }\n\n return {\n type: 'img',\n props: {\n ...rest,\n src,\n alt: alt || '',\n style: normalizeStyle(imageStyle),\n onload: onLoad,\n onerror: onError,\n },\n children: [],\n }\n}\n","/**\n * Pressable - Universal touchable/clickable component\n *\n * Maps to:\n * - Web: <button>\n * - React Native: <Pressable>\n *\n * @example\n * ```tsx\n * <Pressable\n * onPress={() => console.log('pressed')}\n * style={{ padding: 10 }}\n * >\n * <Text>Click Me</Text>\n * </Pressable>\n * ```\n */\n\nimport type { FNode } from '../types'\nimport type { PressableProps } from './types'\nimport { normalizeStyle } from './utils'\n\nexport function Pressable(props: PressableProps): FNode {\n const {\n children,\n onPress,\n onPressIn,\n onPressOut,\n disabled,\n style,\n activeOpacity: _activeOpacity = 0.7,\n ...rest\n } = props\n\n const buttonStyle = {\n ...style,\n cursor: disabled ? 'not-allowed' : 'pointer',\n opacity: disabled ? 0.5 : style?.opacity,\n border: 'none',\n background: 'none',\n padding: 0,\n }\n\n return {\n type: 'button',\n props: {\n ...rest,\n disabled,\n style: normalizeStyle(buttonStyle),\n onclick: disabled ? undefined : onPress,\n onmousedown: onPressIn,\n onmouseup: onPressOut,\n ontouchstart: onPressIn,\n ontouchend: onPressOut,\n },\n children: Array.isArray(children) ? children : children ? [children] : [],\n }\n}\n","/**\n * ScrollView - Universal scrollable container\n *\n * Maps to:\n * - Web: <div style=\"overflow: scroll\">\n * - React Native: <ScrollView>\n *\n * @example\n * ```tsx\n * <ScrollView style={{ height: 300 }}>\n * <Column>...</Column>\n * <Column>...</Column>\n * </ScrollView>\n * ```\n */\n\nimport type { FNode } from '../types'\nimport type { ScrollViewProps } from './types'\nimport { normalizeStyle } from './utils'\n\nexport function ScrollView(props: ScrollViewProps): FNode {\n const {\n children,\n style,\n horizontal = false,\n showScrollbarX = true,\n showScrollbarY = true,\n ...rest\n } = props\n\n const scrollStyle: Record<string, unknown> = {\n ...style,\n overflowX: horizontal ? 'auto' : 'hidden',\n overflowY: horizontal ? 'hidden' : 'auto',\n display: 'flex',\n flexDirection: horizontal ? 'row' : 'column',\n }\n\n // Hide scrollbars if requested (CSS scrollbar-width for Firefox/modern browsers)\n if (!showScrollbarX || !showScrollbarY) {\n scrollStyle.scrollbarWidth = 'none'\n }\n\n return {\n type: 'div',\n props: {\n ...rest,\n style: normalizeStyle(scrollStyle as Parameters<typeof normalizeStyle>[0]),\n },\n children: Array.isArray(children) ? children : children ? [children] : [],\n }\n}\n"]}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core Renderer Interface
|
|
3
|
+
*
|
|
4
|
+
* This interface defines the contract that all platform-specific renderers must implement.
|
|
5
|
+
* It provides a unified API for creating, updating, and managing nodes across different
|
|
6
|
+
* rendering targets (DOM, Canvas, React Native, WebGL, etc.).
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Base node type - platform-specific implementations will extend this
|
|
10
|
+
* Using any intentionally for cross-platform flexibility (DOM Node, Canvas, etc.)
|
|
11
|
+
*/
|
|
12
|
+
type RenderNode = any;
|
|
13
|
+
/**
|
|
14
|
+
* Event handler function type
|
|
15
|
+
*/
|
|
16
|
+
type EventHandler = (event: Event) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Core renderer interface that all platform renderers must implement
|
|
19
|
+
*/
|
|
20
|
+
interface Renderer {
|
|
21
|
+
/**
|
|
22
|
+
* Create a new platform-specific node
|
|
23
|
+
* @param type - The type of node to create (e.g., 'div', 'Row', 'Text')
|
|
24
|
+
* @param props - Properties to apply to the node
|
|
25
|
+
* @returns The created node
|
|
26
|
+
*/
|
|
27
|
+
createNode(type: string, props: Record<string, unknown>): RenderNode;
|
|
28
|
+
/**
|
|
29
|
+
* Update the properties of an existing node
|
|
30
|
+
* @param node - The node to update
|
|
31
|
+
* @param oldProps - Previous properties (for diffing)
|
|
32
|
+
* @param newProps - New properties to apply
|
|
33
|
+
*/
|
|
34
|
+
updateNode(node: RenderNode, oldProps: Record<string, unknown>, newProps: Record<string, unknown>): void;
|
|
35
|
+
/**
|
|
36
|
+
* Append a child node to a parent node
|
|
37
|
+
* @param parent - The parent node
|
|
38
|
+
* @param child - The child node to append
|
|
39
|
+
*/
|
|
40
|
+
appendChild(parent: RenderNode, child: RenderNode): void;
|
|
41
|
+
/**
|
|
42
|
+
* Insert a child node before a reference node
|
|
43
|
+
* @param parent - The parent node
|
|
44
|
+
* @param child - The child node to insert
|
|
45
|
+
* @param beforeChild - The reference node to insert before
|
|
46
|
+
*/
|
|
47
|
+
insertBefore(parent: RenderNode, child: RenderNode, beforeChild: RenderNode | null): void;
|
|
48
|
+
/**
|
|
49
|
+
* Remove a child node from a parent node
|
|
50
|
+
* @param parent - The parent node
|
|
51
|
+
* @param child - The child node to remove
|
|
52
|
+
*/
|
|
53
|
+
removeChild(parent: RenderNode, child: RenderNode): void;
|
|
54
|
+
/**
|
|
55
|
+
* Create a text node
|
|
56
|
+
* @param text - The text content
|
|
57
|
+
* @returns The created text node
|
|
58
|
+
*/
|
|
59
|
+
createTextNode(text: string): RenderNode;
|
|
60
|
+
/**
|
|
61
|
+
* Update the text content of a text node
|
|
62
|
+
* @param node - The text node to update
|
|
63
|
+
* @param text - The new text content
|
|
64
|
+
*/
|
|
65
|
+
updateTextNode(node: RenderNode, text: string): void;
|
|
66
|
+
/**
|
|
67
|
+
* Add an event listener to a node
|
|
68
|
+
* @param node - The node to attach the listener to
|
|
69
|
+
* @param event - The event name (e.g., 'click', 'press')
|
|
70
|
+
* @param handler - The event handler function
|
|
71
|
+
*/
|
|
72
|
+
addEventListener(node: RenderNode, event: string, handler: EventHandler): void;
|
|
73
|
+
/**
|
|
74
|
+
* Remove an event listener from a node
|
|
75
|
+
* @param node - The node to remove the listener from
|
|
76
|
+
* @param event - The event name
|
|
77
|
+
* @param handler - The event handler function
|
|
78
|
+
*/
|
|
79
|
+
removeEventListener(node: RenderNode, event: string, handler: EventHandler): void;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Platform-agnostic props that should be supported across all renderers
|
|
83
|
+
*/
|
|
84
|
+
interface CommonProps {
|
|
85
|
+
width?: number | string;
|
|
86
|
+
height?: number | string;
|
|
87
|
+
padding?: number;
|
|
88
|
+
paddingTop?: number;
|
|
89
|
+
paddingRight?: number;
|
|
90
|
+
paddingBottom?: number;
|
|
91
|
+
paddingLeft?: number;
|
|
92
|
+
margin?: number;
|
|
93
|
+
marginTop?: number;
|
|
94
|
+
marginRight?: number;
|
|
95
|
+
marginBottom?: number;
|
|
96
|
+
marginLeft?: number;
|
|
97
|
+
flexDirection?: 'row' | 'column';
|
|
98
|
+
justifyContent?: 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly';
|
|
99
|
+
alignItems?: 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline';
|
|
100
|
+
gap?: number;
|
|
101
|
+
flex?: number;
|
|
102
|
+
flexWrap?: 'nowrap' | 'wrap' | 'wrap-reverse';
|
|
103
|
+
bg?: string;
|
|
104
|
+
color?: string;
|
|
105
|
+
borderRadius?: number;
|
|
106
|
+
borderWidth?: number;
|
|
107
|
+
borderColor?: string;
|
|
108
|
+
opacity?: number;
|
|
109
|
+
fontSize?: number;
|
|
110
|
+
fontWeight?: number | string;
|
|
111
|
+
fontFamily?: string;
|
|
112
|
+
lineHeight?: number;
|
|
113
|
+
textAlign?: 'left' | 'center' | 'right';
|
|
114
|
+
onPress?: EventHandler;
|
|
115
|
+
onHover?: EventHandler;
|
|
116
|
+
onChange?: EventHandler;
|
|
117
|
+
onFocus?: EventHandler;
|
|
118
|
+
onBlur?: EventHandler;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Child types that can be rendered
|
|
122
|
+
*/
|
|
123
|
+
type FNodeChild = FNode | string | number | boolean | null | undefined | FNodeChild[];
|
|
124
|
+
/**
|
|
125
|
+
* Flexium Node - lightweight element descriptor for JSX
|
|
126
|
+
* (Not a Virtual DOM - just a simple descriptor that gets immediately converted to real DOM)
|
|
127
|
+
*/
|
|
128
|
+
interface FNode {
|
|
129
|
+
type: string | Function;
|
|
130
|
+
props: Record<string, unknown>;
|
|
131
|
+
children: FNodeChild[];
|
|
132
|
+
key?: string | number;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export type { CommonProps as C, EventHandler as E, FNode as F, Renderer as R, FNodeChild as a };
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core Renderer Interface
|
|
3
|
+
*
|
|
4
|
+
* This interface defines the contract that all platform-specific renderers must implement.
|
|
5
|
+
* It provides a unified API for creating, updating, and managing nodes across different
|
|
6
|
+
* rendering targets (DOM, Canvas, React Native, WebGL, etc.).
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Base node type - platform-specific implementations will extend this
|
|
10
|
+
* Using any intentionally for cross-platform flexibility (DOM Node, Canvas, etc.)
|
|
11
|
+
*/
|
|
12
|
+
type RenderNode = any;
|
|
13
|
+
/**
|
|
14
|
+
* Event handler function type
|
|
15
|
+
*/
|
|
16
|
+
type EventHandler = (event: Event) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Core renderer interface that all platform renderers must implement
|
|
19
|
+
*/
|
|
20
|
+
interface Renderer {
|
|
21
|
+
/**
|
|
22
|
+
* Create a new platform-specific node
|
|
23
|
+
* @param type - The type of node to create (e.g., 'div', 'Row', 'Text')
|
|
24
|
+
* @param props - Properties to apply to the node
|
|
25
|
+
* @returns The created node
|
|
26
|
+
*/
|
|
27
|
+
createNode(type: string, props: Record<string, unknown>): RenderNode;
|
|
28
|
+
/**
|
|
29
|
+
* Update the properties of an existing node
|
|
30
|
+
* @param node - The node to update
|
|
31
|
+
* @param oldProps - Previous properties (for diffing)
|
|
32
|
+
* @param newProps - New properties to apply
|
|
33
|
+
*/
|
|
34
|
+
updateNode(node: RenderNode, oldProps: Record<string, unknown>, newProps: Record<string, unknown>): void;
|
|
35
|
+
/**
|
|
36
|
+
* Append a child node to a parent node
|
|
37
|
+
* @param parent - The parent node
|
|
38
|
+
* @param child - The child node to append
|
|
39
|
+
*/
|
|
40
|
+
appendChild(parent: RenderNode, child: RenderNode): void;
|
|
41
|
+
/**
|
|
42
|
+
* Insert a child node before a reference node
|
|
43
|
+
* @param parent - The parent node
|
|
44
|
+
* @param child - The child node to insert
|
|
45
|
+
* @param beforeChild - The reference node to insert before
|
|
46
|
+
*/
|
|
47
|
+
insertBefore(parent: RenderNode, child: RenderNode, beforeChild: RenderNode | null): void;
|
|
48
|
+
/**
|
|
49
|
+
* Remove a child node from a parent node
|
|
50
|
+
* @param parent - The parent node
|
|
51
|
+
* @param child - The child node to remove
|
|
52
|
+
*/
|
|
53
|
+
removeChild(parent: RenderNode, child: RenderNode): void;
|
|
54
|
+
/**
|
|
55
|
+
* Create a text node
|
|
56
|
+
* @param text - The text content
|
|
57
|
+
* @returns The created text node
|
|
58
|
+
*/
|
|
59
|
+
createTextNode(text: string): RenderNode;
|
|
60
|
+
/**
|
|
61
|
+
* Update the text content of a text node
|
|
62
|
+
* @param node - The text node to update
|
|
63
|
+
* @param text - The new text content
|
|
64
|
+
*/
|
|
65
|
+
updateTextNode(node: RenderNode, text: string): void;
|
|
66
|
+
/**
|
|
67
|
+
* Add an event listener to a node
|
|
68
|
+
* @param node - The node to attach the listener to
|
|
69
|
+
* @param event - The event name (e.g., 'click', 'press')
|
|
70
|
+
* @param handler - The event handler function
|
|
71
|
+
*/
|
|
72
|
+
addEventListener(node: RenderNode, event: string, handler: EventHandler): void;
|
|
73
|
+
/**
|
|
74
|
+
* Remove an event listener from a node
|
|
75
|
+
* @param node - The node to remove the listener from
|
|
76
|
+
* @param event - The event name
|
|
77
|
+
* @param handler - The event handler function
|
|
78
|
+
*/
|
|
79
|
+
removeEventListener(node: RenderNode, event: string, handler: EventHandler): void;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Platform-agnostic props that should be supported across all renderers
|
|
83
|
+
*/
|
|
84
|
+
interface CommonProps {
|
|
85
|
+
width?: number | string;
|
|
86
|
+
height?: number | string;
|
|
87
|
+
padding?: number;
|
|
88
|
+
paddingTop?: number;
|
|
89
|
+
paddingRight?: number;
|
|
90
|
+
paddingBottom?: number;
|
|
91
|
+
paddingLeft?: number;
|
|
92
|
+
margin?: number;
|
|
93
|
+
marginTop?: number;
|
|
94
|
+
marginRight?: number;
|
|
95
|
+
marginBottom?: number;
|
|
96
|
+
marginLeft?: number;
|
|
97
|
+
flexDirection?: 'row' | 'column';
|
|
98
|
+
justifyContent?: 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly';
|
|
99
|
+
alignItems?: 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline';
|
|
100
|
+
gap?: number;
|
|
101
|
+
flex?: number;
|
|
102
|
+
flexWrap?: 'nowrap' | 'wrap' | 'wrap-reverse';
|
|
103
|
+
bg?: string;
|
|
104
|
+
color?: string;
|
|
105
|
+
borderRadius?: number;
|
|
106
|
+
borderWidth?: number;
|
|
107
|
+
borderColor?: string;
|
|
108
|
+
opacity?: number;
|
|
109
|
+
fontSize?: number;
|
|
110
|
+
fontWeight?: number | string;
|
|
111
|
+
fontFamily?: string;
|
|
112
|
+
lineHeight?: number;
|
|
113
|
+
textAlign?: 'left' | 'center' | 'right';
|
|
114
|
+
onPress?: EventHandler;
|
|
115
|
+
onHover?: EventHandler;
|
|
116
|
+
onChange?: EventHandler;
|
|
117
|
+
onFocus?: EventHandler;
|
|
118
|
+
onBlur?: EventHandler;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Child types that can be rendered
|
|
122
|
+
*/
|
|
123
|
+
type FNodeChild = FNode | string | number | boolean | null | undefined | FNodeChild[];
|
|
124
|
+
/**
|
|
125
|
+
* Flexium Node - lightweight element descriptor for JSX
|
|
126
|
+
* (Not a Virtual DOM - just a simple descriptor that gets immediately converted to real DOM)
|
|
127
|
+
*/
|
|
128
|
+
interface FNode {
|
|
129
|
+
type: string | Function;
|
|
130
|
+
props: Record<string, unknown>;
|
|
131
|
+
children: FNodeChild[];
|
|
132
|
+
key?: string | number;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export type { CommonProps as C, EventHandler as E, FNode as F, Renderer as R, FNodeChild as a };
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { S as Signal, C as Computed } from './signal-mNtlF8-v.cjs';
|
|
2
|
+
import { a as FNodeChild, F as FNode } from './renderer-DSLb-FGg.cjs';
|
|
3
|
+
|
|
4
|
+
interface Location {
|
|
5
|
+
pathname: string;
|
|
6
|
+
search: string;
|
|
7
|
+
hash: string;
|
|
8
|
+
query: Record<string, string>;
|
|
9
|
+
}
|
|
10
|
+
interface RouterContext {
|
|
11
|
+
location: Signal<Location> | Computed<Location>;
|
|
12
|
+
params: Signal<Record<string, string>> | Computed<Record<string, string>>;
|
|
13
|
+
navigate: (path: string) => void;
|
|
14
|
+
matches: Signal<RouteMatch[]> | Computed<RouteMatch[]>;
|
|
15
|
+
}
|
|
16
|
+
interface RouteProps {
|
|
17
|
+
path?: string;
|
|
18
|
+
index?: boolean;
|
|
19
|
+
component: Function;
|
|
20
|
+
children?: FNodeChild;
|
|
21
|
+
beforeEnter?: (params: Record<string, string>) => boolean | Promise<boolean>;
|
|
22
|
+
}
|
|
23
|
+
interface RouteMatch {
|
|
24
|
+
route: RouteDef;
|
|
25
|
+
params: Record<string, string>;
|
|
26
|
+
pathname: string;
|
|
27
|
+
}
|
|
28
|
+
interface RouteDef {
|
|
29
|
+
path: string;
|
|
30
|
+
index: boolean;
|
|
31
|
+
component: Function;
|
|
32
|
+
children: RouteDef[];
|
|
33
|
+
beforeEnter?: (params: Record<string, string>) => boolean | Promise<boolean>;
|
|
34
|
+
}
|
|
35
|
+
interface LinkProps {
|
|
36
|
+
to: string;
|
|
37
|
+
class?: string;
|
|
38
|
+
children?: FNodeChild;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Router Core Module
|
|
43
|
+
*
|
|
44
|
+
* Provides core routing functionality including location management,
|
|
45
|
+
* path matching, and navigation.
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Creates a reactive location signal and navigate function.
|
|
50
|
+
*
|
|
51
|
+
* The location signal automatically updates when:
|
|
52
|
+
* - navigate() is called
|
|
53
|
+
* - Browser back/forward buttons are used (popstate event)
|
|
54
|
+
*
|
|
55
|
+
* @returns Tuple of [location signal, navigate function, cleanup function]
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```tsx
|
|
59
|
+
* const [location, navigate, cleanup] = createLocation();
|
|
60
|
+
* // Access current path
|
|
61
|
+
* console.log(location().pathname);
|
|
62
|
+
* // Navigate to new path
|
|
63
|
+
* navigate('/users/123');
|
|
64
|
+
* // Cleanup when done (removes popstate listener)
|
|
65
|
+
* cleanup();
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
declare function createLocation(): [Signal<Location>, (path: string) => void, () => void];
|
|
69
|
+
/**
|
|
70
|
+
* Check if a path contains unsafe protocols (XSS prevention)
|
|
71
|
+
* @param path - Path to validate
|
|
72
|
+
* @returns true if path is unsafe
|
|
73
|
+
*/
|
|
74
|
+
declare function isUnsafePath(path: string): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Sanitize query parameter value to prevent XSS
|
|
77
|
+
* @param value - Query parameter value
|
|
78
|
+
* @returns Sanitized value
|
|
79
|
+
*/
|
|
80
|
+
declare function sanitizeQueryValue(value: string): string;
|
|
81
|
+
/**
|
|
82
|
+
* Matches a pathname against a route pattern.
|
|
83
|
+
*
|
|
84
|
+
* Supports dynamic segments with `:param` syntax.
|
|
85
|
+
*
|
|
86
|
+
* @param pathname - Current URL pathname (e.g., "/users/123")
|
|
87
|
+
* @param routePath - Route pattern (e.g., "/users/:id")
|
|
88
|
+
* @returns Object with `matches` boolean and extracted `params`
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```tsx
|
|
92
|
+
* const result = matchPath('/users/123', '/users/:id');
|
|
93
|
+
* // { matches: true, params: { id: '123' } }
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
declare function matchPath(pathname: string, routePath: string): {
|
|
97
|
+
matches: boolean;
|
|
98
|
+
params: Record<string, string>;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Get the current router context.
|
|
103
|
+
* Must be called within a <Router> component.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```tsx
|
|
107
|
+
* const r = router()
|
|
108
|
+
* r.navigate('/dashboard')
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
declare function router(): RouterContext;
|
|
112
|
+
declare function Router(props: {
|
|
113
|
+
children: FNodeChild;
|
|
114
|
+
}): () => FNode;
|
|
115
|
+
/**
|
|
116
|
+
* Route configuration component.
|
|
117
|
+
* Doesn't render anything directly; used by Router to build the route tree.
|
|
118
|
+
*/
|
|
119
|
+
declare function Route(_props: RouteProps): null;
|
|
120
|
+
/**
|
|
121
|
+
* Renders the child route content.
|
|
122
|
+
*/
|
|
123
|
+
declare function Outlet(): (() => FNode | null) | null;
|
|
124
|
+
declare function Link(props: LinkProps): FNode;
|
|
125
|
+
|
|
126
|
+
export { Link, type LinkProps, type Location, Outlet, Route, type RouteDef, type RouteMatch, type RouteProps, Router, type RouterContext, createLocation, isUnsafePath, matchPath, router, sanitizeQueryValue };
|
package/dist/router.d.ts
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { S as Signal, C as Computed } from './signal-mNtlF8-v.js';
|
|
2
|
+
import { a as FNodeChild, F as FNode } from './renderer-DSLb-FGg.js';
|
|
3
|
+
|
|
4
|
+
interface Location {
|
|
5
|
+
pathname: string;
|
|
6
|
+
search: string;
|
|
7
|
+
hash: string;
|
|
8
|
+
query: Record<string, string>;
|
|
9
|
+
}
|
|
10
|
+
interface RouterContext {
|
|
11
|
+
location: Signal<Location> | Computed<Location>;
|
|
12
|
+
params: Signal<Record<string, string>> | Computed<Record<string, string>>;
|
|
13
|
+
navigate: (path: string) => void;
|
|
14
|
+
matches: Signal<RouteMatch[]> | Computed<RouteMatch[]>;
|
|
15
|
+
}
|
|
16
|
+
interface RouteProps {
|
|
17
|
+
path?: string;
|
|
18
|
+
index?: boolean;
|
|
19
|
+
component: Function;
|
|
20
|
+
children?: FNodeChild;
|
|
21
|
+
beforeEnter?: (params: Record<string, string>) => boolean | Promise<boolean>;
|
|
22
|
+
}
|
|
23
|
+
interface RouteMatch {
|
|
24
|
+
route: RouteDef;
|
|
25
|
+
params: Record<string, string>;
|
|
26
|
+
pathname: string;
|
|
27
|
+
}
|
|
28
|
+
interface RouteDef {
|
|
29
|
+
path: string;
|
|
30
|
+
index: boolean;
|
|
31
|
+
component: Function;
|
|
32
|
+
children: RouteDef[];
|
|
33
|
+
beforeEnter?: (params: Record<string, string>) => boolean | Promise<boolean>;
|
|
34
|
+
}
|
|
35
|
+
interface LinkProps {
|
|
36
|
+
to: string;
|
|
37
|
+
class?: string;
|
|
38
|
+
children?: FNodeChild;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Router Core Module
|
|
43
|
+
*
|
|
44
|
+
* Provides core routing functionality including location management,
|
|
45
|
+
* path matching, and navigation.
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Creates a reactive location signal and navigate function.
|
|
50
|
+
*
|
|
51
|
+
* The location signal automatically updates when:
|
|
52
|
+
* - navigate() is called
|
|
53
|
+
* - Browser back/forward buttons are used (popstate event)
|
|
54
|
+
*
|
|
55
|
+
* @returns Tuple of [location signal, navigate function, cleanup function]
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```tsx
|
|
59
|
+
* const [location, navigate, cleanup] = createLocation();
|
|
60
|
+
* // Access current path
|
|
61
|
+
* console.log(location().pathname);
|
|
62
|
+
* // Navigate to new path
|
|
63
|
+
* navigate('/users/123');
|
|
64
|
+
* // Cleanup when done (removes popstate listener)
|
|
65
|
+
* cleanup();
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
declare function createLocation(): [Signal<Location>, (path: string) => void, () => void];
|
|
69
|
+
/**
|
|
70
|
+
* Check if a path contains unsafe protocols (XSS prevention)
|
|
71
|
+
* @param path - Path to validate
|
|
72
|
+
* @returns true if path is unsafe
|
|
73
|
+
*/
|
|
74
|
+
declare function isUnsafePath(path: string): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Sanitize query parameter value to prevent XSS
|
|
77
|
+
* @param value - Query parameter value
|
|
78
|
+
* @returns Sanitized value
|
|
79
|
+
*/
|
|
80
|
+
declare function sanitizeQueryValue(value: string): string;
|
|
81
|
+
/**
|
|
82
|
+
* Matches a pathname against a route pattern.
|
|
83
|
+
*
|
|
84
|
+
* Supports dynamic segments with `:param` syntax.
|
|
85
|
+
*
|
|
86
|
+
* @param pathname - Current URL pathname (e.g., "/users/123")
|
|
87
|
+
* @param routePath - Route pattern (e.g., "/users/:id")
|
|
88
|
+
* @returns Object with `matches` boolean and extracted `params`
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```tsx
|
|
92
|
+
* const result = matchPath('/users/123', '/users/:id');
|
|
93
|
+
* // { matches: true, params: { id: '123' } }
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
declare function matchPath(pathname: string, routePath: string): {
|
|
97
|
+
matches: boolean;
|
|
98
|
+
params: Record<string, string>;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Get the current router context.
|
|
103
|
+
* Must be called within a <Router> component.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```tsx
|
|
107
|
+
* const r = router()
|
|
108
|
+
* r.navigate('/dashboard')
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
declare function router(): RouterContext;
|
|
112
|
+
declare function Router(props: {
|
|
113
|
+
children: FNodeChild;
|
|
114
|
+
}): () => FNode;
|
|
115
|
+
/**
|
|
116
|
+
* Route configuration component.
|
|
117
|
+
* Doesn't render anything directly; used by Router to build the route tree.
|
|
118
|
+
*/
|
|
119
|
+
declare function Route(_props: RouteProps): null;
|
|
120
|
+
/**
|
|
121
|
+
* Renders the child route content.
|
|
122
|
+
*/
|
|
123
|
+
declare function Outlet(): (() => FNode | null) | null;
|
|
124
|
+
declare function Link(props: LinkProps): FNode;
|
|
125
|
+
|
|
126
|
+
export { Link, type LinkProps, type Location, Outlet, Route, type RouteDef, type RouteMatch, type RouteProps, Router, type RouterContext, createLocation, isUnsafePath, matchPath, router, sanitizeQueryValue };
|
package/dist/router.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunkV4K6WOXN_js=require('./chunk-V4K6WOXN.js');require('./chunk-CNY6FPKJ.js'),require('./chunk-Q7IWDVJ4.js'),require('./chunk-WQFQO5LK.js'),require('./chunk-ROYFUJN5.js');Object.defineProperty(exports,"Link",{enumerable:true,get:function(){return chunkV4K6WOXN_js.i}});Object.defineProperty(exports,"Outlet",{enumerable:true,get:function(){return chunkV4K6WOXN_js.h}});Object.defineProperty(exports,"Route",{enumerable:true,get:function(){return chunkV4K6WOXN_js.g}});Object.defineProperty(exports,"Router",{enumerable:true,get:function(){return chunkV4K6WOXN_js.f}});Object.defineProperty(exports,"createLocation",{enumerable:true,get:function(){return chunkV4K6WOXN_js.a}});Object.defineProperty(exports,"isUnsafePath",{enumerable:true,get:function(){return chunkV4K6WOXN_js.b}});Object.defineProperty(exports,"matchPath",{enumerable:true,get:function(){return chunkV4K6WOXN_js.d}});Object.defineProperty(exports,"router",{enumerable:true,get:function(){return chunkV4K6WOXN_js.e}});Object.defineProperty(exports,"sanitizeQueryValue",{enumerable:true,get:function(){return chunkV4K6WOXN_js.c}});//# sourceMappingURL=router.js.map
|
|
2
|
+
//# sourceMappingURL=router.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"router.js"}
|