@moneko/solid 1.10.2 → 1.10.3-beta.0
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/lib/get-pathname.js +1 -1
- package/lib/get-pathname.js.map +1 -1
- package/{mdx.d.ts → mdx/index.d.ts} +2 -2
- package/{mdx.js → mdx/index.js} +1 -1
- package/mdx/index.js.map +1 -0
- package/package.json +9 -10
- package/mdx.js.map +0 -1
package/lib/get-pathname.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t from"@app/info";let e=t.base.length,n=e>1
|
|
1
|
+
import t from"@app/info";let e=t.base.length,n=e>1&&!function(t,e){let n=t.length;return!(1>n)&&t.lastIndexOf("/")===n-1}(t.base,0)?e+1:e;export default function(t){return t.pathname.substring(n)}
|
|
2
2
|
//# sourceMappingURL=get-pathname.js.map
|
package/lib/get-pathname.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/get-pathname.ts"],"sourcesContent":["import type { Location } from '@solidjs/router';\nimport app from '@app/info';\n\nconst len = app.base.length;\nconst prefix = len > 1 ? (app.base
|
|
1
|
+
{"version":3,"sources":["../src/get-pathname.ts"],"sourcesContent":["import type { Location } from '@solidjs/router';\nimport app from '@app/info';\n\nfunction endsWith(str: string, suffix: string): boolean {\n const strLen = str.length;\n const suffixLen = suffix.length;\n\n if (suffixLen > strLen) {\n return false;\n }\n return str.lastIndexOf(suffix) === strLen - suffixLen;\n}\nconst len = app.base.length;\nconst prefix = len > 1 ? (endsWith(app.base, '/') ? len : len + 1) : len;\n\nfunction getPathName(location: Location) {\n return location.pathname.substring(prefix);\n}\n\nexport default getPathName;\n"],"names":["app","len","base","length","prefix","endsWith","str","suffix","strLen","suffixLen","lastIndexOf","location","pathname","substring"],"mappings":"AACA,OAAOA,MAAS,WAAY,CAW5B,IAAMC,EAAMD,EAAIE,IAAI,CAACC,MAAM,CACrBC,EAASH,EAAM,IAAKI,AAV1B,SAAkBC,CAAW,CAAEC,CAAc,EAC3C,IAAMC,EAASF,EAAIH,MAAM,OAGzB,CAAIM,CAAAA,AAMuC,EAN3BD,CAAK,GAGdF,EAAII,WAAW,CAGqB,OAHRF,EAGQ,CAF7C,EAEmCR,EAAIE,IAAI,CAAE,GAAaD,EAAM,EAAZA,CAMpD,gBAJA,SAAqBU,CAAkB,EACrC,OAAOA,EAASC,QAAQ,CAACC,SAAS,CAACT,EACrC"}
|
|
@@ -6,10 +6,10 @@ export declare function useMDXComponents(components: MDXProviderProps['component
|
|
|
6
6
|
export declare function withMDXComponents(Comp: Component<{
|
|
7
7
|
components?: MDXComponents;
|
|
8
8
|
allComponents?: MDXComponents;
|
|
9
|
-
}>): (props: MDXProviderProps) =>
|
|
9
|
+
}>): (props: MDXProviderProps) => JSX.Element;
|
|
10
10
|
export interface MDXProviderProps extends Component {
|
|
11
11
|
children: JSX.Element;
|
|
12
12
|
components: MDXComponents | ((props: ParentProps) => MDXComponents);
|
|
13
13
|
disableParentContext?: boolean;
|
|
14
14
|
}
|
|
15
|
-
export declare function MDXProvider({ components, children, disableParentContext }: MDXProviderProps):
|
|
15
|
+
export declare function MDXProvider({ components, children, disableParentContext }: MDXProviderProps): JSX.Element;
|
package/{mdx.js → mdx/index.js}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import{mergeProps as o}from"solid-js/web";import{createComponent as e}from"solid-js/web";import{createContext as n,useContext as t}from"solid-js";let r={},s=n(r);export function useMDXComponents(o){let e=t(s);return"function"==typeof o?o(e):Object.assign(e,o)}export function withMDXComponents(n){return function(t){let r=useMDXComponents(t.components);return e(n,o(t,{allComponents:r,components:r}))}}export function MDXProvider({components:o,children:n,disableParentContext:t}){let i;return i=t?"function"==typeof o?o(r):o||r:useMDXComponents(o),e(s.Provider,{value:i,children:n})}
|
|
2
2
|
|
|
3
|
-
//# sourceMappingURL=
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
package/mdx/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../tools/index.tsx"],"names":[],"mappings":"wFAAA,QAAS,iBAAA,CAAa,CAAE,cAAA,CAAU,KAAoD,UAAW,CAMjG,IAAM,EAAuC,CAAC,EACxC,EAAa,EAAc,EAEjC,QAAO,SAAS,iBAAiB,CAA0C,EACzE,IAAM,EAAoB,EAAW,SAErC,AAAI,AAAsB,YAAtB,OAAO,EACF,EAAW,GAGb,OAAO,MAAM,CAAC,EAAmB,EAC1C,CACA,OAAO,SAAS,kBACd,CAGE,EAOF,OALA,SAA2B,CAAuB,EAChD,IAAM,EAAgB,iBAAiB,EAAM,UAAU,EAEvD,SAAQ,IAAS,iBAAsB,aAA2B,IACpE,CAEF,CAQA,OAAO,SAAS,YAAY,CAAE,WAAA,CAAU,CAAE,SAAA,CAAQ,CAAE,qBAAA,CAAoB,CAAoB,EAC1F,IAAI,EASJ,OANE,EADE,EAEA,AAAsB,YAAtB,OAAO,EAA4B,EAAW,GAAe,GAAc,EAE7D,iBAAiB,KAG3B,EAAW,gBAAgB,WAAgB,GACrD","file":"index.js","sourcesContent":["import { createContext, useContext, type ParentProps, type JSX, type Component } from 'solid-js';\n\nexport interface MDXComponents {\n [k: string]: (props: ParentProps) => JSX.Element;\n}\n\nconst emptyObject: Readonly<MDXComponents> = {};\nconst MDXContext = createContext(emptyObject);\n\nexport function useMDXComponents(components: MDXProviderProps['components']) {\n const contextComponents = useContext(MDXContext);\n\n if (typeof components === 'function') {\n return components(contextComponents);\n }\n\n return Object.assign(contextComponents, components);\n}\nexport function withMDXComponents(\n Comp: Component<{\n components?: MDXComponents;\n allComponents?: MDXComponents;\n }>\n) {\n function boundMDXComponent(props: MDXProviderProps) {\n const allComponents = useMDXComponents(props.components);\n\n return <Comp {...props} allComponents={allComponents} components={allComponents} />;\n }\n return boundMDXComponent;\n}\n\nexport interface MDXProviderProps extends Component {\n children: JSX.Element;\n components: MDXComponents | ((props: ParentProps) => MDXComponents);\n disableParentContext?: boolean;\n}\n\nexport function MDXProvider({ components, children, disableParentContext }: MDXProviderProps) {\n let allComponents: MDXComponents;\n\n if (disableParentContext) {\n allComponents =\n typeof components === 'function' ? components(emptyObject) : components || emptyObject;\n } else {\n allComponents = useMDXComponents(components);\n }\n\n return <MDXContext.Provider value={allComponents}>{children}</MDXContext.Provider>;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/solid",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.3-beta.0",
|
|
4
4
|
"description": "Solid js",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"prebuild": "rm -rf ./lib",
|
|
8
|
-
"postbuild": "tsc && tsc --
|
|
9
|
-
"build": "swc src -d lib --strip-leading-paths -D && swc
|
|
7
|
+
"prebuild": "rm -rf ./lib && rm -rf ./mdx",
|
|
8
|
+
"postbuild": "tsc --project dts.src.json && tsc --project dts.mdx.json",
|
|
9
|
+
"build": "swc src -d lib --strip-leading-paths -D && swc tools/index.tsx -o mdx/index.js",
|
|
10
|
+
"prepublishOnly": "npm run build"
|
|
10
11
|
},
|
|
11
12
|
"author": "moneko",
|
|
12
13
|
"type": "module",
|
|
13
14
|
"license": "MIT",
|
|
14
15
|
"dependencies": {
|
|
15
|
-
"@moneko/jsx-dom-expressions": "0.
|
|
16
|
+
"@moneko/jsx-dom-expressions": "0.7.1",
|
|
16
17
|
"@solidjs/router": "0.10.8",
|
|
17
18
|
"solid-refresh": "0.7.5"
|
|
18
19
|
},
|
|
19
20
|
"devDependencies": {
|
|
20
|
-
"@moneko/transform-imports": "0.
|
|
21
|
+
"@moneko/transform-imports": "0.7.0",
|
|
21
22
|
"@swc/cli": "0.4.0",
|
|
22
23
|
"@swc/core": "1.6.13",
|
|
23
|
-
"solid-js": "1.8.
|
|
24
|
+
"solid-js": "1.8.20",
|
|
24
25
|
"typescript": "5.5.4"
|
|
25
26
|
},
|
|
26
27
|
"files": [
|
|
@@ -29,8 +30,6 @@
|
|
|
29
30
|
"base.json",
|
|
30
31
|
"lib.json",
|
|
31
32
|
"env.d.ts",
|
|
32
|
-
"mdx
|
|
33
|
-
"mdx.js.map",
|
|
34
|
-
"mdx.d.ts"
|
|
33
|
+
"mdx"
|
|
35
34
|
]
|
|
36
35
|
}
|
package/mdx.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["mdx.tsx"],"names":[],"mappings":"wFAAA,QAAS,iBAAA,CAAa,CAAE,cAAA,CAAU,KAAoD,UAAW,CAMjG,IAAM,EAAuC,CAAC,EACxC,EAAa,EAAc,EAEjC,QAAO,SAAS,iBAAiB,CAA0C,EACzE,IAAM,EAAoB,EAAW,SAErC,AAAI,AAAsB,YAAtB,OAAO,EACF,EAAW,GAGb,OAAO,MAAM,CAAC,EAAmB,EAC1C,CACA,OAAO,SAAS,kBAAkB,CAGhC,EAOA,OANA,SAA2B,CAAuB,EAChD,IAAM,EAAgB,iBAAiB,EAAM,UAAU,EAGvD,SAAQ,IAAS,iBAAsB,aAA2B,IACpE,CAEF,CAQA,OAAO,SAAS,YAAY,CAAE,WAAA,CAAU,CAAE,SAAA,CAAQ,CAAE,qBAAA,CAAoB,CAAoB,EAC1F,IAAI,EASJ,OANE,EADE,EAEA,AAAsB,YAAtB,OAAO,EAA4B,EAAW,GAAe,GAAc,EAE7D,iBAAiB,KAG3B,EAAW,gBAAgB,WAAyB,GAC9D","file":"mdx.js","sourcesContent":["import { createContext, useContext, type ParentProps, type JSX, type Component } from 'solid-js';\n\nexport interface MDXComponents {\n [k: string]: (props: ParentProps) => JSX.Element;\n}\n\nconst emptyObject: Readonly<MDXComponents> = {};\nconst MDXContext = createContext(emptyObject);\n\nexport function useMDXComponents(components: MDXProviderProps['components']) {\n const contextComponents = useContext(MDXContext);\n\n if (typeof components === 'function') {\n return components(contextComponents);\n }\n\n return Object.assign(contextComponents, components);\n}\nexport function withMDXComponents(Comp: Component<{\n components?: MDXComponents;\n allComponents?: MDXComponents;\n}>) {\n function boundMDXComponent(props: MDXProviderProps) {\n const allComponents = useMDXComponents(props.components);\n\n \n return <Comp {...props} allComponents={allComponents} components={allComponents} />;\n }\n return boundMDXComponent;\n}\n\nexport interface MDXProviderProps extends Component {\n children: JSX.Element;\n components: MDXComponents | ((props: ParentProps) => MDXComponents);\n disableParentContext?: boolean;\n}\n\nexport function MDXProvider({ components, children, disableParentContext }: MDXProviderProps) {\n let allComponents: MDXComponents;\n\n if (disableParentContext) {\n allComponents =\n typeof components === 'function' ? components(emptyObject) : components || emptyObject;\n } else {\n allComponents = useMDXComponents(components);\n }\n\n return <MDXContext.Provider value={allComponents} children={children} />;\n}\n"]}
|