@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,29 +0,0 @@
1
- "use client";
2
-
3
- // src/lang/en.json
4
- var en_default = {
5
- "editor.controlref.appearance": "Appearance",
6
- "editor.controlref.border": "Border",
7
- "editor.controlref.cancel": "Cancel",
8
- "editor.controlref.change_control": "Change Control",
9
- "editor.controlref.control": "Control",
10
- "editor.controlref.controls": "Controls",
11
- "editor.controlref.map_control": "Map Control",
12
- "editor.controlref.radius": "Radius",
13
- "editor.controlref.save_settings": "Save Settings",
14
- "editor.controlref.search_controls": "Search controls...",
15
- "editor.controlref.settings": "Settings",
16
- "editor.controlref.settings_dialog_description": "Customize the appearance and details of the control reference.",
17
- "editor.controlref.shadow": "Shadow",
18
- "editor.controlref.show_description": "Show Description",
19
- "editor.controlref.show_implementations": "Show Implementations",
20
- "editor.controlref.show_status": "Show Status",
21
- "editor.controlref.spacing": "Spacing",
22
- "editor.controlref.variant": "Variant",
23
- "editor.controlref.variant_card": "Card",
24
- "editor.controlref.variant_chip": "Chip"
25
- };
26
-
27
- export {
28
- en_default
29
- };
@@ -1,36 +0,0 @@
1
- "use client";
2
- import {
3
- de_default
4
- } from "./chunk-EDD7DYLE.mjs";
5
- import {
6
- en_default
7
- } from "./chunk-AC4KL3WX.mjs";
8
- import {
9
- __glob
10
- } from "./chunk-GC5EBQ7G.mjs";
11
-
12
- // import("./lang/**/*.json") in src/i18n.ts
13
- var globImport_lang_json = __glob({
14
- "./lang/de.json": () => import("./lang/de.mjs"),
15
- "./lang/en.json": () => import("./lang/en.mjs")
16
- });
17
-
18
- // src/i18n.ts
19
- var loadLocale = async (locale) => {
20
- try {
21
- return (await globImport_lang_json(`./lang/${locale}.json`)).default;
22
- } catch {
23
- return null;
24
- }
25
- };
26
- async function getMessages(locale) {
27
- if (locale === "en") return en_default;
28
- if (locale.toLowerCase() === "en") return en_default;
29
- if (locale.toLowerCase().startsWith("de")) return de_default;
30
- const other = await loadLocale(locale);
31
- return other ? { ...en_default, ...other } : en_default;
32
- }
33
-
34
- export {
35
- getMessages
36
- };
@@ -1,244 +0,0 @@
1
- "use client";
2
- import {
3
- messages
4
- } from "./chunk-WIR5FCIC.mjs";
5
-
6
- // src/settings-dialog.tsx
7
- import { Button, Checkbox, Dialog, Input, Select, Tabs } from "@kopexa/sight";
8
- import { useEffect, useState } from "react";
9
- import { useIntl } from "react-intl";
10
- import { jsx, jsxs } from "react/jsx-runtime";
11
- var SettingsDialog = (props) => {
12
- const {
13
- open,
14
- onOpenChange,
15
- controlId,
16
- controlTitle,
17
- options: initialOptions,
18
- onSave,
19
- onUnlink
20
- } = props;
21
- const intl = useIntl();
22
- const [options, setOptions] = useState(initialOptions);
23
- const [tab, setTab] = useState("link");
24
- const [selected, setSelected] = useState(
25
- controlId ? {
26
- id: controlId,
27
- title: controlTitle != null ? controlTitle : intl.formatMessage(messages.control)
28
- } : null
29
- );
30
- const [q, setQ] = useState("");
31
- const [loading, setLoading] = useState(false);
32
- const [results, setResults] = useState([]);
33
- useEffect(() => {
34
- if (!open) return;
35
- setOptions(initialOptions);
36
- setSelected(
37
- controlId ? {
38
- id: controlId,
39
- title: controlTitle != null ? controlTitle : intl.formatMessage(messages.control)
40
- } : null
41
- );
42
- setQ("");
43
- setResults([]);
44
- setTab("link");
45
- }, [open, initialOptions, controlId, controlTitle, intl.formatMessage]);
46
- const handleOpenChange = (open2) => {
47
- onOpenChange(open2);
48
- };
49
- const save = () => {
50
- onSave({ control: selected, options });
51
- onOpenChange(false);
52
- };
53
- return /* @__PURE__ */ jsx(Dialog.Root, { open, onOpenChange: handleOpenChange, size: "2xl", children: /* @__PURE__ */ jsxs(Dialog.Content, { children: [
54
- /* @__PURE__ */ jsxs(Dialog.Header, { children: [
55
- /* @__PURE__ */ jsx(Dialog.Title, { children: selected ? intl.formatMessage(messages.change_control) : intl.formatMessage(messages.map_control) }),
56
- /* @__PURE__ */ jsx(Dialog.Description, { children: intl.formatMessage(messages.settings_dialog_description) })
57
- ] }),
58
- /* @__PURE__ */ jsx(Dialog.Body, { children: /* @__PURE__ */ jsxs(Tabs, { value: tab, onValueChange: (v) => setTab(v), children: [
59
- /* @__PURE__ */ jsxs(Tabs.List, { children: [
60
- /* @__PURE__ */ jsx(Tabs.Trigger, { value: "link", children: intl.formatMessage(messages.controls) }),
61
- /* @__PURE__ */ jsx(Tabs.Trigger, { value: "settings", children: intl.formatMessage(messages.settings) }),
62
- /* @__PURE__ */ jsx(Tabs.Trigger, { value: "appearance", children: intl.formatMessage(messages.appearance) })
63
- ] }),
64
- /* @__PURE__ */ jsx(Tabs.Content, { value: "link", children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx(
65
- Input,
66
- {
67
- placeholder: intl.formatMessage(messages.search_controls),
68
- value: q,
69
- onChange: (e) => setQ(e.currentTarget.value),
70
- onKeyDown: (e) => e.key === "Escape" && handleOpenChange(false)
71
- }
72
- ) }) }),
73
- /* @__PURE__ */ jsxs(Tabs.Content, { value: "settings", className: "flex flex-col gap-3", children: [
74
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-[1fr_350px]", children: [
75
- /* @__PURE__ */ jsx("div", { className: "text-sm", children: intl.formatMessage(messages.variant) }),
76
- /* @__PURE__ */ jsxs(
77
- Select,
78
- {
79
- value: options == null ? void 0 : options.variant,
80
- onValueChange: (value) => setOptions((o) => ({
81
- ...o,
82
- variant: value
83
- })),
84
- children: [
85
- /* @__PURE__ */ jsx(Select.Trigger, { children: /* @__PURE__ */ jsx(Select.Value, {}) }),
86
- /* @__PURE__ */ jsxs(Select.Content, { children: [
87
- /* @__PURE__ */ jsx(Select.Item, { value: "chip", children: intl.formatMessage(messages.variant_chip) }),
88
- /* @__PURE__ */ jsx(Select.Item, { value: "card", children: intl.formatMessage(messages.variant_card) })
89
- ] })
90
- ]
91
- }
92
- )
93
- ] }),
94
- (options == null ? void 0 : options.variant) === "chip" && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-sm", children: [
95
- /* @__PURE__ */ jsx("span", { children: intl.formatMessage(messages.show_status) }),
96
- /* @__PURE__ */ jsx(
97
- Checkbox,
98
- {
99
- checked: !!(options == null ? void 0 : options.inlineShowStatus),
100
- onCheckedChange: (state) => setOptions((o) => ({
101
- ...o,
102
- inlineShowStatus: typeof state === "boolean" ? state : o.inlineShowStatus
103
- }))
104
- }
105
- )
106
- ] }),
107
- (options == null ? void 0 : options.variant) === "card" && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
108
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-sm", children: [
109
- /* @__PURE__ */ jsx("span", { children: intl.formatMessage(messages.show_description) }),
110
- /* @__PURE__ */ jsx(
111
- Checkbox,
112
- {
113
- checked: !!(options == null ? void 0 : options.cardShowDescription),
114
- onCheckedChange: (state) => setOptions((o) => ({
115
- ...o,
116
- cardShowDescription: typeof state === "boolean" ? state : o.cardShowDescription
117
- }))
118
- }
119
- )
120
- ] }),
121
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-sm", children: [
122
- /* @__PURE__ */ jsx("span", { children: intl.formatMessage(messages.show_implementations) }),
123
- /* @__PURE__ */ jsx(
124
- Checkbox,
125
- {
126
- checked: !!(options == null ? void 0 : options.cardShowImplementations),
127
- onCheckedChange: (state) => setOptions((o) => ({
128
- ...o,
129
- cardShowImplementations: typeof state === "boolean" ? state : o.cardShowImplementations
130
- }))
131
- }
132
- )
133
- ] })
134
- ] })
135
- ] }),
136
- /* @__PURE__ */ jsxs(Tabs.Content, { value: "appearance", className: "flex flex-col gap-3", children: [
137
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-[1fr_350px]", children: [
138
- /* @__PURE__ */ jsx("div", { className: "text-sm", children: intl.formatMessage(messages.border) }),
139
- /* @__PURE__ */ jsxs(
140
- Select,
141
- {
142
- value: options == null ? void 0 : options.cardBorder,
143
- onValueChange: (value) => setOptions((o) => ({
144
- ...o,
145
- cardBorder: value
146
- })),
147
- children: [
148
- /* @__PURE__ */ jsx(Select.Trigger, { children: /* @__PURE__ */ jsx(Select.Value, {}) }),
149
- /* @__PURE__ */ jsxs(Select.Content, { children: [
150
- /* @__PURE__ */ jsx(Select.Item, { value: "none", children: "none" }),
151
- /* @__PURE__ */ jsx(Select.Item, { value: "default", children: "default" }),
152
- /* @__PURE__ */ jsx(Select.Item, { value: "emphasized", children: "emphasized" })
153
- ] })
154
- ]
155
- }
156
- )
157
- ] }),
158
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-[1fr_350px]", children: [
159
- /* @__PURE__ */ jsx("div", { className: "text-sm", children: intl.formatMessage(messages.shadow) }),
160
- /* @__PURE__ */ jsxs(
161
- Select,
162
- {
163
- value: options == null ? void 0 : options.cardShadow,
164
- onValueChange: (value) => setOptions((o) => ({
165
- ...o,
166
- cardShadow: value
167
- })),
168
- children: [
169
- /* @__PURE__ */ jsx(Select.Trigger, { children: /* @__PURE__ */ jsx(Select.Value, {}) }),
170
- /* @__PURE__ */ jsxs(Select.Content, { children: [
171
- /* @__PURE__ */ jsx(Select.Item, { value: "none", children: "none" }),
172
- /* @__PURE__ */ jsx(Select.Item, { value: "2xs", children: "2xs" }),
173
- /* @__PURE__ */ jsx(Select.Item, { value: "sm", children: "sm" }),
174
- /* @__PURE__ */ jsx(Select.Item, { value: "md", children: "md" }),
175
- /* @__PURE__ */ jsx(Select.Item, { value: "lg", children: "lg" })
176
- ] })
177
- ]
178
- }
179
- )
180
- ] }),
181
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-[1fr_350px]", children: [
182
- /* @__PURE__ */ jsx("div", { className: "text-sm", children: intl.formatMessage(messages.radius) }),
183
- /* @__PURE__ */ jsxs(
184
- Select,
185
- {
186
- value: options == null ? void 0 : options.cardRadius,
187
- onValueChange: (value) => setOptions((o) => ({
188
- ...o,
189
- cardRadius: value
190
- })),
191
- children: [
192
- /* @__PURE__ */ jsx(Select.Trigger, { children: /* @__PURE__ */ jsx(Select.Value, {}) }),
193
- /* @__PURE__ */ jsxs(Select.Content, { children: [
194
- /* @__PURE__ */ jsx(Select.Item, { value: "none", children: "none" }),
195
- /* @__PURE__ */ jsx(Select.Item, { value: "sm", children: "sm" }),
196
- /* @__PURE__ */ jsx(Select.Item, { value: "md", children: "md" }),
197
- /* @__PURE__ */ jsx(Select.Item, { value: "lg", children: "lg" })
198
- ] })
199
- ]
200
- }
201
- )
202
- ] }),
203
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-[1fr_350px]", children: [
204
- /* @__PURE__ */ jsx("div", { className: "text-sm", children: intl.formatMessage(messages.spacing) }),
205
- /* @__PURE__ */ jsxs(
206
- Select,
207
- {
208
- value: options == null ? void 0 : options.cardSpacing,
209
- onValueChange: (value) => setOptions((o) => ({
210
- ...o,
211
- cardSpacing: value
212
- })),
213
- children: [
214
- /* @__PURE__ */ jsx(Select.Trigger, { children: /* @__PURE__ */ jsx(Select.Value, {}) }),
215
- /* @__PURE__ */ jsxs(Select.Content, { children: [
216
- /* @__PURE__ */ jsx(Select.Item, { value: "sm", children: "sm" }),
217
- /* @__PURE__ */ jsx(Select.Item, { value: "md", children: "md" }),
218
- /* @__PURE__ */ jsx(Select.Item, { value: "lg", children: "lg" }),
219
- /* @__PURE__ */ jsx(Select.Item, { value: "lg", children: "xl" })
220
- ] })
221
- ]
222
- }
223
- )
224
- ] })
225
- ] })
226
- ] }) }),
227
- /* @__PURE__ */ jsxs(Dialog.Footer, { children: [
228
- /* @__PURE__ */ jsx(
229
- Button,
230
- {
231
- onClick: () => onOpenChange(false),
232
- variant: "ghost",
233
- color: "default",
234
- children: intl.formatMessage(messages.cancel)
235
- }
236
- ),
237
- /* @__PURE__ */ jsx(Button, { onClick: save, children: intl.formatMessage(messages.save_settings) })
238
- ] })
239
- ] }) });
240
- };
241
-
242
- export {
243
- SettingsDialog
244
- };
@@ -1,29 +0,0 @@
1
- "use client";
2
-
3
- // src/lang/de.json
4
- var de_default = {
5
- "editor.controlref.appearance": "Darstellung",
6
- "editor.controlref.border": "Rahmen",
7
- "editor.controlref.cancel": "Abbrechen",
8
- "editor.controlref.change_control": "Kontrolle \xE4ndern",
9
- "editor.controlref.control": "Kontrolle",
10
- "editor.controlref.controls": "Kontrollen",
11
- "editor.controlref.map_control": "Kontrolle zuordnen",
12
- "editor.controlref.radius": "Eckenradius",
13
- "editor.controlref.save_settings": "Einstellungen speichern",
14
- "editor.controlref.search_controls": "Kontrollen suchen...",
15
- "editor.controlref.settings": "Einstellungen",
16
- "editor.controlref.settings_dialog_description": "Passe Darstellung und Details der Kontrollreferenz an.",
17
- "editor.controlref.shadow": "Schatten",
18
- "editor.controlref.show_description": "Beschreibung anzeigen",
19
- "editor.controlref.show_implementations": "Umsetzungen anzeigen",
20
- "editor.controlref.show_status": "Status anzeigen",
21
- "editor.controlref.spacing": "Abst\xE4nde",
22
- "editor.controlref.variant": "Variante",
23
- "editor.controlref.variant_card": "Karte",
24
- "editor.controlref.variant_chip": "Chip"
25
- };
26
-
27
- export {
28
- de_default
29
- };
@@ -1,10 +0,0 @@
1
- "use client";
2
- var __glob = (map) => (path) => {
3
- var fn = map[path];
4
- if (fn) return fn();
5
- throw new Error("Module not found in bundle: " + path);
6
- };
7
-
8
- export {
9
- __glob
10
- };
@@ -1,81 +0,0 @@
1
- "use client";
2
- import {
3
- ControlRefView
4
- } from "./chunk-KLX7Q3HL.mjs";
5
- import {
6
- DEFAULT_CONTROL_REF_OPTIONS
7
- } from "./chunk-QI3ZPZTR.mjs";
8
-
9
- // src/control-ref.ts
10
- import { mergeAttributes, Node } from "@tiptap/core";
11
- import { TextSelection } from "@tiptap/pm/state";
12
- import { ReactNodeViewRenderer } from "@tiptap/react";
13
- var ControlRef = Node.create({
14
- name: "controlRef",
15
- content: "inline*",
16
- inline: false,
17
- draggable: false,
18
- selectable: true,
19
- defining: true,
20
- isolating: true,
21
- addOptions() {
22
- return {
23
- getters: void 0
24
- };
25
- },
26
- group() {
27
- return "block";
28
- },
29
- addAttributes() {
30
- return {
31
- id: { default: null },
32
- title: { default: null },
33
- updatedAt: { default: null },
34
- status: { default: null },
35
- options: { default: DEFAULT_CONTROL_REF_OPTIONS }
36
- // JSON Object <- all UI config lives here
37
- };
38
- },
39
- parseHTML() {
40
- return [
41
- { tag: "span[data-kpx-control-ref]" },
42
- { tag: "div[data-kpx-control-ref]" }
43
- ];
44
- },
45
- renderHTML({ node, HTMLAttributes }) {
46
- var _a;
47
- return [
48
- "span",
49
- mergeAttributes(HTMLAttributes, {
50
- "data-kpx-control-ref": "",
51
- "data-id": node.attrs.id,
52
- "data-title": node.attrs.title
53
- }),
54
- (_a = HTMLAttributes.title) != null ? _a : "Control"
55
- ];
56
- },
57
- addCommands() {
58
- return {
59
- insertControlRef: () => ({ tr, dispatch }) => {
60
- const node = this.type.create({
61
- id: null,
62
- title: null,
63
- status: null,
64
- options: DEFAULT_CONTROL_REF_OPTIONS
65
- });
66
- if (dispatch) {
67
- const offset = tr.selection.from + 1;
68
- tr.replaceSelectionWith(node).scrollIntoView().setSelection(TextSelection.near(tr.doc.resolve(offset)));
69
- }
70
- return true;
71
- }
72
- };
73
- },
74
- addNodeView() {
75
- return ReactNodeViewRenderer(ControlRefView, { as: "span" });
76
- }
77
- });
78
-
79
- export {
80
- ControlRef
81
- };
@@ -1,109 +0,0 @@
1
- "use client";
2
- import {
3
- CardVariant
4
- } from "./chunk-NAJ6IC4Y.mjs";
5
- import {
6
- DEFAULT_CONTROL_REF_OPTIONS
7
- } from "./chunk-QI3ZPZTR.mjs";
8
- import {
9
- getMessages
10
- } from "./chunk-AZ5M5MVC.mjs";
11
- import {
12
- SettingsDialog
13
- } from "./chunk-DTFR234X.mjs";
14
-
15
- // src/control-ref-view.tsx
16
- import { I18nProvider } from "@kopexa/i18n";
17
- import { Chip } from "@kopexa/sight";
18
- import { NodeViewWrapper } from "@tiptap/react";
19
- import { useMemo, useState } from "react";
20
- import { jsx, jsxs } from "react/jsx-runtime";
21
- var implRows = [
22
- { id: "1", title: "Alarmanlage", description: null },
23
- { id: "2", title: "Videokameras", description: null },
24
- { id: "3", title: "Zutrittsprotokolle", description: null }
25
- ];
26
- var ControlRefView = (props) => {
27
- var _a, _b, _c, _d;
28
- const { node, editor, updateAttributes } = props;
29
- const attrs = node.attrs;
30
- const interactive = !!editor.isEditable;
31
- const [open, setOpen] = useState(false);
32
- const options = useMemo(
33
- () => {
34
- var _a2;
35
- return { ...DEFAULT_CONTROL_REF_OPTIONS, ...(_a2 = attrs.options) != null ? _a2 : {} };
36
- },
37
- [attrs.options]
38
- );
39
- const variant = (_a = options.variant) != null ? _a : "chip";
40
- const isInline = variant === "chip";
41
- return /* @__PURE__ */ jsx(I18nProvider, { loaderFn: getMessages, children: /* @__PURE__ */ jsxs(
42
- NodeViewWrapper,
43
- {
44
- as: isInline ? "span" : "div",
45
- className: [isInline ? "inline-flex" : "flex flex-col", "gap-2"].join(
46
- " "
47
- ),
48
- "data-testid": "controlRef",
49
- "data-kpx-control-ref": true,
50
- "data-id": (_b = attrs.id) != null ? _b : "",
51
- children: [
52
- /* @__PURE__ */ jsx(
53
- SettingsDialog,
54
- {
55
- open,
56
- onOpenChange: setOpen,
57
- controlId: attrs.id,
58
- controlTitle: attrs.title,
59
- options: attrs.options,
60
- onSave: ({ control, options: options2 }) => {
61
- var _a2, _b2;
62
- updateAttributes({
63
- id: (_a2 = control == null ? void 0 : control.id) != null ? _a2 : null,
64
- title: (_b2 = control == null ? void 0 : control.title) != null ? _b2 : null,
65
- options: options2
66
- });
67
- },
68
- onUnlink: () => updateAttributes({ id: null, title: null })
69
- }
70
- ),
71
- /* @__PURE__ */ jsx(
72
- Chip,
73
- {
74
- "data-active": open,
75
- contentEditable: false,
76
- indicator: options.inlineShowStatus,
77
- ...(options == null ? void 0 : options.inlineShowStatus) && {
78
- status: (_c = attrs.status) != null ? _c : void 0
79
- },
80
- variant: "bordered",
81
- color: !attrs.id ? "warning" : "default",
82
- size: isInline ? "sm" : "md",
83
- onClick: () => {
84
- setOpen((o) => !o);
85
- },
86
- "aria-label": interactive ? "Map control" : "Control",
87
- children: (_d = attrs.title) != null ? _d : "Unmapped Control"
88
- }
89
- ),
90
- variant === "card" && /* @__PURE__ */ jsx(
91
- CardVariant,
92
- {
93
- control: {
94
- id: attrs.id,
95
- title: attrs.title,
96
- status: attrs.status,
97
- implementations: implRows
98
- },
99
- options
100
- }
101
- )
102
- ]
103
- }
104
- ) });
105
- };
106
-
107
- export {
108
- ControlRefView
109
- };
@@ -1,46 +0,0 @@
1
- "use client";
2
- import {
3
- ControlView
4
- } from "./chunk-VP5POY44.mjs";
5
-
6
- // src/control.ts
7
- import { mergeAttributes, Node } from "@tiptap/core";
8
- import { ReactNodeViewRenderer } from "@tiptap/react";
9
- var Control = Node.create({
10
- name: "control",
11
- inline: true,
12
- draggable: true,
13
- addAttributes() {
14
- return {
15
- id: { default: null },
16
- title: { default: null },
17
- updatedAt: { default: null },
18
- status: { default: null },
19
- options: { default: null }
20
- // JSON Object <- all UI config lives here
21
- };
22
- },
23
- parseHTML() {
24
- return [{ tag: "span[data-type=control]" }];
25
- },
26
- renderHTML({ node, HTMLAttributes }) {
27
- return [
28
- "span",
29
- mergeAttributes(HTMLAttributes, {
30
- "data-type": "control",
31
- "data-id": node.attrs.id,
32
- "data-title": node.attrs.title,
33
- "data-updatedAt": node.attrs.updatedAt,
34
- "data-status": node.attrs.status
35
- }),
36
- node.attrs.title
37
- ];
38
- },
39
- addNodeView() {
40
- return ReactNodeViewRenderer(ControlView, { as: "span" });
41
- }
42
- });
43
-
44
- export {
45
- Control
46
- };
@@ -1,43 +0,0 @@
1
- "use client";
2
-
3
- // src/card-variant.tsx
4
- import { Card, Chip, Heading } from "@kopexa/sight";
5
- import { NodeViewContent } from "@tiptap/react";
6
- import { jsx, jsxs } from "react/jsx-runtime";
7
- var CardVariant = ({
8
- control,
9
- options,
10
- editable
11
- }) => {
12
- var _a, _b;
13
- return /* @__PURE__ */ jsxs(
14
- Card.Root,
15
- {
16
- shadow: options == null ? void 0 : options.cardShadow,
17
- border: options == null ? void 0 : options.cardBorder,
18
- radius: options == null ? void 0 : options.cardRadius,
19
- fullWidth: true,
20
- spacing: options == null ? void 0 : options.cardSpacing,
21
- isPressable: editable,
22
- className: "focus-within:ring-2 focus-within:ring-offset-2 focus-within:ring-primary/50",
23
- children: [
24
- /* @__PURE__ */ jsxs(Card.Header, { className: "flex items-start justify-between gap-2", children: [
25
- /* @__PURE__ */ jsx(Heading, { contentEditable: false, children: (_a = control.title) != null ? _a : "Unmapped Control" }),
26
- control.status && control.status !== "default" && /* @__PURE__ */ jsx(Chip, { size: "sm", variant: "bordered", indicator: true, contentEditable: false, children: control.status })
27
- ] }),
28
- (options == null ? void 0 : options.cardShowDescription) && /* @__PURE__ */ jsx(Card.Body, { className: "bg-muted", children: /* @__PURE__ */ jsx(NodeViewContent, { className: "content is-editable py-4", as: "div" }) }),
29
- (options == null ? void 0 : options.cardShowImplementations) && /* @__PURE__ */ jsx(Card.Footer, { className: "flex flex-col gap-2", children: (control == null ? void 0 : control.implementations) && (control == null ? void 0 : control.implementations.length) === 0 ? /* @__PURE__ */ jsx("div", { className: "text-sm opacity-70", children: "No implementations" }) : (_b = control == null ? void 0 : control.implementations) == null ? void 0 : _b.map((r) => /* @__PURE__ */ jsx(ImplementationCard, { impl: r }, r.id)) })
30
- ]
31
- }
32
- );
33
- };
34
- function ImplementationCard({ impl }) {
35
- return /* @__PURE__ */ jsx(Card.Root, { shadow: "2xs", border: "default", radius: "sm", spacing: "sm", fullWidth: true, children: /* @__PURE__ */ jsx(Card.Body, { children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
36
- /* @__PURE__ */ jsx("div", { className: "font-medium", contentEditable: false, children: impl.title }),
37
- /* @__PURE__ */ jsx("div", { className: "text-sm text-foreground/60", contentEditable: false, children: "No description" })
38
- ] }) }) });
39
- }
40
-
41
- export {
42
- CardVariant
43
- };
@@ -1,26 +0,0 @@
1
- "use client";
2
-
3
- // src/defaults.ts
4
- var DEFAULT_CONTROL_REF_OPTIONS = {
5
- variant: "chip",
6
- inlineShowStatus: true,
7
- cardShowDescription: true,
8
- cardShowImplementations: true,
9
- cardBorder: "default",
10
- cardShadow: "sm",
11
- cardRadius: "sm",
12
- cardSpacing: "md"
13
- };
14
- function mapCardProps(o) {
15
- return {
16
- border: o.cardBorder,
17
- shadow: o.cardShadow,
18
- radius: o.cardRadius,
19
- spacing: o.cardSpacing
20
- };
21
- }
22
-
23
- export {
24
- DEFAULT_CONTROL_REF_OPTIONS,
25
- mapCardProps
26
- };
@@ -1,8 +0,0 @@
1
- "use client";
2
-
3
- // src/utils/index.ts
4
- var DEFAULT_CONTROL_GQL_API = "https://api.kopexa.com/query";
5
-
6
- export {
7
- DEFAULT_CONTROL_GQL_API
8
- };