@zoobzio/nuxt 0.0.1 → 0.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/README.md +51 -6
- package/app/app.vue +3 -5
- package/app/components/breadcrumb.vue +65 -0
- package/app/components/browser.vue +79 -0
- package/app/components/directory.vue +65 -0
- package/app/components/hero.vue +59 -0
- package/app/components/menu.vue +64 -0
- package/app/components/segmented-control.vue +67 -0
- package/app/components/table.vue +68 -0
- package/app/components/tabs.vue +63 -0
- package/app/components/tree.vue +67 -0
- package/app/composables/error.ts +1 -1
- package/app/composables/hook.ts +2 -1
- package/app/composables/request.ts +2 -1
- package/app/error.vue +2 -1
- package/app/factories/browser.ts +1 -1
- package/app/factories/form.ts +1 -1
- package/app/factories/table.ts +1 -1
- package/app/plugins/log.ts +1 -1
- package/app/stores/browser.ts +1 -1
- package/app/stores/form.ts +1 -1
- package/app/stores/log.ts +1 -1
- package/app/stores/notification.ts +1 -1
- package/app/stores/table.ts +1 -1
- package/modules/imports/constant.ts +418 -0
- package/modules/imports/index.ts +36 -11
- package/modules/imports/util.ts +9 -0
- package/package.json +5 -5
package/modules/imports/index.ts
CHANGED
|
@@ -6,21 +6,33 @@ import {
|
|
|
6
6
|
defineNuxtModule,
|
|
7
7
|
} from "@nuxt/kit";
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
|
|
9
|
+
import {
|
|
10
|
+
COMPONENTS,
|
|
11
|
+
DEFINITIONS,
|
|
12
|
+
LAYER,
|
|
13
|
+
LAYER_TYPES,
|
|
14
|
+
VUE_TYPES,
|
|
15
|
+
WRAPPED,
|
|
16
|
+
} from "./constant";
|
|
17
|
+
import { pascal, wrapped } from "./util";
|
|
11
18
|
|
|
12
19
|
export default defineNuxtModule({
|
|
13
20
|
meta: { name: "@zoobzio/nuxt/imports" },
|
|
14
|
-
setup() {
|
|
15
|
-
// @zoobzio/vue: components into #components, define* into #imports.
|
|
21
|
+
setup(_, nuxt) {
|
|
16
22
|
const require = createRequire(import.meta.url);
|
|
17
23
|
const resolve = (subpath: string): string =>
|
|
18
24
|
require.resolve(`@zoobzio/vue/${subpath}`);
|
|
19
25
|
|
|
26
|
+
const resolver = createResolver(import.meta.url);
|
|
27
|
+
const app = (subpath: string): string =>
|
|
28
|
+
resolver.resolve("../../app", subpath);
|
|
29
|
+
|
|
20
30
|
for (const name of COMPONENTS) {
|
|
21
31
|
addComponent({
|
|
22
32
|
name: pascal(name),
|
|
23
|
-
filePath:
|
|
33
|
+
filePath: wrapped(name, WRAPPED)
|
|
34
|
+
? app(`components/${name}.vue`)
|
|
35
|
+
: resolve(`components/${name}.vue`),
|
|
24
36
|
export: "default",
|
|
25
37
|
});
|
|
26
38
|
}
|
|
@@ -32,21 +44,34 @@ export default defineNuxtModule({
|
|
|
32
44
|
})),
|
|
33
45
|
);
|
|
34
46
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
47
|
+
addImports(
|
|
48
|
+
Object.entries(VUE_TYPES).flatMap(([subpath, names]) =>
|
|
49
|
+
names.map((name) => ({
|
|
50
|
+
name,
|
|
51
|
+
from: resolve(`types/${subpath}`),
|
|
52
|
+
type: true,
|
|
53
|
+
})),
|
|
54
|
+
),
|
|
55
|
+
);
|
|
39
56
|
|
|
40
57
|
addImports(
|
|
41
58
|
Object.entries(LAYER).flatMap(([subpath, names]) =>
|
|
42
|
-
names.map((name) => ({ name, from: app(subpath) })),
|
|
59
|
+
names.map((name) => ({ name, from: app(`${subpath}.ts`) })),
|
|
43
60
|
),
|
|
44
61
|
);
|
|
45
62
|
|
|
46
63
|
addImports(
|
|
47
64
|
Object.entries(LAYER_TYPES).flatMap(([subpath, names]) =>
|
|
48
|
-
names.map((name) => ({
|
|
65
|
+
names.map((name) => ({
|
|
66
|
+
name,
|
|
67
|
+
from: app(`${subpath}.ts`),
|
|
68
|
+
type: true,
|
|
69
|
+
})),
|
|
49
70
|
),
|
|
50
71
|
);
|
|
72
|
+
|
|
73
|
+
nuxt.hook("prepare:types", ({ references }) => {
|
|
74
|
+
references.push({ path: resolver.resolve("../../app/app.d.ts") });
|
|
75
|
+
});
|
|
51
76
|
},
|
|
52
77
|
});
|
package/modules/imports/util.ts
CHANGED
|
@@ -1,2 +1,11 @@
|
|
|
1
1
|
export const pascal = (kebab: string): string =>
|
|
2
2
|
kebab.replace(/(^|-)([a-z])/g, (_, __, c: string) => c.toUpperCase());
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Whether a component name is in the wrapped set. A guard, so the readonly
|
|
6
|
+
* tuple's `includes` takes the wider name.
|
|
7
|
+
*/
|
|
8
|
+
export const wrapped = <W extends string>(
|
|
9
|
+
name: string,
|
|
10
|
+
set: readonly W[],
|
|
11
|
+
): name is W => set.some((entry) => entry === name);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zoobzio/nuxt",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "Nuxt layer for the foundation design system: the Nuxt wiring over @zoobzio/vue and the headless services (useState stores, hook-bus factories, app shell).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"ltrl-http": "^0.0.20",
|
|
41
41
|
"objectively": "^0.3.0",
|
|
42
42
|
"reka-ui": "^2.6.0",
|
|
43
|
-
"@zoobzio/
|
|
44
|
-
"@zoobzio/
|
|
45
|
-
"@zoobzio/table": "0.0.
|
|
46
|
-
"@zoobzio/
|
|
43
|
+
"@zoobzio/vue": "0.0.2",
|
|
44
|
+
"@zoobzio/browser": "0.0.2",
|
|
45
|
+
"@zoobzio/table": "0.0.2",
|
|
46
|
+
"@zoobzio/form": "0.0.2"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@vitejs/plugin-vue": "^6.0.6",
|