primitive-app 2.1.7 → 3.0.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.
Files changed (45) hide show
  1. package/dist/chunk-rCbxF51U.cjs +1 -0
  2. package/dist/components/ui/checkbox/Checkbox.vue.d.ts +1 -1
  3. package/dist/components/ui/native-select/NativeSelectOptGroup.vue.d.ts +2 -2
  4. package/dist/components/ui/native-select/NativeSelectOption.vue.d.ts +2 -2
  5. package/dist/components/ui/separator/Separator.vue.d.ts +1 -1
  6. package/dist/components/ui/switch/Switch.vue.d.ts +1 -0
  7. package/dist/components/ui/switch/Switch.vue.d.ts.map +1 -1
  8. package/dist/components/ui/tabs/Tabs.vue.d.ts +2 -2
  9. package/dist/composables/useJsBaoDataLoader.d.ts.map +1 -1
  10. package/dist/dev-tools/document-explorer/DocumentExplorerIndex.vue.d.ts.map +1 -1
  11. package/dist/dev-tools/document-explorer/components/DocumentListPanel.vue.d.ts +3 -15
  12. package/dist/dev-tools/document-explorer/components/DocumentListPanel.vue.d.ts.map +1 -1
  13. package/dist/dev-tools/document-explorer/components/DocumentListSection.vue.d.ts +6 -9
  14. package/dist/dev-tools/document-explorer/components/DocumentListSection.vue.d.ts.map +1 -1
  15. package/dist/dev-tools/document-explorer/components/DocumentPropertiesPanel.vue.d.ts.map +1 -1
  16. package/dist/dev-tools/document-explorer/components/DocumentSharingSection.vue.d.ts.map +1 -1
  17. package/dist/dev-tools/document-explorer/index.d.ts +1 -1
  18. package/dist/dev-tools/document-explorer/index.d.ts.map +1 -1
  19. package/dist/dev-tools/document-explorer/types.d.ts +29 -25
  20. package/dist/dev-tools/document-explorer/types.d.ts.map +1 -1
  21. package/dist/dev-tools/index.d.ts +3 -2
  22. package/dist/dev-tools/index.d.ts.map +1 -1
  23. package/dist/dev-tools/test-harness/TestRunner.vue.d.ts +5 -0
  24. package/dist/dev-tools/test-harness/TestRunner.vue.d.ts.map +1 -1
  25. package/dist/dev-tools/test-harness/index.d.ts +3 -2
  26. package/dist/dev-tools/test-harness/index.d.ts.map +1 -1
  27. package/dist/dev-tools/test-harness/lib.d.ts +38 -15
  28. package/dist/dev-tools/test-harness/lib.d.ts.map +1 -1
  29. package/dist/dev-tools/test-harness/types.d.ts +3 -13
  30. package/dist/dev-tools/test-harness/types.d.ts.map +1 -1
  31. package/dist/dev-tools/vite-plugin/DevToolsOverlay.vue.d.ts +5 -0
  32. package/dist/dev-tools/vite-plugin/DevToolsOverlay.vue.d.ts.map +1 -1
  33. package/dist/dev-tools/vite-plugin/DevToolsRoot.vue.d.ts +5 -0
  34. package/dist/dev-tools/vite-plugin/DevToolsRoot.vue.d.ts.map +1 -1
  35. package/dist/dev-tools/vite-plugin/index.cjs +23 -17
  36. package/dist/dev-tools/vite-plugin/index.js +61 -119
  37. package/dist/dev-tools/vite-plugin/plugin.d.ts.map +1 -1
  38. package/dist/index.cjs +7 -7
  39. package/dist/index.d.ts +2 -1
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/index.js +14147 -17290
  42. package/dist/primitive-app.css +2 -1
  43. package/package.json +30 -30
  44. package/dist/dev-tools/document-explorer/components/InvitationPropertiesPanel.vue.d.ts +0 -14
  45. package/dist/dev-tools/document-explorer/components/InvitationPropertiesPanel.vue.d.ts.map +0 -1
@@ -1,19 +1,27 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("node:fs"),w=require("node:module"),I=require("glob"),f=require("path");var l=typeof document<"u"?document.currentScript:null;async function g(r,s="src/tests",p="**/*.primitive-test.ts"){const a=f.join(r,s);return(await I.glob(p,{cwd:a,ignore:["**/node_modules/**","**/dist/**"],absolute:!0})).map(n=>({absolutePath:n,relativePath:f.relative(r,n)}))}const y="virtual:primitive-devtools",c="\0"+y,_="virtual:primitive-devtools-init",h="\0"+_;function A(r={}){const{testsDir:s="src/tests",testPattern:p="**/*.primitive-test.ts",appName:a="Primitive App",enabled:u=!0,keyboardShortcut:n}=r;let d,v;const b=w.createRequire(typeof document>"u"?require("url").pathToFileURL(__filename).href:l&&l.tagName.toUpperCase()==="SCRIPT"&&l.src||new URL("dev-tools/vite-plugin/index.cjs",document.baseURI).href).resolve("vue-sonner/style.css"),S=C.readFileSync(b,"utf-8");return{name:"primitive-devtools",configResolved(e){d=e.root,v=e.command==="serve"},resolveId(e){if(e===y)return c;if(e===_)return h},async load(e){if(e===c){const t=await g(d,s,p),o=t.map((m,i)=>`import testGroup${i} from '${m.absolutePath}';`).join(`
2
- `),T=t.map((m,i)=>`...(Array.isArray(testGroup${i}) ? testGroup${i} : [testGroup${i}])`).join(`,
3
- `);return`
4
- ${o}
5
-
6
- export const testGroups = [
7
- ${t.length>0?T:""}
8
- ];
9
-
10
- export const appName = ${JSON.stringify(a)};
11
- export const keyboardShortcut = ${JSON.stringify(n)};
12
- `}if(e===h)return`
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../../chunk-rCbxF51U.cjs`);let t=require(`node:fs`),n=require(`node:module`),r=require(`glob`),i=require(`path`);i=e.i(i,1);async function a(e,t=`src/tests`,n=`**/*.primitive-test.ts`){return(await(0,r.glob)(n,{cwd:i.default.join(e,t),ignore:[`**/node_modules/**`,`**/dist/**`],absolute:!0})).map(t=>({absolutePath:t,relativePath:i.default.relative(e,t)}))}var o=`virtual:primitive-devtools`,s=`\0`+o,c=`virtual:primitive-devtools-init`,l=`\0`+c;function u(e={}){let{testsDir:r=`src/tests`,testPattern:i=`**/*.primitive-test.ts`,appName:u=`Primitive App`,enabled:d=!0,keyboardShortcut:f}=e,p,m,h=(0,t.readFileSync)((0,n.createRequire)({}.url).resolve(`vue-sonner/style.css`),`utf-8`);return{name:`primitive-devtools`,configResolved(e){p=e.root,m=e.command===`serve`},resolveId(e){if(e===o)return s;if(e===c)return l},async load(e){if(e===s)return`
2
+ const groups = [];
3
+ const loadErrors = [];
4
+
5
+ ${(await a(p,r,i)).map((e,t)=>` try {
6
+ const mod${t} = await import('${e.absolutePath}');
7
+ const val${t} = mod${t}.default;
8
+ if (Array.isArray(val${t})) groups.push(...val${t});
9
+ else if (val${t}) groups.push(val${t});
10
+ } catch (e) {
11
+ console.error('[primitive-devtools] Failed to load test file: ${e.relativePath}', e);
12
+ loadErrors.push({ file: '${e.relativePath}', error: e });
13
+ }`).join(`
14
+ `)}
15
+
16
+ export const testGroups = groups;
17
+ export const testLoadErrors = loadErrors;
18
+ export const appName = ${JSON.stringify(u)};
19
+ export const keyboardShortcut = ${JSON.stringify(f)};
20
+ `;if(e===l)return`
13
21
  import { createApp, h } from 'vue';
14
22
  import { createPinia } from 'pinia';
15
23
  import { DevToolsRoot, jsBaoClientService } from 'primitive-app';
16
- import { testGroups, appName, keyboardShortcut } from 'virtual:primitive-devtools';
24
+ import { testGroups, testLoadErrors, appName, keyboardShortcut } from 'virtual:primitive-devtools';
17
25
 
18
26
  // Wait for the host app to register its client on window.__primitiveAppClient
19
27
  async function waitForAppClient() {
@@ -48,7 +56,7 @@ const observer = new MutationObserver(async (mutations, obs) => {
48
56
  // The jsBaoClientService is linked to the app's client above
49
57
  const devToolsApp = createApp({
50
58
  render() {
51
- return h(DevToolsRoot, { testGroups, appName, keyboardShortcut });
59
+ return h(DevToolsRoot, { testGroups, testLoadErrors, appName, keyboardShortcut });
52
60
  }
53
61
  });
54
62
  devToolsApp.use(createPinia());
@@ -57,6 +65,4 @@ const observer = new MutationObserver(async (mutations, obs) => {
57
65
  });
58
66
 
59
67
  observer.observe(document.body, { childList: true, subtree: true });
60
- `},transformIndexHtml(e){if(!v||!u)return e;const t=`<style data-primitive-devtools-sonner>${S}</style>`;return e.replace("</body>",`${t}
61
- <script type="module" src="/@id/__x00__virtual:primitive-devtools-init"><\/script>
62
- </body>`)},hotUpdate({file:e,server:t}){if(e.endsWith(".primitive-test.ts")){const o=t.moduleGraph.getModuleById(c);o&&(t.moduleGraph.invalidateModule(o),t.ws.send({type:"full-reload"}))}}}}exports.primitiveDevTools=A;
68
+ `},transformIndexHtml(e){if(!m||!d)return e;let t=`<style data-primitive-devtools-sonner>${h}</style>`;return e.replace(`</body>`,`${t}\n<script type="module" src="/@id/__x00__virtual:primitive-devtools-init"><\/script>\n</body>`)},hotUpdate({file:e,server:t}){if(e.endsWith(`.primitive-test.ts`)){let e=t.moduleGraph.getModuleById(s);e&&(t.moduleGraph.invalidateModule(e),t.ws.send({type:`full-reload`}))}}}}exports.primitiveDevTools=u;
@@ -1,124 +1,66 @@
1
- import { readFileSync as S } from "node:fs";
2
- import { createRequire as T } from "node:module";
3
- import { glob as A } from "glob";
4
- import v from "path";
5
- async function C(r, n = "src/tests", p = "**/*.primitive-test.ts") {
6
- const a = v.join(r, n);
7
- return (await A(p, {
8
- cwd: a,
9
- ignore: ["**/node_modules/**", "**/dist/**"],
10
- absolute: !0
11
- })).map((s) => ({
12
- absolutePath: s,
13
- relativePath: v.relative(r, s)
14
- }));
1
+ import { readFileSync as e } from "node:fs";
2
+ import { createRequire as t } from "node:module";
3
+ import { glob as n } from "glob";
4
+ import r from "path";
5
+ //#region src/dev-tools/vite-plugin/test-discovery.ts
6
+ async function i(e, t = "src/tests", i = "**/*.primitive-test.ts") {
7
+ return (await n(i, {
8
+ cwd: r.join(e, t),
9
+ ignore: ["**/node_modules/**", "**/dist/**"],
10
+ absolute: !0
11
+ })).map((t) => ({
12
+ absolutePath: t,
13
+ relativePath: r.relative(e, t)
14
+ }));
15
15
  }
16
- const h = "virtual:primitive-devtools", l = "\0" + h, y = "virtual:primitive-devtools-init", f = "\0" + y;
17
- function k(r = {}) {
18
- const {
19
- testsDir: n = "src/tests",
20
- testPattern: p = "**/*.primitive-test.ts",
21
- appName: a = "Primitive App",
22
- enabled: c = !0,
23
- keyboardShortcut: s
24
- } = r;
25
- let d, m;
26
- const b = T(import.meta.url).resolve("vue-sonner/style.css"), _ = S(b, "utf-8");
27
- return {
28
- name: "primitive-devtools",
29
- configResolved(t) {
30
- d = t.root, m = t.command === "serve";
31
- },
32
- resolveId(t) {
33
- if (t === h)
34
- return l;
35
- if (t === y)
36
- return f;
37
- },
38
- async load(t) {
39
- if (t === l) {
40
- const e = await C(d, n, p), o = e.map((u, i) => `import testGroup${i} from '${u.absolutePath}';`).join(`
41
- `), w = e.map(
42
- (u, i) => `...(Array.isArray(testGroup${i}) ? testGroup${i} : [testGroup${i}])`
43
- ).join(`,
44
- `);
45
- return `
46
- ${o}
16
+ //#endregion
17
+ //#region src/dev-tools/vite-plugin/plugin.ts
18
+ var a = "virtual:primitive-devtools", o = "\0" + a, s = "virtual:primitive-devtools-init", c = "\0" + s;
19
+ function l(n = {}) {
20
+ let { testsDir: r = "src/tests", testPattern: l = "**/*.primitive-test.ts", appName: u = "Primitive App", enabled: d = !0, keyboardShortcut: f } = n, p, m, h = e(t(import.meta.url).resolve("vue-sonner/style.css"), "utf-8");
21
+ return {
22
+ name: "primitive-devtools",
23
+ configResolved(e) {
24
+ p = e.root, m = e.command === "serve";
25
+ },
26
+ resolveId(e) {
27
+ if (e === a) return o;
28
+ if (e === s) return c;
29
+ },
30
+ async load(e) {
31
+ if (e === o) return `
32
+ const groups = [];
33
+ const loadErrors = [];
47
34
 
48
- export const testGroups = [
49
- ${e.length > 0 ? w : ""}
50
- ];
35
+ ${(await i(p, r, l)).map((e, t) => ` try {
36
+ const mod${t} = await import('${e.absolutePath}');
37
+ const val${t} = mod${t}.default;
38
+ if (Array.isArray(val${t})) groups.push(...val${t});
39
+ else if (val${t}) groups.push(val${t});
40
+ } catch (e) {
41
+ console.error('[primitive-devtools] Failed to load test file: ${e.relativePath}', e);
42
+ loadErrors.push({ file: '${e.relativePath}', error: e });
43
+ }`).join("\n")}
51
44
 
52
- export const appName = ${JSON.stringify(a)};
53
- export const keyboardShortcut = ${JSON.stringify(s)};
45
+ export const testGroups = groups;
46
+ export const testLoadErrors = loadErrors;
47
+ export const appName = ${JSON.stringify(u)};
48
+ export const keyboardShortcut = ${JSON.stringify(f)};
54
49
  `;
55
- }
56
- if (t === f)
57
- return `
58
- import { createApp, h } from 'vue';
59
- import { createPinia } from 'pinia';
60
- import { DevToolsRoot, jsBaoClientService } from 'primitive-app';
61
- import { testGroups, appName, keyboardShortcut } from 'virtual:primitive-devtools';
62
-
63
- // Wait for the host app to register its client on window.__primitiveAppClient
64
- async function waitForAppClient() {
65
- return new Promise((resolve) => {
66
- const check = () => {
67
- if (window.__primitiveAppClient) {
68
- resolve(window.__primitiveAppClient);
69
- } else {
70
- setTimeout(check, 100);
71
- }
72
- };
73
- check();
74
- });
75
- }
76
-
77
- // Wait for main app to mount, then inject dev tools
78
- const observer = new MutationObserver(async (mutations, obs) => {
79
- const appEl = document.getElementById('app');
80
- if (appEl && appEl.children.length > 0) {
81
- obs.disconnect();
82
-
83
- // Wait for the app's client to be available and link it to the debug suite
84
- const appClient = await waitForAppClient();
85
- jsBaoClientService.setExternalClient(appClient);
86
-
87
- // Create mount point for dev tools
88
- const devToolsMount = document.createElement('div');
89
- devToolsMount.id = 'primitive-devtools-root';
90
- document.body.appendChild(devToolsMount);
91
-
92
- // Create the dev tools app with its own Pinia instance
93
- // The jsBaoClientService is linked to the app's client above
94
- const devToolsApp = createApp({
95
- render() {
96
- return h(DevToolsRoot, { testGroups, appName, keyboardShortcut });
97
- }
98
- });
99
- devToolsApp.use(createPinia());
100
- devToolsApp.mount('#primitive-devtools-root');
101
- }
102
- });
103
-
104
- observer.observe(document.body, { childList: true, subtree: true });
105
- `;
106
- },
107
- transformIndexHtml(t) {
108
- if (!m || !c) return t;
109
- const e = `<style data-primitive-devtools-sonner>${_}</style>`;
110
- return t.replace("</body>", `${e}
111
- <script type="module" src="/@id/__x00__virtual:primitive-devtools-init"><\/script>
112
- </body>`);
113
- },
114
- hotUpdate({ file: t, server: e }) {
115
- if (t.endsWith(".primitive-test.ts")) {
116
- const o = e.moduleGraph.getModuleById(l);
117
- o && (e.moduleGraph.invalidateModule(o), e.ws.send({ type: "full-reload" }));
118
- }
119
- }
120
- };
50
+ if (e === c) return "\nimport { createApp, h } from 'vue';\nimport { createPinia } from 'pinia';\nimport { DevToolsRoot, jsBaoClientService } from 'primitive-app';\nimport { testGroups, testLoadErrors, appName, keyboardShortcut } from 'virtual:primitive-devtools';\n\n// Wait for the host app to register its client on window.__primitiveAppClient\nasync function waitForAppClient() {\n return new Promise((resolve) => {\n const check = () => {\n if (window.__primitiveAppClient) {\n resolve(window.__primitiveAppClient);\n } else {\n setTimeout(check, 100);\n }\n };\n check();\n });\n}\n\n// Wait for main app to mount, then inject dev tools\nconst observer = new MutationObserver(async (mutations, obs) => {\n const appEl = document.getElementById('app');\n if (appEl && appEl.children.length > 0) {\n obs.disconnect();\n\n // Wait for the app's client to be available and link it to the debug suite\n const appClient = await waitForAppClient();\n jsBaoClientService.setExternalClient(appClient);\n\n // Create mount point for dev tools\n const devToolsMount = document.createElement('div');\n devToolsMount.id = 'primitive-devtools-root';\n document.body.appendChild(devToolsMount);\n\n // Create the dev tools app with its own Pinia instance\n // The jsBaoClientService is linked to the app's client above\n const devToolsApp = createApp({\n render() {\n return h(DevToolsRoot, { testGroups, testLoadErrors, appName, keyboardShortcut });\n }\n });\n devToolsApp.use(createPinia());\n devToolsApp.mount('#primitive-devtools-root');\n }\n});\n\nobserver.observe(document.body, { childList: true, subtree: true });\n";
51
+ },
52
+ transformIndexHtml(e) {
53
+ if (!m || !d) return e;
54
+ let t = `<style data-primitive-devtools-sonner>${h}</style>`;
55
+ return e.replace("</body>", `${t}\n<script type="module" src="/@id/__x00__virtual:primitive-devtools-init"><\/script>\n</body>`);
56
+ },
57
+ hotUpdate({ file: e, server: t }) {
58
+ if (e.endsWith(".primitive-test.ts")) {
59
+ let e = t.moduleGraph.getModuleById(o);
60
+ e && (t.moduleGraph.invalidateModule(e), t.ws.send({ type: "full-reload" }));
61
+ }
62
+ }
63
+ };
121
64
  }
122
- export {
123
- k as primitiveDevTools
124
- };
65
+ //#endregion
66
+ export { l as primitiveDevTools };
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/dev-tools/vite-plugin/plugin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAInC,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAQD,wBAAgB,iBAAiB,CAC/B,OAAO,GAAE,wBAA6B,GACrC,MAAM,CA+IR"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/dev-tools/vite-plugin/plugin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAInC,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAQD,wBAAgB,iBAAiB,CAC/B,OAAO,GAAE,wBAA6B,GACrC,MAAM,CAoJR"}