@aerogel/core 0.0.0-next.b85327579d32f21c6a9fa21142f0165cdd320d7e → 0.0.0-next.d34923f3b144e8f6720e6a9cdadb2cd4fb4ab289

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 (114) hide show
  1. package/dist/aerogel-core.cjs.js +1 -1
  2. package/dist/aerogel-core.cjs.js.map +1 -1
  3. package/dist/aerogel-core.d.ts +1568 -252
  4. package/dist/aerogel-core.esm.js +1 -1
  5. package/dist/aerogel-core.esm.js.map +1 -1
  6. package/histoire.config.ts +7 -0
  7. package/noeldemartin.config.js +4 -1
  8. package/package.json +13 -4
  9. package/postcss.config.js +6 -0
  10. package/src/assets/histoire.css +3 -0
  11. package/src/bootstrap/bootstrap.test.ts +4 -3
  12. package/src/bootstrap/index.ts +25 -5
  13. package/src/bootstrap/options.ts +3 -0
  14. package/src/components/AGAppLayout.vue +7 -2
  15. package/src/components/AGAppModals.vue +15 -0
  16. package/src/components/AGAppOverlays.vue +10 -8
  17. package/src/components/AGAppSnackbars.vue +13 -0
  18. package/src/components/constants.ts +8 -0
  19. package/src/components/forms/AGButton.vue +25 -15
  20. package/src/components/forms/AGCheckbox.vue +7 -1
  21. package/src/components/forms/AGForm.vue +9 -10
  22. package/src/components/forms/AGInput.vue +10 -6
  23. package/src/components/forms/AGSelect.story.vue +46 -0
  24. package/src/components/forms/AGSelect.vue +60 -0
  25. package/src/components/forms/index.ts +5 -6
  26. package/src/components/headless/forms/AGHeadlessButton.vue +18 -12
  27. package/src/components/headless/forms/AGHeadlessInput.ts +29 -4
  28. package/src/components/headless/forms/AGHeadlessInput.vue +17 -7
  29. package/src/components/headless/forms/AGHeadlessInputDescription.vue +28 -0
  30. package/src/components/headless/forms/AGHeadlessInputInput.vue +43 -5
  31. package/src/components/headless/forms/AGHeadlessInputLabel.vue +8 -2
  32. package/src/components/headless/forms/AGHeadlessInputTextArea.vue +42 -0
  33. package/src/components/headless/forms/AGHeadlessSelect.ts +42 -0
  34. package/src/components/headless/forms/AGHeadlessSelect.vue +77 -0
  35. package/src/components/headless/forms/AGHeadlessSelectButton.vue +24 -0
  36. package/src/components/headless/forms/AGHeadlessSelectError.vue +26 -0
  37. package/src/components/headless/forms/AGHeadlessSelectLabel.vue +24 -0
  38. package/src/components/headless/forms/AGHeadlessSelectOption.ts +4 -0
  39. package/src/components/headless/forms/AGHeadlessSelectOption.vue +39 -0
  40. package/src/components/headless/forms/AGHeadlessSelectOptions.ts +3 -0
  41. package/src/components/headless/forms/composition.ts +10 -0
  42. package/src/components/headless/forms/index.ts +12 -1
  43. package/src/components/headless/index.ts +1 -0
  44. package/src/components/headless/modals/AGHeadlessModal.ts +27 -0
  45. package/src/components/headless/modals/AGHeadlessModal.vue +3 -5
  46. package/src/components/headless/modals/index.ts +4 -6
  47. package/src/components/headless/snackbars/AGHeadlessSnackbar.vue +10 -0
  48. package/src/components/headless/snackbars/index.ts +40 -0
  49. package/src/components/index.ts +4 -1
  50. package/src/components/interfaces.ts +9 -0
  51. package/src/components/lib/AGErrorMessage.vue +16 -0
  52. package/src/components/lib/AGLink.vue +9 -0
  53. package/src/components/{basic → lib}/AGMarkdown.vue +13 -7
  54. package/src/components/lib/AGMeasured.vue +15 -0
  55. package/src/components/lib/AGStartupCrash.vue +31 -0
  56. package/src/components/lib/index.ts +5 -0
  57. package/src/components/modals/AGAlertModal.ts +15 -0
  58. package/src/components/modals/AGAlertModal.vue +4 -16
  59. package/src/components/modals/AGConfirmModal.ts +33 -0
  60. package/src/components/modals/AGConfirmModal.vue +9 -13
  61. package/src/components/modals/AGErrorReportModal.ts +46 -0
  62. package/src/components/modals/AGErrorReportModal.vue +54 -0
  63. package/src/components/modals/AGErrorReportModalButtons.vue +111 -0
  64. package/src/components/modals/AGErrorReportModalTitle.vue +25 -0
  65. package/src/components/modals/AGLoadingModal.ts +23 -0
  66. package/src/components/modals/AGLoadingModal.vue +4 -8
  67. package/src/components/modals/AGModal.ts +1 -1
  68. package/src/components/modals/AGModal.vue +16 -13
  69. package/src/components/modals/AGModalTitle.vue +9 -0
  70. package/src/components/modals/AGPromptModal.ts +36 -0
  71. package/src/components/modals/AGPromptModal.vue +34 -0
  72. package/src/components/modals/index.ts +16 -7
  73. package/src/components/snackbars/AGSnackbar.vue +36 -0
  74. package/src/components/snackbars/index.ts +3 -0
  75. package/src/components/utils.ts +10 -0
  76. package/src/directives/index.ts +20 -3
  77. package/src/directives/measure.ts +21 -0
  78. package/src/errors/Errors.ts +65 -12
  79. package/src/errors/index.ts +26 -1
  80. package/src/errors/utils.ts +19 -0
  81. package/src/forms/Form.ts +57 -9
  82. package/src/forms/index.ts +1 -0
  83. package/src/forms/utils.ts +15 -0
  84. package/src/jobs/Job.ts +5 -0
  85. package/src/jobs/index.ts +7 -0
  86. package/src/lang/Lang.ts +15 -23
  87. package/src/main.histoire.ts +1 -0
  88. package/src/main.ts +3 -2
  89. package/src/plugins/Plugin.ts +1 -0
  90. package/src/plugins/index.ts +19 -0
  91. package/src/services/App.state.ts +22 -4
  92. package/src/services/App.ts +38 -5
  93. package/src/services/Cache.ts +43 -0
  94. package/src/services/Events.test.ts +39 -0
  95. package/src/services/Events.ts +100 -30
  96. package/src/services/Service.ts +55 -16
  97. package/src/services/index.ts +11 -5
  98. package/src/services/store.ts +8 -5
  99. package/src/testing/index.ts +25 -0
  100. package/src/ui/UI.state.ts +10 -1
  101. package/src/ui/UI.ts +168 -26
  102. package/src/ui/index.ts +12 -3
  103. package/src/utils/composition/events.ts +1 -0
  104. package/src/utils/index.ts +1 -0
  105. package/src/utils/markdown.ts +11 -2
  106. package/src/utils/tailwindcss.test.ts +26 -0
  107. package/src/utils/tailwindcss.ts +7 -0
  108. package/src/utils/vue.ts +15 -4
  109. package/tailwind.config.js +4 -0
  110. package/tsconfig.json +1 -0
  111. package/vite.config.ts +2 -1
  112. package/.eslintrc.js +0 -3
  113. package/src/components/basic/index.ts +0 -3
  114. package/src/globals.ts +0 -6
package/src/ui/UI.ts CHANGED
@@ -1,12 +1,15 @@
1
- import { facade, fail, uuid } from '@noeldemartin/utils';
1
+ import { after, facade, fail, uuid } from '@noeldemartin/utils';
2
2
  import { markRaw, nextTick } from 'vue';
3
3
  import type { Component } from 'vue';
4
4
  import type { ObjectValues } from '@noeldemartin/utils';
5
5
 
6
6
  import Events from '@/services/Events';
7
+ import type { Color } from '@/components/constants';
8
+ import type { SnackbarAction, SnackbarColor } from '@/components/headless/snackbars';
9
+ import type { AGAlertModalProps, AGConfirmModalProps, AGLoadingModalProps, AGPromptModalProps } from '@/components';
7
10
 
8
11
  import Service from './UI.state';
9
- import type { Modal, ModalComponent } from './UI.state';
12
+ import type { Modal, ModalComponent, Snackbar } from './UI.state';
10
13
 
11
14
  interface ModalCallbacks<T = unknown> {
12
15
  willClose(result: T | undefined): void;
@@ -21,49 +24,170 @@ type ModalResult<TComponent> = TComponent extends ModalComponent<Record<string,
21
24
  export const UIComponents = {
22
25
  AlertModal: 'alert-modal',
23
26
  ConfirmModal: 'confirm-modal',
27
+ ErrorReportModal: 'error-report-modal',
24
28
  LoadingModal: 'loading-modal',
29
+ PromptModal: 'prompt-modal',
30
+ Snackbar: 'snackbar',
31
+ StartupCrash: 'startup-crash',
25
32
  } as const;
26
33
 
27
34
  export type UIComponent = ObjectValues<typeof UIComponents>;
28
35
 
36
+ export interface ConfirmOptions {
37
+ acceptText?: string;
38
+ acceptColor?: Color;
39
+ cancelText?: string;
40
+ cancelColor?: Color;
41
+ }
42
+
43
+ export interface PromptOptions {
44
+ label?: string;
45
+ defaultValue?: string;
46
+ placeholder?: string;
47
+ acceptText?: string;
48
+ acceptColor?: Color;
49
+ cancelText?: string;
50
+ cancelColor?: Color;
51
+ trim?: boolean;
52
+ }
53
+
54
+ export interface ShowSnackbarOptions {
55
+ component?: Component;
56
+ color?: SnackbarColor;
57
+ actions?: SnackbarAction[];
58
+ }
59
+
29
60
  export class UIService extends Service {
30
61
 
31
62
  private modalCallbacks: Record<string, Partial<ModalCallbacks>> = {};
32
63
  private components: Partial<Record<UIComponent, Component>> = {};
33
64
 
65
+ public requireComponent(name: UIComponent): Component {
66
+ return this.components[name] ?? fail(`UI Component '${name}' is not defined!`);
67
+ }
68
+
34
69
  public alert(message: string): void;
35
70
  public alert(title: string, message: string): void;
36
71
  public alert(messageOrTitle: string, message?: string): void {
37
- const options = typeof message === 'string' ? { title: messageOrTitle, message } : { message: messageOrTitle };
72
+ const getProperties = (): AGAlertModalProps => {
73
+ if (typeof message !== 'string') {
74
+ return { message: messageOrTitle };
75
+ }
38
76
 
39
- this.openModal(this.requireComponent(UIComponents.AlertModal), options);
77
+ return {
78
+ title: messageOrTitle,
79
+ message,
80
+ };
81
+ };
82
+
83
+ this.openModal(this.requireComponent(UIComponents.AlertModal), getProperties());
40
84
  }
41
85
 
42
- public async confirm(message: string): Promise<boolean>;
43
- public async confirm(title: string, message: string): Promise<boolean>;
44
- public async confirm(messageOrTitle: string, message?: string): Promise<boolean> {
45
- const options = typeof message === 'string' ? { title: messageOrTitle, message } : { message: messageOrTitle };
46
- const modal = await this.openModal<ModalComponent<{ message: string }, boolean>>(
86
+ public async confirm(message: string, options?: ConfirmOptions): Promise<boolean>;
87
+ public async confirm(title: string, message: string, options?: ConfirmOptions): Promise<boolean>;
88
+ public async confirm(
89
+ messageOrTitle: string,
90
+ messageOrOptions?: string | ConfirmOptions,
91
+ options?: ConfirmOptions,
92
+ ): Promise<boolean> {
93
+ const getProperties = (): AGConfirmModalProps => {
94
+ if (typeof messageOrOptions !== 'string') {
95
+ return {
96
+ message: messageOrTitle,
97
+ ...(messageOrOptions ?? {}),
98
+ };
99
+ }
100
+
101
+ return {
102
+ title: messageOrTitle,
103
+ message: messageOrOptions,
104
+ ...(options ?? {}),
105
+ };
106
+ };
107
+
108
+ const modal = await this.openModal<ModalComponent<AGConfirmModalProps, boolean>>(
47
109
  this.requireComponent(UIComponents.ConfirmModal),
48
- options,
110
+ getProperties(),
49
111
  );
50
112
  const result = await modal.beforeClose;
51
113
 
52
114
  return result ?? false;
53
115
  }
54
116
 
117
+ public async prompt(message: string, options?: PromptOptions): Promise<string | null>;
118
+ public async prompt(title: string, message: string, options?: PromptOptions): Promise<string | null>;
119
+ public async prompt(
120
+ messageOrTitle: string,
121
+ messageOrOptions?: string | PromptOptions,
122
+ options?: PromptOptions,
123
+ ): Promise<string | null> {
124
+ const trim = options?.trim ?? true;
125
+ const getProperties = (): AGPromptModalProps => {
126
+ if (typeof messageOrOptions !== 'string') {
127
+ return {
128
+ message: messageOrTitle,
129
+ ...(messageOrOptions ?? {}),
130
+ };
131
+ }
132
+
133
+ return {
134
+ title: messageOrTitle,
135
+ message: messageOrOptions,
136
+ ...(options ?? {}),
137
+ };
138
+ };
139
+
140
+ const modal = await this.openModal<ModalComponent<AGPromptModalProps, string | null>>(
141
+ this.requireComponent(UIComponents.PromptModal),
142
+ getProperties(),
143
+ );
144
+ const rawResult = await modal.beforeClose;
145
+ const result = trim && typeof rawResult === 'string' ? rawResult?.trim() : rawResult;
146
+
147
+ return result ?? null;
148
+ }
149
+
55
150
  public async loading<T>(operation: Promise<T>): Promise<T>;
56
151
  public async loading<T>(message: string, operation: Promise<T>): Promise<T>;
57
152
  public async loading<T>(messageOrOperation: string | Promise<T>, operation?: Promise<T>): Promise<T> {
58
- operation = typeof messageOrOperation === 'string' ? (operation as Promise<T>) : messageOrOperation;
153
+ const getProperties = (): AGLoadingModalProps => {
154
+ if (typeof messageOrOperation !== 'string') {
155
+ return {};
156
+ }
157
+
158
+ return { message: messageOrOperation };
159
+ };
59
160
 
60
- const message = typeof messageOrOperation === 'string' ? messageOrOperation : undefined;
61
- const modal = await this.openModal(this.requireComponent(UIComponents.LoadingModal), { message });
62
- const result = await operation;
161
+ const modal = await this.openModal(this.requireComponent(UIComponents.LoadingModal), getProperties());
63
162
 
64
- await this.closeModal(modal.id);
163
+ try {
164
+ operation = typeof messageOrOperation === 'string' ? (operation as Promise<T>) : messageOrOperation;
65
165
 
66
- return result;
166
+ const [result] = await Promise.all([operation, after({ seconds: 1 })]);
167
+
168
+ return result;
169
+ } finally {
170
+ await this.closeModal(modal.id);
171
+ }
172
+ }
173
+
174
+ public showSnackbar(message: string, options: ShowSnackbarOptions = {}): void {
175
+ const snackbar: Snackbar = {
176
+ id: uuid(),
177
+ properties: { message, ...options },
178
+ component: markRaw(options.component ?? this.requireComponent(UIComponents.Snackbar)),
179
+ };
180
+
181
+ this.setState('snackbars', this.snackbars.concat(snackbar));
182
+
183
+ setTimeout(() => this.hideSnackbar(snackbar.id), 5000);
184
+ }
185
+
186
+ public hideSnackbar(id: string): void {
187
+ this.setState(
188
+ 'snackbars',
189
+ this.snackbars.filter((snackbar) => snackbar.id !== id),
190
+ );
67
191
  }
68
192
 
69
193
  public registerComponent(name: UIComponent, component: Component): void {
@@ -105,13 +229,8 @@ export class UIService extends Service {
105
229
  }
106
230
 
107
231
  protected async boot(): Promise<void> {
108
- await super.boot();
109
-
110
232
  this.watchModalEvents();
111
- }
112
-
113
- private requireComponent(name: UIComponent): Component {
114
- return this.components[name] ?? fail(`UI Component '${name}' is not defined!`);
233
+ this.watchMountedEvent();
115
234
  }
116
235
 
117
236
  private watchModalEvents(): void {
@@ -124,7 +243,10 @@ export class UIService extends Service {
124
243
  });
125
244
 
126
245
  Events.on('modal-closed', async ({ modal, result }) => {
127
- this.setState({ modals: this.modals.filter((m) => m.id !== modal.id) });
246
+ this.setState(
247
+ 'modals',
248
+ this.modals.filter((m) => m.id !== modal.id),
249
+ );
128
250
 
129
251
  this.modalCallbacks[modal.id]?.closed?.(result);
130
252
 
@@ -136,16 +258,36 @@ export class UIService extends Service {
136
258
  });
137
259
  }
138
260
 
261
+ private watchMountedEvent(): void {
262
+ Events.once('application-mounted', async () => {
263
+ const splash = document.getElementById('splash');
264
+
265
+ if (!splash) {
266
+ return;
267
+ }
268
+
269
+ if (window.getComputedStyle(splash).opacity !== '0') {
270
+ splash.style.opacity = '0';
271
+
272
+ await after({ ms: 600 });
273
+ }
274
+
275
+ splash.remove();
276
+ });
277
+ }
278
+
139
279
  }
140
280
 
141
- export default facade(new UIService());
281
+ export default facade(UIService);
142
282
 
143
283
  declare module '@/services/Events' {
144
284
  export interface EventsPayload {
145
- 'modal-will-close': { modal: Modal; result?: unknown };
146
- 'modal-closed': { modal: Modal; result?: unknown };
147
285
  'close-modal': { id: string; result?: unknown };
148
286
  'hide-modal': { id: string };
287
+ 'hide-overlays-backdrop': void;
288
+ 'modal-closed': { modal: Modal; result?: unknown };
289
+ 'modal-will-close': { modal: Modal; result?: unknown };
149
290
  'show-modal': { id: string };
291
+ 'show-overlays-backdrop': void;
150
292
  }
151
293
  }
package/src/ui/index.ts CHANGED
@@ -6,13 +6,18 @@ import { definePlugin } from '@/plugins';
6
6
  import UI, { UIComponents } from './UI';
7
7
  import AGAlertModal from '../components/modals/AGAlertModal.vue';
8
8
  import AGConfirmModal from '../components/modals/AGConfirmModal.vue';
9
+ import AGErrorReportModal from '../components/modals/AGErrorReportModal.vue';
9
10
  import AGLoadingModal from '../components/modals/AGLoadingModal.vue';
11
+ import AGPromptModal from '../components/modals/AGPromptModal.vue';
12
+ import AGSnackbar from '../components/snackbars/AGSnackbar.vue';
13
+ import AGStartupCrash from '../components/lib/AGStartupCrash.vue';
10
14
  import type { UIComponent } from './UI';
11
15
 
12
- export { UI, UIComponents, UIComponent };
13
-
14
16
  const services = { $ui: UI };
15
17
 
18
+ export * from './UI';
19
+ export { default as UI } from './UI';
20
+
16
21
  export type UIServices = typeof services;
17
22
 
18
23
  export default definePlugin({
@@ -20,7 +25,11 @@ export default definePlugin({
20
25
  const defaultComponents = {
21
26
  [UIComponents.AlertModal]: AGAlertModal,
22
27
  [UIComponents.ConfirmModal]: AGConfirmModal,
28
+ [UIComponents.ErrorReportModal]: AGErrorReportModal,
23
29
  [UIComponents.LoadingModal]: AGLoadingModal,
30
+ [UIComponents.PromptModal]: AGPromptModal,
31
+ [UIComponents.Snackbar]: AGSnackbar,
32
+ [UIComponents.StartupCrash]: AGStartupCrash,
24
33
  };
25
34
 
26
35
  Object.entries({
@@ -33,7 +42,7 @@ export default definePlugin({
33
42
  });
34
43
 
35
44
  declare module '@/bootstrap/options' {
36
- interface AerogelOptions {
45
+ export interface AerogelOptions {
37
46
  components?: Partial<Record<UIComponent, Component>>;
38
47
  }
39
48
  }
@@ -14,6 +14,7 @@ export function useEvent<Event extends EventWithPayload>(
14
14
  event: Event,
15
15
  listener: EventListener<EventsPayload[Event]>
16
16
  ): void;
17
+ export function useEvent<Payload>(event: string, listener: (payload: Payload) => unknown): void;
17
18
  export function useEvent<Event extends string>(event: UnknownEvent<Event>, listener: EventListener): void;
18
19
 
19
20
  export function useEvent(event: string, listener: EventListener): void {
@@ -1,4 +1,5 @@
1
1
  export * from './composition/events';
2
2
  export * from './composition/forms';
3
3
  export * from './composition/hooks';
4
+ export * from './tailwindcss';
4
5
  export * from './vue';
@@ -1,8 +1,17 @@
1
+ import { tap } from '@noeldemartin/utils';
1
2
  import DOMPurify from 'dompurify';
2
- import { marked } from 'marked';
3
+ import { Renderer, marked } from 'marked';
4
+
5
+ function makeRenderer(): Renderer {
6
+ return tap(new Renderer(), (renderer) => {
7
+ renderer.link = function(href, title, text) {
8
+ return Renderer.prototype.link.apply(this, [href, title, text]).replace('<a', '<a target="_blank"');
9
+ };
10
+ });
11
+ }
3
12
 
4
13
  export function renderMarkdown(markdown: string): string {
5
- return safeHtml(marked(markdown, { mangle: false, headerIds: false }));
14
+ return safeHtml(marked(markdown, { mangle: false, headerIds: false, renderer: makeRenderer() }));
6
15
  }
7
16
 
8
17
  export function safeHtml(html: string): string {
@@ -0,0 +1,26 @@
1
+ import { describe, expect, it } from 'vitest';
2
+
3
+ import { removeInteractiveClasses } from './tailwindcss';
4
+
5
+ describe('TailwindCSS utils', () => {
6
+
7
+ it('Removes interactive classes', () => {
8
+ const cases: [string, string][] = [
9
+ ['text-red hover:text-green', 'text-red'],
10
+ ['text-red hover:text-green text-lg', 'text-red text-lg'],
11
+ [
12
+ `
13
+ text-red text-lg
14
+ focus:text-yellow
15
+ hover:focus:text-black
16
+ `,
17
+ 'text-red text-lg',
18
+ ],
19
+ ];
20
+
21
+ cases.forEach(([original, expected]) => {
22
+ expect(removeInteractiveClasses(original)).toEqual(expected);
23
+ });
24
+ });
25
+
26
+ });
@@ -0,0 +1,7 @@
1
+ export function removeInteractiveClasses(classes: string): string {
2
+ return classes
3
+ .split(/\s+/)
4
+ .filter((className) => !/^(hover|focus|focus-visible):/.test(className))
5
+ .join(' ')
6
+ .trim();
7
+ }
package/src/utils/vue.ts CHANGED
@@ -1,15 +1,17 @@
1
1
  import { fail } from '@noeldemartin/utils';
2
- import { inject, reactive, ref } from 'vue';
2
+ import { computed, inject, reactive, ref, watch } from 'vue';
3
3
  import type { Directive, InjectionKey, PropType, Ref, UnwrapNestedRefs } from 'vue';
4
4
 
5
5
  type BaseProp<T> = {
6
- type: PropType<T>;
6
+ type?: PropType<T>;
7
7
  validator?(value: unknown): boolean;
8
8
  };
9
9
 
10
10
  type RequiredProp<T> = BaseProp<T> & { required: true };
11
11
  type OptionalProp<T> = BaseProp<T> & { default: T | (() => T) | null };
12
12
 
13
+ export type ComponentProps = Record<string, unknown>;
14
+
13
15
  export function arrayProp<T>(defaultValue?: () => T[]): OptionalProp<T[]> {
14
16
  return {
15
17
  type: Array as PropType<T[]>,
@@ -28,6 +30,15 @@ export function componentRef<T>(): Ref<UnwrapNestedRefs<T> | undefined> {
28
30
  return ref<UnwrapNestedRefs<T>>();
29
31
  }
30
32
 
33
+ export function computedAsync<T>(getter: () => Promise<T>): Ref<T | undefined> {
34
+ const result = ref<T>();
35
+ const asyncValue = computed(getter);
36
+
37
+ watch(asyncValue, async () => (result.value = await asyncValue.value), { immediate: true });
38
+
39
+ return result;
40
+ }
41
+
31
42
  export function defineDirective(directive: Directive): Directive {
32
43
  return directive;
33
44
  }
@@ -62,7 +73,7 @@ export function injectOrFail<T>(key: InjectionKey<T> | string, errorMessage?: st
62
73
  return inject(key) ?? fail(errorMessage ?? `Could not resolve '${key}' injection key`);
63
74
  }
64
75
 
65
- export function mixedProp<T>(type: PropType<T>): OptionalProp<T | null> {
76
+ export function mixedProp<T>(type?: PropType<T>): OptionalProp<T | null> {
66
77
  return {
67
78
  type,
68
79
  default: null,
@@ -106,7 +117,7 @@ export function requiredEnumProp<Enum extends Record<string, unknown>>(
106
117
  };
107
118
  }
108
119
 
109
- export function requiredMixedProp<T>(type: PropType<T>): RequiredProp<T> {
120
+ export function requiredMixedProp<T>(type?: PropType<T>): RequiredProp<T> {
110
121
  return {
111
122
  type,
112
123
  required: true,
@@ -0,0 +1,4 @@
1
+ /** @type {import('tailwindcss').Config} */
2
+ module.exports = {
3
+ content: ['./src/**/*.{vue,ts}'],
4
+ };
package/tsconfig.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "extends": "../../tsconfig.json",
3
3
  "compilerOptions": {
4
+ "types": ["unplugin-icons/types/vue3", "@aerogel/vite/dist/virtual"],
4
5
  "baseUrl": ".",
5
6
  "paths": {
6
7
  "@/*": ["./src/*"]
package/vite.config.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import Aerogel from '@aerogel/vite';
2
+ import Icons from 'unplugin-icons/vite';
2
3
  import { defineConfig } from 'vitest/config';
3
4
  import { resolve } from 'path';
4
5
 
5
6
  export default defineConfig({
6
7
  test: { clearMocks: true },
7
- plugins: [Aerogel()],
8
+ plugins: [Aerogel(), Icons()],
8
9
  resolve: {
9
10
  alias: {
10
11
  '@': resolve(__dirname, './src'),
package/.eslintrc.js DELETED
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- extends: ['@noeldemartin/eslint-config-vue'],
3
- };
@@ -1,3 +0,0 @@
1
- import AGMarkdown from './AGMarkdown.vue';
2
-
3
- export { AGMarkdown };
package/src/globals.ts DELETED
@@ -1,6 +0,0 @@
1
- export {};
2
-
3
- declare global {
4
- export const __AG_BASE_PATH: string | undefined;
5
- export const __AG_ENV: 'production' | 'development' | 'testing';
6
- }