@drawback/ui 0.1.0 → 0.2.0-rc.20261201112126

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.
@@ -200,9 +200,9 @@ function dropLayer(editor: AnyEditor, id: LayerId, target: TreeRow, zone: DropZo
200
200
 
201
201
  /** A small label next to the cursor instead of the browser's snapshot of the whole row. */
202
202
  function setDragBadge(event: DragEvent<HTMLElement>, label: string): void {
203
- const host = event.currentTarget.closest('.nx-layers') ?? event.currentTarget.ownerDocument.body;
203
+ const host = event.currentTarget.closest('.db-layers') ?? event.currentTarget.ownerDocument.body;
204
204
  const badge = event.currentTarget.ownerDocument.createElement('div');
205
- badge.className = 'nx-drag-badge';
205
+ badge.className = 'db-drag-badge';
206
206
  badge.textContent = label;
207
207
  host.appendChild(badge);
208
208
  event.dataTransfer.setDragImage(badge, -12, -8);
@@ -243,10 +243,10 @@ function Thumbnail({ id }: { readonly id: ElementId }): ReactNode {
243
243
  }, [view, id, revision]);
244
244
 
245
245
  return url === undefined ? (
246
- <span className="nx-thumb" />
246
+ <span className="db-thumb" />
247
247
  ) : (
248
248
  <img
249
- className="nx-thumb"
249
+ className="db-thumb"
250
250
  src={url}
251
251
  alt=""
252
252
  />
@@ -542,11 +542,11 @@ export function LayersPanel({ thumbnails = false, onClose }: LayersPanelProps):
542
542
  'data-testid': `layer-row-${row.kind}-${row.record.id}`,
543
543
  })}
544
544
  className={cx(
545
- 'nx-row-item',
546
- `nx-row-${row.kind}`,
547
- isSelected && 'nx-selected',
548
- isHiddenRow(row) && 'nx-dimmed',
549
- drop?.key === row.key && `nx-drop-${drop.zone}`,
545
+ 'db-row-item',
546
+ `db-row-${row.kind}`,
547
+ isSelected && 'db-selected',
548
+ isHiddenRow(row) && 'db-dimmed',
549
+ drop?.key === row.key && `db-drop-${drop.zone}`,
550
550
  )}
551
551
  style={{
552
552
  position: 'absolute',
@@ -555,7 +555,7 @@ export function LayersPanel({ thumbnails = false, onClose }: LayersPanelProps):
555
555
  left: 0,
556
556
  right: 0,
557
557
  paddingInlineStart: ROW_PADDING + row.depth * INDENT,
558
- ['--nx-row-indent' as string]: `${ROW_PADDING + row.depth * INDENT}px`,
558
+ ['--db-row-indent' as string]: `${ROW_PADDING + row.depth * INDENT}px`,
559
559
  }}
560
560
  title={
561
561
  reorderable
@@ -617,12 +617,12 @@ export function LayersPanel({ thumbnails = false, onClose }: LayersPanelProps):
617
617
  key={level}
618
618
  aria-hidden="true"
619
619
  className={cx(
620
- 'nx-tree-guide',
620
+ 'db-tree-guide',
621
621
  guide !== undefined &&
622
622
  guide.level === level &&
623
623
  index >= guide.start &&
624
624
  index < guide.end &&
625
- 'nx-active',
625
+ 'db-active',
626
626
  )}
627
627
  style={{ insetInlineStart: ROW_PADDING + level * INDENT + TOGGLE_SIZE / 2 }}
628
628
  />
@@ -630,7 +630,7 @@ export function LayersPanel({ thumbnails = false, onClose }: LayersPanelProps):
630
630
  {row.expandable ? (
631
631
  <button
632
632
  type="button"
633
- className="nx-tree-toggle"
633
+ className="db-tree-toggle"
634
634
  tabIndex={-1}
635
635
  aria-label={row.expanded ? t('layers.collapse') : t('layers.expand')}
636
636
  onClick={(event) => {
@@ -641,7 +641,7 @@ export function LayersPanel({ thumbnails = false, onClose }: LayersPanelProps):
641
641
  <Icon name={row.expanded ? 'collapse' : 'expand'} />
642
642
  </button>
643
643
  ) : (
644
- <span className="nx-tree-toggle" />
644
+ <span className="db-tree-toggle" />
645
645
  )}
646
646
  {row.kind === 'element' && thumbnails ? (
647
647
  <Thumbnail id={row.record.id} />
@@ -652,7 +652,7 @@ export function LayersPanel({ thumbnails = false, onClose }: LayersPanelProps):
652
652
  )}
653
653
  {editing === row.key ? (
654
654
  <input
655
- className="nx-rename"
655
+ className="db-rename"
656
656
  defaultValue={name}
657
657
  aria-label={t('layers.rename')}
658
658
  autoFocus
@@ -673,10 +673,10 @@ export function LayersPanel({ thumbnails = false, onClose }: LayersPanelProps):
673
673
  }}
674
674
  />
675
675
  ) : (
676
- <span className="nx-row-name">{name}</span>
676
+ <span className="db-row-name">{name}</span>
677
677
  )}
678
678
  <span
679
- className="nx-row-actions"
679
+ className="db-row-actions"
680
680
  onClick={(event) => event.stopPropagation()}
681
681
  onDoubleClick={(event) => event.stopPropagation()}
682
682
  >
@@ -686,7 +686,7 @@ export function LayersPanel({ thumbnails = false, onClose }: LayersPanelProps):
686
686
  label={isHiddenRow(row) ? t('layers.show') : t('layers.hide')}
687
687
  disabled={!lockable}
688
688
  onClick={() => toggleVisible(editor, row)}
689
- className="nx-row-action"
689
+ className="db-row-action"
690
690
  tabIndex={-1}
691
691
  testId={`layer-visibility-${row.record.id}`}
692
692
  />
@@ -696,7 +696,7 @@ export function LayersPanel({ thumbnails = false, onClose }: LayersPanelProps):
696
696
  label={isLocked(row) ? t('layers.unlock') : t('layers.lock')}
697
697
  disabled={!lockable}
698
698
  onClick={() => toggleLocked(editor, row)}
699
- className={cx('nx-row-action', isLocked(row) && 'nx-on')}
699
+ className={cx('db-row-action', isLocked(row) && 'db-on')}
700
700
  tabIndex={-1}
701
701
  testId={`layer-lock-${row.record.id}`}
702
702
  />
@@ -714,11 +714,11 @@ export function LayersPanel({ thumbnails = false, onClose }: LayersPanelProps):
714
714
 
715
715
  return (
716
716
  <Island
717
- className="nx-layers"
717
+ className="db-layers"
718
718
  label={t('layers.label')}
719
719
  testId="layers-panel"
720
720
  >
721
- <header className="nx-panel-header">
721
+ <header className="db-panel-header">
722
722
  <h2>{t('layers.label')}</h2>
723
723
  {!isHidden('layers:add') && (
724
724
  <IconButton
@@ -738,7 +738,7 @@ export function LayersPanel({ thumbnails = false, onClose }: LayersPanelProps):
738
738
  />
739
739
  )}
740
740
  </header>
741
- <label className="nx-search">
741
+ <label className="db-search">
742
742
  <Icon name="search" />
743
743
  <input
744
744
  type="search"
@@ -751,7 +751,7 @@ export function LayersPanel({ thumbnails = false, onClose }: LayersPanelProps):
751
751
  </label>
752
752
  <div
753
753
  ref={listRef}
754
- className="nx-tree"
754
+ className="db-tree"
755
755
  role="tree"
756
756
  aria-label={t('layers.label')}
757
757
  aria-multiselectable="true"
@@ -805,18 +805,18 @@ export function LayersPanel({ thumbnails = false, onClose }: LayersPanelProps):
805
805
  }}
806
806
  >
807
807
  {rows.length === 0 && (
808
- <p className="nx-caption">{query === '' ? t('layers.empty') : t('layers.noMatches')}</p>
808
+ <p className="db-caption">{query === '' ? t('layers.empty') : t('layers.noMatches')}</p>
809
809
  )}
810
810
  {sticky.length > 0 && (
811
- <div className="nx-tree-pinned">
811
+ <div className="db-tree-pinned">
812
812
  {sticky.map((entry, position) => {
813
813
  const row = rows[entry.index];
814
814
  return row === undefined ? null : (
815
815
  <div
816
816
  key={row.key}
817
817
  className={cx(
818
- 'nx-pinned-row',
819
- position === sticky.length - 1 && 'nx-pinned-last',
818
+ 'db-pinned-row',
819
+ position === sticky.length - 1 && 'db-pinned-last',
820
820
  )}
821
821
  style={{ top: entry.top, height: ROW_STRIDE, zIndex: sticky.length - position }}
822
822
  >
@@ -844,10 +844,10 @@ export function LayersPanel({ thumbnails = false, onClose }: LayersPanelProps):
844
844
  )}
845
845
  {drop?.key === END_KEY && (
846
846
  <div
847
- className="nx-drop-end nx-drop-below"
847
+ className="db-drop-end db-drop-below"
848
848
  style={{
849
849
  top: TREE_PADDING + rows.length * ROW_STRIDE - ROW_GAP,
850
- ['--nx-row-indent' as string]: `${ROW_PADDING}px`,
850
+ ['--db-row-indent' as string]: `${ROW_PADDING}px`,
851
851
  }}
852
852
  />
853
853
  )}
@@ -61,7 +61,7 @@ function LinkInput({
61
61
  type="text"
62
62
  // oxlint-disable-next-line jsx-a11y/no-autofocus -- the editor opens on an explicit request.
63
63
  autoFocus
64
- className={cx('nx-link-input', error && 'nx-invalid')}
64
+ className={cx('db-link-input', error && 'db-invalid')}
65
65
  value={draft}
66
66
  placeholder={t('link.placeholder')}
67
67
  aria-label={t('link.label')}
@@ -94,7 +94,7 @@ function LinkInput({
94
94
  />
95
95
  {error && (
96
96
  <p
97
- className="nx-link-error"
97
+ className="db-link-error"
98
98
  role="alert"
99
99
  >
100
100
  {t('link.invalid')}
@@ -201,7 +201,7 @@ export function LinkEditor(): ReactNode {
201
201
  return (
202
202
  <div
203
203
  ref={ref}
204
- className="nx-link-popover nx-island"
204
+ className="db-link-popover db-island"
205
205
  role="group"
206
206
  aria-label={t('link.label')}
207
207
  data-testid="link-editor"
@@ -221,7 +221,7 @@ export function LinkEditor(): ReactNode {
221
221
  <>
222
222
  {openable ? (
223
223
  <a
224
- className="nx-link-url"
224
+ className="db-link-url"
225
225
  href={url}
226
226
  title={url}
227
227
  data-testid="link-url"
@@ -234,7 +234,7 @@ export function LinkEditor(): ReactNode {
234
234
  </a>
235
235
  ) : (
236
236
  <span
237
- className="nx-link-url nx-inert"
237
+ className="db-link-url db-inert"
238
238
  title={url}
239
239
  data-testid="link-url"
240
240
  >
@@ -25,7 +25,7 @@ export function CanvasPropertiesPanel(): ReactNode {
25
25
  const type = grid.config.type;
26
26
  return (
27
27
  <div
28
- className="nx-canvas-properties"
28
+ className="db-canvas-properties"
29
29
  data-testid="canvas-properties"
30
30
  >
31
31
  <Section title={t('canvas.background')}>
@@ -41,7 +41,7 @@ export function CanvasPropertiesPanel(): ReactNode {
41
41
  {background !== undefined && (
42
42
  <button
43
43
  type="button"
44
- className="nx-link"
44
+ className="db-link"
45
45
  disabled={!canCanvas}
46
46
  onClick={() => editor.document.setBackground(undefined)}
47
47
  >
@@ -49,7 +49,7 @@ export function CanvasPropertiesPanel(): ReactNode {
49
49
  </button>
50
50
  )}
51
51
  </Section>
52
- <div className="nx-menu-row">
52
+ <div className="db-menu-row">
53
53
  <span>{t('grid.label')}</span>
54
54
  <Choice
55
55
  label={t('grid.type')}
@@ -68,7 +68,7 @@ export function CanvasPropertiesPanel(): ReactNode {
68
68
  </div>
69
69
  {type !== 'none' && (
70
70
  <>
71
- <label className="nx-field">
71
+ <label className="db-field">
72
72
  <span>{t('grid.size')}</span>
73
73
  <input
74
74
  type="number"
@@ -87,7 +87,7 @@ export function CanvasPropertiesPanel(): ReactNode {
87
87
  />
88
88
  </label>
89
89
  {(type === 'square' || type === 'dot') && (
90
- <label className="nx-field">
90
+ <label className="db-field">
91
91
  <span>{t('grid.majorEvery')}</span>
92
92
  <input
93
93
  type="number"
@@ -109,7 +109,7 @@ export function MainMenu({ items, fileName = 'canvas' }: MainMenuProps): ReactNo
109
109
  <>
110
110
  <span
111
111
  ref={anchor}
112
- className="nx-anchor"
112
+ className="db-anchor"
113
113
  >
114
114
  <IconButton
115
115
  icon="menu"
@@ -150,13 +150,13 @@ export function MainMenu({ items, fileName = 'canvas' }: MainMenuProps): ReactNo
150
150
  {items}
151
151
  {(!isHidden('menu:theme') || !isHidden('menu:language') || !isHidden('menu:canvas')) && (
152
152
  <div
153
- className="nx-separator"
153
+ className="db-separator"
154
154
  role="separator"
155
155
  />
156
156
  )}
157
- <div className="nx-menu-settings">
157
+ <div className="db-menu-settings">
158
158
  {!isHidden('menu:theme') && (
159
- <div className="nx-menu-row">
159
+ <div className="db-menu-row">
160
160
  <span>{t('theme.label')}</span>
161
161
  <Choice<ThemeSetting>
162
162
  label={t('theme.label')}
@@ -172,7 +172,7 @@ export function MainMenu({ items, fileName = 'canvas' }: MainMenuProps): ReactNo
172
172
  </div>
173
173
  )}
174
174
  {!isHidden('menu:language') && (
175
- <label className="nx-field">
175
+ <label className="db-field">
176
176
  <span>{t('language.label')}</span>
177
177
  <select
178
178
  value={LANGUAGES.find((entry) => locale.startsWith(entry.locale))?.locale ?? locale}
@@ -197,7 +197,7 @@ export function MainMenu({ items, fileName = 'canvas' }: MainMenuProps): ReactNo
197
197
  {error !== undefined && (
198
198
  <Portal>
199
199
  <div
200
- className="nx-toast"
200
+ className="db-toast"
201
201
  role="alert"
202
202
  data-testid="ui-error"
203
203
  >
@@ -55,7 +55,7 @@ export function Minimap({ width = 200, height = 140, renderers }: MinimapProps):
55
55
 
56
56
  return (
57
57
  <Island
58
- className="nx-minimap"
58
+ className="db-minimap"
59
59
  label={t('minimap.label')}
60
60
  testId="minimap-island"
61
61
  >
@@ -134,7 +134,7 @@ function OpacityField({ elements }: { readonly elements: readonly ElementRecord[
134
134
  };
135
135
 
136
136
  return (
137
- <label className="nx-range">
137
+ <label className="db-range">
138
138
  <input
139
139
  type="range"
140
140
  min={0}
@@ -179,7 +179,7 @@ function ElementActions({ count }: { readonly count: number }): ReactNode {
179
179
  return (
180
180
  <>
181
181
  <Section title={t('properties.layers')}>
182
- <div className="nx-row">
182
+ <div className="db-row">
183
183
  <ActionButton
184
184
  command="core.sendToBack"
185
185
  icon="sendToBack"
@@ -204,7 +204,7 @@ function ElementActions({ count }: { readonly count: number }): ReactNode {
204
204
  </Section>
205
205
  {count > 1 && (
206
206
  <Section title={t('properties.align')}>
207
- <div className="nx-row nx-wrap">
207
+ <div className="db-row db-wrap">
208
208
  <ActionButton
209
209
  command="core.align"
210
210
  args={{ edge: 'left' }}
@@ -261,7 +261,7 @@ function ElementActions({ count }: { readonly count: number }): ReactNode {
261
261
  </Section>
262
262
  )}
263
263
  <Section title={t('properties.actions')}>
264
- <div className="nx-row nx-wrap">
264
+ <div className="db-row db-wrap">
265
265
  <ActionButton
266
266
  command="core.duplicate"
267
267
  icon="copy"
@@ -324,7 +324,7 @@ function CustomEditors({ elements }: { readonly elements: readonly ElementRecord
324
324
  return Component === undefined ? null : (
325
325
  <div
326
326
  key={type}
327
- className="nx-custom-editor"
327
+ className="db-custom-editor"
328
328
  data-testid={`property-editor-${type}`}
329
329
  >
330
330
  <Component
@@ -364,13 +364,13 @@ export function PropertiesPanel(): ReactNode {
364
364
 
365
365
  return (
366
366
  <Island
367
- className="nx-properties"
367
+ className="db-properties"
368
368
  label={t('properties.label')}
369
369
  testId="properties-panel"
370
370
  >
371
- <div className="nx-scroll">
371
+ <div className="db-scroll">
372
372
  {selected.length > 1 && (
373
- <p className="nx-caption">{t('properties.selected', { count: selected.length })}</p>
373
+ <p className="db-caption">{t('properties.selected', { count: selected.length })}</p>
374
374
  )}
375
375
  {has('textColor') && (selected.length > 0 || tool === TEXT_TOOL) && (
376
376
  <Section title={t('properties.textColor')}>
@@ -83,7 +83,7 @@ export function ShortcutsDialog(): ReactNode {
83
83
  testId="shortcuts-dialog"
84
84
  wide
85
85
  >
86
- <label className="nx-search">
86
+ <label className="db-search">
87
87
  <input
88
88
  type="search"
89
89
  placeholder={t('shortcuts.search')}
@@ -93,15 +93,15 @@ export function ShortcutsDialog(): ReactNode {
93
93
  onChange={(event) => setQuery(event.target.value)}
94
94
  />
95
95
  </label>
96
- <div className="nx-shortcuts">
96
+ <div className="db-shortcuts">
97
97
  {sections.map((section) => (
98
98
  <section key={section.title}>
99
- <h3 className="nx-section-title">{section.title}</h3>
99
+ <h3 className="db-section-title">{section.title}</h3>
100
100
  <dl>
101
101
  {section.entries.map((entry) => (
102
102
  <div
103
103
  key={entry.id}
104
- className="nx-shortcut-row"
104
+ className="db-shortcut-row"
105
105
  >
106
106
  <dt>{entry.label}</dt>
107
107
  <dd>
@@ -56,7 +56,7 @@ function ToolOverflow({ tools }: { readonly tools: readonly ToolInfo[] }): React
56
56
  <>
57
57
  <span
58
58
  ref={anchor}
59
- className="nx-anchor"
59
+ className="db-anchor"
60
60
  >
61
61
  <IconButton
62
62
  icon="more"
@@ -64,7 +64,7 @@ function ToolOverflow({ tools }: { readonly tools: readonly ToolInfo[] }): React
64
64
  pressed={open || tools.some((tool) => tool.id === active)}
65
65
  onClick={() => setOpen(!open)}
66
66
  testId="tool-overflow"
67
- className="nx-tool"
67
+ className="db-tool"
68
68
  />
69
69
  </span>
70
70
  <Popover
@@ -121,10 +121,10 @@ export function ToolButton({
121
121
  pressed={active === id}
122
122
  onClick={() => editor.tools.activate(id)}
123
123
  testId={`tool-${id}`}
124
- className="nx-tool"
124
+ className="db-tool"
125
125
  >
126
126
  {/* Shortcut hints are a deliberate choice (unlike Excalidraw); keep them. See CLAUDE.md. */}
127
- {showShortcut && shortcut !== undefined && <span className="nx-tool-key">{shortcut}</span>}
127
+ {showShortcut && shortcut !== undefined && <span className="db-tool-key">{shortcut}</span>}
128
128
  </IconButton>
129
129
  );
130
130
  }
@@ -179,18 +179,18 @@ export function Toolbar({ start, end }: ToolbarProps): ReactNode {
179
179
  let previousOrder = 0;
180
180
  return (
181
181
  <Island
182
- className="nx-toolbar"
182
+ className="db-toolbar"
183
183
  label={t('toolbar.label')}
184
184
  role="toolbar"
185
185
  testId="toolbar"
186
186
  >
187
187
  <div
188
- className="nx-toolbar-items"
188
+ className="db-toolbar-items"
189
189
  onKeyDown={(event) => handleRovingKeys(event, 'horizontal')}
190
190
  >
191
191
  {start}
192
192
  {!isHidden('toolLock') && <ToolLockButton />}
193
- <div className="nx-separator nx-vertical" />
193
+ <div className="db-separator db-vertical" />
194
194
  {entries.map((entry) => {
195
195
  const breakBefore = [...GROUP_BREAKS].some(
196
196
  (limit) => previousOrder < limit && entry.order >= limit,
@@ -198,7 +198,7 @@ export function Toolbar({ start, end }: ToolbarProps): ReactNode {
198
198
  previousOrder = entry.order;
199
199
  return (
200
200
  <Fragment key={entry.id}>
201
- {breakBefore && <div className={cx('nx-separator', 'nx-vertical')} />}
201
+ {breakBefore && <div className={cx('db-separator', 'db-vertical')} />}
202
202
  {entry.render()}
203
203
  </Fragment>
204
204
  );
@@ -206,7 +206,7 @@ export function Toolbar({ start, end }: ToolbarProps): ReactNode {
206
206
  {end}
207
207
  {overflow.length > 0 && (
208
208
  <>
209
- <div className="nx-separator nx-vertical" />
209
+ <div className="db-separator db-vertical" />
210
210
  <ToolOverflow tools={overflow} />
211
211
  </>
212
212
  )}