@ssgoi/solid 7.1.2 → 7.1.3-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -12,6 +12,18 @@ npm install @ssgoi/solid
12
12
 
13
13
  Agent setup guide: https://ssgoi.dev/llms/solid.txt
14
14
 
15
+ ## Router helpers
16
+
17
+ Install this framework package once; router helpers are optional subpaths.
18
+ These router helpers are experimental APIs and may change.
19
+
20
+ | Router | Import | API |
21
+ | ------------ | --------------------------- | -------------------- |
22
+ | Solid Router | `@ssgoi/solid/solid-router` | `SsgoiRouteBoundary` |
23
+ | SolidStart | `@ssgoi/solid/solidstart` | `SsgoiRouteBoundary` |
24
+
25
+ See the [framework guide](https://ssgoi.dev/docs/frameworks/solid) for wiring and limits.
26
+
15
27
  ## Root
16
28
 
17
29
  Use one `<Ssgoi>` around file routes.
@@ -0,0 +1,14 @@
1
+ import { JSX } from 'solid-js';
2
+ export interface RouteBoundaryState {
3
+ id: string;
4
+ key?: string | number;
5
+ }
6
+ export type SsgoiRouteBoundaryProps = JSX.HTMLAttributes<HTMLElement> & {
7
+ as?: keyof JSX.IntrinsicElements;
8
+ routeKey?: string | number;
9
+ resolve?: (location: {
10
+ pathname: string;
11
+ }) => RouteBoundaryState;
12
+ };
13
+ /** @experimental Solid Router integration, including SolidStart. The API may change. */
14
+ export declare function SsgoiRouteBoundary(props: SsgoiRouteBoundaryProps): JSX.Element;
@@ -0,0 +1,3 @@
1
+ /** @experimental SolidStart integration through Solid Router. The API may change. */
2
+ export { SsgoiRouteBoundary } from './solid-router';
3
+ export type { SsgoiRouteBoundaryProps, RouteBoundaryState, } from './solid-router';
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("solid-js/web"),l=require("@solidjs/router"),r=require("solid-js");function m(a){const n=l.useLocation(),[e,u]=r.splitProps(a,["children","as","resolve","routeKey"]),i=r.createMemo(()=>e.resolve?.({pathname:n.pathname})??{id:n.pathname}),d=r.createMemo(o=>{const c=i(),s=e.routeKey??c.key??c.id;return o?.key===s?o:{key:s}});return t.createComponent(r.Show,{get when(){return d()},keyed:!0,children:o=>t.createComponent(t.Dynamic,t.mergeProps({get component(){return e.as??"div"}},u,{get"data-ssgoi-transition"(){return i().id},get children(){return e.children}}))})}exports.SsgoiRouteBoundary=m;
@@ -0,0 +1,2 @@
1
+ export * from './routers/solid-router'
2
+ export {}
@@ -0,0 +1,36 @@
1
+ import { createComponent as a, Dynamic as d, mergeProps as l } from "solid-js/web";
2
+ import { useLocation as p } from "@solidjs/router";
3
+ import { splitProps as h, createMemo as c, Show as y } from "solid-js";
4
+ function v(s) {
5
+ const r = p(), [e, m] = h(s, ["children", "as", "resolve", "routeKey"]), o = c(() => e.resolve?.({
6
+ pathname: r.pathname
7
+ }) ?? {
8
+ id: r.pathname
9
+ }), u = c((t) => {
10
+ const n = o(), i = e.routeKey ?? n.key ?? n.id;
11
+ return t?.key === i ? t : {
12
+ key: i
13
+ };
14
+ });
15
+ return a(y, {
16
+ get when() {
17
+ return u();
18
+ },
19
+ keyed: !0,
20
+ children: (t) => a(d, l({
21
+ get component() {
22
+ return e.as ?? "div";
23
+ }
24
+ }, m, {
25
+ get "data-ssgoi-transition"() {
26
+ return o().id;
27
+ },
28
+ get children() {
29
+ return e.children;
30
+ }
31
+ }))
32
+ });
33
+ }
34
+ export {
35
+ v as SsgoiRouteBoundary
36
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("solid-js/web"),l=require("@solidjs/router"),r=require("solid-js");function m(a){const n=l.useLocation(),[e,u]=r.splitProps(a,["children","as","resolve","routeKey"]),i=r.createMemo(()=>e.resolve?.({pathname:n.pathname})??{id:n.pathname}),d=r.createMemo(o=>{const c=i(),s=e.routeKey??c.key??c.id;return o?.key===s?o:{key:s}});return t.createComponent(r.Show,{get when(){return d()},keyed:!0,children:o=>t.createComponent(t.Dynamic,t.mergeProps({get component(){return e.as??"div"}},u,{get"data-ssgoi-transition"(){return i().id},get children(){return e.children}}))})}exports.SsgoiRouteBoundary=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./solid-router.cjs");exports.SsgoiRouteBoundary=o.SsgoiRouteBoundary;
@@ -1,14 +1,2 @@
1
- import { JSX } from 'solid-js';
2
- export interface RouteBoundaryState {
3
- id: string;
4
- key?: string | number;
5
- }
6
- export type SsgoiRouteBoundaryProps = JSX.HTMLAttributes<HTMLElement> & {
7
- as?: keyof JSX.IntrinsicElements;
8
- routeKey?: string | number;
9
- resolve?: (location: {
10
- pathname: string;
11
- }) => RouteBoundaryState;
12
- };
13
- /** Solid Router boundary, including SolidStart. */
14
- export declare function SsgoiRouteBoundary(props: SsgoiRouteBoundaryProps): JSX.Element;
1
+ export * from './routers/solidstart'
2
+ export {}
@@ -1,36 +1,4 @@
1
- import { createComponent as a, Dynamic as d, mergeProps as l } from "solid-js/web";
2
- import { useLocation as p } from "@solidjs/router";
3
- import { splitProps as h, createMemo as c, Show as y } from "solid-js";
4
- function v(s) {
5
- const r = p(), [e, m] = h(s, ["children", "as", "resolve", "routeKey"]), o = c(() => e.resolve?.({
6
- pathname: r.pathname
7
- }) ?? {
8
- id: r.pathname
9
- }), u = c((t) => {
10
- const n = o(), i = e.routeKey ?? n.key ?? n.id;
11
- return t?.key === i ? t : {
12
- key: i
13
- };
14
- });
15
- return a(y, {
16
- get when() {
17
- return u();
18
- },
19
- keyed: !0,
20
- children: (t) => a(d, l({
21
- get component() {
22
- return e.as ?? "div";
23
- }
24
- }, m, {
25
- get "data-ssgoi-transition"() {
26
- return o().id;
27
- },
28
- get children() {
29
- return e.children;
30
- }
31
- }))
32
- });
33
- }
1
+ import { SsgoiRouteBoundary as e } from "./solid-router.js";
34
2
  export {
35
- v as SsgoiRouteBoundary
3
+ e as SsgoiRouteBoundary
36
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ssgoi/solid",
3
- "version": "7.1.2",
3
+ "version": "7.1.3-beta.1",
4
4
  "description": "Solid.js bindings for SSGOI - Native app-like page transitions for Solid applications",
5
5
  "private": false,
6
6
  "type": "module",
@@ -38,15 +38,22 @@
38
38
  "default": "./dist/view-transitions.js"
39
39
  },
40
40
  "./solidstart": {
41
- "solid": "./src/lib/solidstart.tsx",
42
- "types": "./dist/solidstart.d.ts",
41
+ "solid": "./src/lib/routers/solidstart.ts",
42
+ "types": "./dist/routers/solidstart.d.ts",
43
43
  "import": "./dist/solidstart.js",
44
44
  "require": "./dist/solidstart.cjs",
45
45
  "default": "./dist/solidstart.js"
46
+ },
47
+ "./solid-router": {
48
+ "solid": "./src/lib/routers/solid-router.tsx",
49
+ "types": "./dist/routers/solid-router.d.ts",
50
+ "import": "./dist/solid-router.js",
51
+ "require": "./dist/solid-router.cjs",
52
+ "default": "./dist/solid-router.js"
46
53
  }
47
54
  },
48
55
  "dependencies": {
49
- "@ssgoi/core": "^7.1.2"
56
+ "@ssgoi/core": "^7.1.3-beta.1"
50
57
  },
51
58
  "devDependencies": {
52
59
  "@eslint/js": "^9.30.1",
@@ -13,7 +13,7 @@ export type SsgoiRouteBoundaryProps = JSX.HTMLAttributes<HTMLElement> & {
13
13
  resolve?: (location: { pathname: string }) => RouteBoundaryState;
14
14
  };
15
15
 
16
- /** Solid Router boundary, including SolidStart. */
16
+ /** @experimental Solid Router integration, including SolidStart. The API may change. */
17
17
  export function SsgoiRouteBoundary(props: SsgoiRouteBoundaryProps) {
18
18
  const location = useLocation();
19
19
  const [local, rest] = splitProps(props, [
@@ -0,0 +1,6 @@
1
+ /** @experimental SolidStart integration through Solid Router. The API may change. */
2
+ export { SsgoiRouteBoundary } from "./solid-router";
3
+ export type {
4
+ SsgoiRouteBoundaryProps,
5
+ RouteBoundaryState,
6
+ } from "./solid-router";