helfy-create 0.0.6 → 0.1.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.
Files changed (44) hide show
  1. package/README.md +49 -38
  2. package/bin/create-helfy.js +8 -0
  3. package/package.json +31 -31
  4. package/template/declaration.d.ts +10 -8
  5. package/template/package-lock.json +6981 -7000
  6. package/template/package.json +29 -30
  7. package/template/rspack.config.js +76 -76
  8. package/template/src/App.hf +20 -0
  9. package/template/src/App.ts +5 -0
  10. package/template/src/context/ThemeContext.ts +18 -0
  11. package/template/src/pages/AboutPage.hf +12 -0
  12. package/template/src/pages/AboutPage.ts +5 -0
  13. package/template/src/pages/CounterPage.hf +13 -0
  14. package/template/src/pages/CounterPage.ts +15 -0
  15. package/template/src/pages/HomePage.hf +17 -0
  16. package/template/src/pages/HomePage.ts +5 -0
  17. package/template/src/pages/_router.hf +21 -0
  18. package/template/src/pages/_router.ts +5 -0
  19. package/template/src/pages/{_routes.tsx → _routes.ts} +10 -10
  20. package/template/src/pages/layouts/MainLayout.hf +24 -0
  21. package/template/src/pages/layouts/MainLayout.ts +5 -0
  22. package/template/src/widgets/Footer/Footer.hf +5 -0
  23. package/template/src/widgets/Footer/Footer.ts +5 -0
  24. package/template/src/widgets/Header/Header.hf +15 -0
  25. package/template/src/widgets/Header/Header.ts +11 -0
  26. package/template/src/widgets/Navbar/Navbar.hf +14 -0
  27. package/template/src/widgets/Navbar/Navbar.ts +11 -0
  28. package/template/src/widgets/NotFound/NotFound.hf +14 -0
  29. package/template/src/widgets/NotFound/NotFound.ts +12 -0
  30. package/template/src/widgets/ThemeToggle/ThemeToggle.hf +16 -0
  31. package/template/src/widgets/ThemeToggle/ThemeToggle.ts +12 -0
  32. package/template/src/widgets/navLinks.ts +5 -0
  33. package/template/tsconfig.json +0 -2
  34. package/template/src/App.tsx +0 -26
  35. package/template/src/context/ThemeContext.tsx +0 -60
  36. package/template/src/pages/AboutPage.tsx +0 -18
  37. package/template/src/pages/CounterPage.tsx +0 -17
  38. package/template/src/pages/HomePage.tsx +0 -22
  39. package/template/src/pages/_router.tsx +0 -15
  40. package/template/src/pages/layouts/MainLayout.tsx +0 -29
  41. package/template/src/widgets/Footer/Footer.tsx +0 -8
  42. package/template/src/widgets/Header/Header.tsx +0 -34
  43. package/template/src/widgets/Navbar/Navbar.tsx +0 -29
  44. package/template/src/widgets/NotFound/NotFound.tsx +0 -31
@@ -1,60 +0,0 @@
1
- import { View, Context, state, useCtx, computed, effect } from "@helfy/helfy";
2
-
3
- export type TThemeMode = "light" | "dark";
4
-
5
- @Context
6
- export class ThemeContext {
7
- @state mode: TThemeMode = "dark";
8
-
9
- @state toggle = () => {
10
- this.mode = this.mode === "dark" ? "light" : "dark";
11
- };
12
-
13
- @effect
14
- syncToDom() {
15
- document.documentElement.classList.toggle("dark", this.mode === "dark");
16
- }
17
- }
18
-
19
- @View
20
- export class ThemeSync {
21
- @useCtx(ThemeContext)
22
- private theme!: ThemeContext;
23
-
24
- onMount() {
25
- document.documentElement.classList.toggle("dark", this.theme.mode === "dark");
26
- }
27
-
28
- render() {
29
- document.documentElement.classList.toggle("dark", this.theme.mode === "dark");
30
- return <span class="hidden" aria-hidden="true"></span>;
31
- }
32
- }
33
-
34
- @View
35
- export class ThemeToggle {
36
- @useCtx(ThemeContext, "toggle")
37
- private toggle!: ThemeContext["toggle"];
38
-
39
- @useCtx(ThemeContext, "mode")
40
- private mode!: ThemeContext["mode"];
41
-
42
- render() {
43
- const isDark = this.mode === "dark";
44
- return (
45
- <button
46
- type="button"
47
- class="theme-toggle"
48
- onclick={this.toggle}
49
- title={isDark ? "Light theme" : "Dark theme"}
50
- aria-label={isDark ? "Switch to light theme" : "Switch to dark theme"}
51
- >
52
- {isDark ? (
53
- <span>Светлая</span>
54
- ) : (
55
- <span>Тёмная</span>
56
- )}
57
- </button>
58
- );
59
- }
60
- }
@@ -1,18 +0,0 @@
1
- import { View } from "@helfy/helfy";
2
-
3
- @View
4
- export class AboutPage {
5
- render() {
6
- return (
7
- <div class="page">
8
- <h1>About</h1>
9
- <p>
10
- This is a Helfy application with routing, slots, and theme context.
11
- </p>
12
- <p>
13
- Helfy is a declarative framework with decorators, reactive state, and built-in TypeScript support.
14
- </p>
15
- </div>
16
- );
17
- }
18
- }
@@ -1,17 +0,0 @@
1
- import { View, state } from "@helfy/helfy";
2
-
3
- @View
4
- export class CounterPage {
5
- @state private count = 0;
6
-
7
- render() {
8
- return (
9
- <div class="page">
10
- <h1>Counter</h1>
11
- <p>Count: <strong>{this.count}</strong></p>
12
- <button class="btn" onclick={() => this.count++}>Increment</button>
13
- <button class="btn" onclick={() => this.count--}>Decrement</button>
14
- </div>
15
- );
16
- }
17
- }
@@ -1,22 +0,0 @@
1
- import { View } from "@helfy/helfy";
2
-
3
- @View
4
- export class HomePage {
5
- render() {
6
- return (
7
- <div class="page">
8
- <h1>Welcome to Helfy</h1>
9
- <p>
10
- Welcome to Helfy — a modern TypeScript framework for web applications.
11
- </p>
12
- <p>
13
- Edit <code>src/App.tsx</code> and save the file — changes will appear automatically.
14
- </p>
15
- <h2>Quick Start</h2>
16
- <p>
17
- Use the sidebar for navigation. Try the Counter page to see reactivity in action and toggle the theme in the top-right corner.
18
- </p>
19
- </div>
20
- );
21
- }
22
- }
@@ -1,15 +0,0 @@
1
- import { RouterView, View } from "@helfy/helfy";
2
- import { NotFound } from "@widgets/NotFound/NotFound";
3
-
4
- @View
5
- export class AppRouter {
6
- render() {
7
- return (
8
- <RouterView>
9
- @slot.notFound({ pathname }) {
10
- <NotFound pathname={pathname} />
11
- }
12
- </RouterView>
13
- );
14
- }
15
- }
@@ -1,29 +0,0 @@
1
- import { View } from "@helfy/helfy";
2
-
3
- @View
4
- export class MainLayout {
5
- render() {
6
- return (
7
- <div class="layout">
8
- <header class="header">
9
- @slot:header()
10
- </header>
11
- <div class="layout__body">
12
- <aside class="sidebar">
13
- @slot:sidebar()
14
- </aside>
15
- <main class="main">
16
- <div class="main__content">
17
- @slot:content()
18
- </div>
19
- </main>
20
- </div>
21
- <footer class="footer">
22
- @slot:footer() fallback {
23
- <span>© 2026</span>
24
- }
25
- </footer>
26
- </div>
27
- );
28
- }
29
- }
@@ -1,8 +0,0 @@
1
- import { View } from "@helfy/helfy";
2
-
3
- @View
4
- export class Footer {
5
- render() {
6
- return (<span>Powered by HelfyFramework — © 2026</span>);
7
- }
8
- }
@@ -1,34 +0,0 @@
1
- import { ThemeToggle } from "@context/ThemeContext";
2
- import { Link, path, View } from "@helfy/helfy";
3
-
4
- @View
5
- export class Header {
6
- @path()
7
- private pathname?: string;
8
-
9
- render() {
10
- return (
11
- <div class="header__inner">
12
- <Link to="/" label="Helfy" class="header__logo" />
13
- <nav class="nav">
14
- <Link
15
- to="/"
16
- label="Home"
17
- class={this.pathname === "/" ? "nav-link--active" : ""}
18
- />
19
- <Link
20
- to="/counter"
21
- label="Counter"
22
- class={this.pathname === "/counter" ? "nav-link--active" : ""}
23
- />
24
- <Link
25
- to="/about"
26
- label="About"
27
- class={this.pathname === "/about" ? "nav-link--active" : ""}
28
- />
29
- </nav>
30
- <ThemeToggle />
31
- </div>
32
- );
33
- }
34
- }
@@ -1,29 +0,0 @@
1
- import { Link, path, View } from "@helfy/helfy";
2
-
3
- @View
4
- export class NavBar {
5
- @path()
6
- private pathname?: string;
7
-
8
- render() {
9
- return (
10
- <nav class="sidebar-nav">
11
- <Link
12
- to="/"
13
- label="Home"
14
- class={this.pathname === "/" ? "nav-link nav-link--active" : "nav-link"}
15
- />
16
- <Link
17
- to="/counter"
18
- label="Counter"
19
- class={this.pathname === "/counter" ? "nav-link nav-link--active" : "nav-link"}
20
- />
21
- <Link
22
- to="/about"
23
- label="About"
24
- class={this.pathname === "/about" ? "nav-link nav-link--active" : "nav-link"}
25
- />
26
- </nav>
27
- );
28
- }
29
- }
@@ -1,31 +0,0 @@
1
- import { Link, View } from "@helfy/helfy";
2
-
3
- export interface Props {
4
- pathname?: string;
5
- }
6
-
7
- @View
8
- /** Custom 404 page — overrides the fallback RouterView. */
9
- export class NotFound {
10
- constructor(private readonly props: Props = {}) {}
11
-
12
- render() {
13
- return (
14
- <section class="not-found">
15
- <div class="not-found__code">404</div>
16
- <h1 class="not-found__title">Oops! Page not found</h1>
17
- <p class="not-found__text">
18
- The requested address does not exist or has been moved.
19
- </p>
20
- {(this.props.pathname ?? "") && (
21
- <p class="not-found__path">{this.props.pathname}</p>
22
- )}
23
- <Link
24
- to="/"
25
- label="Back to home"
26
- class="btn btn--primary"
27
- />
28
- </section>
29
- );
30
- }
31
- }