@reopt-ai/opt-devtool 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/README.md +4 -2
- package/dist/brandapp/index.cjs +11 -8
- package/dist/brandapp/index.d.cts +14 -17
- package/dist/brandapp/index.d.ts +14 -17
- package/dist/brandapp/index.js +11 -8
- package/dist/datagrid/index.cjs +5 -5
- package/dist/datagrid/index.d.cts +3 -6
- package/dist/datagrid/index.d.ts +3 -6
- package/dist/datagrid/index.js +5 -5
- package/dist/editor/index.cjs +5 -5
- package/dist/editor/index.d.cts +3 -6
- package/dist/editor/index.d.ts +3 -6
- package/dist/editor/index.js +5 -5
- package/dist/harness/index.cjs +1 -1
- package/dist/harness/index.d.cts +6 -8
- package/dist/harness/index.d.ts +6 -8
- package/dist/harness/index.js +1 -2
- package/dist/{harness-DU8hP98g.js → harness-CJZXBH3w.js} +15 -23
- package/dist/{harness-CoRqiJWO.cjs → harness-CPOp9Wlj.cjs} +21 -23
- package/dist/index.cjs +46 -80
- package/dist/index.d.cts +7 -13
- package/dist/index.d.ts +7 -13
- package/dist/index.js +44 -78
- package/dist/{provider-Bn7CAE_Y.js → provider-Cjg2rSYG.js} +6 -12
- package/dist/{provider-CLRiXjfD.cjs → provider-H53ZWHCo.cjs} +8 -15
- package/dist/theme/index.cjs +9 -7
- package/dist/theme/index.d.cts +5 -8
- package/dist/theme/index.d.ts +5 -8
- package/dist/theme/index.js +9 -7
- package/dist/{theme-isolate-F-oX2d4W.js → theme-isolate-BOo3J259.js} +2 -3
- package/dist/{theme-isolate-DgSS935z.cjs → theme-isolate-D9AMkYrD.cjs} +2 -3
- package/dist/{types-DvhcaPXA.js → types-BKmW0EBr.js} +1 -2
- package/dist/{types-B_abMm2B.cjs → types-Bz4DijhU.cjs} +1 -2
- package/dist/{types-oHbLkgEH.d.ts → types-D_lNT2Nr.d.cts} +0 -4
- package/dist/{types-oHbLkgEH.d.cts → types-D_lNT2Nr.d.ts} +0 -4
- package/dist/ui/index.cjs +1 -1
- package/dist/ui/index.d.cts +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +1 -2
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { i as _objectSpread2, n as useOptDevtoolPlugin, r as useOptDevtoolRegistry, t as OptDevtoolProvider } from "./provider-
|
|
3
|
-
import { t as
|
|
4
|
-
import {
|
|
5
|
-
import { a as getShellSnapshot, c as toggleShellOverlay, i as getShellOverlay, o as subscribeShellOverlay, r as getShellManagerHref, s as subscribeShellSnapshot, t as ShellOverlay } from "./harness-DU8hP98g.js";
|
|
2
|
+
import { i as _objectSpread2, n as useOptDevtoolPlugin, r as useOptDevtoolRegistry, t as OptDevtoolProvider } from "./provider-Cjg2rSYG.js";
|
|
3
|
+
import { n as PANEL_STYLE, t as ISOLATE_STYLE } from "./theme-isolate-BOo3J259.js";
|
|
4
|
+
import { a as getShellSnapshot, c as toggleShellOverlay, i as getShellOverlay, l as SHELL_THEME_EVENT, o as subscribeShellOverlay, r as getShellManagerHref, s as subscribeShellSnapshot, t as ShellOverlay } from "./harness-CJZXBH3w.js";
|
|
6
5
|
import { themeConfigToSnapshot, useThemeDevtoolBridge } from "./theme/index.js";
|
|
6
|
+
import { t as OPT_DEVTOOL_CONFIGURE_EVENT } from "./types-BKmW0EBr.js";
|
|
7
7
|
import * as React from "react";
|
|
8
8
|
import { useEffect, useRef, useState } from "react";
|
|
9
9
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
import { cn, computeSpatialTargets, getTrappedContextRole, shouldSkipArrow, useOptTheme } from "@reopt-ai/opt-ui";
|
|
11
11
|
import { ID_REGISTRY, SLUG_TO_ID } from "@reopt-ai/opt-ui/id-registry";
|
|
12
12
|
import { contrastRatio, wcagLevel } from "@reopt-ai/opt-palette";
|
|
13
|
-
|
|
14
|
-
//#region src/scanning/constants.ts
|
|
13
|
+
// src/scanning/constants.ts
|
|
15
14
|
/**
|
|
16
|
-
* @deprecated since 0.1.0 — opt-
|
|
17
|
-
*
|
|
18
|
-
*
|
|
15
|
+
* @deprecated since 0.1.0 — `@reopt-ai/opt-ui`가 1.2.x까지 공개 export하던
|
|
16
|
+
* `OPT_UI_HELPER_CONFIGURE_EVENT`(UIDebugger, 2026-04-04 제거)의 이벤트
|
|
17
|
+
* 이름입니다. 해당 버전을 쓰던 앱이 아직 dispatch할 수 있으므로 리스너를
|
|
18
|
+
* 유지합니다. 신규 소비자는 {@link OPT_DEVTOOL_CONFIGURE_EVENT}만 사용하세요.
|
|
19
|
+
* 다음 major(2.0.0)에서 제거 예정.
|
|
19
20
|
*/
|
|
20
21
|
const LEGACY_OPT_UI_HELPER_CONFIGURE_EVENT = "opt-ui-helper-configure";
|
|
21
22
|
const TABBABLE = [
|
|
@@ -205,8 +206,7 @@ const CORNER_LABELS = [
|
|
|
205
206
|
label: "↘"
|
|
206
207
|
}
|
|
207
208
|
];
|
|
208
|
-
|
|
209
|
-
//#region src/scanning/visibility.ts
|
|
209
|
+
// src/scanning/visibility.ts
|
|
210
210
|
/** isVisible — see usage in callers. */
|
|
211
211
|
function isVisible(el) {
|
|
212
212
|
if (!el.offsetParent && getComputedStyle(el).position !== "fixed") return false;
|
|
@@ -220,8 +220,7 @@ function safeRect(el) {
|
|
|
220
220
|
if (rect.width === 0 && rect.height === 0) return null;
|
|
221
221
|
return rect;
|
|
222
222
|
}
|
|
223
|
-
|
|
224
|
-
//#region src/scanning/tabbable.ts
|
|
223
|
+
// src/scanning/tabbable.ts
|
|
225
224
|
/** getTabbable — see usage in callers. */
|
|
226
225
|
function getTabbable() {
|
|
227
226
|
const els = Array.from(document.querySelectorAll(TABBABLE)).filter((el) => {
|
|
@@ -237,8 +236,7 @@ function getTabbable() {
|
|
|
237
236
|
positive.sort((a, b) => a.tabIndex - b.tabIndex);
|
|
238
237
|
return [...positive, ...zero];
|
|
239
238
|
}
|
|
240
|
-
|
|
241
|
-
//#region src/scanning/attributes.ts
|
|
239
|
+
// src/scanning/attributes.ts
|
|
242
240
|
/** getAriaAttrs — see usage in callers. */
|
|
243
241
|
function getAriaAttrs(el) {
|
|
244
242
|
return Array.from(el.attributes).filter((attribute) => attribute.name.startsWith("aria-")).map((attribute) => [attribute.name, attribute.value]);
|
|
@@ -306,8 +304,7 @@ function getOptIdentityFromAncestors(el) {
|
|
|
306
304
|
}
|
|
307
305
|
return null;
|
|
308
306
|
}
|
|
309
|
-
|
|
310
|
-
//#region src/scanning/fiber.ts
|
|
307
|
+
// src/scanning/fiber.ts
|
|
311
308
|
/** getOpsUIComponentType — see usage in callers. */
|
|
312
309
|
function getOpsUIComponentType(name) {
|
|
313
310
|
if (OPS_UI_BLOCKS.has(name)) return "block";
|
|
@@ -426,8 +423,7 @@ function findOpsUIComponents() {
|
|
|
426
423
|
} catch (_unused3) {}
|
|
427
424
|
return results;
|
|
428
425
|
}
|
|
429
|
-
|
|
430
|
-
//#region src/scanning/composite.ts
|
|
426
|
+
// src/scanning/composite.ts
|
|
431
427
|
/** getCompositeItems — see usage in callers. */
|
|
432
428
|
function getCompositeItems(container) {
|
|
433
429
|
return Array.from(container.querySelectorAll(ITEM_ROLES)).filter((item) => {
|
|
@@ -625,14 +621,12 @@ function getCompositeInfo(el) {
|
|
|
625
621
|
arrows
|
|
626
622
|
}, loopWrap);
|
|
627
623
|
}
|
|
628
|
-
|
|
629
|
-
//#region src/scanning/spatial.ts
|
|
624
|
+
// src/scanning/spatial.ts
|
|
630
625
|
/** getProtectedDirs — see usage in callers. */
|
|
631
626
|
function getProtectedDirs(el) {
|
|
632
627
|
return ALL_DIRS.filter((direction) => shouldSkipArrow(el, direction));
|
|
633
628
|
}
|
|
634
|
-
|
|
635
|
-
//#region src/i18n/ko.ts
|
|
629
|
+
// src/i18n/ko.ts
|
|
636
630
|
/** opt-devtool Korean label catalog. Used as the package default. */
|
|
637
631
|
const koDevtoolLabels = {
|
|
638
632
|
panelTitle: "opt-devtool",
|
|
@@ -688,8 +682,7 @@ const koDevtoolLabels = {
|
|
|
688
682
|
filterPrimitives: "Primitives",
|
|
689
683
|
filterAll: "전체"
|
|
690
684
|
};
|
|
691
|
-
|
|
692
|
-
//#region src/panels/shared.tsx
|
|
685
|
+
// src/panels/shared.tsx
|
|
693
686
|
/** elLabel — see usage in callers. */
|
|
694
687
|
function elLabel(el) {
|
|
695
688
|
const tag = el.tagName.toLowerCase();
|
|
@@ -825,8 +818,7 @@ function Toggle({ active, onToggle, children }) {
|
|
|
825
818
|
children
|
|
826
819
|
});
|
|
827
820
|
}
|
|
828
|
-
|
|
829
|
-
//#region src/panels/component-trace.tsx
|
|
821
|
+
// src/panels/component-trace.tsx
|
|
830
822
|
/** ComponentTree — see usage in callers. */
|
|
831
823
|
function ComponentTree({ chain }) {
|
|
832
824
|
const reversed = [...chain].reverse();
|
|
@@ -852,8 +844,7 @@ function ComponentTree({ chain }) {
|
|
|
852
844
|
})
|
|
853
845
|
});
|
|
854
846
|
}
|
|
855
|
-
|
|
856
|
-
//#region src/panels/component-tree.tsx
|
|
847
|
+
// src/panels/component-tree.tsx
|
|
857
848
|
const { useMemo: useMemo$2 } = React;
|
|
858
849
|
/** buildComponentHierarchy — see usage in callers. */
|
|
859
850
|
function buildComponentHierarchy(components, displayedEl) {
|
|
@@ -925,8 +916,7 @@ function ComponentTreeViewer({ displayedEl, opsUIComponents }) {
|
|
|
925
916
|
children: hierarchy.map((root) => renderNode(root, 0))
|
|
926
917
|
});
|
|
927
918
|
}
|
|
928
|
-
|
|
929
|
-
//#region src/panels/snapshot-text.ts
|
|
919
|
+
// src/panels/snapshot-text.ts
|
|
930
920
|
/** buildSnapshotText — see usage in callers. */
|
|
931
921
|
function buildSnapshotText(el, componentChain, tabInfo, composite, ariaAttrs, dataAttrs, spatialTargets, trappedContext, protectedDirs, optIdentity = null) {
|
|
932
922
|
const lines = ["=== opt-devtool Snapshot ==="];
|
|
@@ -972,8 +962,7 @@ function buildSnapshotText(el, componentChain, tabInfo, composite, ariaAttrs, da
|
|
|
972
962
|
}
|
|
973
963
|
return lines.join("\n");
|
|
974
964
|
}
|
|
975
|
-
|
|
976
|
-
//#region src/panels/theme-panel.tsx
|
|
965
|
+
// src/panels/theme-panel.tsx
|
|
977
966
|
const { useCallback: useCallback$7, useEffect: useEffect$8, useMemo: useMemo$1, useState: useState$8 } = React;
|
|
978
967
|
const COLOR_TOKENS = {
|
|
979
968
|
primary: [
|
|
@@ -1410,8 +1399,7 @@ function ThemePanel({ visible }) {
|
|
|
1410
1399
|
]
|
|
1411
1400
|
});
|
|
1412
1401
|
}
|
|
1413
|
-
|
|
1414
|
-
//#region src/panels/harness-panel.tsx
|
|
1402
|
+
// src/panels/harness-panel.tsx
|
|
1415
1403
|
const { useCallback: useCallback$6, useEffect: useEffect$7, useState: useState$7, useSyncExternalStore: useSyncExternalStore$1 } = React;
|
|
1416
1404
|
const DEFAULTS = {
|
|
1417
1405
|
density: "comfortable",
|
|
@@ -1837,8 +1825,7 @@ function ShellPanel() {
|
|
|
1837
1825
|
]
|
|
1838
1826
|
});
|
|
1839
1827
|
}
|
|
1840
|
-
|
|
1841
|
-
//#region src/overlays/shared.tsx
|
|
1828
|
+
// src/overlays/shared.tsx
|
|
1842
1829
|
/** HighlightRing — see usage in callers. */
|
|
1843
1830
|
function HighlightRing({ rect, color, solid }) {
|
|
1844
1831
|
return /* @__PURE__ */ jsx("div", {
|
|
@@ -2025,8 +2012,7 @@ function ProtectedDirBadges({ rect, dirs }) {
|
|
|
2025
2012
|
}, dir);
|
|
2026
2013
|
}) });
|
|
2027
2014
|
}
|
|
2028
|
-
|
|
2029
|
-
//#region src/overlays/focus-guide.tsx
|
|
2015
|
+
// src/overlays/focus-guide.tsx
|
|
2030
2016
|
const { useCallback: useCallback$5, useEffect: useEffect$6, useRef: useRef$5, useState: useState$6 } = React;
|
|
2031
2017
|
/** FocusOverlays — see usage in callers. */
|
|
2032
2018
|
function FocusOverlays({ current, tabNext, tabPrev, arrows, spatialTargets, protectedDirs }) {
|
|
@@ -2166,8 +2152,7 @@ function FocusOverlays({ current, tabNext, tabPrev, arrows, spatialTargets, prot
|
|
|
2166
2152
|
]
|
|
2167
2153
|
});
|
|
2168
2154
|
}
|
|
2169
|
-
|
|
2170
|
-
//#region src/overlays/tab-order.tsx
|
|
2155
|
+
// src/overlays/tab-order.tsx
|
|
2171
2156
|
const { useCallback: useCallback$4, useEffect: useEffect$5, useRef: useRef$4, useState: useState$5 } = React;
|
|
2172
2157
|
/** TabOrderBadges — see usage in callers. */
|
|
2173
2158
|
function TabOrderBadges({ tabbable, current }) {
|
|
@@ -2220,8 +2205,7 @@ function TabOrderBadges({ tabbable, current }) {
|
|
|
2220
2205
|
}, badge.index))
|
|
2221
2206
|
});
|
|
2222
2207
|
}
|
|
2223
|
-
|
|
2224
|
-
//#region src/overlays/inspect-tool.tsx
|
|
2208
|
+
// src/overlays/inspect-tool.tsx
|
|
2225
2209
|
const { useCallback: useCallback$3, useEffect: useEffect$4, useRef: useRef$3, useState: useState$4 } = React;
|
|
2226
2210
|
/** InspectOverlay — see usage in callers. */
|
|
2227
2211
|
function InspectOverlay({ element, pinned }) {
|
|
@@ -2258,8 +2242,7 @@ function InspectOverlay({ element, pinned }) {
|
|
|
2258
2242
|
})
|
|
2259
2243
|
});
|
|
2260
2244
|
}
|
|
2261
|
-
|
|
2262
|
-
//#region src/overlays/component-labels.tsx
|
|
2245
|
+
// src/overlays/component-labels.tsx
|
|
2263
2246
|
const { useCallback: useCallback$2, useEffect: useEffect$3, useRef: useRef$2, useState: useState$3 } = React;
|
|
2264
2247
|
/** ComponentLabelsOverlay — see usage in callers. */
|
|
2265
2248
|
function ComponentLabelsOverlay({ components }) {
|
|
@@ -2329,8 +2312,7 @@ function ComponentLabelsOverlay({ components }) {
|
|
|
2329
2312
|
})] }, label.id))]
|
|
2330
2313
|
});
|
|
2331
2314
|
}
|
|
2332
|
-
|
|
2333
|
-
//#region src/overlays/composite-bounds.tsx
|
|
2315
|
+
// src/overlays/composite-bounds.tsx
|
|
2334
2316
|
const { useCallback: useCallback$1, useEffect: useEffect$2, useRef: useRef$1, useState: useState$2 } = React;
|
|
2335
2317
|
/** CompositeBoundsOverlay — see usage in callers. */
|
|
2336
2318
|
function CompositeBoundsOverlay({ zones }) {
|
|
@@ -2405,8 +2387,7 @@ function CompositeBoundsOverlay({ zones }) {
|
|
|
2405
2387
|
})] }, bound.id))
|
|
2406
2388
|
});
|
|
2407
2389
|
}
|
|
2408
|
-
|
|
2409
|
-
//#region src/hooks/use-devtool-keybinding.ts
|
|
2390
|
+
// src/hooks/use-devtool-keybinding.ts
|
|
2410
2391
|
/**
|
|
2411
2392
|
* Bind Ctrl+Shift+F to toggle the devtool panel.
|
|
2412
2393
|
* Pure side-effect hook — relies on the caller's state setter.
|
|
@@ -2423,8 +2404,7 @@ function useDevtoolKeybinding(toggle) {
|
|
|
2423
2404
|
return () => window.removeEventListener("keydown", onKey);
|
|
2424
2405
|
}, [toggle]);
|
|
2425
2406
|
}
|
|
2426
|
-
|
|
2427
|
-
//#region src/hooks/use-devtool-config-event.ts
|
|
2407
|
+
// src/hooks/use-devtool-config-event.ts
|
|
2428
2408
|
/**
|
|
2429
2409
|
* Listen for `OPT_DEVTOOL_CONFIGURE_EVENT` (and the legacy
|
|
2430
2410
|
* `opt-ui-helper-configure`) and forward the payload to a consumer-supplied
|
|
@@ -2446,8 +2426,7 @@ function useDevtoolConfigEvent(apply) {
|
|
|
2446
2426
|
};
|
|
2447
2427
|
}, [apply]);
|
|
2448
2428
|
}
|
|
2449
|
-
|
|
2450
|
-
//#region src/hooks/use-focus-tracking.ts
|
|
2429
|
+
// src/hooks/use-focus-tracking.ts
|
|
2451
2430
|
const FOCUS_HISTORY_LIMIT = 10;
|
|
2452
2431
|
/** Returns the event target as an HTMLElement only if outside the devtool overlay. */
|
|
2453
2432
|
function getExternalTarget$2(event) {
|
|
@@ -2488,8 +2467,7 @@ function useFocusTracking({ enabled }) {
|
|
|
2488
2467
|
tabbable
|
|
2489
2468
|
};
|
|
2490
2469
|
}
|
|
2491
|
-
|
|
2492
|
-
//#region src/hooks/use-inspect-mode.ts
|
|
2470
|
+
// src/hooks/use-inspect-mode.ts
|
|
2493
2471
|
/** Returns the event target as an HTMLElement only if outside the devtool overlay. */
|
|
2494
2472
|
function getExternalTarget$1(event) {
|
|
2495
2473
|
const el = event.target;
|
|
@@ -2537,8 +2515,7 @@ function useInspectMode({ enabled }) {
|
|
|
2537
2515
|
pinned
|
|
2538
2516
|
};
|
|
2539
2517
|
}
|
|
2540
|
-
|
|
2541
|
-
//#region src/hooks/use-scan-ops-ui-components.ts
|
|
2518
|
+
// src/hooks/use-scan-ops-ui-components.ts
|
|
2542
2519
|
const SCAN_ATTR_FILTER$1 = [
|
|
2543
2520
|
"hidden",
|
|
2544
2521
|
"aria-hidden",
|
|
@@ -2608,8 +2585,7 @@ function useScanOpsUIComponents({ enabled }) {
|
|
|
2608
2585
|
}, [enabled]);
|
|
2609
2586
|
return components;
|
|
2610
2587
|
}
|
|
2611
|
-
|
|
2612
|
-
//#region src/hooks/use-scan-composite-bounds.ts
|
|
2588
|
+
// src/hooks/use-scan-composite-bounds.ts
|
|
2613
2589
|
const SCAN_ATTR_FILTER = [
|
|
2614
2590
|
"hidden",
|
|
2615
2591
|
"aria-hidden",
|
|
@@ -2748,8 +2724,7 @@ function useEventLog({ enabled }) {
|
|
|
2748
2724
|
clear: () => setEntries([])
|
|
2749
2725
|
};
|
|
2750
2726
|
}
|
|
2751
|
-
|
|
2752
|
-
//#region src/components/devtool-header.tsx
|
|
2727
|
+
// src/components/devtool-header.tsx
|
|
2753
2728
|
/**
|
|
2754
2729
|
* Sticky panel header — title, copy button, corner picker, and close button.
|
|
2755
2730
|
* Pure presentational; all state lives in the caller.
|
|
@@ -2822,8 +2797,7 @@ function DevtoolHeader({ labels, copied, panelCorner, onCopy, onCornerChange, on
|
|
|
2822
2797
|
})]
|
|
2823
2798
|
});
|
|
2824
2799
|
}
|
|
2825
|
-
|
|
2826
|
-
//#region src/components/devtool-tab-bar.tsx
|
|
2800
|
+
// src/components/devtool-tab-bar.tsx
|
|
2827
2801
|
/** Top-level tab switcher (component / editor / theme / harness). */
|
|
2828
2802
|
function DevtoolTabBar({ active, labels, onChange }) {
|
|
2829
2803
|
const tabs = [
|
|
@@ -2893,8 +2867,7 @@ function DevtoolTabBar({ active, labels, onChange }) {
|
|
|
2893
2867
|
}, id))
|
|
2894
2868
|
});
|
|
2895
2869
|
}
|
|
2896
|
-
|
|
2897
|
-
//#region src/components/editor-tab-panel.tsx
|
|
2870
|
+
// src/components/editor-tab-panel.tsx
|
|
2898
2871
|
/**
|
|
2899
2872
|
* Editor tab body — switcher tabs across registered editor plugins, plus
|
|
2900
2873
|
* the active plugin's panel render. Renders an empty-state message when
|
|
@@ -2923,8 +2896,7 @@ function EditorTabPanel({ labels, plugins, activePlugin, onActivate }) {
|
|
|
2923
2896
|
})]
|
|
2924
2897
|
});
|
|
2925
2898
|
}
|
|
2926
|
-
|
|
2927
|
-
//#region src/components/brandapp-tab-panel.tsx
|
|
2899
|
+
// src/components/brandapp-tab-panel.tsx
|
|
2928
2900
|
/** Brandapp tab body for registered Brandapp SDK integration panels. */
|
|
2929
2901
|
function BrandappTabPanel({ labels, plugins, activePlugin, onActivate }) {
|
|
2930
2902
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -2948,8 +2920,7 @@ function BrandappTabPanel({ labels, plugins, activePlugin, onActivate }) {
|
|
|
2948
2920
|
})]
|
|
2949
2921
|
});
|
|
2950
2922
|
}
|
|
2951
|
-
|
|
2952
|
-
//#region src/components/component-tab-panel.tsx
|
|
2923
|
+
// src/components/component-tab-panel.tsx
|
|
2953
2924
|
/**
|
|
2954
2925
|
* Body of the "component" tab. Renders all focus-driven sections (current
|
|
2955
2926
|
* focus, component trace, component tree, tab order, arrow keys, spatial
|
|
@@ -3273,8 +3244,7 @@ function ComponentTabPanel({ labels, displayedEl, isInspecting, pinnedInspect, c
|
|
|
3273
3244
|
]
|
|
3274
3245
|
});
|
|
3275
3246
|
}
|
|
3276
|
-
|
|
3277
|
-
//#region src/components/component-engine-plugins.tsx
|
|
3247
|
+
// src/components/component-engine-plugins.tsx
|
|
3278
3248
|
/**
|
|
3279
3249
|
* Body for the per-engine plugin panels rendered under the component tab.
|
|
3280
3250
|
* Mirrors {@link EditorTabPanel} but always renders the switcher (callers
|
|
@@ -3303,8 +3273,7 @@ function ComponentEnginePlugins({ labels, plugins, activePlugin, onActivate }) {
|
|
|
3303
3273
|
})]
|
|
3304
3274
|
});
|
|
3305
3275
|
}
|
|
3306
|
-
|
|
3307
|
-
//#region src/components/component-toggles-footer.tsx
|
|
3276
|
+
// src/components/component-toggles-footer.tsx
|
|
3308
3277
|
/**
|
|
3309
3278
|
* Sticky footer with the overlay/info-panel toggle groups for the component
|
|
3310
3279
|
* tab. Pure presentational — every toggle wires straight back to a setter.
|
|
@@ -3384,8 +3353,7 @@ function ToggleGroup({ heading, switches }) {
|
|
|
3384
3353
|
}, label))
|
|
3385
3354
|
})] });
|
|
3386
3355
|
}
|
|
3387
|
-
|
|
3388
|
-
//#region src/opt-devtool.tsx
|
|
3356
|
+
// src/opt-devtool.tsx
|
|
3389
3357
|
const { useCallback, useEffect: useEffect$1, useMemo, useState: useState$1, useSyncExternalStore } = React;
|
|
3390
3358
|
/**
|
|
3391
3359
|
* Auto-bridge: listens for ShellProvider theme CustomEvents and feeds
|
|
@@ -3698,8 +3666,7 @@ function OptDevtool({ defaultOpen = false, labels: labelsProp }) {
|
|
|
3698
3666
|
})
|
|
3699
3667
|
] });
|
|
3700
3668
|
}
|
|
3701
|
-
|
|
3702
|
-
//#region src/i18n/en.ts
|
|
3669
|
+
// src/i18n/en.ts
|
|
3703
3670
|
/** opt-devtool English label catalog. */
|
|
3704
3671
|
const enDevtoolLabels = {
|
|
3705
3672
|
panelTitle: "opt-devtool",
|
|
@@ -3755,5 +3722,4 @@ const enDevtoolLabels = {
|
|
|
3755
3722
|
filterPrimitives: "Primitives",
|
|
3756
3723
|
filterAll: "All"
|
|
3757
3724
|
};
|
|
3758
|
-
//#endregion
|
|
3759
3725
|
export { OPT_DEVTOOL_CONFIGURE_EVENT, OptDevtool, OptDevtoolProvider, koDevtoolLabels as defaultLabels, koDevtoolLabels, enDevtoolLabels, useOptDevtoolPlugin };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
|
|
4
|
+
// \0@oxc-project+runtime@0.156.0/helpers/esm/typeof.js
|
|
5
5
|
function _typeof(o) {
|
|
6
6
|
"@babel/helpers - typeof";
|
|
7
7
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -10,8 +10,7 @@ function _typeof(o) {
|
|
|
10
10
|
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
11
11
|
}, _typeof(o);
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
|
|
13
|
+
// \0@oxc-project+runtime@0.156.0/helpers/esm/toPrimitive.js
|
|
15
14
|
function toPrimitive(t, r) {
|
|
16
15
|
if ("object" != _typeof(t) || !t) return t;
|
|
17
16
|
var e = t[Symbol.toPrimitive];
|
|
@@ -22,14 +21,12 @@ function toPrimitive(t, r) {
|
|
|
22
21
|
}
|
|
23
22
|
return ("string" === r ? String : Number)(t);
|
|
24
23
|
}
|
|
25
|
-
|
|
26
|
-
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
|
|
24
|
+
// \0@oxc-project+runtime@0.156.0/helpers/esm/toPropertyKey.js
|
|
27
25
|
function toPropertyKey(t) {
|
|
28
26
|
var i = toPrimitive(t, "string");
|
|
29
27
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
30
28
|
}
|
|
31
|
-
|
|
32
|
-
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
|
|
29
|
+
// \0@oxc-project+runtime@0.156.0/helpers/esm/defineProperty.js
|
|
33
30
|
function _defineProperty(e, r, t) {
|
|
34
31
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
35
32
|
value: t,
|
|
@@ -38,8 +35,7 @@ function _defineProperty(e, r, t) {
|
|
|
38
35
|
writable: !0
|
|
39
36
|
}) : e[r] = t, e;
|
|
40
37
|
}
|
|
41
|
-
|
|
42
|
-
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/objectSpread2.js
|
|
38
|
+
// \0@oxc-project+runtime@0.156.0/helpers/esm/objectSpread2.js
|
|
43
39
|
function ownKeys(e, r) {
|
|
44
40
|
var t = Object.keys(e);
|
|
45
41
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -61,8 +57,7 @@ function _objectSpread2(e) {
|
|
|
61
57
|
}
|
|
62
58
|
return e;
|
|
63
59
|
}
|
|
64
|
-
|
|
65
|
-
//#region src/provider.tsx
|
|
60
|
+
// src/provider.tsx
|
|
66
61
|
const OptDevtoolRegistryContext = React.createContext({
|
|
67
62
|
plugins: [],
|
|
68
63
|
registerPlugin: () => () => void 0
|
|
@@ -112,5 +107,4 @@ function useOptDevtoolPlugin(plugin) {
|
|
|
112
107
|
registrationKey
|
|
113
108
|
]);
|
|
114
109
|
}
|
|
115
|
-
//#endregion
|
|
116
110
|
export { _objectSpread2 as i, useOptDevtoolPlugin as n, useOptDevtoolRegistry as r, OptDevtoolProvider as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
2
|
+
// \0rolldown/runtime.js
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -16,15 +16,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
}
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
20
20
|
value: mod,
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
|
23
|
-
//#endregion
|
|
24
23
|
let react = require("react");
|
|
25
24
|
react = __toESM(react, 1);
|
|
26
25
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
27
|
-
|
|
26
|
+
// \0@oxc-project+runtime@0.156.0/helpers/esm/typeof.js
|
|
28
27
|
function _typeof(o) {
|
|
29
28
|
"@babel/helpers - typeof";
|
|
30
29
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -33,8 +32,7 @@ function _typeof(o) {
|
|
|
33
32
|
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
34
33
|
}, _typeof(o);
|
|
35
34
|
}
|
|
36
|
-
|
|
37
|
-
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
|
|
35
|
+
// \0@oxc-project+runtime@0.156.0/helpers/esm/toPrimitive.js
|
|
38
36
|
function toPrimitive(t, r) {
|
|
39
37
|
if ("object" != _typeof(t) || !t) return t;
|
|
40
38
|
var e = t[Symbol.toPrimitive];
|
|
@@ -45,14 +43,12 @@ function toPrimitive(t, r) {
|
|
|
45
43
|
}
|
|
46
44
|
return ("string" === r ? String : Number)(t);
|
|
47
45
|
}
|
|
48
|
-
|
|
49
|
-
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
|
|
46
|
+
// \0@oxc-project+runtime@0.156.0/helpers/esm/toPropertyKey.js
|
|
50
47
|
function toPropertyKey(t) {
|
|
51
48
|
var i = toPrimitive(t, "string");
|
|
52
49
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
53
50
|
}
|
|
54
|
-
|
|
55
|
-
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
|
|
51
|
+
// \0@oxc-project+runtime@0.156.0/helpers/esm/defineProperty.js
|
|
56
52
|
function _defineProperty(e, r, t) {
|
|
57
53
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
58
54
|
value: t,
|
|
@@ -61,8 +57,7 @@ function _defineProperty(e, r, t) {
|
|
|
61
57
|
writable: !0
|
|
62
58
|
}) : e[r] = t, e;
|
|
63
59
|
}
|
|
64
|
-
|
|
65
|
-
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/objectSpread2.js
|
|
60
|
+
// \0@oxc-project+runtime@0.156.0/helpers/esm/objectSpread2.js
|
|
66
61
|
function ownKeys(e, r) {
|
|
67
62
|
var t = Object.keys(e);
|
|
68
63
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -84,8 +79,7 @@ function _objectSpread2(e) {
|
|
|
84
79
|
}
|
|
85
80
|
return e;
|
|
86
81
|
}
|
|
87
|
-
|
|
88
|
-
//#region src/provider.tsx
|
|
82
|
+
// src/provider.tsx
|
|
89
83
|
const OptDevtoolRegistryContext = react.createContext({
|
|
90
84
|
plugins: [],
|
|
91
85
|
registerPlugin: () => () => void 0
|
|
@@ -135,7 +129,6 @@ function useOptDevtoolPlugin(plugin) {
|
|
|
135
129
|
registrationKey
|
|
136
130
|
]);
|
|
137
131
|
}
|
|
138
|
-
//#endregion
|
|
139
132
|
Object.defineProperty(exports, "OptDevtoolProvider", {
|
|
140
133
|
enumerable: true,
|
|
141
134
|
get: function() {
|
package/dist/theme/index.cjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const require_provider = require("../provider-
|
|
5
|
-
const require_theme_isolate = require("../theme-isolate-
|
|
4
|
+
const require_provider = require("../provider-H53ZWHCo.cjs");
|
|
5
|
+
const require_theme_isolate = require("../theme-isolate-D9AMkYrD.cjs");
|
|
6
6
|
let react = require("react");
|
|
7
7
|
react = require_provider.__toESM(react, 1);
|
|
8
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
9
|
let _reopt_ai_opt_palette = require("@reopt-ai/opt-palette");
|
|
10
|
-
|
|
10
|
+
// src/theme/index.tsx
|
|
11
11
|
const AUDIT_PAIRS = [
|
|
12
12
|
["--opt-text", "--opt-surface"],
|
|
13
13
|
["--opt-accent-fg", "--opt-accent"],
|
|
@@ -20,7 +20,9 @@ function computeContrastPairs(tokens) {
|
|
|
20
20
|
const bgVal = tokens[bgName];
|
|
21
21
|
if (!fgVal || !bgVal) continue;
|
|
22
22
|
try {
|
|
23
|
-
const
|
|
23
|
+
const fgRgb = (0, _reopt_ai_opt_palette.hexToSrgb)(fgVal);
|
|
24
|
+
const bgRgb = (0, _reopt_ai_opt_palette.hexToSrgb)(bgVal);
|
|
25
|
+
const ratio = (0, _reopt_ai_opt_palette.contrastRatio)(fgRgb, bgRgb);
|
|
24
26
|
results.push({
|
|
25
27
|
fg: fgName,
|
|
26
28
|
bg: bgName,
|
|
@@ -279,7 +281,7 @@ function useThemeDevtoolBridge({ id = "theme", label = "Theme", order = 15 } = {
|
|
|
279
281
|
const inspect = react.useCallback((nextSnapshot) => {
|
|
280
282
|
setSnapshot(nextSnapshot);
|
|
281
283
|
}, []);
|
|
282
|
-
|
|
284
|
+
const plugin = react.useMemo(() => ({
|
|
283
285
|
id,
|
|
284
286
|
label,
|
|
285
287
|
order,
|
|
@@ -289,9 +291,9 @@ function useThemeDevtoolBridge({ id = "theme", label = "Theme", order = 15 } = {
|
|
|
289
291
|
label,
|
|
290
292
|
order,
|
|
291
293
|
snapshot
|
|
292
|
-
])
|
|
294
|
+
]);
|
|
295
|
+
require_provider.useOptDevtoolPlugin(plugin);
|
|
293
296
|
return { inspect };
|
|
294
297
|
}
|
|
295
|
-
//#endregion
|
|
296
298
|
exports.themeConfigToSnapshot = themeConfigToSnapshot;
|
|
297
299
|
exports.useThemeDevtoolBridge = useThemeDevtoolBridge;
|
package/dist/theme/index.d.cts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { ResolvedShellThemeConfig } from "@reopt-ai/opt-shell";
|
|
3
|
-
|
|
4
|
-
interface ThemeDevtoolSnapshot {
|
|
3
|
+
export interface ThemeDevtoolSnapshot {
|
|
5
4
|
mode: "preset" | "generated";
|
|
6
5
|
preset: string;
|
|
7
6
|
seed?: string;
|
|
@@ -19,16 +18,14 @@ interface ThemeDevtoolSnapshot {
|
|
|
19
18
|
level: "AAA" | "AA" | "Fail";
|
|
20
19
|
}[];
|
|
21
20
|
}
|
|
22
|
-
interface UseThemeDevtoolBridgeOptions {
|
|
21
|
+
export interface UseThemeDevtoolBridgeOptions {
|
|
23
22
|
id?: string;
|
|
24
23
|
label?: string;
|
|
25
24
|
order?: number;
|
|
26
25
|
}
|
|
27
|
-
interface RegisteredThemeDevtoolBridge {
|
|
26
|
+
export interface RegisteredThemeDevtoolBridge {
|
|
28
27
|
inspect: (snapshot: ThemeDevtoolSnapshot) => void;
|
|
29
28
|
}
|
|
30
29
|
/** Build a ThemeDevtoolSnapshot from a ResolvedShellThemeConfig */
|
|
31
|
-
declare function themeConfigToSnapshot(theme: ResolvedShellThemeConfig): ThemeDevtoolSnapshot;
|
|
32
|
-
declare function useThemeDevtoolBridge({ id, label, order }?: UseThemeDevtoolBridgeOptions): RegisteredThemeDevtoolBridge;
|
|
33
|
-
//#endregion
|
|
34
|
-
export { RegisteredThemeDevtoolBridge, ThemeDevtoolSnapshot, UseThemeDevtoolBridgeOptions, themeConfigToSnapshot, useThemeDevtoolBridge };
|
|
30
|
+
export declare function themeConfigToSnapshot(theme: ResolvedShellThemeConfig): ThemeDevtoolSnapshot;
|
|
31
|
+
export declare function useThemeDevtoolBridge({ id, label, order }?: UseThemeDevtoolBridgeOptions): RegisteredThemeDevtoolBridge;
|
package/dist/theme/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { ResolvedShellThemeConfig } from "@reopt-ai/opt-shell";
|
|
3
|
-
|
|
4
|
-
interface ThemeDevtoolSnapshot {
|
|
3
|
+
export interface ThemeDevtoolSnapshot {
|
|
5
4
|
mode: "preset" | "generated";
|
|
6
5
|
preset: string;
|
|
7
6
|
seed?: string;
|
|
@@ -19,16 +18,14 @@ interface ThemeDevtoolSnapshot {
|
|
|
19
18
|
level: "AAA" | "AA" | "Fail";
|
|
20
19
|
}[];
|
|
21
20
|
}
|
|
22
|
-
interface UseThemeDevtoolBridgeOptions {
|
|
21
|
+
export interface UseThemeDevtoolBridgeOptions {
|
|
23
22
|
id?: string;
|
|
24
23
|
label?: string;
|
|
25
24
|
order?: number;
|
|
26
25
|
}
|
|
27
|
-
interface RegisteredThemeDevtoolBridge {
|
|
26
|
+
export interface RegisteredThemeDevtoolBridge {
|
|
28
27
|
inspect: (snapshot: ThemeDevtoolSnapshot) => void;
|
|
29
28
|
}
|
|
30
29
|
/** Build a ThemeDevtoolSnapshot from a ResolvedShellThemeConfig */
|
|
31
|
-
declare function themeConfigToSnapshot(theme: ResolvedShellThemeConfig): ThemeDevtoolSnapshot;
|
|
32
|
-
declare function useThemeDevtoolBridge({ id, label, order }?: UseThemeDevtoolBridgeOptions): RegisteredThemeDevtoolBridge;
|
|
33
|
-
//#endregion
|
|
34
|
-
export { RegisteredThemeDevtoolBridge, ThemeDevtoolSnapshot, UseThemeDevtoolBridgeOptions, themeConfigToSnapshot, useThemeDevtoolBridge };
|
|
30
|
+
export declare function themeConfigToSnapshot(theme: ResolvedShellThemeConfig): ThemeDevtoolSnapshot;
|
|
31
|
+
export declare function useThemeDevtoolBridge({ id, label, order }?: UseThemeDevtoolBridgeOptions): RegisteredThemeDevtoolBridge;
|
package/dist/theme/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
|
-
import { n as useOptDevtoolPlugin } from "../provider-
|
|
4
|
-
import { t as ISOLATE_STYLE } from "../theme-isolate-
|
|
3
|
+
import { n as useOptDevtoolPlugin } from "../provider-Cjg2rSYG.js";
|
|
4
|
+
import { t as ISOLATE_STYLE } from "../theme-isolate-BOo3J259.js";
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { contrastRatio, hexToSrgb, wcagLevel } from "@reopt-ai/opt-palette";
|
|
8
|
-
|
|
8
|
+
// src/theme/index.tsx
|
|
9
9
|
const AUDIT_PAIRS = [
|
|
10
10
|
["--opt-text", "--opt-surface"],
|
|
11
11
|
["--opt-accent-fg", "--opt-accent"],
|
|
@@ -18,7 +18,9 @@ function computeContrastPairs(tokens) {
|
|
|
18
18
|
const bgVal = tokens[bgName];
|
|
19
19
|
if (!fgVal || !bgVal) continue;
|
|
20
20
|
try {
|
|
21
|
-
const
|
|
21
|
+
const fgRgb = hexToSrgb(fgVal);
|
|
22
|
+
const bgRgb = hexToSrgb(bgVal);
|
|
23
|
+
const ratio = contrastRatio(fgRgb, bgRgb);
|
|
22
24
|
results.push({
|
|
23
25
|
fg: fgName,
|
|
24
26
|
bg: bgName,
|
|
@@ -277,7 +279,7 @@ function useThemeDevtoolBridge({ id = "theme", label = "Theme", order = 15 } = {
|
|
|
277
279
|
const inspect = React.useCallback((nextSnapshot) => {
|
|
278
280
|
setSnapshot(nextSnapshot);
|
|
279
281
|
}, []);
|
|
280
|
-
|
|
282
|
+
const plugin = React.useMemo(() => ({
|
|
281
283
|
id,
|
|
282
284
|
label,
|
|
283
285
|
order,
|
|
@@ -287,8 +289,8 @@ function useThemeDevtoolBridge({ id = "theme", label = "Theme", order = 15 } = {
|
|
|
287
289
|
label,
|
|
288
290
|
order,
|
|
289
291
|
snapshot
|
|
290
|
-
])
|
|
292
|
+
]);
|
|
293
|
+
useOptDevtoolPlugin(plugin);
|
|
291
294
|
return { inspect };
|
|
292
295
|
}
|
|
293
|
-
//#endregion
|
|
294
296
|
export { themeConfigToSnapshot, useThemeDevtoolBridge };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { i as _objectSpread2 } from "./provider-
|
|
3
|
-
|
|
2
|
+
import { i as _objectSpread2 } from "./provider-Cjg2rSYG.js";
|
|
3
|
+
// src/theme-isolate.tsx
|
|
4
4
|
/**
|
|
5
5
|
* Style object that isolates opt-devtool from external themes.
|
|
6
6
|
*
|
|
@@ -39,5 +39,4 @@ const ISOLATE_STYLE = {
|
|
|
39
39
|
};
|
|
40
40
|
/** Panel-specific style — solid opaque background that blocks page content. */
|
|
41
41
|
const PANEL_STYLE = _objectSpread2(_objectSpread2({}, ISOLATE_STYLE), {}, { backgroundColor: "#0a0a0a" });
|
|
42
|
-
//#endregion
|
|
43
42
|
export { PANEL_STYLE as n, ISOLATE_STYLE as t };
|