@humandialog/forms.svelte 1.4.6 → 1.4.8
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 +76 -26
- package/components/Fab.svelte.d.ts +1 -0
- package/components/Floating_container.svelte +20 -4
- package/components/combo/combo.source.svelte +3 -0
- package/components/combo/combo.source.svelte.d.ts +2 -0
- package/components/combo/combo.svelte +118 -118
- package/components/contextmenu.svelte +22 -6
- package/components/document/editor.svelte +33 -13
- package/components/document/editor.svelte.d.ts +12 -3
- package/components/document/internal/palette.row.svelte +1 -3
- package/components/document/internal/palette.svelte +63 -36
- package/components/icon.svelte +42 -9
- package/components/icon.svelte.d.ts +3 -3
- package/components/menu.d.ts +1 -0
- package/components/menu.js +6 -0
- package/components/tag.svelte +23 -9
- package/components/tag.svelte.d.ts +1 -0
- package/components/tags.palette.svelte +237 -0
- package/components/tags.palette.svelte.d.ts +38 -0
- package/components/tags.svelte +46 -15
- package/console.svelte +82 -3
- package/desk.svelte +43 -26
- package/horizontal.toolbar.svelte +11 -5
- package/index.d.ts +2 -2
- package/index.js +2 -2
- package/modal.svelte +4 -5
- package/package.json +3 -2
- package/stores.d.ts +3 -0
- package/stores.js +12 -0
- package/tenant.members.svelte +1 -1
- package/updates.d.ts +2 -1
- package/updates.js +19 -1
- package/utils.js +24 -4
- package/vertical.toolbar.svelte +23 -5
|
@@ -18,6 +18,7 @@ let menu_items = [];
|
|
|
18
18
|
let submenus = [];
|
|
19
19
|
let around_rect;
|
|
20
20
|
let css_position = "";
|
|
21
|
+
let closeButtonPos = "";
|
|
21
22
|
$:
|
|
22
23
|
display = visible ? "block" : "none";
|
|
23
24
|
function calculatePosition(x2, y2, around, visible2, fresh) {
|
|
@@ -53,6 +54,7 @@ function calculatePosition(x2, y2, around, visible2, fresh) {
|
|
|
53
54
|
y2 = screenRect.bottom - maxHeight - margin;
|
|
54
55
|
result = `left: ${x2}px; top: ${y2}px; width: ${width}px; max-height: ${maxHeight}px; display: block`;
|
|
55
56
|
}
|
|
57
|
+
closeButtonPos = `right: ${margin}px; top: calc(${y2}px - 1.75rem)`;
|
|
56
58
|
} else {
|
|
57
59
|
let myRect = null;
|
|
58
60
|
if (!fresh) {
|
|
@@ -86,6 +88,7 @@ function calculatePosition(x2, y2, around, visible2, fresh) {
|
|
|
86
88
|
y2 = screenRect.top;
|
|
87
89
|
}
|
|
88
90
|
result = `left:${x2}px; top:${y2}px; display: block; min-width: 15rem`;
|
|
91
|
+
closeButtonPos = "";
|
|
89
92
|
}
|
|
90
93
|
return result;
|
|
91
94
|
}
|
|
@@ -108,7 +111,7 @@ export async function show(around, _operations) {
|
|
|
108
111
|
hide_window_indicator = 0;
|
|
109
112
|
window.addEventListener("click", on_before_window_click, true);
|
|
110
113
|
}
|
|
111
|
-
if (
|
|
114
|
+
if (false) {
|
|
112
115
|
pushToolsActionsOperations({
|
|
113
116
|
opver: 1,
|
|
114
117
|
operations: [
|
|
@@ -139,7 +142,7 @@ export function isVisible() {
|
|
|
139
142
|
return visible;
|
|
140
143
|
}
|
|
141
144
|
export function hide() {
|
|
142
|
-
if (
|
|
145
|
+
if (false)
|
|
143
146
|
popToolsActionsOperations();
|
|
144
147
|
visible = false;
|
|
145
148
|
css_position = calculatePosition(x, y, around_rect, false, false);
|
|
@@ -324,14 +327,27 @@ function calculateBackground(is_highlighted, active) {
|
|
|
324
327
|
}
|
|
325
328
|
</script>
|
|
326
329
|
|
|
330
|
+
|
|
327
331
|
<div id="__hd_svelte_contextmenu"
|
|
328
332
|
class=" bg-white dark:bg-stone-800
|
|
329
333
|
text-stone-800 dark:text-stone-400 rounded-lg border
|
|
330
334
|
border-stone-200 dark:border-stone-700 shadow-md
|
|
331
|
-
z-
|
|
335
|
+
z-40 fixed min-w-60 max-h-screen overflow-y-auto"
|
|
332
336
|
style={css_position}
|
|
333
337
|
bind:this={menu_root}>
|
|
334
338
|
|
|
339
|
+
{#if closeButtonPos}
|
|
340
|
+
<button class=" fixed w-6 h-6 flex items-center justify-center
|
|
341
|
+
text-stone-500 bg-stone-200/70 hover:bg-stone-200
|
|
342
|
+
focus:outline-none font-medium rounded-full text-sm text-center
|
|
343
|
+
dark:text-stone-500 dark:bg-stone-700/80 dark:hover:bg-stone-700
|
|
344
|
+
focus:ring-4 focus:ring-blue-300 dark:focus:ring-blue-800"
|
|
345
|
+
style={closeButtonPos}
|
|
346
|
+
on:click={ hide }>
|
|
347
|
+
<Icon component={FaTimes} s="md"/>
|
|
348
|
+
</button>
|
|
349
|
+
{/if}
|
|
350
|
+
|
|
335
351
|
{#each operations as operation, index}
|
|
336
352
|
{@const is_separator = operation.separator}
|
|
337
353
|
{#if is_separator}
|
|
@@ -365,14 +381,14 @@ function calculateBackground(is_highlighted, active) {
|
|
|
365
381
|
{#if operation.icon}
|
|
366
382
|
{@const cc = mobile ? 7 : 6}
|
|
367
383
|
{@const icon_size = icon_placeholder_size - cc}
|
|
368
|
-
<Icon
|
|
384
|
+
<Icon s="md" component={operation.icon}/>
|
|
369
385
|
{:else}
|
|
370
386
|
{@const cc = mobile ? 7 : 6}
|
|
371
387
|
{@const icon_size = icon_placeholder_size - cc}
|
|
372
|
-
<div
|
|
388
|
+
<div class="w-4 h-4"></div>
|
|
373
389
|
{/if}
|
|
374
390
|
</div>
|
|
375
|
-
<div class="">
|
|
391
|
+
<div class="flex items-center ">
|
|
376
392
|
<p> {operation.caption}</p>
|
|
377
393
|
{#if operation.description}
|
|
378
394
|
{@const shortcut_width_px = operation.shortcut ? 80 : 0}
|
|
@@ -62,7 +62,8 @@ export let a = "";
|
|
|
62
62
|
export let context = "";
|
|
63
63
|
export let typename = "";
|
|
64
64
|
export let compact = false;
|
|
65
|
-
export let
|
|
65
|
+
export let onSingleChange = void 0;
|
|
66
|
+
export let onApplyChanges = void 0;
|
|
66
67
|
export let onFocusCb = void 0;
|
|
67
68
|
export let onBlurCb = void 0;
|
|
68
69
|
export let onAddImage = void 0;
|
|
@@ -612,6 +613,10 @@ onMount(() => {
|
|
|
612
613
|
if (wasContentChanged) {
|
|
613
614
|
hasChangedValue = true;
|
|
614
615
|
changedValue = editor2.getHTML();
|
|
616
|
+
if (onSingleChange)
|
|
617
|
+
onSingleChange(changedValue);
|
|
618
|
+
else
|
|
619
|
+
logChanges();
|
|
615
620
|
handleImagesChanges(transaction);
|
|
616
621
|
}
|
|
617
622
|
refreshToolbarOperations();
|
|
@@ -671,32 +676,34 @@ function on_blur() {
|
|
|
671
676
|
$data_tick_store = last_tick;
|
|
672
677
|
}
|
|
673
678
|
}
|
|
674
|
-
export function save() {
|
|
679
|
+
export async function save() {
|
|
675
680
|
if (saveData()) {
|
|
676
681
|
last_tick = $data_tick_store + 1;
|
|
677
682
|
$data_tick_store = last_tick;
|
|
678
|
-
refreshToolbarOperations();
|
|
679
683
|
}
|
|
680
684
|
}
|
|
681
685
|
function saveData() {
|
|
682
686
|
if (!hasChangedValue)
|
|
683
687
|
return false;
|
|
684
688
|
hasChangedValue = false;
|
|
685
|
-
if (
|
|
686
|
-
|
|
689
|
+
if (onApplyChanges) {
|
|
690
|
+
onApplyChanges(changedValue);
|
|
687
691
|
return true;
|
|
688
692
|
} else if (item && a) {
|
|
689
|
-
|
|
690
|
-
if (typename)
|
|
691
|
-
informModification(item, a, typename);
|
|
692
|
-
else
|
|
693
|
-
informModification(item, a);
|
|
693
|
+
logChanges();
|
|
694
694
|
if (pushChangesImmediately)
|
|
695
|
-
pushChanges();
|
|
695
|
+
pushChanges(refreshToolbarOperations);
|
|
696
696
|
return true;
|
|
697
697
|
}
|
|
698
698
|
return false;
|
|
699
699
|
}
|
|
700
|
+
function logChanges() {
|
|
701
|
+
item[a] = changedValue;
|
|
702
|
+
if (typename)
|
|
703
|
+
informModification(item, a, typename);
|
|
704
|
+
else
|
|
705
|
+
informModification(item, a);
|
|
706
|
+
}
|
|
700
707
|
let palette = null;
|
|
701
708
|
let is_command_palette_visible = false;
|
|
702
709
|
function get_selection_bbox() {
|
|
@@ -717,7 +724,7 @@ function on_palette_mouse_click() {
|
|
|
717
724
|
}
|
|
718
725
|
function on_palette_shown() {
|
|
719
726
|
is_command_palette_visible = true;
|
|
720
|
-
if (
|
|
727
|
+
if (false) {
|
|
721
728
|
pushToolsActionsOperations({
|
|
722
729
|
opver: 1,
|
|
723
730
|
operations: [
|
|
@@ -740,8 +747,9 @@ function on_palette_shown() {
|
|
|
740
747
|
}
|
|
741
748
|
}
|
|
742
749
|
function on_palette_hidden() {
|
|
743
|
-
if (
|
|
750
|
+
if (false)
|
|
744
751
|
popToolsActionsOperations();
|
|
752
|
+
editor?.commands.focus();
|
|
745
753
|
is_command_palette_visible = false;
|
|
746
754
|
}
|
|
747
755
|
function show_command_palette(cursor_rect) {
|
|
@@ -958,6 +966,18 @@ export function isActiveNormal() {
|
|
|
958
966
|
export function isActiveHeading(level) {
|
|
959
967
|
return editor?.isActive("heading", { level });
|
|
960
968
|
}
|
|
969
|
+
export function isActiveH1() {
|
|
970
|
+
return editor?.isActive("heading", { level: 1 });
|
|
971
|
+
}
|
|
972
|
+
export function isActiveH2() {
|
|
973
|
+
return editor?.isActive("heading", { level: 2 });
|
|
974
|
+
}
|
|
975
|
+
export function isActiveH3() {
|
|
976
|
+
return editor?.isActive("heading", { level: 3 });
|
|
977
|
+
}
|
|
978
|
+
export function isActiveH4() {
|
|
979
|
+
return editor?.isActive("heading", { level: 4 });
|
|
980
|
+
}
|
|
961
981
|
export function isActiveCode() {
|
|
962
982
|
return editor?.isActive("CodeBlock");
|
|
963
983
|
}
|
|
@@ -9,7 +9,8 @@ declare const __propDef: {
|
|
|
9
9
|
context?: string | undefined;
|
|
10
10
|
typename?: string | undefined;
|
|
11
11
|
compact?: boolean | undefined;
|
|
12
|
-
|
|
12
|
+
onSingleChange?: Function | undefined;
|
|
13
|
+
onApplyChanges?: Function | undefined;
|
|
13
14
|
onFocusCb?: undefined;
|
|
14
15
|
onBlurCb?: undefined;
|
|
15
16
|
onAddImage?: undefined;
|
|
@@ -42,7 +43,7 @@ declare const __propDef: {
|
|
|
42
43
|
tbr: string;
|
|
43
44
|
}) | undefined;
|
|
44
45
|
scrollIntoView?: ((param: any) => void) | undefined;
|
|
45
|
-
save?: (() => void) | undefined;
|
|
46
|
+
save?: (() => Promise<void>) | undefined;
|
|
46
47
|
addTemporaryImage?: ((src: any) => void) | undefined;
|
|
47
48
|
replaceTemporaryImage?: ((temporarySrc: any, dataPath: any) => void) | undefined;
|
|
48
49
|
removeTemporaryImage?: ((temporarySrc: any) => void) | undefined;
|
|
@@ -69,6 +70,10 @@ declare const __propDef: {
|
|
|
69
70
|
isActiveStrikethrough?: (() => any) | undefined;
|
|
70
71
|
isActiveNormal?: (() => any) | undefined;
|
|
71
72
|
isActiveHeading?: ((level: any) => any) | undefined;
|
|
73
|
+
isActiveH1?: (() => any) | undefined;
|
|
74
|
+
isActiveH2?: (() => any) | undefined;
|
|
75
|
+
isActiveH3?: (() => any) | undefined;
|
|
76
|
+
isActiveH4?: (() => any) | undefined;
|
|
72
77
|
isActiveCode?: (() => any) | undefined;
|
|
73
78
|
isActiveComment?: (() => any) | undefined;
|
|
74
79
|
isActiveQuote?: (() => any) | undefined;
|
|
@@ -111,7 +116,7 @@ export default class Editor extends SvelteComponentTyped<EditorProps, EditorEven
|
|
|
111
116
|
tbr: string;
|
|
112
117
|
};
|
|
113
118
|
get scrollIntoView(): (param: any) => void;
|
|
114
|
-
get save(): () => void
|
|
119
|
+
get save(): () => Promise<void>;
|
|
115
120
|
get addTemporaryImage(): (src: any) => void;
|
|
116
121
|
get replaceTemporaryImage(): (temporarySrc: any, dataPath: any) => void;
|
|
117
122
|
get removeTemporaryImage(): (temporarySrc: any) => void;
|
|
@@ -138,6 +143,10 @@ export default class Editor extends SvelteComponentTyped<EditorProps, EditorEven
|
|
|
138
143
|
get isActiveStrikethrough(): () => any;
|
|
139
144
|
get isActiveNormal(): () => any;
|
|
140
145
|
get isActiveHeading(): (level: any) => any;
|
|
146
|
+
get isActiveH1(): () => any;
|
|
147
|
+
get isActiveH2(): () => any;
|
|
148
|
+
get isActiveH3(): () => any;
|
|
149
|
+
get isActiveH4(): () => any;
|
|
141
150
|
get isActiveCode(): () => any;
|
|
142
151
|
get isActiveComment(): () => any;
|
|
143
152
|
get isActiveQuote(): () => any;
|
|
@@ -5,8 +5,6 @@ export let cmd;
|
|
|
5
5
|
export let width_px = 400;
|
|
6
6
|
export let is_highlighted = false;
|
|
7
7
|
export let active = false;
|
|
8
|
-
let icon_size = cmd.icon_size ? cmd.icon_size : 4;
|
|
9
|
-
let icon_placeholder_size = icon_size + 4;
|
|
10
8
|
let cl = $$props.class ?? "";
|
|
11
9
|
$:
|
|
12
10
|
active_class = calculateBackground(is_highlighted, active);
|
|
@@ -40,7 +38,7 @@ export function scrollToView() {
|
|
|
40
38
|
bind:this={element}>
|
|
41
39
|
<div class="flex items-center justify-center space-x-10 px-4 py-2 ml-12 sm:ml-0" >
|
|
42
40
|
{#if cmd.icon}
|
|
43
|
-
<Icon
|
|
41
|
+
<Icon s="md" component={cmd.icon}/>
|
|
44
42
|
{/if}
|
|
45
43
|
</div>
|
|
46
44
|
|
|
@@ -4,6 +4,7 @@ import Pallete_row from "./palette.row.svelte";
|
|
|
4
4
|
import { createEventDispatcher } from "svelte";
|
|
5
5
|
import Icon from "../../icon.svelte";
|
|
6
6
|
import { isDeviceSmallerThan, UI } from "../../../utils.js";
|
|
7
|
+
import { FaTimes } from "svelte-icons/fa";
|
|
7
8
|
export let commands;
|
|
8
9
|
export let width_px = 400;
|
|
9
10
|
export let max_height_px = 500;
|
|
@@ -27,7 +28,7 @@ export function showAsToolbox(rect) {
|
|
|
27
28
|
toolboxX = margin;
|
|
28
29
|
toolboxY = rect.bottom + margin;
|
|
29
30
|
toolboxY += window.scrollY;
|
|
30
|
-
css_style = `
|
|
31
|
+
css_style = `left:${toolboxX}px; top:${toolboxY}px;`;
|
|
31
32
|
console.log("toolbox: ", css_style);
|
|
32
33
|
dispatch("palette_shown");
|
|
33
34
|
}
|
|
@@ -48,19 +49,26 @@ afterUpdate(
|
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
51
|
);
|
|
52
|
+
let closeButtonPos = "";
|
|
51
53
|
export function show(x, y, up = false) {
|
|
52
54
|
isToolbox = false;
|
|
53
|
-
css_style = `width: ${width_px}px; max-height:${max_height_px}px;
|
|
55
|
+
css_style = `width: ${width_px}px; max-height:${max_height_px}px; left:${x}px; top:${y}px;`;
|
|
54
56
|
if (up)
|
|
55
57
|
css_style += " transform: translate(0, -100%);";
|
|
56
58
|
visible = true;
|
|
57
59
|
dispatch("palette_shown");
|
|
60
|
+
closeButtonPos = "";
|
|
61
|
+
setTimeout(() => {
|
|
62
|
+
const rect = paletteElement.getBoundingClientRect();
|
|
63
|
+
closeButtonPos = `right: ${15}px; top: calc(${rect.y}px - 1.75rem)`;
|
|
64
|
+
}, 0);
|
|
65
|
+
console.trace();
|
|
58
66
|
}
|
|
59
67
|
export function show_fullscreen(_width_px, _height_px) {
|
|
60
68
|
isToolbox = false;
|
|
61
69
|
width_px = _width_px;
|
|
62
70
|
max_height_px = _height_px;
|
|
63
|
-
css_style = `
|
|
71
|
+
css_style = `left: 0px; top: 0px; width: ${_width_px}px; height: ${_height_px}px; z-index: 1055;`;
|
|
64
72
|
visible = true;
|
|
65
73
|
dispatch("palette_shown");
|
|
66
74
|
}
|
|
@@ -231,7 +239,7 @@ function mousemove(e) {
|
|
|
231
239
|
const touch = e.touches.item(0);
|
|
232
240
|
const trackDelta = new DOMPoint(touch.clientX - beforeTrackingClient.x, touch.clientY - beforeTrackingClient.y);
|
|
233
241
|
toolboxX = beforeTrackingPos.x + trackDelta.x;
|
|
234
|
-
css_style = `
|
|
242
|
+
css_style = `left:${toolboxX}px; top:${toolboxY}px;`;
|
|
235
243
|
e.stopPropagation();
|
|
236
244
|
}
|
|
237
245
|
}
|
|
@@ -250,8 +258,8 @@ function isRowActive(cmd) {
|
|
|
250
258
|
|
|
251
259
|
{#if isToolbox}
|
|
252
260
|
<menu 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
|
|
253
|
-
z-
|
|
254
|
-
flex flex-row flex-nowrap"
|
|
261
|
+
z-40
|
|
262
|
+
flex flex-row flex-nowrap fixed"
|
|
255
263
|
style={css_style}
|
|
256
264
|
hidden={!visible}
|
|
257
265
|
on:touchstart={mousedown}
|
|
@@ -278,7 +286,7 @@ function isRowActive(cmd) {
|
|
|
278
286
|
{@const cc = mobile ? 7 : 6}
|
|
279
287
|
{@const default_icon_size = icon_placeholder_size - cc}
|
|
280
288
|
{@const icon_size = cmd.icon_size ? cmd.icon_size : default_icon_size}
|
|
281
|
-
<Icon
|
|
289
|
+
<Icon s="md" component={cmd.icon}/>
|
|
282
290
|
{/if}
|
|
283
291
|
</div>
|
|
284
292
|
</button>
|
|
@@ -287,37 +295,56 @@ function isRowActive(cmd) {
|
|
|
287
295
|
{/if}
|
|
288
296
|
</menu>
|
|
289
297
|
{:else}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
<Pallete_row {id}
|
|
306
|
-
cmd={cmd}
|
|
307
|
-
is_highlighted={cmd == current_command}
|
|
308
|
-
on:click={ () => { execute_mouse_click(cmd.on_choice); }}
|
|
309
|
-
on:mousemove={ () => { on_mouse_over(cmd); }}
|
|
310
|
-
on:mousedown={buttonMousedown}
|
|
311
|
-
bind:this={rows[idx]}
|
|
312
|
-
{active}
|
|
313
|
-
/>
|
|
314
|
-
{/if}
|
|
315
|
-
{/each}
|
|
316
|
-
{:else}
|
|
317
|
-
<p class="text-sm text-stone-500">No results</p>
|
|
298
|
+
<!--div hidden={!visible}-->
|
|
299
|
+
|
|
300
|
+
{#if visible && closeButtonPos}
|
|
301
|
+
{#key closeButtonPos}
|
|
302
|
+
<button class=" fixed w-6 h-6 flex items-center justify-center
|
|
303
|
+
text-stone-500 bg-stone-200/70 hover:bg-stone-200
|
|
304
|
+
focus:outline-none font-medium rounded-full text-sm text-center
|
|
305
|
+
dark:text-stone-500 dark:bg-stone-700/80 dark:hover:bg-stone-700
|
|
306
|
+
focus:ring-4 focus:ring-blue-300 dark:focus:ring-blue-800"
|
|
307
|
+
style={closeButtonPos}
|
|
308
|
+
on:mousedown={buttonMousedown}
|
|
309
|
+
on:click={ () => hide() }>
|
|
310
|
+
<Icon component={FaTimes} s="md"/>
|
|
311
|
+
</button>
|
|
312
|
+
{/key}
|
|
318
313
|
{/if}
|
|
314
|
+
|
|
315
|
+
<div hidden={!visible}
|
|
316
|
+
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-40 fixed"
|
|
317
|
+
id="__hd_FormattingPalette"
|
|
318
|
+
bind:this={paletteElement}
|
|
319
|
+
style={css_style} >
|
|
319
320
|
|
|
320
|
-
|
|
321
|
+
{#if filtered_commands && filtered_commands.length}
|
|
322
|
+
{#each filtered_commands as cmd, idx (cmd.caption)}
|
|
323
|
+
{#if cmd.separator}
|
|
324
|
+
{#if idx>0 && idx<filtered_commands.length-1} <!-- not first or last place -->
|
|
325
|
+
<hr class="mx-4 my-1 border-stone-300 dark:border-stone-700"/>
|
|
326
|
+
{/if}
|
|
327
|
+
{:else}
|
|
328
|
+
{@const id = "cpi_" + idx}
|
|
329
|
+
{@const active=isRowActive(cmd)}
|
|
330
|
+
<Pallete_row {id}
|
|
331
|
+
cmd={cmd}
|
|
332
|
+
is_highlighted={cmd == current_command}
|
|
333
|
+
on:click={ () => { execute_mouse_click(cmd.on_choice); }}
|
|
334
|
+
on:mousemove={ () => { on_mouse_over(cmd); }}
|
|
335
|
+
on:mousedown={buttonMousedown}
|
|
336
|
+
bind:this={rows[idx]}
|
|
337
|
+
{active}
|
|
338
|
+
/>
|
|
339
|
+
{/if}
|
|
340
|
+
{/each}
|
|
341
|
+
{:else}
|
|
342
|
+
<p class="text-sm text-stone-500">No results</p>
|
|
343
|
+
{/if}
|
|
344
|
+
|
|
345
|
+
</div>
|
|
346
|
+
<!---/div-->
|
|
347
|
+
|
|
321
348
|
|
|
322
349
|
{/if}
|
|
323
350
|
|
package/components/icon.svelte
CHANGED
|
@@ -6,9 +6,42 @@ export let img = "";
|
|
|
6
6
|
export let label = "";
|
|
7
7
|
export let symbol = "";
|
|
8
8
|
export let color = "";
|
|
9
|
-
export let
|
|
9
|
+
export let s = "md";
|
|
10
10
|
export let bg = "";
|
|
11
11
|
export let circle = false;
|
|
12
|
+
let size = 4;
|
|
13
|
+
switch (s) {
|
|
14
|
+
case "5xl":
|
|
15
|
+
size = 12;
|
|
16
|
+
break;
|
|
17
|
+
case "4xl":
|
|
18
|
+
size = 9;
|
|
19
|
+
break;
|
|
20
|
+
case "3xl":
|
|
21
|
+
size = 7.5;
|
|
22
|
+
break;
|
|
23
|
+
case "2xl":
|
|
24
|
+
size = 6;
|
|
25
|
+
break;
|
|
26
|
+
case "xl":
|
|
27
|
+
size = 5;
|
|
28
|
+
break;
|
|
29
|
+
case "lg":
|
|
30
|
+
size = 4.5;
|
|
31
|
+
break;
|
|
32
|
+
case "md":
|
|
33
|
+
size = 4;
|
|
34
|
+
break;
|
|
35
|
+
case "base":
|
|
36
|
+
size = 4;
|
|
37
|
+
break;
|
|
38
|
+
case "sm":
|
|
39
|
+
size = 3.5;
|
|
40
|
+
break;
|
|
41
|
+
case "xs":
|
|
42
|
+
size = 3;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
12
45
|
let additional_class = $$restProps.class ?? "";
|
|
13
46
|
let id = $$restProps.id ?? "";
|
|
14
47
|
let _bg;
|
|
@@ -58,16 +91,16 @@ $: {
|
|
|
58
91
|
}
|
|
59
92
|
let style;
|
|
60
93
|
$: {
|
|
61
|
-
if (
|
|
62
|
-
if (!additional_class) {
|
|
63
|
-
size = 5;
|
|
64
|
-
let icon_size = `${size * 0.25}rem`;
|
|
65
|
-
style = `width: ${icon_size}; height: ${icon_size}`;
|
|
66
|
-
} else
|
|
67
|
-
style = "";
|
|
68
|
-
} else {
|
|
94
|
+
if (!additional_class) {
|
|
69
95
|
let icon_size = `${size * 0.25}rem`;
|
|
70
96
|
style = `width: ${icon_size}; height: ${icon_size}`;
|
|
97
|
+
} else {
|
|
98
|
+
if (additional_class.includes("w-") || additional_class.includes("h-"))
|
|
99
|
+
style = "";
|
|
100
|
+
else {
|
|
101
|
+
let icon_size = `${size * 0.25}rem`;
|
|
102
|
+
style = `width: ${icon_size}; height: ${icon_size}`;
|
|
103
|
+
}
|
|
71
104
|
}
|
|
72
105
|
}
|
|
73
106
|
</script>
|
|
@@ -8,7 +8,7 @@ declare const __propDef: {
|
|
|
8
8
|
label?: string | undefined;
|
|
9
9
|
symbol?: string | undefined;
|
|
10
10
|
color?: string | undefined;
|
|
11
|
-
|
|
11
|
+
s?: string | undefined;
|
|
12
12
|
bg?: string | undefined;
|
|
13
13
|
circle?: boolean | undefined;
|
|
14
14
|
};
|
|
@@ -49,9 +49,9 @@ export default class Icon extends SvelteComponentTyped<IconProps, IconEvents, Ic
|
|
|
49
49
|
get color(): string | undefined;
|
|
50
50
|
/**accessor*/
|
|
51
51
|
set color(_: string | undefined);
|
|
52
|
-
get
|
|
52
|
+
get s(): string | undefined;
|
|
53
53
|
/**accessor*/
|
|
54
|
-
set
|
|
54
|
+
set s(_: string | undefined);
|
|
55
55
|
get bg(): string | undefined;
|
|
56
56
|
/**accessor*/
|
|
57
57
|
set bg(_: string | undefined);
|
package/components/menu.d.ts
CHANGED
|
@@ -2,4 +2,5 @@ import Floating_container from './Floating_container.svelte';
|
|
|
2
2
|
export declare function showMenu(around: DOMRect | DOMPoint, operations: any): void;
|
|
3
3
|
export declare function hideWholeContextMenu(): void;
|
|
4
4
|
export declare function showFloatingToolbar(around: DOMRect | DOMPoint, toolbar: any, props?: {}): Floating_container | null;
|
|
5
|
+
export declare function hideFloatingToolbar(): void;
|
|
5
6
|
export declare function showGridMenu(around: DOMRect | DOMPoint, operations: any): void;
|
package/components/menu.js
CHANGED
|
@@ -54,6 +54,12 @@ export function showFloatingToolbar(around, toolbar, props = {}) {
|
|
|
54
54
|
console.error('what now?');
|
|
55
55
|
return toolbar_component;
|
|
56
56
|
}
|
|
57
|
+
export function hideFloatingToolbar() {
|
|
58
|
+
if (toolbar_component) {
|
|
59
|
+
if (toolbar_component.isVisible())
|
|
60
|
+
toolbar_component.hide();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
57
63
|
export function showGridMenu(around, operations) {
|
|
58
64
|
showFloatingToolbar(around, Grid, { operations: operations });
|
|
59
65
|
}
|
package/components/tag.svelte
CHANGED
|
@@ -7,14 +7,7 @@ export let color;
|
|
|
7
7
|
export let onRemove = void 0;
|
|
8
8
|
export let onColor = void 0;
|
|
9
9
|
export let s = "sm";
|
|
10
|
-
|
|
11
|
-
if (onColor && rootElement) {
|
|
12
|
-
rootElement.addEventListener("click", showColorPicker);
|
|
13
|
-
rootElement.classList.add("cursor-pointer");
|
|
14
|
-
}
|
|
15
|
-
return () => {
|
|
16
|
-
};
|
|
17
|
-
});
|
|
10
|
+
export let onCustomClick = void 0;
|
|
18
11
|
let pr = onRemove ? "pr-1" : "pr-2";
|
|
19
12
|
let font;
|
|
20
13
|
let x_size;
|
|
@@ -47,11 +40,32 @@ function onSelectColor(color2) {
|
|
|
47
40
|
onColor(name, color2);
|
|
48
41
|
colorPicker?.hide();
|
|
49
42
|
}
|
|
43
|
+
function conditionalClick(node, { condition, callback }) {
|
|
44
|
+
if (condition) {
|
|
45
|
+
node.addEventListener("click", callback);
|
|
46
|
+
return {
|
|
47
|
+
destroy() {
|
|
48
|
+
node.removeEventListener("click", callback);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const hasClick = onColor != void 0 || onCustomClick != void 0;
|
|
54
|
+
function handleClick(e) {
|
|
55
|
+
if (onColor)
|
|
56
|
+
showColorPicker(e);
|
|
57
|
+
else if (onCustomClick)
|
|
58
|
+
onCustomClick(e);
|
|
59
|
+
}
|
|
50
60
|
</script>
|
|
51
61
|
|
|
52
62
|
<span
|
|
53
63
|
class=" pl-2 {pr} rounded text-white flex flex-row {color} items-center"
|
|
54
|
-
|
|
64
|
+
class:cursor-pointer={hasClick}
|
|
65
|
+
use:conditionalClick={{
|
|
66
|
+
condition: hasClick,
|
|
67
|
+
callback: handleClick
|
|
68
|
+
}}
|
|
55
69
|
bind:this={rootElement}>
|
|
56
70
|
<span class={font}>{name}</span>
|
|
57
71
|
{#if onRemove}
|