@xy-planning-network/trees 0.4.0-rc-7 → 0.4.0-rc-8

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 CHANGED
@@ -59,44 +59,34 @@ npm i @xy-planning-network/trees mitt
59
59
 
60
60
  This example installs all components of Trees, which may not be necessary for all projects. Assumes you have a vue 3 project with tailwind created.
61
61
 
62
- **Establish global types for VueBus and Flashes in global.d.ts**
63
-
64
- ```ts
65
- // global.d.ts
66
-
67
- import { Emitter } from "mitt";
68
-
69
- declare global {
70
- interface Window {
71
- Flashes: Array<{ message: string }>;
72
- VueBus: Emitter;
73
- }
74
- }
75
- ```
76
-
77
62
  **Initialize trees components in main.ts**
78
63
 
79
64
  ```ts
80
65
  // main.ts
81
- import Vue, { createApp } from "vue";
82
- import Mitt from "mitt";
83
- import Trees from "@xy-planning-network/trees";
84
- import HelloWorld from "@/components/HelloWorld.vue";
66
+
67
+ // include the type interfaces for Window and GlobalComponents
68
+ /// <reference types="@xy-planning-network/trees/types/global" />
69
+ /// <reference types="@xy-planning-network/trees/types/components" />
70
+
71
+ import Vue, { createApp } from "vue"
72
+ import Mitt from "mitt"
73
+ import Trees from "@xy-planning-network/trees"
74
+ import HelloWorld from "@/components/HelloWorld.vue"
85
75
 
86
76
  // import your project's main stylesheet
87
- import "@/main.css";
77
+ import "@/main.css"
88
78
 
89
79
  // initialize the app
90
- const app = createApp(HelloWorld);
80
+ const app = createApp(HelloWorld)
91
81
 
92
82
  // initialize mitt on VueBus
93
- window.VueBus = mitt();
83
+ window.VueBus = mitt()
94
84
 
95
85
  // use all of Trees as a vue plugin
96
- app.use(Trees);
86
+ app.use(Trees)
97
87
 
98
88
  // mount the application
99
- app.mount("#vue-app");
89
+ app.mount("#vue-app")
100
90
  ```
101
91
 
102
92
  **Initialize styles in main.css**
@@ -129,10 +119,10 @@ Note you may need a deep merge utility depending on the depth of properties you
129
119
 
130
120
  ```js
131
121
  /* eslint-disable */
132
- const treesConfig = require("@xy-planning-network/trees/config/tailwind.config");
122
+ const treesConfig = require("@xy-planning-network/trees/config/tailwind.config")
133
123
  module.exports = {
134
124
  ...treesConfig,
135
125
  mode: "jit", // Optional
136
126
  purge: [...treesConfig.purge, ...["./src/**/*.vue"]],
137
- };
127
+ }
138
128
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xy-planning-network/trees",
3
- "version": "0.4.0-rc-7",
3
+ "version": "0.4.0-rc-8",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "repository": "github:xy-planning-network/trees",
@@ -16,17 +16,17 @@
16
16
  "unpkg": "dist/trees.umd.js",
17
17
  "types": "types/entry.d.ts",
18
18
  "sideEffects": [
19
- "*.css",
20
- "*.vue"
19
+ "*.css"
21
20
  ],
22
21
  "scripts": {
23
22
  "dev": "vite",
24
- "build": "vite build && vue-tsc -p src && npm run copy:types && tsc-alias -p src/tsconfig.json",
23
+ "build": "vite build && vue-tsc -p src --emitDeclarationOnly && npm run copy:types && tsc-alias -p src/tsconfig.json",
25
24
  "build:docs": "vue-tsc -p dev --noEmit && vite build --config vite.docs.config.ts",
26
- "copy:types": "copyfiles -f ./src/types/**/*.d.ts ./types",
25
+ "copy:types": "copyfiles -f ./src/*.d.ts ./types",
27
26
  "lint": "eslint --ext .js,.ts,.vue src",
28
27
  "lint:fix": "eslint --fix --ext .js,.ts,.vue src dev && prettier -w -u src dev",
29
- "preview": "vite preview --config vite.docs.config.ts"
28
+ "preview": "vite preview --config vite.docs.config.ts",
29
+ "typecheck": "vue-tsc -p src --noEmit"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/node": "^16.11.13",
@@ -1,7 +1,11 @@
1
1
  import { TreesComponents } from "./lib-components"
2
2
 
3
- export default TreesComponents
4
-
3
+ /**
4
+ * When using App.use(Trees) include a
5
+ * /// <reference types="@xy-planning-network/trees/types/components" /> or
6
+ * import GlobalComponents from "@xy-planning-network/trees/types/components"
7
+ * in the project.
8
+ */
5
9
  declare module "@vue/runtime-core" {
6
10
  // eslint-disable-next-line @typescript-eslint/no-empty-interface
7
11
  interface GlobalComponents extends TreesComponents {}
@@ -0,0 +1,4 @@
1
+ export interface DateRange {
2
+ minDate: number;
3
+ maxDate: number;
4
+ }
@@ -0,0 +1,13 @@
1
+ import { DefineComponent, RenderFunction } from "vue";
2
+ export interface Item {
3
+ icon?: DefineComponent<unknown, unknown, any> | RenderFunction;
4
+ name: string;
5
+ openInTab?: boolean;
6
+ url: string;
7
+ }
8
+ export interface Pagination {
9
+ page: number;
10
+ perPage: number;
11
+ totalItems: number;
12
+ totalPages: number;
13
+ }
@@ -0,0 +1,4 @@
1
+ export interface Flash {
2
+ type?: string;
3
+ message: string;
4
+ }
@@ -0,0 +1,32 @@
1
+ import { ComponentPublicInstance, DefineComponent } from "vue";
2
+ import User from "../composables/user";
3
+ export interface Column {
4
+ display: string;
5
+ class?: string;
6
+ key?: string;
7
+ presenter?(row: any, instance: ComponentPublicInstance): any;
8
+ component?: DefineComponent<unknown, unknown, any>;
9
+ items?: Array<MenuItem>;
10
+ sort?: string;
11
+ }
12
+ export interface Dynamic {
13
+ currentUser: User;
14
+ columns: Array<Column>;
15
+ dateSearch?: boolean;
16
+ defaultSort?: string;
17
+ defaultSortDirection?: string;
18
+ refreshTrigger: number;
19
+ reloadTrigger?: number;
20
+ search?: boolean;
21
+ url: string;
22
+ }
23
+ export interface MenuItem {
24
+ label: string;
25
+ event: string;
26
+ show?(propsData: any, currentUser: User): boolean;
27
+ }
28
+ export interface Static {
29
+ currentUser: User;
30
+ columns: Array<Column>;
31
+ items: Record<string, unknown>[];
32
+ }
@@ -0,0 +1,9 @@
1
+ export interface User {
2
+ accountID: number;
3
+ accountOwner: boolean;
4
+ archived: boolean;
5
+ id: number;
6
+ email: string;
7
+ name: string;
8
+ }
9
+ export default User;
package/types/global.d.ts CHANGED
@@ -1,7 +1,10 @@
1
1
  import { Emitter } from "mitt"
2
2
 
3
- export {}
4
-
3
+ /**
4
+ * When using window.VueBus.emit("Flash-show-generic-error", "support@trees.com") include
5
+ * /// <reference types="@xy-planning-network/trees/types/global" />
6
+ * in the project.
7
+ */
5
8
  declare global {
6
9
  interface Window {
7
10
  Flashes: Array<{ type?: string; message: string }>
@@ -29,14 +29,6 @@ import { default as YesOrNoRadio } from "./forms/YesOrNoRadio.vue";
29
29
  export { ActionsDropdown, Cards, ContentModal, DateFilter, DetailList, DownloadCell, Flash, Modal, SidebarLayout, Slideover, StackedLayout, Paginator, Spinner, StaticTable, Steps, Table, Tabs, Toggle, BaseInput, Checkbox, DateRangePicker, InputHelp, InputLabel, MultiCheckboxes, Radio, Select, TextArea, YesOrNoRadio, };
30
30
  /**
31
31
  * declare global component types for App.use(Trees)
32
- *
33
- * apply to project with the following
34
- import { TreesComponents } from "@xy-planning-network/trees"
35
-
36
- declare module "@vue/runtime-core" {
37
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
38
- interface GlobalComponents extends TreesComponents {}
39
- }
40
32
  */
41
33
  export interface TreesComponents {
42
34
  ActionsDropdown: typeof ActionsDropdown;
@@ -1,7 +1,4 @@
1
- export interface DateRange {
2
- minDate: number;
3
- maxDate: number;
4
- }
1
+ import { DateRange } from "../../composables/date";
5
2
  declare const _default: import("vue").DefineComponent<__VLS_DefinePropsToOptions<{
6
3
  dateRange: DateRange;
7
4
  sortDir: string;
@@ -1,4 +1,4 @@
1
- import * as NavTypes from "../../types/nav";
1
+ import * as NavTypes from "../../composables/nav";
2
2
  declare const _default: import("vue").DefineComponent<{
3
3
  activeURL: {
4
4
  type: import("vue").PropType<string>;
@@ -1,5 +1,5 @@
1
- import * as NavTypes from "../../types/nav";
2
- import User from "../../types/users";
1
+ import * as NavTypes from "../../composables/nav";
2
+ import User from "../../composables/user";
3
3
  declare const _default: import("vue").DefineComponent<{
4
4
  activeURL: {
5
5
  type: import("vue").PropType<string>;
@@ -1,4 +1,4 @@
1
- import * as TableTypes from "../../types/table";
1
+ import * as TableTypes from "../../composables/table";
2
2
  declare const _default: import("vue").DefineComponent<__VLS_DefinePropsToOptions<{
3
3
  tableData: TableTypes.Static;
4
4
  }>, () => void, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
@@ -1,4 +1,4 @@
1
- import * as TableTypes from "../../types/table";
1
+ import * as TableTypes from "../../composables/table";
2
2
  declare const _default: import("vue").DefineComponent<{
3
3
  clickable: {
4
4
  type: import("vue").PropType<boolean>;
@@ -1,6 +1,6 @@
1
1
  import { MenuItem } from "@headlessui/vue";
2
- import * as TableTypes from "../../types/table";
3
- import User from "../../types/users";
2
+ import * as TableTypes from "../../composables/table";
3
+ import User from "../../composables/user";
4
4
  declare const _default: import("vue").DefineComponent<__VLS_DefinePropsToOptions<{
5
5
  currentUser: User;
6
6
  items: TableTypes.MenuItem[];
@@ -1,9 +1,4 @@
1
- export interface Pagination {
2
- page: number;
3
- perPage: number;
4
- totalItems: number;
5
- totalPages: number;
6
- }
1
+ import { Pagination } from "../../composables/nav";
7
2
  declare const _default: import("vue").DefineComponent<__VLS_DefinePropsToOptions<{
8
3
  modelValue: Pagination;
9
4
  }>, () => void, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
@@ -1,6 +1,2 @@
1
- export interface Flash {
2
- type?: string;
3
- message: string;
4
- }
5
1
  declare const _default: import("vue").DefineComponent<{}, () => void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{} & {} & {}>, {}>;
6
2
  export default _default;
package/types/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export * as NavTypes from "./nav"
2
- export * as TableTypes from "./table"
3
- export * as UserTypes from "./users"
package/types/nav.d.ts DELETED
@@ -1,8 +0,0 @@
1
- import { DefineComponent, RenderFunction } from "vue"
2
-
3
- export interface Item {
4
- icon?: DefineComponent<unknown, unknown, any> | RenderFunction
5
- name: string
6
- openInTab?: boolean
7
- url: string
8
- }
package/types/table.d.ts DELETED
@@ -1,36 +0,0 @@
1
- import { ComponentPublicInstance, DefineComponent } from "vue"
2
- import User from "./users"
3
-
4
- export interface Column {
5
- display: string
6
- class?: string
7
- key?: string
8
- presenter?(row: any, instance: ComponentPublicInstance): any
9
- component?: DefineComponent<unknown, unknown, any>
10
- items?: Array<MenuItem>
11
- sort?: string
12
- }
13
-
14
- export interface Dynamic {
15
- currentUser: User
16
- columns: Array<Column>
17
- dateSearch?: boolean
18
- defaultSort?: string
19
- defaultSortDirection?: string
20
- refreshTrigger: number
21
- reloadTrigger?: number
22
- search?: boolean
23
- url: string
24
- }
25
-
26
- export interface MenuItem {
27
- label: string
28
- event: string
29
- show?(propsData: any, currentUser: User): boolean
30
- }
31
-
32
- export interface Static {
33
- currentUser: User
34
- columns: Array<Column>
35
- items: Record<string, unknown>[]
36
- }
package/types/users.d.ts DELETED
@@ -1,10 +0,0 @@
1
- export interface User {
2
- accountID: number
3
- accountOwner: boolean
4
- archived: boolean
5
- id: number
6
- email: string
7
- name: string
8
- }
9
-
10
- export default User