@aprovan/bobbin 0.1.0-dev.c00a8ae → 0.1.0-dev.c1ac1dc

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aprovan/bobbin",
3
- "version": "0.1.0-dev.c00a8ae",
3
+ "version": "0.1.0-dev.c1ac1dc",
4
4
  "description": "Visual DOM editor",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/src/Bobbin.tsx CHANGED
@@ -1,12 +1,12 @@
1
1
  import { createPortal } from 'react-dom';
2
- import type { BobbinProps } from './types';
3
- import { useBobbin } from './core/useBobbin';
4
- import { Pill } from './components/Pill/Pill';
5
- import { SelectionOverlay } from './components/Overlay/SelectionOverlay';
6
- import { ControlHandles } from './components/Overlay/ControlHandles';
7
- import { MarginPaddingOverlay } from './components/Overlay/MarginPaddingOverlay';
8
2
  import { EditPanel } from './components/EditPanel/EditPanel';
9
3
  import { Inspector } from './components/Inspector/Inspector';
4
+ import { ControlHandles } from './components/Overlay/ControlHandles';
5
+ import { MarginPaddingOverlay } from './components/Overlay/MarginPaddingOverlay';
6
+ import { SelectionOverlay } from './components/Overlay/SelectionOverlay';
7
+ import { Pill } from './components/Pill/Pill';
8
+ import { useBobbin } from './core/useBobbin';
9
+ import type { BobbinProps } from './types';
10
10
 
11
11
  export interface BobbinComponentProps extends BobbinProps {
12
12
  /** Show inspector panel */
@@ -1,12 +1,12 @@
1
1
  import { useState, useMemo } from 'react';
2
- import type { SelectedElement, BobbinActions, DesignTokens, Change, StyleChange, Annotation } from '../../types';
2
+ import { AnnotationSection } from './sections/AnnotationSection';
3
+ import { BackgroundSection } from './sections/BackgroundSection';
4
+ import { EffectsSection } from './sections/EffectsSection';
3
5
  import { LayoutSection } from './sections/LayoutSection';
4
- import { SpacingSection } from './sections/SpacingSection';
5
6
  import { SizeSection } from './sections/SizeSection';
7
+ import { SpacingSection } from './sections/SpacingSection';
6
8
  import { TypographySection } from './sections/TypographySection';
7
- import { BackgroundSection } from './sections/BackgroundSection';
8
- import { EffectsSection } from './sections/EffectsSection';
9
- import { AnnotationSection } from './sections/AnnotationSection';
9
+ import type { SelectedElement, BobbinActions, DesignTokens, Change, StyleChange, Annotation } from '../../types';
10
10
 
11
11
  // Theme icons
12
12
  const SunIcon = () => (
@@ -13,7 +13,7 @@ export function QuickSelectDropdown({
13
13
  tokens,
14
14
  quickKeys,
15
15
  onChange,
16
- placeholder = 'More...',
16
+ placeholder: _placeholder = 'More...',
17
17
  }: QuickSelectDropdownProps) {
18
18
  const [showDropdown, setShowDropdown] = useState(false);
19
19
 
@@ -1,7 +1,7 @@
1
- import type { DesignTokens } from '../../../types';
2
- import { SectionWrapper } from './SectionWrapper';
3
1
  import { ColorPicker } from '../controls/ColorPicker';
4
2
  import { TokenDropdown } from '../controls/TokenDropdown';
3
+ import { SectionWrapper } from './SectionWrapper';
4
+ import type { DesignTokens } from '../../../types';
5
5
 
6
6
  interface BackgroundSectionProps {
7
7
  expanded: boolean;
@@ -1,7 +1,7 @@
1
- import type { DesignTokens } from '../../../types';
2
- import { SectionWrapper } from './SectionWrapper';
3
1
  import { QuickSelectDropdown } from '../controls/QuickSelectDropdown';
4
2
  import { SliderInput } from '../controls/SliderInput';
3
+ import { SectionWrapper } from './SectionWrapper';
4
+ import type { DesignTokens } from '../../../types';
5
5
 
6
6
  interface EffectsSectionProps {
7
7
  expanded: boolean;
@@ -1,7 +1,7 @@
1
- import type { DesignTokens } from '../../../types';
2
- import { SectionWrapper } from './SectionWrapper';
3
1
  import { ToggleGroup } from '../controls/ToggleGroup';
4
2
  import { TokenDropdown } from '../controls/TokenDropdown';
3
+ import { SectionWrapper } from './SectionWrapper';
4
+ import type { DesignTokens } from '../../../types';
5
5
 
6
6
  // Direction icons
7
7
  const ArrowRightIcon = () => (
@@ -1,4 +1,4 @@
1
- import { ReactNode } from 'react';
1
+ import { type ReactNode } from 'react';
2
2
 
3
3
  interface SectionWrapperProps {
4
4
  title: string;
@@ -1,7 +1,7 @@
1
1
  import { useState } from 'react';
2
- import type { DesignTokens } from '../../../types';
3
- import { SectionWrapper } from './SectionWrapper';
4
2
  import { SliderInput } from '../controls/SliderInput';
3
+ import { SectionWrapper } from './SectionWrapper';
4
+ import type { DesignTokens } from '../../../types';
5
5
 
6
6
  // Common size presets
7
7
  const sizePresets: Record<string, string> = {
@@ -1,6 +1,6 @@
1
- import type { DesignTokens } from '../../../types';
2
- import { SectionWrapper } from './SectionWrapper';
3
1
  import { SpacingControl } from '../controls/SpacingControl';
2
+ import { SectionWrapper } from './SectionWrapper';
3
+ import type { DesignTokens } from '../../../types';
4
4
 
5
5
  interface SpacingSectionProps {
6
6
  expanded: boolean;
@@ -1,9 +1,9 @@
1
- import type { DesignTokens } from '../../../types';
2
- import { SectionWrapper } from './SectionWrapper';
3
- import { TokenDropdown } from '../controls/TokenDropdown';
4
- import { QuickSelectDropdown } from '../controls/QuickSelectDropdown';
5
1
  import { ColorPicker } from '../controls/ColorPicker';
2
+ import { QuickSelectDropdown } from '../controls/QuickSelectDropdown';
6
3
  import { ToggleGroup } from '../controls/ToggleGroup';
4
+ import { TokenDropdown } from '../controls/TokenDropdown';
5
+ import { SectionWrapper } from './SectionWrapper';
6
+ import type { DesignTokens } from '../../../types';
7
7
 
8
8
  // Text alignment icons
9
9
  const AlignLeftIcon = () => (
@@ -50,7 +50,7 @@ export function ControlHandles({
50
50
  const [isDragging, setIsDragging] = useState(false);
51
51
  const [dropTarget, setDropTarget] = useState<HTMLElement | null>(null);
52
52
  const [cornerToolbarExpanded, setCornerToolbarExpanded] = useState(false);
53
- const toolbarRef = useRef<HTMLDivElement>(null);
53
+ const _toolbarRef = useRef<HTMLDivElement>(null);
54
54
  const { rect } = selectedElement;
55
55
 
56
56
  const layoutDirection = useMemo(
@@ -59,7 +59,7 @@ export function ControlHandles({
59
59
  );
60
60
 
61
61
  // Check if corner toolbar should collapse
62
- const isNarrowElement = rect.width < MIN_WIDTH_FOR_CORNER_TOOLBAR;
62
+ const _isNarrowElement = rect.width < MIN_WIDTH_FOR_CORNER_TOOLBAR;
63
63
 
64
64
  // Check if edge zones need collapsing (based on element dimension perpendicular to edge)
65
65
  const isShortForVerticalEdge = rect.height < MIN_SIZE_FOR_EDGE_ICONS; // for left/right edges
@@ -117,7 +117,7 @@ export function ControlHandles({
117
117
  </svg>
118
118
  );
119
119
 
120
- const MoreIcon = () => (
120
+ const _MoreIcon = () => (
121
121
  <svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
122
122
  <circle cx="12" cy="12" r="1" fill="currentColor" />
123
123
  <circle cx="19" cy="12" r="1" fill="currentColor" />
@@ -125,7 +125,7 @@ export function ControlHandles({
125
125
  </svg>
126
126
  );
127
127
 
128
- const MoreIconVertical = () => (
128
+ const _MoreIconVertical = () => (
129
129
  <svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
130
130
  <circle cx="12" cy="5" r="1" fill="currentColor" />
131
131
  <circle cx="12" cy="12" r="1" fill="currentColor" />
@@ -270,7 +270,7 @@ export function ControlHandles({
270
270
  };
271
271
 
272
272
  // Check if an edge needs collapse based on position
273
- const edgeNeedsCollapse = (position: HandlePosition): boolean => {
273
+ const _edgeNeedsCollapse = (position: HandlePosition): boolean => {
274
274
  const isHorizontal = position === 'top' || position === 'bottom';
275
275
  return isHorizontal ? isShortForHorizontalEdge : isShortForVerticalEdge;
276
276
  };
@@ -417,7 +417,7 @@ export function ControlHandles({
417
417
  };
418
418
 
419
419
  // Expanded popup for collapsed edge zones
420
- const EdgeExpandedPopup = ({ position }: { position: HandlePosition }) => {
420
+ const _EdgeExpandedPopup = ({ position }: { position: HandlePosition }) => {
421
421
  const isHorizontal = position === 'top' || position === 'bottom';
422
422
 
423
423
  // Position the popup to extend in the direction it needs space
@@ -518,7 +518,7 @@ export function ControlHandles({
518
518
  );
519
519
 
520
520
  // Toolbar buttons (always the same, rendered conditionally based on narrow state)
521
- const ToolbarButtons = () => (
521
+ const _ToolbarButtons = () => (
522
522
  <>
523
523
  <ActionButton
524
524
  icon={<MoveIcon />}
@@ -1,4 +1,11 @@
1
1
  import { useState, useCallback, useMemo, useEffect } from 'react';
2
+ import { defaultTokens } from '../tokens';
3
+ import { applyStyleToElement, enableContentEditable } from '../utils/dom';
4
+ import { getElementPath, getElementXPath } from '../utils/selectors';
5
+ import { serializeChangesToYAML } from './changeSerializer';
6
+ import { useChangeTracker } from './useChangeTracker';
7
+ import { useClipboard } from './useClipboard';
8
+ import { useElementSelection } from './useElementSelection';
2
9
  import type {
3
10
  BobbinState,
4
11
  BobbinActions,
@@ -6,13 +13,6 @@ import type {
6
13
  DesignTokens,
7
14
  Annotation,
8
15
  } from '../types';
9
- import { useElementSelection } from './useElementSelection';
10
- import { useChangeTracker } from './useChangeTracker';
11
- import { useClipboard } from './useClipboard';
12
- import { serializeChangesToYAML } from './changeSerializer';
13
- import { defaultTokens } from '../tokens';
14
- import { getElementPath, getElementXPath } from '../utils/selectors';
15
- import { applyStyleToElement, enableContentEditable } from '../utils/dom';
16
16
 
17
17
  export function useBobbin(props: BobbinProps = {}) {
18
18
  const {
@@ -1,4 +1,5 @@
1
1
  import { useState, useCallback, useRef, useMemo } from 'react';
2
+ import { generateId } from '../utils/selectors';
2
3
  import type {
3
4
  Change,
4
5
  StyleChange,
@@ -6,7 +7,6 @@ import type {
6
7
  MoveChange,
7
8
  ChangeType,
8
9
  } from '../types';
9
- import { generateId } from '../utils/selectors';
10
10
 
11
11
  export function useChangeTracker() {
12
12
  const [changes, setChanges] = useState<Change[]>([]);
@@ -1,6 +1,6 @@
1
1
  import { useState, useCallback, useEffect, useRef } from 'react';
2
- import type { SelectedElement } from '../types';
3
2
  import { getElementPath, getElementXPath } from '../utils/selectors';
3
+ import type { SelectedElement } from '../types';
4
4
 
5
5
  export interface UseElementSelectionOptions {
6
6
  container?: HTMLElement | null;
@@ -1,5 +1,6 @@
1
- import type { DesignTokens } from '../types';
1
+ import { borderRadius, borderWidth } from './borders';
2
2
  import { colors } from './colors';
3
+ import { boxShadow } from './shadows';
3
4
  import { spacing } from './spacing';
4
5
  import {
5
6
  fontSize,
@@ -8,8 +9,7 @@ import {
8
9
  lineHeight,
9
10
  letterSpacing,
10
11
  } from './typography';
11
- import { borderRadius, borderWidth } from './borders';
12
- import { boxShadow } from './shadows';
12
+ import type { DesignTokens } from '../types';
13
13
 
14
14
  export const defaultTokens: DesignTokens = {
15
15
  colors,