@oh-just-another/react-ui 0.57.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.
- package/CHANGELOG.md +22 -0
- package/LICENSE +21 -0
- package/README.md +54 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/bottom-sheet.d.ts +26 -0
- package/dist/bottom-sheet.d.ts.map +1 -0
- package/dist/bottom-sheet.js +87 -0
- package/dist/bottom-sheet.js.map +1 -0
- package/dist/button-group.d.ts +14 -0
- package/dist/button-group.d.ts.map +1 -0
- package/dist/button-group.js +3 -0
- package/dist/button-group.js.map +1 -0
- package/dist/color-palette.d.ts +34 -0
- package/dist/color-palette.d.ts.map +1 -0
- package/dist/color-palette.js +77 -0
- package/dist/color-palette.js.map +1 -0
- package/dist/color-swatch-picker.d.ts +29 -0
- package/dist/color-swatch-picker.d.ts.map +1 -0
- package/dist/color-swatch-picker.js +56 -0
- package/dist/color-swatch-picker.js.map +1 -0
- package/dist/command-palette.d.ts +13 -0
- package/dist/command-palette.d.ts.map +1 -0
- package/dist/command-palette.js +146 -0
- package/dist/command-palette.js.map +1 -0
- package/dist/comments-panel.d.ts +27 -0
- package/dist/comments-panel.d.ts.map +1 -0
- package/dist/comments-panel.js +139 -0
- package/dist/comments-panel.js.map +1 -0
- package/dist/constants.d.ts +112 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +119 -0
- package/dist/constants.js.map +1 -0
- package/dist/context-menu-controller.d.ts +41 -0
- package/dist/context-menu-controller.d.ts.map +1 -0
- package/dist/context-menu-controller.js +26 -0
- package/dist/context-menu-controller.js.map +1 -0
- package/dist/context-menu.d.ts +53 -0
- package/dist/context-menu.d.ts.map +1 -0
- package/dist/context-menu.js +333 -0
- package/dist/context-menu.js.map +1 -0
- package/dist/context.d.ts +44 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +95 -0
- package/dist/context.js.map +1 -0
- package/dist/diagram-bars.d.ts +21 -0
- package/dist/diagram-bars.d.ts.map +1 -0
- package/dist/diagram-bars.js +4 -0
- package/dist/diagram-bars.js.map +1 -0
- package/dist/diagram-canvas.d.ts +39 -0
- package/dist/diagram-canvas.d.ts.map +1 -0
- package/dist/diagram-canvas.js +9 -0
- package/dist/diagram-canvas.js.map +1 -0
- package/dist/diagram-root.d.ts +70 -0
- package/dist/diagram-root.d.ts.map +1 -0
- package/dist/diagram-root.js +180 -0
- package/dist/diagram-root.js.map +1 -0
- package/dist/diff-panel.d.ts +25 -0
- package/dist/diff-panel.d.ts.map +1 -0
- package/dist/diff-panel.js +77 -0
- package/dist/diff-panel.js.map +1 -0
- package/dist/edge-style-panel.d.ts +19 -0
- package/dist/edge-style-panel.d.ts.map +1 -0
- package/dist/edge-style-panel.js +120 -0
- package/dist/edge-style-panel.js.map +1 -0
- package/dist/frame-name-editor-overlay.d.ts +13 -0
- package/dist/frame-name-editor-overlay.d.ts.map +1 -0
- package/dist/frame-name-editor-overlay.js +84 -0
- package/dist/frame-name-editor-overlay.js.map +1 -0
- package/dist/frame-panel.d.ts +19 -0
- package/dist/frame-panel.d.ts.map +1 -0
- package/dist/frame-panel.js +66 -0
- package/dist/frame-panel.js.map +1 -0
- package/dist/help-button.d.ts +16 -0
- package/dist/help-button.d.ts.map +1 -0
- package/dist/help-button.js +14 -0
- package/dist/help-button.js.map +1 -0
- package/dist/help-dialog.d.ts +56 -0
- package/dist/help-dialog.d.ts.map +1 -0
- package/dist/help-dialog.js +142 -0
- package/dist/help-dialog.js.map +1 -0
- package/dist/hooks.d.ts +54 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +85 -0
- package/dist/hooks.js.map +1 -0
- package/dist/icon-button.d.ts +28 -0
- package/dist/icon-button.d.ts.map +1 -0
- package/dist/icon-button.js +14 -0
- package/dist/icon-button.js.map +1 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +46 -0
- package/dist/index.js.map +1 -0
- package/dist/layer-panel.d.ts +13 -0
- package/dist/layer-panel.d.ts.map +1 -0
- package/dist/layer-panel.js +109 -0
- package/dist/layer-panel.js.map +1 -0
- package/dist/library-panel.d.ts +33 -0
- package/dist/library-panel.d.ts.map +1 -0
- package/dist/library-panel.js +37 -0
- package/dist/library-panel.js.map +1 -0
- package/dist/link-caption-editor.d.ts +8 -0
- package/dist/link-caption-editor.d.ts.map +1 -0
- package/dist/link-caption-editor.js +65 -0
- package/dist/link-caption-editor.js.map +1 -0
- package/dist/link-drop-shape-menu.d.ts +12 -0
- package/dist/link-drop-shape-menu.d.ts.map +1 -0
- package/dist/link-drop-shape-menu.js +55 -0
- package/dist/link-drop-shape-menu.js.map +1 -0
- package/dist/link-hover-popup.d.ts +2 -0
- package/dist/link-hover-popup.d.ts.map +1 -0
- package/dist/link-hover-popup.js +96 -0
- package/dist/link-hover-popup.js.map +1 -0
- package/dist/main-menu.d.ts +67 -0
- package/dist/main-menu.d.ts.map +1 -0
- package/dist/main-menu.js +243 -0
- package/dist/main-menu.js.map +1 -0
- package/dist/markdown.d.ts +10 -0
- package/dist/markdown.d.ts.map +1 -0
- package/dist/markdown.js +131 -0
- package/dist/markdown.js.map +1 -0
- package/dist/merge-dialog.d.ts +22 -0
- package/dist/merge-dialog.d.ts.map +1 -0
- package/dist/merge-dialog.js +46 -0
- package/dist/merge-dialog.js.map +1 -0
- package/dist/modal.d.ts +19 -0
- package/dist/modal.d.ts.map +1 -0
- package/dist/modal.js +87 -0
- package/dist/modal.js.map +1 -0
- package/dist/palette.d.ts +73 -0
- package/dist/palette.d.ts.map +1 -0
- package/dist/palette.js +330 -0
- package/dist/palette.js.map +1 -0
- package/dist/popover.d.ts +33 -0
- package/dist/popover.d.ts.map +1 -0
- package/dist/popover.js +107 -0
- package/dist/popover.js.map +1 -0
- package/dist/property-panel.d.ts +32 -0
- package/dist/property-panel.d.ts.map +1 -0
- package/dist/property-panel.js +728 -0
- package/dist/property-panel.js.map +1 -0
- package/dist/reset-to-content-button.d.ts +10 -0
- package/dist/reset-to-content-button.d.ts.map +1 -0
- package/dist/reset-to-content-button.js +62 -0
- package/dist/reset-to-content-button.js.map +1 -0
- package/dist/segmented-control.d.ts +23 -0
- package/dist/segmented-control.d.ts.map +1 -0
- package/dist/segmented-control.js +5 -0
- package/dist/segmented-control.js.map +1 -0
- package/dist/selection-floating-panel.d.ts +56 -0
- package/dist/selection-floating-panel.d.ts.map +1 -0
- package/dist/selection-floating-panel.js +251 -0
- package/dist/selection-floating-panel.js.map +1 -0
- package/dist/sidebar.d.ts +31 -0
- package/dist/sidebar.d.ts.map +1 -0
- package/dist/sidebar.js +66 -0
- package/dist/sidebar.js.map +1 -0
- package/dist/slider.d.ts +20 -0
- package/dist/slider.d.ts.map +1 -0
- package/dist/slider.js +9 -0
- package/dist/slider.js.map +1 -0
- package/dist/text-editor-overlay.d.ts +16 -0
- package/dist/text-editor-overlay.d.ts.map +1 -0
- package/dist/text-editor-overlay.js +112 -0
- package/dist/text-editor-overlay.js.map +1 -0
- package/dist/toast.d.ts +34 -0
- package/dist/toast.d.ts.map +1 -0
- package/dist/toast.js +89 -0
- package/dist/toast.js.map +1 -0
- package/dist/toolbar.d.ts +149 -0
- package/dist/toolbar.d.ts.map +1 -0
- package/dist/toolbar.js +282 -0
- package/dist/toolbar.js.map +1 -0
- package/dist/tooltip.d.ts +21 -0
- package/dist/tooltip.d.ts.map +1 -0
- package/dist/tooltip.js +217 -0
- package/dist/tooltip.js.map +1 -0
- package/dist/ui-layer.d.ts +22 -0
- package/dist/ui-layer.d.ts.map +1 -0
- package/dist/ui-layer.js +3 -0
- package/dist/ui-layer.js.map +1 -0
- package/dist/versioning.d.ts +32 -0
- package/dist/versioning.d.ts.map +1 -0
- package/dist/versioning.js +206 -0
- package/dist/versioning.js.map +1 -0
- package/package.json +81 -0
- package/src/styles.css +1502 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tunable visual sizes for the React UI panels and toolbar. Pixel values,
|
|
3
|
+
* overridable via component props when a host wants a different layout —
|
|
4
|
+
* these are the defaults baked into the built-in panels.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Viewport width (CSS px) at/below which the chrome switches to its mobile
|
|
8
|
+
* layout (bottom-sheet property panel, etc.). Combined with `(pointer: coarse)`
|
|
9
|
+
* so touch tablets also get the mobile treatment regardless of width.
|
|
10
|
+
* See `useMobileLayout`.
|
|
11
|
+
*/
|
|
12
|
+
export declare const MOBILE_MAX_WIDTH_PX = 640;
|
|
13
|
+
/** Width of the left palette panel, in CSS pixels. */
|
|
14
|
+
export declare const PALETTE_WIDTH = 200;
|
|
15
|
+
/** Pixel side of the per-template hit area inside the palette grid. */
|
|
16
|
+
export declare const PALETTE_ITEM_SIZE = 28;
|
|
17
|
+
/** Width of the right property panel, in CSS pixels. */
|
|
18
|
+
export declare const PROPERTY_PANEL_WIDTH = 240;
|
|
19
|
+
/** Pixel side of the colour swatches inside the property panel. */
|
|
20
|
+
export declare const PROPERTY_SWATCH_SIZE = 12;
|
|
21
|
+
/** Width of the layer panel, in CSS pixels. */
|
|
22
|
+
export declare const LAYER_PANEL_WIDTH = 220;
|
|
23
|
+
/** Pixel side of the toggle icon (visibility / lock) buttons. */
|
|
24
|
+
export declare const LAYER_TOGGLE_ICON_SIZE = 20;
|
|
25
|
+
/** Pixel side of the per-row colour swatch in the layer panel. */
|
|
26
|
+
export declare const LAYER_SWATCH_SIZE = 22;
|
|
27
|
+
/** Width of the comments popover, in CSS pixels. */
|
|
28
|
+
export declare const COMMENTS_PANEL_WIDTH = 280;
|
|
29
|
+
/** Pixel height of the toolbar vertical separator. */
|
|
30
|
+
export declare const TOOLBAR_SEPARATOR_HEIGHT = 20;
|
|
31
|
+
/**
|
|
32
|
+
* Default auto-dismiss time for a toast (ms). 0 / Infinity keep it
|
|
33
|
+
* open until the user clicks the × — useful for sticky errors.
|
|
34
|
+
*/
|
|
35
|
+
export declare const TOAST_DEFAULT_DURATION_MS = 3000;
|
|
36
|
+
/**
|
|
37
|
+
* Maximum width of the `<HelpDialog>` modal in CSS pixels. The dialog
|
|
38
|
+
* still respects the viewport via `min(this, 100vw - 64px)`.
|
|
39
|
+
*/
|
|
40
|
+
export declare const HELP_DIALOG_MAX_WIDTH_PX = 720;
|
|
41
|
+
/**
|
|
42
|
+
* Delay before a `<Tooltip>` opens on first hover (ms). Short enough to
|
|
43
|
+
* feel responsive on an intentional pause, long enough not to flash on a
|
|
44
|
+
* pointer that's just passing through.
|
|
45
|
+
*/
|
|
46
|
+
export declare const TOOLTIP_OPEN_DELAY_MS = 600;
|
|
47
|
+
/**
|
|
48
|
+
* Window after a tooltip closes during which the next hover opens the next
|
|
49
|
+
* tooltip instantly — lets users scan a toolbar without waiting for each hint.
|
|
50
|
+
*/
|
|
51
|
+
export declare const TOOLTIP_SKIP_DELAY_MS = 600;
|
|
52
|
+
/**
|
|
53
|
+
* Grace period before a tooltip actually hides after pointerleave.
|
|
54
|
+
* Small value smooths over pointer jitter at the edge of the
|
|
55
|
+
* trigger without letting stale hints linger.
|
|
56
|
+
*/
|
|
57
|
+
export declare const TOOLTIP_HIDE_GRACE_MS = 80;
|
|
58
|
+
/**
|
|
59
|
+
* Distance in CSS pixels between the trigger edge and the tooltip
|
|
60
|
+
* box on the side specified by the `side` prop.
|
|
61
|
+
*/
|
|
62
|
+
export declare const TOOLTIP_OFFSET_PX = 6;
|
|
63
|
+
/**
|
|
64
|
+
* Floating-panel positioning defaults for the `@floating-ui/dom`-positioned
|
|
65
|
+
* overlays. Each is the fallback used when the component is rendered without
|
|
66
|
+
* an explicit prop, so hosts can re-tune the spacing globally here.
|
|
67
|
+
*
|
|
68
|
+
* - `SELECTION_PANEL_OFFSET_PX` — distance between the selection floating
|
|
69
|
+
* panel and the selected element's bbox. Range: 6–48.
|
|
70
|
+
* - `SELECTION_PANEL_EDGE_INSET_*_PX` — per-side inset that shrinks the region
|
|
71
|
+
* the panel is allowed to occupy, measured from each viewport edge (fed to
|
|
72
|
+
* the `shift` middleware as a per-side `padding`). The panel starts shifting
|
|
73
|
+
* to stay inside the inset region as it approaches that edge, so it never
|
|
74
|
+
* lands over fixed chrome on that side (top toolbar, bottom zoom bar, docked
|
|
75
|
+
* side panels). Tune each side to the chrome that lives there. Range per
|
|
76
|
+
* side: 0–320.
|
|
77
|
+
* - `POPOVER_OFFSET_PX` — distance between a popover and its trigger. Smaller
|
|
78
|
+
* than the selection-panel gap since a popover hangs off a control, not a
|
|
79
|
+
* shape. Range: 4–12.
|
|
80
|
+
*/
|
|
81
|
+
export declare const SELECTION_PANEL_OFFSET_PX = 48;
|
|
82
|
+
/** Inset from the TOP edge — clears the top toolbar. */
|
|
83
|
+
export declare const SELECTION_PANEL_EDGE_INSET_TOP_PX = 66;
|
|
84
|
+
/** Inset from the RIGHT edge. Bump it if a right-docked panel must stay clear. */
|
|
85
|
+
export declare const SELECTION_PANEL_EDGE_INSET_RIGHT_PX = 16;
|
|
86
|
+
/** Inset from the BOTTOM edge — clears the bottom zoom / status bar. */
|
|
87
|
+
export declare const SELECTION_PANEL_EDGE_INSET_BOTTOM_PX = 66;
|
|
88
|
+
/** Inset from the LEFT edge — small margin (no left-docked chrome by default). */
|
|
89
|
+
export declare const SELECTION_PANEL_EDGE_INSET_LEFT_PX = 16;
|
|
90
|
+
export declare const POPOVER_OFFSET_PX = 6;
|
|
91
|
+
/**
|
|
92
|
+
* Text contextual-panel controls.
|
|
93
|
+
*
|
|
94
|
+
* - `TEXT_FONT_SIZE_PRESETS` — the S/M/L/XL quick buckets in the font
|
|
95
|
+
* size segmented control (world-unit px). The popover slider covers
|
|
96
|
+
* the full {@link TEXT_FONT_SIZE_MIN}–{@link TEXT_FONT_SIZE_MAX} range.
|
|
97
|
+
* - `TEXT_FONT_SIZE_MIN` / `TEXT_FONT_SIZE_MAX` — slider clamp range.
|
|
98
|
+
* - `TEXT_FONT_STACKS` — font-family choices offered in the family
|
|
99
|
+
* dropdown. `value` is written verbatim to `TextElement.fontFamily`;
|
|
100
|
+
* `label` is the human name shown in the menu.
|
|
101
|
+
*/
|
|
102
|
+
export declare const TEXT_FONT_SIZE_PRESETS: readonly {
|
|
103
|
+
readonly label: string;
|
|
104
|
+
readonly value: number;
|
|
105
|
+
}[];
|
|
106
|
+
export declare const TEXT_FONT_SIZE_MIN = 8;
|
|
107
|
+
export declare const TEXT_FONT_SIZE_MAX = 256;
|
|
108
|
+
export declare const TEXT_FONT_STACKS: readonly {
|
|
109
|
+
readonly label: string;
|
|
110
|
+
readonly value: string;
|
|
111
|
+
}[];
|
|
112
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC,sDAAsD;AACtD,eAAO,MAAM,aAAa,MAAM,CAAC;AAEjC,uEAAuE;AACvE,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC,wDAAwD;AACxD,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC,mEAAmE;AACnE,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAEvC,+CAA+C;AAC/C,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC,iEAAiE;AACjE,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC,kEAAkE;AAClE,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC,oDAAoD;AACpD,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC,sDAAsD;AACtD,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAE3C;;;GAGG;AACH,eAAO,MAAM,yBAAyB,OAAQ,CAAC;AAE/C;;;GAGG;AACH,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAE5C;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC;;;GAGG;AACH,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC;;;GAGG;AACH,eAAO,MAAM,iBAAiB,IAAI,CAAC;AAEnC;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAC5C,wDAAwD;AACxD,eAAO,MAAM,iCAAiC,KAAK,CAAC;AACpD,kFAAkF;AAClF,eAAO,MAAM,mCAAmC,KAAK,CAAC;AACtD,wEAAwE;AACxE,eAAO,MAAM,oCAAoC,KAAK,CAAC;AACvD,kFAAkF;AAClF,eAAO,MAAM,kCAAkC,KAAK,CAAC;AACrD,eAAO,MAAM,iBAAiB,IAAI,CAAC;AAEnC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB,EAAE,SAAS;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAM7F,CAAC;AACJ,eAAO,MAAM,kBAAkB,IAAI,CAAC;AACpC,eAAO,MAAM,kBAAkB,MAAM,CAAC;AACtC,eAAO,MAAM,gBAAgB,EAAE,SAAS;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAQzF,CAAC"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tunable visual sizes for the React UI panels and toolbar. Pixel values,
|
|
3
|
+
* overridable via component props when a host wants a different layout —
|
|
4
|
+
* these are the defaults baked into the built-in panels.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Viewport width (CSS px) at/below which the chrome switches to its mobile
|
|
8
|
+
* layout (bottom-sheet property panel, etc.). Combined with `(pointer: coarse)`
|
|
9
|
+
* so touch tablets also get the mobile treatment regardless of width.
|
|
10
|
+
* See `useMobileLayout`.
|
|
11
|
+
*/
|
|
12
|
+
export const MOBILE_MAX_WIDTH_PX = 640;
|
|
13
|
+
/** Width of the left palette panel, in CSS pixels. */
|
|
14
|
+
export const PALETTE_WIDTH = 200;
|
|
15
|
+
/** Pixel side of the per-template hit area inside the palette grid. */
|
|
16
|
+
export const PALETTE_ITEM_SIZE = 28;
|
|
17
|
+
/** Width of the right property panel, in CSS pixels. */
|
|
18
|
+
export const PROPERTY_PANEL_WIDTH = 240;
|
|
19
|
+
/** Pixel side of the colour swatches inside the property panel. */
|
|
20
|
+
export const PROPERTY_SWATCH_SIZE = 12;
|
|
21
|
+
/** Width of the layer panel, in CSS pixels. */
|
|
22
|
+
export const LAYER_PANEL_WIDTH = 220;
|
|
23
|
+
/** Pixel side of the toggle icon (visibility / lock) buttons. */
|
|
24
|
+
export const LAYER_TOGGLE_ICON_SIZE = 20;
|
|
25
|
+
/** Pixel side of the per-row colour swatch in the layer panel. */
|
|
26
|
+
export const LAYER_SWATCH_SIZE = 22;
|
|
27
|
+
/** Width of the comments popover, in CSS pixels. */
|
|
28
|
+
export const COMMENTS_PANEL_WIDTH = 280;
|
|
29
|
+
/** Pixel height of the toolbar vertical separator. */
|
|
30
|
+
export const TOOLBAR_SEPARATOR_HEIGHT = 20;
|
|
31
|
+
/**
|
|
32
|
+
* Default auto-dismiss time for a toast (ms). 0 / Infinity keep it
|
|
33
|
+
* open until the user clicks the × — useful for sticky errors.
|
|
34
|
+
*/
|
|
35
|
+
export const TOAST_DEFAULT_DURATION_MS = 3_000;
|
|
36
|
+
/**
|
|
37
|
+
* Maximum width of the `<HelpDialog>` modal in CSS pixels. The dialog
|
|
38
|
+
* still respects the viewport via `min(this, 100vw - 64px)`.
|
|
39
|
+
*/
|
|
40
|
+
export const HELP_DIALOG_MAX_WIDTH_PX = 720;
|
|
41
|
+
/**
|
|
42
|
+
* Delay before a `<Tooltip>` opens on first hover (ms). Short enough to
|
|
43
|
+
* feel responsive on an intentional pause, long enough not to flash on a
|
|
44
|
+
* pointer that's just passing through.
|
|
45
|
+
*/
|
|
46
|
+
export const TOOLTIP_OPEN_DELAY_MS = 600;
|
|
47
|
+
/**
|
|
48
|
+
* Window after a tooltip closes during which the next hover opens the next
|
|
49
|
+
* tooltip instantly — lets users scan a toolbar without waiting for each hint.
|
|
50
|
+
*/
|
|
51
|
+
export const TOOLTIP_SKIP_DELAY_MS = 600;
|
|
52
|
+
/**
|
|
53
|
+
* Grace period before a tooltip actually hides after pointerleave.
|
|
54
|
+
* Small value smooths over pointer jitter at the edge of the
|
|
55
|
+
* trigger without letting stale hints linger.
|
|
56
|
+
*/
|
|
57
|
+
export const TOOLTIP_HIDE_GRACE_MS = 80;
|
|
58
|
+
/**
|
|
59
|
+
* Distance in CSS pixels between the trigger edge and the tooltip
|
|
60
|
+
* box on the side specified by the `side` prop.
|
|
61
|
+
*/
|
|
62
|
+
export const TOOLTIP_OFFSET_PX = 6;
|
|
63
|
+
/**
|
|
64
|
+
* Floating-panel positioning defaults for the `@floating-ui/dom`-positioned
|
|
65
|
+
* overlays. Each is the fallback used when the component is rendered without
|
|
66
|
+
* an explicit prop, so hosts can re-tune the spacing globally here.
|
|
67
|
+
*
|
|
68
|
+
* - `SELECTION_PANEL_OFFSET_PX` — distance between the selection floating
|
|
69
|
+
* panel and the selected element's bbox. Range: 6–48.
|
|
70
|
+
* - `SELECTION_PANEL_EDGE_INSET_*_PX` — per-side inset that shrinks the region
|
|
71
|
+
* the panel is allowed to occupy, measured from each viewport edge (fed to
|
|
72
|
+
* the `shift` middleware as a per-side `padding`). The panel starts shifting
|
|
73
|
+
* to stay inside the inset region as it approaches that edge, so it never
|
|
74
|
+
* lands over fixed chrome on that side (top toolbar, bottom zoom bar, docked
|
|
75
|
+
* side panels). Tune each side to the chrome that lives there. Range per
|
|
76
|
+
* side: 0–320.
|
|
77
|
+
* - `POPOVER_OFFSET_PX` — distance between a popover and its trigger. Smaller
|
|
78
|
+
* than the selection-panel gap since a popover hangs off a control, not a
|
|
79
|
+
* shape. Range: 4–12.
|
|
80
|
+
*/
|
|
81
|
+
export const SELECTION_PANEL_OFFSET_PX = 48;
|
|
82
|
+
/** Inset from the TOP edge — clears the top toolbar. */
|
|
83
|
+
export const SELECTION_PANEL_EDGE_INSET_TOP_PX = 66;
|
|
84
|
+
/** Inset from the RIGHT edge. Bump it if a right-docked panel must stay clear. */
|
|
85
|
+
export const SELECTION_PANEL_EDGE_INSET_RIGHT_PX = 16;
|
|
86
|
+
/** Inset from the BOTTOM edge — clears the bottom zoom / status bar. */
|
|
87
|
+
export const SELECTION_PANEL_EDGE_INSET_BOTTOM_PX = 66;
|
|
88
|
+
/** Inset from the LEFT edge — small margin (no left-docked chrome by default). */
|
|
89
|
+
export const SELECTION_PANEL_EDGE_INSET_LEFT_PX = 16;
|
|
90
|
+
export const POPOVER_OFFSET_PX = 6;
|
|
91
|
+
/**
|
|
92
|
+
* Text contextual-panel controls.
|
|
93
|
+
*
|
|
94
|
+
* - `TEXT_FONT_SIZE_PRESETS` — the S/M/L/XL quick buckets in the font
|
|
95
|
+
* size segmented control (world-unit px). The popover slider covers
|
|
96
|
+
* the full {@link TEXT_FONT_SIZE_MIN}–{@link TEXT_FONT_SIZE_MAX} range.
|
|
97
|
+
* - `TEXT_FONT_SIZE_MIN` / `TEXT_FONT_SIZE_MAX` — slider clamp range.
|
|
98
|
+
* - `TEXT_FONT_STACKS` — font-family choices offered in the family
|
|
99
|
+
* dropdown. `value` is written verbatim to `TextElement.fontFamily`;
|
|
100
|
+
* `label` is the human name shown in the menu.
|
|
101
|
+
*/
|
|
102
|
+
export const TEXT_FONT_SIZE_PRESETS = [
|
|
103
|
+
{ label: "S", value: 16 },
|
|
104
|
+
{ label: "M", value: 24 },
|
|
105
|
+
{ label: "L", value: 36 },
|
|
106
|
+
{ label: "XL", value: 64 },
|
|
107
|
+
];
|
|
108
|
+
export const TEXT_FONT_SIZE_MIN = 8;
|
|
109
|
+
export const TEXT_FONT_SIZE_MAX = 256;
|
|
110
|
+
export const TEXT_FONT_STACKS = [
|
|
111
|
+
// Labels map to the three fonts embedded in the WASM MSDF shaper
|
|
112
|
+
// (sans / serif / mono). Canvas2D resolves the same stacks against
|
|
113
|
+
// real system fonts. Keep the family keywords ("serif", "mono") in
|
|
114
|
+
// each value so the shaper's resolver picks the right embedded font.
|
|
115
|
+
{ label: "Sans", value: "system-ui, sans-serif" },
|
|
116
|
+
{ label: "Serif", value: "Georgia, 'Times New Roman', serif" },
|
|
117
|
+
{ label: "Mono", value: "ui-monospace, 'SF Mono', Menlo, monospace" },
|
|
118
|
+
];
|
|
119
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEvC,sDAAsD;AACtD,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,CAAC;AAEjC,uEAAuE;AACvE,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAEpC,wDAAwD;AACxD,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAExC,mEAAmE;AACnE,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEvC,+CAA+C;AAC/C,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAErC,iEAAiE;AACjE,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAEzC,kEAAkE;AAClE,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAEpC,oDAAoD;AACpD,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAExC,sDAAsD;AACtD,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,CAAC;AAE3C;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,KAAK,CAAC;AAE/C;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAE5C;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAEzC;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAEzC;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,CAAC;AAExC;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAEnC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,CAAC;AAC5C,wDAAwD;AACxD,MAAM,CAAC,MAAM,iCAAiC,GAAG,EAAE,CAAC;AACpD,kFAAkF;AAClF,MAAM,CAAC,MAAM,mCAAmC,GAAG,EAAE,CAAC;AACtD,wEAAwE;AACxE,MAAM,CAAC,MAAM,oCAAoC,GAAG,EAAE,CAAC;AACvD,kFAAkF;AAClF,MAAM,CAAC,MAAM,kCAAkC,GAAG,EAAE,CAAC;AACrD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAEnC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,sBAAsB,GACjC;IACE,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE;IACzB,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE;IACzB,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE;IACzB,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;CAC3B,CAAC;AACJ,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AACpC,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AACtC,MAAM,CAAC,MAAM,gBAAgB,GAAkE;IAC7F,iEAAiE;IACjE,mEAAmE;IACnE,mEAAmE;IACnE,qEAAqE;IACrE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,uBAAuB,EAAE;IACjD,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,mCAAmC,EAAE;IAC9D,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,2CAA2C,EAAE;CACtE,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
/** Screen-space (CSS px) + world-space point pair an open request carries. */
|
|
3
|
+
export interface ContextMenuOpenRequest {
|
|
4
|
+
readonly screenPoint: {
|
|
5
|
+
readonly x: number;
|
|
6
|
+
readonly y: number;
|
|
7
|
+
};
|
|
8
|
+
readonly worldPoint: {
|
|
9
|
+
readonly x: number;
|
|
10
|
+
readonly y: number;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
type OpenFn = (req: ContextMenuOpenRequest) => void;
|
|
14
|
+
/**
|
|
15
|
+
* Shared imperative handle for the diagram's context menu. Lets UI
|
|
16
|
+
* outside the canvas — e.g. the "⋯" button in the selection floating
|
|
17
|
+
* panel — open the same menu that a right-click opens, positioned
|
|
18
|
+
* wherever the caller asks.
|
|
19
|
+
*
|
|
20
|
+
* `<ContextMenu>` registers its open handler on mount; callers use
|
|
21
|
+
* {@link useContextMenuController}.`open(...)`. When no `<ContextMenu>`
|
|
22
|
+
* is mounted, `open` is a no-op.
|
|
23
|
+
*/
|
|
24
|
+
export interface ContextMenuController {
|
|
25
|
+
readonly open: OpenFn;
|
|
26
|
+
/** `<ContextMenu>` registers its open handler here. */
|
|
27
|
+
readonly register: (fn: OpenFn) => () => void;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Provides a single {@link ContextMenuController} to everything
|
|
31
|
+
* inside. Mounted automatically by `<DiagramRoot>`; context flows
|
|
32
|
+
* through React portals, so the floating selection panel (portaled to
|
|
33
|
+
* `document.body`) still sees it.
|
|
34
|
+
*/
|
|
35
|
+
export declare const ContextMenuControllerProvider: ({ children }: {
|
|
36
|
+
readonly children: ReactNode;
|
|
37
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
/** Access the shared context-menu controller, or `null` outside a provider. */
|
|
39
|
+
export declare const useContextMenuController: () => ContextMenuController | null;
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=context-menu-controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-menu-controller.d.ts","sourceRoot":"","sources":["../src/context-menu-controller.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,8EAA8E;AAC9E,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,WAAW,EAAE;QAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACjE,QAAQ,CAAC,UAAU,EAAE;QAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACjE;AAED,KAAK,MAAM,GAAG,CAAC,GAAG,EAAE,sBAAsB,KAAK,IAAI,CAAC;AAEpD;;;;;;;;;GASG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,uDAAuD;IACvD,QAAQ,CAAC,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,IAAI,CAAC;CAC/C;AAID;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,GAAI,cAAc;IAAE,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,4CAmB3F,CAAC;AAEF,+EAA+E;AAC/E,eAAO,MAAM,wBAAwB,QAAO,qBAAqB,GAAG,IAC1B,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useMemo, useRef, } from "react";
|
|
3
|
+
const ContextMenuControllerContext = createContext(null);
|
|
4
|
+
/**
|
|
5
|
+
* Provides a single {@link ContextMenuController} to everything
|
|
6
|
+
* inside. Mounted automatically by `<DiagramRoot>`; context flows
|
|
7
|
+
* through React portals, so the floating selection panel (portaled to
|
|
8
|
+
* `document.body`) still sees it.
|
|
9
|
+
*/
|
|
10
|
+
export const ContextMenuControllerProvider = ({ children }) => {
|
|
11
|
+
const ref = useRef(null);
|
|
12
|
+
const controller = useMemo(() => ({
|
|
13
|
+
open: (req) => ref.current?.(req),
|
|
14
|
+
register: (fn) => {
|
|
15
|
+
ref.current = fn;
|
|
16
|
+
return () => {
|
|
17
|
+
if (ref.current === fn)
|
|
18
|
+
ref.current = null;
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
}), []);
|
|
22
|
+
return (_jsx(ContextMenuControllerContext.Provider, { value: controller, children: children }));
|
|
23
|
+
};
|
|
24
|
+
/** Access the shared context-menu controller, or `null` outside a provider. */
|
|
25
|
+
export const useContextMenuController = () => useContext(ContextMenuControllerContext);
|
|
26
|
+
//# sourceMappingURL=context-menu-controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-menu-controller.js","sourceRoot":"","sources":["../src/context-menu-controller.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EACb,UAAU,EACV,OAAO,EACP,MAAM,GAEP,MAAM,OAAO,CAAC;AA0Bf,MAAM,4BAA4B,GAAG,aAAa,CAA+B,IAAI,CAAC,CAAC;AAEvF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,EAAE,QAAQ,EAAoC,EAAE,EAAE;IAC9F,MAAM,GAAG,GAAG,MAAM,CAAgB,IAAI,CAAC,CAAC;IACxC,MAAM,UAAU,GAAG,OAAO,CACxB,GAAG,EAAE,CAAC,CAAC;QACL,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC;QACjC,QAAQ,EAAE,CAAC,EAAE,EAAE,EAAE;YACf,GAAG,CAAC,OAAO,GAAG,EAAE,CAAC;YACjB,OAAO,GAAG,EAAE;gBACV,IAAI,GAAG,CAAC,OAAO,KAAK,EAAE;oBAAE,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC;YAC7C,CAAC,CAAC;QACJ,CAAC;KACF,CAAC,EACF,EAAE,CACH,CAAC;IACF,OAAO,CACL,KAAC,4BAA4B,CAAC,QAAQ,IAAC,KAAK,EAAE,UAAU,YACrD,QAAQ,GAC6B,CACzC,CAAC;AACJ,CAAC,CAAC;AAEF,+EAA+E;AAC/E,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAiC,EAAE,CACzE,UAAU,CAAC,4BAA4B,CAAC,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type CSSProperties, type ReactNode } from "react";
|
|
2
|
+
import type { Editor } from "@oh-just-another/state";
|
|
3
|
+
/**
|
|
4
|
+
* Declarative menu entry. `divider` paints a separator; everything else
|
|
5
|
+
* is a clickable row.
|
|
6
|
+
*
|
|
7
|
+
* The `visible` / `disabled` predicates run against the *current* editor
|
|
8
|
+
* snapshot when the menu opens. They can read selection, mode, history
|
|
9
|
+
* state, anything on the editor.
|
|
10
|
+
*/
|
|
11
|
+
export type ContextMenuItem = {
|
|
12
|
+
readonly kind: "divider";
|
|
13
|
+
} | {
|
|
14
|
+
readonly kind: "action";
|
|
15
|
+
readonly id: string;
|
|
16
|
+
readonly label: ReactNode;
|
|
17
|
+
readonly shortcut?: string;
|
|
18
|
+
readonly visible?: (editor: Editor, ctx: ContextMenuContext) => boolean;
|
|
19
|
+
readonly disabled?: (editor: Editor, ctx: ContextMenuContext) => boolean;
|
|
20
|
+
readonly onClick: (editor: Editor, ctx: ContextMenuContext) => void;
|
|
21
|
+
};
|
|
22
|
+
/** Per-open snapshot the menu hands to predicates and click handlers. */
|
|
23
|
+
export interface ContextMenuContext {
|
|
24
|
+
/** World-space pointer position where the menu opened. */
|
|
25
|
+
readonly worldPoint: {
|
|
26
|
+
readonly x: number;
|
|
27
|
+
readonly y: number;
|
|
28
|
+
};
|
|
29
|
+
/** Screen-space pointer position (CSS pixels). */
|
|
30
|
+
readonly screenPoint: {
|
|
31
|
+
readonly x: number;
|
|
32
|
+
readonly y: number;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Render-prop helper that listens for `contextmenu` on the wrapped
|
|
37
|
+
* element, opens a positioned menu, and dispatches the chosen item's
|
|
38
|
+
* `onClick` against the live editor. Drop it as a sibling of the canvas
|
|
39
|
+
* surface inside `<DiagramRoot>`.
|
|
40
|
+
*/
|
|
41
|
+
export interface ContextMenuProps {
|
|
42
|
+
readonly items: readonly ContextMenuItem[];
|
|
43
|
+
/**
|
|
44
|
+
* Target element to attach the `contextmenu` listener to. Defaults to
|
|
45
|
+
* the element the trigger is rendered into.
|
|
46
|
+
*/
|
|
47
|
+
readonly target?: HTMLElement | null;
|
|
48
|
+
readonly style?: CSSProperties;
|
|
49
|
+
readonly className?: string;
|
|
50
|
+
}
|
|
51
|
+
export declare const ContextMenu: ({ items, target, style, className }: ContextMenuProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
52
|
+
export declare const DEFAULT_CONTEXT_MENU: readonly ContextMenuItem[];
|
|
53
|
+
//# sourceMappingURL=context-menu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-menu.d.ts","sourceRoot":"","sources":["../src/context-menu.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,aAAa,EAElB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAKrD;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,GACvB;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,GAC5B;IACE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,kBAAkB,KAAK,OAAO,CAAC;IACxE,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,kBAAkB,KAAK,OAAO,CAAC;IACzE,QAAQ,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,kBAAkB,KAAK,IAAI,CAAC;CACrE,CAAC;AAEN,yEAAyE;AACzE,MAAM,WAAW,kBAAkB;IACjC,0DAA0D;IAC1D,QAAQ,CAAC,UAAU,EAAE;QAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAChE,kDAAkD;IAClD,QAAQ,CAAC,WAAW,EAAE;QAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAClE;AAOD;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,SAAS,eAAe,EAAE,CAAC;IAC3C;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,eAAO,MAAM,WAAW,GAAI,qCAAqC,gBAAgB,mDAmIhF,CAAC;AA6GF,eAAO,MAAM,oBAAoB,EAAE,SAAS,eAAe,EA2I1D,CAAC"}
|