Skip to content
Merged
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
1 change: 0 additions & 1 deletion plugins/bindable.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ function transform({ node, environment }) {
} else {
node.attributes.value = object[property] ?? '';
}
node.attributes.name = node.attributes.name || node.attributes.bind;
if (environment.client) {
if (node.attributes.type === 'checkbox' || node.attributes.type === 'radio') {
node.attributes.onclick ??= noop;
Expand Down
34 changes: 21 additions & 13 deletions types/ClientContext.d.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { NullstackEnvironment } from "./Environment";
import { NullstackPage } from "./Page";
import { NullstackParams } from "./Params";
import { NullstackProject } from "./Project";
import { NullstackRouter } from "./Router";
import { NullstackSettings } from "./Settings";
import { NullstackWorker } from "./Worker";
import { NullstackEnvironment } from './Environment';
import { NullstackNode } from './JSX';
import { NullstackPage } from './Page';
import { NullstackParams } from './Params';
import { NullstackProject } from './Project';
import { NullstackRouter } from './Router';
import { NullstackSettings } from './Settings';
import { NullstackWorker } from './Worker';

/**
* @see https://nullstack.app/context
*/
export type NullstackClientContext = {

export type NullstackClientContext<TProps = unknown, TBindValue = undefined> = TProps & {
/**
* Information about the document `head` metatags.
*
Expand Down Expand Up @@ -48,7 +48,7 @@ export type NullstackClientContext = {
* @scope client
* @see https://nullstack.app/context-instances
*/
instances?: Record<string, any>;
instances?: Record<string, unknown>;

/**
* It gives you information about the current environment.
Expand Down Expand Up @@ -93,11 +93,19 @@ export type NullstackClientContext = {
*
* @see https://nullstack.app/renderable-components#components-with-children
*/
children?: Readonly<Array<any>>;
children?: NullstackNode;

/**
* Custom context prop.
* Bind object.
*
* @see https://nullstack.app/two-way-bindings#complex-bindable-components
*/
[key: string]: any;
bind?: { object: Record<string, unknown>; property: string };

/**
* Bind value.
*
* @see https://nullstack.app/two-way-bindings#complex-bindable-components
*/
value?: TBindValue;
};
4 changes: 1 addition & 3 deletions types/Environment.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export type NullstackEnvironment = {

client: boolean;

server: boolean;
Expand All @@ -24,5 +23,4 @@ export type NullstackEnvironment = {
* @see https://nullstack.app/context-environment
*/
event: string;

};
};
Loading