@stacksjs/types 0.58.48 → 0.58.49

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 (60) hide show
  1. package/package.json +3 -2
  2. package/src/ai.ts +25 -0
  3. package/src/analytics.ts +21 -0
  4. package/src/api.ts +63 -0
  5. package/src/app.ts +172 -0
  6. package/src/auto-imports.ts +1 -0
  7. package/src/binary.ts +12 -0
  8. package/src/build.ts +2 -0
  9. package/src/cache.ts +98 -0
  10. package/src/cdn.ts +17 -0
  11. package/src/chat.ts +5 -0
  12. package/src/cli.ts +305 -0
  13. package/src/cloud.ts +85 -0
  14. package/src/components.ts +64 -0
  15. package/src/configure.ts +6 -0
  16. package/src/cron-jobs.ts +44 -0
  17. package/src/database.ts +45 -0
  18. package/src/dependencies.ts +69 -0
  19. package/src/deploy.ts +13 -0
  20. package/src/dns.ts +186 -0
  21. package/src/docs.ts +22 -0
  22. package/src/email.ts +16 -0
  23. package/src/env.ts +1 -0
  24. package/src/errors.ts +11 -0
  25. package/src/events.ts +30 -0
  26. package/src/exit-code.ts +10 -0
  27. package/src/file-systems.ts +70 -0
  28. package/src/git.ts +133 -0
  29. package/src/hashing.ts +131 -0
  30. package/src/helpers.ts +11 -0
  31. package/src/i18n.ts +19 -0
  32. package/src/index.ts +58 -0
  33. package/src/inspect.ts +10 -0
  34. package/src/layout.ts +8 -0
  35. package/src/library.ts +156 -0
  36. package/src/manifest.ts +9 -0
  37. package/src/model.ts +72 -0
  38. package/src/money.ts +3 -0
  39. package/src/native.ts +0 -0
  40. package/src/notifications.ts +147 -0
  41. package/src/pages.ts +10 -0
  42. package/src/payments.ts +65 -0
  43. package/src/promise.ts +1 -0
  44. package/src/push.ts +36 -0
  45. package/src/pwa.ts +8 -0
  46. package/src/queue.ts +36 -0
  47. package/src/reactivity.ts +1 -0
  48. package/src/router.ts +70 -0
  49. package/src/scheduler.ts +1 -0
  50. package/src/search-engine.ts +136 -0
  51. package/src/security.ts +23 -0
  52. package/src/services.ts +44 -0
  53. package/src/sms.ts +5 -0
  54. package/src/ssg.ts +3 -0
  55. package/src/stacks.ts +226 -0
  56. package/src/storage.ts +13 -0
  57. package/src/tables.ts +57 -0
  58. package/src/team.ts +8 -0
  59. package/src/ui.ts +197 -0
  60. package/src/utils.ts +47 -0
package/src/ui.ts ADDED
@@ -0,0 +1,197 @@
1
+ import type { UserShortcuts } from 'unocss'
2
+
3
+ export type Font = 'inter' | 'mona' | 'hubot'
4
+ export type Icon = 'heroicons'
5
+ export type WebFontsProviders = 'google' | 'bunny' | 'fontshare'
6
+
7
+ export interface FontInfo {
8
+ title: string
9
+ text: string
10
+ }
11
+ export type FontFor = 'email' | 'desktop' | 'mobile' | 'web'
12
+
13
+ export interface WebFontMeta {
14
+ name: string
15
+ weights?: (string | number)[]
16
+ italic?: boolean
17
+ provider?: WebFontsProviders
18
+ }
19
+
20
+ /**
21
+ * **UI Engine Options**
22
+ *
23
+ * This type defines all of your UI Engine options. Because Stacks is fully-typed, you may
24
+ * hover any of the options below and the definitions will be provided. In case you
25
+ * have any questions, feel free to reach out via Discord or GitHub Discussions.
26
+ */
27
+ export interface UiOptions {
28
+ /**
29
+ * **Shortcuts**
30
+ *
31
+ * Shortcuts provide you with the ability to combine
32
+ * utility names for reusability purposes.
33
+ *
34
+ * @example
35
+ * ```
36
+ * config: {
37
+ * shortcuts: {
38
+ * 'btn': 'px-4 py-2 rounded text-white bg-blue-500',
39
+ * 'btn-lg': 'btn px-6 py-3',
40
+ * }
41
+ * }
42
+ * ```
43
+ */
44
+ shortcuts: Shortcuts
45
+
46
+ /**
47
+ * **Safelist**
48
+ *
49
+ * Use the `safelist` option to ensure the generation of
50
+ * those utility classes. This is useful when certain
51
+ * class names don’t exist in your content files.
52
+ *
53
+ * @example
54
+ * ```ts
55
+ * safelist: [
56
+ * 'btn',
57
+ * 'btn-lg',
58
+ * 'btn-blue',
59
+ * 'btn-blue-500',
60
+ * ]
61
+ */
62
+ safelist: string
63
+
64
+ /**
65
+ * **Trigger String**
66
+ *
67
+ * The "trigger string" defines the class name markup
68
+ * you want to add into your components.
69
+ *
70
+ * @default ':stx:'
71
+ *
72
+ * @example
73
+ * ```ts
74
+ * trigger: ':stx:'
75
+ * ```
76
+ */
77
+ trigger?: string
78
+
79
+ /**
80
+ * **Class Prefix**
81
+ *
82
+ * The prefix for the compiled class name. When transforming
83
+ * all utility classes into a single class, this prefix
84
+ * will be added to the generated CSS class name.
85
+ *
86
+ * @default 'stx-'
87
+ *
88
+ * @example
89
+ * ```ts
90
+ * prefix: 'stx-'
91
+ * ```
92
+ */
93
+ classPrefix?: string
94
+
95
+ /**
96
+ * **Hash Function**
97
+ *
98
+ * The hash function used to generate the class name.
99
+ *
100
+ * @example
101
+ * ```ts
102
+ * hash: (str: string) => {
103
+ * return str
104
+ * .split('')
105
+ * .reduce((a, b) => {
106
+ * a = ((a << 5) - a) + b.charCodeAt(0)
107
+ * return a & a
108
+ * }, 0)
109
+ * .toString(36)
110
+ * }
111
+ */
112
+ hashFn?: (str: string) => string
113
+
114
+ /**
115
+ * **CSS Resets—Preset**
116
+ *
117
+ * Define a standard of reset CSS stylesheets. By default, the Tailwind
118
+ * reset styles are utilized. You may set this value to `null`
119
+ * if you prefer not applying any default stylesheets.
120
+ *
121
+ * @url https://www.npmjs.com/package/@unocss/reset
122
+ * @todo preset needs to be added via a Vite plugin on development & build
123
+ * @example
124
+ * ```ts
125
+ * reset: 'tailwind'
126
+ * ```
127
+ */
128
+ reset?: ResetPreset
129
+
130
+ /**
131
+ * **Fonts**
132
+ *
133
+ * Define the fonts you want to use. By default, Stacks provides support
134
+ * for several local font providers. You may set this value to
135
+ * `null` if you prefer not utilize any local fonts.
136
+ *
137
+ * @see https://stacks.ow3.org/fonts
138
+ * @example applies the same font for all platforms _(web, email, desktop, and mobile)_
139
+ * ```ts
140
+ * fonts: {
141
+ * title: 'Mona',
142
+ * text: 'Hubot'
143
+ * }
144
+ * ```
145
+ * @example
146
+ * ```ts
147
+ * fonts: {
148
+ * web: {
149
+ * title: 'Inter',
150
+ * text: 'Mona'
151
+ * },
152
+ * desktop: {
153
+ * title: 'Mona',
154
+ * text: 'Inter'
155
+ * },
156
+ * }
157
+ * ```
158
+ */
159
+ fonts?: Record<FontFor, FontInfo> | { [key in FontFor]: FontInfo }
160
+
161
+ useWebFonts?: boolean | WebFontsProviders
162
+
163
+ /**
164
+ * **Icon Sets**
165
+ *
166
+ * This value defines the icon sets you want to use. When using icons, they
167
+ * are displayed utilizing a technique called "icons in pure css."
168
+ * Learn more here https://antfu.me/posts/icons-in-pure-css.
169
+ *
170
+ * @see https://stacks.ow3.org/config/icons — list of available icon sets
171
+ * @todo implement this into Vite build flow
172
+ * @example
173
+ * ```ts
174
+ * icons: ['heroicons']
175
+ * ```
176
+ * @example
177
+ * ```html
178
+ * <i class="i-heroicons-outline-book-open w-8 h-8 text-gray-500" aria-hidden="true" />
179
+ * ```
180
+ */
181
+ icons: Icon | Icon[]
182
+ // icons: Record<string, () => Promise<any>>
183
+ }
184
+
185
+ export type UiConfig = Partial<UiOptions>
186
+
187
+ export type Shortcuts = UserShortcuts
188
+
189
+ /**
190
+ * **Style Reset — Preset**
191
+ *
192
+ * This value sets the "reset preset." A preset defines certain
193
+ * CSS defaults to be applied.
194
+ *
195
+ * @default "tailwind"
196
+ */
197
+ export type ResetPreset = 'tailwind' | 'normalize' | 'sanitize' | 'eric-meyer' | 'antfu' | null
package/src/utils.ts ADDED
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Null or whatever.
3
+ */
4
+ export type Nullable<T> = T | null | undefined
5
+
6
+ /**
7
+ * Function
8
+ */
9
+ export type Fn<T = void> = () => T
10
+
11
+ /**
12
+ * Array, or not yet
13
+ */
14
+ export type Arrayable<T> = T | Array<T>
15
+
16
+ /**
17
+ * Constructor.
18
+ */
19
+ export type Constructor<T = void> = new (...args: any[]) => T
20
+
21
+ /**
22
+ * Defines an intersection type of all union items.
23
+ *
24
+ * @param U Union of any types that will be intersected.
25
+ * @returns U items intersected
26
+ * @see https://stackoverflow.com/a/50375286/9259330
27
+ */
28
+ export type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never
29
+
30
+ export type MergeInsertions<T> =
31
+ T extends object
32
+ ? { [K in keyof T]: MergeInsertions<T[K]> }
33
+ : T
34
+
35
+ export type DeepMerge<F, S> = MergeInsertions<{
36
+ [K in keyof F | keyof S]: K extends keyof S & keyof F
37
+ ? DeepMerge<F[K], S[K]>
38
+ : K extends keyof S
39
+ ? S[K]
40
+ : K extends keyof F
41
+ ? F[K]
42
+ : never;
43
+ }>
44
+
45
+ export type DeepPartial<T> = {
46
+ [P in keyof T]?: DeepPartial<T[P]>;
47
+ }