@redvars/peacock 3.5.1 → 3.6.1
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-DuASuVth.js → BaseButton-BNFAYn-S.js} +2 -2
- package/dist/{BaseButton-DuASuVth.js.map → BaseButton-BNFAYn-S.js.map} +1 -1
- package/dist/BaseInput-14YmcfK7.js +27 -0
- package/dist/BaseInput-14YmcfK7.js.map +1 -0
- package/dist/banner.js +2 -3
- package/dist/banner.js.map +1 -1
- package/dist/{button-DouvOfEU.js → button-colors-Ccys3hvS.js} +5 -294
- package/dist/button-colors-Ccys3hvS.js.map +1 -0
- package/dist/button-group.js +226 -6
- 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/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/code-editor.js +2 -1
- package/dist/code-editor.js.map +1 -1
- package/dist/code-highlighter.js +1 -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 +8479 -3965
- package/dist/custom-elements.json +15228 -7544
- 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 +1 -1
- package/dist/flow-designer-DvTUrDp5.js +1656 -0
- package/dist/flow-designer-DvTUrDp5.js.map +1 -0
- package/dist/flow-designer-node-BWrPuxAR.js +548 -0
- package/dist/flow-designer-node-BWrPuxAR.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 +27516 -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 +29 -6
- 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 +412 -0
- package/dist/modal.js.map +1 -0
- package/dist/{navigation-rail-Lxetd5-Z.js → navigation-rail-DTTkqohi.js} +1049 -2391
- package/dist/navigation-rail-DTTkqohi.js.map +1 -0
- package/dist/notification-manager.js +268 -0
- package/dist/notification-manager.js.map +1 -0
- package/dist/peacock-loader.js +93 -8
- 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/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/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/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/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/html-editor/html-editor.d.ts +89 -0
- package/dist/src/html-editor/index.d.ts +2 -0
- package/dist/src/index.d.ts +15 -0
- package/dist/src/list/index.d.ts +2 -0
- package/dist/src/list/list-item.d.ts +35 -0
- package/dist/src/list/list.d.ts +28 -0
- 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 +57 -0
- package/dist/src/navigation-rail/navigation-rail.d.ts +3 -7
- package/dist/src/notification-manager/index.d.ts +1 -0
- package/dist/src/notification-manager/notification-manager.d.ts +44 -0
- package/dist/src/number-field/number-field.d.ts +2 -2
- 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/split-button/index.d.ts +1 -0
- package/dist/src/split-button/split-button.d.ts +72 -0
- package/dist/src/svg/index.d.ts +1 -0
- package/dist/src/svg/svg.d.ts +38 -0
- package/dist/src/toolbar/toolbar.d.ts +3 -3
- package/dist/src/tooltip/tooltip.d.ts +2 -15
- package/dist/test/flow-designer.test.d.ts +1 -0
- package/dist/toolbar.js +3 -3
- package/dist/toolbar.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -2
- package/readme.md +3 -3
- package/src/__controllers/floating-controller.ts +237 -0
- package/src/banner/banner.scss +2 -3
- package/src/button/button/button.ts +1 -0
- 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/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/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/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/html-editor/html-editor.scss +188 -0
- package/src/html-editor/html-editor.ts +491 -0
- package/src/html-editor/index.ts +3 -0
- package/src/index.ts +27 -1
- package/src/list/index.ts +2 -0
- package/src/list/list-item.scss +111 -0
- package/src/list/list-item.ts +175 -0
- package/src/list/list.scss +24 -0
- package/src/list/list.ts +51 -0
- 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 +82 -78
- package/src/modal/index.ts +1 -0
- package/src/modal/modal.scss +206 -0
- package/src/modal/modal.ts +195 -0
- package/src/navigation-rail/navigation-rail-item.scss +7 -38
- package/src/navigation-rail/navigation-rail-item.ts +1 -2
- package/src/navigation-rail/navigation-rail.scss +17 -21
- package/src/navigation-rail/navigation-rail.ts +6 -9
- 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 +2 -2
- package/src/peacock-loader.ts +83 -0
- 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/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/svg/index.ts +1 -0
- package/src/svg/svg.scss +91 -0
- package/src/svg/svg.ts +160 -0
- package/src/table/table.ts +2 -2
- package/src/toolbar/toolbar.ts +3 -3
- package/src/tooltip/tooltip.scss +4 -3
- package/src/tooltip/tooltip.ts +46 -104
- package/dist/button-DouvOfEU.js.map +0 -1
- package/dist/button-group-CEdMwvJJ.js +0 -464
- package/dist/button-group-CEdMwvJJ.js.map +0 -1
- package/dist/is-dark-mode-DicqGkCJ.js.map +0 -1
- package/dist/navigation-rail-Lxetd5-Z.js.map +0 -1
- package/dist/src/menu/menu/MenuSurfaceController.d.ts +0 -18
- package/src/menu/menu/MenuSurfaceController.ts +0 -61
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,GAAG,MAAM,EAAE;QAClE,IAAI,SAAS,KAAK,MAAM;AAAE,YAAA,OAAO,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE;QACpE,IAAI,SAAS,KAAK,OAAO;AAAE,YAAA,OAAO,E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eAAe,aAAa,CAAA;;;;;;oBAM5C,UAAU;;;;;;AAMR,oBAAA,EAAA,IAAI,CAAC,GAAG;AACP,qBAAA,EAAA,IAAI,CAAC,GAAG;;wCAES,SAAS,CAAA;;;;;;;;;;;;;;;;;AAiBjC,cAAA,EAAA,eAAe,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG;AAC5B,cAAA,EAAA,eAAe,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG;;;;;;YAMhC,MAAM;;;KAGb;IACH;;AAvSO,MAAA,CAAA,MAAM,GAAG,CAACC,QAAM,CAAC;AAMxB,UAAA,CAAA;AADC,IAAAC,CAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE;AACE,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,QAAA,EAAA,MAAA,CAAA;AAM3B,UAAA,CAAA;IADCA,CAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE;AACrB,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,SAAA,EAAA,MAAA,CAAA;AAMpB,UAAA,CAAA;IADCA,CAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE;AACxB,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,MAAA,EAAA,MAAA,CAAA;AAMjB,UAAA,CAAA;AADC,IAAAA,CAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE;AACT,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,SAAA,EAAA,MAAA,CAAA;AAzBN,MAAM,GAAA,QAAA,GAAA,UAAA,CAAA;IADlB;AACY,CAAA,EAAA,MAAM,CAySlB;;;;"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { a as i, _ as __decorate, I as IndividualComponent, i as i$1, A, b } from './IndividualComponent-DUINtMGK.js';
|
|
2
|
+
import { n } from './property-1psGvXOq.js';
|
|
3
|
+
|
|
4
|
+
var css_248z = i`* {
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.screen-reader-only {
|
|
9
|
+
display: none !important;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
:host {
|
|
13
|
+
display: block;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.compound-expression {
|
|
17
|
+
display: flex;
|
|
18
|
+
padding-top: var(--spacing-200);
|
|
19
|
+
}
|
|
20
|
+
.compound-expression .field-name-container {
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
padding-top: var(--spacing-100);
|
|
24
|
+
padding-right: var(--spacing-200);
|
|
25
|
+
}
|
|
26
|
+
.compound-expression .field-name-container .field-label {
|
|
27
|
+
font-family: var(--typography-label-medium-font-family);
|
|
28
|
+
font-size: var(--typography-label-medium-font-size);
|
|
29
|
+
font-weight: var(--typography-label-medium-font-weight);
|
|
30
|
+
line-height: var(--typography-label-medium-line-height);
|
|
31
|
+
letter-spacing: var(--typography-label-medium-letter-spacing);
|
|
32
|
+
color: var(--color-on-surface-variant);
|
|
33
|
+
}
|
|
34
|
+
.compound-expression .field-name-container .field-compound-type {
|
|
35
|
+
flex: 1;
|
|
36
|
+
padding-bottom: var(--spacing-250);
|
|
37
|
+
}
|
|
38
|
+
.compound-expression .conditions {
|
|
39
|
+
flex: 1;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.slot-end {
|
|
43
|
+
display: block;
|
|
44
|
+
}`;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @label CB Compound Expression
|
|
48
|
+
* @tag wc-cb-compound-expression
|
|
49
|
+
* @rawTag cb-compound-expression
|
|
50
|
+
* @summary A compound expression group in a condition builder that displays a field label, an optional condition operator divider, and slots for child expressions.
|
|
51
|
+
* @tags condition-builder
|
|
52
|
+
* @parentRawTag compound-builder
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```html
|
|
56
|
+
* <wc-cb-compound-expression field-label="Age" condition-operator="or">
|
|
57
|
+
* <wc-cb-expression>
|
|
58
|
+
* <wc-input placeholder="Enter value"></wc-input>
|
|
59
|
+
* </wc-cb-expression>
|
|
60
|
+
* </wc-cb-compound-expression>
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
let CbCompoundExpression = class CbCompoundExpression extends i$1 {
|
|
64
|
+
constructor() {
|
|
65
|
+
super(...arguments);
|
|
66
|
+
/** The field name for the compound expression. */
|
|
67
|
+
this.fieldName = '';
|
|
68
|
+
/** The display label for the field. */
|
|
69
|
+
this.fieldLabel = '';
|
|
70
|
+
}
|
|
71
|
+
updated() {
|
|
72
|
+
this.__adjustSlotEndPadding();
|
|
73
|
+
}
|
|
74
|
+
__adjustSlotEndPadding() {
|
|
75
|
+
const slotEnd = this.renderRoot.querySelector('.slot-end');
|
|
76
|
+
const fieldNameContainer = this.renderRoot.querySelector('.field-name-container');
|
|
77
|
+
if (slotEnd && fieldNameContainer) {
|
|
78
|
+
slotEnd.style.paddingInlineStart =
|
|
79
|
+
fieldNameContainer.getBoundingClientRect().width + 'px';
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
__renderOperatorDivider() {
|
|
83
|
+
if (!this.conditionOperator)
|
|
84
|
+
return A;
|
|
85
|
+
return b `
|
|
86
|
+
<wc-cb-divider connect-end>
|
|
87
|
+
<wc-tag color="yellow" size="sm">${this.conditionOperator}</wc-tag>
|
|
88
|
+
</wc-cb-divider>
|
|
89
|
+
`;
|
|
90
|
+
}
|
|
91
|
+
render() {
|
|
92
|
+
return b `
|
|
93
|
+
<div class="compound-expression" field-name=${this.fieldName}>
|
|
94
|
+
<div class="field-name-container">
|
|
95
|
+
<span class="field-label">${this.fieldLabel}</span>
|
|
96
|
+
<div class="field-compound-type">
|
|
97
|
+
${this.__renderOperatorDivider()}
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
<div class="conditions">
|
|
101
|
+
<slot></slot>
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
<div class="slot-end">
|
|
105
|
+
<slot name="end"></slot>
|
|
106
|
+
</div>
|
|
107
|
+
`;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
CbCompoundExpression.styles = [css_248z];
|
|
111
|
+
__decorate([
|
|
112
|
+
n({ type: String, attribute: 'condition-operator', reflect: true })
|
|
113
|
+
], CbCompoundExpression.prototype, "conditionOperator", void 0);
|
|
114
|
+
__decorate([
|
|
115
|
+
n({ type: String, attribute: 'field-name' })
|
|
116
|
+
], CbCompoundExpression.prototype, "fieldName", void 0);
|
|
117
|
+
__decorate([
|
|
118
|
+
n({ type: String, attribute: 'field-label' })
|
|
119
|
+
], CbCompoundExpression.prototype, "fieldLabel", void 0);
|
|
120
|
+
CbCompoundExpression = __decorate([
|
|
121
|
+
IndividualComponent
|
|
122
|
+
], CbCompoundExpression);
|
|
123
|
+
|
|
124
|
+
export { CbCompoundExpression };
|
|
125
|
+
//# sourceMappingURL=cb-compound-expression.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cb-compound-expression.js","sources":["../../src/condition-builder/cb-compound-expression.ts"],"sourcesContent":["import { html, LitElement, nothing } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport IndividualComponent from '@/IndividualComponent.js';\nimport styles from './cb-compound-expression.scss';\n\n/**\n * @label CB Compound Expression\n * @tag wc-cb-compound-expression\n * @rawTag cb-compound-expression\n * @summary A compound expression group in a condition builder that displays a field label, an optional condition operator divider, and slots for child expressions.\n * @tags condition-builder\n * @parentRawTag compound-builder\n *\n * @example\n * ```html\n * <wc-cb-compound-expression field-label=\"Age\" condition-operator=\"or\">\n * <wc-cb-expression>\n * <wc-input placeholder=\"Enter value\"></wc-input>\n * </wc-cb-expression>\n * </wc-cb-compound-expression>\n * ```\n */\n@IndividualComponent\nexport class CbCompoundExpression extends LitElement {\n static styles = [styles];\n\n /** The logical operator joining conditions in this group ('and' or 'or'). */\n @property({ type: String, attribute: 'condition-operator', reflect: true })\n conditionOperator?: 'and' | 'or';\n\n /** The field name for the compound expression. */\n @property({ type: String, attribute: 'field-name' })\n fieldName = '';\n\n /** The display label for the field. */\n @property({ type: String, attribute: 'field-label' })\n fieldLabel = '';\n\n override updated() {\n this.__adjustSlotEndPadding();\n }\n\n private __adjustSlotEndPadding() {\n const slotEnd = this.renderRoot.querySelector<HTMLElement>('.slot-end');\n const fieldNameContainer =\n this.renderRoot.querySelector<HTMLElement>('.field-name-container');\n if (slotEnd && fieldNameContainer) {\n slotEnd.style.paddingInlineStart =\n fieldNameContainer.getBoundingClientRect().width + 'px';\n }\n }\n\n private __renderOperatorDivider() {\n if (!this.conditionOperator) return nothing;\n return html`\n <wc-cb-divider connect-end>\n <wc-tag color=\"yellow\" size=\"sm\">${this.conditionOperator}</wc-tag>\n </wc-cb-divider>\n `;\n }\n\n render() {\n return html`\n <div class=\"compound-expression\" field-name=${this.fieldName}>\n <div class=\"field-name-container\">\n <span class=\"field-label\">${this.fieldLabel}</span>\n <div class=\"field-compound-type\">\n ${this.__renderOperatorDivider()}\n </div>\n </div>\n <div class=\"conditions\">\n <slot></slot>\n </div>\n </div>\n <div class=\"slot-end\">\n <slot name=\"end\"></slot>\n </div>\n `;\n }\n}\n"],"names":["LitElement","nothing","html","styles","property"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA;;;;;;;;;;;;;;;;AAgBG;AAEI,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQA,GAAU,CAAA;AAA7C,IAAA,WAAA,GAAA;;;QASL,IAAA,CAAA,SAAS,GAAG,EAAE;;QAId,IAAA,CAAA,UAAU,GAAG,EAAE;IA2CjB;IAzCW,OAAO,GAAA;QACd,IAAI,CAAC,sBAAsB,EAAE;IAC/B;IAEQ,sBAAsB,GAAA;QAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAc,WAAW,CAAC;QACvE,MAAM,kBAAkB,GACtB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