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
247 changes: 247 additions & 0 deletions lib/node_modules/@stdlib/plot/vega/autosize/ctor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,247 @@
<!--

@license Apache-2.0

Copyright (c) 2026 The Stdlib Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

-->

# Autosize

> Autosize constructor.

<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->

<section class="intro">

</section>

<!-- /.intro -->

<!-- Package usage documentation. -->

<section class="usage">

## Usage

```javascript
var Autosize = require( '@stdlib/plot/vega/autosize/ctor' );
```

#### Autosize( \[options] )

Returns an autosize instance.

```javascript
var autosize = new Autosize();
// returns <Autosize>
```

The constructor accepts the following `options`:

- **contains**: method for determining how a size calculation should be performed. Default: `'content'`.
- **resize**: boolean indicating whether to re-calculate an autosize layout on every view update. Default: `false`.
- **type**: autosize method. Default: `'pad'`.

```javascript
var autosize = new Autosize({
'contains': 'padding',
'resize': true,
'type': 'fit'
});
// returns <Autosize>

var v = autosize.type;
// returns 'fit'
```

* * *

### Writable Properties

<a name="prop-contains"></a>

#### Autosize.prototype.contains

Method for determining how a size calculation should be performed. Default: `'content'`.

```javascript
var autosize = new Autosize();

// Set:
autosize.contains = 'padding';

// Get:
var v = autosize.contains;
// returns 'padding'
```

<a name="prop-resize"></a>

#### Autosize.prototype.resize

Boolean indicating whether to re-calculate an autosize layout on every view update. Default: `false`.

```javascript
var autosize = new Autosize();

// Set:
autosize.resize = true;

// Get:
var v = autosize.resize;
// returns true
```

<a name="prop-type"></a>

#### Autosize.prototype.type

Autosize type. Default: `'pad'`.

```javascript
var autosize = new Autosize();

// Set:
autosize.type = 'none';

// Get:
var v = autosize.type;
// returns 'none'
```

* * *

### Read-only Properties

<a name="prop-properties"></a>

#### Autosize.prototype.properties

List of enumerable properties.

```javascript
var autosize = new Autosize();

var v = autosize.properties;
// returns [ 'contains', 'resize', 'type' ]
```

* * *

### Methods

<a name="method-to-json"></a>

#### Autosize.prototype.toJSON()

Serializes an autosize instance to a JSON object.

```javascript
var autosize = new Autosize({
'type': 'fit'
});

var v = autosize.toJSON();
// returns { 'contains': 'content', 'resize': false, 'type': 'fit' }
```

This method is implicitly invoked by `JSON.stringify`.

```javascript
var autosize = new Autosize({
'type': 'fit'
});

var str = JSON.stringify( autosize );
// returns '{"contains":"content","resize":false,"type":"fit"}'
```

* * *

### Events

#### 'change'

Emitted whenever a property value changes.

```javascript
var autosize = new Autosize();

autosize.on( 'change', onChange );

autosize.type = 'fit';

function onChange( event ) {
console.log( 'Updated property: %s', event.property );
}
```

</section>

<!-- /.usage -->

<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="notes">

</section>

<!-- /.notes -->

<!-- Package usage examples. -->

<section class="examples">

* * *

## Examples

<!-- eslint no-undef: "error" -->

```javascript
var Autosize = require( '@stdlib/plot/vega/autosize/ctor' );

var autosize = new Autosize();
console.log( autosize.toJSON() );
```

</section>

<!-- /.examples -->

<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="references">

</section>

<!-- /.references -->

<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->

<section class="related">

</section>

<!-- /.related -->

<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="links">

</section>

<!-- /.links -->
Loading
Loading