@c2n/color-select 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.
@@ -1,5 +1,6 @@
1
1
  import { LitElement, html, nothing, unsafeCSS } from "lit";
2
- import { customElement, property, query, state } from "lit/decorators.js";
2
+ import { property, query, state } from "lit/decorators.js";
3
+ import { customElement } from "@c2n/core/element-helper.js";
3
4
  import "@c2n/overlay";
4
5
  import "@c2n/color-area";
5
6
  import "@c2n/select";
@@ -1149,6 +1150,7 @@ var ColorSelect = class ColorSelect extends LitElement {
1149
1150
  get color() {
1150
1151
  return this._color;
1151
1152
  }
1153
+ /** Selected CSS colour value. */
1152
1154
  set color(value) {
1153
1155
  if (this._color != value) {
1154
1156
  this._color = value;
package/package.json CHANGED
@@ -1,18 +1,30 @@
1
1
  {
2
2
  "name": "@c2n/color-select",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "type": "module",
5
5
  "main": "dist/color-select.js",
6
6
  "exports": {
7
7
  ".": {
8
- "default": "./dist/color-select.js",
9
- "types": "./types/src/color-select.d.ts"
8
+ "types": "./types/src/color-select.d.ts",
9
+ "default": "./dist/color-select.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-select",
@@ -53,12 +65,12 @@
53
65
  }
54
66
  },
55
67
  "dependencies": {
56
- "@c2n/color-area": "0.0.6",
57
- "@c2n/color-slider": "0.0.6",
58
- "@c2n/core": "0.0.6",
59
- "@c2n/overlay": "0.0.6",
60
- "@c2n/select": "0.0.6",
61
- "@c2n/text-field": "0.0.6",
68
+ "@c2n/color-area": "0.0.7",
69
+ "@c2n/color-slider": "0.0.7",
70
+ "@c2n/core": "0.0.7",
71
+ "@c2n/overlay": "0.0.7",
72
+ "@c2n/select": "0.0.7",
73
+ "@c2n/text-field": "0.0.7",
62
74
  "@ctrl/tinycolor": "4.2.0",
63
75
  "lit": "3.3.3"
64
76
  },
@@ -66,5 +78,5 @@
66
78
  "@c2n/config": "*"
67
79
  },
68
80
  "customElements": "custom-elements.json",
69
- "gitHead": "2921054bc75299da66dad11c1e374246ff88a51e"
81
+ "gitHead": "c8db398a27f7cd417d665fdf5da455fee2d4e910"
70
82
  }
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-select. Import once, anywhere in the program:
4
+ //
5
+ // import '@c2n/color-select/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 { ColorSelect } from '@c2n/color-select'
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-select': C2Props<ColorSelect>
20
+ }
21
+ }
22
+ }
23
+
24
+ export {}
package/react.js ADDED
@@ -0,0 +1,3 @@
1
+ // GENERATED by @c2n/framework-types. Do not edit by hand.
2
+ // Types only — see the matching .d.ts.
3
+ export {}
@@ -1,4 +1,5 @@
1
1
  import { LitElement } from 'lit';
2
+ import type { TypedAddEventListener, TypedRemoveEventListener } from '@c2n/core/event-helper.js';
2
3
  import { TinyColor } from '@ctrl/tinycolor';
3
4
  import '@c2n/overlay';
4
5
  import '@c2n/color-area';
@@ -12,10 +13,20 @@ export interface ColorSelectChangeEventDetail {
12
13
  v: number;
13
14
  a: number;
14
15
  }
16
+ /** Events fired by {@link ColorSelect}, keyed for `addEventListener`. */
17
+ export interface ColorSelectEventMap {
18
+ change: CustomEvent<string>;
19
+ }
20
+ export interface ColorSelect {
21
+ addEventListener: TypedAddEventListener<ColorSelect, ColorSelectEventMap>;
22
+ removeEventListener: TypedRemoveEventListener<ColorSelect, ColorSelectEventMap>;
23
+ }
15
24
  /**
25
+ * Popup colour picker combining a colour area, hue control and editable colour value.
26
+ *
16
27
  * @tag c2-color-select
17
28
  *
18
- * @event {CustomEvent} change
29
+ * @event {CustomEvent<string>} change - Fired when the selected colour changes; `detail` is the serialized colour.
19
30
  *
20
31
  * @cssproperty {pixel} [--c2-color-select--width=16px]
21
32
  * @cssproperty {pixel} [--c2-color-select--height=16px]
@@ -63,9 +74,11 @@ export interface ColorSelectChangeEventDetail {
63
74
  */
64
75
  export declare class ColorSelect extends LitElement {
65
76
  static styles: import("lit").CSSResult;
77
+ /** Preferred popup placement relative to the trigger. */
66
78
  placement: string;
67
79
  private _color;
68
80
  get color(): string;
81
+ /** Selected CSS colour value. */
69
82
  set color(value: string);
70
83
  hue: number;
71
84
  saturation: number;
@@ -1 +1 @@
1
- {"version":3,"file":"color-select.d.ts","sourceRoot":"","sources":["../../src/color-select.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA4B,MAAM,KAAK,CAAA;AAE1D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAI3C,OAAO,cAAc,CAAA;AACrB,OAAO,iBAAiB,CAAA;AACxB,OAAO,aAAa,CAAA;AACpB,OAAO,iBAAiB,CAAA;AACxB,OAAO,mBAAmB,CAAA;AAG1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAIhD,MAAM,WAAW,4BAA4B;IAC3C,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;I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AO,CAAC,2BAA2B;IAQnC,OAAO,CAAC,0BAA0B;IAQlC,OAAO,CAAC,oBAAoB;IAY5B,OAAO,CAAC,sBAAsB;IAQ9B,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,qBAAqB;IAK7B,OAAO,CAAC,uBAAuB;IAK/B,OAAO,CAAC,oBAAoB;IAQ5B,OAAO,CAAC,qBAAqB;IAQ7B,OAAO,CAAC,mBAAmB;IAK3B,mBAAmB;IAeV,MAAM;CAoDhB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,iBAAiB,EAAE,WAAW,CAAA;KAC/B;CACF"}
package/vue.d.ts ADDED
@@ -0,0 +1,33 @@
1
+ // GENERATED by @c2n/framework-types. Do not edit by hand.
2
+ //
3
+ // Vue template types for the custom elements of @c2n/color-select. Import once, anywhere in the program:
4
+ //
5
+ // import '@c2n/color-select/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 { ColorSelect, ColorSelectEventMap } from '@c2n/color-select'
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-select': DefineComponent<
19
+ C2Props<ColorSelect> & {
20
+ onChange?: (event: ColorSelectEventMap['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
@@ -0,0 +1,3 @@
1
+ // GENERATED by @c2n/framework-types. Do not edit by hand.
2
+ // Types only — see the matching .d.ts.
3
+ export {}