create-absolutejs 0.2.2 → 0.3.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.
Files changed (70) hide show
  1. package/dist/commands/formatProject.d.ts +6 -0
  2. package/dist/commands/installDependencies.d.ts +6 -0
  3. package/dist/constants.d.ts +4 -0
  4. package/dist/data.d.ts +15 -0
  5. package/dist/generators/configurations/addConfigurationFiles.d.ts +7 -0
  6. package/dist/generators/configurations/generateDrizzleConfig.d.ts +7 -0
  7. package/dist/generators/configurations/generatePackageJson.d.ts +7 -0
  8. package/dist/generators/configurations/generatePrettierrc.d.ts +2 -0
  9. package/dist/generators/configurations/initializeRoot.d.ts +5 -0
  10. package/dist/generators/db/scaffoldDatabase.d.ts +9 -0
  11. package/dist/generators/html/scaffoldHTML.d.ts +6 -0
  12. package/dist/generators/htmx/scaffoldHTMX.d.ts +2 -0
  13. package/dist/generators/project/generateMarkupCSS.d.ts +1 -0
  14. package/dist/generators/project/generateServer.d.ts +7 -0
  15. package/dist/generators/project/scaffoldFrontends.d.ts +8 -0
  16. package/dist/generators/react/scaffoldReact.d.ts +2 -0
  17. package/dist/generators/svelte/scaffoldSvelte.d.ts +2 -0
  18. package/dist/generators/vue/scaffoldVue.d.ts +4 -0
  19. package/dist/index.d.ts +2 -0
  20. package/dist/index.js +390 -447
  21. package/dist/messages.d.ts +14 -0
  22. package/dist/prompt.d.ts +2 -0
  23. package/dist/questions/authProvider.d.ts +1 -0
  24. package/dist/questions/codeQualityTool.d.ts +1 -0
  25. package/dist/questions/configurationType.d.ts +1 -0
  26. package/dist/questions/databaseEngine.d.ts +1 -0
  27. package/dist/questions/databaseHost.d.ts +2 -0
  28. package/dist/questions/directoryConfiguration.d.ts +14 -0
  29. package/dist/questions/frontendDirectoryConfigurations.d.ts +2 -0
  30. package/dist/questions/frontends.d.ts +1 -0
  31. package/dist/questions/htmlScriptingOption.d.ts +1 -0
  32. package/dist/questions/initializeGitNow.d.ts +1 -0
  33. package/dist/questions/installDependenciesNow.d.ts +1 -0
  34. package/dist/questions/orm.d.ts +1 -0
  35. package/dist/questions/plugins.d.ts +1 -0
  36. package/dist/questions/projectName.d.ts +1 -0
  37. package/dist/questions/useTailwind.d.ts +1 -0
  38. package/dist/scaffold.d.ts +8 -0
  39. package/dist/templates/assets/ico/favicon.ico +0 -0
  40. package/dist/templates/assets/png/absolutejs-temp.png +0 -0
  41. package/dist/templates/assets/svg/HTML5_Badge.svg +7 -0
  42. package/dist/templates/assets/svg/htmx-logo-black.svg +9 -0
  43. package/dist/templates/assets/svg/htmx-logo-white.svg +9 -0
  44. package/dist/templates/assets/svg/svelte-logo.svg +1 -0
  45. package/dist/templates/assets/svg/vue-logo.svg +4 -0
  46. package/dist/templates/html/pages/HTMLExample.html +66 -0
  47. package/dist/templates/html/scripts/typescript-example.ts +21 -0
  48. package/dist/templates/htmx/pages/HTMXExample.html +92 -0
  49. package/dist/templates/react/components/App.tsx +52 -0
  50. package/dist/templates/react/components/Dropdown.tsx +23 -0
  51. package/dist/templates/react/components/Head.tsx +34 -0
  52. package/dist/templates/react/pages/ReactExample.tsx +18 -0
  53. package/dist/templates/styles/colors.ts +11 -0
  54. package/dist/templates/styles/reset.css +84 -0
  55. package/dist/templates/svelte/components/Counter.svelte +19 -0
  56. package/dist/templates/svelte/composables/counter.svelte.ts +14 -0
  57. package/dist/templates/svelte/pages/SvelteExample.svelte +215 -0
  58. package/dist/templates/vue/components/CountButton.vue +39 -0
  59. package/dist/templates/vue/composables/useCount.ts +14 -0
  60. package/dist/templates/vue/pages/VueExample.vue +266 -0
  61. package/dist/typeGuards.d.ts +8 -0
  62. package/dist/types.d.ts +128 -0
  63. package/dist/utils/abort.d.ts +1 -0
  64. package/dist/utils/commandMaps.d.ts +2 -0
  65. package/dist/utils/getPackageVersion.d.ts +1 -0
  66. package/dist/utils/parseCommandLineOptions.d.ts +7 -0
  67. package/dist/utils/t3-utils.d.ts +7 -0
  68. package/package.json +7 -6
  69. package/dist/templates/react/hooks/useMediaQuery.ts +0 -54
  70. package/dist/templates/react/styles/defaultStyles.ts +0 -28
@@ -0,0 +1,14 @@
1
+ import type { CreateConfiguration } from './types';
2
+ export declare const helpMessage: string;
3
+ type OutroMessageProps = {
4
+ projectName: string;
5
+ packageManager: string;
6
+ installDependenciesNow: boolean;
7
+ };
8
+ export declare const getOutroMessage: ({ projectName, packageManager, installDependenciesNow }: OutroMessageProps) => string;
9
+ type DebugMessageProps = {
10
+ response: CreateConfiguration;
11
+ packageManager: string;
12
+ };
13
+ export declare const getDebugMessage: ({ response: { projectName, codeQualityTool, directoryConfig, useTailwind, tailwind, frontends, useHTMLScripts, frontendDirectories, buildDirectory, assetsDirectory, databaseEngine, databaseHost, databaseDirectory, orm, authProvider, plugins, initializeGitNow, installDependenciesNow }, packageManager }: DebugMessageProps) => string;
14
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { ArgumentConfiguration, CreateConfiguration } from './types';
2
+ export declare const prompt: (argumentConfiguration: ArgumentConfiguration) => Promise<CreateConfiguration>;
@@ -0,0 +1 @@
1
+ export declare const getAuthProvider: () => Promise<"absoluteAuth" | undefined>;
@@ -0,0 +1 @@
1
+ export declare const getCodeQualityTool: () => Promise<"eslint+prettier" | "biome">;
@@ -0,0 +1 @@
1
+ export declare const getConfigurationType: () => Promise<"default" | "custom">;
@@ -0,0 +1 @@
1
+ export declare const getDatabaseEngine: () => Promise<"postgresql" | "mysql" | "sqlite" | "mongodb" | "redis" | "singlestore" | "cockroachdb" | "mssql" | undefined>;
@@ -0,0 +1,2 @@
1
+ import type { DatabaseEngine } from '../types';
2
+ export declare const getDatabaseHost: (databaseEngine: DatabaseEngine) => Promise<"neon" | "planetscale" | "supabase" | "turso" | "upstash" | "atlas" | undefined>;
@@ -0,0 +1,14 @@
1
+ import type { ArgumentConfiguration, CreateConfiguration } from '../types';
2
+ type GetDirectoryConfigurationProps = Pick<CreateConfiguration, 'directoryConfig' | 'useTailwind' | 'databaseEngine'> & {
3
+ argumentConfiguration: ArgumentConfiguration;
4
+ };
5
+ export declare const getDirectoryConfiguration: ({ directoryConfig, useTailwind, databaseEngine, argumentConfiguration }: GetDirectoryConfigurationProps) => Promise<{
6
+ assetsDirectory: string;
7
+ buildDirectory: string;
8
+ databaseDirectory: string | undefined;
9
+ tailwind: {
10
+ input: string;
11
+ output: string;
12
+ } | undefined;
13
+ }>;
14
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { DirectoryConfiguration, Frontend } from '../types';
2
+ export declare const getFrontendDirectoryConfigurations: (directoryConfiguration: DirectoryConfiguration, frontends: Frontend[], passedFrontendDirectories: Partial<Record<Frontend, string>> | undefined) => Promise<Partial<Record<"react" | "html" | "svelte" | "vue" | "htmx", string>>>;
@@ -0,0 +1 @@
1
+ export declare const getFrontends: () => Promise<("react" | "html" | "svelte" | "vue" | "htmx")[]>;
@@ -0,0 +1 @@
1
+ export declare const getHtmlScriptingOption: () => Promise<boolean>;
@@ -0,0 +1 @@
1
+ export declare const getInitializeGit: () => Promise<boolean>;
@@ -0,0 +1 @@
1
+ export declare const getInstallDependencies: () => Promise<boolean>;
@@ -0,0 +1 @@
1
+ export declare const getORM: () => Promise<"drizzle" | "prisma" | undefined>;
@@ -0,0 +1 @@
1
+ export declare const getPlugins: () => Promise<string[]>;
@@ -0,0 +1 @@
1
+ export declare const getProjectName: () => Promise<string>;
@@ -0,0 +1 @@
1
+ export declare const getUseTailwind: () => Promise<boolean>;
@@ -0,0 +1,8 @@
1
+ import type { PackageManager, CreateConfiguration } from './types';
2
+ type ScaffoldProps = {
3
+ response: CreateConfiguration;
4
+ packageManager: PackageManager;
5
+ latest: boolean;
6
+ };
7
+ export declare const scaffold: ({ response: { projectName, codeQualityTool, initializeGitNow, databaseEngine, useHTMLScripts, useTailwind, databaseDirectory, orm, frontends, plugins, authProvider, buildDirectory, assetsDirectory, tailwind, installDependenciesNow, frontendDirectories }, latest, packageManager }: ScaffoldProps) => void;
8
+ export {};
@@ -0,0 +1,7 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
2
+ <title>HTML5 Logo Badge</title>
3
+ <path fill="#E34F26" d="M71,460 L30,0 481,0 440,460 255,512"/>
4
+ <path fill="#EF652A" d="M256,472 L405,431 440,37 256,37"/>
5
+ <path fill="#EBEBEB" d="M256,208 L181,208 176,150 256,150 256,94 255,94 114,94 115,109 129,265 256,265zM256,355 L255,355 192,338 188,293 158,293 132,293 139,382 255,414 256,414z"/>
6
+ <path fill="#FFF" d="M255,208 L255,265 325,265 318,338 255,355 255,414 371,382 372,372 385,223 387,208 371,208zM255,94 L255,129 255,150 255,150 392,150 392,150 392,150 393,138 396,109 397,94z"/>
7
+ </svg>
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="256px" height="168px" viewBox="0 0 256 168" version="1.1" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid">
3
+ <title>htmx</title>
4
+ <g>
5
+ <polygon fill="#111111" points="181.394935 42.749283 256 74.2039835 256 96.0617321 181.394935 127.078518 175.477838 105.581524 230.646979 84.8771384 175.477838 64.0931689"></polygon>
6
+ <polygon fill="#111111" points="74.6050654 42.7484751 6.6060424e-14 74.2039835 1.83634114e-13 96.0617321 74.6050654 127.078518 80.5221623 105.581524 25.3530206 84.8771384 80.5221623 64.0931689"></polygon>
7
+ <polygon fill="#4065C5" points="144.339858 -1.59458264e-15 170.003907 -1.59458264e-15 112.990192 167.110525 85.996093 167.110525"></polygon>
8
+ </g>
9
+ </svg>
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="256px" height="168px" viewBox="0 0 256 168" version="1.1" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid">
3
+ <title>htmx</title>
4
+ <g>
5
+ <polygon fill="#ffffff" points="181.394935 42.749283 256 74.2039835 256 96.0617321 181.394935 127.078518 175.477838 105.581524 230.646979 84.8771384 175.477838 64.0931689"></polygon>
6
+ <polygon fill="#ffffff" points="74.6050654 42.7484751 6.6060424e-14 74.2039835 1.83634114e-13 96.0617321 74.6050654 127.078518 80.5221623 105.581524 25.3530206 84.8771384 80.5221623 64.0931689"></polygon>
7
+ <polygon fill="#4065C5" points="144.339858 -1.59458264e-15 170.003907 -1.59458264e-15 112.990192 167.110525 85.996093 167.110525"></polygon>
8
+ </g>
9
+ </svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="107" height="128" viewBox="0 0 107 128"><title>svelte-logo</title><path d="M94.1566,22.8189c-10.4-14.8851-30.94-19.2971-45.7914-9.8348L22.2825,29.6078A29.9234,29.9234,0,0,0,8.7639,49.6506a31.5136,31.5136,0,0,0,3.1076,20.2318A30.0061,30.0061,0,0,0,7.3953,81.0653a31.8886,31.8886,0,0,0,5.4473,24.1157c10.4022,14.8865,30.9423,19.2966,45.7914,9.8348L84.7167,98.3921A29.9177,29.9177,0,0,0,98.2353,78.3493,31.5263,31.5263,0,0,0,95.13,58.117a30,30,0,0,0,4.4743-11.1824,31.88,31.88,0,0,0-5.4473-24.1157" style="fill:#ff3e00"/><path d="M45.8171,106.5815A20.7182,20.7182,0,0,1,23.58,98.3389a19.1739,19.1739,0,0,1-3.2766-14.5025,18.1886,18.1886,0,0,1,.6233-2.4357l.4912-1.4978,1.3363.9815a33.6443,33.6443,0,0,0,10.203,5.0978l.9694.2941-.0893.9675a5.8474,5.8474,0,0,0,1.052,3.8781,6.2389,6.2389,0,0,0,6.6952,2.485,5.7449,5.7449,0,0,0,1.6021-.7041L69.27,76.281a5.4306,5.4306,0,0,0,2.4506-3.631,5.7948,5.7948,0,0,0-.9875-4.3712,6.2436,6.2436,0,0,0-6.6978-2.4864,5.7427,5.7427,0,0,0-1.6.7036l-9.9532,6.3449a19.0329,19.0329,0,0,1-5.2965,2.3259,20.7181,20.7181,0,0,1-22.2368-8.2427,19.1725,19.1725,0,0,1-3.2766-14.5024,17.9885,17.9885,0,0,1,8.13-12.0513L55.8833,23.7472a19.0038,19.0038,0,0,1,5.3-2.3287A20.7182,20.7182,0,0,1,83.42,29.6611a19.1739,19.1739,0,0,1,3.2766,14.5025,18.4,18.4,0,0,1-.6233,2.4357l-.4912,1.4978-1.3356-.98a33.6175,33.6175,0,0,0-10.2037-5.1l-.9694-.2942.0893-.9675a5.8588,5.8588,0,0,0-1.052-3.878,6.2389,6.2389,0,0,0-6.6952-2.485,5.7449,5.7449,0,0,0-1.6021.7041L37.73,51.719a5.4218,5.4218,0,0,0-2.4487,3.63,5.7862,5.7862,0,0,0,.9856,4.3717,6.2437,6.2437,0,0,0,6.6978,2.4864,5.7652,5.7652,0,0,0,1.602-.7041l9.9519-6.3425a18.978,18.978,0,0,1,5.2959-2.3278,20.7181,20.7181,0,0,1,22.2368,8.2427,19.1725,19.1725,0,0,1,3.2766,14.5024,17.9977,17.9977,0,0,1-8.13,12.0532L51.1167,104.2528a19.0038,19.0038,0,0,1-5.3,2.3287" style="fill:#fff"/></svg>
@@ -0,0 +1,4 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 196.32 170.02">
2
+ <path fill="#42b883" d="M120.83 0L98.16 39.26 75.49 0H0l98.16 170.02L196.32 0h-75.49z"/>
3
+ <path fill="#35495e" d="M120.83 0L98.16 39.26 75.49 0H39.26l58.9 102.01L157.06 0h-36.23z"/>
4
+ </svg>
@@ -0,0 +1,66 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <title>AbsoluteJS + HTML</title>
5
+ <meta name="description" content="AbsoluteJS HTML Example" />
6
+ <meta charset="utf-8" />
7
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
8
+ <link
9
+ rel="stylesheet"
10
+ type="text/css"
11
+ href="../styles/html-example.css"
12
+ />
13
+ <link rel="icon" href="/assets/ico/favicon.ico" />
14
+ </head>
15
+ <body>
16
+ <header>
17
+ <a href="/">AbsoluteJS</a>
18
+ <details>
19
+ <summary>Pages</summary>
20
+ <nav>
21
+ <a href="/html">HTML</a>
22
+ <a href="/react">React</a>
23
+ <a href="/htmx">HTMX</a>
24
+ <a href="/svelte">Svelte</a>
25
+ <a href="/vue">Vue</a>
26
+ <a href="/angular">Angular</a>
27
+ </nav>
28
+ </details>
29
+ </header>
30
+ <main>
31
+ <nav>
32
+ <a href="https://absolutejs.com" target="_blank">
33
+ <img
34
+ class="logo"
35
+ src="/assets/png/absolutejs-temp.png"
36
+ alt="AbsoluteJS Logo"
37
+ />
38
+ </a>
39
+ <a href="https://html.spec.whatwg.org/multipage/">
40
+ <img
41
+ class="logo html"
42
+ src="/assets/svg/HTML5_Badge.svg"
43
+ alt="HTML Logo"
44
+ />
45
+ </a>
46
+ </nav>
47
+ <h1>AbsoluteJS + HTML</h1>
48
+ <button id="counter-button">
49
+ count is <span id="counter">0</span>
50
+ </button>
51
+ <p>
52
+ Edit <code>example/html/pages/HtmlExample.html</code> save and
53
+ rebuild to update the page.
54
+ </p>
55
+ <p style="color: #777">( Hot Module Reloading is coming soon )</p>
56
+ <p style="margin-top: 2rem">
57
+ Explore the other pages to see how AbsoluteJS seamlessly unifies
58
+ multiple frameworks on a single server.
59
+ </p>
60
+ <p style="margin-top: 2rem; font-size: 1rem; color: #777">
61
+ Click on the AbsoluteJS and HTML logos to learn more.
62
+ </p>
63
+ </main>
64
+ <script src="../scripts/typescript-example.ts"></script>
65
+ </body>
66
+ </html>
@@ -0,0 +1,21 @@
1
+ const button = document.querySelector<HTMLButtonElement>('#counter-button');
2
+ const counter = document.querySelector<HTMLSpanElement>('#counter');
3
+ const details = document.querySelector<HTMLDetailsElement>('header details');
4
+
5
+ if (!button || !counter || !details) {
6
+ throw new Error('Required elements not found');
7
+ }
8
+
9
+ let count = 0;
10
+
11
+ button.addEventListener('click', () => {
12
+ counter.textContent = (++count).toString();
13
+ });
14
+
15
+ details.addEventListener('pointerenter', () => {
16
+ details.open = true;
17
+ });
18
+
19
+ details.addEventListener('pointerleave', () => {
20
+ details.open = false;
21
+ });
@@ -0,0 +1,92 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <title>AbsoluteJS + HTMX</title>
5
+ <meta name="description" content="AbsoluteJS HTMX Example" />
6
+ <meta charset="utf-8" />
7
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
8
+ <link
9
+ rel="stylesheet"
10
+ type="text/css"
11
+ href="../styles/htmx-example.css"
12
+ />
13
+ <link rel="icon" href="/assets/ico/favicon.ico" />
14
+ <!-- TODO : Download htmx instead of from CDN -->
15
+ <script src="https://cdn.jsdelivr.net/npm/htmx.org@2.0.6/dist/htmx.min.js"></script>
16
+ </head>
17
+ <body
18
+ hx-post="/htmx/reset"
19
+ hx-trigger="beforeunload from:window once"
20
+ hx-swap="none"
21
+ >
22
+ <header>
23
+ <a href="/">AbsoluteJS</a>
24
+ <details
25
+ hx-on:pointerenter="this.open = true"
26
+ hx-on:pointerleave="this.open = false"
27
+ >
28
+ <summary>Pages</summary>
29
+ <nav>
30
+ <a href="/html">HTML</a>
31
+ <a href="/react">React</a>
32
+ <a href="/htmx">HTMX</a>
33
+ <a href="/svelte">Svelte</a>
34
+ <a href="/vue">Vue</a>
35
+ <a href="/angular">Angular</a>
36
+ </nav>
37
+ </details>
38
+ </header>
39
+ <main>
40
+ <nav>
41
+ <a href="https://absolutejs.com" target="_blank">
42
+ <img
43
+ class="logo"
44
+ src="/assets/png/absolutejs-temp.png"
45
+ alt="AbsoluteJS Logo"
46
+ />
47
+ </a>
48
+ <a href="https://htmx.org" target="_blank">
49
+ <picture>
50
+ <source
51
+ srcset="/assets/svg/htmx-logo-white.svg"
52
+ media="(prefers-color-scheme: dark)"
53
+ />
54
+
55
+ <img
56
+ src="/assets/svg/htmx-logo-black.svg"
57
+ alt="HTMX logo"
58
+ class="logo htmx"
59
+ />
60
+ </picture>
61
+ </a>
62
+ </nav>
63
+ <h1>AbsoluteJS + HTMX</h1>
64
+ <button
65
+ hx-post="/htmx/increment"
66
+ hx-target="#count"
67
+ hx-swap="innerHTML"
68
+ >
69
+ count is
70
+ <span
71
+ id="count"
72
+ hx-get="/htmx/count"
73
+ hx-trigger="load"
74
+ hx-swap="innerHTML"
75
+ >0</span
76
+ >
77
+ </button>
78
+ <p>
79
+ Edit <code>example/htmx/pages/HtmxHome.html</code> save and
80
+ rebuild to update the page.
81
+ </p>
82
+ <p style="color: #777">( Hot Module Reloading is coming soon )</p>
83
+ <p style="margin-top: 2rem">
84
+ Explore the other pages to see how AbsoluteJS seamlessly unifies
85
+ multiple frameworks on a single server.
86
+ </p>
87
+ <p style="margin-top: 2rem; font-size: 1rem; color: #777">
88
+ Click on the AbsoluteJS and HTML logos to learn more.
89
+ </p>
90
+ </main>
91
+ </body>
92
+ </html>
@@ -0,0 +1,52 @@
1
+ import { useState } from 'react';
2
+
3
+ type AppProps = { initialCount: number };
4
+
5
+ export const App = ({ initialCount }: AppProps) => {
6
+ const [count, setCount] = useState(initialCount);
7
+
8
+ return (
9
+ <main>
10
+ <nav>
11
+ <a href="https://absolutejs.com" target="_blank">
12
+ <img
13
+ className="logo"
14
+ src="/assets/png/absolutejs-temp.png"
15
+ alt="AbsoluteJS Logo"
16
+ />
17
+ </a>
18
+ <a href="https://react.dev/">
19
+ <img
20
+ className="logo react"
21
+ src="/assets/svg/react.svg"
22
+ alt="React Logo"
23
+ />
24
+ </a>
25
+ </nav>
26
+ <h1>AbsoluteJS + React</h1>
27
+ <button onClick={() => setCount(count + 1)}>
28
+ count is {count}
29
+ </button>
30
+ <p>
31
+ Edit <code>example/react/pages/ReactExample.tsx</code> then save
32
+ and refresh to update the page.
33
+ </p>
34
+ <p style={{ color: '#777' }}>
35
+ ( Hot Module Reloading is coming soon )
36
+ </p>
37
+ <p style={{ marginTop: '2rem' }}>
38
+ Explore the other pages to see how AbsoluteJS seamlessly unifies
39
+ multiple frameworks on a single server.
40
+ </p>
41
+ <p
42
+ style={{
43
+ color: '#777',
44
+ fontSize: '1rem',
45
+ marginTop: '2rem'
46
+ }}
47
+ >
48
+ Click on the AbsoluteJS and React logos to learn more.
49
+ </p>
50
+ </main>
51
+ );
52
+ };
@@ -0,0 +1,23 @@
1
+ import { useState } from 'react';
2
+
3
+ export const Dropdown = () => {
4
+ const [isOpen, setIsOpen] = useState(false);
5
+
6
+ return (
7
+ <details
8
+ onPointerEnter={() => setIsOpen(true)}
9
+ onPointerLeave={() => setIsOpen(false)}
10
+ open={isOpen}
11
+ >
12
+ <summary>Pages</summary>
13
+ <nav>
14
+ <a href="/html">HTML</a>
15
+ <a href="/react">React</a>
16
+ <a href="/htmx">HTMX</a>
17
+ <a href="/svelte">Svelte</a>
18
+ <a href="/vue">Vue</a>
19
+ <a href="/angular">Angular</a>
20
+ </nav>
21
+ </details>
22
+ );
23
+ };
@@ -0,0 +1,34 @@
1
+ type HeadProps = {
2
+ title?: string;
3
+ description?: string;
4
+ icon?: string;
5
+ font?: string;
6
+ cssPath?: string;
7
+ };
8
+
9
+ export const Head = ({
10
+ title = 'AbsoluteJS + React',
11
+ description = 'AbsoluteJS React Example',
12
+ icon = '/assets/ico/favicon.ico',
13
+ font = 'Poppins',
14
+ cssPath
15
+ }: HeadProps) => (
16
+ <head>
17
+ <meta charSet="utf-8" />
18
+ <title>{title}</title>
19
+ <meta name="description" content={description} />
20
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
21
+ <link rel="icon" href={icon} />
22
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
23
+ <link
24
+ rel="preconnect"
25
+ href="https://fonts.gstatic.com"
26
+ crossOrigin="anonymous"
27
+ />
28
+ <link
29
+ href={`https://fonts.googleapis.com/css2?family=${font}:wght@100..900&display=swap`}
30
+ rel="stylesheet"
31
+ />
32
+ {cssPath && <link rel="stylesheet" href={cssPath} type="text/css" />}
33
+ </head>
34
+ );
@@ -0,0 +1,18 @@
1
+ import { App } from '../components/App';
2
+ import { Dropdown } from '../components/Dropdown';
3
+ import { Head } from '../components/Head';
4
+
5
+ type ReactExampleProps = { initialCount: number; cssPath: string };
6
+
7
+ export const ReactExample = ({ initialCount, cssPath }: ReactExampleProps) => (
8
+ <html>
9
+ <Head cssPath={cssPath} />
10
+ <body>
11
+ <header>
12
+ <a href="/">AbsoluteJS</a>
13
+ <Dropdown />
14
+ </header>
15
+ <App initialCount={initialCount} />
16
+ </body>
17
+ </html>
18
+ );
@@ -0,0 +1,11 @@
1
+ export const primaryColor = '#5FBEEB';
2
+ export const secondaryColor = '#35d5a2';
3
+ export const tertiaryColor = '#ff4b91';
4
+
5
+ export const lightPrimaryColor = '#ffffff';
6
+ export const lightSecondaryColor = '#f5f5f5';
7
+ export const lightTertiaryColor = '#e0e0e0';
8
+
9
+ export const darkPrimaryColor = '#1a1a1a';
10
+ export const darkSecondaryColor = '#2c2c2c';
11
+ export const darkTertiaryColor = '#3c3c3c';
@@ -0,0 +1,84 @@
1
+ * {
2
+ box-sizing: border-box;
3
+ line-height: 1.5;
4
+ margin: 0;
5
+ padding: 0;
6
+ }
7
+
8
+ html {
9
+ font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
10
+ height: 100%;
11
+ }
12
+
13
+ body {
14
+ background-color: #2c2c2c;
15
+ color: #f5f5f5;
16
+ color-scheme: light dark;
17
+ display: flex;
18
+ flex-direction: column;
19
+ font-synthesis: none;
20
+ font-weight: 400;
21
+ height: 100%;
22
+ -moz-osx-font-smoothing: grayscale;
23
+ text-rendering: optimizeLegibility;
24
+ -webkit-font-smoothing: antialiased;
25
+ }
26
+
27
+ main {
28
+ align-items: center;
29
+ display: flex;
30
+ flex: 1;
31
+ flex-direction: column;
32
+ justify-content: center;
33
+ text-align: center;
34
+ }
35
+
36
+ h1,
37
+ h2,
38
+ h3,
39
+ h4,
40
+ h5,
41
+ h6 {
42
+ line-height: 1.1;
43
+ }
44
+
45
+ p {
46
+ font-size: 1.2rem;
47
+ max-width: 1280px;
48
+ }
49
+
50
+ a {
51
+ color: #5fbeeb;
52
+ font-size: 1.5rem;
53
+ font-weight: 500;
54
+ position: relative;
55
+ text-decoration: none;
56
+ }
57
+
58
+ button {
59
+ background-color: #1a1a1a;
60
+ border: 1px solid transparent;
61
+ border-radius: 0.5rem;
62
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
63
+ cursor: pointer;
64
+ font-family: inherit;
65
+ font-size: 1.1rem;
66
+ font-weight: 500;
67
+ margin: 2rem 0;
68
+ padding: 0.6rem 1.2rem;
69
+ transition: border-color 0.25s;
70
+ }
71
+ button:hover {
72
+ border-color: #5fbeeb;
73
+ }
74
+ button:focus,
75
+ button:focus-visible {
76
+ outline: 4px auto -webkit-focus-ring-color;
77
+ }
78
+
79
+ @media (prefers-color-scheme: light) {
80
+ body {
81
+ background-color: #f5f5f5;
82
+ color: #1a1a1a;
83
+ }
84
+ }
@@ -0,0 +1,19 @@
1
+ <script lang="ts">
2
+ type CounterProps = {
3
+ initialCount: number;
4
+ };
5
+
6
+ let { initialCount }: CounterProps = $props();
7
+ import { counter } from '../composables/counter.svelte';
8
+ const { getCount, increment } = counter(initialCount);
9
+ </script>
10
+
11
+ <button onclick={increment}>count is {getCount()}</button>
12
+
13
+ <style>
14
+ @media (prefers-color-scheme: light) {
15
+ button {
16
+ background-color: #ffffff;
17
+ }
18
+ }
19
+ </style>
@@ -0,0 +1,14 @@
1
+ export const counter = (initialCount: number) => {
2
+ let count = $state(initialCount);
3
+
4
+ const getCount = () => count;
5
+
6
+ const increment = () => {
7
+ count += 1;
8
+ };
9
+
10
+ return {
11
+ getCount,
12
+ increment
13
+ };
14
+ };