@elaraai/east-ui-components 1.0.12 → 1.0.14

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/dist/index.js CHANGED
@@ -1170,8 +1170,13 @@ const globalCss = defineGlobalStyles({
1170
1170
  },
1171
1171
  /* ─── Drag & drop stages (drag-drop-visuals) ─────────────────────────
1172
1172
  * The DragLayerProvider drives these via data attributes; surfaces get
1173
- * the treatment for free by registering cells/sinks. */
1174
- "[data-dragging]": {
1173
+ * the treatment for free by registering cells/sinks.
1174
+ *
1175
+ * Scoped `:not([data-scope])` so it dims only our own drag origins —
1176
+ * Ark/Zag widgets (Slider, etc.) set `data-dragging` on themselves for
1177
+ * their own drag state and carry a `data-scope`; without this exclusion
1178
+ * a slider goes to 40% opacity while its thumb is dragged. */
1179
+ "[data-dragging]:not([data-scope])": {
1175
1180
  opacity: "0.4"
1176
1181
  },
1177
1182
  "[data-drag-ghost]": {
@@ -2991,9 +2996,13 @@ const schematicSlotRecipe = defineSlotRecipe({
2991
2996
  "root",
2992
2997
  "canvas",
2993
2998
  "grid",
2999
+ "cardLayer",
2994
3000
  "underlay",
2995
3001
  "zone",
2996
3002
  "zoneLabel",
3003
+ "zoneShapes",
3004
+ "zoneShapeLabel",
3005
+ "footprints",
2997
3006
  "item",
2998
3007
  "itemHead",
2999
3008
  "itemIcon",
@@ -3065,6 +3074,15 @@ const schematicSlotRecipe = defineSlotRecipe({
3065
3074
  linear-gradient(to right, color-mix(in oklch, {colors.border.subtle} 22%, transparent) 1px, transparent 1px),
3066
3075
  linear-gradient(to bottom, color-mix(in oklch, {colors.border.subtle} 22%, transparent) 1px, transparent 1px)`
3067
3076
  },
3077
+ /* Holds the live `--cam-ppu` / `--cam-tx` / `--cam-ty` custom
3078
+ * properties (written by applyCamera each frame). Transparent and
3079
+ * click-through; each card re-enables its own pointer events so the
3080
+ * full-cover layer never swallows canvas clicks (issue #57). */
3081
+ cardLayer: {
3082
+ position: "absolute",
3083
+ inset: "0",
3084
+ pointerEvents: "none"
3085
+ },
3068
3086
  /* Links draw in pixel space; tone → token mapping lives here so
3069
3087
  * data only ever names a tone. */
3070
3088
  underlay: {
@@ -3123,6 +3141,91 @@ const schematicSlotRecipe = defineSlotRecipe({
3123
3141
  paddingX: "{spacing.1}",
3124
3142
  whiteSpace: "nowrap"
3125
3143
  },
3144
+ /* Shaped zones (polyline / polygon) stroke in SVG so curves and
3145
+ * diagonals aren't confined to a div bounding box. Tone → token
3146
+ * mapping mirrors `underlay`; data only ever names a tone. These
3147
+ * are annotations like the rect zones — no pointer events. */
3148
+ zoneShapes: {
3149
+ position: "absolute",
3150
+ inset: "0",
3151
+ pointerEvents: "none",
3152
+ overflow: "visible",
3153
+ "& g[data-tone=brand]": { "--schematic-tone": "{colors.brand.600}" },
3154
+ "& g[data-tone=ink]": { "--schematic-tone": "{colors.fg}" },
3155
+ "& g[data-tone=muted]": { "--schematic-tone": "{colors.border.strong}" },
3156
+ "& g[data-tone=success]": { "--schematic-tone": "{colors.status.ok}" },
3157
+ "& g[data-tone=warning]": { "--schematic-tone": "{colors.status.warn}" },
3158
+ "& g[data-tone=danger]": { "--schematic-tone": "{colors.status.bad}" },
3159
+ "& path": {
3160
+ stroke: "var(--schematic-tone)",
3161
+ fill: "none",
3162
+ strokeLinejoin: "round"
3163
+ },
3164
+ /* Polygon outline echoes the dashed outline-rect zone. */
3165
+ "& path[data-shape=polygon]": {
3166
+ strokeWidth: "1px",
3167
+ strokeDasharray: "4 3"
3168
+ },
3169
+ /* Polyline is a run / road: a thin centre-line, or a soft band
3170
+ * when a world-space width is set inline. */
3171
+ "& path[data-shape=polyline]": {
3172
+ strokeWidth: "1.5px",
3173
+ strokeLinecap: "round",
3174
+ opacity: "0.55"
3175
+ }
3176
+ },
3177
+ /* Standalone eyebrow for a shaped zone — same look as `zoneLabel`
3178
+ * but positioned at the bbox top-left via inline coords. */
3179
+ zoneShapeLabel: {
3180
+ position: "absolute",
3181
+ transform: "translateY(-50%)",
3182
+ marginLeft: "{spacing.2}",
3183
+ fontFamily: "mono",
3184
+ fontSize: "9px",
3185
+ fontWeight: "600",
3186
+ letterSpacing: "0.14em",
3187
+ lineHeight: "normal",
3188
+ textTransform: "uppercase",
3189
+ color: "fg.muted",
3190
+ background: "bg.panel",
3191
+ paddingX: "{spacing.1}",
3192
+ whiteSpace: "nowrap",
3193
+ pointerEvents: "none"
3194
+ },
3195
+ /* Item footprints — the true shape body at close zoom (semantic
3196
+ * zoom). The path is clickable (selects the item); the card still
3197
+ * renders at the anchor, so no item info is lost. */
3198
+ footprints: {
3199
+ position: "absolute",
3200
+ inset: "0",
3201
+ pointerEvents: "none",
3202
+ overflow: "visible",
3203
+ "& g[data-tone=success]": { "--schematic-tone": "{colors.status.ok}" },
3204
+ "& g[data-tone=warning]": { "--schematic-tone": "{colors.status.warn}" },
3205
+ "& g[data-tone=danger]": { "--schematic-tone": "{colors.status.bad}" },
3206
+ "& g[data-tone=info]": { "--schematic-tone": "{colors.brand.500}" },
3207
+ "& g[data-tone=neutral]": { "--schematic-tone": "{colors.fg.muted}" },
3208
+ "& path": {
3209
+ stroke: "var(--schematic-tone)",
3210
+ strokeWidth: "1.5px",
3211
+ strokeLinejoin: "round",
3212
+ fill: "color-mix(in oklch, var(--schematic-tone) 12%, transparent)",
3213
+ cursor: "pointer",
3214
+ pointerEvents: "visiblePainted",
3215
+ transition: "fill {durations.fast}"
3216
+ },
3217
+ "& path[data-shape=polyline]": {
3218
+ fill: "none",
3219
+ strokeLinecap: "round"
3220
+ },
3221
+ "& g:hover path": {
3222
+ fill: "color-mix(in oklch, var(--schematic-tone) 20%, transparent)"
3223
+ },
3224
+ "& g[data-selected] path": {
3225
+ strokeWidth: "2.5px",
3226
+ fill: "color-mix(in oklch, var(--schematic-tone) 24%, transparent)"
3227
+ }
3228
+ },
3126
3229
  /* LOD tiers — constant screen-size markers over scaled geometry.
3127
3230
  * Items are the content layer: the darkest marks on the canvas at
3128
3231
  * every tier. */
@@ -3176,6 +3279,7 @@ const schematicSlotRecipe = defineSlotRecipe({
3176
3279
  item: {
3177
3280
  position: "absolute",
3178
3281
  transform: "translate(-50%, -50%)",
3282
+ pointerEvents: "auto",
3179
3283
  display: "flex",
3180
3284
  flexDirection: "column",
3181
3285
  gap: "2px",
@@ -3371,14 +3475,24 @@ const schematicSlotRecipe = defineSlotRecipe({
3371
3475
  minHeight: "0",
3372
3476
  overflowY: "auto",
3373
3477
  paddingBottom: "{spacing.2}",
3374
- lineHeight: "1.7"
3375
- },
3478
+ lineHeight: "1.7",
3479
+ // Row height shared by the sticky zone headers (their stacked `top`
3480
+ // offset is a multiple of this) so an ancestor chain pins flush.
3481
+ "--nav-row-h": "22px"
3482
+ },
3483
+ /* Zone headers pin to the top of the scroll area like a tree view: each
3484
+ * depth level sticks at `top = depth × --nav-row-h` (set inline), so the
3485
+ * area (and its ancestors) stays visible while you scroll its items.
3486
+ * The opaque surface + z-index occlude the items scrolling underneath. */
3376
3487
  navZone: {
3377
3488
  display: "flex",
3378
3489
  alignItems: "center",
3379
3490
  gap: "{spacing.1}",
3380
- paddingY: "2px",
3381
- paddingRight: "{spacing.3}"
3491
+ height: "var(--nav-row-h)",
3492
+ paddingRight: "{spacing.3}",
3493
+ position: "sticky",
3494
+ background: "bg.surface",
3495
+ zIndex: "1"
3382
3496
  },
3383
3497
  navCaret: {
3384
3498
  background: "transparent",
@@ -3425,6 +3539,9 @@ const schematicSlotRecipe = defineSlotRecipe({
3425
3539
  border: "none",
3426
3540
  paddingY: "2px",
3427
3541
  paddingRight: "{spacing.3}",
3542
+ // Keep the auto-scroll-to-selected item clear of the pinned zone
3543
+ // headers (up to two ancestor levels).
3544
+ scrollMarginTop: "calc(var(--nav-row-h) * 2)",
3428
3545
  fontFamily: "mono",
3429
3546
  fontSize: "11px",
3430
3547
  letterSpacing: "0.06em",
@@ -9422,7 +9539,7 @@ function transformForCss(_ref2) {
9422
9539
  return val;
9423
9540
  }
9424
9541
  var baseStyles = ":root, :host {\n --fa-font-solid: normal 900 1em/1 'Font Awesome 7 Free';\n --fa-font-regular: normal 400 1em/1 'Font Awesome 7 Free';\n --fa-font-light: normal 300 1em/1 'Font Awesome 7 Pro';\n --fa-font-thin: normal 100 1em/1 'Font Awesome 7 Pro';\n --fa-font-duotone: normal 900 1em/1 'Font Awesome 7 Duotone';\n --fa-font-duotone-regular: normal 400 1em/1 'Font Awesome 7 Duotone';\n --fa-font-duotone-light: normal 300 1em/1 'Font Awesome 7 Duotone';\n --fa-font-duotone-thin: normal 100 1em/1 'Font Awesome 7 Duotone';\n --fa-font-brands: normal 400 1em/1 'Font Awesome 7 Brands';\n --fa-font-sharp-solid: normal 900 1em/1 'Font Awesome 7 Sharp';\n --fa-font-sharp-regular: normal 400 1em/1 'Font Awesome 7 Sharp';\n --fa-font-sharp-light: normal 300 1em/1 'Font Awesome 7 Sharp';\n --fa-font-sharp-thin: normal 100 1em/1 'Font Awesome 7 Sharp';\n --fa-font-sharp-duotone-solid: normal 900 1em/1 'Font Awesome 7 Sharp Duotone';\n --fa-font-sharp-duotone-regular: normal 400 1em/1 'Font Awesome 7 Sharp Duotone';\n --fa-font-sharp-duotone-light: normal 300 1em/1 'Font Awesome 7 Sharp Duotone';\n --fa-font-sharp-duotone-thin: normal 100 1em/1 'Font Awesome 7 Sharp Duotone';\n --fa-font-slab-regular: normal 400 1em/1 'Font Awesome 7 Slab';\n --fa-font-slab-press-regular: normal 400 1em/1 'Font Awesome 7 Slab Press';\n --fa-font-whiteboard-semibold: normal 600 1em/1 'Font Awesome 7 Whiteboard';\n --fa-font-thumbprint-light: normal 300 1em/1 'Font Awesome 7 Thumbprint';\n --fa-font-notdog-solid: normal 900 1em/1 'Font Awesome 7 Notdog';\n --fa-font-notdog-duo-solid: normal 900 1em/1 'Font Awesome 7 Notdog Duo';\n --fa-font-etch-solid: normal 900 1em/1 'Font Awesome 7 Etch';\n --fa-font-graphite-thin: normal 100 1em/1 'Font Awesome 7 Graphite';\n --fa-font-jelly-regular: normal 400 1em/1 'Font Awesome 7 Jelly';\n --fa-font-jelly-fill-regular: normal 400 1em/1 'Font Awesome 7 Jelly Fill';\n --fa-font-jelly-duo-regular: normal 400 1em/1 'Font Awesome 7 Jelly Duo';\n --fa-font-chisel-regular: normal 400 1em/1 'Font Awesome 7 Chisel';\n --fa-font-utility-semibold: normal 600 1em/1 'Font Awesome 7 Utility';\n --fa-font-utility-duo-semibold: normal 600 1em/1 'Font Awesome 7 Utility Duo';\n --fa-font-utility-fill-semibold: normal 600 1em/1 'Font Awesome 7 Utility Fill';\n}\n\n.svg-inline--fa {\n box-sizing: content-box;\n display: var(--fa-display, inline-block);\n height: 1em;\n overflow: visible;\n vertical-align: -0.125em;\n width: var(--fa-width, 1.25em);\n}\n.svg-inline--fa.fa-2xs {\n vertical-align: 0.1em;\n}\n.svg-inline--fa.fa-xs {\n vertical-align: 0em;\n}\n.svg-inline--fa.fa-sm {\n vertical-align: -0.0714285714em;\n}\n.svg-inline--fa.fa-lg {\n vertical-align: -0.2em;\n}\n.svg-inline--fa.fa-xl {\n vertical-align: -0.25em;\n}\n.svg-inline--fa.fa-2xl {\n vertical-align: -0.3125em;\n}\n.svg-inline--fa.fa-pull-left,\n.svg-inline--fa .fa-pull-start {\n float: inline-start;\n margin-inline-end: var(--fa-pull-margin, 0.3em);\n}\n.svg-inline--fa.fa-pull-right,\n.svg-inline--fa .fa-pull-end {\n float: inline-end;\n margin-inline-start: var(--fa-pull-margin, 0.3em);\n}\n.svg-inline--fa.fa-li {\n width: var(--fa-li-width, 2em);\n inset-inline-start: calc(-1 * var(--fa-li-width, 2em));\n inset-block-start: 0.25em; /* syncing vertical alignment with Web Font rendering */\n}\n\n.fa-layers-counter, .fa-layers-text {\n display: inline-block;\n position: absolute;\n text-align: center;\n}\n\n.fa-layers {\n display: inline-block;\n height: 1em;\n position: relative;\n text-align: center;\n vertical-align: -0.125em;\n width: var(--fa-width, 1.25em);\n}\n.fa-layers .svg-inline--fa {\n inset: 0;\n margin: auto;\n position: absolute;\n transform-origin: center center;\n}\n\n.fa-layers-text {\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n transform-origin: center center;\n}\n\n.fa-layers-counter {\n background-color: var(--fa-counter-background-color, #ff253a);\n border-radius: var(--fa-counter-border-radius, 1em);\n box-sizing: border-box;\n color: var(--fa-inverse, #fff);\n line-height: var(--fa-counter-line-height, 1);\n max-width: var(--fa-counter-max-width, 5em);\n min-width: var(--fa-counter-min-width, 1.5em);\n overflow: hidden;\n padding: var(--fa-counter-padding, 0.25em 0.5em);\n right: var(--fa-right, 0);\n text-overflow: ellipsis;\n top: var(--fa-top, 0);\n transform: scale(var(--fa-counter-scale, 0.25));\n transform-origin: top right;\n}\n\n.fa-layers-bottom-right {\n bottom: var(--fa-bottom, 0);\n right: var(--fa-right, 0);\n top: auto;\n transform: scale(var(--fa-layers-scale, 0.25));\n transform-origin: bottom right;\n}\n\n.fa-layers-bottom-left {\n bottom: var(--fa-bottom, 0);\n left: var(--fa-left, 0);\n right: auto;\n top: auto;\n transform: scale(var(--fa-layers-scale, 0.25));\n transform-origin: bottom left;\n}\n\n.fa-layers-top-right {\n top: var(--fa-top, 0);\n right: var(--fa-right, 0);\n transform: scale(var(--fa-layers-scale, 0.25));\n transform-origin: top right;\n}\n\n.fa-layers-top-left {\n left: var(--fa-left, 0);\n right: auto;\n top: var(--fa-top, 0);\n transform: scale(var(--fa-layers-scale, 0.25));\n transform-origin: top left;\n}\n\n.fa-1x {\n font-size: 1em;\n}\n\n.fa-2x {\n font-size: 2em;\n}\n\n.fa-3x {\n font-size: 3em;\n}\n\n.fa-4x {\n font-size: 4em;\n}\n\n.fa-5x {\n font-size: 5em;\n}\n\n.fa-6x {\n font-size: 6em;\n}\n\n.fa-7x {\n font-size: 7em;\n}\n\n.fa-8x {\n font-size: 8em;\n}\n\n.fa-9x {\n font-size: 9em;\n}\n\n.fa-10x {\n font-size: 10em;\n}\n\n.fa-2xs {\n font-size: calc(10 / 16 * 1em); /* converts a 10px size into an em-based value that's relative to the scale's 16px base */\n line-height: calc(1 / 10 * 1em); /* sets the line-height of the icon back to that of it's parent */\n vertical-align: calc((6 / 10 - 0.375) * 1em); /* vertically centers the icon taking into account the surrounding text's descender */\n}\n\n.fa-xs {\n font-size: calc(12 / 16 * 1em); /* converts a 12px size into an em-based value that's relative to the scale's 16px base */\n line-height: calc(1 / 12 * 1em); /* sets the line-height of the icon back to that of it's parent */\n vertical-align: calc((6 / 12 - 0.375) * 1em); /* vertically centers the icon taking into account the surrounding text's descender */\n}\n\n.fa-sm {\n font-size: calc(14 / 16 * 1em); /* converts a 14px size into an em-based value that's relative to the scale's 16px base */\n line-height: calc(1 / 14 * 1em); /* sets the line-height of the icon back to that of it's parent */\n vertical-align: calc((6 / 14 - 0.375) * 1em); /* vertically centers the icon taking into account the surrounding text's descender */\n}\n\n.fa-lg {\n font-size: calc(20 / 16 * 1em); /* converts a 20px size into an em-based value that's relative to the scale's 16px base */\n line-height: calc(1 / 20 * 1em); /* sets the line-height of the icon back to that of it's parent */\n vertical-align: calc((6 / 20 - 0.375) * 1em); /* vertically centers the icon taking into account the surrounding text's descender */\n}\n\n.fa-xl {\n font-size: calc(24 / 16 * 1em); /* converts a 24px size into an em-based value that's relative to the scale's 16px base */\n line-height: calc(1 / 24 * 1em); /* sets the line-height of the icon back to that of it's parent */\n vertical-align: calc((6 / 24 - 0.375) * 1em); /* vertically centers the icon taking into account the surrounding text's descender */\n}\n\n.fa-2xl {\n font-size: calc(32 / 16 * 1em); /* converts a 32px size into an em-based value that's relative to the scale's 16px base */\n line-height: calc(1 / 32 * 1em); /* sets the line-height of the icon back to that of it's parent */\n vertical-align: calc((6 / 32 - 0.375) * 1em); /* vertically centers the icon taking into account the surrounding text's descender */\n}\n\n.fa-width-auto {\n --fa-width: auto;\n}\n\n.fa-fw,\n.fa-width-fixed {\n --fa-width: 1.25em;\n}\n\n.fa-ul {\n list-style-type: none;\n margin-inline-start: var(--fa-li-margin, 2.5em);\n padding-inline-start: 0;\n}\n.fa-ul > li {\n position: relative;\n}\n\n.fa-li {\n inset-inline-start: calc(-1 * var(--fa-li-width, 2em));\n position: absolute;\n text-align: center;\n width: var(--fa-li-width, 2em);\n line-height: inherit;\n}\n\n/* Heads Up: Bordered Icons will not be supported in the future!\n - This feature will be deprecated in the next major release of Font Awesome (v8)!\n - You may continue to use it in this version *v7), but it will not be supported in Font Awesome v8.\n*/\n/* Notes:\n* --@{v.$css-prefix}-border-width = 1/16 by default (to render as ~1px based on a 16px default font-size)\n* --@{v.$css-prefix}-border-padding =\n ** 3/16 for vertical padding (to give ~2px of vertical whitespace around an icon considering it's vertical alignment)\n ** 4/16 for horizontal padding (to give ~4px of horizontal whitespace around an icon)\n*/\n.fa-border {\n border-color: var(--fa-border-color, #eee);\n border-radius: var(--fa-border-radius, 0.1em);\n border-style: var(--fa-border-style, solid);\n border-width: var(--fa-border-width, 0.0625em);\n box-sizing: var(--fa-border-box-sizing, content-box);\n padding: var(--fa-border-padding, 0.1875em 0.25em);\n}\n\n.fa-pull-left,\n.fa-pull-start {\n float: inline-start;\n margin-inline-end: var(--fa-pull-margin, 0.3em);\n}\n\n.fa-pull-right,\n.fa-pull-end {\n float: inline-end;\n margin-inline-start: var(--fa-pull-margin, 0.3em);\n}\n\n.fa-beat {\n animation-name: fa-beat;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, ease-in-out);\n}\n\n.fa-bounce {\n animation-name: fa-bounce;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.28, 0.84, 0.42, 1));\n}\n\n.fa-fade {\n animation-name: fa-fade;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));\n}\n\n.fa-beat-fade {\n animation-name: fa-beat-fade;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));\n}\n\n.fa-flip {\n animation-name: fa-flip;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, ease-in-out);\n}\n\n.fa-shake {\n animation-name: fa-shake;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, linear);\n}\n\n.fa-spin {\n animation-name: fa-spin;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 2s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, linear);\n}\n\n.fa-spin-reverse {\n --fa-animation-direction: reverse;\n}\n\n.fa-pulse,\n.fa-spin-pulse {\n animation-name: fa-spin;\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, steps(8));\n}\n\n@media (prefers-reduced-motion: reduce) {\n .fa-beat,\n .fa-bounce,\n .fa-fade,\n .fa-beat-fade,\n .fa-flip,\n .fa-pulse,\n .fa-shake,\n .fa-spin,\n .fa-spin-pulse {\n animation: none !important;\n transition: none !important;\n }\n}\n@keyframes fa-beat {\n 0%, 90% {\n transform: scale(1);\n }\n 45% {\n transform: scale(var(--fa-beat-scale, 1.25));\n }\n}\n@keyframes fa-bounce {\n 0% {\n transform: scale(1, 1) translateY(0);\n }\n 10% {\n transform: scale(var(--fa-bounce-start-scale-x, 1.1), var(--fa-bounce-start-scale-y, 0.9)) translateY(0);\n }\n 30% {\n transform: scale(var(--fa-bounce-jump-scale-x, 0.9), var(--fa-bounce-jump-scale-y, 1.1)) translateY(var(--fa-bounce-height, -0.5em));\n }\n 50% {\n transform: scale(var(--fa-bounce-land-scale-x, 1.05), var(--fa-bounce-land-scale-y, 0.95)) translateY(0);\n }\n 57% {\n transform: scale(1, 1) translateY(var(--fa-bounce-rebound, -0.125em));\n }\n 64% {\n transform: scale(1, 1) translateY(0);\n }\n 100% {\n transform: scale(1, 1) translateY(0);\n }\n}\n@keyframes fa-fade {\n 50% {\n opacity: var(--fa-fade-opacity, 0.4);\n }\n}\n@keyframes fa-beat-fade {\n 0%, 100% {\n opacity: var(--fa-beat-fade-opacity, 0.4);\n transform: scale(1);\n }\n 50% {\n opacity: 1;\n transform: scale(var(--fa-beat-fade-scale, 1.125));\n }\n}\n@keyframes fa-flip {\n 50% {\n transform: rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), var(--fa-flip-angle, -180deg));\n }\n}\n@keyframes fa-shake {\n 0% {\n transform: rotate(-15deg);\n }\n 4% {\n transform: rotate(15deg);\n }\n 8%, 24% {\n transform: rotate(-18deg);\n }\n 12%, 28% {\n transform: rotate(18deg);\n }\n 16% {\n transform: rotate(-22deg);\n }\n 20% {\n transform: rotate(22deg);\n }\n 32% {\n transform: rotate(-12deg);\n }\n 36% {\n transform: rotate(12deg);\n }\n 40%, 100% {\n transform: rotate(0deg);\n }\n}\n@keyframes fa-spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n.fa-rotate-90 {\n transform: rotate(90deg);\n}\n\n.fa-rotate-180 {\n transform: rotate(180deg);\n}\n\n.fa-rotate-270 {\n transform: rotate(270deg);\n}\n\n.fa-flip-horizontal {\n transform: scale(-1, 1);\n}\n\n.fa-flip-vertical {\n transform: scale(1, -1);\n}\n\n.fa-flip-both,\n.fa-flip-horizontal.fa-flip-vertical {\n transform: scale(-1, -1);\n}\n\n.fa-rotate-by {\n transform: rotate(var(--fa-rotate-angle, 0));\n}\n\n.svg-inline--fa .fa-primary {\n fill: var(--fa-primary-color, currentColor);\n opacity: var(--fa-primary-opacity, 1);\n}\n\n.svg-inline--fa .fa-secondary {\n fill: var(--fa-secondary-color, currentColor);\n opacity: var(--fa-secondary-opacity, 0.4);\n}\n\n.svg-inline--fa.fa-swap-opacity .fa-primary {\n opacity: var(--fa-secondary-opacity, 0.4);\n}\n\n.svg-inline--fa.fa-swap-opacity .fa-secondary {\n opacity: var(--fa-primary-opacity, 1);\n}\n\n.svg-inline--fa mask .fa-primary,\n.svg-inline--fa mask .fa-secondary {\n fill: black;\n}\n\n.svg-inline--fa.fa-inverse {\n fill: var(--fa-inverse, #fff);\n}\n\n.fa-stack {\n display: inline-block;\n height: 2em;\n line-height: 2em;\n position: relative;\n vertical-align: middle;\n width: 2.5em;\n}\n\n.fa-inverse {\n color: var(--fa-inverse, #fff);\n}\n\n.svg-inline--fa.fa-stack-1x {\n --fa-width: 1.25em;\n height: 1em;\n width: var(--fa-width);\n}\n.svg-inline--fa.fa-stack-2x {\n --fa-width: 2.5em;\n height: 2em;\n width: var(--fa-width);\n}\n\n.fa-stack-1x,\n.fa-stack-2x {\n inset: 0;\n margin: auto;\n position: absolute;\n z-index: var(--fa-stack-z-index, auto);\n}";
9425
- function css() {
9542
+ function css$1() {
9426
9543
  var dcp = DEFAULT_CSS_PREFIX;
9427
9544
  var drc = DEFAULT_REPLACEMENT_CLASS;
9428
9545
  var fp = config.cssPrefix;
@@ -9439,7 +9556,7 @@ function css() {
9439
9556
  var _cssInserted = false;
9440
9557
  function ensureCss() {
9441
9558
  if (config.autoAddCss && !_cssInserted) {
9442
- insertCss(css());
9559
+ insertCss(css$1());
9443
9560
  _cssInserted = true;
9444
9561
  }
9445
9562
  }
@@ -9447,7 +9564,7 @@ var InjectCSS = {
9447
9564
  mixout: function mixout() {
9448
9565
  return {
9449
9566
  dom: {
9450
- css,
9567
+ css: css$1,
9451
9568
  insertCss: ensureCss
9452
9569
  }
9453
9570
  };
@@ -61515,23 +61632,123 @@ function multiSelect(arr, left, right, n2, compare) {
61515
61632
  stack.push(left, mid, mid, right);
61516
61633
  }
61517
61634
  }
61518
- library$1.add(icons$2);
61519
- const schematicEqual = equalFor(Schematic.Types.Schematic);
61520
61635
  const IDENTITY = { zoom: 1, tx: 0, ty: 0 };
61521
- const MAX_ZOOM = 40;
61522
- const LOD_CARD_PPU = 30;
61523
- const LOD_LABEL_PPU = 16;
61524
- const MINIMAP_AUTO = 25;
61525
- function statusTone(status) {
61526
- return status.type === "some" ? status.value.type : void 0;
61636
+ function project(x2, y2, cam) {
61637
+ return { sx: x2 * cam.ppu + cam.tx, sy: y2 * cam.ppu + cam.ty };
61527
61638
  }
61528
- function niceScaleLength(ppu, targetPx) {
61529
- const target = targetPx / ppu;
61530
- const pow2 = Math.pow(10, Math.floor(Math.log10(target)));
61531
- for (const m2 of [5, 2, 1]) {
61532
- if (m2 * pow2 <= target) return m2 * pow2;
61639
+ function cardTranslateCss(x2, y2) {
61640
+ return `translate(calc(var(--cam-ppu) * ${x2} * 1px + var(--cam-tx)), calc(var(--cam-ppu) * ${y2} * 1px + var(--cam-ty)))`;
61641
+ }
61642
+ function cardWidthCss(width) {
61643
+ return `calc(var(--cam-ppu) * ${width} * 1px)`;
61644
+ }
61645
+ function viewportWorldBbox(cam, width, height) {
61646
+ return {
61647
+ minX: -cam.tx / cam.ppu,
61648
+ minY: -cam.ty / cam.ppu,
61649
+ maxX: (width - cam.tx) / cam.ppu,
61650
+ maxY: (height - cam.ty) / cam.ppu
61651
+ };
61652
+ }
61653
+ function bboxOverlaps(a2, b2) {
61654
+ return a2.maxX >= b2.minX && a2.minX <= b2.maxX && a2.maxY >= b2.minY && a2.minY <= b2.maxY;
61655
+ }
61656
+ function pointsBbox(pts) {
61657
+ if (pts.length === 0) return null;
61658
+ let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
61659
+ for (const p2 of pts) {
61660
+ if (p2.x < minX) minX = p2.x;
61661
+ if (p2.y < minY) minY = p2.y;
61662
+ if (p2.x > maxX) maxX = p2.x;
61663
+ if (p2.y > maxY) maxY = p2.y;
61664
+ }
61665
+ return { minX, minY, maxX, maxY };
61666
+ }
61667
+ function zoomAbout(prev, factor, px, py, min2, max2) {
61668
+ const zoom = Math.max(min2, Math.min(max2, prev.zoom * factor));
61669
+ if (zoom === 1) return IDENTITY;
61670
+ const k2 = zoom / prev.zoom;
61671
+ return { zoom, tx: px - k2 * (px - prev.tx), ty: py - k2 * (py - prev.ty) };
61672
+ }
61673
+ function nextMode(mode, event) {
61674
+ switch (event) {
61675
+ case "pointerDown":
61676
+ return "panning";
61677
+ case "wheel":
61678
+ return "wheeling";
61679
+ case "zoom":
61680
+ return "wheeling";
61681
+ case "flyStart":
61682
+ return "flying";
61683
+ case "pointerUp":
61684
+ return mode === "panning" ? "idle" : mode;
61685
+ case "flyEnd":
61686
+ return mode === "flying" ? "idle" : mode;
61687
+ case "cancel":
61688
+ return "idle";
61689
+ }
61690
+ }
61691
+ function cancelsFly(mode, event) {
61692
+ return mode === "flying" && (event === "pointerDown" || event === "wheel" || event === "zoom" || event === "cancel");
61693
+ }
61694
+ function makeRafCoalescer(schedule, cancel) {
61695
+ let handle2 = null;
61696
+ return {
61697
+ request(run) {
61698
+ if (handle2 !== null) return;
61699
+ handle2 = schedule(() => {
61700
+ handle2 = null;
61701
+ run();
61702
+ });
61703
+ },
61704
+ cancel() {
61705
+ if (handle2 !== null) {
61706
+ cancel(handle2);
61707
+ handle2 = null;
61708
+ }
61709
+ }
61710
+ };
61711
+ }
61712
+ const css = (c2, a2 = 1) => a2 >= 1 ? `rgb(${c2[0]},${c2[1]},${c2[2]})` : `rgba(${c2[0]},${c2[1]},${c2[2]},${a2})`;
61713
+ function toneRGB(p2, tone, kind) {
61714
+ switch (tone) {
61715
+ case "brand":
61716
+ return p2.brand600;
61717
+ case "ink":
61718
+ return p2.fg;
61719
+ case "muted":
61720
+ return kind === "zone" ? p2.borderStrong : p2.fgMuted;
61721
+ case "success":
61722
+ return p2.statusOk;
61723
+ case "warning":
61724
+ return p2.statusWarn;
61725
+ case "danger":
61726
+ return p2.statusBad;
61727
+ default:
61728
+ return p2.fgMuted;
61729
+ }
61730
+ }
61731
+ function statusRGB(p2, status) {
61732
+ switch (status) {
61733
+ case "success":
61734
+ return p2.statusOk;
61735
+ case "warning":
61736
+ return p2.statusWarn;
61737
+ case "danger":
61738
+ return p2.statusBad;
61739
+ case "info":
61740
+ return p2.brand500;
61741
+ default:
61742
+ return p2.fgMuted;
61533
61743
  }
61534
- return pow2;
61744
+ }
61745
+ function statusTone$1(status) {
61746
+ return status.type === "some" ? status.value.type : void 0;
61747
+ }
61748
+ function resolveTint(p2, color2, tone, fallback) {
61749
+ if (color2 !== void 0) return color2;
61750
+ if (tone !== void 0) return css(toneRGB(p2, tone, "link"));
61751
+ return css(fallback);
61535
61752
  }
61536
61753
  function orthogonalize(points) {
61537
61754
  const out = [];
@@ -61544,26 +61761,410 @@ function orthogonalize(points) {
61544
61761
  }
61545
61762
  return out;
61546
61763
  }
61547
- function roundedPath(pts, radius) {
61548
- if (pts.length === 0) return "";
61549
- let d2 = `M ${pts[0].x} ${pts[0].y}`;
61764
+ function traceRounded(ctx, pts, radius) {
61765
+ if (pts.length === 0) return;
61766
+ ctx.moveTo(pts[0].x, pts[0].y);
61550
61767
  for (let i2 = 1; i2 < pts.length - 1; i2++) {
61551
61768
  const p2 = pts[i2], a2 = pts[i2 - 1], b2 = pts[i2 + 1];
61552
61769
  const inLen = Math.hypot(p2.x - a2.x, p2.y - a2.y);
61553
61770
  const outLen = Math.hypot(b2.x - p2.x, b2.y - p2.y);
61554
61771
  const r2 = Math.min(radius, inLen / 2, outLen / 2);
61555
61772
  if (r2 < 0.5) {
61556
- d2 += ` L ${p2.x} ${p2.y}`;
61773
+ ctx.lineTo(p2.x, p2.y);
61557
61774
  continue;
61558
61775
  }
61559
61776
  const inU = { x: (p2.x - a2.x) / inLen, y: (p2.y - a2.y) / inLen };
61560
- const outU = { x: (b2.x - p2.x) / outLen, y: (b2.y - p2.y) / outLen };
61561
- d2 += ` L ${p2.x - inU.x * r2} ${p2.y - inU.y * r2}`;
61562
- d2 += ` Q ${p2.x} ${p2.y} ${p2.x + outU.x * r2} ${p2.y + outU.y * r2}`;
61777
+ ctx.lineTo(p2.x - inU.x * r2, p2.y - inU.y * r2);
61778
+ ctx.quadraticCurveTo(p2.x, p2.y, p2.x + (b2.x - p2.x) / outLen * r2, p2.y + (b2.y - p2.y) / outLen * r2);
61563
61779
  }
61564
61780
  const last = pts[pts.length - 1];
61565
- if (pts.length > 1) d2 += ` L ${last.x} ${last.y}`;
61566
- return d2;
61781
+ if (pts.length > 1) ctx.lineTo(last.x, last.y);
61782
+ }
61783
+ function arcFromBulge(p1, p2, bulge) {
61784
+ const dx = p2.x - p1.x, dy = p2.y - p1.y;
61785
+ const chord = Math.hypot(dx, dy);
61786
+ if (Math.abs(bulge) < 1e-4 || chord < 1e-9) return null;
61787
+ const theta = 4 * Math.atan(bulge);
61788
+ const radius = Math.abs(chord / (2 * Math.sin(theta / 2)));
61789
+ const mx = (p1.x + p2.x) / 2, my = (p1.y + p2.y) / 2;
61790
+ const d2 = chord / 2 / Math.tan(theta / 2);
61791
+ const cx2 = mx - dy / chord * d2, cy = my + dx / chord * d2;
61792
+ if (!Number.isFinite(radius) || !Number.isFinite(d2) || !Number.isFinite(cx2) || !Number.isFinite(cy)) return null;
61793
+ return {
61794
+ cx: cx2,
61795
+ cy,
61796
+ radius,
61797
+ startAngle: Math.atan2(p1.y - cy, p1.x - cx2),
61798
+ endAngle: Math.atan2(p2.y - cy, p2.x - cx2),
61799
+ anticlockwise: theta < 0
61800
+ };
61801
+ }
61802
+ function traceBulge(ctx, p1, p2, bulge) {
61803
+ const arc = arcFromBulge(p1, p2, bulge);
61804
+ if (arc === null) {
61805
+ ctx.lineTo(p2.x, p2.y);
61806
+ return;
61807
+ }
61808
+ ctx.arc(arc.cx, arc.cy, arc.radius, arc.startAngle, arc.endAngle, arc.anticlockwise);
61809
+ }
61810
+ function traceVertices(ctx, pts, closed) {
61811
+ if (pts.length === 0) return;
61812
+ ctx.moveTo(pts[0].x, pts[0].y);
61813
+ for (let i2 = 1; i2 < pts.length; i2++) traceBulge(ctx, pts[i2 - 1], pts[i2], pts[i2 - 1].bulge);
61814
+ if (closed) {
61815
+ const last = pts[pts.length - 1];
61816
+ traceBulge(ctx, last, pts[0], last.bulge);
61817
+ ctx.closePath();
61818
+ }
61819
+ }
61820
+ const MARKER_LABEL_FONT = '600 10px ui-monospace, "SF Mono", Menlo, monospace';
61821
+ const MARKER_DOT_RADIUS = 5;
61822
+ const MARKER_DOT_HIT_RADIUS = 10;
61823
+ const MARKER_PIN_PAD_X = 6, MARKER_PIN_DOT_W = 7, MARKER_PIN_GAP = 4, MARKER_PIN_H = 16;
61824
+ function markerHitbox(item, tier, cam, measure) {
61825
+ const { sx, sy } = project(item.x, item.y, cam);
61826
+ if (tier === "dot") return { kind: "circle", cx: sx, cy: sy, r: MARKER_DOT_HIT_RADIUS };
61827
+ const tw = measure(item.label);
61828
+ const w2 = MARKER_PIN_PAD_X + MARKER_PIN_DOT_W + MARKER_PIN_GAP + tw + MARKER_PIN_PAD_X;
61829
+ return { kind: "rect", left: sx - w2 / 2, top: sy - MARKER_PIN_H / 2, w: w2, h: MARKER_PIN_H };
61830
+ }
61831
+ function markerHit(box, sx, sy) {
61832
+ return box.kind === "circle" ? Math.hypot(sx - box.cx, sy - box.cy) <= box.r : sx >= box.left && sx <= box.left + box.w && sy >= box.top && sy <= box.top + box.h;
61833
+ }
61834
+ function hatchSpacing(rawSpacing) {
61835
+ return Number.isFinite(rawSpacing) ? Math.max(1, rawSpacing) : 1;
61836
+ }
61837
+ function hatchSweepBounds(x2, y2, w2, h2, width, height, dx, dy, diag, spacing) {
61838
+ const nx = -dy, ny = dx;
61839
+ if (Math.abs(nx) <= 1e-6) return { oStart: -diag, oEnd: diag };
61840
+ const cx0 = Math.max(x2, 0), cy0 = Math.max(y2, 0);
61841
+ const cx1 = Math.min(x2 + w2, width), cy1 = Math.min(y2 + h2, height);
61842
+ const cs = [cx0 * nx + cy0 * ny, cx1 * nx + cy0 * ny, cx0 * nx + cy1 * ny, cx1 * nx + cy1 * ny];
61843
+ const oOfC = (c2) => (c2 - x2 * nx - (y2 - diag * dy) * ny) / nx;
61844
+ const oA = oOfC(Math.min(...cs)), oB = oOfC(Math.max(...cs));
61845
+ return {
61846
+ oStart: Math.max(-diag, -diag + Math.floor((Math.min(oA, oB) + diag) / spacing) * spacing - spacing),
61847
+ oEnd: Math.min(diag, Math.max(oA, oB) + spacing)
61848
+ };
61849
+ }
61850
+ function zoneWorldBbox(zone, geom) {
61851
+ const bb = { minX: zone.x, minY: zone.y, maxX: zone.x + zone.width, maxY: zone.y + zone.height };
61852
+ if (geom !== void 0 && geom.type === "circle") {
61853
+ const cx2 = zone.x + zone.width / 2, cy = zone.y + zone.height / 2, r2 = geom.value.radius;
61854
+ bb.minX = Math.min(bb.minX, cx2 - r2);
61855
+ bb.minY = Math.min(bb.minY, cy - r2);
61856
+ bb.maxX = Math.max(bb.maxX, cx2 + r2);
61857
+ bb.maxY = Math.max(bb.maxY, cy + r2);
61858
+ } else if (geom !== void 0 && geom.type !== "rect") {
61859
+ const g2 = pointsBbox(geom.value.vertices);
61860
+ if (g2 !== null) {
61861
+ bb.minX = Math.min(bb.minX, g2.minX);
61862
+ bb.minY = Math.min(bb.minY, g2.minY);
61863
+ bb.maxX = Math.max(bb.maxX, g2.maxX);
61864
+ bb.maxY = Math.max(bb.maxY, g2.maxY);
61865
+ }
61866
+ }
61867
+ return bb;
61868
+ }
61869
+ function paintSchematic(input) {
61870
+ var _a2, _b, _c, _d;
61871
+ const { ctx, value, cam, width, height, visibleItems, tiers, selected, centers, palette: p2 } = input;
61872
+ const wx = (x2) => x2 * cam.ppu + cam.tx;
61873
+ const wy = (y2) => y2 * cam.ppu + cam.ty;
61874
+ const ppu = cam.ppu;
61875
+ const viewBbox = viewportWorldBbox(cam, width, height);
61876
+ ctx.save();
61877
+ ctx.setTransform(1, 0, 0, 1, 0, 0);
61878
+ ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
61879
+ ctx.restore();
61880
+ ctx.lineJoin = "round";
61881
+ for (const zone of value.zones) {
61882
+ const geom = getSomeorUndefined(zone.geometry);
61883
+ if (!bboxOverlaps(zoneWorldBbox(zone, geom), viewBbox)) continue;
61884
+ const pattern = zone.pattern;
61885
+ const patternTone = (pattern.value.tone.type === "some" ? pattern.value.tone.value.type : void 0) ?? "muted";
61886
+ const tint = resolveTint(p2, getSomeorUndefined(zone.color), (_a2 = getSomeorUndefined(zone.tone)) == null ? void 0 : _a2.type, toneRGB(p2, patternTone, "zone"));
61887
+ const zbg = getSomeorUndefined(zone.bg);
61888
+ const zFillAlpha = getSomeorUndefined(zone.fillOpacity) ?? 0.15;
61889
+ const zWeight = getSomeorUndefined(zone.weight);
61890
+ const x2 = wx(zone.x), y2 = wy(zone.y), w2 = zone.width * ppu, h2 = zone.height * ppu;
61891
+ const fillShape = () => {
61892
+ if (zbg === void 0) return;
61893
+ ctx.save();
61894
+ ctx.globalAlpha = zFillAlpha;
61895
+ ctx.fillStyle = zbg;
61896
+ ctx.fill();
61897
+ ctx.restore();
61898
+ };
61899
+ if (geom !== void 0 && geom.type !== "rect") {
61900
+ if (geom.type === "circle") {
61901
+ ctx.beginPath();
61902
+ ctx.arc(x2 + w2 / 2, y2 + h2 / 2, geom.value.radius * ppu, 0, Math.PI * 2);
61903
+ fillShape();
61904
+ ctx.setLineDash([4, 3]);
61905
+ ctx.lineWidth = zWeight ?? 1;
61906
+ ctx.strokeStyle = tint;
61907
+ ctx.stroke();
61908
+ ctx.setLineDash([]);
61909
+ } else {
61910
+ const pts = geom.value.vertices.map((q) => ({ x: wx(q.x), y: wy(q.y), bulge: q.bulge }));
61911
+ if (pts.length > 0) {
61912
+ ctx.beginPath();
61913
+ if (geom.type === "polygon") {
61914
+ traceVertices(ctx, pts, true);
61915
+ fillShape();
61916
+ ctx.setLineDash([4, 3]);
61917
+ ctx.lineWidth = zWeight ?? 1;
61918
+ ctx.strokeStyle = tint;
61919
+ ctx.stroke();
61920
+ ctx.setLineDash([]);
61921
+ } else {
61922
+ traceVertices(ctx, pts, false);
61923
+ const band2 = geom.value.width.type === "some" ? geom.value.width.value * ppu : void 0;
61924
+ ctx.setLineDash([]);
61925
+ ctx.lineCap = "round";
61926
+ ctx.lineWidth = zWeight ?? band2 ?? 1.5;
61927
+ ctx.save();
61928
+ ctx.globalAlpha = 0.55;
61929
+ ctx.strokeStyle = tint;
61930
+ ctx.stroke();
61931
+ ctx.restore();
61932
+ ctx.lineCap = "butt";
61933
+ }
61934
+ }
61935
+ }
61936
+ } else if (pattern.type === "hatch") {
61937
+ const spacing = hatchSpacing(getSomeorUndefined(pattern.value.spacing) ?? 8);
61938
+ const angle = (getSomeorUndefined(pattern.value.angle) ?? 45) * Math.PI / 180;
61939
+ ctx.save();
61940
+ ctx.beginPath();
61941
+ ctx.rect(x2, y2, w2, h2);
61942
+ ctx.clip();
61943
+ if (zbg !== void 0) {
61944
+ ctx.save();
61945
+ ctx.globalAlpha = zFillAlpha;
61946
+ ctx.fillStyle = zbg;
61947
+ ctx.fillRect(x2, y2, w2, h2);
61948
+ ctx.restore();
61949
+ }
61950
+ ctx.globalAlpha = 0.3;
61951
+ ctx.strokeStyle = tint;
61952
+ ctx.lineWidth = zWeight ?? 1;
61953
+ const dx = Math.cos(angle), dy = Math.sin(angle);
61954
+ const diag = Math.hypot(w2, h2);
61955
+ const { oStart, oEnd } = hatchSweepBounds(x2, y2, w2, h2, width, height, dx, dy, diag, spacing);
61956
+ ctx.beginPath();
61957
+ for (let o2 = oStart; o2 < oEnd; o2 += spacing) {
61958
+ ctx.moveTo(x2 + o2, y2 - diag * dy);
61959
+ ctx.lineTo(x2 + o2 + dx * 2 * diag, y2 - diag * dy + dy * 2 * diag);
61960
+ }
61961
+ ctx.stroke();
61962
+ ctx.restore();
61963
+ } else {
61964
+ if (zbg !== void 0) {
61965
+ ctx.save();
61966
+ ctx.globalAlpha = zFillAlpha;
61967
+ ctx.fillStyle = zbg;
61968
+ ctx.fillRect(x2, y2, w2, h2);
61969
+ ctx.restore();
61970
+ }
61971
+ ctx.setLineDash([5, 4]);
61972
+ ctx.lineWidth = zWeight ?? 1;
61973
+ ctx.strokeStyle = tint;
61974
+ ctx.strokeRect(x2, y2, w2, h2);
61975
+ ctx.setLineDash([]);
61976
+ }
61977
+ if (w2 >= zone.label.length * 6.2 + 24) {
61978
+ ctx.font = '600 9px ui-monospace, "SF Mono", Menlo, monospace';
61979
+ const label = zone.label.toUpperCase();
61980
+ const tw = ctx.measureText(label).width;
61981
+ ctx.fillStyle = css(p2.bgPanel);
61982
+ ctx.fillRect(x2 + 6, y2 - 7, tw + 6, 12);
61983
+ ctx.fillStyle = css(p2.fgMuted);
61984
+ ctx.textBaseline = "middle";
61985
+ ctx.fillText(label, x2 + 9, y2);
61986
+ }
61987
+ }
61988
+ for (const link2 of value.links) {
61989
+ const from = centers.get(link2.from), to = centers.get(link2.to);
61990
+ if (!from || !to) continue;
61991
+ const linkBbox = pointsBbox([from, ...link2.via, to]);
61992
+ if (linkBbox !== null && !bboxOverlaps(linkBbox, viewBbox)) continue;
61993
+ const anchors = [from, ...link2.via, to].map((q) => ({ x: wx(q.x), y: wy(q.y) }));
61994
+ const corner = link2.route.type === "orthogonal" ? link2.route.value.corner.type === "some" ? link2.route.value.corner.value : 8 : 0;
61995
+ const pts = link2.route.type === "orthogonal" ? orthogonalize(anchors) : anchors;
61996
+ const style = link2.style;
61997
+ const tone = (style.value.tone.type === "some" ? style.value.tone.value.type : void 0) ?? (style.type === "solid" ? "brand" : "muted");
61998
+ const weight = style.value.weight.type === "some" ? style.value.weight.value : style.type === "solid" ? 2.5 : 1.5;
61999
+ const color2 = toneRGB(p2, tone, "link");
62000
+ ctx.lineCap = "round";
62001
+ ctx.strokeStyle = css(color2);
62002
+ ctx.lineWidth = weight;
62003
+ ctx.setLineDash(style.type === "dashed" ? [6, 5] : []);
62004
+ ctx.beginPath();
62005
+ traceRounded(ctx, pts, corner);
62006
+ ctx.stroke();
62007
+ ctx.setLineDash([]);
62008
+ ctx.fillStyle = css(color2);
62009
+ for (const end3 of [anchors[0], anchors[anchors.length - 1]]) {
62010
+ ctx.beginPath();
62011
+ ctx.arc(end3.x, end3.y, weight + 1.5, 0, Math.PI * 2);
62012
+ ctx.fill();
62013
+ }
62014
+ ctx.lineCap = "butt";
62015
+ }
62016
+ for (const item of visibleItems) {
62017
+ const footprint = getSomeorUndefined(item.footprint);
62018
+ if (footprint === void 0 || footprint.type === "rect") continue;
62019
+ if ((tiers.get(item.key) ?? "dot") !== "card") continue;
62020
+ const isSel = selected === item.key;
62021
+ const tint = resolveTint(p2, getSomeorUndefined(item.color), (_b = getSomeorUndefined(item.tone)) == null ? void 0 : _b.type, statusRGB(p2, statusTone$1(item.status)));
62022
+ const ibg = getSomeorUndefined(item.bg);
62023
+ const fillAlpha = getSomeorUndefined(item.fillOpacity) ?? (isSel ? 0.24 : 0.12);
62024
+ const stroke = getSomeorUndefined(item.weight) ?? (isSel ? 2.5 : 1.5);
62025
+ const fillShape = () => {
62026
+ ctx.save();
62027
+ ctx.globalAlpha = fillAlpha;
62028
+ ctx.fillStyle = ibg ?? tint;
62029
+ ctx.fill();
62030
+ ctx.restore();
62031
+ };
62032
+ if (footprint.type === "circle") {
62033
+ ctx.beginPath();
62034
+ ctx.arc(wx(item.x), wy(item.y), footprint.value.radius * ppu, 0, Math.PI * 2);
62035
+ fillShape();
62036
+ ctx.lineWidth = stroke;
62037
+ ctx.strokeStyle = tint;
62038
+ ctx.stroke();
62039
+ continue;
62040
+ }
62041
+ const pts = footprint.value.vertices.map((q) => ({ x: wx(q.x), y: wy(q.y), bulge: q.bulge }));
62042
+ if (pts.length === 0) continue;
62043
+ ctx.beginPath();
62044
+ if (footprint.type === "polygon") {
62045
+ traceVertices(ctx, pts, true);
62046
+ fillShape();
62047
+ ctx.lineWidth = stroke;
62048
+ } else {
62049
+ traceVertices(ctx, pts, false);
62050
+ const band2 = footprint.value.width.type === "some" ? footprint.value.width.value * ppu : void 0;
62051
+ ctx.lineCap = "round";
62052
+ ctx.lineWidth = getSomeorUndefined(item.weight) ?? band2 ?? (isSel ? 2.5 : 1.5);
62053
+ }
62054
+ ctx.strokeStyle = tint;
62055
+ ctx.stroke();
62056
+ ctx.lineCap = "butt";
62057
+ }
62058
+ for (const item of visibleItems) {
62059
+ const tier = tiers.get(item.key) ?? "dot";
62060
+ if (tier === "card") continue;
62061
+ const tint = resolveTint(p2, getSomeorUndefined(item.color), (_c = getSomeorUndefined(item.tone)) == null ? void 0 : _c.type, statusRGB(p2, statusTone$1(item.status)));
62062
+ const isSel = selected === item.key;
62063
+ const x2 = wx(item.x), y2 = wy(item.y);
62064
+ if (tier === "dot") {
62065
+ ctx.beginPath();
62066
+ ctx.arc(x2, y2, MARKER_DOT_RADIUS, 0, Math.PI * 2);
62067
+ ctx.fillStyle = tint;
62068
+ ctx.fill();
62069
+ ctx.lineWidth = 1.5;
62070
+ ctx.strokeStyle = css(p2.white);
62071
+ ctx.stroke();
62072
+ if (isSel) {
62073
+ ctx.beginPath();
62074
+ ctx.arc(x2, y2, 7.5, 0, Math.PI * 2);
62075
+ ctx.lineWidth = 2;
62076
+ ctx.strokeStyle = css(p2.fg);
62077
+ ctx.stroke();
62078
+ }
62079
+ continue;
62080
+ }
62081
+ ctx.font = MARKER_LABEL_FONT;
62082
+ const box = markerHitbox(item, "label", cam, (t4) => ctx.measureText(t4).width);
62083
+ if (box.kind !== "rect") continue;
62084
+ const { left, top, w: w2, h: h2 } = box;
62085
+ ctx.beginPath();
62086
+ (_d = ctx.roundRect) == null ? void 0 : _d.call(ctx, left, top, w2, h2, h2 / 2);
62087
+ if (!ctx.roundRect) ctx.rect(left, top, w2, h2);
62088
+ ctx.fillStyle = css(p2.bgSurface);
62089
+ ctx.fill();
62090
+ ctx.lineWidth = 1;
62091
+ ctx.strokeStyle = isSel ? css(p2.fg) : css(p2.borderStrong);
62092
+ ctx.stroke();
62093
+ ctx.beginPath();
62094
+ ctx.arc(left + MARKER_PIN_PAD_X + MARKER_PIN_DOT_W / 2, y2, MARKER_PIN_DOT_W / 2, 0, Math.PI * 2);
62095
+ ctx.fillStyle = tint;
62096
+ ctx.fill();
62097
+ ctx.fillStyle = css(p2.fg);
62098
+ ctx.textBaseline = "middle";
62099
+ ctx.fillText(item.label, left + MARKER_PIN_PAD_X + MARKER_PIN_DOT_W + MARKER_PIN_GAP, y2);
62100
+ }
62101
+ }
62102
+ const TOKENS = {
62103
+ brand600: "brand.600",
62104
+ brand500: "brand.500",
62105
+ fg: "fg",
62106
+ fgMuted: "fg.muted",
62107
+ fgSubtle: "fg.subtle",
62108
+ borderStrong: "border.strong",
62109
+ borderSubtle: "border.subtle",
62110
+ bgSurface: "bg.surface",
62111
+ bgPanel: "bg.panel",
62112
+ statusOk: "status.ok",
62113
+ statusWarn: "status.warn",
62114
+ statusBad: "status.bad",
62115
+ white: "white"
62116
+ };
62117
+ const KEYS = Object.keys(TOKENS);
62118
+ function parseRGB(s2) {
62119
+ const m2 = s2.match(/[\d.]+/g);
62120
+ if (m2 === null || m2.length < 3) return [0, 0, 0];
62121
+ return [Math.round(+m2[0]), Math.round(+m2[1]), Math.round(+m2[2])];
62122
+ }
62123
+ const SchematicPaletteProbe = memo$2(function SchematicPaletteProbe2({ onResolve }) {
62124
+ const ref = useRef(null);
62125
+ useLayoutEffect(() => {
62126
+ const read = () => {
62127
+ const el = ref.current;
62128
+ if (el === null) return;
62129
+ const kids = el.children;
62130
+ const palette = {};
62131
+ KEYS.forEach((k2, i2) => {
62132
+ const child = kids[i2];
62133
+ if (child !== void 0) palette[k2] = parseRGB(getComputedStyle(child).color);
62134
+ });
62135
+ onResolve(palette);
62136
+ };
62137
+ read();
62138
+ const obs = new MutationObserver(read);
62139
+ obs.observe(document.documentElement, { attributes: true, attributeFilter: ["class", "data-theme", "style"] });
62140
+ return () => obs.disconnect();
62141
+ }, [onResolve]);
62142
+ return /* @__PURE__ */ jsx(Box, { ref, "aria-hidden": "true", css: { position: "absolute", width: "0", height: "0", overflow: "hidden", pointerEvents: "none" }, children: KEYS.map((k2) => /* @__PURE__ */ jsx(Box, { color: TOKENS[k2] }, k2)) });
62143
+ });
62144
+ library$1.add(icons$2);
62145
+ const schematicEqual = equalFor(Schematic.Types.Schematic);
62146
+ const MAX_ZOOM = 40;
62147
+ const LOD_CARD_PPU = 30;
62148
+ const LOD_LABEL_PPU = 16;
62149
+ const MINIMAP_AUTO = 25;
62150
+ function statusTone(status) {
62151
+ return status.type === "some" ? status.value.type : void 0;
62152
+ }
62153
+ function niceScaleLength(ppu, targetPx) {
62154
+ const target = targetPx / ppu;
62155
+ const pow2 = Math.pow(10, Math.floor(Math.log10(target)));
62156
+ for (const m2 of [5, 2, 1]) {
62157
+ if (m2 * pow2 <= target) return m2 * pow2;
62158
+ }
62159
+ return pow2;
62160
+ }
62161
+ function pointInPolygon(x2, y2, pts) {
62162
+ let inside = false;
62163
+ for (let i2 = 0, j2 = pts.length - 1; i2 < pts.length; j2 = i2++) {
62164
+ const xi = pts[i2].x, yi = pts[i2].y, xj = pts[j2].x, yj = pts[j2].y;
62165
+ if (yi > y2 !== yj > y2 && x2 < (xj - xi) * (y2 - yi) / (yj - yi) + xi) inside = !inside;
62166
+ }
62167
+ return inside;
61567
62168
  }
61568
62169
  function buildNavTree(zones, items) {
61569
62170
  const nodes = /* @__PURE__ */ new Map();
@@ -61646,7 +62247,7 @@ function declutterTiers(items, tree, baseLod, ppu, selected) {
61646
62247
  if (selected !== null && tiers.has(selected)) tiers.set(selected, baseLod);
61647
62248
  return tiers;
61648
62249
  }
61649
- const EastChakraSchematic = memo$2(function EastChakraSchematic2({ value }) {
62250
+ const EastChakraSchematic = memo$2(function EastChakraSchematic2({ value, storageKey }) {
61650
62251
  const styles2 = useSlotRecipe({ key: "schematic" })();
61651
62252
  const { width: W2, height: H } = value.extent;
61652
62253
  const onSelectFn = useMemo(() => getSomeorUndefined(value.onSelect), [value.onSelect]);
@@ -61654,13 +62255,19 @@ const EastChakraSchematic = memo$2(function EastChakraSchematic2({ value }) {
61654
62255
  const showGrid = getSomeorUndefined(value.grid) ?? true;
61655
62256
  const showNavigator = getSomeorUndefined(value.navigator) ?? value.zones.length > 0;
61656
62257
  const showMinimap = getSomeorUndefined(value.minimap) ?? value.items.length >= MINIMAP_AUTO;
62258
+ const fixedHeight = getSomeorUndefined(value.height);
61657
62259
  const [selected, setSelected] = useState(null);
61658
- const [view, setView] = useState(IDENTITY);
61659
62260
  const [query, setQuery] = useState("");
61660
62261
  const [openZone, setOpenZone] = useState(null);
61661
- const [navCollapsed, setNavCollapsed] = useState(false);
62262
+ const { state: persisted, setState: setPersisted } = usePersistedState(storageKey, { navCollapsed: false });
62263
+ const navCollapsed = persisted.navCollapsed;
62264
+ const setNavCollapsed = useCallback((next) => setPersisted((prev) => ({ ...prev, navCollapsed: next })), [setPersisted]);
62265
+ const [palette, setPalette] = useState(null);
61662
62266
  const navTreeRef = useRef(null);
61663
62267
  const canvasRef = useRef(null);
62268
+ const drawRef = useRef(null);
62269
+ const cardLayerRef = useRef(null);
62270
+ const gridRef = useRef(null);
61664
62271
  const [size, setSize] = useState(null);
61665
62272
  useLayoutEffect(() => {
61666
62273
  const el = canvasRef.current;
@@ -61671,10 +62278,30 @@ const EastChakraSchematic = memo$2(function EastChakraSchematic2({ value }) {
61671
62278
  ro.observe(el);
61672
62279
  return () => ro.disconnect();
61673
62280
  }, []);
62281
+ const [dpr, setDpr] = useState(() => typeof window !== "undefined" ? window.devicePixelRatio || 1 : 1);
62282
+ useEffect(() => {
62283
+ if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
62284
+ let cleanup = () => {
62285
+ };
62286
+ const subscribe2 = () => {
62287
+ const mql = window.matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`);
62288
+ const onChange2 = () => {
62289
+ cleanup();
62290
+ setDpr(window.devicePixelRatio || 1);
62291
+ subscribe2();
62292
+ };
62293
+ mql.addEventListener("change", onChange2);
62294
+ cleanup = () => mql.removeEventListener("change", onChange2);
62295
+ };
62296
+ subscribe2();
62297
+ return () => cleanup();
62298
+ }, []);
62299
+ const cameraRef = useRef(IDENTITY);
62300
+ const modeRef = useRef("idle");
62301
+ const animRef = useRef(null);
62302
+ const [cameraSnapshot, setCameraSnapshot] = useState(IDENTITY);
61674
62303
  const fit = size !== null ? Math.min(size.w / W2, size.h / H) : 0;
61675
- const ppu = fit * view.zoom;
61676
- const wx = (x2) => x2 * ppu + view.tx;
61677
- const wy = (y2) => y2 * ppu + view.ty;
62304
+ const ppu = fit * cameraSnapshot.zoom;
61678
62305
  const centers = useMemo(() => {
61679
62306
  const out = /* @__PURE__ */ new Map();
61680
62307
  for (const item of value.items) out.set(item.key, { x: item.x, y: item.y });
@@ -61684,19 +62311,35 @@ const EastChakraSchematic = memo$2(function EastChakraSchematic2({ value }) {
61684
62311
  const tree = new RBush();
61685
62312
  tree.load(value.items.map((item) => {
61686
62313
  const hw = (getSomeorUndefined(item.width) ?? 0) / 2 + 2.4;
61687
- return { minX: item.x - hw, minY: item.y - 2, maxX: item.x + hw, maxY: item.y + 2, item };
62314
+ let minX = item.x - hw, minY = item.y - 2, maxX = item.x + hw, maxY = item.y + 2;
62315
+ const fp = getSomeorUndefined(item.footprint);
62316
+ if (fp !== void 0 && fp.type === "circle") {
62317
+ const r2 = fp.value.radius;
62318
+ minX = Math.min(minX, item.x - r2);
62319
+ minY = Math.min(minY, item.y - r2);
62320
+ maxX = Math.max(maxX, item.x + r2);
62321
+ maxY = Math.max(maxY, item.y + r2);
62322
+ } else if (fp !== void 0 && fp.type !== "rect") {
62323
+ for (const v2 of fp.value.vertices) {
62324
+ minX = Math.min(minX, v2.x);
62325
+ minY = Math.min(minY, v2.y);
62326
+ maxX = Math.max(maxX, v2.x);
62327
+ maxY = Math.max(maxY, v2.y);
62328
+ }
62329
+ }
62330
+ return { minX, minY, maxX, maxY, item };
61688
62331
  }));
61689
62332
  return tree;
61690
62333
  }, [value.items]);
61691
62334
  const visibleItems = useMemo(() => {
61692
62335
  if (size === null || ppu === 0) return [];
61693
62336
  return index2.search({
61694
- minX: -view.tx / ppu,
61695
- minY: -view.ty / ppu,
61696
- maxX: (size.w - view.tx) / ppu,
61697
- maxY: (size.h - view.ty) / ppu
62337
+ minX: -cameraSnapshot.tx / ppu,
62338
+ minY: -cameraSnapshot.ty / ppu,
62339
+ maxX: (size.w - cameraSnapshot.tx) / ppu,
62340
+ maxY: (size.h - cameraSnapshot.ty) / ppu
61698
62341
  }).map((b2) => b2.item);
61699
- }, [index2, size, ppu, view]);
62342
+ }, [index2, size, ppu, cameraSnapshot]);
61700
62343
  const nav = useMemo(() => buildNavTree(value.zones, value.items), [value.zones, value.items]);
61701
62344
  const zoneDisplay = useMemo(() => {
61702
62345
  const counts = /* @__PURE__ */ new Map();
@@ -61722,39 +62365,194 @@ const EastChakraSchematic = memo$2(function EastChakraSchematic2({ value }) {
61722
62365
  const indexOf = new Map(ordered.map((item, i2) => [item.key, i2]));
61723
62366
  return { ordered, indexOf };
61724
62367
  }, [nav]);
61725
- const animRef = useRef(null);
61726
- const viewRef = useRef(view);
61727
- viewRef.current = view;
62368
+ const [currentZone, setCurrentZone] = useState(void 0);
62369
+ useEffect(() => {
62370
+ const SPY_ENTER = 0.3, SPY_STAY = 0.18, SPY_MARGIN = 0.15;
62371
+ if (size === null || ppu === 0 || cameraSnapshot.zoom <= 1.05) {
62372
+ setCurrentZone(void 0);
62373
+ return;
62374
+ }
62375
+ const vx0 = -cameraSnapshot.tx / ppu, vy0 = -cameraSnapshot.ty / ppu;
62376
+ const vx1 = (size.w - cameraSnapshot.tx) / ppu, vy1 = (size.h - cameraSnapshot.ty) / ppu;
62377
+ const viewArea = (vx1 - vx0) * (vy1 - vy0);
62378
+ const scoreOf = (z) => {
62379
+ const ix = Math.max(0, Math.min(vx1, z.x + z.width) - Math.max(vx0, z.x));
62380
+ const iy = Math.max(0, Math.min(vy1, z.y + z.height) - Math.max(vy0, z.y));
62381
+ return ix * iy / Math.min(viewArea, z.width * z.height);
62382
+ };
62383
+ let best;
62384
+ let bestScore = 0;
62385
+ for (const z of value.zones) {
62386
+ const score = scoreOf(z);
62387
+ if (score > bestScore) {
62388
+ best = z.key;
62389
+ bestScore = score;
62390
+ }
62391
+ }
62392
+ setCurrentZone((prev) => {
62393
+ if (prev !== void 0) {
62394
+ const holder = value.zones.find((z) => z.key === prev);
62395
+ const holderScore = holder !== void 0 ? scoreOf(holder) : 0;
62396
+ if (holderScore >= SPY_STAY && (best === prev || bestScore < holderScore + SPY_MARGIN)) return prev;
62397
+ }
62398
+ return bestScore >= SPY_ENTER ? best : void 0;
62399
+ });
62400
+ }, [size, ppu, cameraSnapshot, value.zones]);
62401
+ const lod = ppu >= LOD_CARD_PPU ? "card" : ppu >= LOD_LABEL_PPU ? "label" : "dot";
62402
+ const centerTree = useMemo(() => buildCenterTree(visibleItems), [visibleItems]);
62403
+ const tiers = useMemo(() => declutterTiers(visibleItems, centerTree, lod, ppu, selected), [visibleItems, centerTree, lod, ppu, selected]);
62404
+ const lowerQuery = query.trim().toLowerCase();
62405
+ const searchHits = useMemo(() => lowerQuery === "" ? [] : value.items.filter((i2) => i2.key.toLowerCase().includes(lowerQuery) || i2.label.toLowerCase().includes(lowerQuery)).slice(0, 12), [lowerQuery, value.items]);
62406
+ const scaleLen = ppu > 0 ? niceScaleLength(ppu, 100) : 0;
62407
+ const valueRef = useRef(value);
62408
+ valueRef.current = value;
62409
+ const sizeRef = useRef(size);
62410
+ sizeRef.current = size;
62411
+ const fitRef = useRef(fit);
62412
+ fitRef.current = fit;
62413
+ const dprRef = useRef(dpr);
62414
+ dprRef.current = dpr;
62415
+ const paletteRef = useRef(palette);
62416
+ paletteRef.current = palette;
62417
+ const visibleItemsRef = useRef(visibleItems);
62418
+ visibleItemsRef.current = visibleItems;
62419
+ const tiersRef = useRef(tiers);
62420
+ tiersRef.current = tiers;
62421
+ const selectedRef = useRef(selected);
62422
+ selectedRef.current = selected;
62423
+ const centersRef = useRef(centers);
62424
+ centersRef.current = centers;
62425
+ const openZoneRef = useRef(openZone);
62426
+ openZoneRef.current = openZone;
62427
+ const lastPaintRef = useRef(null);
62428
+ const applyCamera = useCallback(() => {
62429
+ const sz = sizeRef.current;
62430
+ if (sz === null) return;
62431
+ const cam = cameraRef.current;
62432
+ const ppuLive = fitRef.current * cam.zoom;
62433
+ const dprLive = dprRef.current;
62434
+ const layer = cardLayerRef.current;
62435
+ if (layer !== null) {
62436
+ layer.style.setProperty("--cam-ppu", String(ppuLive));
62437
+ layer.style.setProperty("--cam-tx", `${cam.tx}px`);
62438
+ layer.style.setProperty("--cam-ty", `${cam.ty}px`);
62439
+ }
62440
+ const grid = gridRef.current;
62441
+ if (grid !== null) {
62442
+ const len = ppuLive > 0 ? niceScaleLength(ppuLive, 100) : 0;
62443
+ if (len > 0) {
62444
+ const major = len * ppuLive, minor = major / 5;
62445
+ grid.style.backgroundSize = `${major}px ${major}px, ${major}px ${major}px, ${minor}px ${minor}px, ${minor}px ${minor}px`;
62446
+ grid.style.backgroundPosition = `${cam.tx}px 0, 0 ${cam.ty}px, ${cam.tx}px 0, 0 ${cam.ty}px`;
62447
+ }
62448
+ }
62449
+ const canvas = drawRef.current, pal = paletteRef.current;
62450
+ if (canvas === null || pal === null) return;
62451
+ const last = lastPaintRef.current;
62452
+ if (last !== null && last.zoom === cam.zoom && last.tx === cam.tx && last.ty === cam.ty && last.vis === visibleItemsRef.current && last.tiers === tiersRef.current && last.sel === selectedRef.current && last.pal === pal && last.w === sz.w && last.h === sz.h && last.dpr === dprLive && last.val === valueRef.current) return;
62453
+ lastPaintRef.current = {
62454
+ zoom: cam.zoom,
62455
+ tx: cam.tx,
62456
+ ty: cam.ty,
62457
+ vis: visibleItemsRef.current,
62458
+ tiers: tiersRef.current,
62459
+ sel: selectedRef.current,
62460
+ pal,
62461
+ w: sz.w,
62462
+ h: sz.h,
62463
+ dpr: dprLive,
62464
+ val: valueRef.current
62465
+ };
62466
+ const bw = Math.round(sz.w * dprLive), bh = Math.round(sz.h * dprLive);
62467
+ if (canvas.width !== bw || canvas.height !== bh) {
62468
+ canvas.width = bw;
62469
+ canvas.height = bh;
62470
+ }
62471
+ const ctx = canvas.getContext("2d");
62472
+ if (ctx === null) return;
62473
+ ctx.setTransform(dprLive, 0, 0, dprLive, 0, 0);
62474
+ paintSchematic({
62475
+ ctx,
62476
+ value: valueRef.current,
62477
+ cam: { ppu: ppuLive, tx: cam.tx, ty: cam.ty },
62478
+ width: sz.w,
62479
+ height: sz.h,
62480
+ visibleItems: visibleItemsRef.current,
62481
+ tiers: tiersRef.current,
62482
+ selected: selectedRef.current,
62483
+ centers: centersRef.current,
62484
+ palette: pal
62485
+ });
62486
+ }, []);
62487
+ const coalescerRef = useRef(null);
62488
+ if (coalescerRef.current === null && typeof requestAnimationFrame !== "undefined") {
62489
+ coalescerRef.current = makeRafCoalescer(requestAnimationFrame, cancelAnimationFrame);
62490
+ }
62491
+ const requestRender = useCallback(() => {
62492
+ const run = () => {
62493
+ applyCamera();
62494
+ const cam = cameraRef.current;
62495
+ setCameraSnapshot((prev) => prev.zoom === cam.zoom && prev.tx === cam.tx && prev.ty === cam.ty ? prev : { zoom: cam.zoom, tx: cam.tx, ty: cam.ty });
62496
+ };
62497
+ const cz = coalescerRef.current;
62498
+ if (cz !== null) cz.request(run);
62499
+ else run();
62500
+ }, [applyCamera]);
62501
+ const cancelFlyRaf = useCallback(() => {
62502
+ if (animRef.current !== null) {
62503
+ cancelAnimationFrame(animRef.current);
62504
+ animRef.current = null;
62505
+ }
62506
+ }, []);
62507
+ const transition = useCallback((event) => {
62508
+ if (cancelsFly(modeRef.current, event)) cancelFlyRaf();
62509
+ modeRef.current = nextMode(modeRef.current, event);
62510
+ }, [cancelFlyRaf]);
61728
62511
  const flyTo = useCallback((rect) => {
61729
- if (size === null || fit === 0) return;
62512
+ if (sizeRef.current === null || fitRef.current === 0) return;
61730
62513
  const pad2 = 1.18;
61731
- const zoom = Math.min(MAX_ZOOM, Math.min(size.w / (rect.w * pad2 * fit), size.h / (rect.h * pad2 * fit)));
61732
- const target = {
61733
- zoom,
61734
- tx: size.w / 2 - (rect.x + rect.w / 2) * fit * zoom,
61735
- ty: size.h / 2 - (rect.y + rect.h / 2) * fit * zoom
62514
+ const frame = () => {
62515
+ const sz = sizeRef.current, ft = fitRef.current;
62516
+ if (sz === null || ft === 0) return null;
62517
+ const zoom = Math.min(MAX_ZOOM, Math.min(sz.w / (rect.w * pad2 * ft), sz.h / (rect.h * pad2 * ft)));
62518
+ return {
62519
+ zoom,
62520
+ tx: sz.w / 2 - (rect.x + rect.w / 2) * ft * zoom,
62521
+ ty: sz.h / 2 - (rect.y + rect.h / 2) * ft * zoom
62522
+ };
61736
62523
  };
61737
- const from = viewRef.current;
62524
+ const from = { ...cameraRef.current };
61738
62525
  const start = performance.now();
61739
62526
  if (animRef.current !== null) cancelAnimationFrame(animRef.current);
62527
+ transition("flyStart");
61740
62528
  const step = (now) => {
61741
62529
  const t4 = Math.min(1, (now - start) / 350);
61742
62530
  const e3 = 1 - Math.pow(1 - t4, 3);
61743
- setView({
61744
- zoom: from.zoom + (target.zoom - from.zoom) * e3,
61745
- tx: from.tx + (target.tx - from.tx) * e3,
61746
- ty: from.ty + (target.ty - from.ty) * e3
61747
- });
61748
- if (t4 < 1) animRef.current = requestAnimationFrame(step);
62531
+ const target = frame();
62532
+ if (target !== null) {
62533
+ cameraRef.current = {
62534
+ zoom: from.zoom + (target.zoom - from.zoom) * e3,
62535
+ tx: from.tx + (target.tx - from.tx) * e3,
62536
+ ty: from.ty + (target.ty - from.ty) * e3
62537
+ };
62538
+ applyCamera();
62539
+ const cam = cameraRef.current;
62540
+ setCameraSnapshot({ zoom: cam.zoom, tx: cam.tx, ty: cam.ty });
62541
+ }
62542
+ if (t4 < 1) {
62543
+ animRef.current = requestAnimationFrame(step);
62544
+ } else {
62545
+ animRef.current = null;
62546
+ transition("flyEnd");
62547
+ }
61749
62548
  };
61750
62549
  animRef.current = requestAnimationFrame(step);
61751
- }, [size, fit]);
61752
- useEffect(() => () => {
61753
- if (animRef.current !== null) cancelAnimationFrame(animRef.current);
61754
- }, []);
62550
+ }, [applyCamera, transition]);
62551
+ const zoneOverrideRef = useRef(null);
61755
62552
  const flyToItem = useCallback((item) => {
61756
62553
  flyTo({ x: item.x - 4, y: item.y - 3, w: 8, h: 6 });
61757
62554
  setSelected(item.key);
62555
+ zoneOverrideRef.current = null;
61758
62556
  setOpenZone(nav.zoneOf.get(item.key) ?? null);
61759
62557
  if (onSelectFn) queueMicrotask(() => onSelectFn(item.key));
61760
62558
  }, [flyTo, nav.zoneOf, onSelectFn]);
@@ -61766,6 +62564,7 @@ const EastChakraSchematic = memo$2(function EastChakraSchematic2({ value }) {
61766
62564
  }, [itemOrder, selected, flyToItem]);
61767
62565
  const flyToZone = useCallback((zone) => {
61768
62566
  flyTo({ x: zone.x, y: zone.y, w: zone.width, h: zone.height });
62567
+ zoneOverrideRef.current = null;
61769
62568
  setOpenZone(zone.key);
61770
62569
  }, [flyTo]);
61771
62570
  useEffect(() => {
@@ -61775,85 +62574,144 @@ const EastChakraSchematic = memo$2(function EastChakraSchematic2({ value }) {
61775
62574
  e3.preventDefault();
61776
62575
  const rect = el.getBoundingClientRect();
61777
62576
  const px = e3.clientX - rect.left, py = e3.clientY - rect.top;
61778
- setView((prev) => {
61779
- const zoom = Math.max(1, Math.min(MAX_ZOOM, prev.zoom * Math.exp(-e3.deltaY * 15e-4)));
61780
- const k2 = zoom / prev.zoom;
61781
- const next = { zoom, tx: px - k2 * (px - prev.tx), ty: py - k2 * (py - prev.ty) };
61782
- return zoom === 1 ? IDENTITY : next;
61783
- });
62577
+ transition("wheel");
62578
+ cameraRef.current = zoomAbout(cameraRef.current, Math.exp(-e3.deltaY * 15e-4), px, py, 1, MAX_ZOOM);
62579
+ requestRender();
61784
62580
  };
61785
62581
  el.addEventListener("wheel", onWheel, { passive: false });
61786
62582
  return () => el.removeEventListener("wheel", onWheel);
61787
- }, []);
62583
+ }, [transition, requestRender]);
61788
62584
  const panRef = useRef(null);
62585
+ const movedRef = useRef(false);
62586
+ const pickAt = useCallback((host, clientX, clientY) => {
62587
+ var _a2, _b, _c;
62588
+ const sz = sizeRef.current;
62589
+ if (sz === null) return false;
62590
+ const cam = cameraRef.current;
62591
+ const ppuLive = fitRef.current * cam.zoom;
62592
+ if (ppuLive === 0) return false;
62593
+ const rect = host.getBoundingClientRect();
62594
+ const sx = clientX - rect.left, sy = clientY - rect.top;
62595
+ const wxp = (sx - cam.tx) / ppuLive, wyp = (sy - cam.ty) / ppuLive;
62596
+ const select = (key) => {
62597
+ setSelected(key);
62598
+ if (onSelectFn) queueMicrotask(() => onSelectFn(key));
62599
+ };
62600
+ for (const it of visibleItems) {
62601
+ if ((tiers.get(it.key) ?? lod) !== "card") continue;
62602
+ const fp = getSomeorUndefined(it.footprint);
62603
+ if (fp === void 0 || fp.type === "rect") continue;
62604
+ const hit = fp.type === "circle" ? Math.hypot(wxp - it.x, wyp - it.y) <= fp.value.radius : pointInPolygon(wxp, wyp, fp.value.vertices);
62605
+ if (hit) {
62606
+ select(it.key);
62607
+ return true;
62608
+ }
62609
+ }
62610
+ if (typeof document !== "undefined") {
62611
+ const cardKey = (_b = (_a2 = document.elementFromPoint(clientX, clientY)) == null ? void 0 : _a2.closest("[data-card-key]")) == null ? void 0 : _b.getAttribute("data-card-key");
62612
+ if (cardKey !== null && cardKey !== void 0) {
62613
+ select(cardKey);
62614
+ return true;
62615
+ }
62616
+ }
62617
+ const ctx = ((_c = drawRef.current) == null ? void 0 : _c.getContext("2d")) ?? null;
62618
+ if (ctx !== null) {
62619
+ ctx.save();
62620
+ ctx.font = MARKER_LABEL_FONT;
62621
+ }
62622
+ const camScreen = { ppu: ppuLive, tx: cam.tx, ty: cam.ty };
62623
+ let best = null, bestD = Infinity;
62624
+ for (const it of visibleItems) {
62625
+ const tier = tiers.get(it.key) ?? lod;
62626
+ if (tier === "card") continue;
62627
+ const box = markerHitbox(it, tier, camScreen, (t4) => ctx !== null ? ctx.measureText(t4).width : t4.length * 6);
62628
+ if (!markerHit(box, sx, sy)) continue;
62629
+ const d2 = Math.hypot(it.x * ppuLive + cam.tx - sx, it.y * ppuLive + cam.ty - sy);
62630
+ if (d2 < bestD) {
62631
+ best = it;
62632
+ bestD = d2;
62633
+ }
62634
+ }
62635
+ if (ctx !== null) ctx.restore();
62636
+ if (best !== null) {
62637
+ flyToItem(best);
62638
+ return true;
62639
+ }
62640
+ return false;
62641
+ }, [tiers, lod, visibleItems, onSelectFn, flyToItem]);
61789
62642
  const onCanvasPointerDown = useCallback((e3) => {
61790
62643
  if (e3.button !== 0) return;
61791
62644
  if (e3.target.closest("button") !== null) return;
61792
- panRef.current = { x: e3.clientX, y: e3.clientY, tx: viewRef.current.tx, ty: viewRef.current.ty };
62645
+ transition("pointerDown");
62646
+ panRef.current = { x: e3.clientX, y: e3.clientY, tx: cameraRef.current.tx, ty: cameraRef.current.ty };
62647
+ movedRef.current = false;
61793
62648
  e3.currentTarget.setPointerCapture(e3.pointerId);
61794
- }, []);
62649
+ }, [transition]);
61795
62650
  const onCanvasPointerMove = useCallback((e3) => {
61796
62651
  const pan = panRef.current;
61797
62652
  if (!pan) return;
61798
- setView((prev) => ({ ...prev, tx: pan.tx + e3.clientX - pan.x, ty: pan.ty + e3.clientY - pan.y }));
61799
- }, []);
61800
- const onCanvasPointerUp = useCallback(() => {
62653
+ if (Math.abs(e3.clientX - pan.x) > 4 || Math.abs(e3.clientY - pan.y) > 4) movedRef.current = true;
62654
+ cameraRef.current = { ...cameraRef.current, tx: pan.tx + e3.clientX - pan.x, ty: pan.ty + e3.clientY - pan.y };
62655
+ requestRender();
62656
+ }, [requestRender]);
62657
+ const endPan = useCallback(() => {
62658
+ if (panRef.current === null) return false;
61801
62659
  panRef.current = null;
61802
- }, []);
61803
- const resetView = useCallback(() => setView(IDENTITY), []);
62660
+ transition("pointerUp");
62661
+ return true;
62662
+ }, [transition]);
62663
+ const onCanvasPointerUp = useCallback((e3) => {
62664
+ const wasPress = endPan();
62665
+ if (!wasPress || movedRef.current) return;
62666
+ if (!pickAt(e3.currentTarget, e3.clientX, e3.clientY)) setSelected(null);
62667
+ }, [endPan, pickAt]);
62668
+ const onCanvasPointerCancel = useCallback(() => {
62669
+ movedRef.current = false;
62670
+ endPan();
62671
+ }, [endPan]);
62672
+ const resetView = useCallback(() => {
62673
+ transition("cancel");
62674
+ cameraRef.current = IDENTITY;
62675
+ requestRender();
62676
+ }, [transition, requestRender]);
61804
62677
  const zoomBy = useCallback((factor) => {
61805
- if (size === null) return;
61806
- const px = size.w / 2, py = size.h / 2;
61807
- setView((prev) => {
61808
- const zoom = Math.max(1, Math.min(MAX_ZOOM, prev.zoom * factor));
61809
- const k2 = zoom / prev.zoom;
61810
- return zoom === 1 ? IDENTITY : { zoom, tx: px - k2 * (px - prev.tx), ty: py - k2 * (py - prev.ty) };
61811
- });
61812
- }, [size]);
61813
- const [currentZone, setCurrentZone] = useState(void 0);
61814
- useEffect(() => {
61815
- const SPY_ENTER = 0.3, SPY_STAY = 0.18, SPY_MARGIN = 0.15;
61816
- if (size === null || ppu === 0 || view.zoom <= 1.05) {
61817
- setCurrentZone(void 0);
61818
- return;
61819
- }
61820
- const vx0 = -view.tx / ppu, vy0 = -view.ty / ppu;
61821
- const vx1 = (size.w - view.tx) / ppu, vy1 = (size.h - view.ty) / ppu;
61822
- const viewArea = (vx1 - vx0) * (vy1 - vy0);
61823
- const scoreOf = (z) => {
61824
- const ix = Math.max(0, Math.min(vx1, z.x + z.width) - Math.max(vx0, z.x));
61825
- const iy = Math.max(0, Math.min(vy1, z.y + z.height) - Math.max(vy0, z.y));
61826
- return ix * iy / Math.min(viewArea, z.width * z.height);
61827
- };
61828
- let best;
61829
- let bestScore = 0;
61830
- for (const z of value.zones) {
61831
- const score = scoreOf(z);
61832
- if (score > bestScore) {
61833
- best = z.key;
61834
- bestScore = score;
61835
- }
61836
- }
61837
- setCurrentZone((prev) => {
61838
- if (prev !== void 0) {
61839
- const holder = value.zones.find((z) => z.key === prev);
61840
- const holderScore = holder !== void 0 ? scoreOf(holder) : 0;
61841
- if (holderScore >= SPY_STAY && (best === prev || bestScore < holderScore + SPY_MARGIN)) return prev;
61842
- }
61843
- return bestScore >= SPY_ENTER ? best : void 0;
61844
- });
61845
- }, [size, ppu, view, value.zones]);
61846
- const lod = ppu >= LOD_CARD_PPU ? "card" : ppu >= LOD_LABEL_PPU ? "label" : "dot";
61847
- const centerTree = useMemo(() => buildCenterTree(visibleItems), [visibleItems]);
61848
- const tiers = useMemo(() => declutterTiers(visibleItems, centerTree, lod, ppu, selected), [visibleItems, centerTree, lod, ppu, selected]);
61849
- const lowerQuery = query.trim().toLowerCase();
61850
- const searchHits = useMemo(() => lowerQuery === "" ? [] : value.items.filter((i2) => i2.key.toLowerCase().includes(lowerQuery) || i2.label.toLowerCase().includes(lowerQuery)).slice(0, 12), [lowerQuery, value.items]);
61851
- const scaleLen = ppu > 0 ? niceScaleLength(ppu, 100) : 0;
62678
+ const sz = sizeRef.current;
62679
+ if (sz === null) return;
62680
+ transition("zoom");
62681
+ cameraRef.current = zoomAbout(cameraRef.current, factor, sz.w / 2, sz.h / 2, 1, MAX_ZOOM);
62682
+ requestRender();
62683
+ }, [transition, requestRender]);
62684
+ const minimapDragRef = useRef(false);
62685
+ const minimapJump = useCallback((el, clientX, clientY) => {
62686
+ const sz = sizeRef.current;
62687
+ if (sz === null) return;
62688
+ const rect = el.getBoundingClientRect();
62689
+ const cx2 = (clientX - rect.left) / rect.width * W2;
62690
+ const cy = (clientY - rect.top) / rect.height * H;
62691
+ const cam = cameraRef.current;
62692
+ cameraRef.current = { ...cam, tx: sz.w / 2 - cx2 * fitRef.current * cam.zoom, ty: sz.h / 2 - cy * fitRef.current * cam.zoom };
62693
+ requestRender();
62694
+ }, [W2, H, requestRender]);
62695
+ useEffect(() => () => {
62696
+ var _a2;
62697
+ (_a2 = coalescerRef.current) == null ? void 0 : _a2.cancel();
62698
+ if (animRef.current !== null) cancelAnimationFrame(animRef.current);
62699
+ }, [animRef]);
62700
+ useLayoutEffect(() => {
62701
+ applyCamera();
62702
+ }, [applyCamera, value, visibleItems, tiers, selected, palette, size, dpr, fit, cameraSnapshot]);
61852
62703
  const toggleZone = useCallback((key) => {
61853
- setOpenZone((prev) => prev === key ? nav.parentOf.get(key) ?? null : key);
62704
+ const collapsing = openZoneRef.current === key;
62705
+ zoneOverrideRef.current = collapsing ? key : null;
62706
+ setOpenZone(collapsing ? nav.parentOf.get(key) ?? null : key);
61854
62707
  }, [nav.parentOf]);
61855
62708
  useEffect(() => {
61856
- if (currentZone !== void 0) setOpenZone(currentZone);
62709
+ if (currentZone === void 0) return;
62710
+ if (zoneOverrideRef.current !== null) {
62711
+ if (zoneOverrideRef.current === currentZone) return;
62712
+ zoneOverrideRef.current = null;
62713
+ }
62714
+ setOpenZone(currentZone);
61857
62715
  }, [currentZone]);
61858
62716
  const openPath = useMemo(() => {
61859
62717
  const path2 = /* @__PURE__ */ new Set();
@@ -61878,7 +62736,15 @@ const EastChakraSchematic = memo$2(function EastChakraSchematic2({ value }) {
61878
62736
  Box,
61879
62737
  {
61880
62738
  css: styles2.navZone,
61881
- style: { paddingLeft: `${8 + depth * 14}px` },
62739
+ style: {
62740
+ paddingLeft: `${8 + depth * 14}px`,
62741
+ // Pin this header below its ancestors' pinned headers
62742
+ // (each level offset by one row) so the whole path stays
62743
+ // visible while scrolling the zone's items; shallower
62744
+ // levels stack above deeper ones.
62745
+ top: `calc(var(--nav-row-h) * ${depth})`,
62746
+ zIndex: 30 - depth
62747
+ },
61882
62748
  ...node2.zone.key === currentZone ? { "data-current": "" } : {},
61883
62749
  children: [
61884
62750
  expandable ? /* @__PURE__ */ jsx(
@@ -61917,7 +62783,8 @@ const EastChakraSchematic = memo$2(function EastChakraSchematic2({ value }) {
61917
62783
  ))
61918
62784
  ] }, node2.zone.key);
61919
62785
  };
61920
- return /* @__PURE__ */ jsxs(Box, { css: styles2.root, children: [
62786
+ return /* @__PURE__ */ jsxs(Box, { css: styles2.root, ...fixedHeight !== void 0 ? { style: { height: fixedHeight, maxHeight: fixedHeight } } : {}, children: [
62787
+ /* @__PURE__ */ jsx(SchematicPaletteProbe, { onResolve: setPalette }),
61921
62788
  showNavigator && navCollapsed && /* @__PURE__ */ jsx(Box, { css: styles2.navCollapsed, children: /* @__PURE__ */ jsx(Box, { as: "button", css: styles2.navToggle, "aria-label": "Expand index", title: "Show index", onClick: () => setNavCollapsed(false), children: /* @__PURE__ */ jsx(FontAwesomeIcon, { icon: faAnglesRight }) }) }),
61922
62789
  showNavigator && !navCollapsed && /* @__PURE__ */ jsxs(Box, { css: styles2.nav, children: [
61923
62790
  /* @__PURE__ */ jsxs(Box, { css: styles2.navHeader, children: [
@@ -61962,112 +62829,27 @@ const EastChakraSchematic = memo$2(function EastChakraSchematic2({ value }) {
61962
62829
  ref: canvasRef,
61963
62830
  css: styles2.canvas,
61964
62831
  "data-schematic-canvas": "",
61965
- style: { aspectRatio: `${W2} / ${H}` },
62832
+ style: fixedHeight !== void 0 ? { minHeight: 0 } : { aspectRatio: `${W2} / ${H}` },
61966
62833
  onPointerDown: onCanvasPointerDown,
61967
62834
  onPointerMove: onCanvasPointerMove,
61968
62835
  onPointerUp: onCanvasPointerUp,
62836
+ onPointerCancel: onCanvasPointerCancel,
62837
+ onLostPointerCapture: onCanvasPointerCancel,
61969
62838
  onDoubleClick: resetView,
61970
62839
  children: [
61971
- showGrid && size !== null && scaleLen > 0 && (() => {
61972
- const major = scaleLen * ppu;
61973
- const minor = major / 5;
61974
- return /* @__PURE__ */ jsx(
61975
- Box,
62840
+ showGrid && size !== null && /* @__PURE__ */ jsx(Box, { ref: gridRef, css: styles2.grid }),
62841
+ size !== null && /* @__PURE__ */ jsxs(Fragment, { children: [
62842
+ /* @__PURE__ */ jsx(
62843
+ "canvas",
61976
62844
  {
61977
- css: styles2.grid,
61978
- style: {
61979
- backgroundSize: `${major}px ${major}px, ${major}px ${major}px, ${minor}px ${minor}px, ${minor}px ${minor}px`,
61980
- backgroundPosition: `${view.tx}px 0, 0 ${view.ty}px, ${view.tx}px 0, 0 ${view.ty}px`
61981
- }
62845
+ ref: drawRef,
62846
+ style: { position: "absolute", inset: 0, width: "100%", height: "100%" }
61982
62847
  }
61983
- );
61984
- })(),
61985
- size !== null && /* @__PURE__ */ jsxs(Fragment, { children: [
61986
- value.zones.map((zone) => {
61987
- const pattern = zone.pattern;
61988
- const tone = (pattern.value.tone.type === "some" ? pattern.value.tone.value.type : void 0) ?? "muted";
61989
- const hatchVars = pattern.type === "hatch" ? {
61990
- "--hatch-spacing": `${pattern.value.spacing.type === "some" ? pattern.value.spacing.value : 8}px`,
61991
- "--hatch-angle": `${pattern.value.angle.type === "some" ? pattern.value.angle.value : 45}deg`
61992
- } : {};
61993
- return /* @__PURE__ */ jsx(
61994
- Box,
61995
- {
61996
- css: styles2.zone,
61997
- "data-pattern": pattern.type,
61998
- "data-tone": tone,
61999
- style: {
62000
- left: wx(zone.x),
62001
- top: wy(zone.y),
62002
- width: zone.width * ppu,
62003
- height: zone.height * ppu,
62004
- ...hatchVars
62005
- },
62006
- children: zone.width * ppu >= zone.label.length * 6.2 + 24 && /* @__PURE__ */ jsx(Box, { as: "span", css: styles2.zoneLabel, "data-pattern": pattern.type, children: zone.label })
62007
- },
62008
- zone.key
62009
- );
62010
- }),
62011
- /* @__PURE__ */ jsx(Box, { as: "svg", css: styles2.underlay, ...{ viewBox: `0 0 ${size.w} ${size.h}`, width: size.w, height: size.h }, children: value.links.map((link2) => {
62012
- const from = centers.get(link2.from);
62013
- const to = centers.get(link2.to);
62014
- if (!from || !to) return null;
62015
- const anchors = [from, ...link2.via, to].map((p2) => ({ x: wx(p2.x), y: wy(p2.y) }));
62016
- const corner = link2.route.type === "orthogonal" ? link2.route.value.corner.type === "some" ? link2.route.value.corner.value : 8 : 0;
62017
- const pts = link2.route.type === "orthogonal" ? orthogonalize(anchors) : anchors;
62018
- const style = link2.style;
62019
- const tone = (style.value.tone.type === "some" ? style.value.tone.value.type : void 0) ?? (style.type === "solid" ? "brand" : "muted");
62020
- const weight = style.value.weight.type === "some" ? style.value.weight.value : style.type === "solid" ? 2.5 : 1.5;
62021
- return /* @__PURE__ */ jsxs("g", { "data-tone": tone, children: [
62022
- /* @__PURE__ */ jsx(
62023
- "path",
62024
- {
62025
- d: roundedPath(pts, corner),
62026
- fill: "none",
62027
- "data-style": style.type,
62028
- strokeWidth: weight,
62029
- ...style.type === "dashed" ? { strokeDasharray: "6 5" } : {}
62030
- }
62031
- ),
62032
- /* @__PURE__ */ jsx("circle", { cx: anchors[0].x, cy: anchors[0].y, r: weight + 1.5 }),
62033
- /* @__PURE__ */ jsx("circle", { cx: anchors[anchors.length - 1].x, cy: anchors[anchors.length - 1].y, r: weight + 1.5 })
62034
- ] }, link2.key);
62035
- }) }),
62036
- visibleItems.map((item) => {
62848
+ ),
62849
+ /* @__PURE__ */ jsx(Box, { ref: cardLayerRef, css: styles2.cardLayer, children: visibleItems.map((item) => {
62850
+ if ((tiers.get(item.key) ?? lod) !== "card") return null;
62037
62851
  const tone = statusTone(item.status);
62038
62852
  const isSelected = selected === item.key;
62039
- const tier = tiers.get(item.key) ?? lod;
62040
- if (tier === "dot") {
62041
- return /* @__PURE__ */ jsx(
62042
- Box,
62043
- {
62044
- css: styles2.itemDot,
62045
- "data-tone": tone ?? "neutral",
62046
- ...isSelected ? { "data-selected": "" } : {},
62047
- style: { left: wx(item.x), top: wy(item.y) },
62048
- onClick: () => flyToItem(item),
62049
- onPointerDown: (e3) => e3.stopPropagation()
62050
- },
62051
- item.key
62052
- );
62053
- }
62054
- if (tier === "label") {
62055
- return /* @__PURE__ */ jsxs(
62056
- Box,
62057
- {
62058
- css: styles2.itemPin,
62059
- ...isSelected ? { "data-selected": "" } : {},
62060
- style: { left: wx(item.x), top: wy(item.y) },
62061
- onClick: () => flyToItem(item),
62062
- onPointerDown: (e3) => e3.stopPropagation(),
62063
- children: [
62064
- /* @__PURE__ */ jsx(Box, { as: "span", css: styles2.statusDot, "data-tone": tone ?? "neutral" }),
62065
- item.label
62066
- ]
62067
- },
62068
- item.key
62069
- );
62070
- }
62071
62853
  const sublabel = getSomeorUndefined(item.sublabel);
62072
62854
  const icon3 = getSomeorUndefined(item.icon);
62073
62855
  const meter = getSomeorUndefined(item.meter);
@@ -62078,17 +62860,14 @@ const EastChakraSchematic = memo$2(function EastChakraSchematic2({ value }) {
62078
62860
  Box,
62079
62861
  {
62080
62862
  css: styles2.item,
62863
+ "data-card-key": item.key,
62081
62864
  ...isSelected ? { "data-selected": "" } : {},
62082
62865
  style: {
62083
- left: wx(item.x),
62084
- top: wy(item.y),
62085
- ...typeof width === "number" ? { width: width * ppu } : {}
62086
- },
62087
- onClick: () => {
62088
- setSelected(item.key);
62089
- if (onSelectFn) queueMicrotask(() => onSelectFn(item.key));
62866
+ left: 0,
62867
+ top: 0,
62868
+ transform: `${cardTranslateCss(item.x, item.y)} translate(-50%, -50%)`,
62869
+ ...typeof width === "number" ? { width: cardWidthCss(width) } : {}
62090
62870
  },
62091
- onPointerDown: (e3) => e3.stopPropagation(),
62092
62871
  children: [
62093
62872
  /* @__PURE__ */ jsxs(Box, { css: styles2.itemHead, children: [
62094
62873
  iconDef !== void 0 && /* @__PURE__ */ jsx(Box, { as: "span", css: styles2.itemIcon, children: /* @__PURE__ */ jsx(FontAwesomeIcon, { icon: iconDef }) }),
@@ -62102,7 +62881,7 @@ const EastChakraSchematic = memo$2(function EastChakraSchematic2({ value }) {
62102
62881
  },
62103
62882
  item.key
62104
62883
  );
62105
- }),
62884
+ }) }),
62106
62885
  /* @__PURE__ */ jsxs(Box, { css: styles2.controls, children: [
62107
62886
  /* @__PURE__ */ jsx(Box, { as: "button", css: styles2.controlButton, "aria-label": "Zoom in", title: "Zoom in (scroll)", onClick: () => zoomBy(1.5), children: /* @__PURE__ */ jsx(FontAwesomeIcon, { icon: faPlus }) }),
62108
62887
  /* @__PURE__ */ jsx(Box, { as: "button", css: styles2.controlButton, "aria-label": "Zoom out", title: "Zoom out (scroll)", onClick: () => zoomBy(1 / 1.5), children: /* @__PURE__ */ jsx(FontAwesomeIcon, { icon: faMinus }) }),
@@ -62146,16 +62925,20 @@ const EastChakraSchematic = memo$2(function EastChakraSchematic2({ value }) {
62146
62925
  style: { width: 150, height: 150 * H / W2 },
62147
62926
  onPointerDown: (e3) => {
62148
62927
  e3.stopPropagation();
62149
- const rect = e3.currentTarget.getBoundingClientRect();
62150
- const cx2 = (e3.clientX - rect.left) / rect.width * W2;
62151
- const cy = (e3.clientY - rect.top) / rect.height * H;
62152
- if (size !== null) {
62153
- setView((prev) => ({
62154
- ...prev,
62155
- tx: size.w / 2 - cx2 * fit * prev.zoom,
62156
- ty: size.h / 2 - cy * fit * prev.zoom
62157
- }));
62158
- }
62928
+ const el = e3.currentTarget;
62929
+ el.setPointerCapture(e3.pointerId);
62930
+ transition("cancel");
62931
+ minimapDragRef.current = true;
62932
+ minimapJump(el, e3.clientX, e3.clientY);
62933
+ },
62934
+ onPointerMove: (e3) => {
62935
+ if (!minimapDragRef.current) return;
62936
+ e3.stopPropagation();
62937
+ minimapJump(e3.currentTarget, e3.clientX, e3.clientY);
62938
+ },
62939
+ onPointerUp: (e3) => {
62940
+ minimapDragRef.current = false;
62941
+ e3.currentTarget.releasePointerCapture(e3.pointerId);
62159
62942
  },
62160
62943
  children: [
62161
62944
  value.zones.map((zone) => /* @__PURE__ */ jsx(
@@ -62176,8 +62959,8 @@ const EastChakraSchematic = memo$2(function EastChakraSchematic2({ value }) {
62176
62959
  {
62177
62960
  css: styles2.minimapViewport,
62178
62961
  style: {
62179
- left: `${Math.max(0, -view.tx / ppu / W2 * 100)}%`,
62180
- top: `${Math.max(0, -view.ty / ppu / H * 100)}%`,
62962
+ left: `${Math.max(0, -cameraSnapshot.tx / ppu / W2 * 100)}%`,
62963
+ top: `${Math.max(0, -cameraSnapshot.ty / ppu / H * 100)}%`,
62181
62964
  width: `${Math.min(100, size.w / ppu / W2 * 100)}%`,
62182
62965
  height: `${Math.min(100, size.h / ppu / H * 100)}%`
62183
62966
  }