Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update reference docs #131

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app-examples/unstyled_example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.db
*.py[cod]
.web
__pycache__/
Binary file not shown.
10 changes: 10 additions & 0 deletions app-examples/unstyled_example/assets/github.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions app-examples/unstyled_example/assets/gradient_underline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions app-examples/unstyled_example/assets/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions app-examples/unstyled_example/assets/logo_darkmode.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions app-examples/unstyled_example/assets/paneleft.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions app-examples/unstyled_example/assets/text_logo_darkmode.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# This file has been modified by the Nextpy Team in 2023 using AI tools and automation scripts.
# We have rigorously tested these modifications to ensure reliability and performance. Based on successful test results, we are confident in the quality and stability of these changes.

"""The email package builts on top of fastapi-mail."""
54 changes: 54 additions & 0 deletions app-examples/unstyled_example/unstyled_example/unstyled_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import nextpy as xt


class CounterState(xt.State):
value: int = 0

def change_value(self, amount):
self.value += amount
Comment on lines +4 to +8
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tip

Codebase Verification

The change_value method from the CounterState class is being called directly from the class in the provided context, which may not be the intended usage if it's supposed to be an instance method. This could lead to issues since the method would not have access to instance-specific data.

Analysis chain

The CounterState class is a simple state management example. Ensure that the change_value method is correctly bound to instances of CounterState when used.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that the change_value method is correctly bound to instances of CounterState
ast-grep --lang python --pattern $'CounterState.change_value($_)'

Length of output: 197



def create_button(label, amount):
return xt.unstyled.button(
label,
on_click=lambda: CounterState.change_value(amount)
)


def index() -> xt.Component:
heading_color = xt.match(
CounterState.value,
(0, "red"),
(4, "blue"),
(8, "green"),
(12, "orange"),
(16, "lime"),
(20, "orange"),
"black"
)

return xt.unstyled.flex(
xt.unstyled.heading(
CounterState.value,
color="white",
background_color=heading_color,
as_="h2"
),
xt.unstyled.flex(
create_button("decrement", -1),
create_button("increment", 1),
gap="2"
),
align_items="center",
direction="column",
gap="2"
)


# Global styles defined as a Python dictionary
style = {
"text_align": "center",
}

app = xt.App(style=style)
app.add_page(index)
5 changes: 5 additions & 0 deletions app-examples/unstyled_example/xtconfig.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import nextpy as xt

config = xt.Config(
app_name="unstyled_example",
)
7 changes: 5 additions & 2 deletions nextpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@
"nextpy.frontend.components.el": ["el"],
"nextpy.frontend.components.moment.moment": ["MomentDelta"],
"nextpy.frontend.page": ["page"],
"nextpy.frontend.components.proxy": ["animation", "unstyled"],
"nextpy.frontend.style": ["color_mode", "style", "toggle_color_mode"],
"nextpy.frontend.components.recharts": [
"area_chart", "bar_chart", "line_chart", "composed_chart", "pie_chart",
Expand All @@ -300,7 +301,6 @@
"polar_angle_axis", "polar_grid", "polar_radius_axis",
],
"nextpy.utils": ["utils"],
"nextpy.frontend.components.proxy": ["animation"],
}


Expand Down Expand Up @@ -354,6 +354,9 @@ def __getattr__(name: str) -> Type:
module = importlib.import_module("nextpy.frontend.components.proxy")
return module.animation

# Custom alias handling for 'unstyled'
if name == "unstyled":
return importlib.import_module("nextpy.frontend.components.proxy.unstyled")

try:
# Check for import of a module that is not in the mapping.
Expand All @@ -371,4 +374,4 @@ def __getattr__(name: str) -> Type:
getattr(module, name) if name != _MAPPING[name].rsplit(".")[-1] else module
)
except ModuleNotFoundError:
raise AttributeError(f"module 'nextpy' has no attribute {name}") from None
raise AttributeError(f"module 'nextpy' has no attribute {name}") from None
19 changes: 14 additions & 5 deletions nextpy/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file has been modified by the Nextpy Team in 2023 using AI tools and automation scripts.
# This file has been modified by the Nextpy Team in 2023 using AI tools and automation scripts.
# We have rigorously tested these modifications to ensure reliability and performance. Based on successful test results, we are confident in the quality and stability of these changes.

from nextpy.backend import admin as admin
Expand Down Expand Up @@ -257,7 +257,9 @@ from nextpy.frontend.components import center as center
from nextpy.frontend.components import checkbox as checkbox
from nextpy.frontend.components import checkbox_group as checkbox_group
from nextpy.frontend.components import circular_progress as circular_progress
from nextpy.frontend.components import circular_progress_label as circular_progress_label
from nextpy.frontend.components import (
circular_progress_label as circular_progress_label,
)
from nextpy.frontend.components import circle as circle
from nextpy.frontend.components import code as code
from nextpy.frontend.components import code_block as code_block
Expand Down Expand Up @@ -341,8 +343,12 @@ from nextpy.frontend.components import moment as moment
from nextpy.frontend.components import multi_select as multi_select
from nextpy.frontend.components import multi_select_option as multi_select_option
from nextpy.frontend.components import next_link as next_link
from nextpy.frontend.components import number_decrement_stepper as number_decrement_stepper
from nextpy.frontend.components import number_increment_stepper as number_increment_stepper
from nextpy.frontend.components import (
number_decrement_stepper as number_decrement_stepper,
)
from nextpy.frontend.components import (
number_increment_stepper as number_increment_stepper,
)
from nextpy.frontend.components import number_input as number_input
from nextpy.frontend.components import number_input_field as number_input_field
from nextpy.frontend.components import number_input_stepper as number_input_stepper
Expand All @@ -365,7 +371,9 @@ from nextpy.frontend.components import progress as progress
from nextpy.frontend.components import radio as radio
from nextpy.frontend.components import radio_group as radio_group
from nextpy.frontend.components import range_slider as range_slider
from nextpy.frontend.components import range_slider_filled_track as range_slider_filled_track
from nextpy.frontend.components import (
range_slider_filled_track as range_slider_filled_track,
)
from nextpy.frontend.components import range_slider_thumb as range_slider_thumb
from nextpy.frontend.components import range_slider_track as range_slider_track
from nextpy.frontend.components import responsive_grid as responsive_grid
Expand Down Expand Up @@ -455,6 +463,7 @@ from nextpy.build.config import Config as Config
from nextpy.build.config import DBConfig as DBConfig
from nextpy import constants as constants
from nextpy.constants import Env as Env

# from nextpy.frontend.custom_components import custom_components as custom_components
from nextpy.frontend.components import el as el
from nextpy.backend import event as event
Expand Down
16 changes: 16 additions & 0 deletions nextpy/backend/module/mail/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""The email package."""

from .config import EmailConfig
from .message import EmailMessage
from .sender import EmailSender
from .email_template import EmailTemplateManager
from .exceptions import EmailConfigError, EmailSendError

__all__ = [
'EmailConfig',
'EmailSender',
'EmailMessage',
'EmailTemplateManager',
'EmailConfigError',
'EmailSendError'
]
Loading
Loading