@iyulab/chat-components 0.4.0 → 0.5.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/CHANGELOG.md +83 -52
- package/README.md +133 -16
- package/dist/_virtual/_@oxc-project_runtime@0.124.0/helpers/decorate.js +9 -0
- package/dist/_virtual/_@oxc-project_runtime@0.124.0/helpers/decorateMetadata.js +6 -0
- package/dist/_virtual/_glob-assets_raw/intent-prompt.md.1907474e.js +4 -0
- package/dist/_virtual/_glob-assets_raw/view-prompt.md.e0dbcffe.js +4 -0
- package/dist/components/blocks/UCodeBlock.d.ts +24 -2
- package/dist/components/blocks/UCodeBlock.js +65 -2
- package/dist/components/blocks/UCodeBlock.styles.js +4 -4
- package/dist/components/blocks/UFileBlock.d.ts +33 -0
- package/dist/components/blocks/UFileBlock.js +154 -0
- package/dist/components/blocks/{UFilesBlock.styles.js → UFileBlock.styles.js} +12 -90
- package/dist/components/blocks/UJsonBlock.d.ts +44 -2
- package/dist/components/blocks/UJsonBlock.js +128 -3
- package/dist/components/blocks/UJsonBlock.styles.js +4 -4
- package/dist/components/blocks/UMarkedBlock.d.ts +44 -2
- package/dist/components/blocks/UMarkedBlock.js +154 -4
- package/dist/components/blocks/UMarkedBlock.styles.js +4 -4
- package/dist/components/blocks/URefBlock.d.ts +16 -2
- package/dist/components/blocks/URefBlock.js +58 -3
- package/dist/components/blocks/URefBlock.styles.js +4 -4
- package/dist/components/blocks/UTableBlock.d.ts +47 -2
- package/dist/components/blocks/UTableBlock.js +197 -4
- package/dist/components/blocks/UTableBlock.styles.js +4 -5
- package/dist/components/blocks/UTextBlock.d.ts +36 -2
- package/dist/components/blocks/UTextBlock.js +94 -4
- package/dist/components/blocks/UTextBlock.styles.js +4 -4
- package/dist/components/blocks/UThinkBlock.d.ts +30 -2
- package/dist/components/blocks/UThinkBlock.js +86 -4
- package/dist/components/blocks/UThinkBlock.styles.js +4 -4
- package/dist/components/blocks/UToolBlock.d.ts +19 -2
- package/dist/components/blocks/UToolBlock.js +68 -3
- package/dist/components/blocks/UToolBlock.styles.js +4 -4
- package/dist/components/buttons/UAttachButton.d.ts +21 -2
- package/dist/components/buttons/UAttachButton.js +61 -3
- package/dist/components/buttons/UAttachButton.styles.js +4 -4
- package/dist/components/buttons/UCopyButton.d.ts +19 -2
- package/dist/components/buttons/UCopyButton.js +57 -3
- package/dist/components/buttons/UCopyButton.styles.js +4 -4
- package/dist/components/buttons/UVoteButton.d.ts +14 -3
- package/dist/components/buttons/UVoteButton.js +62 -3
- package/dist/components/buttons/UVoteButton.styles.js +4 -4
- package/dist/components/{actions/UQuestionAction.component.d.ts → intents/UQuestionIntent.d.ts} +6 -2
- package/dist/components/intents/UQuestionIntent.js +41 -0
- package/dist/components/{actions/UQuestionAction.styles.js → intents/UQuestionIntent.styles.js} +4 -6
- package/dist/components/message/UMessage.d.ts +18 -2
- package/dist/components/message/UMessage.js +47 -2
- package/dist/components/message/UMessage.styles.js +4 -4
- package/dist/components/prompt/UPrompt.d.ts +37 -2
- package/dist/components/prompt/UPrompt.js +139 -2
- package/dist/components/prompt/UPrompt.styles.js +15 -5
- package/dist/components/references/URefCard.d.ts +30 -2
- package/dist/components/references/URefCard.js +97 -2
- package/dist/components/references/URefCard.styles.js +4 -4
- package/dist/components/references/URefCardGroup.d.ts +25 -2
- package/dist/components/references/URefCardGroup.js +69 -4
- package/dist/components/references/URefCardGroup.styles.js +4 -4
- package/dist/components/references/URefTag.d.ts +12 -2
- package/dist/components/references/URefTag.js +37 -2
- package/dist/components/references/URefTag.styles.js +4 -4
- package/dist/components/{widgets/UChartWidget.component.d.ts → views/UChartView.d.ts} +7 -4
- package/dist/components/views/UChartView.js +167 -0
- package/dist/components/{widgets/UChartWidget.styles.js → views/UChartView.styles.js} +4 -4
- package/dist/components/{widgets/UImagesWidget.component.d.ts → views/UImagesView.d.ts} +7 -4
- package/dist/components/views/UImagesView.js +144 -0
- package/dist/components/{widgets/UImagesWidget.styles.js → views/UImagesView.styles.js} +6 -5
- package/dist/components/{widgets/UMapWidget.component.d.ts → views/UMapView.d.ts} +7 -3
- package/dist/components/views/UMapView.js +45 -0
- package/dist/components/{widgets/UMapWidget.styles.js → views/UMapView.styles.js} +4 -4
- package/dist/components/{widgets/UVideoWidget.component.d.ts → views/UVideoView.d.ts} +7 -3
- package/dist/components/views/UVideoView.js +81 -0
- package/dist/components/{widgets/UVideoWidget.styles.js → views/UVideoView.styles.js} +4 -4
- package/dist/components/{widgets/UWidget.component.d.ts → views/UView.d.ts} +8 -5
- package/dist/components/views/UView.js +113 -0
- package/dist/components/{widgets/UWidget.styles.js → views/UView.styles.js} +4 -4
- package/dist/events/AttachEvent.d.ts +9 -0
- package/dist/events/ChoiceEvent.d.ts +9 -0
- package/dist/events/SendEvent.d.ts +21 -0
- package/dist/events/StopEvent.d.ts +17 -0
- package/dist/index.d.ts +13 -16
- package/dist/index.js +28 -56
- package/dist/react/UAttachButton.d.ts +11 -0
- package/dist/react/UAttachButton.js +12 -0
- package/dist/react/UChartView.d.ts +9 -0
- package/dist/react/UChartView.js +10 -0
- package/dist/react/UCodeBlock.d.ts +9 -0
- package/dist/react/UCodeBlock.js +10 -0
- package/dist/react/UCopyButton.d.ts +9 -0
- package/dist/react/UCopyButton.js +10 -0
- package/dist/react/UFileBlock.d.ts +11 -0
- package/dist/react/UFileBlock.js +12 -0
- package/dist/react/UImagesView.d.ts +9 -0
- package/dist/react/UImagesView.js +10 -0
- package/dist/react/UJsonBlock.d.ts +9 -0
- package/dist/react/UJsonBlock.js +10 -0
- package/dist/react/UMapView.d.ts +9 -0
- package/dist/react/UMapView.js +10 -0
- package/dist/react/UMarkedBlock.d.ts +9 -0
- package/dist/react/UMarkedBlock.js +10 -0
- package/dist/react/UMessage.d.ts +9 -0
- package/dist/react/UMessage.js +10 -0
- package/dist/react/UPrompt.d.ts +13 -0
- package/dist/react/UPrompt.js +13 -0
- package/dist/react/UQuestionIntent.d.ts +11 -0
- package/dist/react/UQuestionIntent.js +12 -0
- package/dist/react/URefBlock.d.ts +9 -0
- package/dist/react/URefBlock.js +10 -0
- package/dist/react/URefCard.d.ts +9 -0
- package/dist/react/URefCard.js +10 -0
- package/dist/react/URefCardGroup.d.ts +9 -0
- package/dist/react/URefCardGroup.js +10 -0
- package/dist/react/URefTag.d.ts +9 -0
- package/dist/react/URefTag.js +10 -0
- package/dist/react/UTableBlock.d.ts +9 -0
- package/dist/react/UTableBlock.js +10 -0
- package/dist/react/UTextBlock.d.ts +9 -0
- package/dist/react/UTextBlock.js +10 -0
- package/dist/react/UThinkBlock.d.ts +9 -0
- package/dist/react/UThinkBlock.js +10 -0
- package/dist/react/UToolBlock.d.ts +9 -0
- package/dist/react/UToolBlock.js +10 -0
- package/dist/react/UVideoView.d.ts +9 -0
- package/dist/react/UVideoView.js +10 -0
- package/dist/react/UView.d.ts +9 -0
- package/dist/react/UView.js +10 -0
- package/dist/react/UVoteButton.d.ts +9 -0
- package/dist/react/UVoteButton.js +10 -0
- package/dist/react/index.d.ts +23 -0
- package/dist/react/index.js +23 -0
- package/dist/types/BlockItem.d.ts +21 -32
- package/dist/types/Intents.d.ts +26 -0
- package/dist/types/Intents.js +30 -0
- package/dist/types/{Widgets.d.ts → Views.d.ts} +8 -8
- package/dist/types/Views.js +150 -0
- package/dist/utilities/IntentPromptBuilder.d.ts +40 -0
- package/dist/utilities/IntentPromptBuilder.js +95 -0
- package/dist/utilities/ViewPromptBuilder.d.ts +28 -0
- package/dist/utilities/ViewPromptBuilder.js +76 -0
- package/dist/utilities/dom-agent/DOMAgent.d.ts +74 -0
- package/dist/utilities/dom-agent/DOMController.d.ts +78 -0
- package/dist/utilities/dom-agent/DOMPromptBuilder.d.ts +54 -0
- package/dist/utilities/dom-agent/DOMScanner.d.ts +83 -0
- package/dist/utilities/dom-agent/index.d.ts +9 -0
- package/dist/utilities/dom-agent/types.d.ts +209 -0
- package/package.json +33 -16
- package/skills/iyulab-chat-components/SKILL.md +107 -0
- package/skills/iyulab-chat-components/references/components/attach-button.md +69 -0
- package/skills/iyulab-chat-components/references/components/chart-view.md +65 -0
- package/skills/iyulab-chat-components/references/components/code-block.md +42 -0
- package/skills/iyulab-chat-components/references/components/copy-button.md +46 -0
- package/skills/iyulab-chat-components/references/components/file-block.md +64 -0
- package/skills/iyulab-chat-components/references/components/images-view.md +63 -0
- package/skills/iyulab-chat-components/references/components/json-block.md +41 -0
- package/skills/iyulab-chat-components/references/components/map-view.md +54 -0
- package/skills/iyulab-chat-components/references/components/marked-block.md +53 -0
- package/skills/iyulab-chat-components/references/components/message.md +60 -0
- package/skills/iyulab-chat-components/references/components/prompt.md +102 -0
- package/skills/iyulab-chat-components/references/components/question-intent.md +75 -0
- package/skills/iyulab-chat-components/references/components/ref-block.md +45 -0
- package/skills/iyulab-chat-components/references/components/ref-card-group.md +41 -0
- package/skills/iyulab-chat-components/references/components/ref-card.md +48 -0
- package/skills/iyulab-chat-components/references/components/ref-tag.md +40 -0
- package/skills/iyulab-chat-components/references/components/table-block.md +63 -0
- package/skills/iyulab-chat-components/references/components/text-block.md +59 -0
- package/skills/iyulab-chat-components/references/components/think-block.md +48 -0
- package/skills/iyulab-chat-components/references/components/tool-block.md +57 -0
- package/skills/iyulab-chat-components/references/components/video-view.md +55 -0
- package/skills/iyulab-chat-components/references/components/view.md +51 -0
- package/skills/iyulab-chat-components/references/components/vote-button.md +60 -0
- package/skills/iyulab-chat-components/references/types.md +115 -0
- package/skills/iyulab-chat-components/references/usage.md +254 -0
- package/skills/iyulab-chat-components/references/utilities/intent-prompt-builder.md +123 -0
- package/skills/iyulab-chat-components/references/utilities/view-prompt-builder.md +112 -0
- package/dist/assets/action-prompt.md.js +0 -3
- package/dist/assets/widget-prompt.md.js +0 -3
- package/dist/components/actions/UQuestionAction.component.js +0 -58
- package/dist/components/actions/UQuestionAction.d.ts +0 -7
- package/dist/components/actions/UQuestionAction.js +0 -5
- package/dist/components/blocks/UCodeBlock.component.d.ts +0 -25
- package/dist/components/blocks/UCodeBlock.component.js +0 -88
- package/dist/components/blocks/UFilesBlock.component.d.ts +0 -22
- package/dist/components/blocks/UFilesBlock.component.js +0 -192
- package/dist/components/blocks/UFilesBlock.d.ts +0 -7
- package/dist/components/blocks/UFilesBlock.js +0 -5
- package/dist/components/blocks/UJsonBlock.component.d.ts +0 -45
- package/dist/components/blocks/UJsonBlock.component.js +0 -140
- package/dist/components/blocks/UMarkedBlock.component.d.ts +0 -40
- package/dist/components/blocks/UMarkedBlock.component.js +0 -159
- package/dist/components/blocks/URefBlock.component.d.ts +0 -17
- package/dist/components/blocks/URefBlock.component.js +0 -73
- package/dist/components/blocks/UTableBlock.component.d.ts +0 -49
- package/dist/components/blocks/UTableBlock.component.js +0 -228
- package/dist/components/blocks/UTextBlock.component.d.ts +0 -37
- package/dist/components/blocks/UTextBlock.component.js +0 -123
- package/dist/components/blocks/UThinkBlock.component.d.ts +0 -23
- package/dist/components/blocks/UThinkBlock.component.js +0 -90
- package/dist/components/blocks/UToolBlock.component.d.ts +0 -20
- package/dist/components/blocks/UToolBlock.component.js +0 -80
- package/dist/components/buttons/UAttachButton.component.d.ts +0 -22
- package/dist/components/buttons/UAttachButton.component.js +0 -89
- package/dist/components/buttons/UCopyButton.component.d.ts +0 -20
- package/dist/components/buttons/UCopyButton.component.js +0 -81
- package/dist/components/buttons/UReportButton.component.d.ts +0 -9
- package/dist/components/buttons/UReportButton.component.js +0 -36
- package/dist/components/buttons/UReportButton.d.ts +0 -7
- package/dist/components/buttons/UReportButton.js +0 -5
- package/dist/components/buttons/UReportButton.styles.js +0 -14
- package/dist/components/buttons/URetryButton.component.d.ts +0 -11
- package/dist/components/buttons/URetryButton.component.js +0 -53
- package/dist/components/buttons/URetryButton.d.ts +0 -7
- package/dist/components/buttons/URetryButton.js +0 -5
- package/dist/components/buttons/URetryButton.styles.js +0 -26
- package/dist/components/buttons/UShareButton.component.d.ts +0 -9
- package/dist/components/buttons/UShareButton.component.js +0 -36
- package/dist/components/buttons/UShareButton.d.ts +0 -7
- package/dist/components/buttons/UShareButton.js +0 -5
- package/dist/components/buttons/UShareButton.styles.js +0 -14
- package/dist/components/buttons/UVoteButton.component.d.ts +0 -15
- package/dist/components/buttons/UVoteButton.component.js +0 -73
- package/dist/components/message/UMessage.component.d.ts +0 -19
- package/dist/components/message/UMessage.component.js +0 -56
- package/dist/components/prompt/UPrompt.component.d.ts +0 -25
- package/dist/components/prompt/UPrompt.component.js +0 -113
- package/dist/components/references/URefCard.component.d.ts +0 -27
- package/dist/components/references/URefCard.component.js +0 -109
- package/dist/components/references/URefCardGroup.component.d.ts +0 -26
- package/dist/components/references/URefCardGroup.component.js +0 -88
- package/dist/components/references/URefTag.component.d.ts +0 -13
- package/dist/components/references/URefTag.component.js +0 -54
- package/dist/components/widgets/UChartWidget.component.js +0 -180
- package/dist/components/widgets/UChartWidget.d.ts +0 -7
- package/dist/components/widgets/UChartWidget.js +0 -5
- package/dist/components/widgets/UImagesWidget.component.js +0 -164
- package/dist/components/widgets/UImagesWidget.d.ts +0 -7
- package/dist/components/widgets/UImagesWidget.js +0 -5
- package/dist/components/widgets/UMapWidget.component.js +0 -65
- package/dist/components/widgets/UMapWidget.d.ts +0 -7
- package/dist/components/widgets/UMapWidget.js +0 -5
- package/dist/components/widgets/UMapWidget.styles.d.ts +0 -1
- package/dist/components/widgets/UVideoWidget.component.js +0 -106
- package/dist/components/widgets/UVideoWidget.d.ts +0 -7
- package/dist/components/widgets/UVideoWidget.js +0 -5
- package/dist/components/widgets/UVideoWidget.styles.d.ts +0 -1
- package/dist/components/widgets/UWidget.component.js +0 -140
- package/dist/components/widgets/UWidget.d.ts +0 -7
- package/dist/components/widgets/UWidget.js +0 -5
- package/dist/components/widgets/UWidget.styles.d.ts +0 -1
- package/dist/events/UCancelEvent.d.ts +0 -6
- package/dist/events/USubmitEvent.d.ts +0 -6
- package/dist/types/Actions.d.ts +0 -24
- package/dist/types/Actions.js +0 -34
- package/dist/types/Widgets.js +0 -115
- package/dist/utilities/ActionPromptBuilder.d.ts +0 -40
- package/dist/utilities/ActionPromptBuilder.js +0 -93
- package/dist/utilities/WidgetPromptBuilder.d.ts +0 -28
- package/dist/utilities/WidgetPromptBuilder.js +0 -87
- package/dist/utilities/converters.d.ts +0 -9
- package/dist/utilities/converters.js +0 -19
- /package/dist/components/{actions/UQuestionAction.styles.d.ts → blocks/UFileBlock.styles.d.ts} +0 -0
- /package/dist/components/{blocks/UFilesBlock.styles.d.ts → intents/UQuestionIntent.styles.d.ts} +0 -0
- /package/dist/components/{buttons/UReportButton.styles.d.ts → views/UChartView.styles.d.ts} +0 -0
- /package/dist/components/{buttons/URetryButton.styles.d.ts → views/UImagesView.styles.d.ts} +0 -0
- /package/dist/components/{buttons/UShareButton.styles.d.ts → views/UMapView.styles.d.ts} +0 -0
- /package/dist/components/{widgets/UChartWidget.styles.d.ts → views/UVideoView.styles.d.ts} +0 -0
- /package/dist/components/{widgets/UImagesWidget.styles.d.ts → views/UView.styles.d.ts} +0 -0
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { nothing, html } from 'lit';
|
|
2
|
-
import { property, query, state } from 'lit/decorators.js';
|
|
3
|
-
import { Chart } from 'chart.js/auto';
|
|
4
|
-
import { UElement } from '@iyulab/components/dist/components/UElement.js';
|
|
5
|
-
import { UIcon } from '@iyulab/components/dist/components/icon/UIcon.component.js';
|
|
6
|
-
import { UButton } from '@iyulab/components/dist/components/button/UButton.component.js';
|
|
7
|
-
import { styles } from './UChartWidget.styles.js';
|
|
8
|
-
|
|
9
|
-
var __defProp = Object.defineProperty;
|
|
10
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
11
|
-
var result = void 0 ;
|
|
12
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
13
|
-
if (decorator = decorators[i])
|
|
14
|
-
result = (decorator(target, key, result) ) || result;
|
|
15
|
-
if (result) __defProp(target, key, result);
|
|
16
|
-
return result;
|
|
17
|
-
};
|
|
18
|
-
class UChartWidget extends UElement {
|
|
19
|
-
constructor() {
|
|
20
|
-
super(...arguments);
|
|
21
|
-
this.error = null;
|
|
22
|
-
this.chartjs = null;
|
|
23
|
-
}
|
|
24
|
-
static {
|
|
25
|
-
this.styles = [super.styles, styles];
|
|
26
|
-
}
|
|
27
|
-
static {
|
|
28
|
-
this.dependencies = {
|
|
29
|
-
"u-icon": UIcon,
|
|
30
|
-
"u-button": UButton
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
connectedCallback() {
|
|
34
|
-
super.connectedCallback();
|
|
35
|
-
this.observer = new MutationObserver(() => {
|
|
36
|
-
this.applyTheme();
|
|
37
|
-
this.createChart();
|
|
38
|
-
});
|
|
39
|
-
this.observer.observe(document.documentElement, {
|
|
40
|
-
attributes: true,
|
|
41
|
-
attributeFilter: ["theme"]
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
disconnectedCallback() {
|
|
45
|
-
super.disconnectedCallback();
|
|
46
|
-
this.observer?.disconnect();
|
|
47
|
-
this.destroyChart();
|
|
48
|
-
}
|
|
49
|
-
updated(changedProperties) {
|
|
50
|
-
super.updated(changedProperties);
|
|
51
|
-
if (changedProperties.has("data") || changedProperties.has("type") || changedProperties.has("options")) {
|
|
52
|
-
this.createChart();
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
render() {
|
|
56
|
-
if (!this.data) return nothing;
|
|
57
|
-
return html`
|
|
58
|
-
<div class="toolbar">
|
|
59
|
-
<div class="toolbar-left"></div>
|
|
60
|
-
<div class="toolbar-right">
|
|
61
|
-
<u-button title="PNG Download" @click=${this.handleDownloadPNG}>
|
|
62
|
-
PNG
|
|
63
|
-
<u-icon slot="suffix" lib="internal" name="download"></u-icon>
|
|
64
|
-
</u-button>
|
|
65
|
-
<u-button title="JSON Download" @click=${this.handleDownloadJSON}>
|
|
66
|
-
JSON
|
|
67
|
-
<u-icon slot="suffix" lib="internal" name="download"></u-icon>
|
|
68
|
-
</u-button>
|
|
69
|
-
<u-button title="Full Screen" @click=${this.handleFullscreen}>
|
|
70
|
-
<u-icon lib="internal" name="box-arrow-up-right"></u-icon>
|
|
71
|
-
</u-button>
|
|
72
|
-
</div>
|
|
73
|
-
</div>
|
|
74
|
-
<div class="viewport">
|
|
75
|
-
<canvas></canvas>
|
|
76
|
-
<div class="error-overlay" ?hidden=${!this.error}>
|
|
77
|
-
<u-icon lib="internal" name="exclamation-triangle-fill"></u-icon>
|
|
78
|
-
<span>${this.error}</span>
|
|
79
|
-
</div>
|
|
80
|
-
</div>
|
|
81
|
-
`;
|
|
82
|
-
}
|
|
83
|
-
/** Chart.js로 차트 생성 */
|
|
84
|
-
createChart() {
|
|
85
|
-
if (!this.canvas) return;
|
|
86
|
-
if (!this.type || !this.data) return;
|
|
87
|
-
this.destroyChart();
|
|
88
|
-
this.error = null;
|
|
89
|
-
const ctx = this.canvas.getContext("2d");
|
|
90
|
-
if (!ctx) {
|
|
91
|
-
this.error = "Canvas 2D context를 가져올 수 없습니다.";
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
try {
|
|
95
|
-
this.applyTheme();
|
|
96
|
-
this.chartjs = new Chart(ctx, {
|
|
97
|
-
type: this.type,
|
|
98
|
-
data: this.data,
|
|
99
|
-
options: {
|
|
100
|
-
responsive: true,
|
|
101
|
-
maintainAspectRatio: true,
|
|
102
|
-
...this.options
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
} catch (e) {
|
|
106
|
-
this.error = e instanceof Error ? e.message : String(e);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
/** 기존 차트 인스턴스 제거 */
|
|
110
|
-
destroyChart() {
|
|
111
|
-
if (this.chartjs) {
|
|
112
|
-
this.chartjs.destroy();
|
|
113
|
-
this.chartjs = null;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
/** 현재 테마의 CSS 변수를 읽어 Chart.defaults에 전역 적용 */
|
|
117
|
-
applyTheme() {
|
|
118
|
-
const css = (v) => getComputedStyle(this).getPropertyValue(v).trim();
|
|
119
|
-
const textColor = css("--u-txt-color");
|
|
120
|
-
const weakColor = css("--u-txt-color-weak");
|
|
121
|
-
const borderColor = css("--u-border-color");
|
|
122
|
-
const bgColor = css("--u-bg-color");
|
|
123
|
-
Chart.defaults.color = textColor;
|
|
124
|
-
Chart.defaults.borderColor = borderColor;
|
|
125
|
-
Chart.defaults.plugins.tooltip.backgroundColor = bgColor;
|
|
126
|
-
Chart.defaults.plugins.tooltip.titleColor = textColor;
|
|
127
|
-
Chart.defaults.plugins.tooltip.bodyColor = weakColor;
|
|
128
|
-
Chart.defaults.plugins.tooltip.borderColor = borderColor;
|
|
129
|
-
Chart.defaults.plugins.tooltip.borderWidth = 1;
|
|
130
|
-
Chart.defaults.scale.ticks.color = weakColor;
|
|
131
|
-
Chart.defaults.scale.grid.color = borderColor;
|
|
132
|
-
}
|
|
133
|
-
handleDownloadPNG() {
|
|
134
|
-
if (!this.chartjs) return;
|
|
135
|
-
const url = this.chartjs.toBase64Image("image/png", 1);
|
|
136
|
-
const a = document.createElement("a");
|
|
137
|
-
a.href = url;
|
|
138
|
-
a.download = "chart-image.png";
|
|
139
|
-
a.click();
|
|
140
|
-
}
|
|
141
|
-
handleDownloadJSON() {
|
|
142
|
-
if (!this.data) return;
|
|
143
|
-
const json = JSON.stringify(this.data, null, 2);
|
|
144
|
-
const blob = new Blob([json], { type: "application/json;charset=utf-8;" });
|
|
145
|
-
const url = URL.createObjectURL(blob);
|
|
146
|
-
const a = document.createElement("a");
|
|
147
|
-
a.href = url;
|
|
148
|
-
a.download = "chart-data.json";
|
|
149
|
-
a.click();
|
|
150
|
-
URL.revokeObjectURL(url);
|
|
151
|
-
}
|
|
152
|
-
handleFullscreen() {
|
|
153
|
-
const target = this.viewport ?? this;
|
|
154
|
-
if (document.fullscreenElement) {
|
|
155
|
-
document.exitFullscreen();
|
|
156
|
-
} else {
|
|
157
|
-
target.requestFullscreen?.();
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
__decorateClass([
|
|
162
|
-
property({ type: String })
|
|
163
|
-
], UChartWidget.prototype, "type");
|
|
164
|
-
__decorateClass([
|
|
165
|
-
property({ type: Object })
|
|
166
|
-
], UChartWidget.prototype, "data");
|
|
167
|
-
__decorateClass([
|
|
168
|
-
property({ type: Object })
|
|
169
|
-
], UChartWidget.prototype, "options");
|
|
170
|
-
__decorateClass([
|
|
171
|
-
query("canvas")
|
|
172
|
-
], UChartWidget.prototype, "canvas");
|
|
173
|
-
__decorateClass([
|
|
174
|
-
query(".viewport")
|
|
175
|
-
], UChartWidget.prototype, "viewport");
|
|
176
|
-
__decorateClass([
|
|
177
|
-
state()
|
|
178
|
-
], UChartWidget.prototype, "error");
|
|
179
|
-
|
|
180
|
-
export { UChartWidget };
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import { nothing, html } from 'lit';
|
|
2
|
-
import { property, state } from 'lit/decorators.js';
|
|
3
|
-
import { repeat } from 'lit/directives/repeat.js';
|
|
4
|
-
import { UElement } from '@iyulab/components/dist/components/UElement.js';
|
|
5
|
-
import { UCarousel } from '@iyulab/components/dist/components/carousel/UCarousel.component.js';
|
|
6
|
-
import { UIcon } from '@iyulab/components/dist/components/icon/UIcon.component.js';
|
|
7
|
-
import { styles } from './UImagesWidget.styles.js';
|
|
8
|
-
|
|
9
|
-
var __defProp = Object.defineProperty;
|
|
10
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
11
|
-
var result = void 0 ;
|
|
12
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
13
|
-
if (decorator = decorators[i])
|
|
14
|
-
result = (decorator(target, key, result) ) || result;
|
|
15
|
-
if (result) __defProp(target, key, result);
|
|
16
|
-
return result;
|
|
17
|
-
};
|
|
18
|
-
class UImagesWidget extends UElement {
|
|
19
|
-
constructor() {
|
|
20
|
-
super(...arguments);
|
|
21
|
-
this.items = [];
|
|
22
|
-
this.index = null;
|
|
23
|
-
this.open = (i) => {
|
|
24
|
-
this.index = i;
|
|
25
|
-
};
|
|
26
|
-
this.close = () => {
|
|
27
|
-
this.index = null;
|
|
28
|
-
};
|
|
29
|
-
this.prev = () => {
|
|
30
|
-
if (this.index !== null && this.index > 0) {
|
|
31
|
-
this.index--;
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
this.next = () => {
|
|
35
|
-
if (this.index !== null && this.index < this.items.length - 1) {
|
|
36
|
-
this.index++;
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
this.handlePrevClick = (e) => {
|
|
40
|
-
e.stopPropagation();
|
|
41
|
-
this.prev();
|
|
42
|
-
};
|
|
43
|
-
this.handleNextClick = (e) => {
|
|
44
|
-
e.stopPropagation();
|
|
45
|
-
this.next();
|
|
46
|
-
};
|
|
47
|
-
this.handleKeyDown = (e) => {
|
|
48
|
-
if (this.index === null) return;
|
|
49
|
-
if (e.key === "Escape") this.close();
|
|
50
|
-
else if (e.key === "ArrowLeft") this.prev();
|
|
51
|
-
else if (e.key === "ArrowRight") this.next();
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
static {
|
|
55
|
-
this.styles = [super.styles, styles];
|
|
56
|
-
}
|
|
57
|
-
static {
|
|
58
|
-
this.dependencies = {
|
|
59
|
-
"u-carousel": UCarousel,
|
|
60
|
-
"u-icon": UIcon
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
connectedCallback() {
|
|
64
|
-
super.connectedCallback();
|
|
65
|
-
document.addEventListener("keydown", this.handleKeyDown);
|
|
66
|
-
}
|
|
67
|
-
disconnectedCallback() {
|
|
68
|
-
document.removeEventListener("keydown", this.handleKeyDown);
|
|
69
|
-
super.disconnectedCallback();
|
|
70
|
-
}
|
|
71
|
-
render() {
|
|
72
|
-
if (!this.items?.length) return nothing;
|
|
73
|
-
const count = this.items.length;
|
|
74
|
-
return html`
|
|
75
|
-
<u-carousel
|
|
76
|
-
.loop=${false}
|
|
77
|
-
.navigation=${false}
|
|
78
|
-
.pagination=${true}
|
|
79
|
-
.draggable=${true}
|
|
80
|
-
.slidesPerView=${Math.min(count, 3)}
|
|
81
|
-
.gap=${8}
|
|
82
|
-
>
|
|
83
|
-
${repeat(this.items, (item, i) => html`
|
|
84
|
-
<div class="slide"
|
|
85
|
-
@click=${() => this.open(i)}>
|
|
86
|
-
<img
|
|
87
|
-
src=${item.src}
|
|
88
|
-
alt=${item.alt || ""}
|
|
89
|
-
loading="lazy"
|
|
90
|
-
/>
|
|
91
|
-
<div class="caption"
|
|
92
|
-
?hidden=${!item.caption}>
|
|
93
|
-
${item.caption}
|
|
94
|
-
</div>
|
|
95
|
-
</div>
|
|
96
|
-
`)}
|
|
97
|
-
</u-carousel>
|
|
98
|
-
|
|
99
|
-
${this.renderLightbox()}
|
|
100
|
-
`;
|
|
101
|
-
}
|
|
102
|
-
renderLightbox() {
|
|
103
|
-
const idx = this.index;
|
|
104
|
-
if (idx === null) return nothing;
|
|
105
|
-
if (idx < 0 || idx >= this.items.length) return nothing;
|
|
106
|
-
const item = this.items[idx];
|
|
107
|
-
if (!item) return nothing;
|
|
108
|
-
const total = this.items.length;
|
|
109
|
-
const translateX = `calc(15vw - ${idx} * (70vw + 16px))`;
|
|
110
|
-
return html`
|
|
111
|
-
<div class="lb-overlay">
|
|
112
|
-
|
|
113
|
-
<!-- 상단: 카운터(중앙) + 닫기 버튼(우측) -->
|
|
114
|
-
<header class="lb-header">
|
|
115
|
-
<div class="lb-counter" ?hidden=${total <= 1}>
|
|
116
|
-
${idx + 1} / ${total}
|
|
117
|
-
</div>
|
|
118
|
-
<button class="lb-close" @click=${this.close}>
|
|
119
|
-
<u-icon lib="internal" name="x-lg"></u-icon>
|
|
120
|
-
</button>
|
|
121
|
-
</header>
|
|
122
|
-
|
|
123
|
-
<!-- 중앙: 뷰포트 + 이전/다음 버튼(absolute 오버레이) -->
|
|
124
|
-
<div class="lb-body">
|
|
125
|
-
<div class="lb-viewport">
|
|
126
|
-
<div class="lb-track" style="transform:translateX(${translateX})">
|
|
127
|
-
${repeat(this.items, (img, i) => html`
|
|
128
|
-
<div class="lb-slide" ?active=${i === idx}>
|
|
129
|
-
<img src=${img.src} alt=${img.alt || ""} />
|
|
130
|
-
</div>
|
|
131
|
-
`)}
|
|
132
|
-
</div>
|
|
133
|
-
</div>
|
|
134
|
-
|
|
135
|
-
<button class="lb-nav prev"
|
|
136
|
-
?hidden=${idx <= 0}
|
|
137
|
-
@click=${this.handlePrevClick}>
|
|
138
|
-
<u-icon lib="internal" name="chevron-left"></u-icon>
|
|
139
|
-
</button>
|
|
140
|
-
|
|
141
|
-
<button class="lb-nav next"
|
|
142
|
-
?hidden=${idx >= total - 1}
|
|
143
|
-
@click=${this.handleNextClick}>
|
|
144
|
-
<u-icon lib="internal" name="chevron-right"></u-icon>
|
|
145
|
-
</button>
|
|
146
|
-
</div>
|
|
147
|
-
|
|
148
|
-
<!-- 하단: 캡션 -->
|
|
149
|
-
<footer class="lb-footer" ?hidden=${!item.caption}>
|
|
150
|
-
<p class="lb-caption">${item.caption}</p>
|
|
151
|
-
</footer>
|
|
152
|
-
|
|
153
|
-
</div>
|
|
154
|
-
`;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
__decorateClass([
|
|
158
|
-
property({ type: Array })
|
|
159
|
-
], UImagesWidget.prototype, "items");
|
|
160
|
-
__decorateClass([
|
|
161
|
-
state()
|
|
162
|
-
], UImagesWidget.prototype, "index");
|
|
163
|
-
|
|
164
|
-
export { UImagesWidget };
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { nothing, html } from 'lit';
|
|
2
|
-
import { property } from 'lit/decorators.js';
|
|
3
|
-
import { UElement } from '@iyulab/components/dist/components/UElement.js';
|
|
4
|
-
import { styles } from './UMapWidget.styles.js';
|
|
5
|
-
|
|
6
|
-
var __defProp = Object.defineProperty;
|
|
7
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
8
|
-
var result = void 0 ;
|
|
9
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
10
|
-
if (decorator = decorators[i])
|
|
11
|
-
result = (decorator(target, key, result) ) || result;
|
|
12
|
-
if (result) __defProp(target, key, result);
|
|
13
|
-
return result;
|
|
14
|
-
};
|
|
15
|
-
class UMapWidget extends UElement {
|
|
16
|
-
constructor() {
|
|
17
|
-
super(...arguments);
|
|
18
|
-
this.zoom = 15;
|
|
19
|
-
}
|
|
20
|
-
static {
|
|
21
|
-
this.styles = [super.styles, styles];
|
|
22
|
-
}
|
|
23
|
-
static {
|
|
24
|
-
this.dependencies = {};
|
|
25
|
-
}
|
|
26
|
-
render() {
|
|
27
|
-
if (this.lat == null || this.lng == null) return nothing;
|
|
28
|
-
const offset = 360 / Math.pow(2, this.zoom);
|
|
29
|
-
const bbox = `${this.lng - offset},${this.lat - offset},${this.lng + offset},${this.lat + offset}`;
|
|
30
|
-
const embedUrl = `https://www.openstreetmap.org/export/embed.html?bbox=${bbox}&layer=mapnik&marker=${this.lat},${this.lng}`;
|
|
31
|
-
const linkUrl = `https://www.openstreetmap.org/?mlat=${this.lat}&mlon=${this.lng}#map=${this.zoom}/${this.lat}/${this.lng}`;
|
|
32
|
-
return html`
|
|
33
|
-
<iframe
|
|
34
|
-
src="${embedUrl}"
|
|
35
|
-
loading="lazy"
|
|
36
|
-
></iframe>
|
|
37
|
-
<a class="caption"
|
|
38
|
-
?hidden=${!this.label && !this.description}
|
|
39
|
-
href="${linkUrl}"
|
|
40
|
-
target="_blank"
|
|
41
|
-
rel="noopener"
|
|
42
|
-
>
|
|
43
|
-
<strong>${this.label}</strong>
|
|
44
|
-
<span>${this.description}</span>
|
|
45
|
-
</a>
|
|
46
|
-
`;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
__decorateClass([
|
|
50
|
-
property({ type: Number })
|
|
51
|
-
], UMapWidget.prototype, "lat");
|
|
52
|
-
__decorateClass([
|
|
53
|
-
property({ type: Number })
|
|
54
|
-
], UMapWidget.prototype, "lng");
|
|
55
|
-
__decorateClass([
|
|
56
|
-
property({ type: Number })
|
|
57
|
-
], UMapWidget.prototype, "zoom");
|
|
58
|
-
__decorateClass([
|
|
59
|
-
property({ type: String })
|
|
60
|
-
], UMapWidget.prototype, "label");
|
|
61
|
-
__decorateClass([
|
|
62
|
-
property({ type: String })
|
|
63
|
-
], UMapWidget.prototype, "description");
|
|
64
|
-
|
|
65
|
-
export { UMapWidget };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const styles: import('lit').CSSResult;
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { nothing, html } from 'lit';
|
|
2
|
-
import { property } from 'lit/decorators.js';
|
|
3
|
-
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
4
|
-
import { UElement } from '@iyulab/components/dist/components/UElement.js';
|
|
5
|
-
import { styles } from './UVideoWidget.styles.js';
|
|
6
|
-
|
|
7
|
-
var __defProp = Object.defineProperty;
|
|
8
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
9
|
-
var result = void 0 ;
|
|
10
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
11
|
-
if (decorator = decorators[i])
|
|
12
|
-
result = (decorator(target, key, result) ) || result;
|
|
13
|
-
if (result) __defProp(target, key, result);
|
|
14
|
-
return result;
|
|
15
|
-
};
|
|
16
|
-
class UVideoWidget extends UElement {
|
|
17
|
-
constructor() {
|
|
18
|
-
super(...arguments);
|
|
19
|
-
this.ratio = "16:9";
|
|
20
|
-
}
|
|
21
|
-
static {
|
|
22
|
-
this.styles = [super.styles, styles];
|
|
23
|
-
}
|
|
24
|
-
static {
|
|
25
|
-
this.dependencies = {};
|
|
26
|
-
}
|
|
27
|
-
updated(changedProperties) {
|
|
28
|
-
super.updated(changedProperties);
|
|
29
|
-
if (changedProperties.has("ratio")) {
|
|
30
|
-
this.style.setProperty("--video-ratio", this.ratio.replace(":", " / "));
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
render() {
|
|
34
|
-
if (!this.src) return nothing;
|
|
35
|
-
if (this.isYouTube(this.src)) {
|
|
36
|
-
const videoId = this.extractYouTubeId(this.src);
|
|
37
|
-
if (videoId) {
|
|
38
|
-
return html`
|
|
39
|
-
<div class="video-wrapper">
|
|
40
|
-
<iframe
|
|
41
|
-
src="https://www.youtube.com/embed/${videoId}"
|
|
42
|
-
loading="lazy"
|
|
43
|
-
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
|
44
|
-
allowfullscreen
|
|
45
|
-
></iframe>
|
|
46
|
-
</div>
|
|
47
|
-
`;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
if (this.isVimeo(this.src)) {
|
|
51
|
-
const videoId = this.extractVimeoId(this.src);
|
|
52
|
-
if (videoId) {
|
|
53
|
-
return html`
|
|
54
|
-
<div class="video-wrapper">
|
|
55
|
-
<iframe
|
|
56
|
-
src="https://player.vimeo.com/video/${videoId}"
|
|
57
|
-
loading="lazy"
|
|
58
|
-
allow="autoplay; fullscreen; picture-in-picture"
|
|
59
|
-
allowfullscreen
|
|
60
|
-
></iframe>
|
|
61
|
-
</div>
|
|
62
|
-
`;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return html`
|
|
66
|
-
<video
|
|
67
|
-
src=${this.src}
|
|
68
|
-
poster=${ifDefined(this.poster)}
|
|
69
|
-
controls
|
|
70
|
-
playsinline
|
|
71
|
-
></video>
|
|
72
|
-
`;
|
|
73
|
-
}
|
|
74
|
-
isYouTube(url) {
|
|
75
|
-
return /youtube\.com|youtu\.be/i.test(url);
|
|
76
|
-
}
|
|
77
|
-
isVimeo(url) {
|
|
78
|
-
return /vimeo\.com/i.test(url);
|
|
79
|
-
}
|
|
80
|
-
extractYouTubeId(url) {
|
|
81
|
-
const patterns = [
|
|
82
|
-
/(?:youtube\.com\/watch\?v=|youtu\.be\/)([^&\s]+)/,
|
|
83
|
-
/youtube\.com\/embed\/([^&\s]+)/
|
|
84
|
-
];
|
|
85
|
-
for (const pattern of patterns) {
|
|
86
|
-
const match = url.match(pattern);
|
|
87
|
-
if (match && match[1]) return match[1];
|
|
88
|
-
}
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
extractVimeoId(url) {
|
|
92
|
-
const match = url.match(/vimeo\.com\/(\d+)/);
|
|
93
|
-
return match ? match[1] : null;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
__decorateClass([
|
|
97
|
-
property({ type: String })
|
|
98
|
-
], UVideoWidget.prototype, "src");
|
|
99
|
-
__decorateClass([
|
|
100
|
-
property({ type: String })
|
|
101
|
-
], UVideoWidget.prototype, "poster");
|
|
102
|
-
__decorateClass([
|
|
103
|
-
property({ type: String })
|
|
104
|
-
], UVideoWidget.prototype, "ratio");
|
|
105
|
-
|
|
106
|
-
export { UVideoWidget };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const styles: import('lit').CSSResult;
|