Skip to content

Add more exports#760

Open
guilhermesimoes wants to merge 1 commit intolightning-js:mainfrom
guilhermesimoes:add-lightning3-exports
Open

Add more exports#760
guilhermesimoes wants to merge 1 commit intolightning-js:mainfrom
guilhermesimoes:add-lightning3-exports

Conversation

@guilhermesimoes
Copy link

Add type exports TextRenderer, CoreNodeProps and CoreTextNodeProps.

Also export CoreNode and CoreTextNode since we can't use stage.createNode() or stage.createTextNode().

Peacock has been using Lightning v2's Element for several years now, so all our components extend that class. In order to migrate to Lightning v3, we need access to the new building blocks, CoreNode and CoreTextNode, so that our components can extend those.

export type { AnimationSettings } from '../src/core/animations/CoreAnimation.js';
export type { TimingFunction } from '../src/core/utils.js';
export type { Inspector } from '../src/main-api/Inspector.js';
export type { CoreNodeRenderState } from '../src/core/CoreNode.js';
Copy link
Author

@guilhermesimoes guilhermesimoes Mar 13, 2026

Choose a reason for hiding this comment

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

I'd also like to report something here.

Is it intended for consumers of lightningjs/renderer to be able to do:

import { CoreNodeRenderState } from '@lightningjs/renderer';

if (renderState === CoreNodeRenderState.InViewport) { ... }

?

Because if so, then this isn't working. All enums are being exported as export declare enum X. In order to preserve enums for consumers, preserveConstEnums must be used.

@elsassph
Copy link
Contributor

@guilhermesimoes I think you aren't approaching that correctly - to create nodes you should be go through the renderer instance:

Both the official Blits and unofficial SolidJS frameworks use this API, and in both cases they don't directly extend those objects, which is potentially a departure from the Lightning 2 approach where you can extend the base Element type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants