@kopexa/extension-controlref 1.0.0 → 2.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.
Files changed (126) hide show
  1. package/dist/chunk-4C72VBLP.mjs +52 -0
  2. package/dist/chunk-A7FWOQDN.mjs +210 -0
  3. package/dist/chunk-AQTNFDGA.mjs +57 -0
  4. package/dist/chunk-D53W4HWR.mjs +245 -0
  5. package/dist/chunk-FTEE5U3H.mjs +37 -0
  6. package/dist/chunk-GYDJVHHG.mjs +250 -0
  7. package/dist/chunk-IMHLTRZJ.mjs +29 -0
  8. package/dist/chunk-JM66CQVD.mjs +10 -0
  9. package/dist/chunk-LMKP3DDN.mjs +189 -0
  10. package/dist/chunk-RTBFRPB3.mjs +186 -0
  11. package/dist/chunk-TEDXYIGO.mjs +38 -0
  12. package/dist/chunk-WIS7ZNTO.mjs +4 -0
  13. package/dist/chunk-X46EFFCE.mjs +148 -0
  14. package/dist/chunk-XHD2KFKQ.mjs +16 -0
  15. package/dist/chunk-ZRKYAFRY.mjs +46 -0
  16. package/dist/chunk-ZUR6XKMG.mjs +21 -0
  17. package/dist/components/control-block-view.d.mts +6 -0
  18. package/dist/components/control-block-view.d.ts +6 -0
  19. package/dist/components/control-block-view.js +789 -0
  20. package/dist/components/control-block-view.mjs +11 -0
  21. package/dist/components/control-implementation-view.d.mts +6 -0
  22. package/dist/components/control-implementation-view.d.ts +6 -0
  23. package/dist/components/control-implementation-view.js +52 -0
  24. package/dist/components/control-implementation-view.mjs +7 -0
  25. package/dist/components/control-picker.d.mts +25 -0
  26. package/dist/components/control-picker.d.ts +25 -0
  27. package/dist/components/control-picker.js +522 -0
  28. package/dist/components/control-picker.mjs +10 -0
  29. package/dist/components/control-view.js +677 -122
  30. package/dist/components/control-view.mjs +5 -5
  31. package/dist/components/use-control.d.mts +20 -0
  32. package/dist/components/use-control.d.ts +20 -0
  33. package/dist/components/use-control.js +127 -0
  34. package/dist/components/use-control.mjs +9 -0
  35. package/dist/control-block.d.mts +35 -0
  36. package/dist/control-block.d.ts +35 -0
  37. package/dist/control-block.js +1012 -0
  38. package/dist/control-block.mjs +17 -0
  39. package/dist/control-implementation.d.mts +7 -0
  40. package/dist/control-implementation.d.ts +7 -0
  41. package/dist/control-implementation.js +92 -0
  42. package/dist/control-implementation.mjs +9 -0
  43. package/dist/control.d.mts +31 -1
  44. package/dist/control.d.ts +31 -1
  45. package/dist/control.js +819 -136
  46. package/dist/control.mjs +7 -6
  47. package/dist/defaults.d.mts +3 -9
  48. package/dist/defaults.d.ts +3 -9
  49. package/dist/defaults.js +3 -20
  50. package/dist/defaults.mjs +3 -6
  51. package/dist/index.d.mts +10 -10
  52. package/dist/index.d.ts +10 -10
  53. package/dist/index.js +1229 -569
  54. package/dist/index.mjs +58 -21
  55. package/dist/messages/index.d.mts +135 -0
  56. package/dist/messages/index.d.ts +135 -0
  57. package/dist/messages/index.js +137 -2
  58. package/dist/messages/index.mjs +1 -2
  59. package/dist/role.d.mts +17 -0
  60. package/dist/role.d.ts +17 -0
  61. package/dist/role.js +5 -0
  62. package/dist/role.mjs +2 -0
  63. package/dist/types.d.mts +23 -16
  64. package/dist/types.d.ts +23 -16
  65. package/dist/utils/create-control-block.d.mts +7 -0
  66. package/dist/utils/create-control-block.d.ts +7 -0
  67. package/dist/utils/create-control-block.js +85 -0
  68. package/dist/utils/create-control-block.mjs +10 -0
  69. package/dist/utils/create-control-implementation.d.mts +8 -0
  70. package/dist/utils/create-control-implementation.d.ts +8 -0
  71. package/dist/utils/create-control-implementation.js +39 -0
  72. package/dist/utils/create-control-implementation.mjs +7 -0
  73. package/dist/utils/getControlNodeTypes.d.mts +5 -0
  74. package/dist/utils/getControlNodeTypes.d.ts +5 -0
  75. package/dist/utils/getControlNodeTypes.js +44 -0
  76. package/dist/utils/getControlNodeTypes.mjs +7 -0
  77. package/dist/utils/index.d.mts +7 -2
  78. package/dist/utils/index.d.ts +7 -2
  79. package/dist/utils/index.js +35 -3
  80. package/dist/utils/index.mjs +7 -4
  81. package/dist/utils/status-indicator.d.mts +18 -0
  82. package/dist/utils/status-indicator.d.ts +18 -0
  83. package/dist/utils/status-indicator.js +80 -0
  84. package/dist/utils/status-indicator.mjs +7 -0
  85. package/package.json +9 -9
  86. package/dist/card-variant.d.mts +0 -12
  87. package/dist/card-variant.d.ts +0 -12
  88. package/dist/card-variant.js +0 -66
  89. package/dist/card-variant.mjs +0 -8
  90. package/dist/chunk-AC4KL3WX.mjs +0 -29
  91. package/dist/chunk-AZ5M5MVC.mjs +0 -36
  92. package/dist/chunk-DTFR234X.mjs +0 -244
  93. package/dist/chunk-EDD7DYLE.mjs +0 -29
  94. package/dist/chunk-GC5EBQ7G.mjs +0 -10
  95. package/dist/chunk-H2ECPGOG.mjs +0 -81
  96. package/dist/chunk-KLX7Q3HL.mjs +0 -109
  97. package/dist/chunk-LKRTUIEV.mjs +0 -46
  98. package/dist/chunk-NAJ6IC4Y.mjs +0 -43
  99. package/dist/chunk-QI3ZPZTR.mjs +0 -26
  100. package/dist/chunk-SNRVOTF5.mjs +0 -8
  101. package/dist/chunk-VP5POY44.mjs +0 -57
  102. package/dist/chunk-WIR5FCIC.mjs +0 -110
  103. package/dist/control-ref-view.d.mts +0 -6
  104. package/dist/control-ref-view.d.ts +0 -6
  105. package/dist/control-ref-view.js +0 -615
  106. package/dist/control-ref-view.mjs +0 -15
  107. package/dist/control-ref.d.mts +0 -28
  108. package/dist/control-ref.d.ts +0 -28
  109. package/dist/control-ref.js +0 -687
  110. package/dist/control-ref.mjs +0 -16
  111. package/dist/i18n.d.mts +0 -4
  112. package/dist/i18n.d.ts +0 -4
  113. package/dist/i18n.js +0 -128
  114. package/dist/i18n.mjs +0 -10
  115. package/dist/lang/de.d.mts +0 -24
  116. package/dist/lang/de.d.ts +0 -24
  117. package/dist/lang/de.js +0 -25
  118. package/dist/lang/de.mjs +0 -8
  119. package/dist/lang/en.d.mts +0 -24
  120. package/dist/lang/en.d.ts +0 -24
  121. package/dist/lang/en.js +0 -25
  122. package/dist/lang/en.mjs +0 -8
  123. package/dist/settings-dialog.d.mts +0 -19
  124. package/dist/settings-dialog.d.ts +0 -19
  125. package/dist/settings-dialog.js +0 -371
  126. package/dist/settings-dialog.mjs +0 -9
@@ -1,687 +0,0 @@
1
- "use client";
2
- "use strict";
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __glob = (map) => (path) => {
10
- var fn = map[path];
11
- if (fn) return fn();
12
- throw new Error("Module not found in bundle: " + path);
13
- };
14
- var __commonJS = (cb, mod) => function __require() {
15
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
16
- };
17
- var __export = (target, all) => {
18
- for (var name in all)
19
- __defProp(target, name, { get: all[name], enumerable: true });
20
- };
21
- var __copyProps = (to, from, except, desc) => {
22
- if (from && typeof from === "object" || typeof from === "function") {
23
- for (let key of __getOwnPropNames(from))
24
- if (!__hasOwnProp.call(to, key) && key !== except)
25
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
26
- }
27
- return to;
28
- };
29
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
30
- // If the importer is in node compatibility mode or this is not an ESM
31
- // file that has been converted to a CommonJS file using a Babel-
32
- // compatible transform (i.e. "__esModule" has not been set), then set
33
- // "default" to the CommonJS "module.exports" for node compatibility.
34
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
35
- mod
36
- ));
37
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
38
-
39
- // src/lang/de.json
40
- var require_de = __commonJS({
41
- "src/lang/de.json"(exports2, module2) {
42
- module2.exports = {
43
- "editor.controlref.appearance": "Darstellung",
44
- "editor.controlref.border": "Rahmen",
45
- "editor.controlref.cancel": "Abbrechen",
46
- "editor.controlref.change_control": "Kontrolle \xE4ndern",
47
- "editor.controlref.control": "Kontrolle",
48
- "editor.controlref.controls": "Kontrollen",
49
- "editor.controlref.map_control": "Kontrolle zuordnen",
50
- "editor.controlref.radius": "Eckenradius",
51
- "editor.controlref.save_settings": "Einstellungen speichern",
52
- "editor.controlref.search_controls": "Kontrollen suchen...",
53
- "editor.controlref.settings": "Einstellungen",
54
- "editor.controlref.settings_dialog_description": "Passe Darstellung und Details der Kontrollreferenz an.",
55
- "editor.controlref.shadow": "Schatten",
56
- "editor.controlref.show_description": "Beschreibung anzeigen",
57
- "editor.controlref.show_implementations": "Umsetzungen anzeigen",
58
- "editor.controlref.show_status": "Status anzeigen",
59
- "editor.controlref.spacing": "Abst\xE4nde",
60
- "editor.controlref.variant": "Variante",
61
- "editor.controlref.variant_card": "Karte",
62
- "editor.controlref.variant_chip": "Chip"
63
- };
64
- }
65
- });
66
-
67
- // src/lang/en.json
68
- var require_en = __commonJS({
69
- "src/lang/en.json"(exports2, module2) {
70
- module2.exports = {
71
- "editor.controlref.appearance": "Appearance",
72
- "editor.controlref.border": "Border",
73
- "editor.controlref.cancel": "Cancel",
74
- "editor.controlref.change_control": "Change Control",
75
- "editor.controlref.control": "Control",
76
- "editor.controlref.controls": "Controls",
77
- "editor.controlref.map_control": "Map Control",
78
- "editor.controlref.radius": "Radius",
79
- "editor.controlref.save_settings": "Save Settings",
80
- "editor.controlref.search_controls": "Search controls...",
81
- "editor.controlref.settings": "Settings",
82
- "editor.controlref.settings_dialog_description": "Customize the appearance and details of the control reference.",
83
- "editor.controlref.shadow": "Shadow",
84
- "editor.controlref.show_description": "Show Description",
85
- "editor.controlref.show_implementations": "Show Implementations",
86
- "editor.controlref.show_status": "Show Status",
87
- "editor.controlref.spacing": "Spacing",
88
- "editor.controlref.variant": "Variant",
89
- "editor.controlref.variant_card": "Card",
90
- "editor.controlref.variant_chip": "Chip"
91
- };
92
- }
93
- });
94
-
95
- // src/control-ref.ts
96
- var control_ref_exports = {};
97
- __export(control_ref_exports, {
98
- ControlRef: () => ControlRef
99
- });
100
- module.exports = __toCommonJS(control_ref_exports);
101
- var import_core = require("@tiptap/core");
102
- var import_state = require("@tiptap/pm/state");
103
- var import_react5 = require("@tiptap/react");
104
-
105
- // src/control-ref-view.tsx
106
- var import_i18n = require("@kopexa/i18n");
107
- var import_sight3 = require("@kopexa/sight");
108
- var import_react3 = require("@tiptap/react");
109
- var import_react4 = require("react");
110
-
111
- // src/card-variant.tsx
112
- var import_sight = require("@kopexa/sight");
113
- var import_react = require("@tiptap/react");
114
- var import_jsx_runtime = require("react/jsx-runtime");
115
- var CardVariant = ({
116
- control,
117
- options,
118
- editable
119
- }) => {
120
- var _a, _b;
121
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
122
- import_sight.Card.Root,
123
- {
124
- shadow: options == null ? void 0 : options.cardShadow,
125
- border: options == null ? void 0 : options.cardBorder,
126
- radius: options == null ? void 0 : options.cardRadius,
127
- fullWidth: true,
128
- spacing: options == null ? void 0 : options.cardSpacing,
129
- isPressable: editable,
130
- className: "focus-within:ring-2 focus-within:ring-offset-2 focus-within:ring-primary/50",
131
- children: [
132
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_sight.Card.Header, { className: "flex items-start justify-between gap-2", children: [
133
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sight.Heading, { contentEditable: false, children: (_a = control.title) != null ? _a : "Unmapped Control" }),
134
- control.status && control.status !== "default" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sight.Chip, { size: "sm", variant: "bordered", indicator: true, contentEditable: false, children: control.status })
135
- ] }),
136
- (options == null ? void 0 : options.cardShowDescription) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sight.Card.Body, { className: "bg-muted", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.NodeViewContent, { className: "content is-editable py-4", as: "div" }) }),
137
- (options == null ? void 0 : options.cardShowImplementations) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sight.Card.Footer, { className: "flex flex-col gap-2", children: (control == null ? void 0 : control.implementations) && (control == null ? void 0 : control.implementations.length) === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-sm opacity-70", children: "No implementations" }) : (_b = control == null ? void 0 : control.implementations) == null ? void 0 : _b.map((r) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ImplementationCard, { impl: r }, r.id)) })
138
- ]
139
- }
140
- );
141
- };
142
- function ImplementationCard({ impl }) {
143
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sight.Card.Root, { shadow: "2xs", border: "default", radius: "sm", spacing: "sm", fullWidth: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sight.Card.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col gap-1", children: [
144
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "font-medium", contentEditable: false, children: impl.title }),
145
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-sm text-foreground/60", contentEditable: false, children: "No description" })
146
- ] }) }) });
147
- }
148
-
149
- // src/defaults.ts
150
- var DEFAULT_CONTROL_REF_OPTIONS = {
151
- variant: "chip",
152
- inlineShowStatus: true,
153
- cardShowDescription: true,
154
- cardShowImplementations: true,
155
- cardBorder: "default",
156
- cardShadow: "sm",
157
- cardRadius: "sm",
158
- cardSpacing: "md"
159
- };
160
-
161
- // src/i18n.ts
162
- var import_de = __toESM(require_de());
163
- var import_en = __toESM(require_en());
164
-
165
- // import("./lang/**/*.json") in src/i18n.ts
166
- var globImport_lang_json = __glob({
167
- "./lang/de.json": () => Promise.resolve().then(() => __toESM(require_de())),
168
- "./lang/en.json": () => Promise.resolve().then(() => __toESM(require_en()))
169
- });
170
-
171
- // src/i18n.ts
172
- var loadLocale = async (locale) => {
173
- try {
174
- return (await globImport_lang_json(`./lang/${locale}.json`)).default;
175
- } catch {
176
- return null;
177
- }
178
- };
179
- async function getMessages(locale) {
180
- if (locale === "en") return import_en.default;
181
- if (locale.toLowerCase() === "en") return import_en.default;
182
- if (locale.toLowerCase().startsWith("de")) return import_de.default;
183
- const other = await loadLocale(locale);
184
- return other ? { ...import_en.default, ...other } : import_en.default;
185
- }
186
-
187
- // src/settings-dialog.tsx
188
- var import_sight2 = require("@kopexa/sight");
189
- var import_react2 = require("react");
190
- var import_react_intl2 = require("react-intl");
191
-
192
- // src/messages/index.ts
193
- var import_react_intl = require("react-intl");
194
- var messages = (0, import_react_intl.defineMessages)({
195
- control: {
196
- id: "editor.controlref.control",
197
- defaultMessage: "Control",
198
- description: "Label for control"
199
- },
200
- settings_dialog_description: {
201
- id: "editor.controlref.settings_dialog_description",
202
- defaultMessage: "Customize the appearance and details of the control reference.",
203
- description: "Description for the settings dialog"
204
- },
205
- controls: {
206
- id: "editor.controlref.controls",
207
- defaultMessage: "Controls",
208
- description: "Label for controls"
209
- },
210
- change_control: {
211
- id: "editor.controlref.change_control",
212
- defaultMessage: "Change Control",
213
- description: "Label for change control button"
214
- },
215
- map_control: {
216
- id: "editor.controlref.map_control",
217
- defaultMessage: "Map Control",
218
- description: "Label for map control button"
219
- },
220
- settings: {
221
- id: "editor.controlref.settings",
222
- defaultMessage: "Settings",
223
- description: "Label for settings button"
224
- },
225
- appearance: {
226
- id: "editor.controlref.appearance",
227
- defaultMessage: "Appearance",
228
- description: "Label for appearance section"
229
- },
230
- search_controls: {
231
- id: "editor.controlref.search_controls",
232
- defaultMessage: "Search controls...",
233
- description: "Placeholder for search controls input"
234
- },
235
- variant: {
236
- id: "editor.controlref.variant",
237
- defaultMessage: "Variant",
238
- description: "Label for variant section"
239
- },
240
- variant_chip: {
241
- id: "editor.controlref.variant_chip",
242
- defaultMessage: "Chip",
243
- description: "Label for variant chip"
244
- },
245
- variant_card: {
246
- id: "editor.controlref.variant_card",
247
- defaultMessage: "Card",
248
- description: "Label for variant card"
249
- },
250
- show_status: {
251
- id: "editor.controlref.show_status",
252
- defaultMessage: "Show Status",
253
- description: "Label for show status toggle"
254
- },
255
- show_description: {
256
- id: "editor.controlref.show_description",
257
- defaultMessage: "Show Description",
258
- description: "Label for show description toggle"
259
- },
260
- show_implementations: {
261
- id: "editor.controlref.show_implementations",
262
- defaultMessage: "Show Implementations",
263
- description: "Label for show implementations toggle"
264
- },
265
- border: {
266
- id: "editor.controlref.border",
267
- defaultMessage: "Border",
268
- description: "Label for border toggle"
269
- },
270
- shadow: {
271
- id: "editor.controlref.shadow",
272
- defaultMessage: "Shadow",
273
- description: "Label for shadow toggle"
274
- },
275
- radius: {
276
- id: "editor.controlref.radius",
277
- defaultMessage: "Radius",
278
- description: "Label for radius toggle"
279
- },
280
- spacing: {
281
- id: "editor.controlref.spacing",
282
- defaultMessage: "Spacing",
283
- description: "Label for spacing section"
284
- },
285
- cancel: {
286
- id: "editor.controlref.cancel",
287
- defaultMessage: "Cancel",
288
- description: "Label for cancel button"
289
- },
290
- save_settings: {
291
- id: "editor.controlref.save_settings",
292
- defaultMessage: "Save Settings",
293
- description: "Label for save settings button"
294
- }
295
- });
296
-
297
- // src/settings-dialog.tsx
298
- var import_jsx_runtime2 = require("react/jsx-runtime");
299
- var SettingsDialog = (props) => {
300
- const {
301
- open,
302
- onOpenChange,
303
- controlId,
304
- controlTitle,
305
- options: initialOptions,
306
- onSave,
307
- onUnlink
308
- } = props;
309
- const intl = (0, import_react_intl2.useIntl)();
310
- const [options, setOptions] = (0, import_react2.useState)(initialOptions);
311
- const [tab, setTab] = (0, import_react2.useState)("link");
312
- const [selected, setSelected] = (0, import_react2.useState)(
313
- controlId ? {
314
- id: controlId,
315
- title: controlTitle != null ? controlTitle : intl.formatMessage(messages.control)
316
- } : null
317
- );
318
- const [q, setQ] = (0, import_react2.useState)("");
319
- const [loading, setLoading] = (0, import_react2.useState)(false);
320
- const [results, setResults] = (0, import_react2.useState)([]);
321
- (0, import_react2.useEffect)(() => {
322
- if (!open) return;
323
- setOptions(initialOptions);
324
- setSelected(
325
- controlId ? {
326
- id: controlId,
327
- title: controlTitle != null ? controlTitle : intl.formatMessage(messages.control)
328
- } : null
329
- );
330
- setQ("");
331
- setResults([]);
332
- setTab("link");
333
- }, [open, initialOptions, controlId, controlTitle, intl.formatMessage]);
334
- const handleOpenChange = (open2) => {
335
- onOpenChange(open2);
336
- };
337
- const save = () => {
338
- onSave({ control: selected, options });
339
- onOpenChange(false);
340
- };
341
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Dialog.Root, { open, onOpenChange: handleOpenChange, size: "2xl", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_sight2.Dialog.Content, { children: [
342
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_sight2.Dialog.Header, { children: [
343
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Dialog.Title, { children: selected ? intl.formatMessage(messages.change_control) : intl.formatMessage(messages.map_control) }),
344
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Dialog.Description, { children: intl.formatMessage(messages.settings_dialog_description) })
345
- ] }),
346
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Dialog.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_sight2.Tabs, { value: tab, onValueChange: (v) => setTab(v), children: [
347
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_sight2.Tabs.List, { children: [
348
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Tabs.Trigger, { value: "link", children: intl.formatMessage(messages.controls) }),
349
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Tabs.Trigger, { value: "settings", children: intl.formatMessage(messages.settings) }),
350
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Tabs.Trigger, { value: "appearance", children: intl.formatMessage(messages.appearance) })
351
- ] }),
352
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Tabs.Content, { value: "link", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
353
- import_sight2.Input,
354
- {
355
- placeholder: intl.formatMessage(messages.search_controls),
356
- value: q,
357
- onChange: (e) => setQ(e.currentTarget.value),
358
- onKeyDown: (e) => e.key === "Escape" && handleOpenChange(false)
359
- }
360
- ) }) }),
361
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_sight2.Tabs.Content, { value: "settings", className: "flex flex-col gap-3", children: [
362
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "grid grid-cols-[1fr_350px]", children: [
363
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "text-sm", children: intl.formatMessage(messages.variant) }),
364
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
365
- import_sight2.Select,
366
- {
367
- value: options == null ? void 0 : options.variant,
368
- onValueChange: (value) => setOptions((o) => ({
369
- ...o,
370
- variant: value
371
- })),
372
- children: [
373
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Select.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Select.Value, {}) }),
374
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_sight2.Select.Content, { children: [
375
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Select.Item, { value: "chip", children: intl.formatMessage(messages.variant_chip) }),
376
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Select.Item, { value: "card", children: intl.formatMessage(messages.variant_card) })
377
- ] })
378
- ]
379
- }
380
- )
381
- ] }),
382
- (options == null ? void 0 : options.variant) === "chip" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex items-center justify-between text-sm", children: [
383
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: intl.formatMessage(messages.show_status) }),
384
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
385
- import_sight2.Checkbox,
386
- {
387
- checked: !!(options == null ? void 0 : options.inlineShowStatus),
388
- onCheckedChange: (state) => setOptions((o) => ({
389
- ...o,
390
- inlineShowStatus: typeof state === "boolean" ? state : o.inlineShowStatus
391
- }))
392
- }
393
- )
394
- ] }),
395
- (options == null ? void 0 : options.variant) === "card" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex flex-col gap-3", children: [
396
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex items-center justify-between text-sm", children: [
397
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: intl.formatMessage(messages.show_description) }),
398
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
399
- import_sight2.Checkbox,
400
- {
401
- checked: !!(options == null ? void 0 : options.cardShowDescription),
402
- onCheckedChange: (state) => setOptions((o) => ({
403
- ...o,
404
- cardShowDescription: typeof state === "boolean" ? state : o.cardShowDescription
405
- }))
406
- }
407
- )
408
- ] }),
409
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex items-center justify-between text-sm", children: [
410
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: intl.formatMessage(messages.show_implementations) }),
411
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
412
- import_sight2.Checkbox,
413
- {
414
- checked: !!(options == null ? void 0 : options.cardShowImplementations),
415
- onCheckedChange: (state) => setOptions((o) => ({
416
- ...o,
417
- cardShowImplementations: typeof state === "boolean" ? state : o.cardShowImplementations
418
- }))
419
- }
420
- )
421
- ] })
422
- ] })
423
- ] }),
424
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_sight2.Tabs.Content, { value: "appearance", className: "flex flex-col gap-3", children: [
425
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "grid grid-cols-[1fr_350px]", children: [
426
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "text-sm", children: intl.formatMessage(messages.border) }),
427
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
428
- import_sight2.Select,
429
- {
430
- value: options == null ? void 0 : options.cardBorder,
431
- onValueChange: (value) => setOptions((o) => ({
432
- ...o,
433
- cardBorder: value
434
- })),
435
- children: [
436
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Select.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Select.Value, {}) }),
437
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_sight2.Select.Content, { children: [
438
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Select.Item, { value: "none", children: "none" }),
439
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Select.Item, { value: "default", children: "default" }),
440
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Select.Item, { value: "emphasized", children: "emphasized" })
441
- ] })
442
- ]
443
- }
444
- )
445
- ] }),
446
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "grid grid-cols-[1fr_350px]", children: [
447
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "text-sm", children: intl.formatMessage(messages.shadow) }),
448
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
449
- import_sight2.Select,
450
- {
451
- value: options == null ? void 0 : options.cardShadow,
452
- onValueChange: (value) => setOptions((o) => ({
453
- ...o,
454
- cardShadow: value
455
- })),
456
- children: [
457
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Select.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Select.Value, {}) }),
458
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_sight2.Select.Content, { children: [
459
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Select.Item, { value: "none", children: "none" }),
460
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Select.Item, { value: "2xs", children: "2xs" }),
461
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Select.Item, { value: "sm", children: "sm" }),
462
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Select.Item, { value: "md", children: "md" }),
463
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Select.Item, { value: "lg", children: "lg" })
464
- ] })
465
- ]
466
- }
467
- )
468
- ] }),
469
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "grid grid-cols-[1fr_350px]", children: [
470
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "text-sm", children: intl.formatMessage(messages.radius) }),
471
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
472
- import_sight2.Select,
473
- {
474
- value: options == null ? void 0 : options.cardRadius,
475
- onValueChange: (value) => setOptions((o) => ({
476
- ...o,
477
- cardRadius: value
478
- })),
479
- children: [
480
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Select.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Select.Value, {}) }),
481
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_sight2.Select.Content, { children: [
482
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Select.Item, { value: "none", children: "none" }),
483
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Select.Item, { value: "sm", children: "sm" }),
484
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Select.Item, { value: "md", children: "md" }),
485
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Select.Item, { value: "lg", children: "lg" })
486
- ] })
487
- ]
488
- }
489
- )
490
- ] }),
491
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "grid grid-cols-[1fr_350px]", children: [
492
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "text-sm", children: intl.formatMessage(messages.spacing) }),
493
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
494
- import_sight2.Select,
495
- {
496
- value: options == null ? void 0 : options.cardSpacing,
497
- onValueChange: (value) => setOptions((o) => ({
498
- ...o,
499
- cardSpacing: value
500
- })),
501
- children: [
502
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Select.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Select.Value, {}) }),
503
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_sight2.Select.Content, { children: [
504
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Select.Item, { value: "sm", children: "sm" }),
505
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Select.Item, { value: "md", children: "md" }),
506
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Select.Item, { value: "lg", children: "lg" }),
507
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Select.Item, { value: "lg", children: "xl" })
508
- ] })
509
- ]
510
- }
511
- )
512
- ] })
513
- ] })
514
- ] }) }),
515
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_sight2.Dialog.Footer, { children: [
516
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
517
- import_sight2.Button,
518
- {
519
- onClick: () => onOpenChange(false),
520
- variant: "ghost",
521
- color: "default",
522
- children: intl.formatMessage(messages.cancel)
523
- }
524
- ),
525
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sight2.Button, { onClick: save, children: intl.formatMessage(messages.save_settings) })
526
- ] })
527
- ] }) });
528
- };
529
-
530
- // src/control-ref-view.tsx
531
- var import_jsx_runtime3 = require("react/jsx-runtime");
532
- var implRows = [
533
- { id: "1", title: "Alarmanlage", description: null },
534
- { id: "2", title: "Videokameras", description: null },
535
- { id: "3", title: "Zutrittsprotokolle", description: null }
536
- ];
537
- var ControlRefView = (props) => {
538
- var _a, _b, _c, _d;
539
- const { node, editor, updateAttributes } = props;
540
- const attrs = node.attrs;
541
- const interactive = !!editor.isEditable;
542
- const [open, setOpen] = (0, import_react4.useState)(false);
543
- const options = (0, import_react4.useMemo)(
544
- () => {
545
- var _a2;
546
- return { ...DEFAULT_CONTROL_REF_OPTIONS, ...(_a2 = attrs.options) != null ? _a2 : {} };
547
- },
548
- [attrs.options]
549
- );
550
- const variant = (_a = options.variant) != null ? _a : "chip";
551
- const isInline = variant === "chip";
552
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_i18n.I18nProvider, { loaderFn: getMessages, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
553
- import_react3.NodeViewWrapper,
554
- {
555
- as: isInline ? "span" : "div",
556
- className: [isInline ? "inline-flex" : "flex flex-col", "gap-2"].join(
557
- " "
558
- ),
559
- "data-testid": "controlRef",
560
- "data-kpx-control-ref": true,
561
- "data-id": (_b = attrs.id) != null ? _b : "",
562
- children: [
563
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
564
- SettingsDialog,
565
- {
566
- open,
567
- onOpenChange: setOpen,
568
- controlId: attrs.id,
569
- controlTitle: attrs.title,
570
- options: attrs.options,
571
- onSave: ({ control, options: options2 }) => {
572
- var _a2, _b2;
573
- updateAttributes({
574
- id: (_a2 = control == null ? void 0 : control.id) != null ? _a2 : null,
575
- title: (_b2 = control == null ? void 0 : control.title) != null ? _b2 : null,
576
- options: options2
577
- });
578
- },
579
- onUnlink: () => updateAttributes({ id: null, title: null })
580
- }
581
- ),
582
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
583
- import_sight3.Chip,
584
- {
585
- "data-active": open,
586
- contentEditable: false,
587
- indicator: options.inlineShowStatus,
588
- ...(options == null ? void 0 : options.inlineShowStatus) && {
589
- status: (_c = attrs.status) != null ? _c : void 0
590
- },
591
- variant: "bordered",
592
- color: !attrs.id ? "warning" : "default",
593
- size: isInline ? "sm" : "md",
594
- onClick: () => {
595
- setOpen((o) => !o);
596
- },
597
- "aria-label": interactive ? "Map control" : "Control",
598
- children: (_d = attrs.title) != null ? _d : "Unmapped Control"
599
- }
600
- ),
601
- variant === "card" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
602
- CardVariant,
603
- {
604
- control: {
605
- id: attrs.id,
606
- title: attrs.title,
607
- status: attrs.status,
608
- implementations: implRows
609
- },
610
- options
611
- }
612
- )
613
- ]
614
- }
615
- ) });
616
- };
617
-
618
- // src/control-ref.ts
619
- var ControlRef = import_core.Node.create({
620
- name: "controlRef",
621
- content: "inline*",
622
- inline: false,
623
- draggable: false,
624
- selectable: true,
625
- defining: true,
626
- isolating: true,
627
- addOptions() {
628
- return {
629
- getters: void 0
630
- };
631
- },
632
- group() {
633
- return "block";
634
- },
635
- addAttributes() {
636
- return {
637
- id: { default: null },
638
- title: { default: null },
639
- updatedAt: { default: null },
640
- status: { default: null },
641
- options: { default: DEFAULT_CONTROL_REF_OPTIONS }
642
- // JSON Object <- all UI config lives here
643
- };
644
- },
645
- parseHTML() {
646
- return [
647
- { tag: "span[data-kpx-control-ref]" },
648
- { tag: "div[data-kpx-control-ref]" }
649
- ];
650
- },
651
- renderHTML({ node, HTMLAttributes }) {
652
- var _a;
653
- return [
654
- "span",
655
- (0, import_core.mergeAttributes)(HTMLAttributes, {
656
- "data-kpx-control-ref": "",
657
- "data-id": node.attrs.id,
658
- "data-title": node.attrs.title
659
- }),
660
- (_a = HTMLAttributes.title) != null ? _a : "Control"
661
- ];
662
- },
663
- addCommands() {
664
- return {
665
- insertControlRef: () => ({ tr, dispatch }) => {
666
- const node = this.type.create({
667
- id: null,
668
- title: null,
669
- status: null,
670
- options: DEFAULT_CONTROL_REF_OPTIONS
671
- });
672
- if (dispatch) {
673
- const offset = tr.selection.from + 1;
674
- tr.replaceSelectionWith(node).scrollIntoView().setSelection(import_state.TextSelection.near(tr.doc.resolve(offset)));
675
- }
676
- return true;
677
- }
678
- };
679
- },
680
- addNodeView() {
681
- return (0, import_react5.ReactNodeViewRenderer)(ControlRefView, { as: "span" });
682
- }
683
- });
684
- // Annotate the CommonJS export names for ESM import in node:
685
- 0 && (module.exports = {
686
- ControlRef
687
- });