@lavalogic/scoria 0.40.22 → 0.40.25

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.
@@ -867,10 +867,18 @@ export declare const icons: {
867
867
  readonly box: 24;
868
868
  readonly svg: "<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M17.4338 3C17.7851 3 18.1106 3.1843 18.2913 3.4855L20.8575 7.76249C20.9507 7.9179 21 8.09574 21 8.27698V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V8.27698C3 8.09574 3.04926 7.9179 3.14251 7.76249L5.7087 3.4855C5.88942 3.1843 6.21493 3 6.56619 3H17.4338ZM14.5 5H17.2L19 8H15.5L14.5 5ZM12.5 5H11.5L10.5 8V13H13.5V8L12.5 5ZM9.5 5H6.8L5 8H8.5L9.5 5ZM8.5 10H5V19H19V10H15.5V14C15.5 14.5523 15.0523 15 14.5 15H9.5C8.94772 15 8.5 14.5523 8.5 14V10Z\"/>";
869
869
  };
870
- readonly doors: {
870
+ readonly 'warehouse-doors': {
871
871
  readonly box: 24;
872
872
  readonly svg: "<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 4C19 4 22 8 22 8V9H20V20H4V9H2V8C2 8 5 4 12 4ZM12 6C8 6 6 8 6 8V18H8V13H11V18H13V13H16V18H18V8C18 8 16 6 12 6Z\"/>";
873
873
  };
874
+ readonly 'warehouse-doors-2': {
875
+ readonly box: 24;
876
+ readonly svg: "<path d=\"M12 3C19 3 22 7 22 7V8H20V20H18V19V7C18 7 16 5 12 5C8 5 6 7 6 7V19V20H4V8H2V7C2 7 5 3 12 3Z\"/>\n\t\t\t\t\t\t<path d=\"M8 14H11V19H8V14Z\"/>\n\t\t\t\t\t\t<path d=\"M13 14H16V19H13V14Z\"/>";
877
+ };
878
+ readonly 'warehouse-doors-3': {
879
+ readonly box: 24;
880
+ readonly svg: "<path d=\"M2 8.62604L11.5263 3.12604C11.5263 3.12604 12.0088 2.84245 12.5 3.12604L22.0263 8.62604L21.0263 10.3581L20 9.76557V20H18V8.61086L12.0131 5.15435L6 8.62604V20H4V9.78074L3 10.3581L2 8.62604Z\"/>\n\t\t\t\t\t\t<path d=\"M8 14H11V19H8V14Z\"/>\n\t\t\t\t\t\t<path d=\"M13 14H16V19H13V14Z\"/>";
881
+ };
874
882
  readonly 'door-groups': {
875
883
  readonly box: 24;
876
884
  readonly svg: "<path d=\"M13 21H11V13H5V21H3V11H13V21Z\"/>\n\t\t\t\t\t\t<path d=\"M17 17H15V9H9V10H7V7H17V17Z\"/>\n\t\t\t\t\t\t<path d=\"M21 13H19V5H13V6H11V3H21V13Z\"/>";
@@ -1238,10 +1238,22 @@ export const icons = {
1238
1238
  box: 24,
1239
1239
  svg: `<path fill-rule="evenodd" clip-rule="evenodd" d="M17.4338 3C17.7851 3 18.1106 3.1843 18.2913 3.4855L20.8575 7.76249C20.9507 7.9179 21 8.09574 21 8.27698V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V8.27698C3 8.09574 3.04926 7.9179 3.14251 7.76249L5.7087 3.4855C5.88942 3.1843 6.21493 3 6.56619 3H17.4338ZM14.5 5H17.2L19 8H15.5L14.5 5ZM12.5 5H11.5L10.5 8V13H13.5V8L12.5 5ZM9.5 5H6.8L5 8H8.5L9.5 5ZM8.5 10H5V19H19V10H15.5V14C15.5 14.5523 15.0523 15 14.5 15H9.5C8.94772 15 8.5 14.5523 8.5 14V10Z"/>`,
1240
1240
  },
1241
- doors: {
1241
+ 'warehouse-doors': {
1242
1242
  box: 24,
1243
1243
  svg: `<path fill-rule="evenodd" clip-rule="evenodd" d="M12 4C19 4 22 8 22 8V9H20V20H4V9H2V8C2 8 5 4 12 4ZM12 6C8 6 6 8 6 8V18H8V13H11V18H13V13H16V18H18V8C18 8 16 6 12 6Z"/>`,
1244
1244
  },
1245
+ 'warehouse-doors-2': {
1246
+ box: 24,
1247
+ svg: `<path d="M12 3C19 3 22 7 22 7V8H20V20H18V19V7C18 7 16 5 12 5C8 5 6 7 6 7V19V20H4V8H2V7C2 7 5 3 12 3Z"/>
1248
+ <path d="M8 14H11V19H8V14Z"/>
1249
+ <path d="M13 14H16V19H13V14Z"/>`,
1250
+ },
1251
+ 'warehouse-doors-3': {
1252
+ box: 24,
1253
+ svg: `<path d="M2 8.62604L11.5263 3.12604C11.5263 3.12604 12.0088 2.84245 12.5 3.12604L22.0263 8.62604L21.0263 10.3581L20 9.76557V20H18V8.61086L12.0131 5.15435L6 8.62604V20H4V9.78074L3 10.3581L2 8.62604Z"/>
1254
+ <path d="M8 14H11V19H8V14Z"/>
1255
+ <path d="M13 14H16V19H13V14Z"/>`,
1256
+ },
1245
1257
  'door-groups': {
1246
1258
  box: 24,
1247
1259
  svg: `<path d="M13 21H11V13H5V21H3V11H13V21Z"/>
@@ -294,6 +294,34 @@ function onSlotMouseEnter(resourceId, slotIndex, e) {
294
294
  }
295
295
  dragEndSlotIndex = slotIndex;
296
296
  }
297
+ /** Builds a range selection spanning slots [startIdx, endIdx] inclusive. */
298
+ function buildSlotRange(resourceId, startIdx, endIdx) {
299
+ const startSlot = timeSlots[startIdx];
300
+ const endSlot = timeSlots[endIdx];
301
+ // eslint-disable-next-line svelte/prefer-svelte-reactivity
302
+ const start = new Date(selected);
303
+ start.setHours(startSlot.hour, startSlot.minute, 0, 0);
304
+ // eslint-disable-next-line svelte/prefer-svelte-reactivity
305
+ const end = new Date(selected);
306
+ // End slot is the start of the last selected slot; add one interval.
307
+ end.setHours(endSlot.hour, endSlot.minute + slotIntervalMinutes, 0, 0);
308
+ return {
309
+ resourceId,
310
+ start,
311
+ end
312
+ };
313
+ }
314
+ /**
315
+ * Double-clicking a single slot creates a one-interval range there. A single
316
+ * click is intentionally inert (see `onSlotMouseUp`): only a double-click or a
317
+ * multi-cell drag opens the consumer's range-select flow.
318
+ */
319
+ function onSlotDoubleClick(resourceId, slotIndex) {
320
+ if (!onrangeselect || isSlotUnavailable(resourceId, slotIndex)) {
321
+ return;
322
+ }
323
+ onrangeselect(buildSlotRange(resourceId, slotIndex, slotIndex));
324
+ }
297
325
  function onSlotMouseUp() {
298
326
  // ---- Handle event drag-move ----
299
327
  if (isDraggingEvent && draggedEvent && moveTargetResourceId != null && moveTargetSlotIndex != null) {
@@ -331,25 +359,20 @@ function onSlotMouseUp() {
331
359
  }
332
360
  const startIdx = Math.min(dragStartSlotIndex, dragEndSlotIndex);
333
361
  const endIdx = Math.max(dragStartSlotIndex, dragEndSlotIndex);
334
- const startSlot = timeSlots[startIdx];
335
- const endSlot = timeSlots[endIdx];
336
- // eslint-disable-next-line svelte/prefer-svelte-reactivity
337
- const start = new Date(selected);
338
- start.setHours(startSlot.hour, startSlot.minute, 0, 0);
339
- // eslint-disable-next-line svelte/prefer-svelte-reactivity
340
- const end = new Date(selected);
341
- // End slot is the start of the last selected slot; add one interval.
342
- end.setHours(endSlot.hour, endSlot.minute + slotIntervalMinutes, 0, 0);
343
- const selection = {
344
- resourceId: dragResourceId,
345
- start,
346
- end
347
- };
362
+ const resourceId = dragResourceId;
363
+ // Capture done; clear the drag state before any early return so it is
364
+ // never left stuck for the next interaction.
348
365
  isDragging = false;
349
366
  dragResourceId = null;
350
367
  dragStartSlotIndex = null;
351
368
  dragEndSlotIndex = null;
352
- onrangeselect?.(selection);
369
+ // A single-cell selection is a plain click - intentionally inert. Creating
370
+ // from one cell requires a double-click (onSlotDoubleClick); only a drag
371
+ // across multiple cells opens the range-select flow here.
372
+ if (startIdx === endIdx) {
373
+ return;
374
+ }
375
+ onrangeselect?.(buildSlotRange(resourceId, startIdx, endIdx));
353
376
  }
354
377
  function isSlotInDragRange(resourceId, slotIndex) {
355
378
  if (!isDragging || resourceId !== dragResourceId) {
@@ -697,6 +720,9 @@ $effect(() => {
697
720
  hoveredSlotIndex = slotIdx;
698
721
  onSlotMouseEnter(resource.id, slotIdx, e);
699
722
  }}
723
+ ondblclick={() => {
724
+ onSlotDoubleClick(resource.id, slotIdx);
725
+ }}
700
726
  ></div>
701
727
  {/each}
702
728
  <!-- Unavailable shading: one continuous block per contiguous run -->
@@ -961,8 +987,6 @@ $effect(() => {
961
987
  left: 2px;
962
988
  right: 2px;
963
989
  z-index: 5;
964
- border-radius: 4px;
965
- overflow: hidden;
966
990
  cursor: pointer;
967
991
  user-select: none;
968
992
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lavalogic/scoria",
3
3
  "description": "Svelte components used for the FloWMS Web Frontend",
4
- "version": "0.40.22",
4
+ "version": "0.40.25",
5
5
  "publishConfig": {
6
6
  "access": "restricted"
7
7
  },