@dryui/feedback 0.0.2

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 (79) hide show
  1. package/dist/components/annotation-marker.svelte +163 -0
  2. package/dist/components/annotation-marker.svelte.d.ts +11 -0
  3. package/dist/components/annotation-popup.svelte +669 -0
  4. package/dist/components/annotation-popup.svelte.d.ts +42 -0
  5. package/dist/components/highlight-overlay.svelte +48 -0
  6. package/dist/components/highlight-overlay.svelte.d.ts +8 -0
  7. package/dist/components/settings-panel.svelte +446 -0
  8. package/dist/components/settings-panel.svelte.d.ts +24 -0
  9. package/dist/components/toolbar.svelte +1111 -0
  10. package/dist/components/toolbar.svelte.d.ts +46 -0
  11. package/dist/constants.d.ts +9 -0
  12. package/dist/constants.js +37 -0
  13. package/dist/feedback.svelte +2879 -0
  14. package/dist/feedback.svelte.d.ts +4 -0
  15. package/dist/index.d.ts +10 -0
  16. package/dist/index.js +7 -0
  17. package/dist/layout-mode/catalog.d.ts +16 -0
  18. package/dist/layout-mode/catalog.js +81 -0
  19. package/dist/layout-mode/component-actions.svelte +84 -0
  20. package/dist/layout-mode/component-actions.svelte.d.ts +18 -0
  21. package/dist/layout-mode/component-picker.svelte +73 -0
  22. package/dist/layout-mode/component-picker.svelte.d.ts +10 -0
  23. package/dist/layout-mode/design-mode.svelte +1115 -0
  24. package/dist/layout-mode/design-mode.svelte.d.ts +24 -0
  25. package/dist/layout-mode/design-palette.svelte +396 -0
  26. package/dist/layout-mode/design-palette.svelte.d.ts +20 -0
  27. package/dist/layout-mode/element-heuristics.d.ts +5 -0
  28. package/dist/layout-mode/element-heuristics.js +51 -0
  29. package/dist/layout-mode/freeze.d.ts +6 -0
  30. package/dist/layout-mode/freeze.js +163 -0
  31. package/dist/layout-mode/generated-library.d.ts +940 -0
  32. package/dist/layout-mode/generated-library.js +1445 -0
  33. package/dist/layout-mode/geometry.d.ts +38 -0
  34. package/dist/layout-mode/geometry.js +133 -0
  35. package/dist/layout-mode/history.d.ts +10 -0
  36. package/dist/layout-mode/history.js +45 -0
  37. package/dist/layout-mode/index.d.ts +23 -0
  38. package/dist/layout-mode/index.js +18 -0
  39. package/dist/layout-mode/live-mount.d.ts +20 -0
  40. package/dist/layout-mode/live-mount.js +70 -0
  41. package/dist/layout-mode/output.d.ts +26 -0
  42. package/dist/layout-mode/output.js +550 -0
  43. package/dist/layout-mode/placement-skeleton.d.ts +9 -0
  44. package/dist/layout-mode/placement-skeleton.js +535 -0
  45. package/dist/layout-mode/rearrange-overlay.svelte +1293 -0
  46. package/dist/layout-mode/rearrange-overlay.svelte.d.ts +18 -0
  47. package/dist/layout-mode/responsive-bar.svelte +39 -0
  48. package/dist/layout-mode/responsive-bar.svelte.d.ts +8 -0
  49. package/dist/layout-mode/route-creator.svelte +70 -0
  50. package/dist/layout-mode/route-creator.svelte.d.ts +8 -0
  51. package/dist/layout-mode/section-detection.d.ts +6 -0
  52. package/dist/layout-mode/section-detection.js +214 -0
  53. package/dist/layout-mode/spatial.d.ts +42 -0
  54. package/dist/layout-mode/spatial.js +156 -0
  55. package/dist/layout-mode/types.d.ts +144 -0
  56. package/dist/layout-mode/types.js +84 -0
  57. package/dist/types.d.ts +157 -0
  58. package/dist/types.js +1 -0
  59. package/dist/utils/dryui-detection.d.ts +1 -0
  60. package/dist/utils/dryui-detection.js +219 -0
  61. package/dist/utils/element-id.d.ts +12 -0
  62. package/dist/utils/element-id.js +333 -0
  63. package/dist/utils/freeze.d.ts +7 -0
  64. package/dist/utils/freeze.js +168 -0
  65. package/dist/utils/output.d.ts +15 -0
  66. package/dist/utils/output.js +245 -0
  67. package/dist/utils/selection.d.ts +22 -0
  68. package/dist/utils/selection.js +58 -0
  69. package/dist/utils/shadow-dom.d.ts +4 -0
  70. package/dist/utils/shadow-dom.js +39 -0
  71. package/dist/utils/storage.d.ts +30 -0
  72. package/dist/utils/storage.js +206 -0
  73. package/dist/utils/svelte-detection.d.ts +8 -0
  74. package/dist/utils/svelte-detection.js +86 -0
  75. package/dist/utils/svelte-meta.d.ts +6 -0
  76. package/dist/utils/svelte-meta.js +69 -0
  77. package/dist/utils/sync.d.ts +18 -0
  78. package/dist/utils/sync.js +62 -0
  79. package/package.json +65 -0
@@ -0,0 +1,163 @@
1
+ <script lang="ts">
2
+ import { Badge } from '@dryui/ui/badge';
3
+ import { Button } from '@dryui/ui/button';
4
+ import { ProgressRing } from '@dryui/ui/progress-ring';
5
+ import { Tooltip } from '@dryui/ui/tooltip';
6
+ import type { Annotation } from '../types.js';
7
+
8
+ interface Props {
9
+ annotation: Annotation;
10
+ index: number;
11
+ onclick?: (annotation: Annotation) => void;
12
+ onmouseenter?: (annotation: Annotation) => void;
13
+ onmouseleave?: () => void;
14
+ }
15
+
16
+ let { annotation, index, onclick, onmouseenter, onmouseleave }: Props = $props();
17
+
18
+ function markerColor(color: Annotation['color']): string {
19
+ switch (color) {
20
+ case 'info':
21
+ return 'var(--dry-color-fill-info, #0ea5e9)';
22
+ case 'success':
23
+ return 'var(--dry-color-fill-success, #16a34a)';
24
+ case 'warning':
25
+ return 'var(--dry-color-fill-warning, #d97706)';
26
+ case 'error':
27
+ return 'var(--dry-color-fill-error, #dc2626)';
28
+ case 'neutral':
29
+ return 'var(--dry-color-fill, #6b7280)';
30
+ case 'brand':
31
+ default:
32
+ return 'var(--dry-color-fill-brand, #4f46e5)';
33
+ }
34
+ }
35
+
36
+ const status = $derived(annotation.status ?? 'pending');
37
+ const isResolved = $derived(status === 'resolved');
38
+ const isDismissed = $derived(status === 'dismissed');
39
+ const isWorking = $derived(status === 'acknowledged');
40
+ const isFailed = $derived(status === 'failed');
41
+
42
+ const bg = $derived(
43
+ isResolved
44
+ ? 'var(--dry-color-fill-success, #16a34a)'
45
+ : isFailed
46
+ ? 'var(--dry-color-fill-error, #dc2626)'
47
+ : isDismissed
48
+ ? 'var(--dry-color-fill, #6b7280)'
49
+ : markerColor(annotation.color),
50
+ );
51
+
52
+ const tooltip = $derived(
53
+ `${annotation.element}${annotation.comment ? `: ${annotation.comment}` : ''}`,
54
+ );
55
+
56
+ function handleClick(event: MouseEvent) {
57
+ event.stopPropagation();
58
+ onclick?.(annotation);
59
+ }
60
+
61
+ function handleMouseEnter() {
62
+ onmouseenter?.(annotation);
63
+ }
64
+ </script>
65
+
66
+ <div
67
+ data-dryui-feedback
68
+ style="
69
+ position: {annotation.isFixed ? 'fixed' : 'absolute'};
70
+ left: {annotation.x}%;
71
+ top: {Math.max(12, annotation.y)}px;
72
+ z-index: 10000;
73
+ transform: translate(-50%, -50%);
74
+ display: grid;
75
+ place-items: center;
76
+ width: 34px;
77
+ height: 34px;
78
+ "
79
+ >
80
+ {#if isWorking}
81
+ <div style="position: absolute; inset: 0; pointer-events: none; display: grid; place-items: center;">
82
+ <ProgressRing
83
+ indeterminate
84
+ size={34}
85
+ strokeWidth={2.5}
86
+ color="yellow"
87
+ style="--dry-progress-ring-indeterminate-speed: 1.2s;"
88
+ />
89
+ </div>
90
+ {:else if isResolved}
91
+ <div style="position: absolute; inset: 0; pointer-events: none; display: grid; place-items: center;">
92
+ <ProgressRing value={100} max={100} size={34} strokeWidth={2.5} color="green" />
93
+ </div>
94
+ {:else if isFailed}
95
+ <div style="position: absolute; inset: 0; pointer-events: none; display: grid; place-items: center;">
96
+ <ProgressRing value={100} max={100} size={34} strokeWidth={2.5} color="red" />
97
+ </div>
98
+ {/if}
99
+
100
+ <Tooltip.Root openDelay={200}>
101
+ <Tooltip.Trigger>
102
+ <Button
103
+ size="icon-sm"
104
+ variant="solid"
105
+ data-feedback-marker
106
+ data-dryui-feedback
107
+ data-feedback-marker-color={annotation.color}
108
+ data-status={status}
109
+ aria-label={`${annotation.element}. ${annotation.comment || 'Open annotation'}`}
110
+ aria-pressed={isResolved}
111
+ onclick={handleClick}
112
+ onmouseenter={handleMouseEnter}
113
+ onmouseleave={onmouseleave}
114
+ style="
115
+ --dry-btn-bg: {bg};
116
+ --dry-btn-border: var(--dry-color-bg-base, #fff);
117
+ --dry-btn-color: var(--dry-color-on-brand, #fff);
118
+ --dry-btn-radius: var(--dry-radius-full, 9999px);
119
+ --dry-btn-accent: {bg};
120
+ --dry-btn-accent-hover: {bg};
121
+ --dry-btn-accent-active: {bg};
122
+ width: 24px;
123
+ height: 24px;
124
+ min-width: 24px;
125
+ min-height: 24px;
126
+ border-width: 2px;
127
+ font-size: 11px;
128
+ font-weight: 600;
129
+ opacity: {isDismissed ? '0.4' : '1'};
130
+ "
131
+ >
132
+ {#if isResolved}
133
+ <svg width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true">
134
+ <path d="M2.5 6L5 8.5L9.5 3.5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
135
+ </svg>
136
+ {:else if isFailed}
137
+ !
138
+ {:else}
139
+ {index}
140
+ {/if}
141
+ </Button>
142
+ </Tooltip.Trigger>
143
+ <Tooltip.Content>
144
+ {tooltip}
145
+ {#if isResolved}
146
+ <div>Resolved</div>
147
+ {:else if isWorking}
148
+ <div>In progress</div>
149
+ {:else if isDismissed}
150
+ <div>Dismissed</div>
151
+ {/if}
152
+ </Tooltip.Content>
153
+ </Tooltip.Root>
154
+
155
+ {#if status === 'pending'}
156
+ <Badge
157
+ variant="dot"
158
+ pulse
159
+ color="info"
160
+ style="position: absolute; top: -1px; right: -1px; pointer-events: none;"
161
+ />
162
+ {/if}
163
+ </div>
@@ -0,0 +1,11 @@
1
+ import type { Annotation } from '../types.js';
2
+ interface Props {
3
+ annotation: Annotation;
4
+ index: number;
5
+ onclick?: (annotation: Annotation) => void;
6
+ onmouseenter?: (annotation: Annotation) => void;
7
+ onmouseleave?: () => void;
8
+ }
9
+ declare const AnnotationMarker: import("svelte").Component<Props, {}, "">;
10
+ type AnnotationMarker = ReturnType<typeof AnnotationMarker>;
11
+ export default AnnotationMarker;