nitro-web 0.0.74 → 0.0.75
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.
|
@@ -106,7 +106,7 @@ async function store(req, res) {
|
|
|
106
106
|
async function signup(req, res) {
|
|
107
107
|
try {
|
|
108
108
|
const desktop = req.query.desktop
|
|
109
|
-
let user = await this.userCreate(req.body
|
|
109
|
+
let user = await this.userCreate(req.body)
|
|
110
110
|
sendEmail({
|
|
111
111
|
config: authConfig,
|
|
112
112
|
template: 'welcome',
|
|
@@ -315,8 +315,12 @@ export async function signinAndGetStore(user, isDesktop, getStore) {
|
|
|
315
315
|
return { ...store, jwt }
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
-
export async function userCreate({ name, business, email, password
|
|
318
|
+
export async function userCreate({ name, business, email, password }) {
|
|
319
319
|
try {
|
|
320
|
+
if (!this.findUserFromProvider) {
|
|
321
|
+
throw new Error('this.findUserFromProvider doesn\'t exist, make sure the context is available when calling this function')
|
|
322
|
+
}
|
|
323
|
+
|
|
320
324
|
const options = { blacklist: ['-_id'] }
|
|
321
325
|
const isMultiTenant = !authConfig.isNotMultiTenant
|
|
322
326
|
const userId = db.id()
|
|
@@ -81,45 +81,51 @@ export const Dropdown = forwardRef(function Dropdown({
|
|
|
81
81
|
|
|
82
82
|
useEffect(() => {
|
|
83
83
|
setReady(false)
|
|
84
|
+
console.log(1111, isActive, dropdownRef.current)
|
|
84
85
|
if (!isActive || !dropdownRef.current) return
|
|
85
86
|
|
|
86
|
-
const ul = dropdownRef.current.querySelector('ul') as HTMLElement
|
|
87
|
-
if (!ul) return
|
|
87
|
+
// const ul = dropdownRef.current.querySelector('&>ul') as HTMLElement
|
|
88
|
+
// if (!ul) return
|
|
89
|
+
// console.log(1111)
|
|
88
90
|
|
|
89
91
|
// Temporarily show the ul for measurement
|
|
90
|
-
const originalMaxHeight = ul.style.maxHeight
|
|
91
|
-
const originalVisibility = ul.style.visibility
|
|
92
|
-
const originalOpacity = ul.style.opacity
|
|
93
|
-
const originalPointerEvents = ul.style.pointerEvents
|
|
92
|
+
// const originalMaxHeight = ul.style.maxHeight
|
|
93
|
+
// const originalVisibility = ul.style.visibility
|
|
94
|
+
// const originalOpacity = ul.style.opacity
|
|
95
|
+
// const originalPointerEvents = ul.style.pointerEvents
|
|
94
96
|
|
|
95
|
-
ul.style.maxHeight = 'none'
|
|
96
|
-
ul.style.visibility = 'hidden'
|
|
97
|
-
ul.style.opacity = '0'
|
|
98
|
-
ul.style.pointerEvents = 'none'
|
|
97
|
+
// ul.style.maxHeight = 'none'
|
|
98
|
+
// ul.style.visibility = 'hidden'
|
|
99
|
+
// ul.style.opacity = '0'
|
|
100
|
+
// ul.style.pointerEvents = 'none'
|
|
99
101
|
|
|
100
|
-
const dropdownHeight = ul.getBoundingClientRect().height
|
|
102
|
+
// const dropdownHeight = ul.getBoundingClientRect().height
|
|
101
103
|
|
|
102
104
|
// Revert styles
|
|
103
|
-
ul.style.maxHeight = originalMaxHeight
|
|
104
|
-
ul.style.visibility = originalVisibility
|
|
105
|
-
ul.style.opacity = originalOpacity
|
|
106
|
-
ul.style.pointerEvents = originalPointerEvents
|
|
105
|
+
// ul.style.maxHeight = originalMaxHeight
|
|
106
|
+
// ul.style.visibility = originalVisibility
|
|
107
|
+
// ul.style.opacity = originalOpacity
|
|
108
|
+
// ul.style.pointerEvents = originalPointerEvents
|
|
107
109
|
|
|
108
|
-
const rect = dropdownRef.current.getBoundingClientRect()
|
|
109
|
-
const spaceBelow = window.innerHeight - rect.bottom
|
|
110
|
-
const spaceAbove = rect.top
|
|
111
110
|
|
|
112
|
-
const
|
|
111
|
+
// const rect = dropdownRef.current.getBoundingClientRect()
|
|
112
|
+
// const spaceBelow = window.innerHeight - rect.bottom
|
|
113
|
+
// const spaceAbove = rect.top
|
|
113
114
|
|
|
114
|
-
const
|
|
115
|
-
? `${spaceBelow < dropdownHeight && spaceAbove > dropdownHeight ? 'top' : 'bottom'}-${side}`
|
|
116
|
-
: `${spaceAbove < dropdownHeight && spaceBelow > dropdownHeight ? 'bottom' : 'top'}-${side}`
|
|
115
|
+
// const side = dir.endsWith('right') ? 'right' : 'left'
|
|
117
116
|
|
|
118
|
-
|
|
117
|
+
// const newDirection = dir.startsWith('bottom')
|
|
118
|
+
// ? `${1 < 1 && 1 > 1 ? 'top' : 'bottom'}-${side}`
|
|
119
|
+
// : `${1 < 1 && 1 > 1 ? 'bottom' : 'top'}-${side}`
|
|
119
120
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
// setDirection(dir as 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right')
|
|
122
|
+
|
|
123
|
+
// requestAnimationFrame(() => {
|
|
124
|
+
// // console.log('ul', originalOpacity)
|
|
125
|
+
// setReady(true)
|
|
126
|
+
// })
|
|
127
|
+
setDirection(dir)
|
|
128
|
+
setReady(true)
|
|
123
129
|
}, [isActive, dir])
|
|
124
130
|
|
|
125
131
|
function onMouseDown(e: { key: string, preventDefault: Function }) {
|
|
@@ -132,13 +138,12 @@ export const Dropdown = forwardRef(function Dropdown({
|
|
|
132
138
|
if (option.onClick) option.onClick(e)
|
|
133
139
|
if (!menuIsOpen) setIsActive(!isActive)
|
|
134
140
|
}
|
|
135
|
-
var ready2
|
|
136
141
|
|
|
137
142
|
return (
|
|
138
143
|
<div
|
|
139
144
|
class={
|
|
140
145
|
`relative is-${direction || dir}` + // until hovered, show the original direction to prevent scrollbars
|
|
141
|
-
(
|
|
146
|
+
(ready ? ' is-ready' : '') +
|
|
142
147
|
(isHoverable ? ' is-hoverable' : '') +
|
|
143
148
|
(isActive ? ' is-active' : '') +
|
|
144
149
|
(!animate ? ' no-animation' : '') +
|
|
@@ -160,7 +165,7 @@ export const Dropdown = forwardRef(function Dropdown({
|
|
|
160
165
|
<ul
|
|
161
166
|
style={{ minWidth }}
|
|
162
167
|
class={
|
|
163
|
-
twMerge(`${menuStyle}
|
|
168
|
+
twMerge(`${menuStyle} absolute invisible opacity-0 select-none min-w-full z-[1] ${menuClassName||''}`)}
|
|
164
169
|
>
|
|
165
170
|
{menuContent}
|
|
166
171
|
{
|
|
@@ -193,7 +198,7 @@ const style = css`
|
|
|
193
198
|
}
|
|
194
199
|
&.is-bottom-right,
|
|
195
200
|
&.is-top-right {
|
|
196
|
-
ul {
|
|
201
|
+
&>ul {
|
|
197
202
|
left: auto;
|
|
198
203
|
right: 0;
|
|
199
204
|
}
|
|
@@ -213,13 +218,14 @@ const style = css`
|
|
|
213
218
|
}
|
|
214
219
|
}
|
|
215
220
|
// active submenu
|
|
221
|
+
&./////////////
|
|
216
222
|
&.is-hoverable:hover,
|
|
217
223
|
&:focus,
|
|
218
224
|
&.is-active,
|
|
219
225
|
&>ul>li:hover,
|
|
220
226
|
&>ul>li:focus,
|
|
221
227
|
&>ul>li.is-active {
|
|
222
|
-
&>ul
|
|
228
|
+
&>ul {
|
|
223
229
|
opacity: 1;
|
|
224
230
|
visibility: visible;
|
|
225
231
|
transition: transform 0.15s ease, opacity 0.15s ease;
|
|
@@ -119,9 +119,10 @@ export const Filters = forwardRef<FiltersHandleType, FiltersProps>(({
|
|
|
119
119
|
|
|
120
120
|
return (
|
|
121
121
|
<Elements.Dropdown
|
|
122
|
+
// menuIsOpen={true}
|
|
123
|
+
className='ddddddddd'
|
|
122
124
|
dir="bottom-right"
|
|
123
125
|
allowOverflow={true}
|
|
124
|
-
// menuIsOpen={true}
|
|
125
126
|
{...dropdownProps}
|
|
126
127
|
menuClassName={twMerge(`min-w-[330px] ${dropdownProps?.menuClassName || ''}`)}
|
|
127
128
|
menuContent={
|
|
@@ -22,7 +22,7 @@ type FieldExtraProps = {
|
|
|
22
22
|
/** icon to show in the input */
|
|
23
23
|
icon?: React.ReactNode
|
|
24
24
|
iconPos?: 'left' | 'right'
|
|
25
|
-
/**
|
|
25
|
+
/** Dependencies to break the implicit memoization of onChange/onInputChange */
|
|
26
26
|
deps?: unknown[]
|
|
27
27
|
placeholder?: string
|
|
28
28
|
}
|
|
@@ -181,25 +181,19 @@ function ColorSvg({ hex }: { hex?: string }) {
|
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
export function isFieldCached(prev: IsFieldCachedProps, next: IsFieldCachedProps) {
|
|
184
|
+
// Check if the field is cached, onChange/onInputChange doesn't affect the cache
|
|
184
185
|
const path = prev.name
|
|
185
186
|
const state = prev.state || {}
|
|
186
|
-
// If state
|
|
187
|
-
if (deepFind(state, path) !== deepFind(next.state || {}, path))
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
if (
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
if ((next.deps?.length !== prev.deps?.length) || next.deps?.some((v, i) => v !== prev.deps?.[i])) {
|
|
197
|
-
// console.log(3, 'deps changed', path)
|
|
198
|
-
return false
|
|
199
|
-
}
|
|
200
|
-
// If any other props have changed, except onChange/onInputChange, re-render!
|
|
201
|
-
// In most cases, onChange/onInputChange remain the same and reference the same function...
|
|
202
|
-
for (const k in prev) {
|
|
187
|
+
// If the state value has changed, re-render!
|
|
188
|
+
if (deepFind(state, path) !== deepFind(next.state || {}, path)) return false
|
|
189
|
+
// If the state error has changed, re-render!
|
|
190
|
+
if (getErrorFromState(state, path) !== getErrorFromState(next.state || {}, path)) return false
|
|
191
|
+
// If `deps` have changed, handy for onChange/onInputChange, re-render!
|
|
192
|
+
if ((next.deps?.length !== prev.deps?.length) || next.deps?.some((v, i) => v !== prev.deps?.[i])) return false
|
|
193
|
+
|
|
194
|
+
// Check if any prop has changed, except `onChange`/`onInputChange`
|
|
195
|
+
const allKeys = new Set([...Object.keys(prev), ...Object.keys(next)])
|
|
196
|
+
for (const k of allKeys) {
|
|
203
197
|
if (k === 'state' || k === 'onChange' || k === 'onInputChange') continue
|
|
204
198
|
if (prev[k as keyof typeof prev] !== next[k as keyof typeof next]) {
|
|
205
199
|
// console.log(4, 'changed', path, k)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nitro-web",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.75",
|
|
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 🚀",
|