rankrunners-cms 0.0.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/CLAUDE.md +106 -0
- package/README.md +15 -0
- package/package.json +39 -0
- package/src/CaptchaBadge.tsx +72 -0
- package/src/editor/blocks/Blank/index.tsx +15 -0
- package/src/editor/blocks/Blank/styles.module.css +4 -0
- package/src/editor/blocks/Button/index.tsx +46 -0
- package/src/editor/blocks/Card/index.tsx +67 -0
- package/src/editor/blocks/Card/styles.module.css +54 -0
- package/src/editor/blocks/Container/index.tsx +36 -0
- package/src/editor/blocks/Flex/index.tsx +82 -0
- package/src/editor/blocks/Flex/styles.module.css +9 -0
- package/src/editor/blocks/Grid/index.tsx +53 -0
- package/src/editor/blocks/Grid/styles.module.css +11 -0
- package/src/editor/blocks/Heading/index.tsx +69 -0
- package/src/editor/blocks/Hero/Hero.tsx +107 -0
- package/src/editor/blocks/Hero/client.tsx +204 -0
- package/src/editor/blocks/Hero/index.tsx +2 -0
- package/src/editor/blocks/Hero/quotes.ts +46 -0
- package/src/editor/blocks/Hero/server.tsx +7 -0
- package/src/editor/blocks/Hero/styles.module.css +116 -0
- package/src/editor/blocks/Logos/index.tsx +77 -0
- package/src/editor/blocks/Logos/styles.module.css +13 -0
- package/src/editor/blocks/Paragraph/index.tsx +95 -0
- package/src/editor/blocks/Paragraph/styles.module.css +4 -0
- package/src/editor/blocks/Space/index.tsx +45 -0
- package/src/editor/blocks/Space/styles.module.css +14 -0
- package/src/editor/blocks/Stats/index.tsx +58 -0
- package/src/editor/blocks/Stats/styles.module.css +64 -0
- package/src/editor/blocks/Text/index.tsx +75 -0
- package/src/editor/blocks/Text/styles.module.css +4 -0
- package/src/editor/components/Layout/index.tsx +160 -0
- package/src/editor/components/Layout/styles.module.css +3 -0
- package/src/editor/components/Section/index.tsx +31 -0
- package/src/editor/components/Section/styles.module.css +23 -0
- package/src/editor/index.tsx +63 -0
- package/src/editor/options.ts +37 -0
- package/src/editor/types.ts +60 -0
- package/src/editor/utils/generateId.ts +2 -0
- package/src/editor/utils/getClassNameFactory.ts +63 -0
- package/src/index.css +1 -0
- package/src/index.ts +6 -0
- package/src/libs/redirect.ts +10 -0
- package/src/sitemap/handleRobotsTxt.ts +19 -0
- package/src/sitemap/handleSitemap.ts +25 -0
- package/src/sitemap/index.ts +2 -0
- package/src/styles.d.ts +4 -0
- package/tsconfig.json +42 -0
- package/tsdown.config.ts +15 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import classnames from 'classnames'
|
|
2
|
+
|
|
3
|
+
type OptionsObj = Record<string, any>
|
|
4
|
+
type Options = string | OptionsObj
|
|
5
|
+
|
|
6
|
+
export const getGlobalClassName = (rootClass: string, options: Options) => {
|
|
7
|
+
if (typeof options === 'string') {
|
|
8
|
+
return `${rootClass}-${options}`
|
|
9
|
+
} else {
|
|
10
|
+
const mappedOptions: Options = {}
|
|
11
|
+
for (const option in options) {
|
|
12
|
+
mappedOptions[`${rootClass}--${option}`] = options[option]
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return classnames({
|
|
16
|
+
[rootClass]: true,
|
|
17
|
+
...mappedOptions,
|
|
18
|
+
})
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const getClassNameFactory =
|
|
23
|
+
(
|
|
24
|
+
rootClass: string,
|
|
25
|
+
styles: Record<string, string>,
|
|
26
|
+
config: { baseClass?: string } = { baseClass: '' },
|
|
27
|
+
) =>
|
|
28
|
+
(options: Options = {}) => {
|
|
29
|
+
if (typeof options === 'string') {
|
|
30
|
+
const descendant = options
|
|
31
|
+
|
|
32
|
+
const style = styles[`${rootClass}-${descendant}`]
|
|
33
|
+
|
|
34
|
+
if (style) {
|
|
35
|
+
return config.baseClass + styles[`${rootClass}-${descendant}`] || ''
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return ''
|
|
39
|
+
} else if (typeof options === 'object') {
|
|
40
|
+
const modifiers = options
|
|
41
|
+
|
|
42
|
+
const prefixedModifiers: OptionsObj = {}
|
|
43
|
+
|
|
44
|
+
for (const modifier in modifiers) {
|
|
45
|
+
prefixedModifiers[styles[`${rootClass}--${modifier}`]] =
|
|
46
|
+
modifiers[modifier]
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const c = styles[rootClass]
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
config.baseClass +
|
|
53
|
+
classnames({
|
|
54
|
+
[c]: !!c, // only apply the class if it exists
|
|
55
|
+
...prefixedModifiers,
|
|
56
|
+
})
|
|
57
|
+
)
|
|
58
|
+
} else {
|
|
59
|
+
return config.baseClass + styles[rootClass] || ''
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default getClassNameFactory
|
package/src/index.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import 'tailwindcss';
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { redirect } from "../libs/redirect";
|
|
2
|
+
|
|
3
|
+
export const handleRobotsTxt = async (req: Request) => {
|
|
4
|
+
const response = await fetch(
|
|
5
|
+
`https://cms.rankrunners.net/api/sites/${process.env.NEXT_SITE_ID}/sitemaps/robots.txt`
|
|
6
|
+
);
|
|
7
|
+
|
|
8
|
+
if (!response.ok) {
|
|
9
|
+
return redirect(req);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const sitemapData = await response.text();
|
|
13
|
+
return new Response(sitemapData, {
|
|
14
|
+
status: 200,
|
|
15
|
+
headers: {
|
|
16
|
+
"Content-Type": "text/plain",
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { redirect } from "../libs/redirect";
|
|
2
|
+
|
|
3
|
+
export const handleSitemap = async (
|
|
4
|
+
req: Request,
|
|
5
|
+
context: { params: Promise<{}> }
|
|
6
|
+
) => {
|
|
7
|
+
const { params } = context;
|
|
8
|
+
const { sitemap } = await (params as Promise<{ sitemap: string }>);
|
|
9
|
+
|
|
10
|
+
const response = await fetch(
|
|
11
|
+
`https://cms.rankrunners.net/api/sites/${process.env.NEXT_SITE_ID}/sitemaps/${sitemap}.xml`
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
if (!response.ok) {
|
|
15
|
+
return redirect(req);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const sitemapData = await response.text();
|
|
19
|
+
return new Response(sitemapData, {
|
|
20
|
+
status: 200,
|
|
21
|
+
headers: {
|
|
22
|
+
"Content-Type": "application/xml",
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
};
|
package/src/styles.d.ts
ADDED
package/tsconfig.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
// Environment setup & latest features
|
|
4
|
+
"lib": ["ES2021", "DOM"],
|
|
5
|
+
"target": "es2021",
|
|
6
|
+
"module": "es2020",
|
|
7
|
+
"moduleDetection": "force",
|
|
8
|
+
"jsx": "react-jsx",
|
|
9
|
+
"removeComments": false,
|
|
10
|
+
|
|
11
|
+
// Bundler mode
|
|
12
|
+
"moduleResolution": "bundler",
|
|
13
|
+
"esModuleInterop": true,
|
|
14
|
+
"allowImportingTsExtensions": true,
|
|
15
|
+
"verbatimModuleSyntax": true,
|
|
16
|
+
|
|
17
|
+
// Declarations
|
|
18
|
+
"declaration": true,
|
|
19
|
+
"declarationDir": "dist/types",
|
|
20
|
+
"emitDeclarationOnly": true,
|
|
21
|
+
"isolatedDeclarations": false,
|
|
22
|
+
|
|
23
|
+
// Best practices
|
|
24
|
+
"strict": true,
|
|
25
|
+
"skipLibCheck": true,
|
|
26
|
+
"noFallthroughCasesInSwitch": true,
|
|
27
|
+
"noUncheckedIndexedAccess": true,
|
|
28
|
+
"noImplicitOverride": true,
|
|
29
|
+
|
|
30
|
+
// Some stricter flags (disabled by default)
|
|
31
|
+
"noUnusedLocals": false,
|
|
32
|
+
"noUnusedParameters": false,
|
|
33
|
+
"noPropertyAccessFromIndexSignature": false,
|
|
34
|
+
|
|
35
|
+
// Path aliases
|
|
36
|
+
"baseUrl": ".",
|
|
37
|
+
"paths": {
|
|
38
|
+
"@/*": ["src/*"]
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"include": ["src"]
|
|
42
|
+
}
|
package/tsdown.config.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defineConfig } from 'tsdown';
|
|
2
|
+
import { injectCssPlugin } from '@bosh-code/tsdown-plugin-inject-css';
|
|
3
|
+
import { tailwindPlugin } from '@bosh-code/tsdown-plugin-tailwindcss';
|
|
4
|
+
|
|
5
|
+
export default defineConfig([
|
|
6
|
+
{
|
|
7
|
+
entry: ['./src/index.ts'],
|
|
8
|
+
sourcemap: false,
|
|
9
|
+
dts: true,
|
|
10
|
+
minify: true,
|
|
11
|
+
clean: true,
|
|
12
|
+
plugins: [tailwindPlugin(), injectCssPlugin()],
|
|
13
|
+
external: ['react', 'react-dom', 'react/jx-runtime'],
|
|
14
|
+
},
|
|
15
|
+
]);
|