author | ymh <ymh.work@gmail.com> |
Fri, 05 Sep 2025 18:40:08 +0200 | |
changeset 21 | 48c4eec2b7e6 |
parent 19 | 3d72ae0968f4 |
child 22 | 8c2e4d02f4ef |
permissions | -rw-r--r-- |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1 |
/******/ (() => { // webpackBootstrap |
19 | 2 |
/******/ "use strict"; |
3 |
/******/ // The require scope |
|
4 |
/******/ var __webpack_require__ = {}; |
|
5 |
/******/ |
|
6 |
/************************************************************************/ |
|
7 |
/******/ /* webpack/runtime/define property getters */ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
8 |
/******/ (() => { |
19 | 9 |
/******/ // define getter functions for harmony exports |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
10 |
/******/ __webpack_require__.d = (exports, definition) => { |
19 | 11 |
/******/ for(var key in definition) { |
12 |
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
|
13 |
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
|
14 |
/******/ } |
|
15 |
/******/ } |
|
9 | 16 |
/******/ }; |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
17 |
/******/ })(); |
19 | 18 |
/******/ |
19 |
/******/ /* webpack/runtime/hasOwnProperty shorthand */ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
20 |
/******/ (() => { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
21 |
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
22 |
/******/ })(); |
19 | 23 |
/******/ |
9 | 24 |
/************************************************************************/ |
19 | 25 |
var __webpack_exports__ = {}; |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
26 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
27 |
/* harmony export */ "default": () => (/* binding */ TokenList) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
28 |
/* harmony export */ }); |
9 | 29 |
/** |
30 |
* A set of tokens. |
|
31 |
* |
|
16 | 32 |
* @see https://dom.spec.whatwg.org/#domtokenlist |
9 | 33 |
*/ |
18 | 34 |
class TokenList { |
9 | 35 |
/** |
36 |
* Constructs a new instance of TokenList. |
|
37 |
* |
|
38 |
* @param {string} initialValue Initial value to assign. |
|
39 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
40 |
constructor(initialValue = '') { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
41 |
this.value = initialValue; |
16 | 42 |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
43 |
// Disable reason: These are type hints on the class. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
44 |
/* eslint-disable no-unused-expressions */ |
16 | 45 |
/** @type {string} */ |
46 |
this._currentValue; |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
47 |
|
16 | 48 |
/** @type {string[]} */ |
49 |
this._valueAsArray; |
|
50 |
/* eslint-enable no-unused-expressions */ |
|
18 | 51 |
} |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
52 |
|
9 | 53 |
/** |
16 | 54 |
* @param {Parameters<Array<string>['entries']>} args |
9 | 55 |
*/ |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
56 |
entries(...args) { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
57 |
return this._valueAsArray.entries(...args); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
58 |
} |
9 | 59 |
|
18 | 60 |
/** |
61 |
* @param {Parameters<Array<string>['forEach']>} args |
|
62 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
63 |
forEach(...args) { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
64 |
return this._valueAsArray.forEach(...args); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
65 |
} |
16 | 66 |
|
18 | 67 |
/** |
68 |
* @param {Parameters<Array<string>['keys']>} args |
|
69 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
70 |
keys(...args) { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
71 |
return this._valueAsArray.keys(...args); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
72 |
} |
16 | 73 |
|
18 | 74 |
/** |
75 |
* @param {Parameters<Array<string>['values']>} args |
|
76 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
77 |
values(...args) { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
78 |
return this._valueAsArray.values(...args); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
79 |
} |
9 | 80 |
|
18 | 81 |
/** |
82 |
* Returns the associated set as string. |
|
83 |
* |
|
84 |
* @see https://dom.spec.whatwg.org/#dom-domtokenlist-value |
|
85 |
* |
|
86 |
* @return {string} Token set as string. |
|
87 |
*/ |
|
88 |
get value() { |
|
89 |
return this._currentValue; |
|
90 |
} |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
91 |
|
18 | 92 |
/** |
93 |
* Replaces the associated set with a new string value. |
|
94 |
* |
|
95 |
* @see https://dom.spec.whatwg.org/#dom-domtokenlist-value |
|
96 |
* |
|
97 |
* @param {string} value New token set as string. |
|
98 |
*/ |
|
99 |
set value(value) { |
|
100 |
value = String(value); |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
101 |
this._valueAsArray = [...new Set(value.split(/\s+/g).filter(Boolean))]; |
18 | 102 |
this._currentValue = this._valueAsArray.join(' '); |
103 |
} |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
104 |
|
18 | 105 |
/** |
106 |
* Returns the number of tokens. |
|
107 |
* |
|
108 |
* @see https://dom.spec.whatwg.org/#dom-domtokenlist-length |
|
109 |
* |
|
110 |
* @return {number} Number of tokens. |
|
111 |
*/ |
|
112 |
get length() { |
|
113 |
return this._valueAsArray.length; |
|
114 |
} |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
115 |
|
18 | 116 |
/** |
117 |
* Returns the stringified form of the TokenList. |
|
118 |
* |
|
119 |
* @see https://dom.spec.whatwg.org/#DOMTokenList-stringification-behavior |
|
120 |
* @see https://www.ecma-international.org/ecma-262/9.0/index.html#sec-tostring |
|
121 |
* |
|
122 |
* @return {string} Token set as string. |
|
123 |
*/ |
|
124 |
toString() { |
|
125 |
return this.value; |
|
126 |
} |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
127 |
|
18 | 128 |
/** |
129 |
* Returns an iterator for the TokenList, iterating items of the set. |
|
130 |
* |
|
131 |
* @see https://dom.spec.whatwg.org/#domtokenlist |
|
132 |
* |
|
133 |
* @return {IterableIterator<string>} TokenList iterator. |
|
134 |
*/ |
|
135 |
*[Symbol.iterator]() { |
|
136 |
return yield* this._valueAsArray; |
|
137 |
} |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
138 |
|
18 | 139 |
/** |
140 |
* Returns the token with index `index`. |
|
141 |
* |
|
142 |
* @see https://dom.spec.whatwg.org/#dom-domtokenlist-item |
|
143 |
* |
|
144 |
* @param {number} index Index at which to return token. |
|
145 |
* |
|
146 |
* @return {string|undefined} Token at index. |
|
147 |
*/ |
|
148 |
item(index) { |
|
149 |
return this._valueAsArray[index]; |
|
150 |
} |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
151 |
|
18 | 152 |
/** |
153 |
* Returns true if `token` is present, and false otherwise. |
|
154 |
* |
|
155 |
* @see https://dom.spec.whatwg.org/#dom-domtokenlist-contains |
|
156 |
* |
|
157 |
* @param {string} item Token to test. |
|
158 |
* |
|
159 |
* @return {boolean} Whether token is present. |
|
160 |
*/ |
|
161 |
contains(item) { |
|
162 |
return this._valueAsArray.indexOf(item) !== -1; |
|
163 |
} |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
164 |
|
18 | 165 |
/** |
166 |
* Adds all arguments passed, except those already present. |
|
167 |
* |
|
168 |
* @see https://dom.spec.whatwg.org/#dom-domtokenlist-add |
|
169 |
* |
|
170 |
* @param {...string} items Items to add. |
|
171 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
172 |
add(...items) { |
18 | 173 |
this.value += ' ' + items.join(' '); |
174 |
} |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
175 |
|
18 | 176 |
/** |
177 |
* Removes arguments passed, if they are present. |
|
178 |
* |
|
179 |
* @see https://dom.spec.whatwg.org/#dom-domtokenlist-remove |
|
180 |
* |
|
181 |
* @param {...string} items Items to remove. |
|
182 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
183 |
remove(...items) { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
184 |
this.value = this._valueAsArray.filter(val => !items.includes(val)).join(' '); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
185 |
} |
18 | 186 |
|
187 |
/** |
|
188 |
* If `force` is not given, "toggles" `token`, removing it if it’s present |
|
189 |
* and adding it if it’s not present. If `force` is true, adds token (same |
|
190 |
* as add()). If force is false, removes token (same as remove()). Returns |
|
191 |
* true if `token` is now present, and false otherwise. |
|
192 |
* |
|
193 |
* @see https://dom.spec.whatwg.org/#dom-domtokenlist-toggle |
|
194 |
* |
|
195 |
* @param {string} token Token to toggle. |
|
196 |
* @param {boolean} [force] Presence to force. |
|
197 |
* |
|
198 |
* @return {boolean} Whether token is present after toggle. |
|
199 |
*/ |
|
200 |
toggle(token, force) { |
|
201 |
if (undefined === force) { |
|
202 |
force = !this.contains(token); |
|
203 |
} |
|
204 |
if (force) { |
|
205 |
this.add(token); |
|
206 |
} else { |
|
207 |
this.remove(token); |
|
208 |
} |
|
209 |
return force; |
|
210 |
} |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
211 |
|
18 | 212 |
/** |
213 |
* Replaces `token` with `newToken`. Returns true if `token` was replaced |
|
214 |
* with `newToken`, and false otherwise. |
|
215 |
* |
|
216 |
* @see https://dom.spec.whatwg.org/#dom-domtokenlist-replace |
|
217 |
* |
|
218 |
* @param {string} token Token to replace with `newToken`. |
|
219 |
* @param {string} newToken Token to use in place of `token`. |
|
220 |
* |
|
221 |
* @return {boolean} Whether replacement occurred. |
|
222 |
*/ |
|
223 |
replace(token, newToken) { |
|
224 |
if (!this.contains(token)) { |
|
225 |
return false; |
|
226 |
} |
|
227 |
this.remove(token); |
|
228 |
this.add(newToken); |
|
229 |
return true; |
|
230 |
} |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
231 |
|
18 | 232 |
/** |
233 |
* Returns true if `token` is in the associated attribute’s supported |
|
234 |
* tokens. Returns false otherwise. |
|
235 |
* |
|
236 |
* Always returns `true` in this implementation. |
|
237 |
* |
|
238 |
* @see https://dom.spec.whatwg.org/#dom-domtokenlist-supports |
|
239 |
* |
|
240 |
* @return {boolean} Whether token is supported. |
|
241 |
*/ |
|
242 |
supports() { |
|
243 |
return true; |
|
244 |
} |
|
245 |
} |
|
9 | 246 |
|
19 | 247 |
(window.wp = window.wp || {}).tokenList = __webpack_exports__["default"]; |
248 |
/******/ })() |
|
249 |
; |