@kopexa/extension-controlref 1.0.0 → 13.0.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/chunk-4C72VBLP.mjs +52 -0
- package/dist/chunk-A7FWOQDN.mjs +210 -0
- package/dist/chunk-AQTNFDGA.mjs +57 -0
- package/dist/chunk-D53W4HWR.mjs +245 -0
- package/dist/chunk-FTEE5U3H.mjs +37 -0
- package/dist/chunk-GYDJVHHG.mjs +250 -0
- package/dist/chunk-IMHLTRZJ.mjs +29 -0
- package/dist/chunk-JM66CQVD.mjs +10 -0
- package/dist/chunk-LMKP3DDN.mjs +189 -0
- package/dist/chunk-RTBFRPB3.mjs +186 -0
- package/dist/chunk-TEDXYIGO.mjs +38 -0
- package/dist/chunk-WIS7ZNTO.mjs +4 -0
- package/dist/chunk-X46EFFCE.mjs +148 -0
- package/dist/chunk-XHD2KFKQ.mjs +16 -0
- package/dist/chunk-ZRKYAFRY.mjs +46 -0
- package/dist/chunk-ZUR6XKMG.mjs +21 -0
- package/dist/components/control-block-view.d.mts +6 -0
- package/dist/components/control-block-view.d.ts +6 -0
- package/dist/components/control-block-view.js +789 -0
- package/dist/components/control-block-view.mjs +11 -0
- package/dist/components/control-implementation-view.d.mts +6 -0
- package/dist/components/control-implementation-view.d.ts +6 -0
- package/dist/components/control-implementation-view.js +52 -0
- package/dist/components/control-implementation-view.mjs +7 -0
- package/dist/components/control-picker.d.mts +25 -0
- package/dist/components/control-picker.d.ts +25 -0
- package/dist/components/control-picker.js +522 -0
- package/dist/components/control-picker.mjs +10 -0
- package/dist/components/control-view.js +677 -122
- package/dist/components/control-view.mjs +5 -5
- package/dist/components/use-control.d.mts +20 -0
- package/dist/components/use-control.d.ts +20 -0
- package/dist/components/use-control.js +127 -0
- package/dist/components/use-control.mjs +9 -0
- package/dist/control-block.d.mts +35 -0
- package/dist/control-block.d.ts +35 -0
- package/dist/control-block.js +1012 -0
- package/dist/control-block.mjs +17 -0
- package/dist/control-implementation.d.mts +7 -0
- package/dist/control-implementation.d.ts +7 -0
- package/dist/control-implementation.js +92 -0
- package/dist/control-implementation.mjs +9 -0
- package/dist/control.d.mts +31 -1
- package/dist/control.d.ts +31 -1
- package/dist/control.js +819 -136
- package/dist/control.mjs +7 -6
- package/dist/defaults.d.mts +3 -9
- package/dist/defaults.d.ts +3 -9
- package/dist/defaults.js +3 -20
- package/dist/defaults.mjs +3 -6
- package/dist/index.d.mts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +1229 -569
- package/dist/index.mjs +58 -21
- package/dist/messages/index.d.mts +135 -0
- package/dist/messages/index.d.ts +135 -0
- package/dist/messages/index.js +137 -2
- package/dist/messages/index.mjs +1 -2
- package/dist/role.d.mts +17 -0
- package/dist/role.d.ts +17 -0
- package/dist/role.js +5 -0
- package/dist/role.mjs +2 -0
- package/dist/types.d.mts +23 -16
- package/dist/types.d.ts +23 -16
- package/dist/utils/create-control-block.d.mts +7 -0
- package/dist/utils/create-control-block.d.ts +7 -0
- package/dist/utils/create-control-block.js +85 -0
- package/dist/utils/create-control-block.mjs +10 -0
- package/dist/utils/create-control-implementation.d.mts +8 -0
- package/dist/utils/create-control-implementation.d.ts +8 -0
- package/dist/utils/create-control-implementation.js +39 -0
- package/dist/utils/create-control-implementation.mjs +7 -0
- package/dist/utils/getControlNodeTypes.d.mts +5 -0
- package/dist/utils/getControlNodeTypes.d.ts +5 -0
- package/dist/utils/getControlNodeTypes.js +44 -0
- package/dist/utils/getControlNodeTypes.mjs +7 -0
- package/dist/utils/index.d.mts +7 -2
- package/dist/utils/index.d.ts +7 -2
- package/dist/utils/index.js +35 -3
- package/dist/utils/index.mjs +7 -4
- package/dist/utils/status-indicator.d.mts +18 -0
- package/dist/utils/status-indicator.d.ts +18 -0
- package/dist/utils/status-indicator.js +80 -0
- package/dist/utils/status-indicator.mjs +7 -0
- package/package.json +11 -11
- package/dist/card-variant.d.mts +0 -12
- package/dist/card-variant.d.ts +0 -12
- package/dist/card-variant.js +0 -66
- package/dist/card-variant.mjs +0 -8
- package/dist/chunk-AC4KL3WX.mjs +0 -29
- package/dist/chunk-AZ5M5MVC.mjs +0 -36
- package/dist/chunk-DTFR234X.mjs +0 -244
- package/dist/chunk-EDD7DYLE.mjs +0 -29
- package/dist/chunk-GC5EBQ7G.mjs +0 -10
- package/dist/chunk-H2ECPGOG.mjs +0 -81
- package/dist/chunk-KLX7Q3HL.mjs +0 -109
- package/dist/chunk-LKRTUIEV.mjs +0 -46
- package/dist/chunk-NAJ6IC4Y.mjs +0 -43
- package/dist/chunk-QI3ZPZTR.mjs +0 -26
- package/dist/chunk-SNRVOTF5.mjs +0 -8
- package/dist/chunk-VP5POY44.mjs +0 -57
- package/dist/chunk-WIR5FCIC.mjs +0 -110
- package/dist/control-ref-view.d.mts +0 -6
- package/dist/control-ref-view.d.ts +0 -6
- package/dist/control-ref-view.js +0 -615
- package/dist/control-ref-view.mjs +0 -15
- package/dist/control-ref.d.mts +0 -28
- package/dist/control-ref.d.ts +0 -28
- package/dist/control-ref.js +0 -687
- package/dist/control-ref.mjs +0 -16
- package/dist/i18n.d.mts +0 -4
- package/dist/i18n.d.ts +0 -4
- package/dist/i18n.js +0 -128
- package/dist/i18n.mjs +0 -10
- package/dist/lang/de.d.mts +0 -24
- package/dist/lang/de.d.ts +0 -24
- package/dist/lang/de.js +0 -25
- package/dist/lang/de.mjs +0 -8
- package/dist/lang/en.d.mts +0 -24
- package/dist/lang/en.d.ts +0 -24
- package/dist/lang/en.js +0 -25
- package/dist/lang/en.mjs +0 -8
- package/dist/settings-dialog.d.mts +0 -19
- package/dist/settings-dialog.d.ts +0 -19
- package/dist/settings-dialog.js +0 -371
- package/dist/settings-dialog.mjs +0 -9
|
@@ -1,20 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use strict";
|
|
3
3
|
"use client";
|
|
4
|
-
var __create = Object.create;
|
|
5
4
|
var __defProp = Object.defineProperty;
|
|
6
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
9
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __glob = (map) => (path) => {
|
|
11
|
-
var fn = map[path];
|
|
12
|
-
if (fn) return fn();
|
|
13
|
-
throw new Error("Module not found in bundle: " + path);
|
|
14
|
-
};
|
|
15
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
16
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
17
|
-
};
|
|
18
8
|
var __export = (target, all) => {
|
|
19
9
|
for (var name in all)
|
|
20
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -27,72 +17,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
27
17
|
}
|
|
28
18
|
return to;
|
|
29
19
|
};
|
|
30
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
31
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
32
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
33
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
34
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
35
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
36
|
-
mod
|
|
37
|
-
));
|
|
38
20
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
39
21
|
|
|
40
|
-
// src/lang/de.json
|
|
41
|
-
var require_de = __commonJS({
|
|
42
|
-
"src/lang/de.json"(exports2, module2) {
|
|
43
|
-
module2.exports = {
|
|
44
|
-
"editor.controlref.appearance": "Darstellung",
|
|
45
|
-
"editor.controlref.border": "Rahmen",
|
|
46
|
-
"editor.controlref.cancel": "Abbrechen",
|
|
47
|
-
"editor.controlref.change_control": "Kontrolle \xE4ndern",
|
|
48
|
-
"editor.controlref.control": "Kontrolle",
|
|
49
|
-
"editor.controlref.controls": "Kontrollen",
|
|
50
|
-
"editor.controlref.map_control": "Kontrolle zuordnen",
|
|
51
|
-
"editor.controlref.radius": "Eckenradius",
|
|
52
|
-
"editor.controlref.save_settings": "Einstellungen speichern",
|
|
53
|
-
"editor.controlref.search_controls": "Kontrollen suchen...",
|
|
54
|
-
"editor.controlref.settings": "Einstellungen",
|
|
55
|
-
"editor.controlref.settings_dialog_description": "Passe Darstellung und Details der Kontrollreferenz an.",
|
|
56
|
-
"editor.controlref.shadow": "Schatten",
|
|
57
|
-
"editor.controlref.show_description": "Beschreibung anzeigen",
|
|
58
|
-
"editor.controlref.show_implementations": "Umsetzungen anzeigen",
|
|
59
|
-
"editor.controlref.show_status": "Status anzeigen",
|
|
60
|
-
"editor.controlref.spacing": "Abst\xE4nde",
|
|
61
|
-
"editor.controlref.variant": "Variante",
|
|
62
|
-
"editor.controlref.variant_card": "Karte",
|
|
63
|
-
"editor.controlref.variant_chip": "Chip"
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
// src/lang/en.json
|
|
69
|
-
var require_en = __commonJS({
|
|
70
|
-
"src/lang/en.json"(exports2, module2) {
|
|
71
|
-
module2.exports = {
|
|
72
|
-
"editor.controlref.appearance": "Appearance",
|
|
73
|
-
"editor.controlref.border": "Border",
|
|
74
|
-
"editor.controlref.cancel": "Cancel",
|
|
75
|
-
"editor.controlref.change_control": "Change Control",
|
|
76
|
-
"editor.controlref.control": "Control",
|
|
77
|
-
"editor.controlref.controls": "Controls",
|
|
78
|
-
"editor.controlref.map_control": "Map Control",
|
|
79
|
-
"editor.controlref.radius": "Radius",
|
|
80
|
-
"editor.controlref.save_settings": "Save Settings",
|
|
81
|
-
"editor.controlref.search_controls": "Search controls...",
|
|
82
|
-
"editor.controlref.settings": "Settings",
|
|
83
|
-
"editor.controlref.settings_dialog_description": "Customize the appearance and details of the control reference.",
|
|
84
|
-
"editor.controlref.shadow": "Shadow",
|
|
85
|
-
"editor.controlref.show_description": "Show Description",
|
|
86
|
-
"editor.controlref.show_implementations": "Show Implementations",
|
|
87
|
-
"editor.controlref.show_status": "Show Status",
|
|
88
|
-
"editor.controlref.spacing": "Spacing",
|
|
89
|
-
"editor.controlref.variant": "Variant",
|
|
90
|
-
"editor.controlref.variant_card": "Card",
|
|
91
|
-
"editor.controlref.variant_chip": "Chip"
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
|
|
96
22
|
// src/components/control-view.tsx
|
|
97
23
|
var control_view_exports = {};
|
|
98
24
|
__export(control_view_exports, {
|
|
@@ -100,79 +26,708 @@ __export(control_view_exports, {
|
|
|
100
26
|
});
|
|
101
27
|
module.exports = __toCommonJS(control_view_exports);
|
|
102
28
|
var import_i18n = require("@kopexa/i18n");
|
|
103
|
-
var
|
|
104
|
-
var
|
|
105
|
-
var
|
|
106
|
-
|
|
107
|
-
// src/i18n.ts
|
|
108
|
-
var import_de = __toESM(require_de());
|
|
109
|
-
var import_en = __toESM(require_en());
|
|
29
|
+
var import_sight2 = require("@kopexa/sight");
|
|
30
|
+
var import_react3 = require("@tiptap/react");
|
|
31
|
+
var import_react4 = require("react");
|
|
32
|
+
var import_react_intl3 = require("react-intl");
|
|
110
33
|
|
|
111
|
-
//
|
|
112
|
-
var
|
|
113
|
-
|
|
114
|
-
|
|
34
|
+
// src/messages/index.ts
|
|
35
|
+
var import_react_intl = require("react-intl");
|
|
36
|
+
var messages = (0, import_react_intl.defineMessages)({
|
|
37
|
+
control: {
|
|
38
|
+
id: "editor.controlref.control",
|
|
39
|
+
defaultMessage: "Control",
|
|
40
|
+
description: "Label for control"
|
|
41
|
+
},
|
|
42
|
+
settings_dialog_description: {
|
|
43
|
+
id: "editor.controlref.settings_dialog_description",
|
|
44
|
+
defaultMessage: "Customize the appearance and details of the control reference.",
|
|
45
|
+
description: "Description for the settings dialog"
|
|
46
|
+
},
|
|
47
|
+
controls: {
|
|
48
|
+
id: "editor.controlref.controls",
|
|
49
|
+
defaultMessage: "Controls",
|
|
50
|
+
description: "Label for controls"
|
|
51
|
+
},
|
|
52
|
+
change_control: {
|
|
53
|
+
id: "editor.controlref.change_control",
|
|
54
|
+
defaultMessage: "Change Control",
|
|
55
|
+
description: "Label for change control button"
|
|
56
|
+
},
|
|
57
|
+
map_control: {
|
|
58
|
+
id: "editor.controlref.map_control",
|
|
59
|
+
defaultMessage: "Map Control",
|
|
60
|
+
description: "Label for map control button"
|
|
61
|
+
},
|
|
62
|
+
settings: {
|
|
63
|
+
id: "editor.controlref.settings",
|
|
64
|
+
defaultMessage: "Settings",
|
|
65
|
+
description: "Label for settings button"
|
|
66
|
+
},
|
|
67
|
+
appearance: {
|
|
68
|
+
id: "editor.controlref.appearance",
|
|
69
|
+
defaultMessage: "Appearance",
|
|
70
|
+
description: "Label for appearance section"
|
|
71
|
+
},
|
|
72
|
+
search_controls: {
|
|
73
|
+
id: "editor.controlref.search_controls",
|
|
74
|
+
defaultMessage: "Search controls\u2026",
|
|
75
|
+
description: "Placeholder for search controls input"
|
|
76
|
+
},
|
|
77
|
+
variant: {
|
|
78
|
+
id: "editor.controlref.variant",
|
|
79
|
+
defaultMessage: "Variante",
|
|
80
|
+
description: "Label for variant section"
|
|
81
|
+
},
|
|
82
|
+
variant_hint: {
|
|
83
|
+
id: "editor.controlref.variant_hint",
|
|
84
|
+
defaultMessage: "Choose a visual emphasis for this section.",
|
|
85
|
+
description: "Hint for variant section"
|
|
86
|
+
},
|
|
87
|
+
variant_chip: {
|
|
88
|
+
id: "editor.controlref.variant_chip",
|
|
89
|
+
defaultMessage: "Chip",
|
|
90
|
+
description: "Label for variant chip"
|
|
91
|
+
},
|
|
92
|
+
variant_card: {
|
|
93
|
+
id: "editor.controlref.variant_card",
|
|
94
|
+
defaultMessage: "Card",
|
|
95
|
+
description: "Label for variant card"
|
|
96
|
+
},
|
|
97
|
+
show_status: {
|
|
98
|
+
id: "editor.controlref.show_status",
|
|
99
|
+
defaultMessage: "Show Status",
|
|
100
|
+
description: "Label for show status toggle"
|
|
101
|
+
},
|
|
102
|
+
show_description: {
|
|
103
|
+
id: "editor.controlref.show_description",
|
|
104
|
+
defaultMessage: "Show Description",
|
|
105
|
+
description: "Label for show description toggle"
|
|
106
|
+
},
|
|
107
|
+
show_implementations: {
|
|
108
|
+
id: "editor.controlref.show_implementations",
|
|
109
|
+
defaultMessage: "Show Implementations",
|
|
110
|
+
description: "Label for show implementations toggle"
|
|
111
|
+
},
|
|
112
|
+
border: {
|
|
113
|
+
id: "editor.controlref.border",
|
|
114
|
+
defaultMessage: "Border",
|
|
115
|
+
description: "Label for border toggle"
|
|
116
|
+
},
|
|
117
|
+
shadow: {
|
|
118
|
+
id: "editor.controlref.shadow",
|
|
119
|
+
defaultMessage: "Shadow",
|
|
120
|
+
description: "Label for shadow toggle"
|
|
121
|
+
},
|
|
122
|
+
radius: {
|
|
123
|
+
id: "editor.controlref.radius",
|
|
124
|
+
defaultMessage: "Radius",
|
|
125
|
+
description: "Label for radius toggle"
|
|
126
|
+
},
|
|
127
|
+
spacing: {
|
|
128
|
+
id: "editor.controlref.spacing",
|
|
129
|
+
defaultMessage: "Spacing",
|
|
130
|
+
description: "Label for spacing section"
|
|
131
|
+
},
|
|
132
|
+
cancel: {
|
|
133
|
+
id: "editor.controlref.cancel",
|
|
134
|
+
defaultMessage: "Cancel",
|
|
135
|
+
description: "Label for cancel button"
|
|
136
|
+
},
|
|
137
|
+
save_settings: {
|
|
138
|
+
id: "editor.controlref.save_settings",
|
|
139
|
+
defaultMessage: "Save Settings",
|
|
140
|
+
description: "Label for save settings button"
|
|
141
|
+
},
|
|
142
|
+
unmapped_control: {
|
|
143
|
+
id: "editor.controlref.unmapped_control",
|
|
144
|
+
defaultMessage: "Unmapped Control",
|
|
145
|
+
description: "Fallback label when no control is selected"
|
|
146
|
+
},
|
|
147
|
+
control_with_title: {
|
|
148
|
+
id: "editor.controlref.control_with_title",
|
|
149
|
+
defaultMessage: "Control: {title}",
|
|
150
|
+
description: "Dialog title with selected control"
|
|
151
|
+
},
|
|
152
|
+
search_hint: {
|
|
153
|
+
id: "editor.controlref.search_hint",
|
|
154
|
+
defaultMessage: "Start typing to search by ID, title or status.",
|
|
155
|
+
description: "Empty search hint"
|
|
156
|
+
},
|
|
157
|
+
no_results: {
|
|
158
|
+
id: "editor.controlref.no_results",
|
|
159
|
+
defaultMessage: "No controls found for \u201C{query}\u201D. You can keep this chip unmapped.",
|
|
160
|
+
description: "Shown when no controls match search query"
|
|
161
|
+
},
|
|
162
|
+
results_count: {
|
|
163
|
+
id: "editor.controlref.results_count",
|
|
164
|
+
defaultMessage: "{count, plural, one {# result} other {# results}}",
|
|
165
|
+
description: "Number of search results"
|
|
166
|
+
},
|
|
167
|
+
updated_at: {
|
|
168
|
+
id: "editor.controlref.updated_at",
|
|
169
|
+
defaultMessage: "Updated {date}",
|
|
170
|
+
description: "Updated date label"
|
|
171
|
+
},
|
|
172
|
+
selected: {
|
|
173
|
+
id: "editor.controlref.selected",
|
|
174
|
+
defaultMessage: "Selected",
|
|
175
|
+
description: "Label for selected item area"
|
|
176
|
+
},
|
|
177
|
+
no_control_selected: {
|
|
178
|
+
id: "editor.controlref.no_control_selected",
|
|
179
|
+
defaultMessage: "No control selected",
|
|
180
|
+
description: "Empty state in selected area"
|
|
181
|
+
},
|
|
182
|
+
clear: {
|
|
183
|
+
id: "editor.controlref.clear",
|
|
184
|
+
defaultMessage: "Clear",
|
|
185
|
+
description: "Clear selection button"
|
|
186
|
+
},
|
|
187
|
+
unmap: {
|
|
188
|
+
id: "editor.controlref.unmap",
|
|
189
|
+
defaultMessage: "Unmap",
|
|
190
|
+
description: "Unmap selection button"
|
|
191
|
+
},
|
|
192
|
+
live_preview: {
|
|
193
|
+
id: "editor.controlref.live_preview",
|
|
194
|
+
defaultMessage: "Live preview",
|
|
195
|
+
description: "Live preview section title"
|
|
196
|
+
},
|
|
197
|
+
display_options: {
|
|
198
|
+
id: "editor.controlref.display_options",
|
|
199
|
+
defaultMessage: "Display options",
|
|
200
|
+
description: "Display options section title"
|
|
201
|
+
},
|
|
202
|
+
show_status_indicator: {
|
|
203
|
+
id: "editor.controlref.show_status_indicator",
|
|
204
|
+
defaultMessage: "Show status indicator",
|
|
205
|
+
description: "Toggle for showing indicator"
|
|
206
|
+
},
|
|
207
|
+
searching: {
|
|
208
|
+
id: "editor.controlref.searching",
|
|
209
|
+
defaultMessage: "Searching\u2026",
|
|
210
|
+
description: "Loading indicator text"
|
|
211
|
+
},
|
|
212
|
+
map_control_aria: {
|
|
213
|
+
id: "editor.controlref.map_control_aria",
|
|
214
|
+
defaultMessage: "Map control",
|
|
215
|
+
description: "ARIA label for mapping control"
|
|
216
|
+
},
|
|
217
|
+
outdated_badge: {
|
|
218
|
+
id: "editor.controlref.outdated_badge",
|
|
219
|
+
defaultMessage: "A newer revision exists",
|
|
220
|
+
description: "Badge for outdated controls"
|
|
221
|
+
},
|
|
222
|
+
missing_badge: {
|
|
223
|
+
id: "editor.controlref.missing_badge",
|
|
224
|
+
defaultMessage: "Control no longer exists",
|
|
225
|
+
description: "Badge for missing controls"
|
|
226
|
+
},
|
|
227
|
+
error_loading: {
|
|
228
|
+
id: "editor.controlref.error_loading",
|
|
229
|
+
defaultMessage: "Failed to load controls",
|
|
230
|
+
description: "Error message when failing to load controls"
|
|
231
|
+
},
|
|
232
|
+
error_timeout: {
|
|
233
|
+
id: "editor.controlref.error_timeout",
|
|
234
|
+
defaultMessage: "The request timed out. Please try again.",
|
|
235
|
+
description: "Error message when the request times out"
|
|
236
|
+
},
|
|
237
|
+
missing_callout: {
|
|
238
|
+
id: "editor.controlref.missing_callout",
|
|
239
|
+
defaultMessage: "The currently mapped control could not be found. It may have been deleted or you may not have access to it anymore. Please select a different control.",
|
|
240
|
+
description: "Callout message when the selected control is missing"
|
|
241
|
+
},
|
|
242
|
+
outdated_callout: {
|
|
243
|
+
id: "editor.controlref.outdated_callout",
|
|
244
|
+
defaultMessage: "A newer revision of the currently mapped control exists. Consider updating to the latest version by re-selecting it below.",
|
|
245
|
+
description: "Callout message when the selected control is outdated"
|
|
246
|
+
},
|
|
247
|
+
search_placeholder: {
|
|
248
|
+
id: "editor.controlref.search_placeholder",
|
|
249
|
+
defaultMessage: "e.g. CTRL-001, Asset Inventory\u2026",
|
|
250
|
+
description: "Placeholder for search controls input"
|
|
251
|
+
},
|
|
252
|
+
control_implementations: {
|
|
253
|
+
id: "editor.controlref.control_implementations",
|
|
254
|
+
defaultMessage: "Implementations",
|
|
255
|
+
description: "Label for control implementations section"
|
|
256
|
+
},
|
|
257
|
+
header_status: {
|
|
258
|
+
id: "editor.controlblock.header_status",
|
|
259
|
+
defaultMessage: "Show status in header",
|
|
260
|
+
description: "Label for show status in header toggle"
|
|
261
|
+
},
|
|
262
|
+
header_status_aria: {
|
|
263
|
+
id: "editor.controlblock.header_status_aria",
|
|
264
|
+
defaultMessage: "Toggle status chip in card header",
|
|
265
|
+
description: "ARIA label for show status in header toggle"
|
|
266
|
+
},
|
|
267
|
+
header_status_avv_tip: {
|
|
268
|
+
id: "editor.controlblock.header_status_avv_tip",
|
|
269
|
+
defaultMessage: "If this document is intended for use or export as a data processing agreement (AVV), disable this option unless you explicitly want to publish the current control status.",
|
|
270
|
+
description: "Tooltip for show status in header toggle when used in AVV documents"
|
|
271
|
+
}
|
|
115
272
|
});
|
|
116
273
|
|
|
117
|
-
// src/
|
|
118
|
-
var
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
274
|
+
// src/components/control-picker.tsx
|
|
275
|
+
var import_sight = require("@kopexa/sight");
|
|
276
|
+
var import_react = require("react");
|
|
277
|
+
var import_react_intl2 = require("react-intl");
|
|
278
|
+
|
|
279
|
+
// src/utils/status-indicator.ts
|
|
280
|
+
function norm(status) {
|
|
281
|
+
return (status != null ? status : "").trim().replace(/[\s-]+/g, "_").toUpperCase();
|
|
282
|
+
}
|
|
283
|
+
function colorForStatusKey(key) {
|
|
284
|
+
switch (key == null ? void 0 : key.toUpperCase()) {
|
|
285
|
+
case "FULFILLED_MANUAL":
|
|
286
|
+
case "FULFILLED_AUTO":
|
|
287
|
+
case "IMPLEMENTED":
|
|
288
|
+
case "APPROVED":
|
|
289
|
+
case "PASSED":
|
|
290
|
+
return "success";
|
|
291
|
+
case "IN_PROGRESS":
|
|
292
|
+
case "NEEDS_APPROVAL":
|
|
293
|
+
case "CHANGES_REQUESTED":
|
|
294
|
+
case "PENDING":
|
|
295
|
+
case "PARTIAL":
|
|
296
|
+
return "warning";
|
|
297
|
+
case "FAILED":
|
|
298
|
+
case "REJECTED":
|
|
299
|
+
return "destructive";
|
|
300
|
+
case "OUT_OF_SCOPE":
|
|
301
|
+
case "PREPARING":
|
|
302
|
+
return "secondary";
|
|
303
|
+
default:
|
|
304
|
+
return "default";
|
|
123
305
|
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
306
|
+
}
|
|
307
|
+
function getIndicatorProps(status, opts) {
|
|
308
|
+
var _a, _b;
|
|
309
|
+
const mapped = (_a = opts == null ? void 0 : opts.mapped) != null ? _a : true;
|
|
310
|
+
const enable = (_b = opts == null ? void 0 : opts.enable) != null ? _b : true;
|
|
311
|
+
if (!enable) {
|
|
312
|
+
return { indicator: false, indicatorColor: "default" };
|
|
313
|
+
}
|
|
314
|
+
if (!mapped) {
|
|
315
|
+
return {
|
|
316
|
+
indicator: true,
|
|
317
|
+
indicatorColor: "destructive",
|
|
318
|
+
indicatorVariant: "pulse"
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
const key = norm(status);
|
|
322
|
+
const indicatorColor = colorForStatusKey(key);
|
|
323
|
+
const shouldPulse = key === "IN_PROGRESS" || key === "NEEDS_APPROVAL" || key === "CHANGES_REQUESTED" || key === "PENDING";
|
|
324
|
+
return {
|
|
325
|
+
indicator: true,
|
|
326
|
+
indicatorColor,
|
|
327
|
+
...shouldPulse ? { indicatorVariant: "pulse" } : {}
|
|
328
|
+
};
|
|
131
329
|
}
|
|
132
330
|
|
|
133
|
-
// src/components/control-
|
|
331
|
+
// src/components/control-picker.tsx
|
|
134
332
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
333
|
+
function ControlPicker({
|
|
334
|
+
resolver,
|
|
335
|
+
value,
|
|
336
|
+
onChange,
|
|
337
|
+
debounceMs = 300,
|
|
338
|
+
timeoutMs = 5e3,
|
|
339
|
+
initialQuery = "",
|
|
340
|
+
showItemStatus = true
|
|
341
|
+
}) {
|
|
342
|
+
const intl = (0, import_react_intl2.useIntl)();
|
|
343
|
+
const searchId = (0, import_react.useId)();
|
|
344
|
+
const [search, setSearch] = (0, import_react.useState)(initialQuery);
|
|
345
|
+
const [debouncedSearch, setDebouncedSearch] = (0, import_react.useState)(search);
|
|
346
|
+
const [loading, setLoading] = (0, import_react.useState)(false);
|
|
347
|
+
const [error, setError] = (0, import_react.useState)(null);
|
|
348
|
+
const [results, setResults] = (0, import_react.useState)([]);
|
|
349
|
+
(0, import_react.useEffect)(() => {
|
|
350
|
+
const t = setTimeout(() => setDebouncedSearch(search), debounceMs);
|
|
351
|
+
return () => clearTimeout(t);
|
|
352
|
+
}, [search, debounceMs]);
|
|
353
|
+
(0, import_react.useEffect)(() => {
|
|
354
|
+
if (!(resolver == null ? void 0 : resolver.getControls)) return;
|
|
355
|
+
let ignore = false;
|
|
356
|
+
(async () => {
|
|
357
|
+
setLoading(true);
|
|
358
|
+
setError(null);
|
|
359
|
+
try {
|
|
360
|
+
const p = resolver.getControls(debouncedSearch);
|
|
361
|
+
const data = await Promise.race([
|
|
362
|
+
p,
|
|
363
|
+
new Promise(
|
|
364
|
+
(_, rej) => setTimeout(
|
|
365
|
+
() => rej(new Error(intl.formatMessage(messages.error_timeout))),
|
|
366
|
+
timeoutMs
|
|
367
|
+
)
|
|
368
|
+
)
|
|
369
|
+
]);
|
|
370
|
+
if (!ignore) setResults(data);
|
|
371
|
+
} catch (e) {
|
|
372
|
+
if (!ignore) {
|
|
373
|
+
setError(
|
|
374
|
+
e instanceof Error ? e.message : intl.formatMessage(messages.error_loading)
|
|
375
|
+
);
|
|
376
|
+
setResults([]);
|
|
377
|
+
}
|
|
378
|
+
} finally {
|
|
379
|
+
if (!ignore) setLoading(false);
|
|
380
|
+
}
|
|
381
|
+
})();
|
|
382
|
+
return () => {
|
|
383
|
+
ignore = true;
|
|
384
|
+
};
|
|
385
|
+
}, [debouncedSearch, resolver, timeoutMs, intl]);
|
|
386
|
+
const statusNode = (0, import_react.useMemo)(() => {
|
|
387
|
+
if (loading)
|
|
388
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
389
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sight.Spinner, { size: "sm" }),
|
|
390
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: intl.formatMessage(messages.searching) })
|
|
391
|
+
] });
|
|
392
|
+
if (error) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-destructive text-sm", children: error });
|
|
393
|
+
if (results.length === 0 && debouncedSearch)
|
|
394
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-muted-foreground text-sm", children: intl.formatMessage(messages.no_results, { query: debouncedSearch }) });
|
|
395
|
+
if (results.length > 0)
|
|
396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-muted-foreground text-sm", children: intl.formatMessage(messages.results_count, {
|
|
397
|
+
count: results.length
|
|
398
|
+
}) });
|
|
399
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-muted-foreground text-sm", children: intl.formatMessage(messages.search_hint) });
|
|
400
|
+
}, [loading, error, results.length, debouncedSearch, intl]);
|
|
401
|
+
const itemToStringValue = (item) => {
|
|
402
|
+
var _a, _b;
|
|
403
|
+
return (_b = (_a = item == null ? void 0 : item.title) != null ? _a : item == null ? void 0 : item.id) != null ? _b : "";
|
|
404
|
+
};
|
|
405
|
+
const highlight = (text) => {
|
|
406
|
+
const t = (text != null ? text : "").toString();
|
|
407
|
+
const q = debouncedSearch.trim();
|
|
408
|
+
if (!q) return t;
|
|
409
|
+
const i = t.toLowerCase().indexOf(q.toLowerCase());
|
|
410
|
+
if (i === -1) return t;
|
|
411
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
412
|
+
t.slice(0, i),
|
|
413
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("mark", { className: "bg-primary/15 rounded px-0.5", children: t.slice(i, i + q.length) }),
|
|
414
|
+
t.slice(i + q.length)
|
|
415
|
+
] });
|
|
416
|
+
};
|
|
417
|
+
const indicator = getIndicatorProps(value == null ? void 0 : value.status, {
|
|
418
|
+
mapped: !!(value == null ? void 0 : value.id),
|
|
419
|
+
enable: showItemStatus
|
|
420
|
+
});
|
|
421
|
+
const selInd = value ? indicator : {
|
|
422
|
+
indicator: false,
|
|
423
|
+
indicatorColor: "default"
|
|
424
|
+
};
|
|
425
|
+
const handleClear = () => {
|
|
426
|
+
onChange(null);
|
|
427
|
+
};
|
|
428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col gap-3", children: [
|
|
429
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
430
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sight.Label, { htmlFor: searchId, children: intl.formatMessage(messages.controls) }),
|
|
431
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
432
|
+
import_sight.Autocomplete,
|
|
433
|
+
{
|
|
434
|
+
items: results,
|
|
435
|
+
value: search,
|
|
436
|
+
onValueChange: setSearch,
|
|
437
|
+
filter: null,
|
|
438
|
+
itemToStringValue,
|
|
439
|
+
children: [
|
|
440
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_sight.Autocomplete.Control, { children: [
|
|
441
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
442
|
+
import_sight.Autocomplete.Input,
|
|
443
|
+
{
|
|
444
|
+
id: searchId,
|
|
445
|
+
placeholder: intl.formatMessage(messages.search_placeholder)
|
|
446
|
+
}
|
|
447
|
+
),
|
|
448
|
+
search && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sight.Autocomplete.Clear, {})
|
|
449
|
+
] }),
|
|
450
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_sight.Autocomplete.Content, { children: [
|
|
451
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "sticky top-0 z-10 bg-background border-b px-2 py-1", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sight.Autocomplete.Status, { children: statusNode }) }),
|
|
452
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sight.Autocomplete.List, { children: (c) => {
|
|
453
|
+
var _a, _b, _c;
|
|
454
|
+
const id = (_a = c.id) != null ? _a : crypto.randomUUID();
|
|
455
|
+
const active = (value == null ? void 0 : value.id) && c.id === value.id;
|
|
456
|
+
const ind = getIndicatorProps(c.status, {
|
|
457
|
+
mapped: !!c.id,
|
|
458
|
+
enable: showItemStatus
|
|
459
|
+
});
|
|
460
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
461
|
+
import_sight.Autocomplete.Item,
|
|
462
|
+
{
|
|
463
|
+
value: c,
|
|
464
|
+
className: "rounded-lg data-[active=true]:bg-muted",
|
|
465
|
+
"data-active": active ? "true" : void 0,
|
|
466
|
+
"aria-selected": active ? "true" : "false",
|
|
467
|
+
onClick: () => onChange(c),
|
|
468
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-2.5 truncate", children: [
|
|
469
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
470
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "font-medium truncate", children: highlight((_b = c.title) != null ? _b : c.id) }),
|
|
471
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "text-sm text-muted-foreground truncate", children: [
|
|
472
|
+
highlight((_c = c.id) != null ? _c : ""),
|
|
473
|
+
c.updatedAt ? ` \u2022 ${intl.formatMessage(messages.updated_at, {
|
|
474
|
+
date: intl.formatDate(new Date(c.updatedAt), {
|
|
475
|
+
year: "numeric",
|
|
476
|
+
month: "short",
|
|
477
|
+
day: "2-digit",
|
|
478
|
+
hour: "2-digit",
|
|
479
|
+
minute: "2-digit"
|
|
480
|
+
})
|
|
481
|
+
})}` : ""
|
|
482
|
+
] })
|
|
483
|
+
] }),
|
|
484
|
+
showItemStatus && c.status && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
485
|
+
import_sight.Chip,
|
|
486
|
+
{
|
|
487
|
+
size: "sm",
|
|
488
|
+
variant: "ghost",
|
|
489
|
+
indicator: ind.indicator,
|
|
490
|
+
indicatorColor: ind.indicatorColor,
|
|
491
|
+
indicatorVariant: ind.indicatorVariant,
|
|
492
|
+
status: c.status,
|
|
493
|
+
children: c.status
|
|
494
|
+
}
|
|
495
|
+
)
|
|
496
|
+
] })
|
|
497
|
+
},
|
|
498
|
+
id
|
|
499
|
+
);
|
|
500
|
+
} })
|
|
501
|
+
] })
|
|
502
|
+
]
|
|
503
|
+
}
|
|
504
|
+
)
|
|
505
|
+
] }),
|
|
506
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center justify-between gap-2 border rounded-md px-3 py-2", children: [
|
|
507
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-3 min-w-0", children: [
|
|
508
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sight.Label, { children: intl.formatMessage(messages.selected) }),
|
|
509
|
+
value ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
510
|
+
import_sight.Chip,
|
|
511
|
+
{
|
|
512
|
+
size: "sm",
|
|
513
|
+
variant: "bordered",
|
|
514
|
+
indicator: selInd.indicator,
|
|
515
|
+
indicatorColor: selInd.indicatorColor,
|
|
516
|
+
indicatorVariant: selInd.indicatorVariant,
|
|
517
|
+
status: showItemStatus ? value == null ? void 0 : value.status : void 0,
|
|
518
|
+
children: value.title
|
|
519
|
+
}
|
|
520
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-muted-foreground text-sm", children: intl.formatMessage(messages.no_control_selected) })
|
|
521
|
+
] }),
|
|
522
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sight.Button, { variant: "ghost", onClick: handleClear, disabled: !value, children: intl.formatMessage(messages.clear) }) })
|
|
523
|
+
] })
|
|
524
|
+
] });
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
// src/components/use-control.ts
|
|
528
|
+
var import_react2 = require("react");
|
|
529
|
+
function useControl({ attrs, resolver, editor }) {
|
|
530
|
+
var _a;
|
|
531
|
+
const isEdit = !!editor.isEditable;
|
|
532
|
+
const interactive = !!editor.isEditable && !!resolver;
|
|
533
|
+
const [isMissing, setIsMissing] = (0, import_react2.useState)(false);
|
|
534
|
+
const [isOutdated, setIsOutdated] = (0, import_react2.useState)(false);
|
|
535
|
+
const lastCheckedRef = (0, import_react2.useRef)(0);
|
|
536
|
+
const mapped = !!attrs.id;
|
|
537
|
+
const ind = getIndicatorProps(attrs.status, {
|
|
538
|
+
mapped,
|
|
539
|
+
enable: !!((_a = attrs == null ? void 0 : attrs.options) == null ? void 0 : _a.showStatus)
|
|
540
|
+
});
|
|
541
|
+
(0, import_react2.useEffect)(() => {
|
|
542
|
+
if (!isEdit || !(resolver == null ? void 0 : resolver.getControl) || !mapped || !attrs.id) return;
|
|
543
|
+
let cancelled = false;
|
|
544
|
+
const now = Date.now();
|
|
545
|
+
if (now - lastCheckedRef.current < 1e4) return;
|
|
546
|
+
(async () => {
|
|
547
|
+
try {
|
|
548
|
+
if (!attrs.id) return;
|
|
549
|
+
lastCheckedRef.current = now;
|
|
550
|
+
const latest = await resolver.getControl(attrs.id);
|
|
551
|
+
if (cancelled) return;
|
|
552
|
+
if (!latest) {
|
|
553
|
+
setIsMissing(true);
|
|
554
|
+
setIsOutdated(false);
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
setIsMissing(false);
|
|
558
|
+
const localUpdated = attrs.updatedAt ? new Date(attrs.updatedAt).getTime() : 0;
|
|
559
|
+
const remoteUpdated = latest.updatedAt ? new Date(latest.updatedAt).getTime() : 0;
|
|
560
|
+
setIsOutdated(remoteUpdated > localUpdated);
|
|
561
|
+
} catch {
|
|
562
|
+
}
|
|
563
|
+
})();
|
|
564
|
+
return () => {
|
|
565
|
+
cancelled = true;
|
|
566
|
+
};
|
|
567
|
+
}, [isEdit, resolver, mapped, attrs.id, attrs.updatedAt]);
|
|
568
|
+
return { isEdit, interactive, ind, mapped, isMissing, isOutdated };
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
// src/components/control-view.tsx
|
|
572
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
135
573
|
var ControlView = (props) => {
|
|
136
574
|
var _a, _b, _c, _d, _e, _f;
|
|
137
575
|
const { node, editor } = props;
|
|
576
|
+
const intl = (0, import_react_intl3.useIntl)();
|
|
138
577
|
const attrs = node.attrs;
|
|
139
|
-
const
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
578
|
+
const resolver = props.extension.options.resolver;
|
|
579
|
+
const { isEdit, interactive, ind, mapped, isMissing, isOutdated } = useControl({
|
|
580
|
+
attrs,
|
|
581
|
+
resolver,
|
|
582
|
+
editor
|
|
583
|
+
});
|
|
584
|
+
const [open, setOpen] = (0, import_react4.useState)(false);
|
|
585
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react3.NodeViewWrapper, { as: "span", "data-kpx-control": true, "data-id": (_a = attrs.id) != null ? _a : "", children: [
|
|
586
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
587
|
+
import_sight2.Chip,
|
|
144
588
|
{
|
|
589
|
+
size: "sm",
|
|
145
590
|
"data-active": open,
|
|
146
591
|
contentEditable: false,
|
|
147
|
-
indicator:
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
},
|
|
592
|
+
indicator: ind.indicator,
|
|
593
|
+
indicatorColor: ind.indicatorColor,
|
|
594
|
+
indicatorVariant: ind.indicatorVariant,
|
|
595
|
+
...((_b = attrs.options) == null ? void 0 : _b.showStatus) && (attrs == null ? void 0 : attrs.status) && { status: attrs.status },
|
|
151
596
|
variant: "bordered",
|
|
152
|
-
color: !attrs.id ? "warning" : "default",
|
|
153
|
-
size: "sm",
|
|
597
|
+
color: !attrs.id ? "warning" : isEdit && (isOutdated || isMissing) ? "destructive" : "default",
|
|
154
598
|
onClick: () => {
|
|
155
599
|
setOpen((o) => !o);
|
|
156
600
|
},
|
|
157
601
|
"aria-label": interactive ? "Map control" : "Control",
|
|
158
|
-
|
|
602
|
+
tabIndex: interactive ? 0 : -1,
|
|
603
|
+
onKeyDown: (e) => {
|
|
604
|
+
if (!interactive) return;
|
|
605
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
606
|
+
e.preventDefault();
|
|
607
|
+
setOpen((o) => !o);
|
|
608
|
+
}
|
|
609
|
+
},
|
|
610
|
+
children: [
|
|
611
|
+
(_c = attrs.title) != null ? _c : "Unmapped Control",
|
|
612
|
+
isEdit && mapped && isOutdated && !isMissing && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Tooltip, { content: intl.formatMessage(messages.outdated_badge), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "ml-1 inline-block h-2 w-2 rounded-full bg-warning" }) }),
|
|
613
|
+
mapped && isMissing && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Tooltip, { content: intl.formatMessage(messages.missing_badge), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "ml-1 inline-block h-2 w-2 rounded-full bg-destructive" }) })
|
|
614
|
+
]
|
|
159
615
|
}
|
|
160
616
|
),
|
|
161
|
-
interactive && /* @__PURE__ */ (0,
|
|
617
|
+
interactive && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
618
|
+
EditControlDialog,
|
|
619
|
+
{
|
|
620
|
+
open,
|
|
621
|
+
onOpenChange: setOpen,
|
|
622
|
+
resolver,
|
|
623
|
+
isMissing,
|
|
624
|
+
isOutdated,
|
|
625
|
+
initialSelection: attrs.id ? {
|
|
626
|
+
id: attrs.id,
|
|
627
|
+
title: (_d = attrs.title) != null ? _d : "",
|
|
628
|
+
status: (_e = attrs.status) != null ? _e : null
|
|
629
|
+
} : null,
|
|
630
|
+
initialOptions: (_f = attrs.options) != null ? _f : { showStatus: true },
|
|
631
|
+
onSave: (selection, options) => {
|
|
632
|
+
var _a2, _b2, _c2;
|
|
633
|
+
props.editor.commands.updateControl({
|
|
634
|
+
id: (_a2 = selection == null ? void 0 : selection.id) != null ? _a2 : null,
|
|
635
|
+
title: (_b2 = selection == null ? void 0 : selection.title) != null ? _b2 : null,
|
|
636
|
+
status: (_c2 = selection == null ? void 0 : selection.status) != null ? _c2 : null,
|
|
637
|
+
options: options != null ? options : null,
|
|
638
|
+
updatedAt: selection == null ? void 0 : selection.updatedAt
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
)
|
|
162
643
|
] });
|
|
163
644
|
};
|
|
164
|
-
var EditControlDialog = ({
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
645
|
+
var EditControlDialog = ({
|
|
646
|
+
open,
|
|
647
|
+
onOpenChange,
|
|
648
|
+
resolver,
|
|
649
|
+
initialSelection,
|
|
650
|
+
initialOptions,
|
|
651
|
+
onSave,
|
|
652
|
+
isMissing,
|
|
653
|
+
isOutdated
|
|
654
|
+
}) => {
|
|
655
|
+
const intl = (0, import_i18n.useSafeIntl)();
|
|
656
|
+
const [selection, setSelection] = (0, import_react4.useState)(
|
|
657
|
+
initialSelection
|
|
658
|
+
);
|
|
659
|
+
const [options, setOptions] = (0, import_react4.useState)(initialOptions);
|
|
660
|
+
const isDirty = JSON.stringify(selection) !== JSON.stringify(initialSelection) || JSON.stringify(options) !== JSON.stringify(initialOptions);
|
|
661
|
+
if (!resolver) return null;
|
|
662
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Dialog, { open, onOpenChange, size: "2xl", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_sight2.Dialog.Content, { "aria-label": "Map Control", children: [
|
|
663
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_sight2.Dialog.Header, { children: [
|
|
664
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Dialog.Title, { children: (selection == null ? void 0 : selection.title) ? intl.formatMessage(messages.control_with_title, {
|
|
665
|
+
title: selection.title
|
|
666
|
+
}) : intl.formatMessage(messages.map_control) }),
|
|
667
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Dialog.Description, { children: intl.formatMessage(messages.settings_dialog_description) })
|
|
169
668
|
] }),
|
|
170
|
-
/* @__PURE__ */ (0,
|
|
171
|
-
|
|
172
|
-
/* @__PURE__ */ (0,
|
|
173
|
-
/* @__PURE__ */ (0,
|
|
669
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Dialog.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "grid grid-cols-1 gap-6 pt-2", children: [
|
|
670
|
+
(selection == null ? void 0 : selection.id) && isMissing && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Callout, { variant: "destructive", children: intl.formatMessage(messages.missing_callout) }),
|
|
671
|
+
!isMissing && isOutdated && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Callout, { variant: "warning", children: intl.formatMessage(messages.outdated_callout) }),
|
|
672
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
673
|
+
ControlPicker,
|
|
674
|
+
{
|
|
675
|
+
resolver,
|
|
676
|
+
value: selection,
|
|
677
|
+
onChange: (next) => setSelection(next),
|
|
678
|
+
debounceMs: 300,
|
|
679
|
+
timeoutMs: 5e3
|
|
680
|
+
}
|
|
681
|
+
),
|
|
682
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "flex flex-col gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex flex-col gap-3", children: [
|
|
683
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Label, { children: intl.formatMessage(messages.display_options) }),
|
|
684
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
685
|
+
import_sight2.Label,
|
|
686
|
+
{
|
|
687
|
+
variant: "secondary",
|
|
688
|
+
className: "flex items-center justify-between gap-3",
|
|
689
|
+
children: [
|
|
690
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: intl.formatMessage(messages.show_status_indicator) }),
|
|
691
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
692
|
+
import_sight2.Switch,
|
|
693
|
+
{
|
|
694
|
+
"aria-label": "Show status indicator",
|
|
695
|
+
checked: !!options.showStatus,
|
|
696
|
+
onCheckedChange: (checked) => setOptions((o) => ({
|
|
697
|
+
...o,
|
|
698
|
+
showStatus: checked
|
|
699
|
+
}))
|
|
700
|
+
}
|
|
701
|
+
)
|
|
702
|
+
]
|
|
703
|
+
}
|
|
704
|
+
)
|
|
705
|
+
] }) })
|
|
706
|
+
] }) }),
|
|
707
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_sight2.Dialog.Footer, { className: "sticky bottom-0 bg-background", children: [
|
|
708
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
709
|
+
import_sight2.Button,
|
|
710
|
+
{
|
|
711
|
+
variant: "ghost",
|
|
712
|
+
color: "default",
|
|
713
|
+
onClick: () => onOpenChange(false),
|
|
714
|
+
children: intl.formatMessage(messages.cancel)
|
|
715
|
+
}
|
|
716
|
+
),
|
|
717
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
718
|
+
import_sight2.Button,
|
|
719
|
+
{
|
|
720
|
+
color: "primary",
|
|
721
|
+
onClick: () => {
|
|
722
|
+
onSave(selection, options);
|
|
723
|
+
onOpenChange(false);
|
|
724
|
+
},
|
|
725
|
+
disabled: !isDirty,
|
|
726
|
+
children: intl.formatMessage(messages.save_settings)
|
|
727
|
+
}
|
|
728
|
+
)
|
|
174
729
|
] })
|
|
175
|
-
] }) })
|
|
730
|
+
] }) });
|
|
176
731
|
};
|
|
177
732
|
// Annotate the CommonJS export names for ESM import in node:
|
|
178
733
|
0 && (module.exports = {
|