@redvars/peacock 3.5.0 → 3.6.0
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/BaseButton-BNFAYn-S.js +219 -0
- package/dist/BaseButton-BNFAYn-S.js.map +1 -0
- package/dist/BaseHyperlinkMixin-BNuwbiEf.js +65 -0
- package/dist/BaseHyperlinkMixin-BNuwbiEf.js.map +1 -0
- package/dist/BaseInput-14YmcfK7.js +27 -0
- package/dist/BaseInput-14YmcfK7.js.map +1 -0
- package/dist/assets/components.css +1 -1
- package/dist/assets/components.css.map +1 -1
- package/dist/assets/styles.css +1 -1
- package/dist/assets/styles.css.map +1 -1
- package/dist/banner.js +14 -30
- package/dist/banner.js.map +1 -1
- package/dist/{button-DMN1dPAg.js → button-colors-Ccys3hvS.js} +5 -468
- package/dist/button-colors-Ccys3hvS.js.map +1 -0
- package/dist/button-group.js +228 -8
- package/dist/button-group.js.map +1 -1
- package/dist/button.js +294 -8
- package/dist/button.js.map +1 -1
- package/dist/calendar-column-view.js +634 -0
- package/dist/calendar-column-view.js.map +1 -0
- package/dist/calendar-event-BrQ_SEKD.js +199 -0
- package/dist/calendar-event-BrQ_SEKD.js.map +1 -0
- package/dist/calendar-month-view.js +376 -0
- package/dist/calendar-month-view.js.map +1 -0
- package/dist/calendar.js +339 -0
- package/dist/calendar.js.map +1 -0
- package/dist/canvas.js +361 -0
- package/dist/canvas.js.map +1 -0
- package/dist/card.js +18 -73
- package/dist/card.js.map +1 -1
- package/dist/cb-compound-expression.js +125 -0
- package/dist/cb-compound-expression.js.map +1 -0
- package/dist/cb-divider.js +150 -0
- package/dist/cb-divider.js.map +1 -0
- package/dist/cb-expression.js +75 -0
- package/dist/cb-expression.js.map +1 -0
- package/dist/cb-predicate.js +137 -0
- package/dist/cb-predicate.js.map +1 -0
- package/dist/chart-bar.js.map +1 -1
- package/dist/chart-doughnut.js +2 -2
- package/dist/chart-doughnut.js.map +1 -1
- package/dist/chart-pie.js +2 -2
- package/dist/chart-pie.js.map +1 -1
- package/dist/chart-stacked-bar.js.map +1 -1
- package/dist/code-editor.js +2 -1
- package/dist/code-editor.js.map +1 -1
- package/dist/code-highlighter.js +2 -1
- package/dist/code-highlighter.js.map +1 -1
- package/dist/condition-builder.js +58 -0
- package/dist/condition-builder.js.map +1 -0
- package/dist/custom-elements-jsdocs.json +10860 -5567
- package/dist/custom-elements.json +16180 -7996
- package/dist/dropdown-button.js +216 -0
- package/dist/dropdown-button.js.map +1 -0
- package/dist/event-manager-D-QCmUgR.js +113 -0
- package/dist/event-manager-D-QCmUgR.js.map +1 -0
- package/dist/fab.js +421 -9
- package/dist/fab.js.map +1 -1
- package/dist/flow-designer-dZnLJOQT.js +1656 -0
- package/dist/flow-designer-dZnLJOQT.js.map +1 -0
- package/dist/flow-designer-node-XMe-jlKg.js +548 -0
- package/dist/flow-designer-node-XMe-jlKg.js.map +1 -0
- package/dist/flow-designer-node.js +4 -0
- package/dist/flow-designer-node.js.map +1 -0
- package/dist/flow-designer.js +16 -0
- package/dist/flow-designer.js.map +1 -0
- package/dist/html-editor.js +358 -0
- package/dist/html-editor.js.map +1 -0
- package/dist/icon-button-CK1ZuE-2.js +247 -0
- package/dist/icon-button-CK1ZuE-2.js.map +1 -0
- package/dist/index.js +31 -8
- package/dist/index.js.map +1 -1
- package/dist/{is-dark-mode-DicqGkCJ.js → is-dark-mode-DOcaw4Yq.js} +2 -27
- package/dist/is-dark-mode-DOcaw4Yq.js.map +1 -0
- package/dist/modal.js +418 -0
- package/dist/modal.js.map +1 -0
- package/dist/{select-4pl4XBj7.js → navigation-rail-DyO0oAZU.js} +2000 -2767
- package/dist/navigation-rail-DyO0oAZU.js.map +1 -0
- package/dist/notification-manager.js +268 -0
- package/dist/notification-manager.js.map +1 -0
- package/dist/notification.js +3 -2
- package/dist/notification.js.map +1 -1
- package/dist/peacock-loader.js +102 -14
- package/dist/peacock-loader.js.map +1 -1
- package/dist/popover-NC7b1lTq.js +1971 -0
- package/dist/popover-NC7b1lTq.js.map +1 -0
- package/dist/popover-content.js +125 -0
- package/dist/popover-content.js.map +1 -0
- package/dist/popover.js +4 -0
- package/dist/popover.js.map +1 -0
- package/dist/search.js +4 -0
- package/dist/search.js.map +1 -1
- package/dist/split-button.js +388 -0
- package/dist/split-button.js.map +1 -0
- package/dist/src/__controllers/floating-controller.d.ts +35 -0
- package/dist/src/__mixins/BaseButtonMixin.d.ts +20 -0
- package/dist/src/__mixins/BaseHyperlinkMixin.d.ts +18 -0
- package/dist/src/__mixins/MixinConstructor.d.ts +1 -0
- package/dist/src/banner/banner.d.ts +0 -4
- package/dist/src/button/BaseButton.d.ts +4 -47
- package/dist/src/button/button/button.d.ts +32 -3
- package/dist/src/button/button-group/button-group.d.ts +2 -2
- package/dist/src/button/icon-button/icon-button.d.ts +33 -8
- package/dist/src/calendar/base-event.d.ts +10 -0
- package/dist/src/calendar/calendar-column-view.d.ts +41 -0
- package/dist/src/calendar/calendar-event.d.ts +7 -0
- package/dist/src/calendar/calendar-month-view.d.ts +31 -0
- package/dist/src/calendar/calendar.d.ts +65 -0
- package/dist/src/calendar/event-manager.d.ts +17 -0
- package/dist/src/calendar/index.d.ts +4 -0
- package/dist/src/calendar/types.d.ts +13 -0
- package/dist/src/calendar/utils.d.ts +31 -0
- package/dist/src/canvas/canvas.d.ts +92 -0
- package/dist/src/canvas/index.d.ts +2 -0
- package/dist/src/card/card.d.ts +4 -15
- package/dist/src/condition-builder/cb-compound-expression.d.ts +31 -0
- package/dist/src/condition-builder/cb-divider.d.ts +26 -0
- package/dist/src/condition-builder/cb-expression.d.ts +31 -0
- package/dist/src/condition-builder/cb-predicate.d.ts +30 -0
- package/dist/src/condition-builder/condition-builder.d.ts +27 -0
- package/dist/src/condition-builder/index.d.ts +5 -0
- package/dist/src/dropdown-button/dropdown-button.d.ts +68 -0
- package/dist/src/dropdown-button/index.d.ts +1 -0
- package/dist/src/fab/fab.d.ts +4 -35
- package/dist/src/flow-designer/commands.d.ts +66 -0
- package/dist/src/flow-designer/flow-designer-node.d.ts +46 -0
- package/dist/src/flow-designer/flow-designer.d.ts +133 -0
- package/dist/src/flow-designer/index.d.ts +7 -0
- package/dist/src/flow-designer/layout.d.ts +30 -0
- package/dist/src/flow-designer/types.d.ts +142 -0
- package/dist/src/flow-designer/validation.d.ts +43 -0
- package/dist/src/flow-designer/workflow-utils.d.ts +40 -0
- package/dist/src/focus-ring/focus-ring.d.ts +11 -5
- package/dist/src/html-editor/html-editor.d.ts +56 -0
- package/dist/src/html-editor/index.d.ts +2 -0
- package/dist/src/index.d.ts +16 -1
- package/dist/src/link/link.d.ts +1 -1
- package/dist/src/menu/menu/menu.d.ts +5 -7
- package/dist/src/menu/menu-item/menu-item.d.ts +14 -13
- package/dist/src/modal/index.d.ts +1 -0
- package/dist/src/modal/modal.d.ts +63 -0
- package/dist/src/navigation-rail/index.d.ts +2 -0
- package/dist/src/navigation-rail/navigation-rail-item.d.ts +55 -0
- package/dist/src/navigation-rail/navigation-rail.d.ts +71 -0
- package/dist/src/notification-manager/index.d.ts +1 -0
- package/dist/src/notification-manager/notification-manager.d.ts +44 -0
- package/dist/src/popover/index.d.ts +2 -0
- package/dist/src/popover/popover-content.d.ts +29 -0
- package/dist/src/popover/popover.d.ts +62 -0
- package/dist/src/sidebar-menu/index.d.ts +3 -0
- package/dist/src/sidebar-menu/sidebar-menu-item.d.ts +58 -0
- package/dist/src/sidebar-menu/sidebar-menu.d.ts +38 -0
- package/dist/src/sidebar-menu/sidebar-sub-menu.d.ts +35 -0
- package/dist/src/split-button/index.d.ts +1 -0
- package/dist/src/split-button/split-button.d.ts +72 -0
- package/dist/src/toolbar/toolbar.d.ts +10 -10
- package/dist/src/tooltip/tooltip.d.ts +5 -15
- package/dist/src/url-field/index.d.ts +1 -0
- package/dist/src/url-field/url-field.d.ts +48 -0
- package/dist/test/flow-designer.test.d.ts +1 -0
- package/dist/test/sidebar-menu.test.d.ts +1 -0
- package/dist/toolbar.js +10 -10
- package/dist/toolbar.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -2
- package/readme.md +73 -65
- package/scss/mixin.scss +16 -0
- package/src/__controllers/floating-controller.ts +237 -0
- package/src/__mixins/BaseButtonMixin.ts +83 -0
- package/src/__mixins/BaseHyperlinkMixin.ts +68 -0
- package/src/__mixins/MixinConstructor.ts +1 -0
- package/src/{__base_element → __mixins}/README.md +2 -2
- package/src/banner/banner.scss +20 -25
- package/src/banner/banner.ts +1 -7
- package/src/button/BaseButton.ts +11 -100
- package/src/button/button/button-sizes.scss +4 -2
- package/src/button/button/button.ts +77 -23
- package/src/button/button-group/button-group.ts +2 -2
- package/src/button/icon-button/icon-button.ts +75 -33
- package/src/calendar/base-event.ts +49 -0
- package/src/calendar/calendar-column-view.scss +326 -0
- package/src/calendar/calendar-column-view.ts +392 -0
- package/src/calendar/calendar-event.ts +20 -0
- package/src/calendar/calendar-month-view.scss +192 -0
- package/src/calendar/calendar-month-view.ts +244 -0
- package/src/calendar/calendar.scss +71 -0
- package/src/calendar/calendar.ts +298 -0
- package/src/calendar/event-manager.ts +117 -0
- package/src/calendar/index.ts +4 -0
- package/src/calendar/types.ts +14 -0
- package/src/calendar/utils.ts +180 -0
- package/src/canvas/canvas.scss +60 -0
- package/src/canvas/canvas.ts +391 -0
- package/src/canvas/index.ts +2 -0
- package/src/card/card.ts +11 -71
- package/src/chart-bar/chart-bar.ts +9 -14
- package/src/chart-bar/chart-stacked-bar.ts +12 -18
- package/src/chart-doughnut/chart-doughnut.ts +23 -27
- package/src/chart-pie/chart-pie.ts +19 -23
- package/src/checkbox/checkbox.scss +17 -34
- package/src/checkbox/checkbox.ts +3 -1
- package/src/code-highlighter/code-highlighter.scss +1 -0
- package/src/code-highlighter/code-highlighter.ts +1 -1
- package/src/condition-builder/cb-compound-expression.scss +37 -0
- package/src/condition-builder/cb-compound-expression.ts +80 -0
- package/src/condition-builder/cb-divider.scss +93 -0
- package/src/condition-builder/cb-divider.ts +56 -0
- package/src/condition-builder/cb-expression.scss +14 -0
- package/src/condition-builder/cb-expression.ts +49 -0
- package/src/condition-builder/cb-predicate.scss +35 -0
- package/src/condition-builder/cb-predicate.ts +102 -0
- package/src/condition-builder/condition-builder.scss +13 -0
- package/src/condition-builder/condition-builder.ts +38 -0
- package/src/condition-builder/index.ts +5 -0
- package/src/date-picker/date-picker.ts +1 -1
- package/src/dropdown-button/demo/index.html +110 -0
- package/src/dropdown-button/dropdown-button.scss +22 -0
- package/src/dropdown-button/dropdown-button.ts +206 -0
- package/src/dropdown-button/index.ts +1 -0
- package/src/elevation/elevation.scss +5 -5
- package/src/fab/fab.ts +29 -100
- package/src/flow-designer/DEMO.md +239 -0
- package/src/flow-designer/commands.ts +278 -0
- package/src/flow-designer/flow-designer-node.ts +172 -0
- package/src/flow-designer/flow-designer.scss +457 -0
- package/src/flow-designer/flow-designer.ts +611 -0
- package/src/flow-designer/index.ts +41 -0
- package/src/flow-designer/layout.ts +357 -0
- package/src/flow-designer/types.ts +166 -0
- package/src/flow-designer/validation.ts +284 -0
- package/src/flow-designer/workflow-utils.ts +282 -0
- package/src/focus-ring/focus-ring.ts +47 -40
- package/src/html-editor/html-editor.scss +146 -0
- package/src/html-editor/html-editor.ts +276 -0
- package/src/html-editor/index.ts +3 -0
- package/src/index.ts +28 -1
- package/src/input/input.ts +3 -1
- package/src/link/link.ts +2 -2
- package/src/menu/menu/menu.scss +2 -2
- package/src/menu/menu/menu.ts +91 -101
- package/src/menu/menu-item/menu-item.scss +4 -0
- package/src/menu/menu-item/menu-item.ts +85 -79
- package/src/modal/index.ts +1 -0
- package/src/modal/modal.scss +206 -0
- package/src/modal/modal.ts +201 -0
- package/src/navigation-rail/index.ts +2 -0
- package/src/navigation-rail/navigation-rail-item.scss +216 -0
- package/src/navigation-rail/navigation-rail-item.ts +223 -0
- package/src/navigation-rail/navigation-rail.scss +72 -0
- package/src/navigation-rail/navigation-rail.ts +149 -0
- package/src/notification/notification.ts +3 -2
- package/src/notification-manager/index.ts +1 -0
- package/src/notification-manager/notification-manager.scss +113 -0
- package/src/notification-manager/notification-manager.ts +199 -0
- package/src/number-field/number-field.ts +6 -4
- package/src/pagination/pagination.ts +6 -4
- package/src/peacock-loader.ts +93 -5
- package/src/popover/index.ts +2 -0
- package/src/popover/popover-content.scss +69 -0
- package/src/popover/popover-content.ts +51 -0
- package/src/popover/popover.scss +7 -0
- package/src/popover/popover.ts +170 -0
- package/src/search/search.ts +4 -0
- package/src/sidebar-menu/demo/index.html +68 -0
- package/src/sidebar-menu/index.ts +3 -0
- package/src/sidebar-menu/sidebar-menu-item.scss +102 -0
- package/src/sidebar-menu/sidebar-menu-item.ts +151 -0
- package/src/{tree-view/tree-view.scss → sidebar-menu/sidebar-menu.scss} +1 -1
- package/src/sidebar-menu/sidebar-menu.ts +182 -0
- package/src/sidebar-menu/sidebar-sub-menu.scss +130 -0
- package/src/sidebar-menu/sidebar-sub-menu.ts +160 -0
- package/src/skeleton/skeleton.scss +18 -24
- package/src/snackbar/snackbar.ts +1 -1
- package/src/split-button/index.ts +1 -0
- package/src/split-button/split-button-colors.scss +56 -0
- package/src/split-button/split-button-sizes.scss +28 -0
- package/src/split-button/split-button.scss +79 -0
- package/src/split-button/split-button.ts +236 -0
- package/src/table/table.ts +2 -2
- package/src/tabs/tab.ts +4 -3
- package/src/text/text.css-component.scss +7 -1
- package/src/time-picker/time-picker.ts +1 -1
- package/src/toolbar/toolbar.ts +10 -10
- package/src/tooltip/tooltip.scss +4 -3
- package/src/tooltip/tooltip.ts +64 -98
- package/src/url-field/index.ts +1 -0
- package/src/url-field/url-field.scss +50 -0
- package/src/url-field/url-field.ts +239 -0
- package/dist/button-DMN1dPAg.js.map +0 -1
- package/dist/button-group-CX9CUUXk.js +0 -435
- package/dist/button-group-CX9CUUXk.js.map +0 -1
- package/dist/fab-C5Nzxk0E.js +0 -497
- package/dist/fab-C5Nzxk0E.js.map +0 -1
- package/dist/is-dark-mode-DicqGkCJ.js.map +0 -1
- package/dist/select-4pl4XBj7.js.map +0 -1
- package/dist/spread-B5cgadZl.js +0 -32
- package/dist/spread-B5cgadZl.js.map +0 -1
- package/dist/src/__base_element/BaseHyperlink.d.ts +0 -20
- package/dist/src/menu/menu/MenuSurfaceController.d.ts +0 -18
- package/dist/src/tree-view/index.d.ts +0 -2
- package/dist/src/tree-view/tree-node.d.ts +0 -69
- package/dist/src/tree-view/tree-view.d.ts +0 -40
- package/dist/src/tree-view/wc-tree-view.d.ts +0 -6
- package/dist/test/tree-view.test.d.ts +0 -1
- package/dist/throttle-C7ZAPqtu.js +0 -24
- package/dist/throttle-C7ZAPqtu.js.map +0 -1
- package/src/__base_element/BaseHyperlink.ts +0 -42
- package/src/menu/menu/MenuSurfaceController.ts +0 -61
- package/src/tree-view/demo/index.html +0 -57
- package/src/tree-view/index.ts +0 -2
- package/src/tree-view/tree-node.scss +0 -101
- package/src/tree-view/tree-node.ts +0 -268
- package/src/tree-view/tree-view.ts +0 -182
- package/src/tree-view/wc-tree-view.ts +0 -9
package/dist/canvas.js
ADDED
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
import { a as i, _ as __decorate, I as IndividualComponent, i as i$1, A, w, b } from './IndividualComponent-DUINtMGK.js';
|
|
2
|
+
import { n } from './property-1psGvXOq.js';
|
|
3
|
+
import { e } from './class-map-YU7g0o3B.js';
|
|
4
|
+
import './directive-ZPhl09Yt.js';
|
|
5
|
+
|
|
6
|
+
var css_248z = i`* {
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.screen-reader-only {
|
|
11
|
+
display: none !important;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
:host {
|
|
15
|
+
display: block;
|
|
16
|
+
--canvas-background: var(--color-surface-container-low);
|
|
17
|
+
--canvas-dot-color: var(--color-outline-variant);
|
|
18
|
+
--canvas-line-color: var(--color-on-surface);
|
|
19
|
+
--canvas-hover-color: var(--color-primary);
|
|
20
|
+
--canvas-arrow-color: var(--color-on-surface);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.canvas-wrapper {
|
|
24
|
+
background: var(--canvas-background);
|
|
25
|
+
border-radius: var(--shape-corner-medium);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
#canvas-background circle {
|
|
29
|
+
fill: var(--canvas-dot-color);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
#endarrow polyline {
|
|
33
|
+
fill: none;
|
|
34
|
+
stroke: var(--canvas-arrow-color);
|
|
35
|
+
vector-effect: non-scaling-stroke;
|
|
36
|
+
stroke-width: 2;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.line.no-color {
|
|
40
|
+
stroke: var(--canvas-line-color);
|
|
41
|
+
}
|
|
42
|
+
.line.variant-dashed {
|
|
43
|
+
stroke-dasharray: 6 6;
|
|
44
|
+
}
|
|
45
|
+
.line.variant-animated-dashed {
|
|
46
|
+
animation: canvas-dash-flow 600ms linear infinite;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.clickable {
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
}
|
|
52
|
+
.clickable:hover .line {
|
|
53
|
+
stroke: var(--canvas-hover-color);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.line.clickable:hover {
|
|
57
|
+
stroke: var(--canvas-hover-color);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@keyframes canvas-dash-flow {
|
|
61
|
+
to {
|
|
62
|
+
stroke-dashoffset: -12;
|
|
63
|
+
}
|
|
64
|
+
}`;
|
|
65
|
+
|
|
66
|
+
var Canvas_1;
|
|
67
|
+
/**
|
|
68
|
+
* @label Canvas
|
|
69
|
+
* @tag wc-canvas
|
|
70
|
+
* @rawTag canvas
|
|
71
|
+
* @summary A Material 3 inspired SVG canvas for drawing shapes, lines, and connectors on a dotted grid.
|
|
72
|
+
*
|
|
73
|
+
* @cssprop --canvas-background - Background color for the canvas wrapper. Defaults to surface-container-low.
|
|
74
|
+
* @cssprop --canvas-dot-color - Color of the background grid dots. Defaults to outline-variant.
|
|
75
|
+
* @cssprop --canvas-line-color - Default stroke color for lines and connectors. Defaults to on-surface.
|
|
76
|
+
* @cssprop --canvas-hover-color - Stroke color on hover for clickable shapes. Defaults to primary.
|
|
77
|
+
* @cssprop --canvas-arrow-color - Stroke color for arrow markers. Defaults to on-surface.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```html
|
|
81
|
+
* <wc-canvas id="my-canvas"></wc-canvas>
|
|
82
|
+
* <script>
|
|
83
|
+
* document.querySelector('#my-canvas').shapes = [
|
|
84
|
+
* { type: 'circle', x: 0, y: 0, radius: 0.25, color: 'red' },
|
|
85
|
+
* ];
|
|
86
|
+
* </script>
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
let Canvas = Canvas_1 = class Canvas extends i$1 {
|
|
90
|
+
constructor() {
|
|
91
|
+
super(...arguments);
|
|
92
|
+
/**
|
|
93
|
+
* Array of shape objects to render on the canvas.
|
|
94
|
+
*/
|
|
95
|
+
this.shapes = [];
|
|
96
|
+
/**
|
|
97
|
+
* Padding around the computed viewbox (in grid units).
|
|
98
|
+
*/
|
|
99
|
+
this.padding = 1;
|
|
100
|
+
/**
|
|
101
|
+
* Zoom multiplier for the canvas dimensions.
|
|
102
|
+
*/
|
|
103
|
+
this.zoom = 1;
|
|
104
|
+
this.unitSize = 1;
|
|
105
|
+
this.gap = this.unitSize * 10;
|
|
106
|
+
}
|
|
107
|
+
static getNextPoint(point, direction, length) {
|
|
108
|
+
if (direction === 'down')
|
|
109
|
+
return { x: point.x, y: point.y + length };
|
|
110
|
+
if (direction === 'up')
|
|
111
|
+
return { x: point.x, y: point.y - length };
|
|
112
|
+
if (direction === 'left')
|
|
113
|
+
return { x: point.x - length, y: point.y };
|
|
114
|
+
if (direction === 'right')
|
|
115
|
+
return { x: point.x + length, y: point.y };
|
|
116
|
+
return { x: point.x, y: point.y };
|
|
117
|
+
}
|
|
118
|
+
static updateComputationArea(point, area) {
|
|
119
|
+
const nextArea = { ...area };
|
|
120
|
+
if (point.x > nextArea.width)
|
|
121
|
+
nextArea.width = point.x;
|
|
122
|
+
else if (point.x < nextArea.x)
|
|
123
|
+
nextArea.x = point.x;
|
|
124
|
+
if (point.y > nextArea.height)
|
|
125
|
+
nextArea.height = point.y;
|
|
126
|
+
else if (point.y < nextArea.y)
|
|
127
|
+
nextArea.y = point.y;
|
|
128
|
+
return nextArea;
|
|
129
|
+
}
|
|
130
|
+
static getStrokeVariantClasses(variant) {
|
|
131
|
+
return {
|
|
132
|
+
line: true,
|
|
133
|
+
'no-color': false,
|
|
134
|
+
'variant-dashed': variant === 'dashed' || variant === 'animated-dashed',
|
|
135
|
+
'variant-animated-dashed': variant === 'animated-dashed',
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
computeShapes(initialBounds) {
|
|
139
|
+
const dotRadius = this.unitSize;
|
|
140
|
+
let computedViewbox = { ...initialBounds };
|
|
141
|
+
const shapes = this.shapes.map(shape => {
|
|
142
|
+
switch (shape.type) {
|
|
143
|
+
case 'circle': {
|
|
144
|
+
const r = shape.radius || 1;
|
|
145
|
+
const cx = shape.x || 0;
|
|
146
|
+
const cy = shape.y || 0;
|
|
147
|
+
if (cx + Math.ceil(r) > computedViewbox.width)
|
|
148
|
+
computedViewbox.width = cx + Math.ceil(r);
|
|
149
|
+
if (cx - Math.ceil(r) < computedViewbox.x)
|
|
150
|
+
computedViewbox.x = cx - Math.ceil(r);
|
|
151
|
+
if (cy + Math.ceil(r) > computedViewbox.height)
|
|
152
|
+
computedViewbox.height = cy + Math.ceil(r);
|
|
153
|
+
if (cy - Math.ceil(r) < computedViewbox.y)
|
|
154
|
+
computedViewbox.y = cy - Math.ceil(r);
|
|
155
|
+
return w `<circle
|
|
156
|
+
cx=${cx * this.gap + dotRadius}
|
|
157
|
+
cy=${cy * this.gap + dotRadius}
|
|
158
|
+
r=${r * this.gap}
|
|
159
|
+
fill=${shape.color || 'var(--canvas-line-color, var(--color-on-surface))'}
|
|
160
|
+
/>`;
|
|
161
|
+
}
|
|
162
|
+
case 'rect': {
|
|
163
|
+
const w$1 = shape.width || 1;
|
|
164
|
+
const h = shape.height || 1;
|
|
165
|
+
const rx = shape.x || 0;
|
|
166
|
+
const ry = shape.y || 0;
|
|
167
|
+
if (rx + Math.ceil(w$1) > computedViewbox.width)
|
|
168
|
+
computedViewbox.width = rx + Math.ceil(w$1);
|
|
169
|
+
if (rx - Math.ceil(w$1) < computedViewbox.x)
|
|
170
|
+
computedViewbox.x = rx - Math.ceil(w$1);
|
|
171
|
+
if (ry + Math.ceil(h) > computedViewbox.height)
|
|
172
|
+
computedViewbox.height = ry + Math.ceil(h);
|
|
173
|
+
if (ry - Math.ceil(h) < computedViewbox.y)
|
|
174
|
+
computedViewbox.y = ry - Math.ceil(h);
|
|
175
|
+
return w `<rect
|
|
176
|
+
x=${rx * this.gap + dotRadius}
|
|
177
|
+
y=${ry * this.gap}
|
|
178
|
+
width=${w$1 * this.gap + dotRadius}
|
|
179
|
+
height=${h * this.gap + dotRadius}
|
|
180
|
+
fill=${shape.color || 'var(--canvas-line-color, var(--color-on-surface))'}
|
|
181
|
+
/>`;
|
|
182
|
+
}
|
|
183
|
+
case 'line': {
|
|
184
|
+
const start = shape.start || { x: 0, y: 0 };
|
|
185
|
+
const end = shape.end || { x: 0, y: 0 };
|
|
186
|
+
const pathString = `M${start.x * this.gap + dotRadius} ${start.y * this.gap + dotRadius} L${end.x * this.gap + dotRadius} ${end.y * this.gap + dotRadius}`;
|
|
187
|
+
const strokeColor = shape.color ||
|
|
188
|
+
'var(--canvas-line-color, var(--color-on-surface))';
|
|
189
|
+
return w `<path
|
|
190
|
+
class=${e({
|
|
191
|
+
...Canvas_1.getStrokeVariantClasses(shape.variant),
|
|
192
|
+
clickable: !!shape.clickable,
|
|
193
|
+
'no-color': !shape.color,
|
|
194
|
+
})}
|
|
195
|
+
stroke-width="2"
|
|
196
|
+
stroke-linecap="round"
|
|
197
|
+
stroke-linejoin="round"
|
|
198
|
+
stroke=${strokeColor}
|
|
199
|
+
marker-end=${shape.showArrow ? 'url(#endarrow)' : ''}
|
|
200
|
+
d=${pathString}
|
|
201
|
+
stroke-dasharray=${shape.variant === 'dashed' || shape.variant === 'animated-dashed' ? '6,6' : A}
|
|
202
|
+
fill="none"
|
|
203
|
+
/>`;
|
|
204
|
+
}
|
|
205
|
+
case 'connector': {
|
|
206
|
+
const start = shape.start || { x: 0, y: 0 };
|
|
207
|
+
let pathString = `M${start.x * this.gap + dotRadius} ${start.y * this.gap + dotRadius}`;
|
|
208
|
+
let current = { ...start };
|
|
209
|
+
computedViewbox = Canvas_1.updateComputationArea(current, computedViewbox);
|
|
210
|
+
const pathSegments = shape.path || [];
|
|
211
|
+
for (let i = 0; i < pathSegments.length; i += 1) {
|
|
212
|
+
const path = pathSegments[i];
|
|
213
|
+
if (i === 0) {
|
|
214
|
+
const point = Canvas_1.getNextPoint(current, path.direction, 1);
|
|
215
|
+
pathString += ` L${point.x * this.gap + dotRadius} ${point.y * this.gap + dotRadius}`;
|
|
216
|
+
current = { ...point };
|
|
217
|
+
computedViewbox = Canvas_1.updateComputationArea(current, computedViewbox);
|
|
218
|
+
}
|
|
219
|
+
const point = Canvas_1.getNextPoint(current, path.direction, path.length - 2);
|
|
220
|
+
pathString += ` L${point.x * this.gap + dotRadius} ${point.y * this.gap + dotRadius}`;
|
|
221
|
+
current = { ...point };
|
|
222
|
+
computedViewbox = Canvas_1.updateComputationArea(current, computedViewbox);
|
|
223
|
+
if (i === pathSegments.length - 1) {
|
|
224
|
+
const endPoint = Canvas_1.getNextPoint(current, path.direction, 1);
|
|
225
|
+
pathString += ` L${endPoint.x * this.gap + dotRadius} ${endPoint.y * this.gap + dotRadius}`;
|
|
226
|
+
current = { ...endPoint };
|
|
227
|
+
computedViewbox = Canvas_1.updateComputationArea(current, computedViewbox);
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
const nextPath = pathSegments[i + 1];
|
|
231
|
+
const midPoint = Canvas_1.getNextPoint(current, path.direction, 1);
|
|
232
|
+
const nextPoint = Canvas_1.getNextPoint(midPoint, nextPath.direction, 1);
|
|
233
|
+
pathString += ` Q ${midPoint.x * this.gap + dotRadius} ${midPoint.y * this.gap + dotRadius} ${nextPoint.x * this.gap + dotRadius} ${nextPoint.y * this.gap + dotRadius}`;
|
|
234
|
+
current = { ...nextPoint };
|
|
235
|
+
computedViewbox = Canvas_1.updateComputationArea(current, computedViewbox);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
const strokeColor = shape.color ||
|
|
239
|
+
'var(--canvas-line-color, var(--color-on-surface))';
|
|
240
|
+
return w `<g class=${e({ clickable: !!shape.clickable })}>
|
|
241
|
+
<path
|
|
242
|
+
class=${e({
|
|
243
|
+
...Canvas_1.getStrokeVariantClasses(shape.variant),
|
|
244
|
+
'no-color': !shape.color,
|
|
245
|
+
})}
|
|
246
|
+
stroke-width="2"
|
|
247
|
+
stroke-linecap="round"
|
|
248
|
+
stroke-linejoin="round"
|
|
249
|
+
stroke=${strokeColor}
|
|
250
|
+
marker-end=${shape.showArrow ? 'url(#endarrow)' : ''}
|
|
251
|
+
d=${pathString}
|
|
252
|
+
stroke-dasharray=${shape.variant === 'dashed' || shape.variant === 'animated-dashed' ? '6,6' : A}
|
|
253
|
+
fill="none"
|
|
254
|
+
/>
|
|
255
|
+
<path
|
|
256
|
+
stroke-width="10"
|
|
257
|
+
stroke-linecap="round"
|
|
258
|
+
stroke-linejoin="round"
|
|
259
|
+
stroke="transparent"
|
|
260
|
+
d=${pathString}
|
|
261
|
+
fill="none"
|
|
262
|
+
/>
|
|
263
|
+
</g>`;
|
|
264
|
+
}
|
|
265
|
+
default:
|
|
266
|
+
return A;
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
// Padding
|
|
270
|
+
computedViewbox.x -= this.padding;
|
|
271
|
+
computedViewbox.y -= this.padding;
|
|
272
|
+
computedViewbox.width += this.padding;
|
|
273
|
+
computedViewbox.height += this.padding;
|
|
274
|
+
computedViewbox.width -= computedViewbox.x;
|
|
275
|
+
computedViewbox.height -= computedViewbox.y;
|
|
276
|
+
return { shapes, computedViewbox };
|
|
277
|
+
}
|
|
278
|
+
render() {
|
|
279
|
+
const dotRadius = this.unitSize;
|
|
280
|
+
let computedViewBox = { width: 0, height: 0, x: 0, y: 0 };
|
|
281
|
+
const { shapes, computedViewbox } = this.computeShapes(computedViewBox);
|
|
282
|
+
computedViewBox = computedViewbox;
|
|
283
|
+
if (this.viewbox) {
|
|
284
|
+
const viewBox = this.viewbox.split(' ');
|
|
285
|
+
computedViewBox = {
|
|
286
|
+
x: parseInt(viewBox[0], 10),
|
|
287
|
+
y: parseInt(viewBox[1], 10),
|
|
288
|
+
width: parseInt(viewBox[2], 10),
|
|
289
|
+
height: parseInt(viewBox[3], 10),
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
const wrapperWidth = (computedViewBox.width * this.gap + 2) * dotRadius * this.zoom;
|
|
293
|
+
const wrapperHeight = (computedViewBox.height * this.gap + 2) * dotRadius * this.zoom;
|
|
294
|
+
const svgViewBox = `${computedViewBox.x * this.gap} ${computedViewBox.y * this.gap} ${computedViewBox.width * this.gap + 2 * dotRadius} ${computedViewBox.height * this.gap + 2 * dotRadius}`;
|
|
295
|
+
return b `
|
|
296
|
+
<div
|
|
297
|
+
class="canvas-wrapper"
|
|
298
|
+
style="width: ${wrapperWidth}px; height: ${wrapperHeight}px;"
|
|
299
|
+
>
|
|
300
|
+
<svg
|
|
301
|
+
class="canvas"
|
|
302
|
+
height="100%"
|
|
303
|
+
width="100%"
|
|
304
|
+
viewBox=${svgViewBox}
|
|
305
|
+
>
|
|
306
|
+
<defs>
|
|
307
|
+
<pattern
|
|
308
|
+
id="canvas-background"
|
|
309
|
+
patternUnits="userSpaceOnUse"
|
|
310
|
+
width=${this.gap}
|
|
311
|
+
height=${this.gap}
|
|
312
|
+
>
|
|
313
|
+
<circle cx="1" cy="1" r=${dotRadius} />
|
|
314
|
+
</pattern>
|
|
315
|
+
|
|
316
|
+
<marker
|
|
317
|
+
id="endarrow"
|
|
318
|
+
markerWidth="15"
|
|
319
|
+
markerHeight="22.5"
|
|
320
|
+
refX="9"
|
|
321
|
+
refY="15"
|
|
322
|
+
markerUnits="userSpaceOnUse"
|
|
323
|
+
orient="auto"
|
|
324
|
+
>
|
|
325
|
+
<polyline points="0 22.5, 7.5 15, 0 7.5"></polyline>
|
|
326
|
+
</marker>
|
|
327
|
+
</defs>
|
|
328
|
+
|
|
329
|
+
<rect
|
|
330
|
+
x=${computedViewBox.x * this.gap}
|
|
331
|
+
y=${computedViewBox.y * this.gap}
|
|
332
|
+
width="100%"
|
|
333
|
+
height="100%"
|
|
334
|
+
fill="url(#canvas-background)"
|
|
335
|
+
/>
|
|
336
|
+
|
|
337
|
+
${shapes}
|
|
338
|
+
</svg>
|
|
339
|
+
</div>
|
|
340
|
+
`;
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
Canvas.styles = [css_248z];
|
|
344
|
+
__decorate([
|
|
345
|
+
n({ type: Array })
|
|
346
|
+
], Canvas.prototype, "shapes", void 0);
|
|
347
|
+
__decorate([
|
|
348
|
+
n({ type: Number, reflect: true })
|
|
349
|
+
], Canvas.prototype, "padding", void 0);
|
|
350
|
+
__decorate([
|
|
351
|
+
n({ type: Number, reflect: true })
|
|
352
|
+
], Canvas.prototype, "zoom", void 0);
|
|
353
|
+
__decorate([
|
|
354
|
+
n({ type: String })
|
|
355
|
+
], Canvas.prototype, "viewbox", void 0);
|
|
356
|
+
Canvas = Canvas_1 = __decorate([
|
|
357
|
+
IndividualComponent
|
|
358
|
+
], Canvas);
|
|
359
|
+
|
|
360
|
+
export { Canvas };
|
|
361
|
+
//# sourceMappingURL=canvas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canvas.js","sources":["../../src/canvas/canvas.ts"],"sourcesContent":["import { html, LitElement, svg, nothing } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport IndividualComponent from '@/IndividualComponent.js';\nimport styles from './canvas.scss';\n\nexport type CanvasDirection = 'up' | 'down' | 'left' | 'right';\n\nexport type CanvasStrokeVariant = 'solid' | 'dashed' | 'animated-dashed';\n\nexport interface CanvasPoint {\n x: number;\n y: number;\n}\n\nexport interface CanvasPathSegment {\n direction: CanvasDirection;\n length: number;\n}\n\ninterface BaseCanvasShape {\n color?: string;\n}\n\ninterface BaseCanvasStrokeShape extends BaseCanvasShape {\n variant?: CanvasStrokeVariant;\n showArrow?: boolean;\n clickable?: boolean;\n}\n\nexport interface CanvasCircleShape extends BaseCanvasShape {\n type: 'circle';\n x?: number;\n y?: number;\n radius?: number;\n}\n\nexport interface CanvasRectShape extends BaseCanvasShape {\n type: 'rect';\n x?: number;\n y?: number;\n width?: number;\n height?: number;\n}\n\nexport interface CanvasLineShape extends BaseCanvasStrokeShape {\n type: 'line';\n start?: CanvasPoint;\n end?: CanvasPoint;\n}\n\nexport interface CanvasConnectorShape extends BaseCanvasStrokeShape {\n type: 'connector';\n start?: CanvasPoint;\n path?: CanvasPathSegment[];\n}\n\nexport type CanvasShape =\n | CanvasCircleShape\n | CanvasRectShape\n | CanvasLineShape\n | CanvasConnectorShape;\n\ninterface CanvasBounds {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\n/**\n * @label Canvas\n * @tag wc-canvas\n * @rawTag canvas\n * @summary A Material 3 inspired SVG canvas for drawing shapes, lines, and connectors on a dotted grid.\n *\n * @cssprop --canvas-background - Background color for the canvas wrapper. Defaults to surface-container-low.\n * @cssprop --canvas-dot-color - Color of the background grid dots. Defaults to outline-variant.\n * @cssprop --canvas-line-color - Default stroke color for lines and connectors. Defaults to on-surface.\n * @cssprop --canvas-hover-color - Stroke color on hover for clickable shapes. Defaults to primary.\n * @cssprop --canvas-arrow-color - Stroke color for arrow markers. Defaults to on-surface.\n *\n * @example\n * ```html\n * <wc-canvas id=\"my-canvas\"></wc-canvas>\n * <script>\n * document.querySelector('#my-canvas').shapes = [\n * { type: 'circle', x: 0, y: 0, radius: 0.25, color: 'red' },\n * ];\n * </script>\n * ```\n */\n@IndividualComponent\nexport class Canvas extends LitElement {\n static styles = [styles];\n\n /**\n * Array of shape objects to render on the canvas.\n */\n @property({ type: Array })\n shapes: CanvasShape[] = [];\n\n /**\n * Padding around the computed viewbox (in grid units).\n */\n @property({ type: Number, reflect: true })\n padding: number = 1;\n\n /**\n * Zoom multiplier for the canvas dimensions.\n */\n @property({ type: Number, reflect: true })\n zoom: number = 1;\n\n /**\n * Optional viewbox override string (e.g. \"0 0 100 100\").\n */\n @property({ type: String })\n viewbox?: string;\n\n private unitSize: number = 1;\n\n private gap: number = this.unitSize * 10;\n\n private static getNextPoint(\n point: CanvasPoint,\n direction: CanvasDirection,\n length: number,\n ): CanvasPoint {\n if (direction === 'down') return { x: point.x, y: point.y + length };\n if (direction === 'up') return { x: point.x, y: point.y - length };\n if (direction === 'left') return { x: point.x - length, y: point.y };\n if (direction === 'right') return { x: point.x + length, y: point.y };\n return { x: point.x, y: point.y };\n }\n\n private static updateComputationArea(\n point: CanvasPoint,\n area: CanvasBounds,\n ): CanvasBounds {\n const nextArea = { ...area };\n if (point.x > nextArea.width) nextArea.width = point.x;\n else if (point.x < nextArea.x) nextArea.x = point.x;\n if (point.y > nextArea.height) nextArea.height = point.y;\n else if (point.y < nextArea.y) nextArea.y = point.y;\n return nextArea;\n }\n\n private static getStrokeVariantClasses(variant?: CanvasStrokeVariant) {\n return {\n line: true,\n 'no-color': false,\n 'variant-dashed': variant === 'dashed' || variant === 'animated-dashed',\n 'variant-animated-dashed': variant === 'animated-dashed',\n };\n }\n\n private computeShapes(initialBounds: CanvasBounds) {\n const dotRadius = this.unitSize;\n let computedViewbox = { ...initialBounds };\n\n const shapes = this.shapes.map(shape => {\n switch (shape.type) {\n case 'circle': {\n const r = shape.radius || 1;\n const cx = shape.x || 0;\n const cy = shape.y || 0;\n if (cx + Math.ceil(r) > computedViewbox.width)\n computedViewbox.width = cx + Math.ceil(r);\n if (cx - Math.ceil(r) < computedViewbox.x)\n computedViewbox.x = cx - Math.ceil(r);\n if (cy + Math.ceil(r) > computedViewbox.height)\n computedViewbox.height = cy + Math.ceil(r);\n if (cy - Math.ceil(r) < computedViewbox.y)\n computedViewbox.y = cy - Math.ceil(r);\n\n return svg`<circle\n cx=${cx * this.gap + dotRadius}\n cy=${cy * this.gap + dotRadius}\n r=${r * this.gap}\n fill=${shape.color || 'var(--canvas-line-color, var(--color-on-surface))'}\n />`;\n }\n case 'rect': {\n const w = shape.width || 1;\n const h = shape.height || 1;\n const rx = shape.x || 0;\n const ry = shape.y || 0;\n if (rx + Math.ceil(w) > computedViewbox.width)\n computedViewbox.width = rx + Math.ceil(w);\n if (rx - Math.ceil(w) < computedViewbox.x)\n computedViewbox.x = rx - Math.ceil(w);\n if (ry + Math.ceil(h) > computedViewbox.height)\n computedViewbox.height = ry + Math.ceil(h);\n if (ry - Math.ceil(h) < computedViewbox.y)\n computedViewbox.y = ry - Math.ceil(h);\n\n return svg`<rect\n x=${rx * this.gap + dotRadius}\n y=${ry * this.gap}\n width=${w * this.gap + dotRadius}\n height=${h * this.gap + dotRadius}\n fill=${shape.color || 'var(--canvas-line-color, var(--color-on-surface))'}\n />`;\n }\n case 'line': {\n const start = shape.start || { x: 0, y: 0 };\n const end = shape.end || { x: 0, y: 0 };\n const pathString = `M${start.x * this.gap + dotRadius} ${start.y * this.gap + dotRadius} L${end.x * this.gap + dotRadius} ${end.y * this.gap + dotRadius}`;\n const strokeColor =\n shape.color ||\n 'var(--canvas-line-color, var(--color-on-surface))';\n\n return svg`<path\n class=${classMap({\n ...Canvas.getStrokeVariantClasses(shape.variant),\n clickable: !!shape.clickable,\n 'no-color': !shape.color,\n })}\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n stroke=${strokeColor}\n marker-end=${shape.showArrow ? 'url(#endarrow)' : ''}\n d=${pathString}\n stroke-dasharray=${shape.variant === 'dashed' || shape.variant === 'animated-dashed' ? '6,6' : nothing}\n fill=\"none\"\n />`;\n }\n case 'connector': {\n const start = shape.start || { x: 0, y: 0 };\n let pathString = `M${start.x * this.gap + dotRadius} ${start.y * this.gap + dotRadius}`;\n let current = { ...start };\n computedViewbox = Canvas.updateComputationArea(current, computedViewbox);\n\n const pathSegments = shape.path || [];\n for (let i = 0; i < pathSegments.length; i += 1) {\n const path = pathSegments[i];\n\n if (i === 0) {\n const point = Canvas.getNextPoint(current, path.direction, 1);\n pathString += ` L${point.x * this.gap + dotRadius} ${point.y * this.gap + dotRadius}`;\n current = { ...point };\n computedViewbox = Canvas.updateComputationArea(current, computedViewbox);\n }\n\n const point = Canvas.getNextPoint(\n current,\n path.direction,\n path.length - 2,\n );\n pathString += ` L${point.x * this.gap + dotRadius} ${point.y * this.gap + dotRadius}`;\n current = { ...point };\n computedViewbox = Canvas.updateComputationArea(current, computedViewbox);\n\n if (i === pathSegments.length - 1) {\n const endPoint = Canvas.getNextPoint(current, path.direction, 1);\n pathString += ` L${endPoint.x * this.gap + dotRadius} ${endPoint.y * this.gap + dotRadius}`;\n current = { ...endPoint };\n computedViewbox = Canvas.updateComputationArea(current, computedViewbox);\n } else {\n const nextPath = pathSegments[i + 1];\n const midPoint = Canvas.getNextPoint(current, path.direction, 1);\n const nextPoint = Canvas.getNextPoint(\n midPoint,\n nextPath.direction,\n 1,\n );\n pathString += ` Q ${midPoint.x * this.gap + dotRadius} ${midPoint.y * this.gap + dotRadius} ${nextPoint.x * this.gap + dotRadius} ${nextPoint.y * this.gap + dotRadius}`;\n current = { ...nextPoint };\n computedViewbox = Canvas.updateComputationArea(current, computedViewbox);\n }\n }\n\n const strokeColor =\n shape.color ||\n 'var(--canvas-line-color, var(--color-on-surface))';\n\n return svg`<g class=${classMap({ clickable: !!shape.clickable })}>\n <path\n class=${classMap({\n ...Canvas.getStrokeVariantClasses(shape.variant),\n 'no-color': !shape.color,\n })}\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n stroke=${strokeColor}\n marker-end=${shape.showArrow ? 'url(#endarrow)' : ''}\n d=${pathString}\n stroke-dasharray=${shape.variant === 'dashed' || shape.variant === 'animated-dashed' ? '6,6' : nothing}\n fill=\"none\"\n />\n <path\n stroke-width=\"10\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n stroke=\"transparent\"\n d=${pathString}\n fill=\"none\"\n />\n </g>`;\n }\n default:\n return nothing;\n }\n });\n\n // Padding\n computedViewbox.x -= this.padding;\n computedViewbox.y -= this.padding;\n computedViewbox.width += this.padding;\n computedViewbox.height += this.padding;\n computedViewbox.width -= computedViewbox.x;\n computedViewbox.height -= computedViewbox.y;\n\n return { shapes, computedViewbox };\n }\n\n protected render() {\n const dotRadius = this.unitSize;\n let computedViewBox = { width: 0, height: 0, x: 0, y: 0 };\n\n const { shapes, computedViewbox } = this.computeShapes(computedViewBox);\n computedViewBox = computedViewbox;\n\n if (this.viewbox) {\n const viewBox = this.viewbox.split(' ');\n computedViewBox = {\n x: parseInt(viewBox[0], 10),\n y: parseInt(viewBox[1], 10),\n width: parseInt(viewBox[2], 10),\n height: parseInt(viewBox[3], 10),\n };\n }\n\n const wrapperWidth =\n (computedViewBox.width * this.gap + 2) * dotRadius * this.zoom;\n const wrapperHeight =\n (computedViewBox.height * this.gap + 2) * dotRadius * this.zoom;\n\n const svgViewBox = `${computedViewBox.x * this.gap} ${computedViewBox.y * this.gap} ${computedViewBox.width * this.gap + 2 * dotRadius} ${computedViewBox.height * this.gap + 2 * dotRadius}`;\n\n return html`\n <div\n class=\"canvas-wrapper\"\n style=\"width: ${wrapperWidth}px; height: ${wrapperHeight}px;\"\n >\n <svg\n class=\"canvas\"\n height=\"100%\"\n width=\"100%\"\n viewBox=${svgViewBox}\n >\n <defs>\n <pattern\n id=\"canvas-background\"\n patternUnits=\"userSpaceOnUse\"\n width=${this.gap}\n height=${this.gap}\n >\n <circle cx=\"1\" cy=\"1\" r=${dotRadius} />\n </pattern>\n\n <marker\n id=\"endarrow\"\n markerWidth=\"15\"\n markerHeight=\"22.5\"\n refX=\"9\"\n refY=\"15\"\n markerUnits=\"userSpaceOnUse\"\n orient=\"auto\"\n >\n <polyline points=\"0 22.5, 7.5 15, 0 7.5\"></polyline>\n </marker>\n </defs>\n\n <rect\n x=${computedViewBox.x * this.gap}\n y=${computedViewBox.y * this.gap}\n width=\"100%\"\n height=\"100%\"\n fill=\"url(#canvas-background)\"\n />\n\n ${shapes}\n </svg>\n </div>\n `;\n }\n}\n"],"names":["LitElement","svg","w","classMap","nothing","html","styles","property"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsEA;;;;;;;;;;;;;;;;;;;;;AAqBG;AAEI,IAAM,MAAM,GAAA,QAAA,GAAZ,MAAM,MAAO,SAAQA,GAAU,CAAA;AAA/B,IAAA,WAAA,GAAA;;AAGL;;AAEG;QAEH,IAAA,CAAA,MAAM,GAAkB,EAAE;AAE1B;;AAEG;QAEH,IAAA,CAAA,OAAO,GAAW,CAAC;AAEnB;;AAEG;QAEH,IAAA,CAAA,IAAI,GAAW,CAAC;QAQR,IAAA,CAAA,QAAQ,GAAW,CAAC;AAEpB,QAAA,IAAA,CAAA,GAAG,GAAW,IAAI,CAAC,QAAQ,GAAG,EAAE;IA4Q1C;AA1QU,IAAA,OAAO,YAAY,CACzB,KAAkB,EAClB,SAA0B,EAC1B,MAAc,EAAA;QAEd,IAAI,SAAS,KAAK,MAAM;AAAE,YAAA,OAAO,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,MAAM,EAAE;QACpE,IAAI,SAAS,KAAK,IAAI;AAAE,YAAA,OAAO,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,GA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AM,CAySlB;;;;"}
|
package/dist/card.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { a as i,
|
|
1
|
+
import { a as i, i as i$1, A, c as __classPrivateFieldGet, b, _ as __decorate, I as IndividualComponent } from './IndividualComponent-DUINtMGK.js';
|
|
2
2
|
import { n } from './property-1psGvXOq.js';
|
|
3
3
|
import { r } from './state-DwbEjqVk.js';
|
|
4
|
-
import { e } from './query-QBcUV-L_.js';
|
|
5
|
-
import { e
|
|
4
|
+
import { e as e$1 } from './query-QBcUV-L_.js';
|
|
5
|
+
import { e } from './class-map-YU7g0o3B.js';
|
|
6
6
|
import { i as isActivationClick, d as dispatchActivationClick } from './dispatch-event-utils-CuEqjlPT.js';
|
|
7
7
|
import { o as observerSlotChangesWithCallback } from './observe-slot-change-BGJfgg2E.js';
|
|
8
|
-
import { t as throttle } from './
|
|
8
|
+
import { B as BaseHyperlinkMixin, t as throttle } from './BaseHyperlinkMixin-BNuwbiEf.js';
|
|
9
9
|
import './directive-ZPhl09Yt.js';
|
|
10
10
|
|
|
11
11
|
var css_248z$1 = i`* {
|
|
@@ -229,7 +229,7 @@ var css_248z = i`:host {
|
|
|
229
229
|
--outlined-card-label-text-color: var(--color-on-surface);
|
|
230
230
|
}`;
|
|
231
231
|
|
|
232
|
-
var _Card_id, _Card_tabindex
|
|
232
|
+
var _Card_id, _Card_tabindex;
|
|
233
233
|
/**
|
|
234
234
|
* @label Card
|
|
235
235
|
* @tag wc-card
|
|
@@ -247,7 +247,7 @@ var _Card_id, _Card_tabindex, _Card_slottedTabIndexMap;
|
|
|
247
247
|
* </wc-card>
|
|
248
248
|
* ```
|
|
249
249
|
*/
|
|
250
|
-
let Card = class Card extends i$1 {
|
|
250
|
+
let Card = class Card extends BaseHyperlinkMixin(i$1) {
|
|
251
251
|
constructor() {
|
|
252
252
|
super(...arguments);
|
|
253
253
|
_Card_id.set(this, crypto.randomUUID());
|
|
@@ -258,10 +258,6 @@ let Card = class Card extends i$1 {
|
|
|
258
258
|
* If button is disabled, the reason why it is disabled.
|
|
259
259
|
*/
|
|
260
260
|
this.disabledReason = '';
|
|
261
|
-
/**
|
|
262
|
-
* Sets or retrieves the window or frame at which to target content.
|
|
263
|
-
*/
|
|
264
|
-
this.target = '_self';
|
|
265
261
|
/**
|
|
266
262
|
* Sets the delay for throttle in milliseconds. Defaults to 200 milliseconds.
|
|
267
263
|
*/
|
|
@@ -272,7 +268,6 @@ let Card = class Card extends i$1 {
|
|
|
272
268
|
this.isPressed = false;
|
|
273
269
|
this.slotHasContent = false;
|
|
274
270
|
_Card_tabindex.set(this, 0);
|
|
275
|
-
_Card_slottedTabIndexMap.set(this, new WeakMap());
|
|
276
271
|
this.__dispatchClickWithThrottle = event => {
|
|
277
272
|
this.__dispatchClick(event);
|
|
278
273
|
};
|
|
@@ -311,49 +306,8 @@ let Card = class Card extends i$1 {
|
|
|
311
306
|
this.__dispatchClickWithThrottle = throttle(this.__dispatchClick, this.throttleDelay);
|
|
312
307
|
observerSlotChangesWithCallback(this.renderRoot.querySelector('slot'), hasContent => {
|
|
313
308
|
this.slotHasContent = hasContent;
|
|
314
|
-
this.__syncSlottedChildrenTabIndex();
|
|
315
309
|
this.requestUpdate();
|
|
316
310
|
});
|
|
317
|
-
this.__syncSlottedChildrenTabIndex();
|
|
318
|
-
}
|
|
319
|
-
updated(changedProperties) {
|
|
320
|
-
if (changedProperties.has('actionable') || changedProperties.has('href')) {
|
|
321
|
-
this.__syncSlottedChildrenTabIndex();
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
__syncSlottedChildrenTabIndex() {
|
|
325
|
-
if (!this.contentSlot)
|
|
326
|
-
return;
|
|
327
|
-
const shouldDisableTabbing = this.actionable || this.__isLink();
|
|
328
|
-
const assignedChildren = this.contentSlot.assignedElements({ flatten: true });
|
|
329
|
-
assignedChildren.forEach(node => {
|
|
330
|
-
if (!(node instanceof HTMLElement))
|
|
331
|
-
return;
|
|
332
|
-
if (shouldDisableTabbing) {
|
|
333
|
-
if (!__classPrivateFieldGet(this, _Card_slottedTabIndexMap, "f").has(node)) {
|
|
334
|
-
__classPrivateFieldGet(this, _Card_slottedTabIndexMap, "f").set(node, node.getAttribute('tabindex'));
|
|
335
|
-
}
|
|
336
|
-
if (node.getAttribute('tabindex') !== '-1') {
|
|
337
|
-
node.setAttribute('tabindex', '-1');
|
|
338
|
-
}
|
|
339
|
-
return;
|
|
340
|
-
}
|
|
341
|
-
const originalTabIndex = __classPrivateFieldGet(this, _Card_slottedTabIndexMap, "f").get(node);
|
|
342
|
-
if (originalTabIndex === null) {
|
|
343
|
-
if (node.hasAttribute('tabindex')) {
|
|
344
|
-
node.removeAttribute('tabindex');
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
else if (originalTabIndex !== undefined) {
|
|
348
|
-
if (node.getAttribute('tabindex') !== originalTabIndex) {
|
|
349
|
-
node.setAttribute('tabindex', originalTabIndex);
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
__classPrivateFieldGet(this, _Card_slottedTabIndexMap, "f").delete(node);
|
|
353
|
-
});
|
|
354
|
-
}
|
|
355
|
-
__isLink() {
|
|
356
|
-
return !!this.href;
|
|
357
311
|
}
|
|
358
312
|
__getDisabledReasonID() {
|
|
359
313
|
return this.disabled && this.disabledReason
|
|
@@ -375,6 +329,7 @@ let Card = class Card extends i$1 {
|
|
|
375
329
|
}
|
|
376
330
|
render() {
|
|
377
331
|
const isLink = this.__isLink();
|
|
332
|
+
const disableSlotTabbing = this.actionable || isLink;
|
|
378
333
|
const cssClasses = {
|
|
379
334
|
card: true,
|
|
380
335
|
'card-element': true,
|
|
@@ -386,15 +341,15 @@ let Card = class Card extends i$1 {
|
|
|
386
341
|
};
|
|
387
342
|
if (!this.actionable && !isLink) {
|
|
388
343
|
return b `<div
|
|
389
|
-
class=${e
|
|
344
|
+
class=${e(cssClasses)}
|
|
390
345
|
id="card"
|
|
391
346
|
>
|
|
392
|
-
${this.renderCardContent()}
|
|
347
|
+
${this.renderCardContent(disableSlotTabbing)}
|
|
393
348
|
</div>`;
|
|
394
349
|
}
|
|
395
350
|
if (!isLink) {
|
|
396
351
|
return b `<button
|
|
397
|
-
class=${e
|
|
352
|
+
class=${e(cssClasses)}
|
|
398
353
|
id="card"
|
|
399
354
|
tabindex=${__classPrivateFieldGet(this, _Card_tabindex, "f")}
|
|
400
355
|
@click=${this.__dispatchClickWithThrottle}
|
|
@@ -405,11 +360,11 @@ let Card = class Card extends i$1 {
|
|
|
405
360
|
aria-disabled=${`${this.disabled}`}
|
|
406
361
|
?disabled=${this.disabled}
|
|
407
362
|
>
|
|
408
|
-
${this.renderCardContent()}
|
|
363
|
+
${this.renderCardContent(disableSlotTabbing)}
|
|
409
364
|
</button>`;
|
|
410
365
|
}
|
|
411
366
|
return b `<a
|
|
412
|
-
class=${e
|
|
367
|
+
class=${e(cssClasses)}
|
|
413
368
|
id="card"
|
|
414
369
|
tabindex=${__classPrivateFieldGet(this, _Card_tabindex, "f")}
|
|
415
370
|
href=${this.href}
|
|
@@ -422,12 +377,12 @@ let Card = class Card extends i$1 {
|
|
|
422
377
|
?aria-describedby=${this.__getDisabledReasonID()}
|
|
423
378
|
aria-disabled=${`${this.disabled}`}
|
|
424
379
|
>
|
|
425
|
-
${this.renderCardContent()}
|
|
380
|
+
${this.renderCardContent(disableSlotTabbing)}
|
|
426
381
|
</a>`;
|
|
427
382
|
}
|
|
428
|
-
renderCardContent() {
|
|
383
|
+
renderCardContent(disableSlotTabbing) {
|
|
429
384
|
return b `
|
|
430
|
-
|
|
385
|
+
<wc-focus-ring class="focus-ring" for='card'></wc-focus-ring>
|
|
431
386
|
<wc-elevation class="elevation"></wc-elevation>
|
|
432
387
|
<div class="background"></div>
|
|
433
388
|
<div class="outline"></div>
|
|
@@ -435,8 +390,8 @@ let Card = class Card extends i$1 {
|
|
|
435
390
|
|
|
436
391
|
<div class="card-content">
|
|
437
392
|
|
|
438
|
-
<div class="slot-container">
|
|
439
|
-
<slot
|
|
393
|
+
<div class="slot-container" ?inert=${disableSlotTabbing}>
|
|
394
|
+
<slot></slot>
|
|
440
395
|
</div>
|
|
441
396
|
|
|
442
397
|
</div>
|
|
@@ -445,7 +400,6 @@ let Card = class Card extends i$1 {
|
|
|
445
400
|
};
|
|
446
401
|
_Card_id = new WeakMap();
|
|
447
402
|
_Card_tabindex = new WeakMap();
|
|
448
|
-
_Card_slottedTabIndexMap = new WeakMap();
|
|
449
403
|
Card.styles = [css_248z$1, css_248z];
|
|
450
404
|
__decorate([
|
|
451
405
|
n({ type: String, reflect: true })
|
|
@@ -459,12 +413,6 @@ __decorate([
|
|
|
459
413
|
__decorate([
|
|
460
414
|
n({ attribute: 'disabled-reason' })
|
|
461
415
|
], Card.prototype, "disabledReason", void 0);
|
|
462
|
-
__decorate([
|
|
463
|
-
n({ reflect: true })
|
|
464
|
-
], Card.prototype, "href", void 0);
|
|
465
|
-
__decorate([
|
|
466
|
-
n()
|
|
467
|
-
], Card.prototype, "target", void 0);
|
|
468
416
|
__decorate([
|
|
469
417
|
n()
|
|
470
418
|
], Card.prototype, "throttleDelay", void 0);
|
|
@@ -475,11 +423,8 @@ __decorate([
|
|
|
475
423
|
r()
|
|
476
424
|
], Card.prototype, "slotHasContent", void 0);
|
|
477
425
|
__decorate([
|
|
478
|
-
e('.card')
|
|
426
|
+
e$1('.card')
|
|
479
427
|
], Card.prototype, "cardElement", void 0);
|
|
480
|
-
__decorate([
|
|
481
|
-
e('slot')
|
|
482
|
-
], Card.prototype, "contentSlot", void 0);
|
|
483
428
|
Card = __decorate([
|
|
484
429
|
IndividualComponent
|
|
485
430
|
], Card);
|