duoyun-ui 0.0.2
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/LICENSE +21 -0
- package/README.md +12 -0
- package/docs/.gitignore +4 -0
- package/docs/104.bundle.js +19 -0
- package/docs/283.bundle.js +47 -0
- package/docs/354.bundle.js +1133 -0
- package/docs/354.bundle.js.LICENSE.txt +13 -0
- package/docs/587.bundle.js +26 -0
- package/docs/810.bundle.js +1 -0
- package/docs/gem-book.json +84 -0
- package/docs/index.html +1 -0
- package/docs/main.bundle.js +1 -0
- package/docs/robots.txt +2 -0
- package/docs/service-worker.js +1 -0
- package/docs/workbox-62d1f9d5.js +1 -0
- package/elements/action-text.d.ts +12 -0
- package/elements/action-text.d.ts.map +1 -0
- package/elements/action-text.js +63 -0
- package/elements/action-text.js.map +1 -0
- package/elements/area-chart.d.ts +35 -0
- package/elements/area-chart.d.ts.map +1 -0
- package/elements/area-chart.js +408 -0
- package/elements/area-chart.js.map +1 -0
- package/elements/avatar.d.ts +42 -0
- package/elements/avatar.d.ts.map +1 -0
- package/elements/avatar.js +190 -0
- package/elements/avatar.js.map +1 -0
- package/elements/banner.d.ts +21 -0
- package/elements/banner.d.ts.map +1 -0
- package/elements/banner.js +136 -0
- package/elements/banner.js.map +1 -0
- package/elements/bar-chart.d.ts +23 -0
- package/elements/bar-chart.d.ts.map +1 -0
- package/elements/bar-chart.js +170 -0
- package/elements/bar-chart.js.map +1 -0
- package/elements/base/chart.d.ts +74 -0
- package/elements/base/chart.d.ts.map +1 -0
- package/elements/base/chart.js +299 -0
- package/elements/base/chart.js.map +1 -0
- package/elements/base/loadable.d.ts +16 -0
- package/elements/base/loadable.d.ts.map +1 -0
- package/elements/base/loadable.js +77 -0
- package/elements/base/loadable.js.map +1 -0
- package/elements/base/resize.d.ts +15 -0
- package/elements/base/resize.d.ts.map +1 -0
- package/elements/base/resize.js +31 -0
- package/elements/base/resize.js.map +1 -0
- package/elements/base/scroll.d.ts +11 -0
- package/elements/base/scroll.d.ts.map +1 -0
- package/elements/base/scroll.js +90 -0
- package/elements/base/scroll.js.map +1 -0
- package/elements/base/visible.d.ts +12 -0
- package/elements/base/visible.d.ts.map +1 -0
- package/elements/base/visible.js +37 -0
- package/elements/base/visible.js.map +1 -0
- package/elements/breadcrumbs.d.ts +20 -0
- package/elements/breadcrumbs.d.ts.map +1 -0
- package/elements/breadcrumbs.js +88 -0
- package/elements/breadcrumbs.js.map +1 -0
- package/elements/button.d.ts +30 -0
- package/elements/button.d.ts.map +1 -0
- package/elements/button.js +225 -0
- package/elements/button.js.map +1 -0
- package/elements/card.d.ts +26 -0
- package/elements/card.d.ts.map +1 -0
- package/elements/card.js +163 -0
- package/elements/card.js.map +1 -0
- package/elements/cascader-pick.d.ts +22 -0
- package/elements/cascader-pick.d.ts.map +1 -0
- package/elements/cascader-pick.js +172 -0
- package/elements/cascader-pick.js.map +1 -0
- package/elements/cascader.d.ts +29 -0
- package/elements/cascader.d.ts.map +1 -0
- package/elements/cascader.js +247 -0
- package/elements/cascader.js.map +1 -0
- package/elements/chart-tooltip.d.ts +29 -0
- package/elements/chart-tooltip.d.ts.map +1 -0
- package/elements/chart-tooltip.js +150 -0
- package/elements/chart-tooltip.js.map +1 -0
- package/elements/chart-zoom.d.ts +20 -0
- package/elements/chart-zoom.d.ts.map +1 -0
- package/elements/chart-zoom.js +207 -0
- package/elements/chart-zoom.js.map +1 -0
- package/elements/checkbox.d.ts +20 -0
- package/elements/checkbox.d.ts.map +1 -0
- package/elements/checkbox.js +108 -0
- package/elements/checkbox.js.map +1 -0
- package/elements/coach-mark.d.ts +39 -0
- package/elements/coach-mark.d.ts.map +1 -0
- package/elements/coach-mark.js +212 -0
- package/elements/coach-mark.js.map +1 -0
- package/elements/code-block.d.ts +14 -0
- package/elements/code-block.d.ts.map +1 -0
- package/elements/code-block.js +427 -0
- package/elements/code-block.js.map +1 -0
- package/elements/collapse.d.ts +22 -0
- package/elements/collapse.d.ts.map +1 -0
- package/elements/collapse.js +111 -0
- package/elements/collapse.js.map +1 -0
- package/elements/color-panel.d.ts +30 -0
- package/elements/color-panel.d.ts.map +1 -0
- package/elements/color-panel.js +383 -0
- package/elements/color-panel.js.map +1 -0
- package/elements/color-pick.d.ts +14 -0
- package/elements/color-pick.d.ts.map +1 -0
- package/elements/color-pick.js +81 -0
- package/elements/color-pick.js.map +1 -0
- package/elements/compartment.d.ts +9 -0
- package/elements/compartment.d.ts.map +1 -0
- package/elements/compartment.js +32 -0
- package/elements/compartment.js.map +1 -0
- package/elements/copy.d.ts +20 -0
- package/elements/copy.d.ts.map +1 -0
- package/elements/copy.js +160 -0
- package/elements/copy.js.map +1 -0
- package/elements/date-panel.d.ts +29 -0
- package/elements/date-panel.d.ts.map +1 -0
- package/elements/date-panel.js +220 -0
- package/elements/date-panel.js.map +1 -0
- package/elements/date-pick.d.ts +23 -0
- package/elements/date-pick.d.ts.map +1 -0
- package/elements/date-pick.js +107 -0
- package/elements/date-pick.js.map +1 -0
- package/elements/date-range-panel.d.ts +28 -0
- package/elements/date-range-panel.d.ts.map +1 -0
- package/elements/date-range-panel.js +154 -0
- package/elements/date-range-panel.js.map +1 -0
- package/elements/date-range-pick.d.ts +26 -0
- package/elements/date-range-pick.d.ts.map +1 -0
- package/elements/date-range-pick.js +159 -0
- package/elements/date-range-pick.js.map +1 -0
- package/elements/divider.d.ts +15 -0
- package/elements/divider.d.ts.map +1 -0
- package/elements/divider.js +95 -0
- package/elements/divider.js.map +1 -0
- package/elements/donut-chart.d.ts +19 -0
- package/elements/donut-chart.d.ts.map +1 -0
- package/elements/donut-chart.js +140 -0
- package/elements/donut-chart.js.map +1 -0
- package/elements/drawer.d.ts +9 -0
- package/elements/drawer.d.ts.map +1 -0
- package/elements/drawer.js +45 -0
- package/elements/drawer.js.map +1 -0
- package/elements/drop-area.d.ts +18 -0
- package/elements/drop-area.d.ts.map +1 -0
- package/elements/drop-area.js +155 -0
- package/elements/drop-area.js.map +1 -0
- package/elements/empty.d.ts +8 -0
- package/elements/empty.d.ts.map +1 -0
- package/elements/empty.js +33 -0
- package/elements/empty.js.map +1 -0
- package/elements/file-pick.d.ts +28 -0
- package/elements/file-pick.d.ts.map +1 -0
- package/elements/file-pick.js +226 -0
- package/elements/file-pick.js.map +1 -0
- package/elements/form.d.ts +76 -0
- package/elements/form.d.ts.map +1 -0
- package/elements/form.js +372 -0
- package/elements/form.js.map +1 -0
- package/elements/heading.d.ts +13 -0
- package/elements/heading.d.ts.map +1 -0
- package/elements/heading.js +88 -0
- package/elements/heading.js.map +1 -0
- package/elements/help-text.d.ts +11 -0
- package/elements/help-text.d.ts.map +1 -0
- package/elements/help-text.js +53 -0
- package/elements/help-text.js.map +1 -0
- package/elements/icons.d.ts +10 -0
- package/elements/icons.d.ts.map +1 -0
- package/elements/icons.js +71 -0
- package/elements/icons.js.map +1 -0
- package/elements/image-preview.d.ts +26 -0
- package/elements/image-preview.d.ts.map +1 -0
- package/elements/image-preview.js +172 -0
- package/elements/image-preview.js.map +1 -0
- package/elements/input-capture.d.ts +17 -0
- package/elements/input-capture.d.ts.map +1 -0
- package/elements/input-capture.js +111 -0
- package/elements/input-capture.js.map +1 -0
- package/elements/input.d.ts +51 -0
- package/elements/input.d.ts.map +1 -0
- package/elements/input.js +372 -0
- package/elements/input.js.map +1 -0
- package/elements/keyboard-access.d.ts +26 -0
- package/elements/keyboard-access.d.ts.map +1 -0
- package/elements/keyboard-access.js +217 -0
- package/elements/keyboard-access.js.map +1 -0
- package/elements/legend.d.ts +21 -0
- package/elements/legend.d.ts.map +1 -0
- package/elements/legend.js +118 -0
- package/elements/legend.js.map +1 -0
- package/elements/line-chart.d.ts +9 -0
- package/elements/line-chart.d.ts.map +1 -0
- package/elements/line-chart.js +116 -0
- package/elements/line-chart.js.map +1 -0
- package/elements/link.d.ts +14 -0
- package/elements/link.d.ts.map +1 -0
- package/elements/link.js +46 -0
- package/elements/link.js.map +1 -0
- package/elements/list.d.ts +30 -0
- package/elements/list.d.ts.map +1 -0
- package/elements/list.js +114 -0
- package/elements/list.js.map +1 -0
- package/elements/loading.d.ts +9 -0
- package/elements/loading.d.ts.map +1 -0
- package/elements/loading.js +44 -0
- package/elements/loading.js.map +1 -0
- package/elements/map.d.ts +68 -0
- package/elements/map.d.ts.map +1 -0
- package/elements/map.js +323 -0
- package/elements/map.js.map +1 -0
- package/elements/menu.d.ts +58 -0
- package/elements/menu.d.ts.map +1 -0
- package/elements/menu.js +256 -0
- package/elements/menu.js.map +1 -0
- package/elements/meter.d.ts +20 -0
- package/elements/meter.d.ts.map +1 -0
- package/elements/meter.js +130 -0
- package/elements/meter.js.map +1 -0
- package/elements/modal.d.ts +46 -0
- package/elements/modal.d.ts.map +1 -0
- package/elements/modal.js +296 -0
- package/elements/modal.js.map +1 -0
- package/elements/more.d.ts +28 -0
- package/elements/more.d.ts.map +1 -0
- package/elements/more.js +118 -0
- package/elements/more.js.map +1 -0
- package/elements/options.d.ts +34 -0
- package/elements/options.d.ts.map +1 -0
- package/elements/options.js +174 -0
- package/elements/options.js.map +1 -0
- package/elements/page-loadbar.d.ts +20 -0
- package/elements/page-loadbar.d.ts.map +1 -0
- package/elements/page-loadbar.js +85 -0
- package/elements/page-loadbar.js.map +1 -0
- package/elements/pagination.d.ts +23 -0
- package/elements/pagination.d.ts.map +1 -0
- package/elements/pagination.js +221 -0
- package/elements/pagination.js.map +1 -0
- package/elements/paragraph.d.ts +8 -0
- package/elements/paragraph.d.ts.map +1 -0
- package/elements/paragraph.js +60 -0
- package/elements/paragraph.js.map +1 -0
- package/elements/pick.d.ts +34 -0
- package/elements/pick.d.ts.map +1 -0
- package/elements/pick.js +168 -0
- package/elements/pick.js.map +1 -0
- package/elements/placeholder.d.ts +23 -0
- package/elements/placeholder.d.ts.map +1 -0
- package/elements/placeholder.js +93 -0
- package/elements/placeholder.js.map +1 -0
- package/elements/popover.d.ts +54 -0
- package/elements/popover.d.ts.map +1 -0
- package/elements/popover.js +316 -0
- package/elements/popover.js.map +1 -0
- package/elements/progress.d.ts +12 -0
- package/elements/progress.d.ts.map +1 -0
- package/elements/progress.js +45 -0
- package/elements/progress.js.map +1 -0
- package/elements/radio.d.ts +34 -0
- package/elements/radio.d.ts.map +1 -0
- package/elements/radio.js +152 -0
- package/elements/radio.js.map +1 -0
- package/elements/rating.d.ts +15 -0
- package/elements/rating.d.ts.map +1 -0
- package/elements/rating.js +122 -0
- package/elements/rating.js.map +1 -0
- package/elements/scatter-chart.d.ts +13 -0
- package/elements/scatter-chart.d.ts.map +1 -0
- package/elements/scatter-chart.js +151 -0
- package/elements/scatter-chart.js.map +1 -0
- package/elements/select.d.ts +63 -0
- package/elements/select.d.ts.map +1 -0
- package/elements/select.js +416 -0
- package/elements/select.js.map +1 -0
- package/elements/shortcut-record.d.ts +19 -0
- package/elements/shortcut-record.d.ts.map +1 -0
- package/elements/shortcut-record.js +127 -0
- package/elements/shortcut-record.js.map +1 -0
- package/elements/side-navigation.d.ts +31 -0
- package/elements/side-navigation.d.ts.map +1 -0
- package/elements/side-navigation.js +137 -0
- package/elements/side-navigation.js.map +1 -0
- package/elements/slider.d.ts +27 -0
- package/elements/slider.d.ts.map +1 -0
- package/elements/slider.js +219 -0
- package/elements/slider.js.map +1 -0
- package/elements/space.d.ts +10 -0
- package/elements/space.d.ts.map +1 -0
- package/elements/space.js +35 -0
- package/elements/space.js.map +1 -0
- package/elements/statistic.d.ts +24 -0
- package/elements/statistic.d.ts.map +1 -0
- package/elements/statistic.js +116 -0
- package/elements/statistic.js.map +1 -0
- package/elements/status-light.d.ts +14 -0
- package/elements/status-light.d.ts.map +1 -0
- package/elements/status-light.js +75 -0
- package/elements/status-light.js.map +1 -0
- package/elements/switch.d.ts +18 -0
- package/elements/switch.d.ts.map +1 -0
- package/elements/switch.js +117 -0
- package/elements/switch.js.map +1 -0
- package/elements/table.d.ts +36 -0
- package/elements/table.d.ts.map +1 -0
- package/elements/table.js +268 -0
- package/elements/table.js.map +1 -0
- package/elements/tabs.d.ts +29 -0
- package/elements/tabs.d.ts.map +1 -0
- package/elements/tabs.js +130 -0
- package/elements/tabs.js.map +1 -0
- package/elements/tag.d.ts +20 -0
- package/elements/tag.d.ts.map +1 -0
- package/elements/tag.js +120 -0
- package/elements/tag.js.map +1 -0
- package/elements/timeline.d.ts +19 -0
- package/elements/timeline.d.ts.map +1 -0
- package/elements/timeline.js +92 -0
- package/elements/timeline.js.map +1 -0
- package/elements/toast.d.ts +26 -0
- package/elements/toast.d.ts.map +1 -0
- package/elements/toast.js +149 -0
- package/elements/toast.js.map +1 -0
- package/elements/tooltip.d.ts +12 -0
- package/elements/tooltip.d.ts.map +1 -0
- package/elements/tooltip.js +27 -0
- package/elements/tooltip.js.map +1 -0
- package/elements/tree.d.ts +48 -0
- package/elements/tree.d.ts.map +1 -0
- package/elements/tree.js +231 -0
- package/elements/tree.js.map +1 -0
- package/elements/wait.d.ts +19 -0
- package/elements/wait.d.ts.map +1 -0
- package/elements/wait.js +97 -0
- package/elements/wait.js.map +1 -0
- package/lib/animations.d.ts +4 -0
- package/lib/animations.d.ts.map +1 -0
- package/lib/animations.js +8 -0
- package/lib/animations.js.map +1 -0
- package/lib/cache.d.ts +12 -0
- package/lib/cache.d.ts.map +1 -0
- package/lib/cache.js +56 -0
- package/lib/cache.js.map +1 -0
- package/lib/color.d.ts +37 -0
- package/lib/color.d.ts.map +1 -0
- package/lib/color.js +101 -0
- package/lib/color.js.map +1 -0
- package/lib/hotkeys.d.ts +31 -0
- package/lib/hotkeys.d.ts.map +1 -0
- package/lib/hotkeys.js +207 -0
- package/lib/hotkeys.js.map +1 -0
- package/lib/icons.d.ts +90 -0
- package/lib/icons.d.ts.map +1 -0
- package/lib/icons.js +81 -0
- package/lib/icons.js.map +1 -0
- package/lib/image.d.ts +29 -0
- package/lib/image.d.ts.map +1 -0
- package/lib/image.js +140 -0
- package/lib/image.js.map +1 -0
- package/lib/locale.d.ts +37 -0
- package/lib/locale.d.ts.map +1 -0
- package/lib/locale.js +14 -0
- package/lib/locale.js.map +1 -0
- package/lib/number.d.ts +80 -0
- package/lib/number.d.ts.map +1 -0
- package/lib/number.js +144 -0
- package/lib/number.js.map +1 -0
- package/lib/theme.d.ts +67 -0
- package/lib/theme.d.ts.map +1 -0
- package/lib/theme.js +56 -0
- package/lib/theme.js.map +1 -0
- package/lib/time.d.ts +58 -0
- package/lib/time.d.ts.map +1 -0
- package/lib/time.js +225 -0
- package/lib/time.js.map +1 -0
- package/lib/types.d.ts +8 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +17 -0
- package/lib/types.js.map +1 -0
- package/lib/utils.d.ts +37 -0
- package/lib/utils.d.ts.map +1 -0
- package/lib/utils.js +249 -0
- package/lib/utils.js.map +1 -0
- package/locales/en.d.ts +34 -0
- package/locales/en.d.ts.map +1 -0
- package/locales/en.js +33 -0
- package/locales/en.js.map +1 -0
- package/locales/zh.d.ts +4 -0
- package/locales/zh.d.ts.map +1 -0
- package/locales/zh.js +34 -0
- package/locales/zh.js.map +1 -0
- package/package.json +39 -0
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
13
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
14
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
15
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
16
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
17
|
+
};
|
|
18
|
+
var _DuoyunColorPanelElement_r, _DuoyunColorPanelElement_g, _DuoyunColorPanelElement_b, _DuoyunColorPanelElement_h, _DuoyunColorPanelElement_s, _DuoyunColorPanelElement_l, _DuoyunColorPanelElement_a, _DuoyunColorPanelElement_sa, _DuoyunColorPanelElement_v, _DuoyunColorPanelElement_value, _DuoyunColorPanelElement_typeOptions, _DuoyunColorPanelElement_getColor, _DuoyunColorPanelElement_getPosition, _DuoyunColorPanelElement_setRgb, _DuoyunColorPanelElement_onPanHue, _DuoyunColorPanelElement_onPanSV, _DuoyunColorPanelElement_onPanA, _DuoyunColorPanelElement_onChangeType, _DuoyunColorPanelElement_onChangeValue, _DuoyunColorPanelElement_onChangeA, _DuoyunColorPanelElement_onChange, _DuoyunColorPanelElement_openEyeDropper, _DuoyunColorPanelElement_init;
|
|
19
|
+
// https://spectrum.adobe.com/page/color-area/
|
|
20
|
+
import { GemElement, html, adoptedStyle, createCSSSheet, css, customElement, attribute, globalemitter, styleMap, classMap, boolattribute, } from '@mantou/gem';
|
|
21
|
+
import { parseHexColor, rgbToHexColor, rgbToHslColor, rgbToRgbColor, hslToRgb, rgbToHsl, hslToHsv, hsvToHsl, isValidHexColor, } from '../lib/color';
|
|
22
|
+
import { theme } from '../lib/theme';
|
|
23
|
+
import { icons } from '../lib/icons';
|
|
24
|
+
import { clamp, formatToPrecision } from '../lib/number';
|
|
25
|
+
import '@mantou/gem/elements/gesture';
|
|
26
|
+
import '@mantou/gem/elements/use';
|
|
27
|
+
import './input';
|
|
28
|
+
import './select';
|
|
29
|
+
const style = createCSSSheet(css `
|
|
30
|
+
:host {
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
gap: 1em;
|
|
34
|
+
width: 20em;
|
|
35
|
+
font-size: 0.875em;
|
|
36
|
+
--hsl: hsl(var(--h), var(--s), var(--l));
|
|
37
|
+
--hue: hsl(var(--h), 100%, 50%);
|
|
38
|
+
--alpha: linear-gradient(var(--hue), transparent),
|
|
39
|
+
conic-gradient(transparent 0.25turn, #d3cfcf 0.25turn 0.5turn, transparent 0.5turn 0.75turn, #d3cfcf 0.75turn) top
|
|
40
|
+
left / 1.2em 1.2em repeat;
|
|
41
|
+
}
|
|
42
|
+
.color {
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: stretch;
|
|
45
|
+
gap: 1em;
|
|
46
|
+
}
|
|
47
|
+
.area {
|
|
48
|
+
flex-grow: 1;
|
|
49
|
+
aspect-ratio: 1 / 1;
|
|
50
|
+
background-color: var(--hue);
|
|
51
|
+
background-image: linear-gradient(transparent, #000), linear-gradient(90deg, #fff, transparent);
|
|
52
|
+
}
|
|
53
|
+
.hue-bar,
|
|
54
|
+
.alpha-bar {
|
|
55
|
+
width: 1.8em;
|
|
56
|
+
}
|
|
57
|
+
.hue-bar {
|
|
58
|
+
background-image: linear-gradient(
|
|
59
|
+
${Array.from({ length: 15 }, (_, i) => `hsl(${360 - (360 / (15 - 1)) * i}, 100%, 50%)`).join(',')}
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
.alpha-bar {
|
|
63
|
+
background: var(--alpha);
|
|
64
|
+
}
|
|
65
|
+
.area,
|
|
66
|
+
.hue-bar,
|
|
67
|
+
.alpha-bar {
|
|
68
|
+
position: relative;
|
|
69
|
+
border-radius: ${theme.normalRound};
|
|
70
|
+
box-shadow: inset 0 0 0 1px #0002;
|
|
71
|
+
}
|
|
72
|
+
.current {
|
|
73
|
+
transition: transform 0.1s;
|
|
74
|
+
background: radial-gradient(transparent 50%, white 50%);
|
|
75
|
+
}
|
|
76
|
+
.current.grabbing {
|
|
77
|
+
transform: translate(-50%, -50%) scale(1.3);
|
|
78
|
+
}
|
|
79
|
+
.current,
|
|
80
|
+
.current span {
|
|
81
|
+
position: absolute;
|
|
82
|
+
width: 1.2em;
|
|
83
|
+
aspect-ratio: 1;
|
|
84
|
+
border-radius: 10em;
|
|
85
|
+
border: 1px solid #0008;
|
|
86
|
+
transform: translate(-50%, -50%);
|
|
87
|
+
}
|
|
88
|
+
.current span {
|
|
89
|
+
left: 50%;
|
|
90
|
+
top: 50%;
|
|
91
|
+
width: 66%;
|
|
92
|
+
background-clip: content-box;
|
|
93
|
+
}
|
|
94
|
+
.area .current span {
|
|
95
|
+
background-color: var(--hsl);
|
|
96
|
+
}
|
|
97
|
+
.hue-bar .current span {
|
|
98
|
+
background-color: var(--hue);
|
|
99
|
+
}
|
|
100
|
+
.alpha-bar .current span {
|
|
101
|
+
background-color: transparent;
|
|
102
|
+
}
|
|
103
|
+
.input {
|
|
104
|
+
display: flex;
|
|
105
|
+
align-items: center;
|
|
106
|
+
gap: 0.5em;
|
|
107
|
+
}
|
|
108
|
+
.type {
|
|
109
|
+
width: 5em;
|
|
110
|
+
flex-shrink: 0;
|
|
111
|
+
}
|
|
112
|
+
.value,
|
|
113
|
+
.alpha {
|
|
114
|
+
border-radius: 0;
|
|
115
|
+
border-top-color: transparent;
|
|
116
|
+
border-inline: none;
|
|
117
|
+
}
|
|
118
|
+
:where(.value, .alpha)::part(input) {
|
|
119
|
+
padding-inline: 0;
|
|
120
|
+
}
|
|
121
|
+
.value {
|
|
122
|
+
width: auto;
|
|
123
|
+
flex-shrink: 1;
|
|
124
|
+
}
|
|
125
|
+
.alpha {
|
|
126
|
+
width: 3em;
|
|
127
|
+
margin-inline-end: 2em;
|
|
128
|
+
}
|
|
129
|
+
.hidden {
|
|
130
|
+
pointer-events: none;
|
|
131
|
+
opacity: 0;
|
|
132
|
+
}
|
|
133
|
+
.colorize {
|
|
134
|
+
padding: 0.15em;
|
|
135
|
+
width: 1.5em;
|
|
136
|
+
flex-shrink: 0;
|
|
137
|
+
border-radius: ${theme.normalRound};
|
|
138
|
+
}
|
|
139
|
+
.colorize:hover {
|
|
140
|
+
background: ${theme.lightBackgroundColor};
|
|
141
|
+
}
|
|
142
|
+
`);
|
|
143
|
+
/**
|
|
144
|
+
* @customElement dy-color-panel
|
|
145
|
+
* @attr value
|
|
146
|
+
* @attr alpha
|
|
147
|
+
*/
|
|
148
|
+
let DuoyunColorPanelElement = class DuoyunColorPanelElement extends GemElement {
|
|
149
|
+
constructor() {
|
|
150
|
+
super();
|
|
151
|
+
this.state = {
|
|
152
|
+
mode: 'Hex',
|
|
153
|
+
grabbingHue: false,
|
|
154
|
+
grabbingA: false,
|
|
155
|
+
grabbingSV: false,
|
|
156
|
+
};
|
|
157
|
+
// stringify
|
|
158
|
+
_DuoyunColorPanelElement_r.set(this, 0);
|
|
159
|
+
_DuoyunColorPanelElement_g.set(this, 0);
|
|
160
|
+
_DuoyunColorPanelElement_b.set(this, 0);
|
|
161
|
+
_DuoyunColorPanelElement_h.set(this, 0);
|
|
162
|
+
_DuoyunColorPanelElement_s.set(this, 0);
|
|
163
|
+
_DuoyunColorPanelElement_l.set(this, 0);
|
|
164
|
+
_DuoyunColorPanelElement_a.set(this, 0);
|
|
165
|
+
// hsv
|
|
166
|
+
_DuoyunColorPanelElement_sa.set(this, 0);
|
|
167
|
+
_DuoyunColorPanelElement_v.set(this, 0);
|
|
168
|
+
// without alpha
|
|
169
|
+
_DuoyunColorPanelElement_value.set(this, '');
|
|
170
|
+
_DuoyunColorPanelElement_typeOptions.set(this, [
|
|
171
|
+
{
|
|
172
|
+
label: 'Hex',
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
label: 'RGB',
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
label: 'HSL',
|
|
179
|
+
},
|
|
180
|
+
]);
|
|
181
|
+
_DuoyunColorPanelElement_getColor.set(this, (mode) => {
|
|
182
|
+
switch (mode) {
|
|
183
|
+
case 'Hex':
|
|
184
|
+
return rgbToHexColor([__classPrivateFieldGet(this, _DuoyunColorPanelElement_r, "f"), __classPrivateFieldGet(this, _DuoyunColorPanelElement_g, "f"), __classPrivateFieldGet(this, _DuoyunColorPanelElement_b, "f")]);
|
|
185
|
+
case 'RGB':
|
|
186
|
+
return rgbToRgbColor([__classPrivateFieldGet(this, _DuoyunColorPanelElement_r, "f"), __classPrivateFieldGet(this, _DuoyunColorPanelElement_g, "f"), __classPrivateFieldGet(this, _DuoyunColorPanelElement_b, "f")]);
|
|
187
|
+
case 'HSL':
|
|
188
|
+
return rgbToHslColor([__classPrivateFieldGet(this, _DuoyunColorPanelElement_r, "f"), __classPrivateFieldGet(this, _DuoyunColorPanelElement_g, "f"), __classPrivateFieldGet(this, _DuoyunColorPanelElement_b, "f")]);
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
_DuoyunColorPanelElement_getPosition.set(this, (target, { clientX, clientY }) => {
|
|
192
|
+
const { left, top, width, height } = target.getBoundingClientRect();
|
|
193
|
+
return {
|
|
194
|
+
left: clamp(0, clientX - left, width) / width,
|
|
195
|
+
top: clamp(0, clientY - top, height) / height,
|
|
196
|
+
};
|
|
197
|
+
});
|
|
198
|
+
_DuoyunColorPanelElement_setRgb.set(this, () => {
|
|
199
|
+
const [r, g, b] = hslToRgb([__classPrivateFieldGet(this, _DuoyunColorPanelElement_h, "f"), __classPrivateFieldGet(this, _DuoyunColorPanelElement_s, "f"), __classPrivateFieldGet(this, _DuoyunColorPanelElement_l, "f")]);
|
|
200
|
+
__classPrivateFieldSet(this, _DuoyunColorPanelElement_r, r, "f");
|
|
201
|
+
__classPrivateFieldSet(this, _DuoyunColorPanelElement_g, g, "f");
|
|
202
|
+
__classPrivateFieldSet(this, _DuoyunColorPanelElement_b, b, "f");
|
|
203
|
+
__classPrivateFieldSet(this, _DuoyunColorPanelElement_value, __classPrivateFieldGet(this, _DuoyunColorPanelElement_getColor, "f").call(this, 'Hex'), "f");
|
|
204
|
+
});
|
|
205
|
+
_DuoyunColorPanelElement_onPanHue.set(this, ({ detail, target }) => {
|
|
206
|
+
const { top } = __classPrivateFieldGet(this, _DuoyunColorPanelElement_getPosition, "f").call(this, target, detail);
|
|
207
|
+
__classPrivateFieldSet(this, _DuoyunColorPanelElement_h, 1 - top, "f");
|
|
208
|
+
__classPrivateFieldGet(this, _DuoyunColorPanelElement_setRgb, "f").call(this);
|
|
209
|
+
this.setState({ grabbingHue: true });
|
|
210
|
+
});
|
|
211
|
+
_DuoyunColorPanelElement_onPanSV.set(this, ({ detail, target }) => {
|
|
212
|
+
const { left, top } = __classPrivateFieldGet(this, _DuoyunColorPanelElement_getPosition, "f").call(this, target, detail);
|
|
213
|
+
__classPrivateFieldSet(this, _DuoyunColorPanelElement_v, 1 - top, "f");
|
|
214
|
+
__classPrivateFieldSet(this, _DuoyunColorPanelElement_sa, left, "f");
|
|
215
|
+
const [_, s, l] = hsvToHsl([__classPrivateFieldGet(this, _DuoyunColorPanelElement_h, "f"), __classPrivateFieldGet(this, _DuoyunColorPanelElement_sa, "f"), __classPrivateFieldGet(this, _DuoyunColorPanelElement_v, "f")]);
|
|
216
|
+
__classPrivateFieldSet(this, _DuoyunColorPanelElement_s, s, "f");
|
|
217
|
+
__classPrivateFieldSet(this, _DuoyunColorPanelElement_l, l, "f");
|
|
218
|
+
__classPrivateFieldGet(this, _DuoyunColorPanelElement_setRgb, "f").call(this);
|
|
219
|
+
this.setState({ grabbingSV: true });
|
|
220
|
+
});
|
|
221
|
+
_DuoyunColorPanelElement_onPanA.set(this, ({ detail, target }) => {
|
|
222
|
+
const { top } = __classPrivateFieldGet(this, _DuoyunColorPanelElement_getPosition, "f").call(this, target, detail);
|
|
223
|
+
__classPrivateFieldSet(this, _DuoyunColorPanelElement_a, 1 - top, "f");
|
|
224
|
+
this.setState({ grabbingA: true });
|
|
225
|
+
});
|
|
226
|
+
_DuoyunColorPanelElement_onChangeType.set(this, (evt) => {
|
|
227
|
+
evt.stopPropagation();
|
|
228
|
+
this.setState({ mode: evt.detail });
|
|
229
|
+
});
|
|
230
|
+
_DuoyunColorPanelElement_onChangeValue.set(this, (evt) => {
|
|
231
|
+
evt.stopPropagation();
|
|
232
|
+
if (this.state.mode !== 'Hex') {
|
|
233
|
+
this.setState({ mode: 'Hex' });
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
__classPrivateFieldSet(this, _DuoyunColorPanelElement_value, '#' + evt.detail.trim().replace('#', '').replace(/[g-z]/gi, '').toLowerCase(), "f");
|
|
237
|
+
// valid color emit event
|
|
238
|
+
if (isValidHexColor(__classPrivateFieldGet(this, _DuoyunColorPanelElement_value, "f"))) {
|
|
239
|
+
__classPrivateFieldGet(this, _DuoyunColorPanelElement_init, "f").call(this, __classPrivateFieldGet(this, _DuoyunColorPanelElement_value, "f"));
|
|
240
|
+
__classPrivateFieldGet(this, _DuoyunColorPanelElement_onChange, "f").call(this);
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
this.update();
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
_DuoyunColorPanelElement_onChangeA.set(this, (evt) => {
|
|
248
|
+
evt.stopPropagation();
|
|
249
|
+
__classPrivateFieldSet(this, _DuoyunColorPanelElement_a, clamp(0, Number(evt.detail) || 0, 1), "f");
|
|
250
|
+
__classPrivateFieldGet(this, _DuoyunColorPanelElement_onChange, "f").call(this);
|
|
251
|
+
});
|
|
252
|
+
_DuoyunColorPanelElement_onChange.set(this, () => {
|
|
253
|
+
const isShort = __classPrivateFieldGet(this, _DuoyunColorPanelElement_value, "f").length === 4;
|
|
254
|
+
const aStr = Math.round(__classPrivateFieldGet(this, _DuoyunColorPanelElement_a, "f") * 255)
|
|
255
|
+
.toString(16)
|
|
256
|
+
.padStart(2, '0');
|
|
257
|
+
const supportSingle = aStr[0] === aStr[1];
|
|
258
|
+
const useShort = isShort && supportSingle;
|
|
259
|
+
if (!useShort) {
|
|
260
|
+
__classPrivateFieldSet(this, _DuoyunColorPanelElement_value, __classPrivateFieldGet(this, _DuoyunColorPanelElement_getColor, "f").call(this, 'Hex'), "f");
|
|
261
|
+
}
|
|
262
|
+
const color = (this.alpha && __classPrivateFieldGet(this, _DuoyunColorPanelElement_a, "f") !== 1 ? __classPrivateFieldGet(this, _DuoyunColorPanelElement_value, "f") + (useShort ? aStr[0] : aStr) : __classPrivateFieldGet(this, _DuoyunColorPanelElement_value, "f"));
|
|
263
|
+
this.setState({ grabbingHue: false, grabbingSV: false, grabbingA: false });
|
|
264
|
+
this.change(color);
|
|
265
|
+
});
|
|
266
|
+
_DuoyunColorPanelElement_openEyeDropper.set(this, async () => {
|
|
267
|
+
const result = await new window.EyeDropper().open();
|
|
268
|
+
this.change(result.sRGBHex);
|
|
269
|
+
});
|
|
270
|
+
_DuoyunColorPanelElement_init.set(this, (value) => {
|
|
271
|
+
const [r, g, b, a] = parseHexColor(value);
|
|
272
|
+
const [h, s, l] = rgbToHsl([r, g, b]);
|
|
273
|
+
const [_, sa, v] = hslToHsv([h, s, l]);
|
|
274
|
+
__classPrivateFieldSet(this, _DuoyunColorPanelElement_r, r, "f");
|
|
275
|
+
__classPrivateFieldSet(this, _DuoyunColorPanelElement_g, g, "f");
|
|
276
|
+
__classPrivateFieldSet(this, _DuoyunColorPanelElement_b, b, "f");
|
|
277
|
+
__classPrivateFieldSet(this, _DuoyunColorPanelElement_a, a, "f");
|
|
278
|
+
if (v !== 0 && sa !== 0) {
|
|
279
|
+
__classPrivateFieldSet(this, _DuoyunColorPanelElement_h, h, "f");
|
|
280
|
+
}
|
|
281
|
+
__classPrivateFieldSet(this, _DuoyunColorPanelElement_s, s, "f");
|
|
282
|
+
__classPrivateFieldSet(this, _DuoyunColorPanelElement_l, l, "f");
|
|
283
|
+
if (v !== 0) {
|
|
284
|
+
__classPrivateFieldSet(this, _DuoyunColorPanelElement_sa, sa, "f");
|
|
285
|
+
}
|
|
286
|
+
__classPrivateFieldSet(this, _DuoyunColorPanelElement_v, v, "f");
|
|
287
|
+
__classPrivateFieldSet(this, _DuoyunColorPanelElement_value, value.length === 5 ? value.slice(0, 4) : value.length === 9 ? value.slice(0, 7) : value, "f");
|
|
288
|
+
});
|
|
289
|
+
this.willMount = () => {
|
|
290
|
+
this.memo(() => __classPrivateFieldGet(this, _DuoyunColorPanelElement_init, "f").call(this, this.value || '#fff'), () => [this.value]);
|
|
291
|
+
};
|
|
292
|
+
this.render = () => {
|
|
293
|
+
const { mode, grabbingHue, grabbingSV, grabbingA } = this.state;
|
|
294
|
+
return html `
|
|
295
|
+
<style>
|
|
296
|
+
:host {
|
|
297
|
+
--h: ${__classPrivateFieldGet(this, _DuoyunColorPanelElement_h, "f") * 360};
|
|
298
|
+
--s: ${__classPrivateFieldGet(this, _DuoyunColorPanelElement_s, "f") * 100}%;
|
|
299
|
+
--l: ${__classPrivateFieldGet(this, _DuoyunColorPanelElement_l, "f") * 100}%;
|
|
300
|
+
--a: ${__classPrivateFieldGet(this, _DuoyunColorPanelElement_a, "f")};
|
|
301
|
+
}
|
|
302
|
+
</style>
|
|
303
|
+
<div class="color">
|
|
304
|
+
<gem-gesture class="area" @pan=${__classPrivateFieldGet(this, _DuoyunColorPanelElement_onPanSV, "f")} @end=${__classPrivateFieldGet(this, _DuoyunColorPanelElement_onChange, "f")}>
|
|
305
|
+
<div
|
|
306
|
+
class=${classMap({ current: true, grabbing: grabbingSV })}
|
|
307
|
+
style=${styleMap({ left: `${__classPrivateFieldGet(this, _DuoyunColorPanelElement_sa, "f") * 100}%`, top: `${(1 - __classPrivateFieldGet(this, _DuoyunColorPanelElement_v, "f")) * 100}%` })}
|
|
308
|
+
>
|
|
309
|
+
<span></span>
|
|
310
|
+
</div>
|
|
311
|
+
</gem-gesture>
|
|
312
|
+
<gem-gesture class="hue-bar" @pan=${__classPrivateFieldGet(this, _DuoyunColorPanelElement_onPanHue, "f")} @end=${__classPrivateFieldGet(this, _DuoyunColorPanelElement_onChange, "f")}>
|
|
313
|
+
<div
|
|
314
|
+
class=${classMap({ current: true, grabbing: grabbingHue })}
|
|
315
|
+
style=${styleMap({ top: `${(1 - __classPrivateFieldGet(this, _DuoyunColorPanelElement_h, "f")) * 100}%`, left: '50%' })}
|
|
316
|
+
>
|
|
317
|
+
<span></span>
|
|
318
|
+
</div>
|
|
319
|
+
</gem-gesture>
|
|
320
|
+
${this.alpha
|
|
321
|
+
? html `
|
|
322
|
+
<gem-gesture class="alpha-bar" @pan=${__classPrivateFieldGet(this, _DuoyunColorPanelElement_onPanA, "f")} @end=${__classPrivateFieldGet(this, _DuoyunColorPanelElement_onChange, "f")}>
|
|
323
|
+
<div
|
|
324
|
+
class=${classMap({ current: true, grabbing: grabbingA })}
|
|
325
|
+
style=${styleMap({ top: `${(1 - __classPrivateFieldGet(this, _DuoyunColorPanelElement_a, "f")) * 100}%`, left: '50%' })}
|
|
326
|
+
>
|
|
327
|
+
<span></span>
|
|
328
|
+
</div>
|
|
329
|
+
</gem-gesture>
|
|
330
|
+
`
|
|
331
|
+
: ''}
|
|
332
|
+
</div>
|
|
333
|
+
<div class="input">
|
|
334
|
+
<dy-select
|
|
335
|
+
class="type"
|
|
336
|
+
?borderless=${true}
|
|
337
|
+
.options=${__classPrivateFieldGet(this, _DuoyunColorPanelElement_typeOptions, "f")}
|
|
338
|
+
.value=${mode}
|
|
339
|
+
.dropdownStyle=${{ fontSize: '0.75em' }}
|
|
340
|
+
@change=${__classPrivateFieldGet(this, _DuoyunColorPanelElement_onChangeType, "f")}
|
|
341
|
+
></dy-select>
|
|
342
|
+
<dy-input
|
|
343
|
+
class="value"
|
|
344
|
+
value=${mode === 'Hex' ? __classPrivateFieldGet(this, _DuoyunColorPanelElement_value, "f") : __classPrivateFieldGet(this, _DuoyunColorPanelElement_getColor, "f").call(this, mode)}
|
|
345
|
+
@change=${__classPrivateFieldGet(this, _DuoyunColorPanelElement_onChangeValue, "f")}
|
|
346
|
+
></dy-input>
|
|
347
|
+
<dy-input
|
|
348
|
+
class=${classMap({ alpha: true, hidden: !this.alpha })}
|
|
349
|
+
aria-hidden=${!this.alpha}
|
|
350
|
+
type="number"
|
|
351
|
+
value=${String(formatToPrecision(__classPrivateFieldGet(this, _DuoyunColorPanelElement_a, "f")))}
|
|
352
|
+
step=${0.1}
|
|
353
|
+
@change=${__classPrivateFieldGet(this, _DuoyunColorPanelElement_onChangeA, "f")}
|
|
354
|
+
></dy-input>
|
|
355
|
+
<gem-use
|
|
356
|
+
role="button"
|
|
357
|
+
aria-hidden=${!('EyeDropper' in window)}
|
|
358
|
+
class=${classMap({ colorize: true, hidden: !('EyeDropper' in window) })}
|
|
359
|
+
.element=${icons.colorize}
|
|
360
|
+
@click=${__classPrivateFieldGet(this, _DuoyunColorPanelElement_openEyeDropper, "f")}
|
|
361
|
+
></gem-use>
|
|
362
|
+
</div>
|
|
363
|
+
`;
|
|
364
|
+
};
|
|
365
|
+
this.internals.role = 'widget';
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
_DuoyunColorPanelElement_r = new WeakMap(), _DuoyunColorPanelElement_g = new WeakMap(), _DuoyunColorPanelElement_b = new WeakMap(), _DuoyunColorPanelElement_h = new WeakMap(), _DuoyunColorPanelElement_s = new WeakMap(), _DuoyunColorPanelElement_l = new WeakMap(), _DuoyunColorPanelElement_a = new WeakMap(), _DuoyunColorPanelElement_sa = new WeakMap(), _DuoyunColorPanelElement_v = new WeakMap(), _DuoyunColorPanelElement_value = new WeakMap(), _DuoyunColorPanelElement_typeOptions = new WeakMap(), _DuoyunColorPanelElement_getColor = new WeakMap(), _DuoyunColorPanelElement_getPosition = new WeakMap(), _DuoyunColorPanelElement_setRgb = new WeakMap(), _DuoyunColorPanelElement_onPanHue = new WeakMap(), _DuoyunColorPanelElement_onPanSV = new WeakMap(), _DuoyunColorPanelElement_onPanA = new WeakMap(), _DuoyunColorPanelElement_onChangeType = new WeakMap(), _DuoyunColorPanelElement_onChangeValue = new WeakMap(), _DuoyunColorPanelElement_onChangeA = new WeakMap(), _DuoyunColorPanelElement_onChange = new WeakMap(), _DuoyunColorPanelElement_openEyeDropper = new WeakMap(), _DuoyunColorPanelElement_init = new WeakMap();
|
|
369
|
+
__decorate([
|
|
370
|
+
attribute
|
|
371
|
+
], DuoyunColorPanelElement.prototype, "value", void 0);
|
|
372
|
+
__decorate([
|
|
373
|
+
boolattribute
|
|
374
|
+
], DuoyunColorPanelElement.prototype, "alpha", void 0);
|
|
375
|
+
__decorate([
|
|
376
|
+
globalemitter
|
|
377
|
+
], DuoyunColorPanelElement.prototype, "change", void 0);
|
|
378
|
+
DuoyunColorPanelElement = __decorate([
|
|
379
|
+
customElement('dy-color-panel'),
|
|
380
|
+
adoptedStyle(style)
|
|
381
|
+
], DuoyunColorPanelElement);
|
|
382
|
+
export { DuoyunColorPanelElement };
|
|
383
|
+
//# sourceMappingURL=color-panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-panel.js","sourceRoot":"","sources":["../src/elements/color-panel.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,8CAA8C;AAC9C,OAAO,EACL,UAAU,EACV,IAAI,EACJ,YAAY,EACZ,cAAc,EACd,GAAG,EACH,aAAa,EACb,SAAS,EACT,aAAa,EAEb,QAAQ,EACR,QAAQ,EACR,aAAa,GACd,MAAM,aAAa,CAAC;AAGrB,OAAO,EAEL,aAAa,EACb,aAAa,EACb,aAAa,EACb,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,eAAe,GAChB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACr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QACJ,CAAC,CAAC;QA3OA,IAAI,CAAC,SAAS,CAAC,IAAI,GAAG,QAAQ,CAAC;IACjC,CAAC;CA2OF,CAAA;;AAnPY;IAAV,SAAS;sDAAiB;AACZ;IAAd,aAAa;sDAAgB;AAEf;IAAd,aAAa;uDAA2B;AAJ9B,uBAAuB;IAFnC,aAAa,CAAC,gBAAgB,CAAC;IAC/B,YAAY,CAAC,KAAK,CAAC;GACP,uBAAuB,CAoPnC;SApPY,uBAAuB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { GemElement, Emitter } from '@mantou/gem';
|
|
2
|
+
import { HexColor } from '../lib/color';
|
|
3
|
+
import './popover';
|
|
4
|
+
import './color-panel';
|
|
5
|
+
/**
|
|
6
|
+
* @customElement dy-color-pick
|
|
7
|
+
*/
|
|
8
|
+
export declare class DuoyunColorPickElement extends GemElement {
|
|
9
|
+
value: HexColor;
|
|
10
|
+
alpha: boolean;
|
|
11
|
+
change: Emitter<HexColor>;
|
|
12
|
+
render: () => import("@mantou/gem").TemplateResult;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=color-pick.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-pick.d.ts","sourceRoot":"","sources":["../src/elements/color-pick.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EAQV,OAAO,EAGR,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAIxC,OAAO,WAAW,CAAC;AACnB,OAAO,eAAe,CAAC;AA0BvB;;GAEG;AACH,qBAEa,sBAAuB,SAAQ,UAAU;IACzC,KAAK,EAAE,QAAQ,CAAC;IACZ,KAAK,EAAE,OAAO,CAAC;IAEf,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAEzC,MAAM,6CAsBJ;CACH"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
// https://spectrum.adobe.com/page/color-area/
|
|
8
|
+
import { GemElement, html, adoptedStyle, createCSSSheet, css, customElement, attribute, globalemitter, styleMap, boolattribute, } from '@mantou/gem';
|
|
9
|
+
import { theme } from '../lib/theme';
|
|
10
|
+
import { commonHandle } from '../lib/hotkeys';
|
|
11
|
+
import './popover';
|
|
12
|
+
import './color-panel';
|
|
13
|
+
const style = createCSSSheet(css `
|
|
14
|
+
:host {
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
display: inline-flex;
|
|
17
|
+
font-size: 0.875em;
|
|
18
|
+
width: 4em;
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
border-radius: ${theme.normalRound};
|
|
21
|
+
background: conic-gradient(
|
|
22
|
+
transparent 0.25turn,
|
|
23
|
+
#d3cfcf 0.25turn 0.5turn,
|
|
24
|
+
transparent 0.5turn 0.75turn,
|
|
25
|
+
#d3cfcf 0.75turn
|
|
26
|
+
)
|
|
27
|
+
top left / 1.2em 1.2em repeat;
|
|
28
|
+
}
|
|
29
|
+
.picker {
|
|
30
|
+
width: 100%;
|
|
31
|
+
height: calc(2.2em + 2px);
|
|
32
|
+
border-radius: ${theme.normalRound};
|
|
33
|
+
box-shadow: inset 0 0 0 1px #0002;
|
|
34
|
+
}
|
|
35
|
+
`);
|
|
36
|
+
/**
|
|
37
|
+
* @customElement dy-color-pick
|
|
38
|
+
*/
|
|
39
|
+
let DuoyunColorPickElement = class DuoyunColorPickElement extends GemElement {
|
|
40
|
+
constructor() {
|
|
41
|
+
super(...arguments);
|
|
42
|
+
this.render = () => {
|
|
43
|
+
return html `
|
|
44
|
+
<dy-popover
|
|
45
|
+
trigger="click"
|
|
46
|
+
.content=${html `
|
|
47
|
+
<dy-color-panel
|
|
48
|
+
style=${styleMap({ marginBlock: '.6em' })}
|
|
49
|
+
value=${this.value}
|
|
50
|
+
?alpha=${this.alpha}
|
|
51
|
+
@change=${({ detail }) => this.change(detail)}
|
|
52
|
+
></dy-color-panel>
|
|
53
|
+
`}
|
|
54
|
+
>
|
|
55
|
+
<div
|
|
56
|
+
role="combobox"
|
|
57
|
+
tabindex="0"
|
|
58
|
+
@keydown=${commonHandle}
|
|
59
|
+
class="picker"
|
|
60
|
+
style=${styleMap({ backgroundColor: this.value })}
|
|
61
|
+
></div>
|
|
62
|
+
</dy-popover>
|
|
63
|
+
`;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
__decorate([
|
|
68
|
+
attribute
|
|
69
|
+
], DuoyunColorPickElement.prototype, "value", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
boolattribute
|
|
72
|
+
], DuoyunColorPickElement.prototype, "alpha", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
globalemitter
|
|
75
|
+
], DuoyunColorPickElement.prototype, "change", void 0);
|
|
76
|
+
DuoyunColorPickElement = __decorate([
|
|
77
|
+
customElement('dy-color-pick'),
|
|
78
|
+
adoptedStyle(style)
|
|
79
|
+
], DuoyunColorPickElement);
|
|
80
|
+
export { DuoyunColorPickElement };
|
|
81
|
+
//# sourceMappingURL=color-pick.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-pick.js","sourceRoot":"","sources":["../src/elements/color-pick.ts"],"names":[],"mappings":";;;;;;AAAA,8CAA8C;AAC9C,OAAO,EACL,UAAU,EACV,IAAI,EACJ,YAAY,EACZ,cAAc,EACd,GAAG,EACH,aAAa,EACb,SAAS,EACT,aAAa,EAEb,QAAQ,EACR,aAAa,GACd,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,WAAW,CAAC;AACnB,OAAO,eAAe,CAAC;AAEvB,MAAM,KAAK,GAAG,cAAc,CAAC,GAAG,CAAA;;;;;;;qBAOX,KAAK,CAAC,WAAW;;;;;;;;;;;;qBAYjB,KAAK,CAAC,WAAW;;;CAGrC,CAAC,CAAC;AAEH;;GAEG;AAGH,IAAa,sBAAsB,GAAnC,MAAa,sBAAuB,SAAQ,UAAU;IAAtD;;QAME,WAAM,GAAG,GAAG,EAAE;YACZ,OAAO,IAAI,CAAA;;;mBAGI,IAAI,CAAA;;oBAEH,QAAQ,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC;oBACjC,IAAI,CAAC,KAAK;qBACT,IAAI,CAAC,KAAK;sBACT,CAAC,EAAE,MAAM,EAAyB,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;;SAEvE;;;;;qBAKY,YAAY;;kBAEf,QAAQ,CAAC,EAAE,eAAe,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;;;KAGtD,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CAAA,CAAA;AA5BY;IAAV,SAAS;qDAAiB;AACZ;IAAd,aAAa;qDAAgB;AAEf;IAAd,aAAa;sDAA2B;AAJ9B,sBAAsB;IAFlC,aAAa,CAAC,eAAe,CAAC;IAC9B,YAAY,CAAC,KAAK,CAAC;GACP,sBAAsB,CA6BlC;SA7BY,sBAAsB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { GemElement, TemplateResult } from '@mantou/gem';
|
|
2
|
+
/**
|
|
3
|
+
* @customElement dy-compartment
|
|
4
|
+
*/
|
|
5
|
+
export declare class DuoyunCompartmentElement extends GemElement {
|
|
6
|
+
content: string | number | TemplateResult;
|
|
7
|
+
render: () => TemplateResult;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=compartment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compartment.d.ts","sourceRoot":"","sources":["../src/elements/compartment.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAOV,cAAc,EACf,MAAM,aAAa,CAAC;AAQrB;;GAEG;AACH,qBAEa,wBAAyB,SAAQ,UAAU;IAC5C,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,cAAc,CAAC;IACpD,MAAM,uBAEJ;CACH"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { GemElement, html, adoptedStyle, createCSSSheet, css, customElement, property, } from '@mantou/gem';
|
|
8
|
+
const style = createCSSSheet(css `
|
|
9
|
+
:host {
|
|
10
|
+
display: contents;
|
|
11
|
+
}
|
|
12
|
+
`);
|
|
13
|
+
/**
|
|
14
|
+
* @customElement dy-compartment
|
|
15
|
+
*/
|
|
16
|
+
let DuoyunCompartmentElement = class DuoyunCompartmentElement extends GemElement {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.render = () => {
|
|
20
|
+
return html `${this.content}`;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
__decorate([
|
|
25
|
+
property
|
|
26
|
+
], DuoyunCompartmentElement.prototype, "content", void 0);
|
|
27
|
+
DuoyunCompartmentElement = __decorate([
|
|
28
|
+
customElement('dy-compartment'),
|
|
29
|
+
adoptedStyle(style)
|
|
30
|
+
], DuoyunCompartmentElement);
|
|
31
|
+
export { DuoyunCompartmentElement };
|
|
32
|
+
//# sourceMappingURL=compartment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compartment.js","sourceRoot":"","sources":["../src/elements/compartment.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,UAAU,EACV,IAAI,EACJ,YAAY,EACZ,cAAc,EACd,GAAG,EACH,aAAa,EACb,QAAQ,GAET,MAAM,aAAa,CAAC;AAErB,MAAM,KAAK,GAAG,cAAc,CAAC,GAAG,CAAA;;;;CAI/B,CAAC,CAAC;AAEH;;GAEG;AAGH,IAAa,wBAAwB,GAArC,MAAa,wBAAyB,SAAQ,UAAU;IAAxD;;QAEE,WAAM,GAAG,GAAG,EAAE;YACZ,OAAO,IAAI,CAAA,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QAC/B,CAAC,CAAC;IACJ,CAAC;CAAA,CAAA;AAJW;IAAT,QAAQ;yDAA2C;AADzC,wBAAwB;IAFpC,aAAa,CAAC,gBAAgB,CAAC;IAC/B,YAAY,CAAC,KAAK,CAAC;GACP,wBAAwB,CAKpC;SALY,wBAAwB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { GemElement } from '@mantou/gem';
|
|
2
|
+
import '@mantou/gem/elements/use';
|
|
3
|
+
import '../elements/tooltip';
|
|
4
|
+
declare type State = {
|
|
5
|
+
status: 'none' | 'success' | 'fail';
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* @customElement dy-copy
|
|
9
|
+
*/
|
|
10
|
+
export declare class DuoyunCopyElement extends GemElement<State> {
|
|
11
|
+
#private;
|
|
12
|
+
silent: boolean;
|
|
13
|
+
block: boolean;
|
|
14
|
+
tooltip: string;
|
|
15
|
+
content?: string;
|
|
16
|
+
state: State;
|
|
17
|
+
render: () => import("@mantou/gem").TemplateResult;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=copy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy.d.ts","sourceRoot":"","sources":["../src/elements/copy.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAUX,MAAM,aAAa,CAAC;AAOrB,OAAO,0BAA0B,CAAC;AAClC,OAAO,qBAAqB,CAAC;AA4D7B,aAAK,KAAK,GAAG;IACX,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;CACrC,CAAC;AAEF;;GAEG;AACH,qBAEa,iBAAkB,SAAQ,UAAU,CAAC,KAAK,CAAC;;IACvC,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAEjB,OAAO,CAAC,EAAE,MAAM,CAAC;IAE3B,KAAK,EAAE,KAAK,CAEV;IAgCF,MAAM,6CAwBJ;CACH"}
|