@lssm/lib.presentation-runtime-core 0.0.0-canary-20251120170226

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 ADDED
@@ -0,0 +1,31 @@
1
+ # @lssm/lib.presentation-runtime-core
2
+
3
+ Core logic for ContractSpec presentation runtimes.
4
+
5
+ ## Purpose
6
+
7
+ To provide the shared, framework-agnostic state management and logic for executing workflows and rendering presentations defined in ContractSpec.
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ npm install @lssm/lib.presentation-runtime-core
13
+ # or
14
+ bun add @lssm/lib.presentation-runtime-core
15
+ ```
16
+
17
+ ## Key Concepts
18
+
19
+ - **Workflow State**: Manages the progression of steps in a `WorkflowSpec`.
20
+ - **Step Navigation**: Logic for next/previous/submit actions.
21
+ - **Validation**: Integration with Zod schemas for step validation.
22
+
23
+ ## Exports
24
+
25
+ - Types and state machines for workflows.
26
+ - Validation helpers.
27
+
28
+ ## Usage
29
+
30
+ Typically used internally by `@lssm/lib.presentation-runtime-react` or `@lssm/lib.presentation-runtime-react-native`.
31
+
@@ -0,0 +1,27 @@
1
+ //#region src/index.d.ts
2
+ interface ListState<TFilters extends Record<string, unknown>> {
3
+ q: string;
4
+ page: number;
5
+ limit: number;
6
+ sort?: string | null;
7
+ filters: TFilters;
8
+ }
9
+ type ListFetcher<TVars, TItem> = (vars: TVars) => Promise<{
10
+ items: TItem[];
11
+ totalItems?: number;
12
+ totalPages?: number;
13
+ }>;
14
+ interface NextAliasOptions {
15
+ uiKitWeb?: string;
16
+ uiKitNative?: string;
17
+ presentationReact?: string;
18
+ presentationNative?: string;
19
+ }
20
+ declare function withPresentationNextAliases(config: any, opts?: NextAliasOptions): any;
21
+ type MetroAliasOptions = NextAliasOptions & {
22
+ monorepoRoot?: string;
23
+ };
24
+ declare function withPresentationMetroAliases(config: any, opts?: MetroAliasOptions): any;
25
+ //#endregion
26
+ export { ListFetcher, ListState, MetroAliasOptions, NextAliasOptions, withPresentationMetroAliases, withPresentationNextAliases };
27
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";UAAiB,2BAA2B;EAA3B,CAAA,EAAA,MAAA;EAQL,IAAA,EAAA,MAAA;EACJ,KAAA,EAAA,MAAA;EACc,IAAA,CAAA,EAAA,MAAA,GAAA,IAAA;EAAjB,OAAA,EALM,QAKN;;AAGY,KALL,WAKqB,CAAA,KAAA,EAAA,KAAA,CAAA,GAAA,CAAA,IAAA,EAJzB,KAIyB,EAAA,GAH5B,OAG4B,CAAA;EAOjB,KAAA,EAVM,KAUN,EAAA;EA4BJ,UAAA,CAAA,EAAA,MAAA;EAII,UAAA,CAAA,EAAA,MAAA;;UAvCC,gBAAA;;;;;;iBAOD,2BAAA,qBAGR;KAyBI,iBAAA,GAAoB;;;iBAIhB,4BAAA,qBAGR"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ function e(e,t={}){let n=t.uiKitWeb??`@lssm/lib.ui-kit-web`,r=t.uiKitNative??`@lssm/lib.ui-kit`,i=t.presentationReact??`@lssm/lib.presentation-runtime-react`,a=t.presentationNative??`@lssm/lib.presentation-runtime-react-native`;return e.resolve??={},e.resolve.alias={...e.resolve.alias||{},[r]:n,[a]:i},e.resolve.extensions=[`.web.js`,`.web.jsx`,`.web.ts`,`.web.tsx`,...e.resolve.extensions||[]],e}function t(e,t={}){let n=t.uiKitWeb??`@lssm/lib.ui-kit-web`,r=t.uiKitNative??`@lssm/lib.ui-kit`,i=t.presentationReact??`@lssm/lib.presentation-runtime-react`,a=t.presentationNative??`@lssm/lib.presentation-runtime-react-native`;e.resolver??={},e.resolver.unstable_enablePackageExports=!0,e.resolver.platforms=[`ios`,`android`,`native`,`mobile`,`web`,...e.resolver.platforms||[]];let o=e.resolver.resolveRequest;return e.resolver.resolveRequest=(e,t,s)=>{if(s===`ios`||s===`android`||s===`native`){if(typeof t==`string`&&t.startsWith(n+`/ui`)){let i=t.replace(n+`/ui`,r+`/ui`);return(o??e.resolveRequest)(e,i,s)}if(t===i)return(o??e.resolveRequest)(e,a,s)}return(o??e.resolveRequest)(e,t,s)},e}export{t as withPresentationMetroAliases,e as withPresentationNextAliases};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["export interface ListState<TFilters extends Record<string, unknown>> {\n q: string;\n page: number;\n limit: number;\n sort?: string | null;\n filters: TFilters;\n}\n\nexport type ListFetcher<TVars, TItem> = (\n vars: TVars\n) => Promise<{ items: TItem[]; totalItems?: number; totalPages?: number }>;\n\n// ---- Framework config helpers (Next / Metro) ----\nexport interface NextAliasOptions {\n uiKitWeb?: string; // default '@lssm/lib.ui-kit-web'\n uiKitNative?: string; // default '@lssm/lib.ui-kit'\n presentationReact?: string; // default '@lssm/lib.presentation-runtime-react'\n presentationNative?: string; // default '@lssm/lib.presentation-runtime-react-native'\n}\n\nexport function withPresentationNextAliases(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n config: any,\n opts: NextAliasOptions = {}\n) {\n const uiWeb = opts.uiKitWeb ?? '@lssm/lib.ui-kit-web';\n const uiNative = opts.uiKitNative ?? '@lssm/lib.ui-kit';\n const presReact =\n opts.presentationReact ?? '@lssm/lib.presentation-runtime-react';\n const presNative =\n opts.presentationNative ?? '@lssm/lib.presentation-runtime-react-native';\n\n config.resolve ??= {};\n config.resolve.alias = {\n ...(config.resolve.alias || {}),\n [uiNative]: uiWeb,\n [presNative]: presReact,\n };\n config.resolve.extensions = [\n '.web.js',\n '.web.jsx',\n '.web.ts',\n '.web.tsx',\n ...((config.resolve.extensions as string[]) || []),\n ];\n return config;\n}\n\nexport type MetroAliasOptions = NextAliasOptions & {\n monorepoRoot?: string;\n};\n\nexport function withPresentationMetroAliases(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n config: any,\n opts: MetroAliasOptions = {}\n) {\n const uiWeb = opts.uiKitWeb ?? '@lssm/lib.ui-kit-web';\n const uiNative = opts.uiKitNative ?? '@lssm/lib.ui-kit';\n const presReact =\n opts.presentationReact ?? '@lssm/lib.presentation-runtime-react';\n const presNative =\n opts.presentationNative ?? '@lssm/lib.presentation-runtime-react-native';\n\n // Prefer package exports resolution\n config.resolver ??= {};\n config.resolver.unstable_enablePackageExports = true;\n\n // Platform resolution ordering\n config.resolver.platforms = [\n 'ios',\n 'android',\n 'native',\n 'mobile',\n 'web',\n ...((config.resolver.platforms as string[]) || []),\n ];\n\n // Map web kit → native at resolver-level\n const original = config.resolver.resolveRequest;\n config.resolver.resolveRequest = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ctx: any,\n moduleName: string,\n platform: string\n ) => {\n if (platform === 'ios' || platform === 'android' || platform === 'native') {\n if (\n typeof moduleName === 'string' &&\n moduleName.startsWith(uiWeb + '/ui')\n ) {\n const mapped = moduleName.replace(uiWeb + '/ui', uiNative + '/ui');\n return (original ?? ctx.resolveRequest)(ctx, mapped, platform);\n }\n if (moduleName === presReact) {\n return (original ?? ctx.resolveRequest)(ctx, presNative, platform);\n }\n }\n return (original ?? ctx.resolveRequest)(ctx, moduleName, platform);\n };\n\n return config;\n}\n"],"mappings":"AAoBA,SAAgB,EAEd,EACA,EAAyB,EAAE,CAC3B,CACA,IAAM,EAAQ,EAAK,UAAY,uBACzB,EAAW,EAAK,aAAe,mBAC/B,EACJ,EAAK,mBAAqB,uCACtB,EACJ,EAAK,oBAAsB,8CAe7B,MAbA,GAAO,UAAY,EAAE,CACrB,EAAO,QAAQ,MAAQ,CACrB,GAAI,EAAO,QAAQ,OAAS,EAAE,EAC7B,GAAW,GACX,GAAa,EACf,CACD,EAAO,QAAQ,WAAa,CAC1B,UACA,WACA,UACA,WACA,GAAK,EAAO,QAAQ,YAA2B,EAAE,CAClD,CACM,EAOT,SAAgB,EAEd,EACA,EAA0B,EAAE,CAC5B,CACA,IAAM,EAAQ,EAAK,UAAY,uBACzB,EAAW,EAAK,aAAe,mBAC/B,EACJ,EAAK,mBAAqB,uCACtB,EACJ,EAAK,oBAAsB,8CAG7B,EAAO,WAAa,EAAE,CACtB,EAAO,SAAS,8BAAgC,GAGhD,EAAO,SAAS,UAAY,CAC1B,MACA,UACA,SACA,SACA,MACA,GAAK,EAAO,SAAS,WAA0B,EAAE,CAClD,CAGD,IAAM,EAAW,EAAO,SAAS,eAsBjC,MArBA,GAAO,SAAS,gBAEd,EACA,EACA,IACG,CACH,GAAI,IAAa,OAAS,IAAa,WAAa,IAAa,SAAU,CACzE,GACE,OAAO,GAAe,UACtB,EAAW,WAAW,EAAQ,MAAM,CACpC,CACA,IAAM,EAAS,EAAW,QAAQ,EAAQ,MAAO,EAAW,MAAM,CAClE,OAAQ,GAAY,EAAI,gBAAgB,EAAK,EAAQ,EAAS,CAEhE,GAAI,IAAe,EACjB,OAAQ,GAAY,EAAI,gBAAgB,EAAK,EAAY,EAAS,CAGtE,OAAQ,GAAY,EAAI,gBAAgB,EAAK,EAAY,EAAS,EAG7D"}
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@lssm/lib.presentation-runtime-core",
3
+ "version": "0.0.0-canary-20251120170226",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "sideEffects": false,
9
+ "scripts": {
10
+ "build": "bun build:bundle && bun build:types",
11
+ "build:bundle": "tsdown",
12
+ "build:types": "tsc --noEmit -p tsconfig.json",
13
+ "dev": "bun run build:bundle --watch",
14
+ "lint": "bun run lint:fix",
15
+ "lint:fix": "eslint src --fix",
16
+ "lint:check": "eslint src"
17
+ },
18
+ "peerDependencies": {
19
+ "typescript": "^5.9.0"
20
+ },
21
+ "devDependencies": {
22
+ "tsdown": "^0.15.9",
23
+ "typescript": "^5.9.3"
24
+ },
25
+ "files": [
26
+ "dist",
27
+ "README.md"
28
+ ],
29
+ "exports": {
30
+ ".": "./dist/index.js",
31
+ "./*": "./*"
32
+ },
33
+ "publishConfig": {
34
+ "exports": {
35
+ ".": "./dist/index.js",
36
+ "./*": "./*"
37
+ }
38
+ }
39
+ }