@humandialog/forms.svelte 1.7.28 → 1.8.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 (258) hide show
  1. package/components/Fab.25.svelte +473 -0
  2. package/components/Fab.25.svelte.d.ts +18 -0
  3. package/components/Fab.svelte +51 -170
  4. package/components/Floating_container.25.svelte +178 -0
  5. package/components/Floating_container.25.svelte.d.ts +23 -0
  6. package/components/Floating_container.svelte +18 -6
  7. package/components/Grid.menu.svelte +15 -16
  8. package/components/Grid.menu.svelte.d.ts +2 -2
  9. package/components/breadcrumb.svelte +27 -27
  10. package/components/checkbox.svelte +1 -1
  11. package/components/combo/combo.svelte +60 -79
  12. package/components/combo/combo.svelte.d.ts +1 -0
  13. package/components/contextmenu-25.svelte +518 -0
  14. package/components/contextmenu-25.svelte.d.ts +26 -0
  15. package/components/contextmenu.svelte +179 -65
  16. package/components/contextmenu.svelte.d.ts +2 -2
  17. package/components/date.svelte +42 -21
  18. package/components/date.svelte.d.ts +1 -0
  19. package/components/delayed.spinner.svelte +2 -1
  20. package/components/document/editor.svelte +21 -31
  21. package/components/document/editor.svelte.d.ts +0 -2
  22. package/components/document/internal/palette.row.svelte +10 -8
  23. package/components/document/internal/palette.svelte +7 -8
  24. package/components/document/rich.edit.svelte +10 -10
  25. package/components/edit.field.svelte +1 -1
  26. package/components/input.text.svelte.d.ts +2 -2
  27. package/components/inputbox.ltop.svelte +1 -1
  28. package/components/inputbox.ltop.svelte.d.ts +12 -12
  29. package/components/kanban/internal/kanban.card.svelte +27 -47
  30. package/components/kanban/internal/kanban.column.svelte +44 -24
  31. package/components/kanban/internal/kanban.inserter.svelte +11 -14
  32. package/components/kanban/internal/kanban.move.menu.svelte +12 -12
  33. package/components/kanban/internal/kanban.props.svelte +24 -9
  34. package/components/kanban/kanban.svelte +24 -77
  35. package/components/kanban/kanban.svelte.d.ts +2 -0
  36. package/components/kanban copy.zip +0 -0
  37. package/components/list/List.d.ts +1 -0
  38. package/components/list/List.js +1 -0
  39. package/components/list/internal/list.element copy.svelte +530 -0
  40. package/components/list/internal/list.element copy.svelte.d.ts +35 -0
  41. package/components/list/internal/list.element.svelte +308 -268
  42. package/components/list/internal/list.element.svelte.d.ts +5 -7
  43. package/components/list/internal/list.inserter.svelte +38 -6
  44. package/components/list/internal/note.txt +5 -0
  45. package/components/list/list.svelte +32 -11
  46. package/components/list/list.svelte.d.ts +5 -3
  47. package/components/list/list.title.svelte +2 -0
  48. package/components/list/list.title.svelte.d.ts +1 -0
  49. package/components/menu.d.ts +1 -1
  50. package/components/menu.js +3 -3
  51. package/components/paginator.svelte +79 -9
  52. package/components/prose.editable.p.svelte.d.ts +2 -2
  53. package/components/prose.editable.span.svelte.d.ts +2 -2
  54. package/components/r.edit.svelte +9 -0
  55. package/components/r.edit.svelte.d.ts +23 -0
  56. package/components/r.editable.svelte +74 -0
  57. package/components/r.editable.svelte.d.ts +31 -0
  58. package/components/r.figcaption.svelte +5 -0
  59. package/components/r.figcaption.svelte.d.ts +27 -0
  60. package/components/r.figure.svelte +25 -0
  61. package/components/r.figure.svelte.d.ts +29 -0
  62. package/components/r.icon.svelte +229 -0
  63. package/components/r.icon.svelte.d.ts +33 -0
  64. package/components/radio.svelte +1 -1
  65. package/components/ricons/arrow-up.svelte +11 -0
  66. package/components/ricons/arrow-up.svelte.d.ts +27 -0
  67. package/components/ricons/barcode.svelte +14 -0
  68. package/components/ricons/barcode.svelte.d.ts +27 -0
  69. package/components/ricons/bold.svelte +10 -0
  70. package/components/ricons/bold.svelte.d.ts +27 -0
  71. package/components/ricons/calendar.svelte +13 -0
  72. package/components/ricons/calendar.svelte.d.ts +27 -0
  73. package/components/ricons/calendars.svelte +16 -0
  74. package/components/ricons/calendars.svelte.d.ts +27 -0
  75. package/components/ricons/cat.svelte +14 -0
  76. package/components/ricons/cat.svelte.d.ts +27 -0
  77. package/components/ricons/check-check.svelte +12 -0
  78. package/components/ricons/check-check.svelte.d.ts +27 -0
  79. package/components/ricons/check.svelte +18 -0
  80. package/components/ricons/check.svelte.d.ts +27 -0
  81. package/components/ricons/chess-rook.svelte +17 -0
  82. package/components/ricons/chess-rook.svelte.d.ts +27 -0
  83. package/components/ricons/chevron-down.svelte +11 -0
  84. package/components/ricons/chevron-down.svelte.d.ts +27 -0
  85. package/components/ricons/chevron-left.svelte +11 -0
  86. package/components/ricons/chevron-left.svelte.d.ts +27 -0
  87. package/components/ricons/chevron-right.svelte +11 -0
  88. package/components/ricons/chevron-right.svelte.d.ts +27 -0
  89. package/components/ricons/chevron-up.svelte +11 -0
  90. package/components/ricons/chevron-up.svelte.d.ts +27 -0
  91. package/components/ricons/chevrons-down.svelte +12 -0
  92. package/components/ricons/chevrons-down.svelte.d.ts +27 -0
  93. package/components/ricons/chevrons-left-right.svelte +12 -0
  94. package/components/ricons/chevrons-left-right.svelte.d.ts +27 -0
  95. package/components/ricons/chevrons-left.svelte +12 -0
  96. package/components/ricons/chevrons-left.svelte.d.ts +27 -0
  97. package/components/ricons/chevrons-right.svelte +12 -0
  98. package/components/ricons/chevrons-right.svelte.d.ts +27 -0
  99. package/components/ricons/chevrons-up-down.svelte +12 -0
  100. package/components/ricons/chevrons-up-down.svelte.d.ts +27 -0
  101. package/components/ricons/chevrons-up.svelte +12 -0
  102. package/components/ricons/chevrons-up.svelte.d.ts +27 -0
  103. package/components/ricons/circle-check.svelte +28 -0
  104. package/components/ricons/circle-check.svelte.d.ts +23 -0
  105. package/components/ricons/circle-dashed.svelte +19 -0
  106. package/components/ricons/circle-dashed.svelte.d.ts +27 -0
  107. package/components/ricons/circle-dot-dashed.svelte +20 -0
  108. package/components/ricons/circle-dot-dashed.svelte.d.ts +27 -0
  109. package/components/ricons/circle.svelte +30 -0
  110. package/components/ricons/circle.svelte.d.ts +23 -0
  111. package/components/ricons/clipboard-list.svelte +17 -0
  112. package/components/ricons/clipboard-list.svelte.d.ts +27 -0
  113. package/components/ricons/clipboard-minus.svelte +9 -0
  114. package/components/ricons/clipboard-minus.svelte.d.ts +23 -0
  115. package/components/ricons/clipboard-pen-line.svelte +18 -0
  116. package/components/ricons/clipboard-pen-line.svelte.d.ts +27 -0
  117. package/components/ricons/code-xml.svelte +12 -0
  118. package/components/ricons/code-xml.svelte.d.ts +27 -0
  119. package/components/ricons/download.svelte +13 -0
  120. package/components/ricons/download.svelte.d.ts +27 -0
  121. package/components/ricons/ellipsis-vertical.svelte +14 -0
  122. package/components/ricons/ellipsis-vertical.svelte.d.ts +27 -0
  123. package/components/ricons/file-archive.svelte +18 -0
  124. package/components/ricons/file-archive.svelte.d.ts +27 -0
  125. package/components/ricons/file-text.svelte +17 -0
  126. package/components/ricons/file-text.svelte.d.ts +27 -0
  127. package/components/ricons/folder.svelte +12 -0
  128. package/components/ricons/folder.svelte.d.ts +27 -0
  129. package/components/ricons/heading-1.svelte +13 -0
  130. package/components/ricons/heading-1.svelte.d.ts +27 -0
  131. package/components/ricons/heading-2.svelte +13 -0
  132. package/components/ricons/heading-2.svelte.d.ts +27 -0
  133. package/components/ricons/heading-3.svelte +14 -0
  134. package/components/ricons/heading-3.svelte.d.ts +27 -0
  135. package/components/ricons/heading-4.svelte +14 -0
  136. package/components/ricons/heading-4.svelte.d.ts +27 -0
  137. package/components/ricons/heading-5.svelte +14 -0
  138. package/components/ricons/heading-5.svelte.d.ts +27 -0
  139. package/components/ricons/image.svelte +12 -0
  140. package/components/ricons/image.svelte.d.ts +27 -0
  141. package/components/ricons/italic.svelte +12 -0
  142. package/components/ricons/italic.svelte.d.ts +27 -0
  143. package/components/ricons/languages.svelte +15 -0
  144. package/components/ricons/languages.svelte.d.ts +27 -0
  145. package/components/ricons/list-checks.svelte +15 -0
  146. package/components/ricons/list-checks.svelte.d.ts +27 -0
  147. package/components/ricons/list-minus.svelte +14 -0
  148. package/components/ricons/list-minus.svelte.d.ts +27 -0
  149. package/components/ricons/list-ordered.svelte +16 -0
  150. package/components/ricons/list-ordered.svelte.d.ts +27 -0
  151. package/components/ricons/list-plus.svelte +14 -0
  152. package/components/ricons/list-plus.svelte.d.ts +27 -0
  153. package/components/ricons/list.svelte +15 -0
  154. package/components/ricons/list.svelte.d.ts +27 -0
  155. package/components/ricons/loader-circle.svelte +19 -0
  156. package/components/ricons/loader-circle.svelte.d.ts +27 -0
  157. package/components/ricons/log-in.svelte +12 -0
  158. package/components/ricons/log-in.svelte.d.ts +27 -0
  159. package/components/ricons/log-out.svelte +12 -0
  160. package/components/ricons/log-out.svelte.d.ts +27 -0
  161. package/components/ricons/message-square.svelte +12 -0
  162. package/components/ricons/message-square.svelte.d.ts +27 -0
  163. package/components/ricons/messages-square.svelte +15 -0
  164. package/components/ricons/messages-square.svelte.d.ts +27 -0
  165. package/components/ricons/minus.svelte +10 -0
  166. package/components/ricons/minus.svelte.d.ts +27 -0
  167. package/components/ricons/notebook-tabs.svelte +19 -0
  168. package/components/ricons/notebook-tabs.svelte.d.ts +27 -0
  169. package/components/ricons/notebook.svelte +16 -0
  170. package/components/ricons/notebook.svelte.d.ts +27 -0
  171. package/components/ricons/package.svelte +22 -0
  172. package/components/ricons/package.svelte.d.ts +27 -0
  173. package/components/ricons/paperclip.svelte +12 -0
  174. package/components/ricons/paperclip.svelte.d.ts +27 -0
  175. package/components/ricons/pencil.svelte +12 -0
  176. package/components/ricons/pencil.svelte.d.ts +27 -0
  177. package/components/ricons/pilcrow.svelte +12 -0
  178. package/components/ricons/pilcrow.svelte.d.ts +27 -0
  179. package/components/ricons/save.svelte +12 -0
  180. package/components/ricons/save.svelte.d.ts +27 -0
  181. package/components/ricons/square-check-big.svelte +13 -0
  182. package/components/ricons/square-check-big.svelte.d.ts +27 -0
  183. package/components/ricons/square-pen.svelte +14 -0
  184. package/components/ricons/square-pen.svelte.d.ts +27 -0
  185. package/components/ricons/square.svelte +10 -0
  186. package/components/ricons/square.svelte.d.ts +27 -0
  187. package/components/ricons/strikethrough.svelte +13 -0
  188. package/components/ricons/strikethrough.svelte.d.ts +27 -0
  189. package/components/ricons/sun-moon.svelte +15 -0
  190. package/components/ricons/sun-moon.svelte.d.ts +27 -0
  191. package/components/ricons/table.svelte +13 -0
  192. package/components/ricons/table.svelte.d.ts +27 -0
  193. package/components/ricons/tag.svelte +12 -0
  194. package/components/ricons/tag.svelte.d.ts +27 -0
  195. package/components/ricons/text-quote.svelte +14 -0
  196. package/components/ricons/text-quote.svelte.d.ts +27 -0
  197. package/components/ricons/turtle.svelte +13 -0
  198. package/components/ricons/turtle.svelte.d.ts +27 -0
  199. package/components/ricons/underline.svelte +11 -0
  200. package/components/ricons/underline.svelte.d.ts +27 -0
  201. package/components/ricons/upload.svelte +13 -0
  202. package/components/ricons/upload.svelte.d.ts +27 -0
  203. package/components/ricons/user.svelte +12 -0
  204. package/components/ricons/user.svelte.d.ts +27 -0
  205. package/components/ricons/users.svelte +14 -0
  206. package/components/ricons/users.svelte.d.ts +27 -0
  207. package/components/ricons/x.svelte +11 -0
  208. package/components/ricons/x.svelte.d.ts +27 -0
  209. package/components/sidebar/sidebar.brand.svelte +14 -13
  210. package/components/sidebar/sidebar.brand.svelte.d.ts +2 -2
  211. package/components/sidebar/sidebar.group.svelte +52 -30
  212. package/components/sidebar/sidebar.item.svelte +35 -141
  213. package/components/sidebar/sidebar.item.svelte.d.ts +2 -5
  214. package/components/sidebar/sidebar.list.svelte +8 -8
  215. package/components/sidebar/sidebar.svelte +19 -2
  216. package/components/simple.table.svelte.d.ts +4 -4
  217. package/components/table/_template.table.svelte.d.ts +4 -4
  218. package/components/tags.svelte +10 -3
  219. package/components/tags.svelte.d.ts +1 -0
  220. package/components/textarea.ltop.svelte.d.ts +2 -2
  221. package/components/tile.title.svelte.d.ts +2 -2
  222. package/desk.svelte +122 -128
  223. package/dialog.svelte +17 -7
  224. package/form.box.svelte.d.ts +4 -4
  225. package/horizontal.nav.tabs.svelte +197 -23
  226. package/horizontal.nav.tabs.svelte.d.ts +2 -2
  227. package/horizontal.toolbar.svelte +25 -18
  228. package/horizontal.toolbar.svelte.d.ts +2 -2
  229. package/index.d.ts +10 -3
  230. package/index.js +10 -3
  231. package/operations.svelte +51 -22
  232. package/package.json +89 -1
  233. package/page.row.svelte.d.ts +2 -2
  234. package/page.svelte +17 -7
  235. package/page.svelte.d.ts +10 -10
  236. package/paper.header.svelte +4 -0
  237. package/paper.header.svelte.d.ts +27 -0
  238. package/paper.nav.svelte +8 -0
  239. package/paper.nav.svelte.d.ts +27 -0
  240. package/paper.svelte +22 -6
  241. package/paper.svelte.d.ts +2 -0
  242. package/paper.table.svelte +27 -0
  243. package/paper.table.svelte.d.ts +27 -0
  244. package/paper.top.margin.svelte +5 -0
  245. package/paper.top.margin.svelte.d.ts +27 -0
  246. package/stores.d.ts +1 -1
  247. package/tenant.create.svelte +93 -0
  248. package/tenant.create.svelte.d.ts +29 -0
  249. package/tenant.members.svelte +116 -93
  250. package/tile.svelte.d.ts +4 -4
  251. package/tiles.row.svelte.d.ts +2 -2
  252. package/tiles.vertical.row.svelte.d.ts +2 -2
  253. package/updates.d.ts +4 -0
  254. package/updates.js +56 -14
  255. package/utils.d.ts +16 -4
  256. package/utils.js +214 -99
  257. package/vertical.toolbar.svelte +62 -47
  258. package/vertical.toolbar.svelte.d.ts +2 -2
@@ -3,6 +3,9 @@ import { showFloatingToolbar, showMenu, showGridMenu } from "./menu.js";
3
3
  import { FaChevronUp, FaChevronDown, FaChevronLeft, FaChevronRight, FaCircle, FaEllipsisV, FaRegDotCircle, FaDotCircle } from "svelte-icons/fa/";
4
4
  import { isDeviceSmallerThan } from "../utils.js";
5
5
  import { tick } from "svelte";
6
+ import Ricon from "./r.icon.svelte";
7
+ import { i18n } from "../i18n.js";
8
+ import { pushChanges, hasModifications, unsavedModificationsTicket } from "../updates.js";
6
9
  export let mainPageCoords = void 0;
7
10
  $:
8
11
  setupCurrentContextOperations(
@@ -13,7 +16,8 @@ $:
13
16
  $bottom_bar_visible_store,
14
17
  $main_sidebar_visible_store,
15
18
  $leftHandedFAB,
16
- $fabHiddenDueToPopup
19
+ $fabHiddenDueToPopup,
20
+ $unsavedModificationsTicket
17
21
  );
18
22
  let operations = [];
19
23
  let mainOperation = null;
@@ -67,6 +71,14 @@ async function setupCurrentContextOperations(...args) {
67
71
  operations = flatOperations;
68
72
  } else if (opVer == 2) {
69
73
  const definedOperations = [...operations];
74
+ const saveOperation = {
75
+ caption: i18n({ en: "Save", es: "Guardar", pl: "Zapisz" }),
76
+ hideToolbarCaption: true,
77
+ mricon: "save",
78
+ action: (f) => pushChanges(),
79
+ fab: "T00",
80
+ disabledFunc: () => !hasModifications()
81
+ };
70
82
  if (main_FAB_position) {
71
83
  let flatOperations = [];
72
84
  definedOperations.forEach((group) => {
@@ -76,10 +88,13 @@ async function setupCurrentContextOperations(...args) {
76
88
  });
77
89
  flatOperations = [...flatOperations, ...group.operations];
78
90
  });
91
+ flatOperations.push({ separator: true });
92
+ flatOperations.push(saveOperation);
79
93
  const realOps = flatOperations.filter((el) => !!el.separator == false);
80
94
  if (realOps.length > 1) {
81
95
  mainOperation = {
82
96
  icon: FaEllipsisV,
97
+ mricon: "ellipsis-vertical",
83
98
  menu: flatOperations,
84
99
  fab: main_FAB_position
85
100
  };
@@ -91,6 +106,7 @@ async function setupCurrentContextOperations(...args) {
91
106
  } else
92
107
  operations = [];
93
108
  }
109
+ operations.push(saveOperation);
94
110
  definedOperations.forEach((group) => {
95
111
  group.operations.forEach((op) => {
96
112
  if (op.fab) {
@@ -102,6 +118,7 @@ async function setupCurrentContextOperations(...args) {
102
118
  if (!operations.find((op) => op.fab == "M10")) {
103
119
  const collapseFAB = {
104
120
  icon: $fabCollapsed ? FaRegDotCircle : FaDotCircle,
121
+ mricon: $fabCollapsed ? "circle-dot-dashed" : "circle-dashed",
105
122
  fab: "M10",
106
123
  action: (f) => toggleExpandAdditionalOperations()
107
124
  };
@@ -209,7 +226,7 @@ function calculatePosition(operation) {
209
226
  let lShift = 0;
210
227
  let tShift = 0;
211
228
  let rShift = 0;
212
- let bShift = 0;
229
+ let bShift = 55;
213
230
  let vMiddle = "50vh";
214
231
  if (!isDeviceSmallerThan("sm")) {
215
232
  const container = document.getElementById("__hd_svelte_main_content_container");
@@ -286,184 +303,48 @@ function operationVisible(operation) {
286
303
  }
287
304
  </script>
288
305
 
289
- {#if isDirectPositioningMode}
290
- {#if operations && operations.length > 0}
291
- {#each operations as operation}
292
- {#if operationVisible(operation)}
293
- {@const position = calculatePosition(operation)}
294
- {#if position}
295
- <button
296
- class=" w-[55px] h-[55px]
297
- fixed m-0
298
- flex items-center justify-center
299
- disable-dbl-tap-zoom
300
- cursor-pointer z-20"
301
- style={position}
302
- on:click|stopPropagation={(e) => {on_click(e, operation)}}
303
- on:mousedown={mousedown} >
304
-
305
- <div class=" text-stone-500 bg-stone-200/70 hover:bg-stone-200
306
- focus:outline-none font-medium rounded-full text-sm text-center
307
- dark:text-stone-500 dark:bg-stone-700/80 dark:hover:bg-stone-700
308
- focus:ring-4 focus:ring-blue-300 dark:focus:ring-blue-800
309
306
 
310
- flex items-center justify-center
311
- w-[30px] h-[30px]">
312
- <div class="w-5 h-5">
313
- <svelte:component this={operation.icon}/>
314
- </div>
315
- </div>
316
- </button>
317
- {/if}
318
- {/if}
319
- {/each}
320
- {/if}
321
- {:else}
307
+ {#if operations && operations.length > 0}
308
+ {#each operations as operation}
309
+ {#if operationVisible(operation)}
310
+ {@const position = calculatePosition(operation)}
311
+ {#if position}
312
+ <button
313
+ class=" w-[55px] h-[55px]
314
+ fixed m-0
315
+ flex items-center justify-center
316
+ disable-dbl-tap-zoom
317
+ cursor-pointer z-20"
318
+ style={position}
319
+ on:click|stopPropagation={(e) => {on_click(e, operation)}}
320
+ on:mousedown={mousedown} >
322
321
 
323
- {#if operations && operations.length > 0}
324
- {@const topPosition = 350}
325
- {@const verticalPosition = mainOperation.aboveKeyboard ? `bottom: ${topPosition}px` : "bottom: 10px"}
326
- <button id="__hd_fab_mainOperation"
327
- class="text-white bg-blue-700 hover:bg-blue-800 focus:outline-none focus:ring-4 focus:ring-blue-300
328
- font-medium rounded-full text-sm text-center shadow-md
329
- w-[55px] h-[55px]
330
- fixed m-0 bottom-0 right-[0px]
331
- dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800
332
- flex items-center justify-center
333
- disable-dbl-tap-zoom"
334
- style={verticalPosition}
335
- on:click|stopPropagation={(e) => {on_click(e, mainOperation)}}
336
- on:mousedown={mousedown} >
337
- <div class="w-7 h-7"><svelte:component this={mainOperation.icon}/></div>
338
- </button>
322
+ <div class=" focus:outline-none font-medium text-sm text-center
339
323
 
340
- {#if secondaryOperation || isExpandable}
324
+ text-stone-500 bg-stone-200/70 hover:bg-stone-200
325
+ rounded-full
326
+ dark:text-orange-200 dark:bg-stone-700/40 dark:hover:bg-stone-700
327
+ ring-1 ring-orange-800/40 dark:ring-orange-200/30
341
328
 
342
- <!-- horizontal container -->
343
- <div class="flex flex-row m-0 fixed bottom-[10px] right-[60px]">
329
+ focus:ring-4 focus:ring-blue-300 dark:focus:ring-blue-800
344
330
 
345
- {#if isExpandable}
346
- <!-- Expander -->
347
- <button class=" bg-transparent mr-2
348
- w-[55px] h-[55px]
349
- flex items-center justify-center
350
- disable-dbl-tap-zoom"
351
- on:click|stopPropagation={toggleExpandToolboxH}
352
- on:mousedown={mousedown}>
353
- <div class=" w-10 h-10
354
- text-white bg-zinc-500 hover:bg-zinc-500
355
- font-medium rounded-full text-sm text-center shadow-md
356
- dark:bg-zinc-500 dark:hover:bg-zinc-500
357
- flex items-center justify-center">
358
- <div class="w-2 h-2">
359
- {#if hToolboxExpanded}
360
- <FaCircle/>
361
- {:else}
362
- <FaCircle/>
363
- {/if}
331
+ flex items-center justify-center
332
+ w-8 h-8">
333
+ {#if operation.mricon}
334
+ <div class="py-1 mr-1 w-4"><Ricon icon = {operation.mricon} s/></div>
335
+ {:else }
336
+ <div class="w-4 h-4 text-orange-500">
337
+ <svelte:component this={operation.icon}/>
364
338
  </div>
339
+ {/if}
365
340
  </div>
366
- </button>
367
-
368
- {#if hToolboxExpanded}
369
- {#if secondaryOperation}
370
- <button class=" bg-transparent
371
- mx-0 mr-2 w-[55px] h-[55px]
372
- flex items-center justify-center
373
- disable-dbl-tap-zoom"
374
- on:click|stopPropagation={(e) => {on_click(e, secondaryOperation)}}
375
- on:mousedown={mousedown}>
376
- <div class=" w-10 h-10
377
- text-white bg-zinc-500 group-hover:bg-zinc-500
378
- dark:bg-zinc-500 dark:group-hover:bg-zinc-500
379
- font-medium rounded-full text-sm text-center shadow-md
380
- flex items-center justify-center">
381
- <div class="w-5 h-5"><svelte:component this={secondaryOperation.icon}/></div>
382
- </div>
383
- </button>
384
- {:else if toolboxOperations.length > 0}
385
- {@const toolbox=toolboxOperations.reverse()}
386
- {#each toolbox as operation}
387
- {#if !operation.separator}
388
- <!-- svelte-ignore a11y-click-events-have-key-events -->
389
- <button class=" bg-transparent
390
- mx-0 mr-2 w-[55px] h-[55px]
391
- flex items-center justify-center
392
- disable-dbl-tap-zoom"
393
- on:click|stopPropagation={(e) => {on_click(e, operation)}}
394
- on:mousedown={mousedown}>
395
- <div class=" w-10 h-10
396
- text-white bg-zinc-500 group-hover:bg-zinc-500
397
- dark:bg-zinc-500 dark:group-hover:bg-zinc-500
398
- font-medium rounded-full text-sm text-center shadow-md
399
- flex items-center justify-center">
400
- <div class="w-5 h-5"><svelte:component this={operation.icon}/></div>
401
- </div>
402
- </button>
403
- {/if}
404
- {/each}
405
-
406
- {/if}
407
- {/if}
408
- {:else}
409
- <button class=" bg-transparent
410
- mx-0 mr-2 w-[55px] h-[55px]
411
- flex items-center justify-center
412
- disable-dbl-tap-zoom"
413
- on:click|stopPropagation={(e) => {on_click(e, secondaryOperation)}}
414
- on:mousedown={mousedown}>
415
- <div class=" w-10 h-10
416
- text-white bg-zinc-500 group-hover:bg-zinc-500
417
- dark:bg-zinc-500 dark:group-hover:bg-zinc-500
418
- font-medium rounded-full text-sm text-center shadow-md
419
- flex items-center justify-center">
420
- <div class="w-5 h-5"><svelte:component this={secondaryOperation.icon}/></div>
421
- </div>
422
- </button>
423
- {/if}
424
-
425
- </div>
426
- {/if}
427
-
428
- {#if operations.length > 2} <!-- has vertical operations -->
429
- <!-- vertical tools container -->
430
- <ul class="list-none m-0 fixed bottom-[70px] right-0">
431
- {#if (isExpandable && vToolboxExpanded) || !isExpandable}
432
- {@const verticalOperations = operations.slice(2).reverse()}
433
- {#each verticalOperations as operation}
434
- {#if !operation.separator}
435
- <!-- svelte-ignore a11y-click-events-have-key-events -->
436
- <li class="flex flex-row px-0 py-0 justify-end group"
437
- on:click|stopPropagation={(e) => {on_click(e, operation)}}
438
- on:mousedown={mousedown}>
439
- {#if operation.caption}
440
- <div>
441
- <span class="block whitespace-nowrap text-sm mt-3 font-semibold text-white mr-3
442
- select-none bg-stone-700 group-hover:bg-stone-800 px-1 shadow-lg rounded">{operation.caption}</span>
443
- </div>
444
- {/if}
445
- <button class=" bg-transparent
446
- mx-0 mb-2 w-[55px] h-[55px]
447
- flex items-center justify-center
448
- disable-dbl-tap-zoom">
449
- <div class=" w-10 h-10
450
- text-white bg-zinc-500 group-hover:bg-zinc-500
451
- dark:bg-zinc-500 dark:group-hover:bg-zinc-500
452
- font-medium rounded-full text-sm text-center shadow-md
453
- flex items-center justify-center">
454
- <div class="w-5 h-5"><svelte:component this={operation.icon}/></div>
455
- </div>
456
- </button>
457
- </li>
458
- {/if}
459
- {/each}
460
- {/if}
461
- </ul>
341
+ </button>
342
+ {/if}
462
343
  {/if}
463
-
464
- {/if}
344
+ {/each}
465
345
  {/if}
466
346
 
347
+
467
348
  <style>
468
349
 
469
350
  .disable-dbl-tap-zoom {
@@ -0,0 +1,178 @@
1
+ <script>import { tick, afterUpdate } from "svelte";
2
+ import { isDeviceSmallerThan } from "../utils";
3
+ import { pushToolsActionsOperations, popToolsActionsOperations, fabHiddenDueToPopup } from "../stores";
4
+ import { FaTimes } from "svelte-icons/fa";
5
+ import Icon from "./icon.svelte";
6
+ import { usePreventScroll } from "./react-aria/preventScroll";
7
+ let x;
8
+ let y;
9
+ let visible = false;
10
+ let toolbar;
11
+ let props = {};
12
+ let around_rect;
13
+ let rootElement;
14
+ let internalElement;
15
+ let closeButtonPos = "";
16
+ let maxHeight = 0;
17
+ let preventScrollRestorer = null;
18
+ export async function show(around, _toolbar, _props = {}) {
19
+ if (around instanceof DOMRect) {
20
+ x = around.left;
21
+ y = around.bottom;
22
+ around_rect = around;
23
+ } else if (around instanceof DOMPoint) {
24
+ x = around.x;
25
+ y = around.y;
26
+ around_rect = new DOMRect(x, y, 0, 0);
27
+ }
28
+ const was_visible = visible;
29
+ if (!was_visible && toolbar == _toolbar && internalElement && internalElement.reload) {
30
+ internalElement.reload(_props);
31
+ }
32
+ visible = true;
33
+ toolbar = _toolbar;
34
+ props = _props;
35
+ cssPosition = calculatePosition(x, y, around_rect, true, true);
36
+ props.onHide = () => {
37
+ hide();
38
+ };
39
+ props.onSizeChanged = () => onSizeChanged();
40
+ hide_window_indicator = 0;
41
+ window.addEventListener("click", on_before_window_click, true);
42
+ if (isDeviceSmallerThan("sm"))
43
+ preventScrollRestorer = usePreventScroll();
44
+ if (isDeviceSmallerThan("sm")) {
45
+ $fabHiddenDueToPopup = true;
46
+ }
47
+ await tick();
48
+ if (!was_visible)
49
+ rootElement.addEventListener("click", on_before_container_click, true);
50
+ cssPosition = calculatePosition(x, y, around_rect, true, false);
51
+ }
52
+ export function isVisible() {
53
+ return visible;
54
+ }
55
+ export function hide() {
56
+ if (visible) {
57
+ $fabHiddenDueToPopup = false;
58
+ }
59
+ visible = false;
60
+ toolbar = null;
61
+ cssPosition = calculatePosition(x, y, around_rect, false, false);
62
+ window.removeEventListener("click", on_before_window_click, true);
63
+ rootElement?.removeEventListener("click", on_before_container_click, true);
64
+ if (preventScrollRestorer) {
65
+ preventScrollRestorer();
66
+ preventScrollRestorer = null;
67
+ }
68
+ }
69
+ export function isSameToolbar(_toolbar) {
70
+ return _toolbar == toolbar;
71
+ }
72
+ async function onSizeChanged() {
73
+ if (!visible)
74
+ return;
75
+ cssPosition = calculatePosition(x, y, around_rect, true, true);
76
+ await tick();
77
+ cssPosition = calculatePosition(x, y, around_rect, true, false);
78
+ }
79
+ let hide_window_indicator = 0;
80
+ function on_before_window_click() {
81
+ hide_window_indicator++;
82
+ setTimeout(() => {
83
+ if (hide_window_indicator != 0) {
84
+ hide_window_indicator = 0;
85
+ hide();
86
+ }
87
+ }, 0);
88
+ }
89
+ function on_before_container_click() {
90
+ hide_window_indicator--;
91
+ }
92
+ let cssPosition = "";
93
+ function calculatePosition(x2, y2, around, visible2, fresh) {
94
+ let result = "";
95
+ if (!visible2) {
96
+ result = "display: none";
97
+ } else if (isDeviceSmallerThan("sm")) {
98
+ let screenRect = new DOMRect();
99
+ screenRect.x = 0;
100
+ screenRect.y = 0;
101
+ screenRect.width = window.innerWidth;
102
+ screenRect.height = window.innerHeight;
103
+ const margin = 5;
104
+ let myRect = null;
105
+ if (!fresh) {
106
+ myRect = rootElement.getBoundingClientRect();
107
+ if (myRect && myRect.height == 0)
108
+ myRect = null;
109
+ }
110
+ if (myRect) {
111
+ maxHeight = screenRect.height / 2 - margin;
112
+ if (myRect.height < maxHeight)
113
+ maxHeight = myRect.height;
114
+ const width = screenRect.width - 2 * margin;
115
+ x2 = margin;
116
+ y2 = screenRect.bottom - maxHeight - margin;
117
+ result = `left: ${x2}px; bottom: ${margin}px; width: ${width}px; max-height: ${maxHeight}px; display: block`;
118
+ } else {
119
+ maxHeight = screenRect.height / 2 - margin;
120
+ const width = screenRect.width - 2 * margin;
121
+ x2 = margin;
122
+ y2 = screenRect.bottom - maxHeight - margin;
123
+ result = `left: ${x2}px; bottom: ${margin}px; width: ${width}px; max-height: ${maxHeight}px; display: block`;
124
+ }
125
+ closeButtonPos = `right: 0.5rem; bottom: calc(${margin + maxHeight}px - 1.75rem)`;
126
+ } else {
127
+ let myRect = null;
128
+ if (!fresh) {
129
+ myRect = rootElement.getBoundingClientRect();
130
+ if (myRect && myRect.height == 0)
131
+ myRect = null;
132
+ }
133
+ const m = 15;
134
+ let screenRect = new DOMRect(m, 0, window.innerWidth - 2 * m, window.innerHeight);
135
+ if (myRect) {
136
+ if (myRect.right > screenRect.right)
137
+ x2 = screenRect.right - myRect.width;
138
+ if (myRect.bottom > screenRect.bottom)
139
+ y2 = screenRect.bottom - myRect.height - around_rect.height;
140
+ if (myRect.left < screenRect.left)
141
+ x2 = screenRect.left;
142
+ if (myRect.top < screenRect.top)
143
+ y2 = screenRect.top;
144
+ }
145
+ result = `left:${x2}px; top:${y2}px; width: max-content; height:max-content; display: block`;
146
+ closeButtonPos = ``;
147
+ }
148
+ return result;
149
+ }
150
+ </script>
151
+
152
+ <div id="__hd_svelte_floating_container"
153
+ class="p-2 bg-stone-100 dark:bg-stone-800 rounded-lg shadow-md shadow-stone-500 dark:shadow-black z-40 fixed "
154
+ style={cssPosition}
155
+ visible={visible}
156
+ bind:this={rootElement}>
157
+ {#if closeButtonPos}
158
+ <button class=" text-stone-800 dark:text-stone-400
159
+ fixed w-6 h-6 flex items-center justify-center
160
+ focus:outline-none font-medium text-sm text-center"
161
+ style={closeButtonPos}
162
+ on:click={ hide }> <!--rounded-full focus:ring-4 focus:ring-blue-300 dark:focus:ring-blue-800 text-stone-500 bg-stone-200/70 hover:bg-stone-200 dark:text-stone-500 dark:bg-stone-700/80 dark:hover:bg-stone-700 -->
163
+ <Icon component={FaTimes} s="md"/>
164
+ </button>
165
+ {/if}
166
+
167
+ {#if toolbar}
168
+ <svelte:component this={toolbar} {...props} {maxHeight} bind:this={internalElement} />
169
+ {/if}
170
+ </div>
171
+
172
+ <!-- use usePreventScroll instead -->
173
+ <!--style>
174
+ :global(body:has(#__hd_svelte_floating_container[visible="true"]))
175
+ {
176
+ overflow: hidden;
177
+ }
178
+ </style-->
@@ -0,0 +1,23 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ show?: ((around: DOMRect | DOMPoint, _toolbar: any, _props?: {}) => Promise<void>) | undefined;
5
+ isVisible?: (() => boolean) | undefined;
6
+ hide?: (() => void) | undefined;
7
+ isSameToolbar?: ((_toolbar: any) => boolean) | undefined;
8
+ };
9
+ events: {
10
+ [evt: string]: CustomEvent<any>;
11
+ };
12
+ slots: {};
13
+ };
14
+ export type FloatingContainerProps = typeof __propDef.props;
15
+ export type FloatingContainerEvents = typeof __propDef.events;
16
+ export type FloatingContainerSlots = typeof __propDef.slots;
17
+ export default class FloatingContainer extends SvelteComponentTyped<FloatingContainerProps, FloatingContainerEvents, FloatingContainerSlots> {
18
+ get show(): (around: DOMRect | DOMPoint, _toolbar: any, _props?: {}) => Promise<void>;
19
+ get isVisible(): () => boolean;
20
+ get hide(): () => void;
21
+ get isSameToolbar(): (_toolbar: any) => boolean;
22
+ }
23
+ export {};
@@ -15,6 +15,7 @@ let internalElement;
15
15
  let closeButtonPos = "";
16
16
  let maxHeight = 0;
17
17
  let preventScrollRestorer = null;
18
+ let ownCloseButton = false;
18
19
  export async function show(around, _toolbar, _props = {}) {
19
20
  if (around instanceof DOMRect) {
20
21
  x = around.left;
@@ -32,6 +33,10 @@ export async function show(around, _toolbar, _props = {}) {
32
33
  visible = true;
33
34
  toolbar = _toolbar;
34
35
  props = _props;
36
+ if (props && props.hasOwnProperty("ownCloseButton"))
37
+ ownCloseButton = props.ownCloseButton;
38
+ else
39
+ ownCloseButton = false;
35
40
  cssPosition = calculatePosition(x, y, around_rect, true, true);
36
41
  props.onHide = () => {
37
42
  hide();
@@ -108,7 +113,7 @@ function calculatePosition(x2, y2, around, visible2, fresh) {
108
113
  myRect = null;
109
114
  }
110
115
  if (myRect) {
111
- maxHeight = screenRect.height / 2 - margin;
116
+ maxHeight = screenRect.height - margin;
112
117
  if (myRect.height < maxHeight)
113
118
  maxHeight = myRect.height;
114
119
  const width = screenRect.width - 2 * margin;
@@ -116,13 +121,16 @@ function calculatePosition(x2, y2, around, visible2, fresh) {
116
121
  y2 = screenRect.bottom - maxHeight - margin;
117
122
  result = `left: ${x2}px; bottom: ${margin}px; width: ${width}px; max-height: ${maxHeight}px; display: block`;
118
123
  } else {
119
- maxHeight = screenRect.height / 2 - margin;
124
+ maxHeight = screenRect.height - margin;
120
125
  const width = screenRect.width - 2 * margin;
121
126
  x2 = margin;
122
127
  y2 = screenRect.bottom - maxHeight - margin;
123
128
  result = `left: ${x2}px; bottom: ${margin}px; width: ${width}px; max-height: ${maxHeight}px; display: block`;
124
129
  }
125
- closeButtonPos = `right: 0.5rem; bottom: calc(${margin + maxHeight}px - 1.75rem)`;
130
+ if (!ownCloseButton)
131
+ closeButtonPos = `right: 0.5rem; bottom: calc(${margin + maxHeight}px - 1.75rem)`;
132
+ else
133
+ closeButtonPos = "";
126
134
  } else {
127
135
  let myRect = null;
128
136
  if (!fresh) {
@@ -150,14 +158,18 @@ function calculatePosition(x2, y2, around, visible2, fresh) {
150
158
  </script>
151
159
 
152
160
  <div id="__hd_svelte_floating_container"
153
- class="p-2 bg-stone-100 dark:bg-stone-800 rounded-lg shadow-md shadow-stone-500 dark:shadow-black z-40 fixed "
161
+ class=" Floating_container
162
+ bg-stone-100 dark:bg-stone-800 rounded-lg shadow-md shadow-stone-500 dark:shadow-black z-40 fixed
163
+ sm:shadow-xl sm:shadow-slate-700/10
164
+ sm:dark:shadow-black/80
165
+ sm:outline sm:outline-1 sm:outline-stone-500"
154
166
  style={cssPosition}
155
167
  visible={visible}
156
168
  bind:this={rootElement}>
157
169
  {#if closeButtonPos}
158
170
  <button class=" text-stone-800 dark:text-stone-400
159
171
  fixed w-6 h-6 flex items-center justify-center
160
- focus:outline-none font-medium text-sm text-center"
172
+ focus:outline-none font-medium text-sm text-center"
161
173
  style={closeButtonPos}
162
174
  on:click={ hide }> <!--rounded-full focus:ring-4 focus:ring-blue-300 dark:focus:ring-blue-800 text-stone-500 bg-stone-200/70 hover:bg-stone-200 dark:text-stone-500 dark:bg-stone-700/80 dark:hover:bg-stone-700 -->
163
175
  <Icon component={FaTimes} s="md"/>
@@ -171,7 +183,7 @@ function calculatePosition(x2, y2, around, visible2, fresh) {
171
183
 
172
184
  <!-- use usePreventScroll instead -->
173
185
  <!--style>
174
- :global(body:has(#__hd_svelte_floating_container[visible="true"]))
186
+ :global(body:has(#__hd_svelte_floating_container[visible="true"]))
175
187
  {
176
188
  overflow: hidden;
177
189
  }
@@ -4,7 +4,7 @@
4
4
  export let operations = []
5
5
  export let label = ''
6
6
  export let onHide = undefined;
7
-
7
+
8
8
  $: grid_cols = init(operations);
9
9
 
10
10
  function init(operations)
@@ -36,31 +36,31 @@
36
36
  {
37
37
  case 1:
38
38
  return "grid-cols-1";
39
-
39
+
40
40
  case 2:
41
41
  return "grid-cols-2";
42
-
42
+
43
43
  case 3:
44
44
  return "grid-cols-3";
45
-
45
+
46
46
  case 4:
47
47
  return "grid-cols-4";
48
-
48
+
49
49
  case 5:
50
50
  return "grid-cols-5";
51
-
51
+
52
52
  case 6:
53
53
  return "grid-cols-6";
54
-
54
+
55
55
  case 7:
56
56
  return "grid-cols-7";
57
-
57
+
58
58
  case 8:
59
59
  return "grid-cols-8";
60
-
60
+
61
61
  case 9:
62
62
  return "grid-cols-9";
63
-
63
+
64
64
  case 10:
65
65
  return "grid-cols-10";
66
66
  }
@@ -109,27 +109,27 @@
109
109
  let context_item = null
110
110
  if($contextItemsStore.focused)
111
111
  context_item = $contextItemsStore[$contextItemsStore.focused]
112
-
112
+
113
113
  operation.action(context_item);
114
114
  }
115
115
 
116
116
  </script>
117
117
 
118
118
 
119
- <div class="">
119
+ <div class="">
120
120
  <p class="block sm:hidden text-stone-800 dark:text-stone-400 text-sm ml-1 mb-1">{label}</p>
121
121
  <div class="grid gap-2 {grid_cols} ">
122
122
  {#each operations as operation}
123
123
  {#if !operation.separator}
124
124
  {@const col=col_span(operation.columns ?? 1)}
125
-
125
+
126
126
  <button class=" py-2.5 px-5 {col}
127
127
  text-sm font-medium text-stone-900 dark:text-stone-400 dark:hover:text-white
128
- bg-stone-100 hover:bg-stone-200 dark:bg-stone-800 dark:hover:bg-stone-700 active:bg-stone-300 dark:active:bg-stone-600
128
+ bg-stone-100 hover:bg-stone-200 dark:bg-stone-800 dark:hover:bg-stone-700 active:bg-stone-200 dark:active:bg-stone-600
129
129
  border rounded border-stone-200 dark:border-stone-600 focus:outline-none
130
130
  inline-flex items-center justify-center"
131
131
  on:click={(e) => {execute_action(e, operation)}}>
132
-
132
+
133
133
  {#if operation.icon}
134
134
  <div class="w-3 h-3 mr-1"><svelte:component this={operation.icon}/></div>
135
135
  {/if}
@@ -139,4 +139,3 @@
139
139
  {/each}
140
140
  </div>
141
141
  </div>
142
-
@@ -2,9 +2,9 @@
2
2
  /** @typedef {typeof __propDef.events} GridEvents */
3
3
  /** @typedef {typeof __propDef.slots} GridSlots */
4
4
  export default class Grid extends SvelteComponentTyped<{
5
- operations?: any[] | undefined;
6
5
  label?: string | undefined;
7
6
  onHide?: any;
7
+ operations?: any[] | undefined;
8
8
  }, {
9
9
  [evt: string]: CustomEvent<any>;
10
10
  }, {}> {
@@ -15,9 +15,9 @@ export type GridSlots = typeof __propDef.slots;
15
15
  import { SvelteComponentTyped } from "svelte";
16
16
  declare const __propDef: {
17
17
  props: {
18
- operations?: any[] | undefined;
19
18
  label?: string | undefined;
20
19
  onHide?: any;
20
+ operations?: any[] | undefined;
21
21
  };
22
22
  events: {
23
23
  [evt: string]: CustomEvent<any>;