@humandialog/forms.svelte 1.3.12 → 1.3.13
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/components/Fab.svelte +12 -6
- package/components/Floating_container.svelte +86 -21
- package/components/combo/combo.svelte +39 -8
- package/components/contextmenu.svelte +97 -30
- package/components/document/editor.svelte +26 -5
- package/components/document/internal/palette.row.svelte +1 -1
- package/components/document/internal/palette.svelte +7 -5
- package/desk.svelte +2 -1
- package/package.json +2 -2
- package/stores.d.ts +1 -0
- package/stores.js +3 -2
package/components/Fab.svelte
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script>import { each } from "svelte/internal";
|
|
2
|
-
import { contextToolbarOperations, pageToolbarOperations, contextItemsStore } from "../stores.js";
|
|
2
|
+
import { contextToolbarOperations, pageToolbarOperations, contextItemsStore, toolsActionsOperations } from "../stores.js";
|
|
3
3
|
import { showFloatingToolbar, showMenu, showGridMenu } from "./menu.js";
|
|
4
4
|
import { FaChevronUp, FaChevronDown, FaChevronLeft, FaChevronRight, FaCircle } from "svelte-icons/fa/";
|
|
5
5
|
$:
|
|
6
|
-
|
|
6
|
+
setupCurrentContextOperations($pageToolbarOperations, $contextToolbarOperations, $toolsActionsOperations);
|
|
7
7
|
let operations = [];
|
|
8
8
|
let mainOperation = null;
|
|
9
9
|
let secondaryOperation = null;
|
|
@@ -12,11 +12,17 @@ let isExpandable = false;
|
|
|
12
12
|
let vToolboxExpanded = false;
|
|
13
13
|
let hToolboxExpanded = false;
|
|
14
14
|
let isDirectPositioningMode = false;
|
|
15
|
-
function
|
|
15
|
+
function setupCurrentContextOperations(...args) {
|
|
16
16
|
isDirectPositioningMode = false;
|
|
17
|
-
if ($
|
|
17
|
+
if ($toolsActionsOperations && Array.isArray($toolsActionsOperations) && toolsActionsOperations.length > 0) {
|
|
18
|
+
operations = $toolsActionsOperations;
|
|
19
|
+
} else if ($toolsActionsOperations && $toolsActionsOperations.operations && $toolsActionsOperations.operations.length > 0) {
|
|
20
|
+
operations = $toolsActionsOperations.operations;
|
|
21
|
+
if ($toolsActionsOperations.opver && $toolsActionsOperations.opver == 1)
|
|
22
|
+
isDirectPositioningMode = true;
|
|
23
|
+
} else if ($contextToolbarOperations && Array.isArray($contextToolbarOperations) && $contextToolbarOperations.length > 0) {
|
|
18
24
|
operations = $contextToolbarOperations;
|
|
19
|
-
else if ($contextToolbarOperations && $contextToolbarOperations.operations && $contextToolbarOperations.operations.length > 0) {
|
|
25
|
+
} else if ($contextToolbarOperations && $contextToolbarOperations.operations && $contextToolbarOperations.operations.length > 0) {
|
|
20
26
|
operations = $contextToolbarOperations.operations;
|
|
21
27
|
if ($contextToolbarOperations.opver && $contextToolbarOperations.opver == 1)
|
|
22
28
|
isDirectPositioningMode = true;
|
|
@@ -189,7 +195,7 @@ function operationVisible(operation) {
|
|
|
189
195
|
dark:bg-blue-600/50 dark:hover:bg-blue-700 dark:focus:ring-blue-800
|
|
190
196
|
flex items-center justify-center
|
|
191
197
|
disable-dbl-tap-zoom
|
|
192
|
-
cursor-pointer z-
|
|
198
|
+
cursor-pointer z-40"
|
|
193
199
|
style={position}
|
|
194
200
|
on:click|stopPropagation={(e) => {on_click(e, operation)}}
|
|
195
201
|
on:mousedown={mousedown} >
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
<script>import { tick, afterUpdate } from "svelte";
|
|
2
|
+
import { isDeviceSmallerThan } from "../utils";
|
|
3
|
+
import { toolsActionsOperations } from "../stores";
|
|
4
|
+
import { FaTimes } from "svelte-icons/fa";
|
|
2
5
|
let x;
|
|
3
6
|
let y;
|
|
4
7
|
let visible = false;
|
|
@@ -6,8 +9,6 @@ let toolbar;
|
|
|
6
9
|
let props = {};
|
|
7
10
|
let around_rect;
|
|
8
11
|
let root_element;
|
|
9
|
-
$:
|
|
10
|
-
display = visible ? "fixed" : "hidden";
|
|
11
12
|
export async function show(around, _toolbar, _props = {}) {
|
|
12
13
|
if (around instanceof DOMRect) {
|
|
13
14
|
x = around.left;
|
|
@@ -22,20 +23,44 @@ export async function show(around, _toolbar, _props = {}) {
|
|
|
22
23
|
visible = true;
|
|
23
24
|
toolbar = _toolbar;
|
|
24
25
|
props = _props;
|
|
26
|
+
cssPosition = calculatePosition(x, y, around_rect, true, true);
|
|
25
27
|
props.onHide = () => {
|
|
26
28
|
hide();
|
|
27
29
|
};
|
|
28
30
|
hide_window_indicator = 0;
|
|
29
31
|
window.addEventListener("click", on_before_window_click, true);
|
|
32
|
+
if (isDeviceSmallerThan("sm")) {
|
|
33
|
+
$toolsActionsOperations = {
|
|
34
|
+
opver: 1,
|
|
35
|
+
operations: [
|
|
36
|
+
{
|
|
37
|
+
caption: "Menu",
|
|
38
|
+
operations: [
|
|
39
|
+
{
|
|
40
|
+
icon: FaTimes,
|
|
41
|
+
action: (f) => {
|
|
42
|
+
hide();
|
|
43
|
+
},
|
|
44
|
+
fab: "M00",
|
|
45
|
+
tbr: "A"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
};
|
|
51
|
+
}
|
|
30
52
|
await tick();
|
|
31
53
|
if (!was_visible)
|
|
32
54
|
root_element.addEventListener("click", on_before_container_click, true);
|
|
55
|
+
cssPosition = calculatePosition(x, y, around_rect, true, false);
|
|
33
56
|
}
|
|
34
57
|
export function isVisible() {
|
|
35
58
|
return visible;
|
|
36
59
|
}
|
|
37
60
|
export function hide() {
|
|
38
61
|
visible = false;
|
|
62
|
+
cssPosition = calculatePosition(x, y, around_rect, false, false);
|
|
63
|
+
$toolsActionsOperations = [];
|
|
39
64
|
window.removeEventListener("click", on_before_window_click, true);
|
|
40
65
|
root_element.removeEventListener("click", on_before_container_click, true);
|
|
41
66
|
}
|
|
@@ -52,28 +77,68 @@ function on_before_window_click() {
|
|
|
52
77
|
function on_before_container_click() {
|
|
53
78
|
hide_window_indicator--;
|
|
54
79
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
80
|
+
let cssPosition = "";
|
|
81
|
+
function calculatePosition(x2, y2, around, visible2, fresh) {
|
|
82
|
+
let result = "";
|
|
83
|
+
if (!visible2) {
|
|
84
|
+
result = "display: none";
|
|
85
|
+
} else if (isDeviceSmallerThan("sm")) {
|
|
86
|
+
let screenRect = new DOMRect();
|
|
87
|
+
screenRect.x = 0;
|
|
88
|
+
screenRect.y = 0;
|
|
89
|
+
screenRect.width = window.innerWidth;
|
|
90
|
+
screenRect.height = window.innerHeight;
|
|
91
|
+
const margin = 5;
|
|
92
|
+
let myRect = null;
|
|
93
|
+
if (!fresh) {
|
|
94
|
+
myRect = root_element.getBoundingClientRect();
|
|
95
|
+
if (myRect && myRect.height == 0)
|
|
96
|
+
myRect = null;
|
|
97
|
+
}
|
|
98
|
+
if (myRect) {
|
|
99
|
+
let maxHeight = screenRect.height / 2 - margin;
|
|
100
|
+
if (myRect.height < maxHeight)
|
|
101
|
+
maxHeight = myRect.height;
|
|
102
|
+
const width = screenRect.width - 2 * margin;
|
|
103
|
+
x2 = margin;
|
|
104
|
+
y2 = screenRect.bottom - maxHeight - margin;
|
|
105
|
+
result = `left: ${x2}px; top: ${y2}px; width: ${width}px; max-height: ${maxHeight}px; display: block`;
|
|
106
|
+
} else {
|
|
107
|
+
const maxHeight = screenRect.height / 2 - margin;
|
|
108
|
+
const width = screenRect.width - 2 * margin;
|
|
109
|
+
x2 = margin;
|
|
110
|
+
y2 = screenRect.bottom - maxHeight - margin;
|
|
111
|
+
result = `left: ${x2}px; top: ${y2}px; width: ${width}px; max-height: ${maxHeight}px; display: block`;
|
|
112
|
+
}
|
|
113
|
+
} else {
|
|
114
|
+
let myRect = null;
|
|
115
|
+
if (!fresh) {
|
|
116
|
+
myRect = root_element.getBoundingClientRect();
|
|
117
|
+
if (myRect && myRect.height == 0)
|
|
118
|
+
myRect = null;
|
|
119
|
+
}
|
|
120
|
+
const m = 15;
|
|
121
|
+
let screenRect = new DOMRect(m, 0, window.innerWidth - 2 * m, window.innerHeight);
|
|
122
|
+
if (myRect) {
|
|
123
|
+
if (myRect.right > screenRect.right)
|
|
124
|
+
x2 = screenRect.right - myRect.width;
|
|
125
|
+
if (myRect.bottom > screenRect.bottom)
|
|
126
|
+
y2 = screenRect.bottom - myRect.height - around_rect.height;
|
|
127
|
+
if (myRect.left < screenRect.left)
|
|
128
|
+
x2 = screenRect.left;
|
|
129
|
+
if (myRect.top < screenRect.top)
|
|
130
|
+
y2 = screenRect.top;
|
|
131
|
+
}
|
|
132
|
+
result = `left:${x2}px; top:${y2}px; width: max-content; height:max-content; display: block`;
|
|
133
|
+
}
|
|
134
|
+
console.log(result);
|
|
135
|
+
return result;
|
|
136
|
+
}
|
|
72
137
|
</script>
|
|
73
138
|
|
|
74
139
|
<div id="__hd_svelte_floating_container"
|
|
75
|
-
class="p-2 bg-stone-100 dark:bg-stone-800 rounded-lg shadow
|
|
76
|
-
style=
|
|
140
|
+
class="p-2 bg-stone-100 dark:bg-stone-800 rounded-lg shadow z-30 fixed"
|
|
141
|
+
style={cssPosition}
|
|
77
142
|
bind:this={root_element}>
|
|
78
143
|
<svelte:component this={toolbar} {...props} />
|
|
79
144
|
</div>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
<script>import { data_tick_store, contextItemsStore, contextTypesStore } from "../../stores.js";
|
|
1
|
+
<script>import { data_tick_store, contextItemsStore, contextTypesStore, toolsActionsOperations } from "../../stores.js";
|
|
2
2
|
import { informModification, pushChanges } from "../../updates.js";
|
|
3
|
-
import { parseWidthDirective, shouldBeComapact } from "../../utils.js";
|
|
3
|
+
import { isDeviceSmallerThan, parseWidthDirective, shouldBeComapact } from "../../utils.js";
|
|
4
4
|
import { afterUpdate, getContext, onMount, setContext } from "svelte";
|
|
5
5
|
import { rCombo_definition, rCombo_item, cached_sources } from "./combo";
|
|
6
|
-
import FaChevronDown from "svelte-icons/fa
|
|
6
|
+
import { FaChevronDown, FaTimes } from "svelte-icons/fa";
|
|
7
7
|
import Icon from "../icon.svelte";
|
|
8
8
|
import { reef } from "@humandialog/auth.svelte/dist/index.js";
|
|
9
9
|
export let label = "";
|
|
@@ -198,17 +198,25 @@ export function show(event, hide_callback) {
|
|
|
198
198
|
show_above = true;
|
|
199
199
|
} else
|
|
200
200
|
y = rect.y + rect.height;
|
|
201
|
-
if (
|
|
201
|
+
if (isDeviceSmallerThan("sm")) {
|
|
202
|
+
let screenRect = new DOMRect();
|
|
203
|
+
screenRect.x = 0;
|
|
204
|
+
screenRect.y = 0;
|
|
205
|
+
screenRect.width = window.innerWidth;
|
|
206
|
+
screenRect.height = window.innerHeight;
|
|
207
|
+
const margin = 5;
|
|
208
|
+
const maxHeight = screenRect.height / 2 - margin;
|
|
209
|
+
const width = screenRect.width - 2 * margin;
|
|
210
|
+
x = margin;
|
|
211
|
+
y = screenRect.bottom - margin;
|
|
212
|
+
dropdown_position = `position: fixed; left: ${x}px; top: ${y}px; transform: translate(0, -100%); width: ${width}px; max-height: ${maxHeight}px; display: block`;
|
|
213
|
+
} else if (show_fullscreen) {
|
|
202
214
|
dropdown_position = `position: fixed; left: 0px; top: 0px; width: ${client_rect.width}px; height: ${client_rect.height}px;`;
|
|
203
215
|
} else {
|
|
204
216
|
dropdown_position = `min-width: ${palette_width_px}px; max-height:${palette_max_height_px}px; position: fixed; left:${x}px; top:${y}px;`;
|
|
205
217
|
if (show_above)
|
|
206
218
|
dropdown_position += " transform: translate(0, -100%);";
|
|
207
219
|
}
|
|
208
|
-
console.log("dropdown_position", dropdown_position, rect, client_rect);
|
|
209
|
-
console.log("preferred_palette_height", preferred_palette_height);
|
|
210
|
-
console.log("bottom_space", bottom_space);
|
|
211
|
-
console.log("top_space", top_space);
|
|
212
220
|
is_dropdown_open = true;
|
|
213
221
|
if (filtered) {
|
|
214
222
|
if (!textbox)
|
|
@@ -226,11 +234,34 @@ export function show(event, hide_callback) {
|
|
|
226
234
|
subtree: true
|
|
227
235
|
});
|
|
228
236
|
}
|
|
237
|
+
if (isDeviceSmallerThan("sm")) {
|
|
238
|
+
$toolsActionsOperations = {
|
|
239
|
+
opver: 1,
|
|
240
|
+
operations: [
|
|
241
|
+
{
|
|
242
|
+
caption: "Menu",
|
|
243
|
+
operations: [
|
|
244
|
+
{
|
|
245
|
+
icon: FaTimes,
|
|
246
|
+
action: (f) => {
|
|
247
|
+
hide();
|
|
248
|
+
},
|
|
249
|
+
fab: "M00",
|
|
250
|
+
tbr: "A"
|
|
251
|
+
}
|
|
252
|
+
]
|
|
253
|
+
}
|
|
254
|
+
]
|
|
255
|
+
};
|
|
256
|
+
}
|
|
229
257
|
}
|
|
230
258
|
export function hide() {
|
|
259
|
+
console.log("combo hide");
|
|
231
260
|
if (mutation_observer)
|
|
232
261
|
mutation_observer.disconnect();
|
|
233
262
|
is_dropdown_open = false;
|
|
263
|
+
$toolsActionsOperations = [];
|
|
264
|
+
dropdown_position = "display: none;";
|
|
234
265
|
combo_text = get_combo_text();
|
|
235
266
|
if (!!textbox)
|
|
236
267
|
textbox.innerHtml = combo_text;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<script>import { afterUpdate, tick } from "svelte";
|
|
2
2
|
import Icon from "./icon.svelte";
|
|
3
|
-
import { contextItemsStore } from "../stores";
|
|
3
|
+
import { contextItemsStore, toolsActionsOperations } from "../stores";
|
|
4
4
|
import { isDeviceSmallerThan, isOnScreenKeyboardVisible } from "../utils";
|
|
5
5
|
import { hideWholeContextMenu } from "./menu";
|
|
6
|
+
import { FaTimes } from "svelte-icons/fa";
|
|
6
7
|
export let widthPx = 400;
|
|
7
8
|
export let menu_items_id_prefix = "__hd_svelte_menuitem_";
|
|
8
9
|
export let owner_menu_item = void 0;
|
|
@@ -16,36 +17,78 @@ let focused_index = 0;
|
|
|
16
17
|
let menu_items = [];
|
|
17
18
|
let submenus = [];
|
|
18
19
|
let around_rect;
|
|
20
|
+
let css_position = "";
|
|
19
21
|
$:
|
|
20
22
|
display = visible ? "block" : "none";
|
|
21
|
-
|
|
22
|
-
let
|
|
23
|
-
if (
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
23
|
+
function calculatePosition(x2, y2, around, visible2, fresh) {
|
|
24
|
+
let result = "";
|
|
25
|
+
if (!visible2) {
|
|
26
|
+
result = "display: none";
|
|
27
|
+
} else if (isDeviceSmallerThan("sm")) {
|
|
28
|
+
let screenRect = new DOMRect();
|
|
29
|
+
screenRect.x = 0;
|
|
30
|
+
screenRect.y = 0;
|
|
31
|
+
screenRect.width = window.innerWidth;
|
|
32
|
+
screenRect.height = window.innerHeight;
|
|
33
|
+
const margin = 5;
|
|
34
|
+
let myRect = null;
|
|
35
|
+
if (!fresh) {
|
|
36
|
+
myRect = menu_root.getBoundingClientRect();
|
|
37
|
+
if (myRect.height == 0) {
|
|
38
|
+
myRect = null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (myRect) {
|
|
42
|
+
let maxHeight = screenRect.height / 2 - margin;
|
|
43
|
+
if (myRect.height < maxHeight)
|
|
44
|
+
maxHeight = myRect.height;
|
|
45
|
+
const width = screenRect.width - 2 * margin;
|
|
46
|
+
x2 = margin;
|
|
47
|
+
y2 = screenRect.bottom - maxHeight - margin;
|
|
48
|
+
result = `left: ${x2}px; top: ${y2}px; width: ${width}px; max-height: ${maxHeight}px; display: block`;
|
|
49
|
+
} else {
|
|
50
|
+
const maxHeight = screenRect.height / 2 - margin;
|
|
51
|
+
const width = screenRect.width - 2 * margin;
|
|
52
|
+
x2 = margin;
|
|
53
|
+
y2 = screenRect.bottom - maxHeight - margin;
|
|
54
|
+
result = `left: ${x2}px; top: ${y2}px; width: ${width}px; max-height: ${maxHeight}px; display: block`;
|
|
55
|
+
}
|
|
56
|
+
} else {
|
|
57
|
+
let myRect = null;
|
|
58
|
+
if (!fresh) {
|
|
59
|
+
myRect = menu_root.getBoundingClientRect();
|
|
60
|
+
if (myRect.height == 0) {
|
|
61
|
+
myRect = null;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (myRect) {
|
|
65
|
+
const m = 15;
|
|
66
|
+
let screenRect = new DOMRect(m, 0, window.innerWidth - 2 * m, window.innerHeight);
|
|
67
|
+
let xShifted = false;
|
|
68
|
+
if (myRect.right > screenRect.right) {
|
|
69
|
+
x2 = screenRect.right - myRect.width + m;
|
|
70
|
+
xShifted = true;
|
|
71
|
+
}
|
|
72
|
+
let yShifted = false;
|
|
73
|
+
if (myRect.bottom > screenRect.bottom) {
|
|
74
|
+
y2 = screenRect.bottom - myRect.height - m;
|
|
75
|
+
if (around) {
|
|
76
|
+
if (xShifted)
|
|
77
|
+
x2 -= around.width;
|
|
78
|
+
else
|
|
79
|
+
y2 -= around.height - m;
|
|
80
|
+
}
|
|
81
|
+
yShifted = true;
|
|
82
|
+
}
|
|
83
|
+
if (myRect.left < screenRect.left)
|
|
84
|
+
x2 = screenRect.left;
|
|
85
|
+
if (myRect.top < screenRect.top)
|
|
86
|
+
y2 = screenRect.top;
|
|
87
|
+
}
|
|
88
|
+
result = `left:${x2}px; top:${y2}px; display: block`;
|
|
43
89
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (rect.top < container_rect.top)
|
|
47
|
-
y = container_rect.top;
|
|
48
|
-
});
|
|
90
|
+
return result;
|
|
91
|
+
}
|
|
49
92
|
export async function show(around, _operations) {
|
|
50
93
|
if (around instanceof DOMRect) {
|
|
51
94
|
x = around.left;
|
|
@@ -57,6 +100,7 @@ export async function show(around, _operations) {
|
|
|
57
100
|
around_rect = new DOMRect(x, y, 0, 0);
|
|
58
101
|
}
|
|
59
102
|
visible = true;
|
|
103
|
+
css_position = calculatePosition(x, y, around_rect, true, true);
|
|
60
104
|
operations = [..._operations];
|
|
61
105
|
focused_index = operations.findIndex((o) => !o.disabled);
|
|
62
106
|
const is_root_menu = owner_menu_item == void 0;
|
|
@@ -64,7 +108,28 @@ export async function show(around, _operations) {
|
|
|
64
108
|
hide_window_indicator = 0;
|
|
65
109
|
window.addEventListener("click", on_before_window_click, true);
|
|
66
110
|
}
|
|
111
|
+
if (isDeviceSmallerThan("sm")) {
|
|
112
|
+
$toolsActionsOperations = {
|
|
113
|
+
opver: 1,
|
|
114
|
+
operations: [
|
|
115
|
+
{
|
|
116
|
+
caption: "Menu",
|
|
117
|
+
operations: [
|
|
118
|
+
{
|
|
119
|
+
icon: FaTimes,
|
|
120
|
+
action: (f) => {
|
|
121
|
+
hide();
|
|
122
|
+
},
|
|
123
|
+
fab: "M00",
|
|
124
|
+
tbr: "A"
|
|
125
|
+
}
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
};
|
|
130
|
+
}
|
|
67
131
|
await tick();
|
|
132
|
+
css_position = calculatePosition(x, y, around_rect, true, false);
|
|
68
133
|
if (is_root_menu)
|
|
69
134
|
menu_root.addEventListener("click", on_before_container_click, true);
|
|
70
135
|
if (menu_items.length && !isDeviceSmallerThan("sm"))
|
|
@@ -74,7 +139,9 @@ export function isVisible() {
|
|
|
74
139
|
return visible;
|
|
75
140
|
}
|
|
76
141
|
export function hide() {
|
|
142
|
+
$toolsActionsOperations = [];
|
|
77
143
|
visible = false;
|
|
144
|
+
css_position = calculatePosition(x, y, around_rect, false, false);
|
|
78
145
|
window.removeEventListener("click", on_before_window_click, true);
|
|
79
146
|
menu_root.removeEventListener("click", on_before_container_click, true);
|
|
80
147
|
}
|
|
@@ -210,8 +277,8 @@ function mousedown(e) {
|
|
|
210
277
|
|
|
211
278
|
<div id="__hd_svelte_contextmenu"
|
|
212
279
|
class=" bg-white dark:bg-stone-700 text-stone-600 dark:text-stone-400 rounded-lg border border-stone-200 dark:border-stone-900 shadow-md
|
|
213
|
-
z-30 fixed min-w-[{min_width_px}px] w-max"
|
|
214
|
-
style={
|
|
280
|
+
z-30 fixed min-w-[{min_width_px}px] w-max overflow-y-auto"
|
|
281
|
+
style={css_position}
|
|
215
282
|
bind:this={menu_root}>
|
|
216
283
|
|
|
217
284
|
{#each operations as operation, index}
|
|
@@ -26,7 +26,7 @@ import Underline from "@tiptap/extension-underline";
|
|
|
26
26
|
import Dropcursor from "@tiptap/extension-dropcursor";
|
|
27
27
|
import Gapcursor from "@tiptap/extension-gapcursor";
|
|
28
28
|
import History from "@tiptap/extension-history";
|
|
29
|
-
import { data_tick_store, contextItemsStore, contextTypesStore, onErrorShowAlert } from "../../stores.js";
|
|
29
|
+
import { data_tick_store, contextItemsStore, contextTypesStore, onErrorShowAlert, toolsActionsOperations } from "../../stores.js";
|
|
30
30
|
import { informModification, pushChanges } from "../../updates.js";
|
|
31
31
|
import { isDeviceSmallerThan, parseWidthDirective, refreshToolbarOperations, UI } from "../../utils.js";
|
|
32
32
|
import Palette from "./internal/palette.svelte";
|
|
@@ -46,7 +46,8 @@ import {
|
|
|
46
46
|
FaArrowLeft,
|
|
47
47
|
FaGripLines,
|
|
48
48
|
FaListUl,
|
|
49
|
-
FaTable
|
|
49
|
+
FaTable,
|
|
50
|
+
FaTimes
|
|
50
51
|
} from "svelte-icons/fa";
|
|
51
52
|
import IcH1 from "./internal/h1.icon.svelte";
|
|
52
53
|
import IcH2 from "./internal/h2.icon.svelte";
|
|
@@ -574,9 +575,31 @@ function on_palette_mouse_click() {
|
|
|
574
575
|
}
|
|
575
576
|
function on_palette_shown() {
|
|
576
577
|
is_command_palette_visible = true;
|
|
578
|
+
if (isDeviceSmallerThan("sm")) {
|
|
579
|
+
$toolsActionsOperations = {
|
|
580
|
+
opver: 1,
|
|
581
|
+
operations: [
|
|
582
|
+
{
|
|
583
|
+
caption: "Palette",
|
|
584
|
+
operations: [
|
|
585
|
+
{
|
|
586
|
+
icon: FaTimes,
|
|
587
|
+
action: (f) => {
|
|
588
|
+
palette.hide();
|
|
589
|
+
editor?.commands.focus();
|
|
590
|
+
},
|
|
591
|
+
fab: "M00",
|
|
592
|
+
tbr: "A"
|
|
593
|
+
}
|
|
594
|
+
]
|
|
595
|
+
}
|
|
596
|
+
]
|
|
597
|
+
};
|
|
598
|
+
}
|
|
577
599
|
}
|
|
578
600
|
function on_palette_hidden() {
|
|
579
601
|
is_command_palette_visible = false;
|
|
602
|
+
$toolsActionsOperations = [];
|
|
580
603
|
}
|
|
581
604
|
function show_command_palette(cursor_rect) {
|
|
582
605
|
let client_rect = get_window_box();
|
|
@@ -664,9 +687,7 @@ function handleImagesChanges(transaction) {
|
|
|
664
687
|
}
|
|
665
688
|
let commands = [
|
|
666
689
|
//{ caption: 'Styles', separator: true },
|
|
667
|
-
{
|
|
668
|
-
editor?.commands.focus();
|
|
669
|
-
}, is_visible: () => isDeviceSmallerThan("sm") },
|
|
690
|
+
// { caption: 'Back to edit', description: 'Escape', icon: FaArrowLeft, on_choice: () => { editor?.commands.focus()}, is_visible: () => isDeviceSmallerThan("sm") },
|
|
670
691
|
{ caption: "Normal", description: "This is normal text style", tags: "text", icon: FaRemoveFormat, on_choice: (range) => {
|
|
671
692
|
if (range)
|
|
672
693
|
editor.chain().focus().deleteRange(range).setParagraph().run();
|
|
@@ -38,7 +38,7 @@ export function scrollToView() {
|
|
|
38
38
|
on:mousemove
|
|
39
39
|
on:mousedown
|
|
40
40
|
bind:this={element}>
|
|
41
|
-
<div class="flex items-center justify-center space-x-10 px-4 py-2" >
|
|
41
|
+
<div class="flex items-center justify-center space-x-10 px-4 py-2 ml-12 sm:ml-0" >
|
|
42
42
|
{#if cmd.icon}
|
|
43
43
|
<Icon size={icon_size} component={cmd.icon}/>
|
|
44
44
|
{/if}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import Pallete_row from "./palette.row.svelte";
|
|
4
4
|
import { createEventDispatcher } from "svelte";
|
|
5
5
|
import Icon from "../../icon.svelte";
|
|
6
|
-
import { isDeviceSmallerThan } from "../../../utils.js";
|
|
6
|
+
import { isDeviceSmallerThan, UI } from "../../../utils.js";
|
|
7
7
|
export let commands;
|
|
8
8
|
export let width_px = 400;
|
|
9
9
|
export let max_height_px = 500;
|
|
@@ -265,11 +265,12 @@ function isRowActive(cmd) {
|
|
|
265
265
|
{/if}
|
|
266
266
|
</menu>
|
|
267
267
|
{:else}
|
|
268
|
-
<div
|
|
269
|
-
|
|
268
|
+
<div class="bg-white dark:bg-stone-800 text-stone-500 dark:text-stone-400 rounded-lg border border-stone-200 dark:border-stone-700 shadow-md overflow-y-auto z-20"
|
|
269
|
+
id="__hd_FormattingPalette"
|
|
270
|
+
bind:this={paletteElement}
|
|
270
271
|
hidden={!visible}
|
|
271
|
-
style={css_style}
|
|
272
|
-
|
|
272
|
+
style={css_style} >
|
|
273
|
+
|
|
273
274
|
{#if filtered_commands && filtered_commands.length}
|
|
274
275
|
{#each filtered_commands as cmd, idx (cmd.caption)}
|
|
275
276
|
{#if cmd.separator}
|
|
@@ -295,5 +296,6 @@ function isRowActive(cmd) {
|
|
|
295
296
|
{/if}
|
|
296
297
|
|
|
297
298
|
</div>
|
|
299
|
+
|
|
298
300
|
{/if}
|
|
299
301
|
|
package/desk.svelte
CHANGED
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
lg_content_area_horizontal_dim = ""
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
console.log('main_side_panel_visibility', main_side_panel_visibility)
|
|
98
|
+
//console.log('main_side_panel_visibility', main_side_panel_visibility)
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
let tools_visibility = "hidden"
|
|
@@ -268,6 +268,7 @@
|
|
|
268
268
|
|
|
269
269
|
function onSelectionChanged(e)
|
|
270
270
|
{
|
|
271
|
+
console.log('onSelectionChanged')
|
|
271
272
|
determineFABVisibilityAsync();
|
|
272
273
|
}
|
|
273
274
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@humandialog/forms.svelte",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.13",
|
|
4
4
|
"description": "Basic Svelte UI components for Object Reef applications",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@playwright/test": "^1.28.1",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"type": "module",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@humandialog/auth.svelte": "^1.8.
|
|
29
|
+
"@humandialog/auth.svelte": "^1.8.5",
|
|
30
30
|
"@tiptap/core": "^2.11.0",
|
|
31
31
|
"@tiptap/extension-bullet-list": "^2.11.5",
|
|
32
32
|
"@tiptap/extension-code-block": "^2.11.5",
|
package/stores.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export const contextTypesStore: import("svelte/store").Writable<{
|
|
|
27
27
|
}>;
|
|
28
28
|
export const contextToolbarOperations: import("svelte/store").Writable<never[]>;
|
|
29
29
|
export const pageToolbarOperations: import("svelte/store").Writable<never[]>;
|
|
30
|
+
export const toolsActionsOperations: import("svelte/store").Writable<never[]>;
|
|
30
31
|
export const page_title: import("svelte/store").Writable<string>;
|
|
31
32
|
export const nav_titles: import("svelte/store").Writable<{}>;
|
|
32
33
|
export const mainContentPageReloader: import("svelte/store").Writable<number>;
|
package/stores.js
CHANGED
|
@@ -8,6 +8,7 @@ export const context_info_store = writable({data: '', sel: ''})
|
|
|
8
8
|
export const contextTypesStore = writable({focused:'', data: null, sel: null})
|
|
9
9
|
export const contextToolbarOperations = writable([]);
|
|
10
10
|
export const pageToolbarOperations = writable([]);
|
|
11
|
+
export const toolsActionsOperations = writable([]);
|
|
11
12
|
export const page_title = writable('');
|
|
12
13
|
export const nav_titles = writable({});
|
|
13
14
|
export const mainContentPageReloader = writable(1);
|
|
@@ -122,7 +123,7 @@ export function toggle_sidebar(index)
|
|
|
122
123
|
{
|
|
123
124
|
previously_visible_sidebar = get(main_sidebar_visible_store);
|
|
124
125
|
|
|
125
|
-
console.log('toggle_sidebar', previously_visible_sidebar, '=>', index)
|
|
126
|
+
//console.log('toggle_sidebar', previously_visible_sidebar, '=>', index)
|
|
126
127
|
|
|
127
128
|
if(get(main_sidebar_visible_store) == index)
|
|
128
129
|
main_sidebar_visible_store.set('*')
|
|
@@ -132,7 +133,7 @@ export function toggle_sidebar(index)
|
|
|
132
133
|
|
|
133
134
|
export function auto_hide_sidebar()
|
|
134
135
|
{
|
|
135
|
-
console.log('auto_hide_sidebar')
|
|
136
|
+
//console.log('auto_hide_sidebar')
|
|
136
137
|
//console.log("sw: " + window.innerWidth, SCREEN_SIZES.lg)
|
|
137
138
|
if(window.innerWidth < SCREEN_SIZES.lg)
|
|
138
139
|
hide_sidebar()
|