@c2n/color-area 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/color-area.js +2 -1
- package/package.json +18 -6
- package/react.d.ts +24 -0
- package/react.js +3 -0
- package/types/src/color-area.d.ts +18 -1
- package/types/src/color-area.d.ts.map +1 -1
- package/vue.d.ts +33 -0
- package/vue.js +3 -0
package/dist/color-area.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LitElement, html, unsafeCSS } from "lit";
|
|
2
|
-
import {
|
|
2
|
+
import { property, query } from "lit/decorators.js";
|
|
3
|
+
import { customElement } from "@c2n/core/element-helper.js";
|
|
3
4
|
//#region src/color-area.scss?inline
|
|
4
5
|
var color_area_default = "/* ex : var((width: 24px), width, c2-checkbox) returns var(--c2-checkbox-width, 24px) */\n:host {\n display: block;\n}\n\n.c2-color-area {\n display: block;\n position: relative;\n padding: calc(var(--c2-color-area__color-handle--size,12px) - 6px);\n width: fit-content;\n height: fit-content;\n}\n.c2-color-area .gradient {\n width: 100%;\n height: 100%;\n width: var(--c2-color-area--width,240px);\n height: var(--c2-color-area--height,240px);\n border-top-left-radius: var(--c2-color-area--border-top-left-radius);\n border-top-right-radius: var(--c2-color-area--border-top-right-radius);\n border-bottom-left-radius: var(--c2-color-area--border-bottom-left-radius);\n border-bottom-right-radius: var(--c2-color-area--border-bottom-right-radius);\n}\n.c2-color-area .color-handle {\n position: absolute;\n pointer-events: none;\n box-sizing: border-box;\n width: var(--c2-color-area__color-handle--size,12px);\n height: var(--c2-color-area__color-handle--size,12px);\n border-radius: 50%;\n top: 0;\n left: 0;\n border: 2px solid white;\n background: transparent;\n box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 0px 0.6px;\n cursor: inherit;\n}";
|
|
5
6
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,18 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c2n/color-area",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/color-area.js",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
8
|
-
"
|
|
9
|
-
"
|
|
8
|
+
"types": "./types/src/color-area.d.ts",
|
|
9
|
+
"default": "./dist/color-area.js"
|
|
10
|
+
},
|
|
11
|
+
"./react": {
|
|
12
|
+
"types": "./react.d.ts",
|
|
13
|
+
"default": "./react.js"
|
|
14
|
+
},
|
|
15
|
+
"./vue": {
|
|
16
|
+
"types": "./vue.d.ts",
|
|
17
|
+
"default": "./vue.js"
|
|
10
18
|
},
|
|
11
19
|
"./custom-elements.json": "./custom-elements.json"
|
|
12
20
|
},
|
|
13
21
|
"files": [
|
|
14
22
|
"dist",
|
|
15
|
-
"types"
|
|
23
|
+
"types",
|
|
24
|
+
"react.d.ts",
|
|
25
|
+
"react.js",
|
|
26
|
+
"vue.d.ts",
|
|
27
|
+
"vue.js"
|
|
16
28
|
],
|
|
17
29
|
"keywords": [
|
|
18
30
|
"color-area",
|
|
@@ -48,7 +60,7 @@
|
|
|
48
60
|
}
|
|
49
61
|
},
|
|
50
62
|
"dependencies": {
|
|
51
|
-
"@c2n/core": "0.0.
|
|
63
|
+
"@c2n/core": "0.0.7",
|
|
52
64
|
"@ctrl/tinycolor": "4.2.0",
|
|
53
65
|
"lit": "3.3.3"
|
|
54
66
|
},
|
|
@@ -56,5 +68,5 @@
|
|
|
56
68
|
"@c2n/config": "*"
|
|
57
69
|
},
|
|
58
70
|
"customElements": "custom-elements.json",
|
|
59
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "c8db398a27f7cd417d665fdf5da455fee2d4e910"
|
|
60
72
|
}
|
package/react.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// GENERATED by @c2n/framework-types. Do not edit by hand.
|
|
2
|
+
//
|
|
3
|
+
// JSX types for the custom elements of @c2n/color-area. Import once, anywhere in the program:
|
|
4
|
+
//
|
|
5
|
+
// import '@c2n/color-area/react'
|
|
6
|
+
//
|
|
7
|
+
// Register the elements at module scope before React renders, or React writes an object prop as an
|
|
8
|
+
// attribute and it stringifies.
|
|
9
|
+
|
|
10
|
+
import type { DetailedHTMLProps, HTMLAttributes } from 'react'
|
|
11
|
+
import type { ColorArea } from '@c2n/color-area'
|
|
12
|
+
|
|
13
|
+
/** Standard React host-element attributes plus the element's own public properties. */
|
|
14
|
+
type C2Props<T> = DetailedHTMLProps<HTMLAttributes<T>, T> & Partial<Omit<T, keyof HTMLElement>>
|
|
15
|
+
|
|
16
|
+
declare module 'react' {
|
|
17
|
+
namespace JSX {
|
|
18
|
+
interface IntrinsicElements {
|
|
19
|
+
'c2-color-area': C2Props<ColorArea>
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export {}
|
package/react.js
ADDED
|
@@ -1,13 +1,27 @@
|
|
|
1
1
|
import { LitElement, type PropertyValueMap } from 'lit';
|
|
2
|
+
import type { TypedAddEventListener, TypedRemoveEventListener } from '@c2n/core/event-helper.js';
|
|
2
3
|
import { TinyColor } from '@ctrl/tinycolor';
|
|
3
4
|
export interface Point {
|
|
4
5
|
x: number;
|
|
5
6
|
y: number;
|
|
6
7
|
}
|
|
8
|
+
/** Events fired by {@link ColorArea}, keyed for `addEventListener`. */
|
|
9
|
+
export interface ColorAreaEventMap {
|
|
10
|
+
change: CustomEvent<{
|
|
11
|
+
saturation: number;
|
|
12
|
+
value: number;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
export interface ColorArea {
|
|
16
|
+
addEventListener: TypedAddEventListener<ColorArea, ColorAreaEventMap>;
|
|
17
|
+
removeEventListener: TypedRemoveEventListener<ColorArea, ColorAreaEventMap>;
|
|
18
|
+
}
|
|
7
19
|
/**
|
|
20
|
+
* Two-dimensional saturation/value picker for a hue, with pointer and keyboard interaction.
|
|
21
|
+
*
|
|
8
22
|
* @tag c2-color-area
|
|
9
23
|
*
|
|
10
|
-
* @event {CustomEvent} change
|
|
24
|
+
* @event {CustomEvent<{ saturation: number; value: number }>} change - Fired while the selected saturation or value changes.
|
|
11
25
|
*
|
|
12
26
|
* @cssproperty {pixel} [--c2-color-area--width=240px]
|
|
13
27
|
* @cssproperty {pixel} [--c2-color-area--height=240px]
|
|
@@ -20,8 +34,11 @@ export interface Point {
|
|
|
20
34
|
*/
|
|
21
35
|
export declare class ColorArea extends LitElement {
|
|
22
36
|
static styles: import("lit").CSSResult;
|
|
37
|
+
/** Hue of the colour plane in degrees. */
|
|
23
38
|
hue: number;
|
|
39
|
+
/** Selected saturation from 0 to 1. */
|
|
24
40
|
saturation: number;
|
|
41
|
+
/** Selected brightness value from 0 to 1. */
|
|
25
42
|
value: number;
|
|
26
43
|
get tinyColor(): TinyColor;
|
|
27
44
|
colorHandle?: HTMLElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-area.d.ts","sourceRoot":"","sources":["../../src/color-area.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAmB,KAAK,gBAAgB,EAAE,MAAM,KAAK,CAAA;AAGxE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C,MAAM,WAAW,KAAK;IACpB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV;AAED
|
|
1
|
+
{"version":3,"file":"color-area.d.ts","sourceRoot":"","sources":["../../src/color-area.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAmB,KAAK,gBAAgB,EAAE,MAAM,KAAK,CAAA;AAGxE,OAAO,KAAK,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAA;AAEhG,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C,MAAM,WAAW,KAAK;IACpB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV;AAED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
|
2
|
+
//
|
|
3
|
+
// Vue template types for the custom elements of @c2n/color-area. Import once, anywhere in the program:
|
|
4
|
+
//
|
|
5
|
+
// import '@c2n/color-area/vue'
|
|
6
|
+
//
|
|
7
|
+
// Tell the compiler about the tags as well, or every c2-* tag is resolved as a Vue component and renders
|
|
8
|
+
// nothing: template.compilerOptions.isCustomElement = (tag) => tag.startsWith('c2-') in vite.config.ts.
|
|
9
|
+
|
|
10
|
+
import type { DefineComponent, HTMLAttributes } from 'vue'
|
|
11
|
+
import type { ColorArea, ColorAreaEventMap } from '@c2n/color-area'
|
|
12
|
+
|
|
13
|
+
/** The element's own public properties, plus every attribute Vue understands on a host element. */
|
|
14
|
+
type C2Props<T> = Partial<Omit<T, keyof HTMLElement>> & HTMLAttributes
|
|
15
|
+
|
|
16
|
+
declare module 'vue' {
|
|
17
|
+
interface GlobalComponents {
|
|
18
|
+
'c2-color-area': DefineComponent<
|
|
19
|
+
C2Props<ColorArea> & {
|
|
20
|
+
onChange?: (event: ColorAreaEventMap['change']) => void
|
|
21
|
+
}
|
|
22
|
+
>
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
declare module '@vue/runtime-dom' {
|
|
27
|
+
interface HTMLAttributes {
|
|
28
|
+
/** Vue's own definition omits it, and slotting a plain element into a component needs it. */
|
|
29
|
+
slot?: string
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export {}
|
package/vue.js
ADDED