@wodecorp/openui-vue-devtools 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 WodeCorp / OpenUI Vue Contributors
4
+ Portions derived from OpenUI, Copyright (c) 2011-2026 Thesys Inc.
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in
14
+ all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ THE SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,9 @@
1
- # Temporary Holding Version
1
+ # @wodecorp/openui-vue-devtools
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ OpenUI Vue 3 devtools headless runtime, thin host component (`OpenUIDevtools`), and CDN loader (`mountOpenUIDevtoolsFromCdn`) wired to `@openuidev/observability`.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pnpm add @wodecorp/openui-vue-devtools vue
9
+ ```
@@ -0,0 +1,14 @@
1
+ # Third-Party Notices
2
+
3
+ This repository implements Vue 3 counterpart packages for OpenUI and derives algorithms, styles, or component interaction semantics from the following open-source projects:
4
+
5
+ - **OpenUI** (`thesysdev/openui`, MIT License, Copyright (c) Thesys Inc.)
6
+ - **Radix Primitives** (`radix-ui/primitives`, MIT License, Copyright (c) WorkOS)
7
+ - **Floating UI** (`floating-ui/floating-ui`, MIT License, Copyright (c) Floating UI contributors)
8
+ - **React DayPicker** (`gpbl/react-day-picker`, MIT License, Copyright (c) Giampaolo Bellavite)
9
+ - **TanStack Table** (`TanStack/table`, MIT License, Copyright (c) Tanner Linsley)
10
+ - **Lucide Icons** (`lucide-icons/lucide`, ISC / MIT License, Copyright (c) Lucide Contributors)
11
+ - **KaTeX** (`KaTeX/KaTeX`, MIT License, Copyright (c) Khan Academy)
12
+ - **D3** (`d3/d3-scale`, `d3-selection`, `d3-shape`, `d3-geo`, ISC License)
13
+ - **Zustand** (`pmndrs/zustand`, MIT License)
14
+ - **aria-hidden** & **react-remove-scroll** (`theKashey`, MIT License)
package/dist/index.cjs ADDED
@@ -0,0 +1,130 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ let vue = require("vue");
3
+ // src/cdn.ts
4
+ /** Major (`0`), minor (`0.1`), or exact (`0.1.0`). */
5
+ const VERSION_RE = /^\d+(\.\d+){0,2}$/;
6
+ /**
7
+ * Normalize a CDN version pin. Returns `"latest"` when omitted/empty.
8
+ * Returns `null` when the string is present but not a major/minor/exact pin.
9
+ */
10
+ function normalizeCdnVersion(version) {
11
+ const trimmed = version?.trim();
12
+ if (!trimmed) return "latest";
13
+ return VERSION_RE.test(trimmed) ? trimmed : null;
14
+ }
15
+ const ALIAS_CACHE_MS = 3e5;
16
+ /**
17
+ * jsDelivr URL for the browser bundle.
18
+ * Omit `version` -> `@latest`. Otherwise major (`"0"`), minor (`"0.1"`),
19
+ * or exact (`"0.1.0"`) npm tags.
20
+ */
21
+ function browserBundleUrl(version) {
22
+ const tag = normalizeCdnVersion(version);
23
+ if (tag === null) return null;
24
+ const url = `https://cdn.jsdelivr.net/npm/@openuidev/devtools@${tag}/dist/devtools.browser.js`;
25
+ if (/^\d+\.\d+\.\d+$/.test(tag)) return url;
26
+ return `${url}?t=${Math.floor(Date.now() / ALIAS_CACHE_MS)}`;
27
+ }
28
+ /**
29
+ * Fetches the optional CDN browser bundle when explicitly enabled.
30
+ * Renders nothing itself and never throws if CDN or peer runtimes are absent.
31
+ */
32
+ function mountOpenUIDevtoolsFromCdn(opts = {}) {
33
+ const { version, enabled, ...widgetProps } = opts;
34
+ if (!(enabled ?? (typeof process === "undefined" || process.env?.NODE_ENV !== "production")) || typeof document === "undefined") return () => {};
35
+ const url = browserBundleUrl(version);
36
+ if (url === null) {
37
+ console.warn(`[@wodecorp/openui-vue-devtools] invalid version "${version?.trim()}" — use a major ("0"), minor ("0.1"), or exact ("0.1.0") pin. Widget not mounted.`);
38
+ return () => {};
39
+ }
40
+ let cancelled = false;
41
+ let unmount = () => {
42
+ cancelled = true;
43
+ };
44
+ import(
45
+ /* webpackIgnore: true */
46
+ /* @vite-ignore */
47
+ url
48
+ ).then((devtools) => {
49
+ if (cancelled || typeof devtools?.mountOpenUIDevtools !== "function") return;
50
+ const attach = () => {
51
+ if (cancelled) return;
52
+ unmount = devtools.mountOpenUIDevtools({ props: {
53
+ ...widgetProps,
54
+ enabled
55
+ } });
56
+ };
57
+ if (document.body) attach();
58
+ else document.addEventListener("DOMContentLoaded", attach, { once: true });
59
+ }).catch(() => {});
60
+ return () => unmount();
61
+ }
62
+ // src/OpenUIDevtools.ts
63
+ /**
64
+ * Development-only OpenUI Inspect / Debug widget.
65
+ *
66
+ * Vue counterpart of the upstream thin host wrapper: it renders nothing and
67
+ * fetches the CDN browser build, forwarding every prop. Pass `version` to pin
68
+ * the CDN tag (`"0"`, `"0.1"`, `"0.1.0"`); omit it for `@latest`.
69
+ */
70
+ const OpenUIDevtools = (0, vue.defineComponent)({
71
+ name: "OpenUIDevtools",
72
+ props: {
73
+ enabled: {
74
+ type: Boolean,
75
+ default: void 0
76
+ },
77
+ position: {
78
+ type: String,
79
+ default: void 0
80
+ },
81
+ maxEvents: {
82
+ type: Number,
83
+ default: void 0
84
+ },
85
+ errorsOnly: {
86
+ type: Boolean,
87
+ default: void 0
88
+ },
89
+ autoOpenOnError: {
90
+ type: Boolean,
91
+ default: void 0
92
+ },
93
+ theme: {
94
+ type: String,
95
+ default: void 0
96
+ },
97
+ version: {
98
+ type: String,
99
+ default: void 0
100
+ },
101
+ __autoMounted: {
102
+ type: Boolean,
103
+ default: void 0
104
+ }
105
+ },
106
+ setup(props) {
107
+ let dispose = () => {};
108
+ (0, vue.watchEffect)(() => {
109
+ dispose();
110
+ dispose = mountOpenUIDevtoolsFromCdn({
111
+ enabled: props.enabled,
112
+ position: props.position,
113
+ maxEvents: props.maxEvents,
114
+ errorsOnly: props.errorsOnly,
115
+ autoOpenOnError: props.autoOpenOnError,
116
+ theme: props.theme,
117
+ version: props.version,
118
+ __autoMounted: props.__autoMounted
119
+ });
120
+ });
121
+ (0, vue.onScopeDispose)(() => dispose());
122
+ return () => null;
123
+ }
124
+ });
125
+ exports.OpenUIDevtools = OpenUIDevtools;
126
+ exports.browserBundleUrl = browserBundleUrl;
127
+ exports.mountOpenUIDevtoolsFromCdn = mountOpenUIDevtoolsFromCdn;
128
+ exports.normalizeCdnVersion = normalizeCdnVersion;
129
+
130
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":["defineComponent","watchEffect","onScopeDispose"],"sources":["../src/cdn.ts","../src/OpenUIDevtools.ts"],"sourcesContent":["import type { OpenUIDevtoolsProps, OpenUIDevtoolsWidgetProps } from \"./types\";\n\n/** Major (`0`), minor (`0.1`), or exact (`0.1.0`). */\nconst VERSION_RE = /^\\d+(\\.\\d+){0,2}$/;\n\n/**\n * Normalize a CDN version pin. Returns `\"latest\"` when omitted/empty.\n * Returns `null` when the string is present but not a major/minor/exact pin.\n */\nexport function normalizeCdnVersion(version?: string): string | null {\n const trimmed = version?.trim();\n if (!trimmed) return \"latest\";\n return VERSION_RE.test(trimmed) ? trimmed : null;\n}\n\nconst ALIAS_CACHE_MS = 5 * 60 * 1000;\n\n/**\n * jsDelivr URL for the browser bundle.\n * Omit `version` -> `@latest`. Otherwise major (`\"0\"`), minor (`\"0.1\"`),\n * or exact (`\"0.1.0\"`) npm tags.\n */\nexport function browserBundleUrl(version?: string): string | null {\n const tag = normalizeCdnVersion(version);\n if (tag === null) return null;\n const url = `https://cdn.jsdelivr.net/npm/@openuidev/devtools@${tag}/dist/devtools.browser.js`;\n if (/^\\d+\\.\\d+\\.\\d+$/.test(tag)) return url;\n return `${url}?t=${Math.floor(Date.now() / ALIAS_CACHE_MS)}`;\n}\n\nexport type MountFromCdnOptions = OpenUIDevtoolsProps;\n\ntype BrowserModule = {\n mountOpenUIDevtools: (opts: {\n React?: unknown;\n ReactDOM?: unknown;\n ReactDOMClient?: unknown;\n loadReactLang?: () => Promise<unknown>;\n props?: OpenUIDevtoolsWidgetProps;\n }) => () => void;\n};\n\n/**\n * Fetches the optional CDN browser bundle when explicitly enabled.\n * Renders nothing itself and never throws if CDN or peer runtimes are absent.\n */\nexport function mountOpenUIDevtoolsFromCdn(opts: MountFromCdnOptions = {}): () => void {\n const { version, enabled, ...widgetProps } = opts;\n const isEnabled =\n enabled ?? (typeof process === \"undefined\" || process.env?.NODE_ENV !== \"production\");\n\n if (!isEnabled || typeof document === \"undefined\") {\n return () => {};\n }\n\n const url = browserBundleUrl(version);\n if (url === null) {\n console.warn(\n `[@wodecorp/openui-vue-devtools] invalid version \"${version?.trim()}\" — use a major (\"0\"), ` +\n `minor (\"0.1\"), or exact (\"0.1.0\") pin. Widget not mounted.`,\n );\n return () => {};\n }\n\n let cancelled = false;\n let unmount = () => {\n cancelled = true;\n };\n\n (import(/* webpackIgnore: true */ /* @vite-ignore */ url) as Promise<BrowserModule>)\n .then((devtools) => {\n if (cancelled || typeof devtools?.mountOpenUIDevtools !== \"function\") return;\n const attach = () => {\n if (cancelled) return;\n unmount = devtools.mountOpenUIDevtools({\n props: { ...widgetProps, enabled },\n });\n };\n if (document.body) attach();\n else document.addEventListener(\"DOMContentLoaded\", attach, { once: true });\n })\n .catch(() => {\n // Never let a CDN / mount failure break the host app.\n });\n\n return () => unmount();\n}\n","import { defineComponent, onScopeDispose, watchEffect, type PropType } from \"vue\";\nimport { mountOpenUIDevtoolsFromCdn } from \"./cdn\";\nimport type { ColorMode, DevtoolsPosition, OpenUIDevtoolsProps } from \"./types\";\n\nexport type { ColorMode, DevtoolsPosition, OpenUIDevtoolsProps } from \"./types\";\n\n/**\n * Development-only OpenUI Inspect / Debug widget.\n *\n * Vue counterpart of the upstream thin host wrapper: it renders nothing and\n * fetches the CDN browser build, forwarding every prop. Pass `version` to pin\n * the CDN tag (`\"0\"`, `\"0.1\"`, `\"0.1.0\"`); omit it for `@latest`.\n */\nexport const OpenUIDevtools = defineComponent({\n name: \"OpenUIDevtools\",\n props: {\n enabled: { type: Boolean, default: undefined },\n position: { type: String as PropType<DevtoolsPosition>, default: undefined },\n maxEvents: { type: Number, default: undefined },\n errorsOnly: { type: Boolean, default: undefined },\n autoOpenOnError: { type: Boolean, default: undefined },\n theme: { type: String as PropType<ColorMode>, default: undefined },\n version: { type: String, default: undefined },\n __autoMounted: { type: Boolean, default: undefined },\n },\n setup(props) {\n let dispose = () => {};\n watchEffect(() => {\n dispose();\n dispose = mountOpenUIDevtoolsFromCdn({\n enabled: props.enabled,\n position: props.position,\n maxEvents: props.maxEvents,\n errorsOnly: props.errorsOnly,\n autoOpenOnError: props.autoOpenOnError,\n theme: props.theme,\n version: props.version,\n __autoMounted: props.__autoMounted,\n });\n });\n onScopeDispose(() => dispose());\n return () => null;\n },\n});\n"],"mappings":";;;;AAGA,MAAM,aAAa;;;;;AAMnB,SAAgB,oBAAoB,SAAiC;CACnE,MAAM,UAA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AU;EAC7C,UAAU;GAAE,MAAM;GAAsC,SAAS,KAAA;EAAU;EAC3E,WAAW;GAAE,MAAM;GAAQ,SAAS,KAAA;EAAU;EAC9C,YAAY;GAAE,MAAM;GAAS,SAAS,KAAA;EAAU;EAChD,iBAAiB;GAAE,MAAM;GAAS,SAAS,KAAA;EAAU;EACrD,OAAO;GAAE,MAAM;GAA+B,SAAS,KAAA;EAAU;EACjE,SAAS;GAAE,MAAM;GAAQ,SAAS,KAAA;EAAU;EAC5C,eAAe;GAAE,MAAM;GAAS,SAAS,KAAA;EAAU;CACrD;CACA,MAAM,OAAO;EACX,IAAI,gBAAgB,CAAC;EACrBC,CAAAA,GAAAA,IAAAA,YAAAA,OAAkB;GAChB,QAAQ;GACR,UAAU,2BAA2B;IACnC,SAAS,MAAM;IACf,UAAU,MAAM;IAChB,WAAW,MAAM;IACjB,YAAY,MAAM;IAClB,iBAAiB,MAAM;IACvB,OAAO,MAAM;IACb,SAAS,MAAM;IACf,eAAe,MAAM;GACvB,CAAC;EACH,CAAC;EACDC,CAAAA,GAAAA,IAAAA,eAAAA,OAAqB,QAAQ,CAAC;EAC9B,aAAa;CACf;AACF,CAAC"}
@@ -0,0 +1,137 @@
1
+ import { PropType } from "vue";
2
+ /**
3
+ * The widget's own theme. Chosen explicitly in Settings (persisted) — the
4
+ * widget never sniffs the host page or the OS, so it looks the same in
5
+ * every app until you change it.
6
+ */
7
+ type ColorMode = "light" | "dark";
8
+ type DevtoolsPosition = "top-left" | "top-right" | "bottom-left" | "bottom-right";
9
+ /**
10
+ * Public props for `<OpenUIDevtools />`. The thin package entry fetches the
11
+ * CDN widget and forwards these into it (except `version`, which only
12
+ * selects which package tag to load).
13
+ */
14
+ interface OpenUIDevtoolsProps {
15
+ /** Force the widget on/off. Defaults to on outside production builds. */
16
+ enabled?: boolean;
17
+ /** Corner for the floating toggle button. Defaults to "bottom-right". */
18
+ position?: DevtoolsPosition;
19
+ /** How many events to keep; oldest are dropped first. */
20
+ maxEvents?: number;
21
+ /** Initial state of the drawer's "errors only" display filter. */
22
+ errorsOnly?: boolean;
23
+ /** Initial state of the drawer's "auto-open on error" checkbox. Defaults to true. */
24
+ autoOpenOnError?: boolean;
25
+ /** Widget UI theme. Overrides the stored Settings choice when present. */
26
+ theme?: ColorMode;
27
+ /**
28
+ * CDN package version to fetch. Omit for `@latest`.
29
+ * Must be a major (`"0"`), minor (`"0.1"`), or exact (`"0.1.0"`) pin.
30
+ */
31
+ version?: string;
32
+ /** @internal Set by react-lang's auto-mount. */
33
+ __autoMounted?: boolean;
34
+ }
35
+ /** Props the CDN widget itself understands (everything except the CDN tag). */
36
+ type OpenUIDevtoolsWidgetProps = Omit<OpenUIDevtoolsProps, "version">;
37
+ /**
38
+ * Development-only OpenUI Inspect / Debug widget.
39
+ *
40
+ * Vue counterpart of the upstream thin host wrapper: it renders nothing and
41
+ * fetches the CDN browser build, forwarding every prop. Pass `version` to pin
42
+ * the CDN tag (`"0"`, `"0.1"`, `"0.1.0"`); omit it for `@latest`.
43
+ */
44
+ export declare const OpenUIDevtools: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
45
+ enabled: {
46
+ type: BooleanConstructor;
47
+ default: undefined;
48
+ };
49
+ position: {
50
+ type: PropType<DevtoolsPosition>;
51
+ default: undefined;
52
+ };
53
+ maxEvents: {
54
+ type: NumberConstructor;
55
+ default: undefined;
56
+ };
57
+ errorsOnly: {
58
+ type: BooleanConstructor;
59
+ default: undefined;
60
+ };
61
+ autoOpenOnError: {
62
+ type: BooleanConstructor;
63
+ default: undefined;
64
+ };
65
+ theme: {
66
+ type: PropType<ColorMode>;
67
+ default: undefined;
68
+ };
69
+ version: {
70
+ type: StringConstructor;
71
+ default: undefined;
72
+ };
73
+ __autoMounted: {
74
+ type: BooleanConstructor;
75
+ default: undefined;
76
+ };
77
+ }>, () => null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
78
+ enabled: {
79
+ type: BooleanConstructor;
80
+ default: undefined;
81
+ };
82
+ position: {
83
+ type: PropType<DevtoolsPosition>;
84
+ default: undefined;
85
+ };
86
+ maxEvents: {
87
+ type: NumberConstructor;
88
+ default: undefined;
89
+ };
90
+ errorsOnly: {
91
+ type: BooleanConstructor;
92
+ default: undefined;
93
+ };
94
+ autoOpenOnError: {
95
+ type: BooleanConstructor;
96
+ default: undefined;
97
+ };
98
+ theme: {
99
+ type: PropType<ColorMode>;
100
+ default: undefined;
101
+ };
102
+ version: {
103
+ type: StringConstructor;
104
+ default: undefined;
105
+ };
106
+ __autoMounted: {
107
+ type: BooleanConstructor;
108
+ default: undefined;
109
+ };
110
+ }>> & Readonly<{}>, {
111
+ enabled: boolean;
112
+ position: DevtoolsPosition;
113
+ maxEvents: number;
114
+ errorsOnly: boolean;
115
+ autoOpenOnError: boolean;
116
+ theme: ColorMode;
117
+ version: string;
118
+ __autoMounted: boolean;
119
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
120
+ /**
121
+ * Normalize a CDN version pin. Returns `"latest"` when omitted/empty.
122
+ * Returns `null` when the string is present but not a major/minor/exact pin.
123
+ */
124
+ export declare function normalizeCdnVersion(version?: string): string | null;
125
+ /**
126
+ * jsDelivr URL for the browser bundle.
127
+ * Omit `version` -> `@latest`. Otherwise major (`"0"`), minor (`"0.1"`),
128
+ * or exact (`"0.1.0"`) npm tags.
129
+ */
130
+ export declare function browserBundleUrl(version?: string): string | null;
131
+ type MountFromCdnOptions = OpenUIDevtoolsProps;
132
+ /**
133
+ * Fetches the optional CDN browser bundle when explicitly enabled.
134
+ * Renders nothing itself and never throws if CDN or peer runtimes are absent.
135
+ */
136
+ export declare function mountOpenUIDevtoolsFromCdn(opts?: MountFromCdnOptions): () => void;
137
+ export type { ColorMode, DevtoolsPosition, MountFromCdnOptions, OpenUIDevtoolsProps, OpenUIDevtoolsWidgetProps };
@@ -0,0 +1,137 @@
1
+ import { PropType } from "vue";
2
+ /**
3
+ * The widget's own theme. Chosen explicitly in Settings (persisted) — the
4
+ * widget never sniffs the host page or the OS, so it looks the same in
5
+ * every app until you change it.
6
+ */
7
+ type ColorMode = "light" | "dark";
8
+ type DevtoolsPosition = "top-left" | "top-right" | "bottom-left" | "bottom-right";
9
+ /**
10
+ * Public props for `<OpenUIDevtools />`. The thin package entry fetches the
11
+ * CDN widget and forwards these into it (except `version`, which only
12
+ * selects which package tag to load).
13
+ */
14
+ interface OpenUIDevtoolsProps {
15
+ /** Force the widget on/off. Defaults to on outside production builds. */
16
+ enabled?: boolean;
17
+ /** Corner for the floating toggle button. Defaults to "bottom-right". */
18
+ position?: DevtoolsPosition;
19
+ /** How many events to keep; oldest are dropped first. */
20
+ maxEvents?: number;
21
+ /** Initial state of the drawer's "errors only" display filter. */
22
+ errorsOnly?: boolean;
23
+ /** Initial state of the drawer's "auto-open on error" checkbox. Defaults to true. */
24
+ autoOpenOnError?: boolean;
25
+ /** Widget UI theme. Overrides the stored Settings choice when present. */
26
+ theme?: ColorMode;
27
+ /**
28
+ * CDN package version to fetch. Omit for `@latest`.
29
+ * Must be a major (`"0"`), minor (`"0.1"`), or exact (`"0.1.0"`) pin.
30
+ */
31
+ version?: string;
32
+ /** @internal Set by react-lang's auto-mount. */
33
+ __autoMounted?: boolean;
34
+ }
35
+ /** Props the CDN widget itself understands (everything except the CDN tag). */
36
+ type OpenUIDevtoolsWidgetProps = Omit<OpenUIDevtoolsProps, "version">;
37
+ /**
38
+ * Development-only OpenUI Inspect / Debug widget.
39
+ *
40
+ * Vue counterpart of the upstream thin host wrapper: it renders nothing and
41
+ * fetches the CDN browser build, forwarding every prop. Pass `version` to pin
42
+ * the CDN tag (`"0"`, `"0.1"`, `"0.1.0"`); omit it for `@latest`.
43
+ */
44
+ export declare const OpenUIDevtools: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
45
+ enabled: {
46
+ type: BooleanConstructor;
47
+ default: undefined;
48
+ };
49
+ position: {
50
+ type: PropType<DevtoolsPosition>;
51
+ default: undefined;
52
+ };
53
+ maxEvents: {
54
+ type: NumberConstructor;
55
+ default: undefined;
56
+ };
57
+ errorsOnly: {
58
+ type: BooleanConstructor;
59
+ default: undefined;
60
+ };
61
+ autoOpenOnError: {
62
+ type: BooleanConstructor;
63
+ default: undefined;
64
+ };
65
+ theme: {
66
+ type: PropType<ColorMode>;
67
+ default: undefined;
68
+ };
69
+ version: {
70
+ type: StringConstructor;
71
+ default: undefined;
72
+ };
73
+ __autoMounted: {
74
+ type: BooleanConstructor;
75
+ default: undefined;
76
+ };
77
+ }>, () => null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
78
+ enabled: {
79
+ type: BooleanConstructor;
80
+ default: undefined;
81
+ };
82
+ position: {
83
+ type: PropType<DevtoolsPosition>;
84
+ default: undefined;
85
+ };
86
+ maxEvents: {
87
+ type: NumberConstructor;
88
+ default: undefined;
89
+ };
90
+ errorsOnly: {
91
+ type: BooleanConstructor;
92
+ default: undefined;
93
+ };
94
+ autoOpenOnError: {
95
+ type: BooleanConstructor;
96
+ default: undefined;
97
+ };
98
+ theme: {
99
+ type: PropType<ColorMode>;
100
+ default: undefined;
101
+ };
102
+ version: {
103
+ type: StringConstructor;
104
+ default: undefined;
105
+ };
106
+ __autoMounted: {
107
+ type: BooleanConstructor;
108
+ default: undefined;
109
+ };
110
+ }>> & Readonly<{}>, {
111
+ enabled: boolean;
112
+ position: DevtoolsPosition;
113
+ maxEvents: number;
114
+ errorsOnly: boolean;
115
+ autoOpenOnError: boolean;
116
+ theme: ColorMode;
117
+ version: string;
118
+ __autoMounted: boolean;
119
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
120
+ /**
121
+ * Normalize a CDN version pin. Returns `"latest"` when omitted/empty.
122
+ * Returns `null` when the string is present but not a major/minor/exact pin.
123
+ */
124
+ export declare function normalizeCdnVersion(version?: string): string | null;
125
+ /**
126
+ * jsDelivr URL for the browser bundle.
127
+ * Omit `version` -> `@latest`. Otherwise major (`"0"`), minor (`"0.1"`),
128
+ * or exact (`"0.1.0"`) npm tags.
129
+ */
130
+ export declare function browserBundleUrl(version?: string): string | null;
131
+ type MountFromCdnOptions = OpenUIDevtoolsProps;
132
+ /**
133
+ * Fetches the optional CDN browser bundle when explicitly enabled.
134
+ * Renders nothing itself and never throws if CDN or peer runtimes are absent.
135
+ */
136
+ export declare function mountOpenUIDevtoolsFromCdn(opts?: MountFromCdnOptions): () => void;
137
+ export type { ColorMode, DevtoolsPosition, MountFromCdnOptions, OpenUIDevtoolsProps, OpenUIDevtoolsWidgetProps };
package/dist/index.mjs ADDED
@@ -0,0 +1,126 @@
1
+ import { defineComponent, onScopeDispose, watchEffect } from "vue";
2
+ // src/cdn.ts
3
+ /** Major (`0`), minor (`0.1`), or exact (`0.1.0`). */
4
+ const VERSION_RE = /^\d+(\.\d+){0,2}$/;
5
+ /**
6
+ * Normalize a CDN version pin. Returns `"latest"` when omitted/empty.
7
+ * Returns `null` when the string is present but not a major/minor/exact pin.
8
+ */
9
+ function normalizeCdnVersion(version) {
10
+ const trimmed = version?.trim();
11
+ if (!trimmed) return "latest";
12
+ return VERSION_RE.test(trimmed) ? trimmed : null;
13
+ }
14
+ const ALIAS_CACHE_MS = 3e5;
15
+ /**
16
+ * jsDelivr URL for the browser bundle.
17
+ * Omit `version` -> `@latest`. Otherwise major (`"0"`), minor (`"0.1"`),
18
+ * or exact (`"0.1.0"`) npm tags.
19
+ */
20
+ function browserBundleUrl(version) {
21
+ const tag = normalizeCdnVersion(version);
22
+ if (tag === null) return null;
23
+ const url = `https://cdn.jsdelivr.net/npm/@openuidev/devtools@${tag}/dist/devtools.browser.js`;
24
+ if (/^\d+\.\d+\.\d+$/.test(tag)) return url;
25
+ return `${url}?t=${Math.floor(Date.now() / ALIAS_CACHE_MS)}`;
26
+ }
27
+ /**
28
+ * Fetches the optional CDN browser bundle when explicitly enabled.
29
+ * Renders nothing itself and never throws if CDN or peer runtimes are absent.
30
+ */
31
+ function mountOpenUIDevtoolsFromCdn(opts = {}) {
32
+ const { version, enabled, ...widgetProps } = opts;
33
+ if (!(enabled ?? (typeof process === "undefined" || process.env?.NODE_ENV !== "production")) || typeof document === "undefined") return () => {};
34
+ const url = browserBundleUrl(version);
35
+ if (url === null) {
36
+ console.warn(`[@wodecorp/openui-vue-devtools] invalid version "${version?.trim()}" — use a major ("0"), minor ("0.1"), or exact ("0.1.0") pin. Widget not mounted.`);
37
+ return () => {};
38
+ }
39
+ let cancelled = false;
40
+ let unmount = () => {
41
+ cancelled = true;
42
+ };
43
+ import(
44
+ /* webpackIgnore: true */
45
+ /* @vite-ignore */
46
+ url
47
+ ).then((devtools) => {
48
+ if (cancelled || typeof devtools?.mountOpenUIDevtools !== "function") return;
49
+ const attach = () => {
50
+ if (cancelled) return;
51
+ unmount = devtools.mountOpenUIDevtools({ props: {
52
+ ...widgetProps,
53
+ enabled
54
+ } });
55
+ };
56
+ if (document.body) attach();
57
+ else document.addEventListener("DOMContentLoaded", attach, { once: true });
58
+ }).catch(() => {});
59
+ return () => unmount();
60
+ }
61
+ // src/OpenUIDevtools.ts
62
+ /**
63
+ * Development-only OpenUI Inspect / Debug widget.
64
+ *
65
+ * Vue counterpart of the upstream thin host wrapper: it renders nothing and
66
+ * fetches the CDN browser build, forwarding every prop. Pass `version` to pin
67
+ * the CDN tag (`"0"`, `"0.1"`, `"0.1.0"`); omit it for `@latest`.
68
+ */
69
+ const OpenUIDevtools = defineComponent({
70
+ name: "OpenUIDevtools",
71
+ props: {
72
+ enabled: {
73
+ type: Boolean,
74
+ default: void 0
75
+ },
76
+ position: {
77
+ type: String,
78
+ default: void 0
79
+ },
80
+ maxEvents: {
81
+ type: Number,
82
+ default: void 0
83
+ },
84
+ errorsOnly: {
85
+ type: Boolean,
86
+ default: void 0
87
+ },
88
+ autoOpenOnError: {
89
+ type: Boolean,
90
+ default: void 0
91
+ },
92
+ theme: {
93
+ type: String,
94
+ default: void 0
95
+ },
96
+ version: {
97
+ type: String,
98
+ default: void 0
99
+ },
100
+ __autoMounted: {
101
+ type: Boolean,
102
+ default: void 0
103
+ }
104
+ },
105
+ setup(props) {
106
+ let dispose = () => {};
107
+ watchEffect(() => {
108
+ dispose();
109
+ dispose = mountOpenUIDevtoolsFromCdn({
110
+ enabled: props.enabled,
111
+ position: props.position,
112
+ maxEvents: props.maxEvents,
113
+ errorsOnly: props.errorsOnly,
114
+ autoOpenOnError: props.autoOpenOnError,
115
+ theme: props.theme,
116
+ version: props.version,
117
+ __autoMounted: props.__autoMounted
118
+ });
119
+ });
120
+ onScopeDispose(() => dispose());
121
+ return () => null;
122
+ }
123
+ });
124
+ export { OpenUIDevtools, browserBundleUrl, mountOpenUIDevtoolsFromCdn, normalizeCdnVersion };
125
+
126
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/cdn.ts","../src/OpenUIDevtools.ts"],"sourcesContent":["import type { OpenUIDevtoolsProps, OpenUIDevtoolsWidgetProps } from \"./types\";\n\n/** Major (`0`), minor (`0.1`), or exact (`0.1.0`). */\nconst VERSION_RE = /^\\d+(\\.\\d+){0,2}$/;\n\n/**\n * Normalize a CDN version pin. Returns `\"latest\"` when omitted/empty.\n * Returns `null` when the string is present but not a major/minor/exact pin.\n */\nexport function normalizeCdnVersion(version?: string): string | null {\n const trimmed = version?.trim();\n if (!trimmed) return \"latest\";\n return VERSION_RE.test(trimmed) ? trimmed : null;\n}\n\nconst ALIAS_CACHE_MS = 5 * 60 * 1000;\n\n/**\n * jsDelivr URL for the browser bundle.\n * Omit `version` -> `@latest`. Otherwise major (`\"0\"`), minor (`\"0.1\"`),\n * or exact (`\"0.1.0\"`) npm tags.\n */\nexport function browserBundleUrl(version?: string): string | null {\n const tag = normalizeCdnVersion(version);\n if (tag === null) return null;\n const url = `https://cdn.jsdelivr.net/npm/@openuidev/devtools@${tag}/dist/devtools.browser.js`;\n if (/^\\d+\\.\\d+\\.\\d+$/.test(tag)) return url;\n return `${url}?t=${Math.floor(Date.now() / ALIAS_CACHE_MS)}`;\n}\n\nexport type MountFromCdnOptions = OpenUIDevtoolsProps;\n\ntype BrowserModule = {\n mountOpenUIDevtools: (opts: {\n React?: unknown;\n ReactDOM?: unknown;\n ReactDOMClient?: unknown;\n loadReactLang?: () => Promise<unknown>;\n props?: OpenUIDevtoolsWidgetProps;\n }) => () => void;\n};\n\n/**\n * Fetches the optional CDN browser bundle when explicitly enabled.\n * Renders nothing itself and never throws if CDN or peer runtimes are absent.\n */\nexport function mountOpenUIDevtoolsFromCdn(opts: MountFromCdnOptions = {}): () => void {\n const { version, enabled, ...widgetProps } = opts;\n const isEnabled =\n enabled ?? (typeof process === \"undefined\" || process.env?.NODE_ENV !== \"production\");\n\n if (!isEnabled || typeof document === \"undefined\") {\n return () => {};\n }\n\n const url = browserBundleUrl(version);\n if (url === null) {\n console.warn(\n `[@wodecorp/openui-vue-devtools] invalid version \"${version?.trim()}\" — use a major (\"0\"), ` +\n `minor (\"0.1\"), or exact (\"0.1.0\") pin. Widget not mounted.`,\n );\n return () => {};\n }\n\n let cancelled = false;\n let unmount = () => {\n cancelled = true;\n };\n\n (import(/* webpackIgnore: true */ /* @vite-ignore */ url) as Promise<BrowserModule>)\n .then((devtools) => {\n if (cancelled || typeof devtools?.mountOpenUIDevtools !== \"function\") return;\n const attach = () => {\n if (cancelled) return;\n unmount = devtools.mountOpenUIDevtools({\n props: { ...widgetProps, enabled },\n });\n };\n if (document.body) attach();\n else document.addEventListener(\"DOMContentLoaded\", attach, { once: true });\n })\n .catch(() => {\n // Never let a CDN / mount failure break the host app.\n });\n\n return () => unmount();\n}\n","import { defineComponent, onScopeDispose, watchEffect, type PropType } from \"vue\";\nimport { mountOpenUIDevtoolsFromCdn } from \"./cdn\";\nimport type { ColorMode, DevtoolsPosition, OpenUIDevtoolsProps } from \"./types\";\n\nexport type { ColorMode, DevtoolsPosition, OpenUIDevtoolsProps } from \"./types\";\n\n/**\n * Development-only OpenUI Inspect / Debug widget.\n *\n * Vue counterpart of the upstream thin host wrapper: it renders nothing and\n * fetches the CDN browser build, forwarding every prop. Pass `version` to pin\n * the CDN tag (`\"0\"`, `\"0.1\"`, `\"0.1.0\"`); omit it for `@latest`.\n */\nexport const OpenUIDevtools = defineComponent({\n name: \"OpenUIDevtools\",\n props: {\n enabled: { type: Boolean, default: undefined },\n position: { type: String as PropType<DevtoolsPosition>, default: undefined },\n maxEvents: { type: Number, default: undefined },\n errorsOnly: { type: Boolean, default: undefined },\n autoOpenOnError: { type: Boolean, default: undefined },\n theme: { type: String as PropType<ColorMode>, default: undefined },\n version: { type: String, default: undefined },\n __autoMounted: { type: Boolean, default: undefined },\n },\n setup(props) {\n let dispose = () => {};\n watchEffect(() => {\n dispose();\n dispose = mountOpenUIDevtoolsFromCdn({\n enabled: props.enabled,\n position: props.position,\n maxEvents: props.maxEvents,\n errorsOnly: props.errorsOnly,\n autoOpenOnError: props.autoOpenOnError,\n theme: props.theme,\n version: props.version,\n __autoMounted: props.__autoMounted,\n });\n });\n onScopeDispose(() => dispose());\n return () => null;\n },\n});\n"],"mappings":";;;AAGA,MAAM,aAAa;;;;;AAMnB,SAAgB,oBAAoB,SAAiC;CACnE,MAAM,UAAU,SAAS,KAAK;CAC9B,IAAI,CAAC,SAAS,OAAO;CACrB,OAAO,WAAW,KAAK,OAAO,IAAI,UAAU;AAC9C;AAEA,MAAM,iBAAiB;;;;;;AAOvB,SAAgB,iBAAiB,SAAiC;CAChE,MAAM,MAAM,oBAAoB,OAAO;CACvC,IAAI,QAAQ,MAAM,OAAO;CACzB,MAAM,MAAM,oDAAoD,IAAI;CACpE,IAAI,kBAAkB,KAAK,GAAG,GAAG,OAAO;CACxC,OAAO,GAAG,IAAI,KAAK,KAAK,MAAM,KAAK,IAAI,IAAI,cAAc;AAC3D;;;;;AAkBA,SAAgB,2BAA2B,OAA4B,CA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Q;GACR,UAAU,2BAA2B;IACnC,SAAS,MAAM;IACf,UAAU,MAAM;IAChB,WAAW,MAAM;IACjB,YAAY,MAAM;IAClB,iBAAiB,MAAM;IACvB,OAAO,MAAM;IACb,SAAS,MAAM;IACf,eAAe,MAAM;GACvB,CAAC;EACH,CAAC;EACD,qBAAqB,QAAQ,CAAC;EAC9B,aAAa;CACf;AACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,66 @@
1
1
  {
2
2
  "name": "@wodecorp/openui-vue-devtools",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "OpenUI Vue 3 devtools headless runtime, host loader, and stream event adapter",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "engines": {
8
+ "node": ">=18"
9
+ },
10
+ "sideEffects": false,
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "http://10.1.1.156/wode/openuivue.git",
17
+ "directory": "packages/vue-devtools"
18
+ },
19
+ "files": [
20
+ "dist",
21
+ "README.md",
22
+ "LICENSE",
23
+ "THIRD_PARTY_NOTICES.md"
24
+ ],
25
+ "main": "./dist/index.cjs",
26
+ "module": "./dist/index.mjs",
27
+ "types": "./dist/index.d.mts",
28
+ "exports": {
29
+ ".": {
30
+ "import": {
31
+ "types": "./dist/index.d.mts",
32
+ "default": "./dist/index.mjs"
33
+ },
34
+ "require": {
35
+ "types": "./dist/index.d.cts",
36
+ "default": "./dist/index.cjs"
37
+ }
38
+ }
39
+ },
40
+ "dependencies": {
41
+ "@openuidev/observability": "^0.0.4"
42
+ },
43
+ "peerDependencies": {
44
+ "@wodecorp/openui-vue-lang": "^0.1.0",
45
+ "vue": "^3.4.0"
46
+ },
47
+ "peerDependenciesMeta": {
48
+ "@wodecorp/openui-vue-lang": {
49
+ "optional": true
50
+ }
51
+ },
52
+ "devDependencies": {
53
+ "@vue/test-utils": "^2.4.6",
54
+ "@wodecorp/openui-vue-lang": "0.1.0",
55
+ "jsdom": "^26.1.0",
56
+ "tsdown": "^0.23.7",
57
+ "typescript": "^5.9.3",
58
+ "vitest": "^3.2.4",
59
+ "vue": "^3.4.38"
60
+ },
61
+ "scripts": {
62
+ "build": "tsdown",
63
+ "typecheck": "tsc --noEmit -p tsconfig.json",
64
+ "test": "vitest run"
65
+ }
6
66
  }