@wuchale/jsx 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,11 @@
1
+ import type { Composite, Mixed } from 'wuchale';
2
+ export type WuchaleComponentProps = {
3
+ nest?: boolean;
4
+ ctx: Composite;
5
+ tags: Function;
6
+ args: any[];
7
+ };
8
+ export declare function selectFragment({ nest, ctx, tags, args }: WuchaleComponentProps, i: number): string | Mixed | Composite;
9
+ declare const _default: (props: WuchaleComponentProps) => (string | Composite | Mixed)[];
10
+ export default _default;
11
+ //# sourceMappingURL=runtime.d.ts.map
@@ -0,0 +1,23 @@
1
+ export function selectFragment({ nest, ctx, tags, args }, i) {
2
+ if (typeof ctx === 'string') {
3
+ return ctx;
4
+ }
5
+ if (typeof ctx === 'number') {
6
+ if (!nest || i > 0) {
7
+ return args[ctx];
8
+ }
9
+ }
10
+ else {
11
+ const tag = tags[ctx[0]];
12
+ if (tag == null) {
13
+ return 'i18n-404:tag';
14
+ }
15
+ else {
16
+ return tag(ctx);
17
+ }
18
+ }
19
+ }
20
+ export default (props) => {
21
+ return props.ctx.map((fragment, i) => selectFragment({ ...props, ctx: fragment }, i));
22
+ };
23
+ //# sourceMappingURL=runtime.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.jsx","sourceRoot":"","sources":["../src/runtime.tsx"],"names":[],"mappings":"AASA,MAAM,UAAU,cAAc,CAAC,EAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAwB,EAAE,CAAS;IACpF,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC1B,OAAO,GAAG,CAAA;IACd,CAAC;IAAC,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC5B,IAAI,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YACjB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAA;QACpB,CAAC;IACL,CAAC;SAAM,CAAC;QACJ,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAW,CAAC,CAAA;QAClC,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;YACd,OAAO,cAAc,CAAA;QACzB,CAAC;aAAM,CAAC;YACJ,OAAO,GAAG,CAAC,GAAG,CAAC,CAAA;QACnB,CAAC;IACL,CAAC;AACL,CAAC;AAED,eAAe,CAAC,KAA4B,EAAE,EAAE;IAC5C,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC,cAAc,CAAC,EAAC,GAAG,KAAK,EAAE,GAAG,EAAE,QAAqB,EAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AACpG,CAAC,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { type WuchaleComponentProps } from './runtime.jsx';
2
+ declare const _default: (props: WuchaleComponentProps) => any;
3
+ export default _default;
4
+ //# sourceMappingURL=runtime.solid.d.ts.map
@@ -0,0 +1,8 @@
1
+ import { selectFragment } from './runtime.jsx';
2
+ import { For } from 'solid-js';
3
+ export default (props) => {
4
+ return <For each={props.ctx}>
5
+ {(fragment, i) => <>{selectFragment({ ...props, ctx: fragment }, i())}</>}
6
+ </For>;
7
+ };
8
+ //# sourceMappingURL=runtime.solid.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.solid.jsx","sourceRoot":"","sources":["../src/runtime.solid.tsx"],"names":[],"mappings":"AACA,OAAO,EAA8B,cAAc,EAAE,MAAM,eAAe,CAAA;AAC1E,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAE9B,eAAe,CAAC,KAA4B,EAAE,EAAE;IAC5C,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CACxB;QAAA,CAAC,CAAC,QAAmB,EAAE,CAAe,EAAE,EAAE,CAAC,EAAE,CAAC,cAAc,CAAC,EAAC,GAAG,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,CACpG;IAAA,EAAE,GAAG,CAAC,CAAA;AACV,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wuchale/jsx",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Protobuf-like i18n from normal code for JSX",
5
5
  "scripts": {
6
6
  "dev": "tsc --watch",