display

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2025 License: EUPL-1.2 Imports: 6 Imported by: 0

README

Display

This repository is a display module for the core web3 framework. It includes a Go backend, an Angular custom element, and a full release cycle configuration.

Getting Started

  1. Clone the repository:

    git clone https://github.com/Snider/display.git
    
  2. Install the dependencies:

    cd display
    go mod tidy
    cd ui
    npm install
    
  3. Run the development server:

    go run ./cmd/demo-cli serve
    

    This will start the Go backend and serve the Angular custom element.

Building the Custom Element

To build the Angular custom element, run the following command:

cd ui
npm run build

This will create a single JavaScript file in the dist directory that you can use in any HTML page.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the EUPL-1.2 License - see the LICENSE file for details.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionOpenWindow

type ActionOpenWindow struct {
	application.WebviewWindowOptions
}

ActionOpenWindow is an IPC message used to request a new window. It contains the options for the new window.

example:

action := display.ActionOpenWindow{
	WebviewWindowOptions: application.WebviewWindowOptions{
		Name: "my-window",
		Title: "My Window",
		Width: 800,
		Height: 600,
	},
}

type Options

type Options struct{}

Options holds configuration for the display service. This struct is used to configure the display service at startup.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service manages windowing, dialogs, and other visual elements. It is the primary interface for interacting with the UI.

func New

func New() (*Service, error)

New is the constructor for the display service. It creates a new Service and returns it.

example:

displayService, err := display.New()
if err != nil {
	log.Fatal(err)
}

func (*Service) OpenWindow

func (s *Service) OpenWindow(opts ...WindowOption) error

OpenWindow creates a new window with the given options. If no options are provided, it will use the default options.

example:

err := displayService.OpenWindow(
	display.WithName("my-window"),
	display.WithTitle("My Window"),
	display.WithWidth(800),
	display.WithHeight(600),
)
if err != nil {
	log.Fatal(err)
}

func (*Service) ShowEnvironmentDialog

func (s *Service) ShowEnvironmentDialog()

ShowEnvironmentDialog displays a dialog containing detailed information about the application's runtime environment. This is useful for debugging and understanding the context in which the application is running.

example:

displayService.ShowEnvironmentDialog()

func (*Service) Startup

func (s *Service) Startup(ctx context.Context) error

Startup is called when the app starts. It initializes the display service and sets up the main application window and system tray.

err := displayService.Startup(ctx)
if err != nil {
	log.Fatal(err)
}

type WindowConfig

type WindowConfig struct {
	Name                string
	Title               string
	Width               int
	Height              int
	URL                 string
	AlwaysOnTop         bool
	Hidden              bool
	MinimiseButtonState application.ButtonState
	MaximiseButtonState application.ButtonState
	CloseButtonState    application.ButtonState
	Frameless           bool
}

WindowConfig holds the configuration for a window. This struct is used to create a new window with the specified options.

type WindowOption

type WindowOption interface {
	Apply(*WindowConfig)
}

WindowOption is an interface for applying configuration options to a WindowConfig.

func WithAlwaysOnTop

func WithAlwaysOnTop(alwaysOnTop bool) WindowOption

WithAlwaysOnTop sets the window to always be on top of other windows.

func WithCloseButtonState

func WithCloseButtonState(state application.ButtonState) WindowOption

WithCloseButtonState sets the state of the close button.

func WithFrameless

func WithFrameless(frameless bool) WindowOption

WithFrameless sets the window to be frameless.

func WithHeight

func WithHeight(height int) WindowOption

WithHeight sets the height of the window.

func WithHidden

func WithHidden(hidden bool) WindowOption

WithHidden sets the window to be hidden when it is created.

func WithMaximiseButtonState

func WithMaximiseButtonState(state application.ButtonState) WindowOption

WithMaximiseButtonState sets the state of the maximise button.

func WithMinimiseButtonState

func WithMinimiseButtonState(state application.ButtonState) WindowOption

WithMinimiseButtonState sets the state of the minimise button.

func WithName

func WithName(name string) WindowOption

WithName sets the name of the window.

func WithTitle

func WithTitle(title string) WindowOption

WithTitle sets the title of the window.

func WithURL

func WithURL(url string) WindowOption

WithURL sets the URL that the window will load.

func WithWidth

func WithWidth(width int) WindowOption

WithWidth sets the width of the window.

type WindowOptionFunc

type WindowOptionFunc func(*WindowConfig)

WindowOptionFunc is a function that implements the WindowOption interface. This allows us to use ordinary functions as window options.

func (WindowOptionFunc) Apply

func (f WindowOptionFunc) Apply(c *WindowConfig)

Apply calls the underlying function to apply the configuration.

Directories

Path Synopsis
cmd
demo-cli command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL