scrabble-solver 2.11.3 → 2.11.5
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/lerna.json +1 -1
- package/package.json +7 -7
- package/packages/configs/package.json +3 -3
- package/packages/constants/build/index.js +2 -30
- package/packages/constants/package.json +1 -1
- package/packages/constants/src/index.ts +3 -31
- package/packages/dictionaries/.scrabble-solver/dictionaries/de-DE.txt +1 -0
- package/packages/dictionaries/.scrabble-solver/dictionaries/en-GB.txt +1 -0
- package/packages/dictionaries/.scrabble-solver/dictionaries/en-US.txt +1 -0
- package/packages/dictionaries/.scrabble-solver/dictionaries/es-ES.txt +1 -0
- package/packages/dictionaries/.scrabble-solver/dictionaries/fa-IR.txt +1 -0
- package/packages/dictionaries/.scrabble-solver/dictionaries/fr-FR.txt +1 -0
- package/packages/dictionaries/.scrabble-solver/dictionaries/pl-PL.txt +1 -0
- package/packages/dictionaries/package-lock.json +3 -10
- package/packages/dictionaries/package.json +4 -4
- package/packages/logger/package-lock.json +3 -224
- package/packages/logger/package.json +1 -1
- package/packages/scrabble-solver/.next/BUILD_ID +1 -1
- package/packages/scrabble-solver/.next/build-manifest.json +7 -7
- package/packages/scrabble-solver/.next/cache/.tsbuildinfo +1 -1
- package/packages/scrabble-solver/.next/cache/eslint/.cache_8dgz12 +1 -1
- package/packages/scrabble-solver/.next/cache/next-server.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/cache/webpack/client-production/0.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/client-production/index.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/edge-server-production/0.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/edge-server-production/index.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-production/0.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-production/index.pack +0 -0
- package/packages/scrabble-solver/.next/export-marker.json +1 -1
- package/packages/scrabble-solver/.next/next-server.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/prerender-manifest.json +1 -1
- package/packages/scrabble-solver/.next/routes-manifest.json +1 -1
- package/packages/scrabble-solver/.next/server/chunks/131.js +1 -1
- package/packages/scrabble-solver/.next/server/chunks/277.js +736 -913
- package/packages/scrabble-solver/.next/server/chunks/44.js +2 -30
- package/packages/scrabble-solver/.next/server/chunks/636.js +286 -0
- package/packages/scrabble-solver/.next/server/chunks/675.js +550 -0
- package/packages/scrabble-solver/.next/server/middleware-build-manifest.js +1 -1
- package/packages/scrabble-solver/.next/server/pages/404.html +2 -2
- package/packages/scrabble-solver/.next/server/pages/404.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/500.html +1 -1
- package/packages/scrabble-solver/.next/server/pages/_app.js +73 -9
- package/packages/scrabble-solver/.next/server/pages/_app.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/_document.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/_error.js +1 -280
- package/packages/scrabble-solver/.next/server/pages/_error.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/api/solve.js +22 -2
- package/packages/scrabble-solver/.next/server/pages/index.html +1 -1
- package/packages/scrabble-solver/.next/server/pages/index.js +382 -313
- package/packages/scrabble-solver/.next/server/pages/index.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/index.json +1 -1
- package/packages/scrabble-solver/.next/static/UzQCOB6CHhyOupkEq8oZM/_buildManifest.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/pages/{404-448ba28510855455.js → 404-d30fe85d005ce32b.js} +1 -1
- package/packages/scrabble-solver/.next/static/chunks/pages/_app-e27464a187a58684.js +28 -0
- package/packages/scrabble-solver/.next/static/chunks/pages/index-3fd280f406cc00fd.js +1 -0
- package/packages/scrabble-solver/.next/static/css/4bd04cebe207859c.css +1 -0
- package/packages/scrabble-solver/.next/static/css/5b3b78170f4c5875.css +2 -0
- package/packages/scrabble-solver/.next/trace +50 -53
- package/packages/scrabble-solver/next.config.js +1 -0
- package/packages/scrabble-solver/package-lock.json +137 -5220
- package/packages/scrabble-solver/package.json +11 -12
- package/packages/scrabble-solver/src/@types/svg.d.ts +1 -1
- package/packages/scrabble-solver/src/components/Board/Board.tsx +48 -44
- package/packages/scrabble-solver/src/components/Board/components/Actions/Actions.tsx +4 -2
- package/packages/scrabble-solver/src/components/Board/components/Cell/Cell.module.scss +59 -1
- package/packages/scrabble-solver/src/components/Board/hooks/useGrid.ts +5 -3
- package/packages/scrabble-solver/src/components/Button/Button.module.scss +1 -1
- package/packages/scrabble-solver/src/components/Loading/Loading.module.scss +1 -1
- package/packages/scrabble-solver/src/components/Loading/Loading.tsx +1 -1
- package/packages/scrabble-solver/src/components/Logo/Logo.tsx +10 -12
- package/packages/scrabble-solver/src/components/Logo/LogoBlueprint.tsx +21 -0
- package/packages/scrabble-solver/src/components/Logo/index.ts +1 -1
- package/packages/scrabble-solver/src/components/Modal/Modal.module.scss +1 -6
- package/packages/scrabble-solver/src/components/Modal/Modal.tsx +15 -8
- package/packages/scrabble-solver/src/components/NavButtons/NavButtons.tsx +2 -2
- package/packages/scrabble-solver/src/components/Rack/Rack.module.scss +59 -0
- package/packages/scrabble-solver/src/components/Results/HeaderButton.tsx +6 -6
- package/packages/scrabble-solver/src/components/Results/Results.module.scss +3 -0
- package/packages/scrabble-solver/src/components/Results/Results.tsx +7 -7
- package/packages/scrabble-solver/src/components/Results/useColumns.ts +2 -5
- package/packages/scrabble-solver/src/components/Solver/Solver.tsx +6 -23
- package/packages/scrabble-solver/src/components/Tile/Tile.module.scss +2 -1
- package/packages/scrabble-solver/src/components/Tile/Tile.tsx +8 -4
- package/packages/scrabble-solver/src/components/index.ts +0 -3
- package/packages/scrabble-solver/src/hooks/index.ts +6 -0
- package/packages/scrabble-solver/src/hooks/useAppLayout.ts +62 -12
- package/packages/scrabble-solver/src/hooks/useEffectOnce.ts +5 -0
- package/packages/scrabble-solver/src/hooks/useIsTouchDevice.ts +1 -1
- package/packages/scrabble-solver/src/hooks/useLatest.ts +13 -0
- package/packages/scrabble-solver/src/hooks/useLocalStorage.ts +51 -0
- package/packages/scrabble-solver/src/hooks/useMedia.ts +36 -0
- package/packages/scrabble-solver/src/hooks/useMediaQueries.ts +13 -0
- package/packages/scrabble-solver/src/hooks/useMediaQuery.ts +2 -1
- package/packages/scrabble-solver/src/hooks/useOnWindowResize.ts +13 -0
- package/packages/scrabble-solver/src/hooks/useViewportSize.ts +19 -0
- package/packages/scrabble-solver/src/i18n/constants.ts +14 -14
- package/packages/scrabble-solver/src/i18n/de.json +2 -2
- package/packages/scrabble-solver/src/i18n/en.json +2 -2
- package/packages/scrabble-solver/src/i18n/es.json +2 -2
- package/packages/scrabble-solver/src/i18n/fa.json +1 -1
- package/packages/scrabble-solver/src/i18n/fr.json +2 -2
- package/packages/scrabble-solver/src/i18n/pl.json +2 -2
- package/packages/scrabble-solver/src/lib/arrayEquals.ts +5 -0
- package/packages/scrabble-solver/src/lib/index.ts +1 -0
- package/packages/scrabble-solver/src/lib/zipCharactersAndTiles.ts +3 -1
- package/packages/scrabble-solver/src/modals/DictionaryModal/DictionaryModal.tsx +2 -2
- package/packages/scrabble-solver/src/modals/KeyMapModal/KeyMapModal.tsx +2 -2
- package/packages/scrabble-solver/src/modals/KeyMapModal/keys.tsx +0 -2
- package/packages/scrabble-solver/src/modals/MenuModal/MenuModal.module.scss +28 -4
- package/packages/scrabble-solver/src/modals/MenuModal/MenuModal.tsx +4 -4
- package/packages/scrabble-solver/src/modals/RemainingTilesModal/RemainingTilesModal.tsx +2 -2
- package/packages/scrabble-solver/src/modals/ResultsModal/ResultsModal.module.scss +1 -5
- package/packages/scrabble-solver/src/modals/ResultsModal/ResultsModal.tsx +10 -2
- package/packages/scrabble-solver/src/modals/SettingsModal/SettingsModal.tsx +2 -2
- package/packages/scrabble-solver/src/modals/SettingsModal/components/AutoGroupTilesSetting/lib.ts +3 -1
- package/packages/scrabble-solver/src/modals/SettingsModal/components/LocaleSetting/LocaleSetting.module.scss +1 -1
- package/packages/scrabble-solver/src/modals/WordsModal/WordsModal.tsx +2 -2
- package/packages/scrabble-solver/src/pages/index.module.scss +3 -21
- package/packages/scrabble-solver/src/pages/index.tsx +51 -67
- package/packages/scrabble-solver/src/parameters/index.ts +29 -2
- package/packages/scrabble-solver/src/state/localStorage.ts +13 -2
- package/packages/scrabble-solver/src/state/sagas.ts +16 -8
- package/packages/scrabble-solver/src/state/slices/boardInitialState.ts +5 -1
- package/packages/scrabble-solver/src/state/slices/boardSlice.ts +2 -2
- package/packages/scrabble-solver/src/state/slices/rackInitialState.ts +8 -2
- package/packages/scrabble-solver/src/state/slices/rackSlice.ts +16 -13
- package/packages/scrabble-solver/src/state/slices/settingsInitialState.ts +9 -4
- package/packages/scrabble-solver/src/state/slices/settingsSlice.ts +3 -1
- package/packages/scrabble-solver/src/styles/animations.scss +0 -20
- package/packages/scrabble-solver/src/styles/global.scss +0 -7
- package/packages/scrabble-solver/src/styles/mixins.scss +0 -59
- package/packages/scrabble-solver/src/styles/variables.scss +11 -0
- package/packages/scrabble-solver/src/types/index.ts +4 -0
- package/packages/solver/package-lock.json +3 -10
- package/packages/solver/package.json +5 -5
- package/packages/types/package.json +2 -2
- package/packages/word-definitions/package-lock.json +3 -153
- package/packages/word-definitions/package.json +2 -2
- package/packages/word-lists/package-lock.json +9 -401
- package/packages/word-lists/package.json +2 -2
- package/packages/scrabble-solver/.next/static/USLkKOoHbITebIEHkMGX_/_buildManifest.js +0 -1
- package/packages/scrabble-solver/.next/static/chunks/pages/_app-21c83ddb81fc09d0.js +0 -28
- package/packages/scrabble-solver/.next/static/chunks/pages/index-0858deea02b2a417.js +0 -1
- package/packages/scrabble-solver/.next/static/css/885da289cec275b3.css +0 -1
- package/packages/scrabble-solver/.next/static/css/ea1c8134fe9a143e.css +0 -2
- package/packages/scrabble-solver/src/components/LogoSplashScreen/LogoSplashScreen.module.scss +0 -65
- package/packages/scrabble-solver/src/components/LogoSplashScreen/LogoSplashScreen.tsx +0 -31
- package/packages/scrabble-solver/src/components/LogoSplashScreen/index.ts +0 -1
- package/packages/scrabble-solver/src/components/Sizer/Sizer.module.scss +0 -10
- package/packages/scrabble-solver/src/components/Sizer/Sizer.tsx +0 -10
- package/packages/scrabble-solver/src/components/Sizer/index.ts +0 -1
- package/packages/scrabble-solver/src/components/SplashScreen/SplashScreen.module.scss +0 -14
- package/packages/scrabble-solver/src/components/SplashScreen/SplashScreen.tsx +0 -19
- package/packages/scrabble-solver/src/components/SplashScreen/index.ts +0 -1
- package/packages/scrabble-solver/src/hooks/useLocalStorage/index.ts +0 -1
- package/packages/scrabble-solver/src/hooks/useLocalStorage/useLocalStorage.ts +0 -13
- package/packages/scrabble-solver/src/hooks/useLocalStorage/useLocalStorageBoard.ts +0 -29
- package/packages/scrabble-solver/src/hooks/useLocalStorage/useLocalStorageConfigId.ts +0 -29
- package/packages/scrabble-solver/src/hooks/useLocalStorage/useLocalStorageLocale.ts +0 -32
- package/packages/scrabble-solver/src/hooks/useLocalStorage/useLocalStorageRack.ts +0 -29
- /package/packages/scrabble-solver/.next/static/{USLkKOoHbITebIEHkMGX_ → UzQCOB6CHhyOupkEq8oZM}/_ssgManifest.js +0 -0
- /package/packages/scrabble-solver/{src/components/Logo/Logo.svg → public/logo.svg} +0 -0
|
@@ -16,36 +16,8 @@ exports.BONUS_CHARACTER = 'BONUS_CHARACTER';
|
|
|
16
16
|
exports.BONUS_WORD = 'BONUS_WORD';
|
|
17
17
|
exports.EMPTY_CELL = ' ';
|
|
18
18
|
exports.NO_BONUS = { characterMultiplier: 1, wordMultiplier: 1 };
|
|
19
|
-
exports.CONSONANTS =
|
|
20
|
-
|
|
21
|
-
'c',
|
|
22
|
-
'ć',
|
|
23
|
-
'd',
|
|
24
|
-
'f',
|
|
25
|
-
'g',
|
|
26
|
-
'h',
|
|
27
|
-
'j',
|
|
28
|
-
'k',
|
|
29
|
-
'l',
|
|
30
|
-
'ł',
|
|
31
|
-
'm',
|
|
32
|
-
'n',
|
|
33
|
-
'ń',
|
|
34
|
-
'ñ',
|
|
35
|
-
'p',
|
|
36
|
-
'q',
|
|
37
|
-
'r',
|
|
38
|
-
's',
|
|
39
|
-
'ś',
|
|
40
|
-
't',
|
|
41
|
-
'v',
|
|
42
|
-
'w',
|
|
43
|
-
'x',
|
|
44
|
-
'z',
|
|
45
|
-
'ź',
|
|
46
|
-
'ż',
|
|
47
|
-
];
|
|
48
|
-
exports.VOWELS = ['a', 'ą', 'ä', 'e', 'ę', 'i', 'o', 'ó', 'ö', 'u', 'ü', 'y'];
|
|
19
|
+
exports.CONSONANTS = 'bcćdfghjklłmnńñpqrsśtvwxzźż'.split('');
|
|
20
|
+
exports.VOWELS = 'aąäeęioóöuüy'.split('');
|
|
49
21
|
|
|
50
22
|
|
|
51
23
|
/***/ }),
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.id = 636;
|
|
3
|
+
exports.ids = [636];
|
|
4
|
+
exports.modules = {
|
|
5
|
+
|
|
6
|
+
/***/ 6495:
|
|
7
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
8
|
+
|
|
9
|
+
var __webpack_unused_export__;
|
|
10
|
+
|
|
11
|
+
__webpack_unused_export__ = ({
|
|
12
|
+
value: true
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(exports, "Z", ({
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function() {
|
|
17
|
+
return _extends;
|
|
18
|
+
}
|
|
19
|
+
}));
|
|
20
|
+
function extends_() {
|
|
21
|
+
extends_ = Object.assign || function(target) {
|
|
22
|
+
for(var i = 1; i < arguments.length; i++){
|
|
23
|
+
var source = arguments[i];
|
|
24
|
+
for(var key in source){
|
|
25
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
26
|
+
target[key] = source[key];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
return extends_.apply(this, arguments);
|
|
33
|
+
}
|
|
34
|
+
function _extends() {
|
|
35
|
+
return extends_.apply(this, arguments);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
/***/ }),
|
|
40
|
+
|
|
41
|
+
/***/ 92648:
|
|
42
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
43
|
+
|
|
44
|
+
var __webpack_unused_export__;
|
|
45
|
+
|
|
46
|
+
__webpack_unused_export__ = ({
|
|
47
|
+
value: true
|
|
48
|
+
});
|
|
49
|
+
Object.defineProperty(exports, "Z", ({
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: function() {
|
|
52
|
+
return _interopRequireDefault;
|
|
53
|
+
}
|
|
54
|
+
}));
|
|
55
|
+
function _interopRequireDefault(obj) {
|
|
56
|
+
return obj && obj.__esModule ? obj : {
|
|
57
|
+
default: obj
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
/***/ }),
|
|
63
|
+
|
|
64
|
+
/***/ 91598:
|
|
65
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
66
|
+
|
|
67
|
+
var __webpack_unused_export__;
|
|
68
|
+
|
|
69
|
+
__webpack_unused_export__ = ({
|
|
70
|
+
value: true
|
|
71
|
+
});
|
|
72
|
+
Object.defineProperty(exports, "Z", ({
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function() {
|
|
75
|
+
return _interopRequireWildcard;
|
|
76
|
+
}
|
|
77
|
+
}));
|
|
78
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
79
|
+
if (typeof WeakMap !== "function") return null;
|
|
80
|
+
var cacheBabelInterop = new WeakMap();
|
|
81
|
+
var cacheNodeInterop = new WeakMap();
|
|
82
|
+
return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) {
|
|
83
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
84
|
+
})(nodeInterop);
|
|
85
|
+
}
|
|
86
|
+
function _interopRequireWildcard(obj, nodeInterop) {
|
|
87
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
88
|
+
return obj;
|
|
89
|
+
}
|
|
90
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
91
|
+
return {
|
|
92
|
+
default: obj
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
96
|
+
if (cache && cache.has(obj)) {
|
|
97
|
+
return cache.get(obj);
|
|
98
|
+
}
|
|
99
|
+
var newObj = {};
|
|
100
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
101
|
+
for(var key in obj){
|
|
102
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
103
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
104
|
+
if (desc && (desc.get || desc.set)) {
|
|
105
|
+
Object.defineProperty(newObj, key, desc);
|
|
106
|
+
} else {
|
|
107
|
+
newObj[key] = obj[key];
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
newObj.default = obj;
|
|
112
|
+
if (cache) {
|
|
113
|
+
cache.set(obj, newObj);
|
|
114
|
+
}
|
|
115
|
+
return newObj;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
/***/ }),
|
|
120
|
+
|
|
121
|
+
/***/ 42636:
|
|
122
|
+
/***/ ((module, exports, __webpack_require__) => {
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
"use client";
|
|
126
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
127
|
+
value: true
|
|
128
|
+
}));
|
|
129
|
+
exports.defaultHead = defaultHead;
|
|
130
|
+
exports["default"] = void 0;
|
|
131
|
+
var _extends = (__webpack_require__(6495)/* ["default"] */ .Z);
|
|
132
|
+
var _interop_require_default = (__webpack_require__(92648)/* ["default"] */ .Z);
|
|
133
|
+
var _interop_require_wildcard = (__webpack_require__(91598)/* ["default"] */ .Z);
|
|
134
|
+
var _react = _interop_require_wildcard(__webpack_require__(16689));
|
|
135
|
+
var _sideEffect = _interop_require_default(__webpack_require__(82470));
|
|
136
|
+
var _ampContext = __webpack_require__(53918);
|
|
137
|
+
var _headManagerContext = __webpack_require__(92796);
|
|
138
|
+
var _ampMode = __webpack_require__(45732);
|
|
139
|
+
var _warnOnce = __webpack_require__(40618);
|
|
140
|
+
function defaultHead(inAmpMode = false) {
|
|
141
|
+
const head = [
|
|
142
|
+
/*#__PURE__*/ _react.default.createElement("meta", {
|
|
143
|
+
charSet: "utf-8"
|
|
144
|
+
})
|
|
145
|
+
];
|
|
146
|
+
if (!inAmpMode) {
|
|
147
|
+
head.push(/*#__PURE__*/ _react.default.createElement("meta", {
|
|
148
|
+
name: "viewport",
|
|
149
|
+
content: "width=device-width"
|
|
150
|
+
}));
|
|
151
|
+
}
|
|
152
|
+
return head;
|
|
153
|
+
}
|
|
154
|
+
function onlyReactElement(list, child) {
|
|
155
|
+
// React children can be "string" or "number" in this case we ignore them for backwards compat
|
|
156
|
+
if (typeof child === "string" || typeof child === "number") {
|
|
157
|
+
return list;
|
|
158
|
+
}
|
|
159
|
+
// Adds support for React.Fragment
|
|
160
|
+
if (child.type === _react.default.Fragment) {
|
|
161
|
+
return list.concat(_react.default.Children.toArray(child.props.children).reduce((fragmentList, fragmentChild)=>{
|
|
162
|
+
if (typeof fragmentChild === "string" || typeof fragmentChild === "number") {
|
|
163
|
+
return fragmentList;
|
|
164
|
+
}
|
|
165
|
+
return fragmentList.concat(fragmentChild);
|
|
166
|
+
}, []));
|
|
167
|
+
}
|
|
168
|
+
return list.concat(child);
|
|
169
|
+
}
|
|
170
|
+
const METATYPES = [
|
|
171
|
+
"name",
|
|
172
|
+
"httpEquiv",
|
|
173
|
+
"charSet",
|
|
174
|
+
"itemProp"
|
|
175
|
+
];
|
|
176
|
+
/*
|
|
177
|
+
returns a function for filtering head child elements
|
|
178
|
+
which shouldn't be duplicated, like <title/>
|
|
179
|
+
Also adds support for deduplicated `key` properties
|
|
180
|
+
*/ function unique() {
|
|
181
|
+
const keys = new Set();
|
|
182
|
+
const tags = new Set();
|
|
183
|
+
const metaTypes = new Set();
|
|
184
|
+
const metaCategories = {};
|
|
185
|
+
return (h)=>{
|
|
186
|
+
let isUnique = true;
|
|
187
|
+
let hasKey = false;
|
|
188
|
+
if (h.key && typeof h.key !== "number" && h.key.indexOf("$") > 0) {
|
|
189
|
+
hasKey = true;
|
|
190
|
+
const key = h.key.slice(h.key.indexOf("$") + 1);
|
|
191
|
+
if (keys.has(key)) {
|
|
192
|
+
isUnique = false;
|
|
193
|
+
} else {
|
|
194
|
+
keys.add(key);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
// eslint-disable-next-line default-case
|
|
198
|
+
switch(h.type){
|
|
199
|
+
case "title":
|
|
200
|
+
case "base":
|
|
201
|
+
if (tags.has(h.type)) {
|
|
202
|
+
isUnique = false;
|
|
203
|
+
} else {
|
|
204
|
+
tags.add(h.type);
|
|
205
|
+
}
|
|
206
|
+
break;
|
|
207
|
+
case "meta":
|
|
208
|
+
for(let i = 0, len = METATYPES.length; i < len; i++){
|
|
209
|
+
const metatype = METATYPES[i];
|
|
210
|
+
if (!h.props.hasOwnProperty(metatype)) continue;
|
|
211
|
+
if (metatype === "charSet") {
|
|
212
|
+
if (metaTypes.has(metatype)) {
|
|
213
|
+
isUnique = false;
|
|
214
|
+
} else {
|
|
215
|
+
metaTypes.add(metatype);
|
|
216
|
+
}
|
|
217
|
+
} else {
|
|
218
|
+
const category = h.props[metatype];
|
|
219
|
+
const categories = metaCategories[metatype] || new Set();
|
|
220
|
+
if ((metatype !== "name" || !hasKey) && categories.has(category)) {
|
|
221
|
+
isUnique = false;
|
|
222
|
+
} else {
|
|
223
|
+
categories.add(category);
|
|
224
|
+
metaCategories[metatype] = categories;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
return isUnique;
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
*
|
|
235
|
+
* @param headChildrenElements List of children of <Head>
|
|
236
|
+
*/ function reduceComponents(headChildrenElements, props) {
|
|
237
|
+
const { inAmpMode } = props;
|
|
238
|
+
return headChildrenElements.reduce(onlyReactElement, []).reverse().concat(defaultHead(inAmpMode).reverse()).filter(unique()).reverse().map((c, i)=>{
|
|
239
|
+
const key = c.key || i;
|
|
240
|
+
if ( true && !inAmpMode) {
|
|
241
|
+
if (c.type === "link" && c.props["href"] && // TODO(prateekbh@): Replace this with const from `constants` when the tree shaking works.
|
|
242
|
+
[
|
|
243
|
+
"https://fonts.googleapis.com/css",
|
|
244
|
+
"https://use.typekit.net/"
|
|
245
|
+
].some((url)=>c.props["href"].startsWith(url))) {
|
|
246
|
+
const newProps = _extends({}, c.props || {});
|
|
247
|
+
newProps["data-href"] = newProps["href"];
|
|
248
|
+
newProps["href"] = undefined;
|
|
249
|
+
// Add this attribute to make it easy to identify optimized tags
|
|
250
|
+
newProps["data-optimized-fonts"] = true;
|
|
251
|
+
return /*#__PURE__*/ _react.default.cloneElement(c, newProps);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
if (false) {}
|
|
255
|
+
return /*#__PURE__*/ _react.default.cloneElement(c, {
|
|
256
|
+
key
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* This component injects elements to `<head>` of your page.
|
|
262
|
+
* To avoid duplicated `tags` in `<head>` you can use the `key` property, which will make sure every tag is only rendered once.
|
|
263
|
+
*/ function Head({ children }) {
|
|
264
|
+
const ampState = (0, _react).useContext(_ampContext.AmpStateContext);
|
|
265
|
+
const headManager = (0, _react).useContext(_headManagerContext.HeadManagerContext);
|
|
266
|
+
return /*#__PURE__*/ _react.default.createElement(_sideEffect.default, {
|
|
267
|
+
reduceComponentsToState: reduceComponents,
|
|
268
|
+
headManager: headManager,
|
|
269
|
+
inAmpMode: (0, _ampMode).isInAmpMode(ampState)
|
|
270
|
+
}, children);
|
|
271
|
+
}
|
|
272
|
+
var _default = Head;
|
|
273
|
+
exports["default"] = _default;
|
|
274
|
+
if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
|
|
275
|
+
Object.defineProperty(exports.default, "__esModule", {
|
|
276
|
+
value: true
|
|
277
|
+
});
|
|
278
|
+
Object.assign(exports.default, exports);
|
|
279
|
+
module.exports = exports.default;
|
|
280
|
+
} //# sourceMappingURL=head.js.map
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
/***/ })
|
|
284
|
+
|
|
285
|
+
};
|
|
286
|
+
;
|