nitro-web 0.0.86 → 0.0.88

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/globals.ts CHANGED
@@ -1,12 +1,16 @@
1
- import { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react'
1
+ import { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState, Dispatch, SetStateAction } from 'react'
2
2
  import { Link, useLocation, useNavigate, useParams } from 'react-router-dom'
3
3
  import { onChange } from 'nitro-web'
4
+ import { Store } from 'nitro-web/types'
4
5
 
5
6
  declare global {
6
- // Common application globals
7
- const onChange: typeof import('nitro-web').onChange
7
+ // useTracked global (normally defined in ./client/index.ts)
8
+ const useTracked: () => [Store, Dispatch<SetStateAction<Store>>]
8
9
 
9
- // Common aependency globals
10
+ // nitro-web global
11
+ const onChange: typeof import('nitro-web').onChange
12
+
13
+ // common daependency globals
10
14
  /** The public API for rendering a history-aware `<a>`. */
11
15
  const Link: typeof import('react-router-dom').Link
12
16
  const useCallback: typeof import('react').useCallback
@@ -21,9 +25,9 @@ declare global {
21
25
  }
22
26
 
23
27
  Object.assign(window, {
24
- // application globals
28
+ // nitro-web global
25
29
  onChange: onChange,
26
- // dependency globals
30
+ // common dependency globals
27
31
  Link: Link,
28
32
  useCallback: useCallback,
29
33
  useEffect: useEffect,
package/package.json CHANGED
@@ -1,26 +1,35 @@
1
1
  {
2
2
  "name": "nitro-web",
3
- "version": "0.0.86",
3
+ "version": "0.0.88",
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
+ "types": "./types/globals.d.ts",
9
10
  "exports": {
10
11
  ".": "./client/index.ts",
12
+ "./.eslintrc.json": "./.eslintrc.json",
11
13
  "./client/imgs/*": "./client/imgs/*",
12
14
  "./client/globals": "./client/globals.ts",
13
15
  "./server": "./server/index.js",
14
16
  "./types": "./types.ts",
15
- "./.eslintrc.json": "./.eslintrc.json",
16
- "./tsconfig.json": "./tsconfig.json",
17
- "./webpack.config.js": "./webpack.config.js",
18
17
  "./util": {
19
18
  "require": "./util.js",
20
19
  "import": "./util.js",
21
20
  "types": "./types/util.d.ts"
22
- }
21
+ },
22
+ "./webpack.config.js": "./webpack.config.js"
23
23
  },
24
+ "files": [
25
+ ".eslintrc.json",
26
+ "client",
27
+ "components",
28
+ "server",
29
+ "types",
30
+ "util.js",
31
+ "webpack.config.js"
32
+ ],
24
33
  "scripts": {
25
34
  "major": "npm run types && standard-version -a --release-as major && npm publish && cd ../webpack && npm publish",
26
35
  "minor": "npm run types && standard-version -a --release-as minor && npm publish && cd ../webpack && npm publish",
@@ -1,4 +1,3 @@
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'
@@ -17,6 +16,7 @@ declare global {
17
16
  const content: string
18
17
  export default content
19
18
  }
19
+
20
20
  }
21
21
 
22
22
  // Webpack: Twin.macro css extension
@@ -37,3 +37,5 @@ declare module 'react' {
37
37
  for?: string | undefined
38
38
  }
39
39
  }
40
+
41
+ export {}
package/.editorconfig DELETED
@@ -1,9 +0,0 @@
1
- root = true
2
-
3
- [*]
4
- charset = utf-8
5
- indent_style = space
6
- indent_size = 2
7
- end_of_line = lf
8
- insert_final_newline = true
9
- trim_trailing_whitespace = true
@@ -1,13 +0,0 @@
1
- const versionRegex = /"(@nitro-web\/webpack|nitro-web)"\s*:\s*"([~^*><= -]*)([0-9.]+)"/
2
-
3
- module.exports.readVersion = function (contents) {
4
- // This is just for showing the version in the console
5
- const version = contents.match(versionRegex)?.[3]
6
- return version
7
- }
8
-
9
- module.exports.writeVersion = function (contents, newVersion) {
10
- return contents.replaceAll(new RegExp(versionRegex, 'g'), (match, packageName, prefix) => {
11
- return `"${packageName}": "${prefix}${newVersion}"`
12
- })
13
- }
package/tsconfig.json DELETED
@@ -1,38 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "allowJs": true,
4
- "checkJs": true,
5
- "allowSyntheticDefaultImports": true,
6
- "downlevelIteration": true,
7
- "esModuleInterop": true,
8
- "forceConsistentCasingInFileNames": true,
9
- "isolatedModules": true,
10
- "jsx": "react-jsx",
11
- "lib": ["es6", "dom", "dom.iterable", "esnext"],
12
- "module": "esnext",
13
- "moduleResolution": "bundler",
14
- "noEmit": false,
15
- "noFallthroughCasesInSwitch": true,
16
- "noImplicitAny": true,
17
- "noImplicitReturns": false,
18
- "noImplicitThis": true,
19
- "noStrictGenericChecks": false,
20
- "outDir": "./dist",
21
- "paths": {
22
- "types": ["./types.ts"]
23
- },
24
- "resolveJsonModule": true,
25
- "rootDir": "./",
26
- "skipLibCheck": true,
27
- "sourceMap": true,
28
- "strict": true,
29
- "target": "es2022"
30
- },
31
- "include": [
32
- "client",
33
- "components/**/*.{tsx,ts,js}",
34
- "server/**/*.js",
35
- "types",
36
- "./types/core-only-globals.d.ts"
37
- ]
38
- }
@@ -1,15 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "allowJs": true,
4
- "declaration": true,
5
- "declarationMap": true,
6
- "emitDeclarationOnly": true,
7
- "esModuleInterop": true,
8
- "jsx": "react-jsx",
9
- "outDir": "./types",
10
- "skipLibCheck": true,
11
- },
12
- "include": [
13
- "util.js"
14
- ]
15
- }
@@ -1,9 +0,0 @@
1
- import { Store } from 'nitro-web/types'
2
- import { Dispatch, SetStateAction } from 'react'
3
-
4
- // Core-only global, this global will be defined globally in the project (e.g. in ./client/index.ts)
5
- declare global {
6
- const useTracked: () => [Store, Dispatch<SetStateAction<Store>>]
7
- }
8
-
9
- export {}
package/types.ts DELETED
@@ -1,60 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
-
3
- type InjectedConfig = {
4
- awsUrl?: string
5
- clientUrl: string
6
- countries: { [key: string]: { name: string, numberFormats: { currency: string } } } // for input-currency.tsx
7
- currencies: { [key: string]: { name: string, symbol: string, digits: number } } // for input-currency.tsx
8
- env: string
9
- googleMapsApiKey?: string
10
- isDemo: boolean // implicitly defined by webpack
11
- isStatic: boolean // implicitly defined by webpack
12
- jwtName: string // implicitly defined by webpack
13
- name: string
14
- placeholderEmail?: string
15
- stripePublishableKey?: string
16
- titleSeparator?: string
17
- version: string
18
- }
19
-
20
- export type Config = InjectedConfig & {
21
- // Non-injectable config on the client
22
- beforeApp?: () => Promise<object>
23
- beforeStoreUpdate?: (prevStore: Store | null, newData: Store) => Store
24
- middleware?: {[key: string]: (route: any, store: any) => undefined | { redirect: string }}
25
- }
26
-
27
- export type User = {
28
- _id?: string
29
- firstName?: string
30
- lastName?: string
31
- name?: string
32
- avatar?: MonasteryImage
33
- }
34
-
35
- export type Error = { title: string, detail: string }
36
- export type Errors = Error[]
37
-
38
- export type MonasteryImage = {
39
- url: string
40
- filename: string
41
- path: string
42
- bucket: string
43
- date?: number
44
- }
45
-
46
- export type MessageObject = {
47
- date?: number
48
- text: string | React.ReactNode
49
- type?: 'error' | 'info' | 'success' | 'warning'
50
- timeout?: number
51
- }
52
-
53
- export type Store = {
54
- apiAvailable?: boolean
55
- jwt?: string
56
- message?: MessageObject | string
57
- user?: User,
58
- }
59
-
60
- export type Svg = React.FC<React.SVGProps<SVGElement>>