@akinon/next 1.14.0 → 1.15.0
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/.editorconfig +7 -7
- package/.eslintrc.js +40 -40
- package/.gitattributes +15 -0
- package/.prettierrc +13 -13
- package/CHANGELOG.md +14 -0
- package/api/auth.ts +231 -231
- package/api/cache.ts +44 -44
- package/api/client.ts +174 -174
- package/api/logout.ts +42 -42
- package/bin/pz-check-dependencies.js +98 -98
- package/bin/pz-install-plugins.js +33 -33
- package/bin/pz-install-theme.js +58 -58
- package/bin/pz-postbuild.js +1 -1
- package/bin/pz-postdev.js +1 -1
- package/bin/pz-postinstall.js +6 -6
- package/bin/pz-poststart.js +1 -1
- package/bin/pz-prebuild.js +4 -4
- package/bin/pz-predev.js +4 -4
- package/bin/pz-prestart.js +1 -1
- package/bin/run-script.js +44 -44
- package/components/accordion.tsx +52 -52
- package/components/button.tsx +46 -46
- package/components/client-root.tsx +19 -19
- package/components/icon.tsx +18 -18
- package/components/image.tsx +133 -133
- package/components/index.ts +1 -0
- package/components/input.tsx +110 -110
- package/components/lazy-component.tsx +33 -33
- package/components/loader-spinner.tsx +23 -23
- package/components/mobile-app-toggler.tsx +26 -26
- package/components/modal.tsx +66 -0
- package/components/oauth-login.tsx +24 -24
- package/components/plugin-module.tsx +5 -0
- package/components/price.tsx +55 -55
- package/components/pz-providers.tsx +24 -24
- package/components/pz-root.tsx +21 -21
- package/components/radio.tsx +18 -18
- package/components/react-portal.tsx +45 -45
- package/components/redirect-three-d/content/index.tsx +74 -74
- package/components/redirect-three-d/index.tsx +17 -17
- package/components/selected-payment-option-view.tsx +1 -1
- package/components/trans.tsx +39 -39
- package/data/client/account.ts +208 -208
- package/data/client/api.ts +85 -85
- package/data/client/basket.ts +82 -82
- package/data/client/misc.ts +101 -101
- package/data/client/product.ts +89 -89
- package/data/client/user.ts +99 -99
- package/data/client/wishlist.ts +118 -118
- package/data/server/category.ts +132 -132
- package/data/server/flatpage.ts +21 -21
- package/data/server/form.ts +22 -22
- package/data/server/index.ts +10 -10
- package/data/server/landingpage.ts +24 -24
- package/data/server/list.ts +67 -67
- package/data/server/menu.ts +35 -35
- package/data/server/product.ts +86 -86
- package/data/server/seo.ts +48 -48
- package/data/server/special-page.ts +47 -47
- package/data/server/widget.ts +27 -27
- package/data/urls.ts +221 -221
- package/hocs/client/index.ts +1 -1
- package/hocs/client/with-segment-defaults.tsx +25 -25
- package/hocs/server/index.ts +1 -1
- package/hocs/server/with-segment-defaults.tsx +85 -85
- package/hooks/index.ts +10 -10
- package/hooks/use-captcha.tsx +76 -76
- package/hooks/use-common-product-attributes.ts +36 -36
- package/hooks/use-debounce.ts +20 -20
- package/hooks/use-localization.ts +78 -78
- package/hooks/use-media-query.ts +36 -36
- package/hooks/use-mobile-iframe-handler.ts +23 -23
- package/hooks/use-on-click-outside.tsx +28 -28
- package/hooks/use-payment-options.ts +3 -1
- package/hooks/use-router.ts +45 -45
- package/hooks/use-translation.ts +14 -14
- package/lib/cache.ts +215 -215
- package/localization/index.ts +5 -5
- package/localization/provider.tsx +58 -58
- package/middlewares/complete-gpay.ts +159 -0
- package/middlewares/currency.ts +100 -100
- package/middlewares/default.ts +259 -256
- package/middlewares/index.ts +31 -29
- package/middlewares/locale.ts +68 -68
- package/middlewares/oauth-login.ts +79 -79
- package/middlewares/pretty-url.ts +104 -104
- package/middlewares/redirection-payment.ts +160 -160
- package/middlewares/three-d-redirection.ts +159 -159
- package/middlewares/url-redirection.ts +65 -65
- package/package.json +2 -2
- package/plugins.js +1 -0
- package/redux/hooks.ts +7 -7
- package/redux/middlewares/index.ts +50 -50
- package/redux/reducers/checkout.ts +184 -184
- package/redux/reducers/config.ts +28 -28
- package/redux/reducers/header.ts +59 -59
- package/redux/reducers/root.ts +61 -61
- package/sentry/index.ts +27 -27
- package/tailwind/rtl.js +137 -137
- package/types/commerce/account.ts +64 -64
- package/types/commerce/address.ts +94 -94
- package/types/commerce/basket.ts +43 -43
- package/types/commerce/category.ts +114 -114
- package/types/commerce/checkout.ts +143 -143
- package/types/commerce/flatpage.ts +7 -7
- package/types/commerce/form.ts +66 -66
- package/types/commerce/index.ts +12 -12
- package/types/commerce/landingpage.ts +7 -7
- package/types/commerce/misc.ts +127 -127
- package/types/commerce/order.ts +119 -119
- package/types/commerce/product.ts +109 -109
- package/types/commerce/widget.ts +28 -28
- package/types/gtm.ts +16 -16
- package/types/index.ts +274 -274
- package/types/metadata.ts +7 -7
- package/types/next-auth.d.ts +24 -24
- package/utils/app-fetch.ts +69 -69
- package/utils/deep-merge.js +24 -24
- package/utils/image-loader.ts +31 -31
- package/utils/index.ts +150 -150
- package/utils/localization.ts +29 -29
- package/utils/log.ts +138 -138
- package/utils/menu-generator.ts +27 -27
- package/utils/mobile-3d-iframe.ts +77 -77
- package/utils/server-translation.ts +57 -57
- package/utils/server-variables.ts +9 -9
- package/with-pz-config.js +94 -94
package/redux/reducers/config.ts
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
|
|
4
|
-
import { Config } from '../../types';
|
|
5
|
-
|
|
6
|
-
const initialState: Config = {
|
|
7
|
-
user_phone_regex: '^(05)\\d{9}$',
|
|
8
|
-
user_phone_format: '05999999999',
|
|
9
|
-
country: {
|
|
10
|
-
pk: 1,
|
|
11
|
-
name: 'Türkiye',
|
|
12
|
-
code: 'tr'
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const configSlice = createSlice({
|
|
17
|
-
name: 'config',
|
|
18
|
-
initialState,
|
|
19
|
-
reducers: {
|
|
20
|
-
setConfig: (state, action: PayloadAction<Config>) => {
|
|
21
|
-
return action.payload;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
export const { setConfig } = configSlice.actions;
|
|
27
|
-
|
|
28
|
-
export default configSlice.reducer;
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
|
|
4
|
+
import { Config } from '../../types';
|
|
5
|
+
|
|
6
|
+
const initialState: Config = {
|
|
7
|
+
user_phone_regex: '^(05)\\d{9}$',
|
|
8
|
+
user_phone_format: '05999999999',
|
|
9
|
+
country: {
|
|
10
|
+
pk: 1,
|
|
11
|
+
name: 'Türkiye',
|
|
12
|
+
code: 'tr'
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const configSlice = createSlice({
|
|
17
|
+
name: 'config',
|
|
18
|
+
initialState,
|
|
19
|
+
reducers: {
|
|
20
|
+
setConfig: (state, action: PayloadAction<Config>) => {
|
|
21
|
+
return action.payload;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export const { setConfig } = configSlice.actions;
|
|
27
|
+
|
|
28
|
+
export default configSlice.reducer;
|
package/redux/reducers/header.ts
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { createSlice } from '@reduxjs/toolkit';
|
|
4
|
-
|
|
5
|
-
export interface HeaderState {
|
|
6
|
-
isMobileMenuOpen: boolean;
|
|
7
|
-
isSearchOpen: boolean;
|
|
8
|
-
openedMenu: string | null;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const initialState: HeaderState = {
|
|
12
|
-
isMobileMenuOpen: false,
|
|
13
|
-
isSearchOpen: false,
|
|
14
|
-
openedMenu: null
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const headerSlice = createSlice({
|
|
18
|
-
name: 'header',
|
|
19
|
-
initialState,
|
|
20
|
-
reducers: {
|
|
21
|
-
openMobileMenu(state) {
|
|
22
|
-
state.isMobileMenuOpen = true;
|
|
23
|
-
},
|
|
24
|
-
closeMobileMenu(state) {
|
|
25
|
-
state.isMobileMenuOpen = false;
|
|
26
|
-
},
|
|
27
|
-
toggleMobileMenu(state) {
|
|
28
|
-
state.isMobileMenuOpen = !state.isMobileMenuOpen;
|
|
29
|
-
},
|
|
30
|
-
openSearch(state) {
|
|
31
|
-
state.isSearchOpen = true;
|
|
32
|
-
},
|
|
33
|
-
closeSearch(state) {
|
|
34
|
-
state.isSearchOpen = false;
|
|
35
|
-
},
|
|
36
|
-
toggleSearch(state) {
|
|
37
|
-
state.isSearchOpen = !state.isSearchOpen;
|
|
38
|
-
},
|
|
39
|
-
setOpenedMenu(state, action) {
|
|
40
|
-
state.openedMenu = action.payload;
|
|
41
|
-
},
|
|
42
|
-
resetHeaderState() {
|
|
43
|
-
return initialState;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
export const {
|
|
49
|
-
openMobileMenu,
|
|
50
|
-
closeMobileMenu,
|
|
51
|
-
toggleMobileMenu,
|
|
52
|
-
openSearch,
|
|
53
|
-
closeSearch,
|
|
54
|
-
toggleSearch,
|
|
55
|
-
setOpenedMenu,
|
|
56
|
-
resetHeaderState
|
|
57
|
-
} = headerSlice.actions;
|
|
58
|
-
|
|
59
|
-
export default headerSlice.reducer;
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
4
|
+
|
|
5
|
+
export interface HeaderState {
|
|
6
|
+
isMobileMenuOpen: boolean;
|
|
7
|
+
isSearchOpen: boolean;
|
|
8
|
+
openedMenu: string | null;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const initialState: HeaderState = {
|
|
12
|
+
isMobileMenuOpen: false,
|
|
13
|
+
isSearchOpen: false,
|
|
14
|
+
openedMenu: null
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const headerSlice = createSlice({
|
|
18
|
+
name: 'header',
|
|
19
|
+
initialState,
|
|
20
|
+
reducers: {
|
|
21
|
+
openMobileMenu(state) {
|
|
22
|
+
state.isMobileMenuOpen = true;
|
|
23
|
+
},
|
|
24
|
+
closeMobileMenu(state) {
|
|
25
|
+
state.isMobileMenuOpen = false;
|
|
26
|
+
},
|
|
27
|
+
toggleMobileMenu(state) {
|
|
28
|
+
state.isMobileMenuOpen = !state.isMobileMenuOpen;
|
|
29
|
+
},
|
|
30
|
+
openSearch(state) {
|
|
31
|
+
state.isSearchOpen = true;
|
|
32
|
+
},
|
|
33
|
+
closeSearch(state) {
|
|
34
|
+
state.isSearchOpen = false;
|
|
35
|
+
},
|
|
36
|
+
toggleSearch(state) {
|
|
37
|
+
state.isSearchOpen = !state.isSearchOpen;
|
|
38
|
+
},
|
|
39
|
+
setOpenedMenu(state, action) {
|
|
40
|
+
state.openedMenu = action.payload;
|
|
41
|
+
},
|
|
42
|
+
resetHeaderState() {
|
|
43
|
+
return initialState;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export const {
|
|
49
|
+
openMobileMenu,
|
|
50
|
+
closeMobileMenu,
|
|
51
|
+
toggleMobileMenu,
|
|
52
|
+
openSearch,
|
|
53
|
+
closeSearch,
|
|
54
|
+
toggleSearch,
|
|
55
|
+
setOpenedMenu,
|
|
56
|
+
resetHeaderState
|
|
57
|
+
} = headerSlice.actions;
|
|
58
|
+
|
|
59
|
+
export default headerSlice.reducer;
|
package/redux/reducers/root.ts
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
-
import Settings from 'settings';
|
|
3
|
-
|
|
4
|
-
const initialState = {
|
|
5
|
-
commerceUrl: Settings.commerceUrl,
|
|
6
|
-
isMobileApp:
|
|
7
|
-
typeof window !== 'undefined' &&
|
|
8
|
-
localStorage.getItem('isMobileApp') === 'true',
|
|
9
|
-
miniBasket: {
|
|
10
|
-
open: false,
|
|
11
|
-
highlightedItem: null
|
|
12
|
-
},
|
|
13
|
-
rootModal: {
|
|
14
|
-
open: false,
|
|
15
|
-
title: null,
|
|
16
|
-
content: null
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const rootSlice = createSlice({
|
|
21
|
-
name: 'root',
|
|
22
|
-
initialState,
|
|
23
|
-
reducers: {
|
|
24
|
-
openMiniBasket: (state) => {
|
|
25
|
-
state.miniBasket.open = true;
|
|
26
|
-
},
|
|
27
|
-
closeMiniBasket: (state) => {
|
|
28
|
-
state.miniBasket.open = false;
|
|
29
|
-
},
|
|
30
|
-
toggleMiniBasket: (state) => {
|
|
31
|
-
state.miniBasket.open = !state.miniBasket.open;
|
|
32
|
-
},
|
|
33
|
-
setHighlightedItem: (state, action: { payload: number | null }) => {
|
|
34
|
-
state.miniBasket.highlightedItem = action.payload;
|
|
35
|
-
},
|
|
36
|
-
openRootModal: (
|
|
37
|
-
state,
|
|
38
|
-
action: { payload: { title?: string; content?: string } }
|
|
39
|
-
) => {
|
|
40
|
-
state.rootModal.open = true;
|
|
41
|
-
state.rootModal.title = action.payload.title;
|
|
42
|
-
state.rootModal.content = action.payload.content;
|
|
43
|
-
},
|
|
44
|
-
closeRootModal: (state) => {
|
|
45
|
-
state.rootModal.open = false;
|
|
46
|
-
state.rootModal.title = null;
|
|
47
|
-
state.rootModal.content = null;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
export const {
|
|
53
|
-
openMiniBasket,
|
|
54
|
-
closeMiniBasket,
|
|
55
|
-
toggleMiniBasket,
|
|
56
|
-
setHighlightedItem,
|
|
57
|
-
openRootModal,
|
|
58
|
-
closeRootModal
|
|
59
|
-
} = rootSlice.actions;
|
|
60
|
-
|
|
61
|
-
export default rootSlice.reducer;
|
|
1
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
import Settings from 'settings';
|
|
3
|
+
|
|
4
|
+
const initialState = {
|
|
5
|
+
commerceUrl: Settings.commerceUrl,
|
|
6
|
+
isMobileApp:
|
|
7
|
+
typeof window !== 'undefined' &&
|
|
8
|
+
localStorage.getItem('isMobileApp') === 'true',
|
|
9
|
+
miniBasket: {
|
|
10
|
+
open: false,
|
|
11
|
+
highlightedItem: null
|
|
12
|
+
},
|
|
13
|
+
rootModal: {
|
|
14
|
+
open: false,
|
|
15
|
+
title: null,
|
|
16
|
+
content: null
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const rootSlice = createSlice({
|
|
21
|
+
name: 'root',
|
|
22
|
+
initialState,
|
|
23
|
+
reducers: {
|
|
24
|
+
openMiniBasket: (state) => {
|
|
25
|
+
state.miniBasket.open = true;
|
|
26
|
+
},
|
|
27
|
+
closeMiniBasket: (state) => {
|
|
28
|
+
state.miniBasket.open = false;
|
|
29
|
+
},
|
|
30
|
+
toggleMiniBasket: (state) => {
|
|
31
|
+
state.miniBasket.open = !state.miniBasket.open;
|
|
32
|
+
},
|
|
33
|
+
setHighlightedItem: (state, action: { payload: number | null }) => {
|
|
34
|
+
state.miniBasket.highlightedItem = action.payload;
|
|
35
|
+
},
|
|
36
|
+
openRootModal: (
|
|
37
|
+
state,
|
|
38
|
+
action: { payload: { title?: string; content?: string } }
|
|
39
|
+
) => {
|
|
40
|
+
state.rootModal.open = true;
|
|
41
|
+
state.rootModal.title = action.payload.title;
|
|
42
|
+
state.rootModal.content = action.payload.content;
|
|
43
|
+
},
|
|
44
|
+
closeRootModal: (state) => {
|
|
45
|
+
state.rootModal.open = false;
|
|
46
|
+
state.rootModal.title = null;
|
|
47
|
+
state.rootModal.content = null;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
export const {
|
|
53
|
+
openMiniBasket,
|
|
54
|
+
closeMiniBasket,
|
|
55
|
+
toggleMiniBasket,
|
|
56
|
+
setHighlightedItem,
|
|
57
|
+
openRootModal,
|
|
58
|
+
closeRootModal
|
|
59
|
+
} = rootSlice.actions;
|
|
60
|
+
|
|
61
|
+
export default rootSlice.reducer;
|
package/sentry/index.ts
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import * as Sentry from '@sentry/nextjs';
|
|
2
|
-
|
|
3
|
-
const SENTRY_DSN: string =
|
|
4
|
-
process.env.SENTRY_DSN || process.env.NEXT_PUBLIC_SENTRY_DSN;
|
|
5
|
-
|
|
6
|
-
export const initSentry = (
|
|
7
|
-
type: 'Server' | 'Client' | 'Edge',
|
|
8
|
-
options: Sentry.BrowserOptions | Sentry.NodeOptions | Sentry.EdgeOptions = {}
|
|
9
|
-
) => {
|
|
10
|
-
// TODO: Handle options with ESLint rules
|
|
11
|
-
|
|
12
|
-
// TODO: Remove Zero Project DSN
|
|
13
|
-
|
|
14
|
-
Sentry.init({
|
|
15
|
-
dsn:
|
|
16
|
-
SENTRY_DSN ||
|
|
17
|
-
'https://d8558ef8997543deacf376c7d8d7cf4b@o64293.ingest.sentry.io/4504338423742464',
|
|
18
|
-
initialScope: {
|
|
19
|
-
tags: {
|
|
20
|
-
APP_TYPE: 'ProjectZeroNext',
|
|
21
|
-
TYPE: type
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
tracesSampleRate: 1.0,
|
|
25
|
-
integrations: []
|
|
26
|
-
});
|
|
27
|
-
};
|
|
1
|
+
import * as Sentry from '@sentry/nextjs';
|
|
2
|
+
|
|
3
|
+
const SENTRY_DSN: string =
|
|
4
|
+
process.env.SENTRY_DSN || process.env.NEXT_PUBLIC_SENTRY_DSN;
|
|
5
|
+
|
|
6
|
+
export const initSentry = (
|
|
7
|
+
type: 'Server' | 'Client' | 'Edge',
|
|
8
|
+
options: Sentry.BrowserOptions | Sentry.NodeOptions | Sentry.EdgeOptions = {}
|
|
9
|
+
) => {
|
|
10
|
+
// TODO: Handle options with ESLint rules
|
|
11
|
+
|
|
12
|
+
// TODO: Remove Zero Project DSN
|
|
13
|
+
|
|
14
|
+
Sentry.init({
|
|
15
|
+
dsn:
|
|
16
|
+
SENTRY_DSN ||
|
|
17
|
+
'https://d8558ef8997543deacf376c7d8d7cf4b@o64293.ingest.sentry.io/4504338423742464',
|
|
18
|
+
initialScope: {
|
|
19
|
+
tags: {
|
|
20
|
+
APP_TYPE: 'ProjectZeroNext',
|
|
21
|
+
TYPE: type
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
tracesSampleRate: 1.0,
|
|
25
|
+
integrations: []
|
|
26
|
+
});
|
|
27
|
+
};
|
package/tailwind/rtl.js
CHANGED
|
@@ -1,137 +1,137 @@
|
|
|
1
|
-
const plugin = require('tailwindcss/plugin');
|
|
2
|
-
|
|
3
|
-
module.exports = plugin(({ addUtilities, matchUtilities, theme, e }) => {
|
|
4
|
-
const spacingUtilities = Object.entries(theme('spacing')).map(
|
|
5
|
-
([key, value]) => {
|
|
6
|
-
return {
|
|
7
|
-
[`[dir="rtl"] .${e(`pl-${key}`)}`]: {
|
|
8
|
-
'padding-right': `${value}`
|
|
9
|
-
},
|
|
10
|
-
[`[dir="rtl"] .${e(`pr-${key}`)}`]: {
|
|
11
|
-
'padding-left': `${value}`
|
|
12
|
-
},
|
|
13
|
-
[`[dir="rtl"] .${e(`ml-${key}`)}`]: {
|
|
14
|
-
'margin-right': `${value}`
|
|
15
|
-
},
|
|
16
|
-
[`[dir="rtl"] .${e(`mr-${key}`)}`]: {
|
|
17
|
-
'margin-left': `${value}`
|
|
18
|
-
},
|
|
19
|
-
[`[dir="rtl"] .${e(`pl-${key}`)}:not([class*="px-"])`]: {
|
|
20
|
-
'padding-left': '0'
|
|
21
|
-
},
|
|
22
|
-
[`[dir="rtl"] .${e(`pr-${key}`)}:not([class*="px-"])`]: {
|
|
23
|
-
'padding-right': '0'
|
|
24
|
-
},
|
|
25
|
-
[`[dir="rtl"] .${e(`ml-${key}`)}:not([class*="mx-"])`]: {
|
|
26
|
-
'margin-left': '0'
|
|
27
|
-
},
|
|
28
|
-
[`[dir="rtl"] .${e(`mr-${key}`)}:not([class*="mx-"])`]: {
|
|
29
|
-
'margin-right': '0'
|
|
30
|
-
},
|
|
31
|
-
[`[dir="rtl"] .${e(
|
|
32
|
-
`space-x-${key}`
|
|
33
|
-
)} > :not([hidden]) ~ :not([hidden])`]: {
|
|
34
|
-
'--tw-space-x-reverse': '0',
|
|
35
|
-
'margin-right':
|
|
36
|
-
'calc(' + `${value}` + ' * calc(1 - var(--tw-space-x-reverse)))',
|
|
37
|
-
'margin-left': 'calc(' + `${value}` + ' * var(--tw-space-x-reverse))'
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
addUtilities(spacingUtilities);
|
|
44
|
-
|
|
45
|
-
const borderUtilities = Object.entries(theme('borderWidth')).map(
|
|
46
|
-
([key, value]) => {
|
|
47
|
-
return {
|
|
48
|
-
[`[dir="rtl"] .${e(`border-l-${key}`)}`]: {
|
|
49
|
-
'border-right-width': `${value}`,
|
|
50
|
-
'border-left-width': '0'
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
addUtilities({
|
|
57
|
-
[`[dir="rtl"] .${e(`border`)}`]: {
|
|
58
|
-
'border-right-width': '1px',
|
|
59
|
-
'border-left-width': '1px'
|
|
60
|
-
},
|
|
61
|
-
[`[dir="rtl"] .${e(`border-l`)}`]: {
|
|
62
|
-
'border-right-width': '1px',
|
|
63
|
-
'border-left-width': '0'
|
|
64
|
-
},
|
|
65
|
-
[`[dir="rtl"] .${e(`border-r`)}`]: {
|
|
66
|
-
'border-left-width': '1px',
|
|
67
|
-
'border-right-width': '0'
|
|
68
|
-
},
|
|
69
|
-
...borderUtilities
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
const insetUtilities = Object.entries(theme('inset')).map(([key, value]) => {
|
|
73
|
-
return {
|
|
74
|
-
[`[dir="rtl"] .${e(`left-${key}`)}`]: {
|
|
75
|
-
right: `${value}`
|
|
76
|
-
},
|
|
77
|
-
[`[dir="rtl"] .${e(`right-${key}`)}`]: {
|
|
78
|
-
left: `${value}`
|
|
79
|
-
},
|
|
80
|
-
[`[dir="rtl"] .${e(`left-${key}`)}:not([class*="right-"])`]: {
|
|
81
|
-
left: 'initial'
|
|
82
|
-
},
|
|
83
|
-
[`[dir="rtl"] .${e(`right-${key}`)}:not([class*="left-"])`]: {
|
|
84
|
-
right: 'initial'
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
addUtilities(insetUtilities);
|
|
90
|
-
|
|
91
|
-
const transformUtilities = Object.entries(theme('translate')).map(
|
|
92
|
-
([key, value]) => {
|
|
93
|
-
let val = value;
|
|
94
|
-
let negativeVal = value;
|
|
95
|
-
|
|
96
|
-
if (value.startsWith('-')) {
|
|
97
|
-
val = value.slice(1);
|
|
98
|
-
} else {
|
|
99
|
-
negativeVal = '-'.concat('', value);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return {
|
|
103
|
-
[`[dir="rtl"] .${e(`-translate-x-${key}`)}`]: {
|
|
104
|
-
'--tw-translate-x': `${val}`
|
|
105
|
-
},
|
|
106
|
-
[`[dir="rtl"] .${e(`translate-x-${key}`)}`]: {
|
|
107
|
-
'--tw-translate-x': `${negativeVal}`
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
addUtilities(transformUtilities);
|
|
114
|
-
|
|
115
|
-
const divideUtilities = Object.entries(theme('divideWidth')).map(
|
|
116
|
-
([key, value]) => {
|
|
117
|
-
return {
|
|
118
|
-
[`[dir="rtl"] .${e(
|
|
119
|
-
`divide-x-${key}`
|
|
120
|
-
)} > :not([hidden]) ~ :not([hidden])`]: {
|
|
121
|
-
'--tw-divide-x-reverse': '0',
|
|
122
|
-
'border-right-width': `calc(${value} * calc(1 - var(--tw-divide-x-reverse)))`,
|
|
123
|
-
'border-left-width': `calc(${value} * var(--tw-divide-x-reverse))`
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
);
|
|
128
|
-
|
|
129
|
-
addUtilities({
|
|
130
|
-
[`[dir="rtl"] .${e(`divide-x`)} > :not([hidden]) ~ :not([hidden])`]: {
|
|
131
|
-
'--tw-divide-x-reverse': '0',
|
|
132
|
-
'border-right-width': 'calc(1px * calc(1 - var(--tw-divide-x-reverse)))',
|
|
133
|
-
'border-left-width': 'calc(1px * var(--tw-divide-x-reverse))'
|
|
134
|
-
},
|
|
135
|
-
...divideUtilities
|
|
136
|
-
});
|
|
137
|
-
});
|
|
1
|
+
const plugin = require('tailwindcss/plugin');
|
|
2
|
+
|
|
3
|
+
module.exports = plugin(({ addUtilities, matchUtilities, theme, e }) => {
|
|
4
|
+
const spacingUtilities = Object.entries(theme('spacing')).map(
|
|
5
|
+
([key, value]) => {
|
|
6
|
+
return {
|
|
7
|
+
[`[dir="rtl"] .${e(`pl-${key}`)}`]: {
|
|
8
|
+
'padding-right': `${value}`
|
|
9
|
+
},
|
|
10
|
+
[`[dir="rtl"] .${e(`pr-${key}`)}`]: {
|
|
11
|
+
'padding-left': `${value}`
|
|
12
|
+
},
|
|
13
|
+
[`[dir="rtl"] .${e(`ml-${key}`)}`]: {
|
|
14
|
+
'margin-right': `${value}`
|
|
15
|
+
},
|
|
16
|
+
[`[dir="rtl"] .${e(`mr-${key}`)}`]: {
|
|
17
|
+
'margin-left': `${value}`
|
|
18
|
+
},
|
|
19
|
+
[`[dir="rtl"] .${e(`pl-${key}`)}:not([class*="px-"])`]: {
|
|
20
|
+
'padding-left': '0'
|
|
21
|
+
},
|
|
22
|
+
[`[dir="rtl"] .${e(`pr-${key}`)}:not([class*="px-"])`]: {
|
|
23
|
+
'padding-right': '0'
|
|
24
|
+
},
|
|
25
|
+
[`[dir="rtl"] .${e(`ml-${key}`)}:not([class*="mx-"])`]: {
|
|
26
|
+
'margin-left': '0'
|
|
27
|
+
},
|
|
28
|
+
[`[dir="rtl"] .${e(`mr-${key}`)}:not([class*="mx-"])`]: {
|
|
29
|
+
'margin-right': '0'
|
|
30
|
+
},
|
|
31
|
+
[`[dir="rtl"] .${e(
|
|
32
|
+
`space-x-${key}`
|
|
33
|
+
)} > :not([hidden]) ~ :not([hidden])`]: {
|
|
34
|
+
'--tw-space-x-reverse': '0',
|
|
35
|
+
'margin-right':
|
|
36
|
+
'calc(' + `${value}` + ' * calc(1 - var(--tw-space-x-reverse)))',
|
|
37
|
+
'margin-left': 'calc(' + `${value}` + ' * var(--tw-space-x-reverse))'
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
addUtilities(spacingUtilities);
|
|
44
|
+
|
|
45
|
+
const borderUtilities = Object.entries(theme('borderWidth')).map(
|
|
46
|
+
([key, value]) => {
|
|
47
|
+
return {
|
|
48
|
+
[`[dir="rtl"] .${e(`border-l-${key}`)}`]: {
|
|
49
|
+
'border-right-width': `${value}`,
|
|
50
|
+
'border-left-width': '0'
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
addUtilities({
|
|
57
|
+
[`[dir="rtl"] .${e(`border`)}`]: {
|
|
58
|
+
'border-right-width': '1px',
|
|
59
|
+
'border-left-width': '1px'
|
|
60
|
+
},
|
|
61
|
+
[`[dir="rtl"] .${e(`border-l`)}`]: {
|
|
62
|
+
'border-right-width': '1px',
|
|
63
|
+
'border-left-width': '0'
|
|
64
|
+
},
|
|
65
|
+
[`[dir="rtl"] .${e(`border-r`)}`]: {
|
|
66
|
+
'border-left-width': '1px',
|
|
67
|
+
'border-right-width': '0'
|
|
68
|
+
},
|
|
69
|
+
...borderUtilities
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const insetUtilities = Object.entries(theme('inset')).map(([key, value]) => {
|
|
73
|
+
return {
|
|
74
|
+
[`[dir="rtl"] .${e(`left-${key}`)}`]: {
|
|
75
|
+
right: `${value}`
|
|
76
|
+
},
|
|
77
|
+
[`[dir="rtl"] .${e(`right-${key}`)}`]: {
|
|
78
|
+
left: `${value}`
|
|
79
|
+
},
|
|
80
|
+
[`[dir="rtl"] .${e(`left-${key}`)}:not([class*="right-"])`]: {
|
|
81
|
+
left: 'initial'
|
|
82
|
+
},
|
|
83
|
+
[`[dir="rtl"] .${e(`right-${key}`)}:not([class*="left-"])`]: {
|
|
84
|
+
right: 'initial'
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
addUtilities(insetUtilities);
|
|
90
|
+
|
|
91
|
+
const transformUtilities = Object.entries(theme('translate')).map(
|
|
92
|
+
([key, value]) => {
|
|
93
|
+
let val = value;
|
|
94
|
+
let negativeVal = value;
|
|
95
|
+
|
|
96
|
+
if (value.startsWith('-')) {
|
|
97
|
+
val = value.slice(1);
|
|
98
|
+
} else {
|
|
99
|
+
negativeVal = '-'.concat('', value);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return {
|
|
103
|
+
[`[dir="rtl"] .${e(`-translate-x-${key}`)}`]: {
|
|
104
|
+
'--tw-translate-x': `${val}`
|
|
105
|
+
},
|
|
106
|
+
[`[dir="rtl"] .${e(`translate-x-${key}`)}`]: {
|
|
107
|
+
'--tw-translate-x': `${negativeVal}`
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
addUtilities(transformUtilities);
|
|
114
|
+
|
|
115
|
+
const divideUtilities = Object.entries(theme('divideWidth')).map(
|
|
116
|
+
([key, value]) => {
|
|
117
|
+
return {
|
|
118
|
+
[`[dir="rtl"] .${e(
|
|
119
|
+
`divide-x-${key}`
|
|
120
|
+
)} > :not([hidden]) ~ :not([hidden])`]: {
|
|
121
|
+
'--tw-divide-x-reverse': '0',
|
|
122
|
+
'border-right-width': `calc(${value} * calc(1 - var(--tw-divide-x-reverse)))`,
|
|
123
|
+
'border-left-width': `calc(${value} * var(--tw-divide-x-reverse))`
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
addUtilities({
|
|
130
|
+
[`[dir="rtl"] .${e(`divide-x`)} > :not([hidden]) ~ :not([hidden])`]: {
|
|
131
|
+
'--tw-divide-x-reverse': '0',
|
|
132
|
+
'border-right-width': 'calc(1px * calc(1 - var(--tw-divide-x-reverse)))',
|
|
133
|
+
'border-left-width': 'calc(1px * var(--tw-divide-x-reverse))'
|
|
134
|
+
},
|
|
135
|
+
...divideUtilities
|
|
136
|
+
});
|
|
137
|
+
});
|