Skip to content

Commit

Permalink
Make things nice for v5 release :)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaames committed Feb 23, 2020
1 parent 6e40724 commit da4059e
Show file tree
Hide file tree
Showing 24 changed files with 2,617 additions and 20,303 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ node_modules
.tmp
docs/.vuepress/dist
built/*
.rpt2_cache/*
.rpt2_cache/*
package-lock.json
12 changes: 6 additions & 6 deletions dist/ComponentBase.d.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { Component, h } from 'preact';
import { IroColor, IroColorPickerOptions } from '@irojs/iro-core';
import { IroColorPicker } from './ColorPicker';
export declare enum EventResult {
start = 0,
move = 1,
end = 2
export declare const enum EventResult {
Start = 0,
Move = 1,
End = 2
}
export interface IroComponentProps extends IroColorPickerOptions {
parent: IroColorPicker;
color: IroColor;
onInput: Function;
onInput: (type: EventResult) => void;
}
interface Props {
onInput: Function;
onInput: (x: number, y: number, type: EventResult) => void;
}
interface State {
}
Expand Down
34 changes: 20 additions & 14 deletions dist/colorPicker.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { h, Component } from 'preact';
import { IroColor, IroColorValue, IroColorPickerOptions } from '@irojs/iro-core';
interface ColorPickerLayoutDefinition {
component: any;
options: any;
options?: any;
}
export interface ColorPickerProps extends IroColorPickerOptions {
display?: string;
Expand All @@ -16,7 +16,6 @@ export interface ColorPickerState extends ColorPickerProps {
colors: IroColor[];
}
export declare class IroColorPicker extends Component<ColorPickerProps, ColorPickerState> {
static pluginHooks: {};
static defaultProps: {
colors: any[];
display: string;
Expand Down Expand Up @@ -47,9 +46,27 @@ export declare class IroColorPicker extends Component<ColorPickerProps, ColorPic
private deferredEvents;
private colorUpdateActive;
constructor(props: ColorPickerProps);
/**
* @desc Add a color to the color picker
* @param color new color to add
* @param index optional color index
*/
addColor(color: IroColorValue, index?: number): void;
/**
* @desc Remove a color from the color picker
* @param index color index
*/
removeColor(index: number): void;
/**
* @desc Set the currently active color
* @param index color index
*/
setActiveColor(index: number): void;
/**
* @desc Replace all of the current colorPicker colors
* @param newColorValues list of new colors to add
*/
setColors(newColorValues: IroColorValue[]): void;
/**
* @desc Set a callback function for an event
* @param eventList event(s) to listen to
Expand All @@ -72,7 +89,7 @@ export declare class IroColorPicker extends Component<ColorPickerProps, ColorPic
* @param eventType - The name of the event to emit
*/
deferredEmit(eventType: string, ...args: any): void;
updateOptions(newOptions: Partial<ColorPickerState>): void;
setOptions(newOptions: Partial<ColorPickerState>): void;
/**
* @desc Resize the color picker
* @param width - new width
Expand All @@ -82,17 +99,6 @@ export declare class IroColorPicker extends Component<ColorPickerProps, ColorPic
* @desc Reset the color picker to the initial color provided in the color picker options
*/
reset(): void;
/**
* @desc Set a callback function for a hook
* @param hookType - The name of the hook to listen to
* @param callback
*/
static addHook(hookType: string, callback: Function): void;
/**
* @desc Emit a callback hook
* @param hookType - The type of hook event to emit
*/
private emitHook;
/**
* @desc Called by the createWidget wrapper when the element is mounted into the page
* @param container - the container element for this ColorPicker instance
Expand Down
25 changes: 24 additions & 1 deletion dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,25 @@
declare const _default: any;
import { h } from 'preact';
import { IroColor } from '@irojs/iro-core';
import { IroComponentBase } from './ComponentBase';
import { IroHandle } from './Handle';
import { IroSlider } from './Slider';
import { IroBox } from './Box';
import { IroWheel } from './Wheel';
declare const _default: {
Color: typeof IroColor;
ColorPicker: {
(parent: HTMLElement, props: any): any;
prototype: any;
__component: import("preact").ComponentType<{}>;
};
ui: {
h: typeof h;
ComponentBase: typeof IroComponentBase;
Handle: typeof IroHandle;
Slider: typeof IroSlider;
Wheel: typeof IroWheel;
Box: typeof IroBox;
};
version: string;
};
export default _default;
1,360 changes: 1,193 additions & 167 deletions dist/iro.es.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion dist/iro.es.js.map

This file was deleted.

1,360 changes: 1,193 additions & 167 deletions dist/iro.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/iro.js.map

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions dist/iro.min.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion dist/iro.min.js.map

This file was deleted.

12 changes: 11 additions & 1 deletion docs/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ colorPicker.setActiveColor(1);

### Adding and Removing Colors

Colors can also be added and removed from the color picker at any time:
Colors can be added and removed from the color picker at any time:

```js
// add a color to the color picker
Expand All @@ -270,6 +270,16 @@ colorPicker.addColor('rgb(100%, 100%, 100%)', 0);
colorPicker.removeColor(1);
```

You can also replace all of the colors at once with the `setColors` method:

```js
colorPicker.setColors([
'rgba(100%, 0%, 100%)'
'rgba(0%, 0%, 0%)'
'rgba(0%, 100%, 100%)'
]);
```

## Custom Handles

By default, the color picker uses circular control handles which can be adjusted with the `handleRadius` option. However, it's possible to override this and use your own SVGs to create custom handles.
Expand Down
8 changes: 8 additions & 0 deletions docs/colorPicker_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,14 @@ Set the currently 'active' color (the color that is selected and highlighted).

* `{Number}` color index

### `setColors`

Replaces all the colors currently on the color picker with a new set of colors.

**Arguments:**

* `{Color []}` new color values

## Utility Methods

### `resize`
Expand Down
Loading

0 comments on commit da4059e

Please sign in to comment.