Skip to content

Commit

Permalink
Merge pull request #202 from lightning-js/dev
Browse files Browse the repository at this point in the history
Release 1.8.3
  • Loading branch information
michielvandergeest authored Oct 31, 2024
2 parents 551ba41 + 741a73e commit a26d3d1
Show file tree
Hide file tree
Showing 5 changed files with 668 additions and 636 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
# Changelog

## v1.8.3

_31 oct 2024_

- Exported TS interfaces and improved return type of before route hook
- Fixed test cases for codegenerator


## v1.8.2

_30 oct 2024_

- Fixed edgecase issue with array based props not triggering reactivity
- Fixed edge case issue with array based props not triggering reactivity


## v1.8.1
Expand Down
46 changes: 23 additions & 23 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {type ShaderEffect as RendererShaderEffect, type WebGlCoreShader} from '@

declare module '@lightningjs/blits' {

interface Hooks {
export interface Hooks {
/**
* Fires when the Component is being instantiated
* At this moment child elements will not be available yet
Expand Down Expand Up @@ -77,7 +77,7 @@ declare module '@lightningjs/blits' {
exit?: () => void;
}

interface Input {
export interface Input {
[key: string]: (event: KeyboardEvent) => void | undefined,
/**
* Catch all input function
Expand All @@ -88,7 +88,7 @@ declare module '@lightningjs/blits' {
any?: (event: KeyboardEvent) => void
}

interface Log {
export interface Log {
/**
* Log an info message
*/
Expand All @@ -109,16 +109,16 @@ declare module '@lightningjs/blits' {



interface RouteData {
export interface RouteData {
[key: string]: any
}

// todo: specify valid route options
interface RouteOptions {
export interface RouteOptions {
[key: string]: any
}

interface Router {
export interface Router {
/**
* Navigate to a different location
*
Expand Down Expand Up @@ -148,7 +148,7 @@ declare module '@lightningjs/blits' {

}

type ComponentBase = {
export type ComponentBase = {
/**
* Listen to events emitted by other components
*/
Expand Down Expand Up @@ -246,7 +246,7 @@ declare module '@lightningjs/blits' {
/**
* Prop object
*/
type PropObject = {
export type PropObject = {
/**
* Name of the prop
*/
Expand Down Expand Up @@ -274,19 +274,19 @@ declare module '@lightningjs/blits' {
};

// Props Array
type Props = (string | PropObject)[];
export type Props = (string | PropObject)[];

// Extract the prop names from the props array
type ExtractPropNames<P extends Props> = {
readonly [K in P[number] as K extends string ? K : K extends { key: infer Key } ? Key : never]: any;
};

// Update the PropsDefinition to handle props as strings or objects
type PropsDefinition<P extends Props> = ExtractPropNames<P>;
export type PropsDefinition<P extends Props> = ExtractPropNames<P>;

type ComponentContext<P extends Props, S, M, C> = ThisType<PropsDefinition<P> & S & M & C & ComponentBase>
export type ComponentContext<P extends Props, S, M, C> = ThisType<PropsDefinition<P> & S & M & C & ComponentBase>

interface ComponentConfig<P extends Props, S, M, C, W> {
export interface ComponentConfig<P extends Props, S, M, C, W> {
components?: {
[key: string]: ComponentFactory,
},
Expand Down Expand Up @@ -365,7 +365,7 @@ declare module '@lightningjs/blits' {
watch?: W & ComponentContext<P, S, M, C>
}

interface ApplicationConfig<P extends Props, S, M, C, W> extends ComponentConfig<P, S, M, C, W> {
export interface ApplicationConfig<P extends Props, S, M, C, W> extends ComponentConfig<P, S, M, C, W> {
/**
* Routes definition
*
Expand All @@ -383,7 +383,7 @@ declare module '@lightningjs/blits' {
}


interface Transition {
export interface Transition {
/**
* Name of the prop to transition (i.e. 'x', 'y', 'alpha', 'color')
*/
Expand All @@ -406,7 +406,7 @@ declare module '@lightningjs/blits' {
delay?: number
}

interface Before {
export interface Before {
/**
* Name of the prop to set before the transition starts
*/
Expand All @@ -417,7 +417,7 @@ declare module '@lightningjs/blits' {
value: any,
}

interface RouteTransition {
export interface RouteTransition {
/**
* Setting or Array of Settings before new view enters into the router view
*/
Expand All @@ -432,9 +432,9 @@ declare module '@lightningjs/blits' {
out: Transition | Transition[],
}

type RouteTransitionFunction = (previousRoute: Route, currentRoute: Route) => RequireAtLeastOne<RouteTransition>
export type RouteTransitionFunction = (previousRoute: Route, currentRoute: Route) => RequireAtLeastOne<RouteTransition>

interface RouteAnnounce {
export interface RouteAnnounce {
/**
* Message to be announced
*/
Expand All @@ -447,15 +447,15 @@ declare module '@lightningjs/blits' {
politeness?: 'off' | 'polite' | 'assertive'
}

type RequireAtLeastOne<T> = {
export type RequireAtLeastOne<T> = {
[K in keyof T]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<keyof T, K>>>
}[keyof T]

interface RouteHooks {
before?: (to: Route, from: Route) => string | Route;
export interface RouteHooks {
before?: (to: Route, from: Route) => string | Route | Promise<string | Route>;
}

type Route = {
export type Route = {
/**
* URI path for the route
*/
Expand Down Expand Up @@ -575,7 +575,7 @@ declare module '@lightningjs/blits' {
* Launcher function that sets up the Lightning renderer and instantiates
* the Blits App
*/
interface Settings {
export interface Settings {
/**
* Width of the Application
*/
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lightningjs/blits",
"version": "1.8.2",
"version": "1.8.3",
"description": "Blits: The Lightning 3 App Development Framework",
"bin": "bin/index.js",
"exports": {
Expand Down
Loading

0 comments on commit a26d3d1

Please sign in to comment.