nitro-web 0.0.93 → 0.0.95
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/client/app.tsx +4 -0
- package/client/globals.ts +0 -9
- package/client/index.ts +9 -8
- package/components/auth/reset.tsx +1 -1
- package/components/auth/signin.tsx +1 -1
- package/components/auth/signup.tsx +1 -1
- package/components/partials/element/accordion.tsx +0 -1
- package/components/partials/styleguide.tsx +1 -1
- package/package.json +2 -2
- package/tsconfig.json +3 -4
- package/types/core-only-globals.d.ts +2 -2
- package/types/{required-globals.d.ts → globals.d.ts} +14 -3
package/client/app.tsx
CHANGED
|
@@ -40,6 +40,10 @@ type RouteWithPolicies = Route & {
|
|
|
40
40
|
|
|
41
41
|
export async function setupApp(config: Config, storeContainer: StoreContainer, layouts: React.FC<LayoutProps>[]) {
|
|
42
42
|
if (!layouts) throw new Error('layouts are required')
|
|
43
|
+
if (!(window as unknown as { useTracked: unknown }).useTracked) {
|
|
44
|
+
throw new Error('useTracked is not defined globally before setupApp()')
|
|
45
|
+
}
|
|
46
|
+
|
|
43
47
|
// Fetch state and init app
|
|
44
48
|
const settings: Settings = {
|
|
45
49
|
beforeApp: config.beforeApp || beforeApp,
|
package/client/globals.ts
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react'
|
|
2
2
|
import { Link, useLocation, useNavigate, useParams } from 'react-router-dom'
|
|
3
|
-
import { onChange } from 'nitro-web'
|
|
4
3
|
|
|
5
4
|
declare global {
|
|
6
|
-
// Common application globals
|
|
7
|
-
const onChange: typeof import('nitro-web').onChange
|
|
8
|
-
|
|
9
|
-
// Common aependency globals
|
|
10
|
-
/** The public API for rendering a history-aware `<a>`. */
|
|
11
5
|
const Link: typeof import('react-router-dom').Link
|
|
12
6
|
const useCallback: typeof import('react').useCallback
|
|
13
7
|
const useEffect: typeof import('react').useEffect
|
|
@@ -21,9 +15,6 @@ declare global {
|
|
|
21
15
|
}
|
|
22
16
|
|
|
23
17
|
Object.assign(window, {
|
|
24
|
-
// application globals
|
|
25
|
-
onChange: onChange,
|
|
26
|
-
// dependency globals
|
|
27
18
|
Link: Link,
|
|
28
19
|
useCallback: useCallback,
|
|
29
20
|
useEffect: useEffect,
|
package/client/index.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
//
|
|
2
|
-
import '../types/
|
|
3
|
-
|
|
4
|
-
// export
|
|
5
|
-
|
|
6
|
-
export * from '
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
// const pi = parseFloat(3.142)
|
|
2
|
+
import '../types/globals.d.ts'
|
|
3
|
+
|
|
4
|
+
// Utility functions (use export path for js declarations to work in host projects)
|
|
5
|
+
export * from 'nitro-web/util'
|
|
6
|
+
export * as util from 'nitro-web/util'
|
|
7
|
+
|
|
8
|
+
// Main types
|
|
9
|
+
export * from 'types'
|
|
9
10
|
|
|
10
11
|
// Main app functions
|
|
11
12
|
export { setupApp, updateJwt } from './app'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Topbar, Field, Button, FormError, request, queryObject, injectedConfig, updateJwt } from 'nitro-web'
|
|
1
|
+
import { Topbar, Field, Button, FormError, request, queryObject, injectedConfig, updateJwt, onChange } from 'nitro-web'
|
|
2
2
|
import { Errors } from 'nitro-web/types'
|
|
3
3
|
|
|
4
4
|
export function Signin() {
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
Drop, Dropdown, Field, Select, Button as ButtonNitro, Checkbox, GithubLink, Modal, Calendar, injectedConfig,
|
|
3
3
|
Filters, FiltersHandleType, FilterType,
|
|
4
4
|
} from 'nitro-web'
|
|
5
|
-
import { getCountryOptions, getCurrencyOptions, ucFirst } from 'nitro-web/util'
|
|
5
|
+
import { getCountryOptions, getCurrencyOptions, onChange, ucFirst } from 'nitro-web/util'
|
|
6
6
|
import { Check, FileEditIcon } from 'lucide-react'
|
|
7
7
|
|
|
8
8
|
type StyleguideProps = {
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nitro-web",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.95",
|
|
4
4
|
"repository": "github:boycce/nitro-web",
|
|
5
5
|
"homepage": "https://boycce.github.io/nitro-web/",
|
|
6
6
|
"description": "Nitro is a battle-tested, modular base project to turbocharge your projects, styled using Tailwind 🚀",
|
|
7
|
-
"main": "./client/index.ts",
|
|
8
7
|
"type": "module",
|
|
8
|
+
"main": "./client/index.ts",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": "./client/index.ts",
|
|
11
11
|
"./client/imgs/*": "./client/imgs/*",
|
package/tsconfig.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Store } from 'nitro-web/types'
|
|
2
2
|
import { Dispatch, SetStateAction } from 'react'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
declare global {
|
|
5
|
+
// useTracked global (normally defined in your project's /client/index.ts)
|
|
6
6
|
const useTracked: () => [Store, Dispatch<SetStateAction<Store>>]
|
|
7
7
|
}
|
|
8
8
|
|
|
@@ -1,24 +1,33 @@
|
|
|
1
|
-
// Required global types
|
|
2
1
|
import 'twin.macro'
|
|
3
2
|
import { css as cssImport } from '@emotion/react'
|
|
4
3
|
import styledImport from '@emotion/styled'
|
|
5
4
|
import { CSSInterpolation } from '@emotion/serialize'
|
|
5
|
+
import 'axios'
|
|
6
|
+
import type { IAxiosRetry } from 'axios-retry'
|
|
6
7
|
|
|
7
8
|
declare global {
|
|
8
9
|
/** Webpack injected config variables */
|
|
9
10
|
const INJECTED_CONFIG: Record<string, string|boolean|object>
|
|
10
11
|
/** Webpack svg loader */
|
|
11
|
-
module '*.svg' {
|
|
12
|
+
declare module '*.svg' {
|
|
12
13
|
const content: React.FC<React.SVGProps<SVGElement>>
|
|
13
14
|
export default content
|
|
14
15
|
}
|
|
16
|
+
|
|
15
17
|
/** Webpack image loader */
|
|
16
|
-
module '*.jpg' {
|
|
18
|
+
declare module '*.jpg' {
|
|
17
19
|
const content: string
|
|
18
20
|
export default content
|
|
19
21
|
}
|
|
20
22
|
}
|
|
21
23
|
|
|
24
|
+
// Webpack: axios-retry augment (since axios-retry is not imported in host project)
|
|
25
|
+
declare module 'axios' {
|
|
26
|
+
export interface AxiosRequestConfig {
|
|
27
|
+
'axios-retry'?: IAxiosRetry.IAxiosRetryConfigExtended
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
22
31
|
// Webpack: Twin.macro css extension
|
|
23
32
|
// https://github.com/ben-rogerson/twin.examples/tree/master/react-emotion-typescript
|
|
24
33
|
declare module 'twin.macro' {
|
|
@@ -37,3 +46,5 @@ declare module 'react' {
|
|
|
37
46
|
for?: string | undefined
|
|
38
47
|
}
|
|
39
48
|
}
|
|
49
|
+
|
|
50
|
+
export {}
|