@jcsoftdev/ui 0.7.1 → 0.9.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 (71) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/README.md +4 -0
  3. package/dist/atoms/elapsed-time/elapsed-time.d.ts +29 -0
  4. package/dist/atoms/elapsed-time/elapsed-time.js +65 -0
  5. package/dist/atoms/elapsed-time/index.d.ts +2 -0
  6. package/dist/atoms/elapsed-time/index.js +9 -0
  7. package/dist/atoms/elapsed-time/model.d.ts +17 -0
  8. package/dist/atoms/elapsed-time/model.js +37 -0
  9. package/dist/atoms/elapsed-time/ticker.d.ts +5 -0
  10. package/dist/atoms/elapsed-time/ticker.js +37 -0
  11. package/dist/atoms/index.d.ts +2 -0
  12. package/dist/atoms/index.js +2 -0
  13. package/dist/atoms/table-glyph/index.d.ts +2 -0
  14. package/dist/atoms/table-glyph/index.js +14 -0
  15. package/dist/atoms/table-glyph/layout.d.ts +38 -0
  16. package/dist/atoms/table-glyph/layout.js +152 -0
  17. package/dist/atoms/table-glyph/table-glyph.d.ts +32 -0
  18. package/dist/atoms/table-glyph/table-glyph.js +131 -0
  19. package/dist/containers/floor-plan/edit-model.d.ts +33 -0
  20. package/dist/containers/floor-plan/edit-model.js +82 -0
  21. package/dist/containers/floor-plan/floor-plan.d.ts +83 -0
  22. package/dist/containers/floor-plan/floor-plan.js +278 -0
  23. package/dist/containers/floor-plan/index.d.ts +3 -0
  24. package/dist/containers/floor-plan/index.js +21 -0
  25. package/dist/containers/floor-plan/model.d.ts +36 -0
  26. package/dist/containers/floor-plan/model.js +52 -0
  27. package/dist/containers/floor-plan/use-floor-plan-edit.d.ts +26 -0
  28. package/dist/containers/floor-plan/use-floor-plan-edit.js +97 -0
  29. package/dist/containers/index.d.ts +2 -0
  30. package/dist/containers/index.js +2 -0
  31. package/dist/containers/order-ticket/index.d.ts +2 -0
  32. package/dist/containers/order-ticket/index.js +16 -0
  33. package/dist/containers/order-ticket/model.d.ts +18 -0
  34. package/dist/containers/order-ticket/model.js +36 -0
  35. package/dist/containers/order-ticket/order-ticket.d.ts +34 -0
  36. package/dist/containers/order-ticket/order-ticket.js +390 -0
  37. package/dist/glass/crystal-map.d.ts +3 -1
  38. package/dist/glass/crystal-map.js +13 -2
  39. package/dist/i18n/strings.d.ts +104 -0
  40. package/dist/i18n/strings.js +62 -0
  41. package/dist/icons/alarm-clock.d.ts +2 -0
  42. package/dist/icons/alarm-clock.js +15 -0
  43. package/dist/icons/hourglass.d.ts +2 -0
  44. package/dist/icons/hourglass.js +13 -0
  45. package/dist/icons/index.d.ts +2 -0
  46. package/dist/icons/index.js +4 -0
  47. package/icons/svg/alarm-clock.svg +8 -0
  48. package/icons/svg/hourglass.svg +6 -0
  49. package/package.json +2 -2
  50. package/src/atoms/elapsed-time/elapsed-time.tsx +101 -0
  51. package/src/atoms/elapsed-time/index.ts +6 -0
  52. package/src/atoms/elapsed-time/model.ts +54 -0
  53. package/src/atoms/elapsed-time/ticker.ts +39 -0
  54. package/src/atoms/index.ts +2 -0
  55. package/src/atoms/table-glyph/index.ts +14 -0
  56. package/src/atoms/table-glyph/layout.ts +187 -0
  57. package/src/atoms/table-glyph/table-glyph.tsx +161 -0
  58. package/src/containers/floor-plan/edit-model.ts +115 -0
  59. package/src/containers/floor-plan/floor-plan.tsx +393 -0
  60. package/src/containers/floor-plan/index.ts +20 -0
  61. package/src/containers/floor-plan/model.ts +81 -0
  62. package/src/containers/floor-plan/use-floor-plan-edit.ts +135 -0
  63. package/src/containers/index.ts +2 -0
  64. package/src/containers/order-ticket/index.ts +15 -0
  65. package/src/containers/order-ticket/model.ts +55 -0
  66. package/src/containers/order-ticket/order-ticket.tsx +463 -0
  67. package/src/glass/crystal-map.ts +21 -3
  68. package/src/i18n/strings.ts +104 -0
  69. package/src/icons/alarm-clock.tsx +16 -0
  70. package/src/icons/hourglass.tsx +14 -0
  71. package/src/icons/index.ts +2 -0
@@ -61,7 +61,9 @@ export interface CrystalMapOptions {
61
61
  * Margin past each side of the surface, in px (default: `margin` on all four). A surface inside
62
62
  * a clipping ancestor (an `overflow` or `clip-path` stage) only has the backdrop within it: a
63
63
  * layer that reaches past the clip is cut by the browser and its filter is shifted, so the map
64
- * covers only the backdrop that exists, and the offsets are clamped so no sample lands beyond it.
64
+ * covers only the backdrop that exists. A side with less room than the margin scales its offsets
65
+ * down so its silhouette still samples inside the room, eased across the surface; the hard clamp
66
+ * that remains only bites in the margin, which the layer clips away.
65
67
  */
66
68
  room?: Partial<Record<"left" | "right" | "top" | "bottom", number>>;
67
69
  /** Largest factor the offset is multiplied by (chromatic dispersion pulls red this much further). Default 1. */
@@ -112,17 +114,33 @@ export function computeCrystalField({
112
114
  const [minY, maxY] = [-hy - top + slack, hy + bottom - slack];
113
115
  const unit = Math.max(amplitude, 1e-6);
114
116
  const f = Math.max(reach, 1);
117
+ // Share of the offset a side keeps so its silhouette, where the offset peaks at `amplitude
118
+ // extent / half`, still samples inside the room. A side with the whole margin keeps all of it.
119
+ const keep = (free: number, extent: number) =>
120
+ free >= m ? 1 : clamp((free - EDGE_SLACK) / Math.max((f * unit * extent) / half, 1e-6), 0, 1);
121
+ const shares = {
122
+ x: [keep(left, hx), keep(right, hx)],
123
+ y: [keep(top, hy), keep(bottom, hy)],
124
+ } as const;
125
+ // Eased from one side's share to the other across the surface, so the lens bends less towards
126
+ // a short side without a crease down the middle (a hard per-side switch would put one there).
127
+ const share = ([low, high]: readonly [number, number], p: number, extent: number) => {
128
+ const u = clamp((p + extent) / (2 * extent), 0, 1);
129
+ return low + (high - low) * u * u * (3 - 2 * u);
130
+ };
115
131
  // Offset (as a fraction of `amplitude`, what the channel encodes) that keeps the source in the room.
116
132
  const within = (p: number, offset: number, lo: number, hi: number) =>
117
133
  clamp((bounded ? clamp(offset, (lo - p) / f, (hi - p) / f) : offset) / unit, -1, 1);
118
134
  for (let j = 0; j < ph; j++) {
119
135
  const py = (j + 0.5) / ry - top - hy;
136
+ const ky = share(shares.y, py, hy);
120
137
  for (let i = 0; i < pw; i++) {
121
138
  const px = (i + 0.5) / rx - left - hx;
139
+ const kx = share(shares.x, px, hx);
122
140
  const s = crystalShape(crystalRadius(px, py, hx, hy));
123
141
  const o = (j * pw + i) * 4;
124
- data[o] = 128 + within(px, (s * px * amplitude) / half, minX, maxX) * 127;
125
- data[o + 1] = 128 + within(py, (s * py * amplitude) / half, minY, maxY) * 127;
142
+ data[o] = 128 + within(px, ((s * px * amplitude) / half) * kx, minX, maxX) * 127;
143
+ data[o + 1] = 128 + within(py, ((s * py * amplitude) / half) * ky, minY, maxY) * 127;
126
144
  data[o + 2] = 255;
127
145
  data[o + 3] = 255;
128
146
  }
@@ -22,6 +22,48 @@ export interface UiStrings {
22
22
  more: string;
23
23
  /** Accessible total on the bottom bar "More" button; `{count}` is replaced. */
24
24
  morePending: string;
25
+ /** Accessible text of an `ElapsedTime` at exactly one minute; `{count}` is replaced. */
26
+ elapsedMinutesOne: string;
27
+ /** Accessible text of an `ElapsedTime`; `{count}` is replaced. */
28
+ elapsedMinutes: string;
29
+ /** Visible text of an `ElapsedTime` with `format="minutes"`; `{count}` is replaced. */
30
+ minutesShort: string;
31
+ /** Accessible text of a countdown `ElapsedTime`; `{time}` is the remaining time. */
32
+ countdownLeft: string;
33
+ /** Accessible text of a countdown `ElapsedTime` past its target; `{time}` is the overrun. */
34
+ countdownOver: string;
35
+ /** Seat count of a floor plan table; `{count}` is replaced. */
36
+ seats: string;
37
+ /** Seat count of a one-seat floor plan table; `{count}` is replaced. */
38
+ seatsOne: string;
39
+ /** Screen-reader state of a floor plan item ringed as late. */
40
+ late: string;
41
+ /** Default accessible name of a `FloorPlan`. */
42
+ floorPlan: string;
43
+ /** Accessible name of the rotate button of an editable `FloorPlan` item. */
44
+ rotate: string;
45
+ /** Keyboard help of an editable `FloorPlan`. */
46
+ floorPlanEditHint: string;
47
+ orderTicketNumber: string;
48
+ orderTicketGuests: string;
49
+ orderTicketGuestsOne: string;
50
+ orderTicketPart: string;
51
+ orderTicketContinued: string;
52
+ orderTicketOnTime: string;
53
+ orderTicketDueSoon: string;
54
+ orderTicketLate: string;
55
+ orderTicketLateBy: string;
56
+ orderTicketProgress: string;
57
+ orderTicketProgressValue: string;
58
+ orderTicketItems: string;
59
+ orderTicketPending: string;
60
+ orderTicketInProgress: string;
61
+ orderTicketDone: string;
62
+ orderTicketNote: string;
63
+ orderTicketAllergy: string;
64
+ orderTicketRecovered: string;
65
+ orderTicketStartAll: string;
66
+ orderTicketReadyAll: string;
25
67
  remove: string;
26
68
  noResults: string;
27
69
  clear: string;
@@ -162,6 +204,37 @@ export const uiStrings = {
162
204
  copied: "Copied",
163
205
  more: "More",
164
206
  morePending: "{count} pending",
207
+ elapsedMinutesOne: "{count} minute",
208
+ elapsedMinutes: "{count} minutes",
209
+ minutesShort: "{count} min",
210
+ countdownLeft: "{time} left",
211
+ countdownOver: "{time} over",
212
+ seats: "{count} seats",
213
+ seatsOne: "{count} seat",
214
+ late: "Late",
215
+ floorPlan: "Floor plan",
216
+ rotate: "Rotate 90°",
217
+ floorPlanEditHint: "Alt with arrows moves, Alt and Shift with arrows resizes, R rotates.",
218
+ orderTicketNumber: "No. {number}",
219
+ orderTicketGuests: "{count} guests",
220
+ orderTicketGuestsOne: "{count} guest",
221
+ orderTicketPart: "({index} of {count})",
222
+ orderTicketContinued: "(cont.)",
223
+ orderTicketOnTime: "on time",
224
+ orderTicketDueSoon: "due soon",
225
+ orderTicketLate: "late",
226
+ orderTicketLateBy: "Late +{time}",
227
+ orderTicketProgress: "Time against the {target} min target",
228
+ orderTicketProgressValue: "{elapsed} of {target} min",
229
+ orderTicketItems: "Items",
230
+ orderTicketPending: "Queued",
231
+ orderTicketInProgress: "Preparing",
232
+ orderTicketDone: "Ready",
233
+ orderTicketNote: "Note: {note}",
234
+ orderTicketAllergy: "Allergy: {allergy}",
235
+ orderTicketRecovered: "Recalled",
236
+ orderTicketStartAll: "Start all",
237
+ orderTicketReadyAll: "All ready",
165
238
  remove: "Remove",
166
239
  noResults: "No results",
167
240
  clear: "Clear",
@@ -252,6 +325,37 @@ export const uiStrings = {
252
325
  copied: "Copiado",
253
326
  more: "Más",
254
327
  morePending: "{count} pendientes",
328
+ elapsedMinutesOne: "{count} minuto",
329
+ elapsedMinutes: "{count} minutos",
330
+ minutesShort: "{count} min",
331
+ countdownLeft: "faltan {time}",
332
+ countdownOver: "{time} de retraso",
333
+ seats: "{count} asientos",
334
+ seatsOne: "{count} asiento",
335
+ late: "Con retraso",
336
+ floorPlan: "Plano de sala",
337
+ rotate: "Girar 90°",
338
+ floorPlanEditHint: "Alt con flechas mueve, Alt y Mayús con flechas cambia el tamaño, R gira.",
339
+ orderTicketNumber: "N.º {number}",
340
+ orderTicketGuests: "{count} personas",
341
+ orderTicketGuestsOne: "{count} persona",
342
+ orderTicketPart: "({index} de {count})",
343
+ orderTicketContinued: "(cont.)",
344
+ orderTicketOnTime: "a tiempo",
345
+ orderTicketDueSoon: "por vencer",
346
+ orderTicketLate: "demorada",
347
+ orderTicketLateBy: "Demorada +{time}",
348
+ orderTicketProgress: "Tiempo contra los {target} min objetivo",
349
+ orderTicketProgressValue: "{elapsed} de {target} min",
350
+ orderTicketItems: "Platos",
351
+ orderTicketPending: "En cola",
352
+ orderTicketInProgress: "Preparando",
353
+ orderTicketDone: "Listo",
354
+ orderTicketNote: "Nota: {note}",
355
+ orderTicketAllergy: "Alergia: {allergy}",
356
+ orderTicketRecovered: "Recuperada",
357
+ orderTicketStartAll: "Empezar todo",
358
+ orderTicketReadyAll: "Listo todo",
255
359
  remove: "Quitar",
256
360
  noResults: "Sin resultados",
257
361
  clear: "Limpiar",
@@ -0,0 +1,16 @@
1
+ // Generated by scripts/build-icons.mjs. Do not edit.
2
+ // Source: icons/svg/alarm-clock.svg
3
+ import { IconBase, type IconProps } from "./icon-base.js";
4
+
5
+ export function AlarmClock(props: IconProps) {
6
+ return (
7
+ <IconBase {...props}>
8
+ <circle cx="12" cy="13" r="8" />
9
+ <path d="M12 9v4l2 2" />
10
+ <path d="M5 3 2 6" />
11
+ <path d="m22 6-3-3" />
12
+ <path d="M6.38 18.7 4 21" />
13
+ <path d="M17.64 18.67 20 21" />
14
+ </IconBase>
15
+ );
16
+ }
@@ -0,0 +1,14 @@
1
+ // Generated by scripts/build-icons.mjs. Do not edit.
2
+ // Source: icons/svg/hourglass.svg
3
+ import { IconBase, type IconProps } from "./icon-base.js";
4
+
5
+ export function Hourglass(props: IconProps) {
6
+ return (
7
+ <IconBase {...props}>
8
+ <path d="M5 22h14" />
9
+ <path d="M5 2h14" />
10
+ <path d="M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22" />
11
+ <path d="M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2" />
12
+ </IconBase>
13
+ );
14
+ }
@@ -1,5 +1,6 @@
1
1
  // Generated by scripts/build-icons.mjs. Do not edit.
2
2
  export { type IconComponent, type IconProps, type LucideIcon } from "./icon-base.js";
3
+ export { AlarmClock } from "./alarm-clock.js";
3
4
  export { AlertTriangle } from "./alert-triangle.js";
4
5
  export { Archive } from "./archive.js";
5
6
  export { Armchair } from "./armchair.js";
@@ -70,6 +71,7 @@ export { Funnel } from "./funnel.js";
70
71
  export { GraduationCap } from "./graduation-cap.js";
71
72
  export { GripVertical } from "./grip-vertical.js";
72
73
  export { Heading2 } from "./heading-2.js";
74
+ export { Hourglass } from "./hourglass.js";
73
75
  export { House } from "./house.js";
74
76
  export { Inbox } from "./inbox.js";
75
77
  export { Info } from "./info.js";