umaki 0.1.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.
Files changed (106) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +592 -0
  3. package/dist/index.d.ts +8 -0
  4. package/dist/index.js +2871 -0
  5. package/dist/index.umd.cjs +3 -0
  6. package/dist/libs/control/bgScrollStop.d.ts +15 -0
  7. package/dist/libs/control/index.d.ts +7 -0
  8. package/dist/libs/control/pd.d.ts +6 -0
  9. package/dist/libs/control/pd.test.d.ts +1 -0
  10. package/dist/libs/control/scrollToHash.d.ts +9 -0
  11. package/dist/libs/control/scrollToHash.test.d.ts +1 -0
  12. package/dist/libs/control/videoPlayControl.d.ts +14 -0
  13. package/dist/libs/control/videoPlayControl.test.d.ts +1 -0
  14. package/dist/libs/convert/changeDateStringToSpecificFormat.d.ts +8 -0
  15. package/dist/libs/convert/changeDateStringToSpecificFormat.test.d.ts +1 -0
  16. package/dist/libs/convert/index.d.ts +5 -0
  17. package/dist/libs/convert/jsonStringToJsonObject.d.ts +7 -0
  18. package/dist/libs/convert/jsonStringToJsonObject.test.d.ts +1 -0
  19. package/dist/libs/get/getAspectRatio.d.ts +11 -0
  20. package/dist/libs/get/getAspectRatio.test.d.ts +1 -0
  21. package/dist/libs/get/getClassNames.d.ts +7 -0
  22. package/dist/libs/get/getClassNames.test.d.ts +1 -0
  23. package/dist/libs/get/getDocumentHeight.d.ts +6 -0
  24. package/dist/libs/get/getDocumentHeight.test.d.ts +1 -0
  25. package/dist/libs/get/getEventPaths.d.ts +6 -0
  26. package/dist/libs/get/getGcd.d.ts +11 -0
  27. package/dist/libs/get/getGcd.test.d.ts +1 -0
  28. package/dist/libs/get/getImageSize.d.ts +7 -0
  29. package/dist/libs/get/getOrientation.d.ts +6 -0
  30. package/dist/libs/get/getOrientation.test.d.ts +1 -0
  31. package/dist/libs/get/getParentList.d.ts +7 -0
  32. package/dist/libs/get/getParentList.test.d.ts +1 -0
  33. package/dist/libs/get/getPath.d.ts +7 -0
  34. package/dist/libs/get/getPath.test.d.ts +1 -0
  35. package/dist/libs/get/getPathFromLocalPublic.d.ts +7 -0
  36. package/dist/libs/get/getPathFromLocalPublic.test.d.ts +1 -0
  37. package/dist/libs/get/getQueryParams.d.ts +10 -0
  38. package/dist/libs/get/getQueryParams.test.d.ts +1 -0
  39. package/dist/libs/get/getRem.d.ts +7 -0
  40. package/dist/libs/get/getRem.test.d.ts +1 -0
  41. package/dist/libs/get/getScrollbarWidth.d.ts +6 -0
  42. package/dist/libs/get/getScrollbarWidth.test.d.ts +1 -0
  43. package/dist/libs/get/getSessionStorage.d.ts +7 -0
  44. package/dist/libs/get/getSessionStorage.test.d.ts +1 -0
  45. package/dist/libs/get/getStringLength.d.ts +10 -0
  46. package/dist/libs/get/getStringLength.test.d.ts +1 -0
  47. package/dist/libs/get/getStylePropertyValue.d.ts +7 -0
  48. package/dist/libs/get/getStylePropertyValue.test.d.ts +1 -0
  49. package/dist/libs/get/getStylePropertyValueToNumber.d.ts +7 -0
  50. package/dist/libs/get/getStylePropertyValueToNumber.test.d.ts +1 -0
  51. package/dist/libs/get/getUaData.d.ts +24 -0
  52. package/dist/libs/get/getUaData.test.d.ts +1 -0
  53. package/dist/libs/get/index.d.ts +18 -0
  54. package/dist/libs/is/index.d.ts +10 -0
  55. package/dist/libs/is/isBetweenDateTime.d.ts +11 -0
  56. package/dist/libs/is/isBetweenDateTime.test.d.ts +1 -0
  57. package/dist/libs/is/isExistAllElements.d.ts +7 -0
  58. package/dist/libs/is/isExistAllElements.test.d.ts +1 -0
  59. package/dist/libs/is/isIpad.d.ts +7 -0
  60. package/dist/libs/is/isIpad.test.d.ts +1 -0
  61. package/dist/libs/is/isKeyExists.d.ts +10 -0
  62. package/dist/libs/is/isKeyExists.test.d.ts +1 -0
  63. package/dist/libs/is/isProduction.d.ts +1 -0
  64. package/dist/libs/is/isProduction.test.d.ts +1 -0
  65. package/dist/libs/is/isSafari.d.ts +7 -0
  66. package/dist/libs/is/isSafari.test.d.ts +1 -0
  67. package/dist/libs/is/isScrollable.d.ts +7 -0
  68. package/dist/libs/is/isScrollable.test.d.ts +1 -0
  69. package/dist/libs/is/isTouchSupport.d.ts +6 -0
  70. package/dist/libs/remove/index.d.ts +7 -0
  71. package/dist/libs/remove/removeAllHtmlTags.d.ts +7 -0
  72. package/dist/libs/remove/removeAllHtmlTags.test.d.ts +1 -0
  73. package/dist/libs/remove/removeAttribute.d.ts +7 -0
  74. package/dist/libs/remove/removeAttribute.test.d.ts +1 -0
  75. package/dist/libs/remove/removeSessionStorage.d.ts +6 -0
  76. package/dist/libs/remove/removeSessionStorage.test.d.ts +1 -0
  77. package/dist/libs/remove/removeStylePropertyValue.d.ts +6 -0
  78. package/dist/libs/remove/removeStylePropertyValue.test.d.ts +1 -0
  79. package/dist/libs/set/index.d.ts +9 -0
  80. package/dist/libs/set/set100vh.d.ts +11 -0
  81. package/dist/libs/set/set100vh.test.d.ts +1 -0
  82. package/dist/libs/set/set100vw.d.ts +6 -0
  83. package/dist/libs/set/set100vw.test.d.ts +1 -0
  84. package/dist/libs/set/setAttribute.d.ts +8 -0
  85. package/dist/libs/set/setAttribute.test.d.ts +1 -0
  86. package/dist/libs/set/setScrollPositionToCenter.d.ts +8 -0
  87. package/dist/libs/set/setScrollPositionToCenter.test.d.ts +1 -0
  88. package/dist/libs/set/setSessionStorage.d.ts +7 -0
  89. package/dist/libs/set/setSessionStorage.test.d.ts +1 -0
  90. package/dist/libs/set/setStylePropertyValue.d.ts +7 -0
  91. package/dist/libs/set/setStylePropertyValue.test.d.ts +1 -0
  92. package/dist/libs/to/index.d.ts +5 -0
  93. package/dist/libs/to/toBoolean.d.ts +7 -0
  94. package/dist/libs/to/toBoolean.test.d.ts +1 -0
  95. package/dist/libs/to/toPositiveNumber.d.ts +7 -0
  96. package/dist/libs/to/toPositiveNumber.test.d.ts +1 -0
  97. package/dist/libs/transform/index.d.ts +4 -0
  98. package/dist/libs/transform/wrapTextWithSpans.d.ts +10 -0
  99. package/dist/libs/transform/wrapTextWithSpans.test.d.ts +1 -0
  100. package/dist/libs/wait/index.d.ts +5 -0
  101. package/dist/libs/wait/sleep.d.ts +7 -0
  102. package/dist/libs/wait/sleep.test.d.ts +1 -0
  103. package/dist/libs/wait/waitForAllMediaLoaded.d.ts +7 -0
  104. package/dist/libs/wait/waitForAllMediaLoaded.test.d.ts +1 -0
  105. package/dist/vite.svg +1 -0
  106. package/package.json +60 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 TsubasaHiga
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,592 @@
1
+ # umaki
2
+
3
+ Web制作で多用するユーティリティーをこれ1つでインポート出来るようにしたパッケージです。
4
+ 基本的には私がよく使っているものを中心に追加していきます。
5
+ パッケージの中身や種類のリクエストがあれば、Issueを立ててください。
6
+
7
+ ## 使い方
8
+
9
+ ``` ts
10
+ import { foo } from 'umaki'
11
+ ```
12
+
13
+ ## ユーティリティー一覧
14
+
15
+ - [Control](#control)
16
+ - [bgScrollStop](#bgscrollstop)
17
+ - [pd](#pd)
18
+ - [scrollToHash](#scrolltohash)
19
+ - [videoPlayControl](#videoplaycontrol)
20
+ - [Convert](#convert)
21
+ - [changeDateStringToSpecificFormat](#changedatestringtospecificformat)
22
+ - [jsonStringToJsonObject](#jsonstringtojsonobject)
23
+ - [Get](#get)
24
+ - [getAspectRatio](#getaspectratio)
25
+ - [getClassNames](#getclassnames)
26
+ - [getDocumentHeight](#getdocumentheight)
27
+ - [getEventPaths](#geteventpaths)
28
+ - [getGcd](#getgcd)
29
+ - [getOrientation](#getorientation)
30
+ - [getParentList](#getparentlist)
31
+ - [getQueryParams](#getqueryparams)
32
+ - [getRem](#getrem)
33
+ - [getScrollbarWidth](#getscrollbarwidth)
34
+ - [getSessionStorage](#getsessionstorage)
35
+ - [getStringLength](#getstringlength)
36
+ - [getStylePropertyValue](#getstylepropertyvalue)
37
+ - [getStylePropertyValueToNumber](#getstylepropertyvaluetonumber)
38
+ - [getUaData](#getuadata)
39
+ - [Is](#is)
40
+ - [isBetweenDateTime](#isbetweendatetime)
41
+ - [isExistAllElements](#isexistallelements)
42
+ - [isIpad](#isipad)
43
+ - [isKeyExists](#iskeyexists)
44
+ - [isSafari](#issafari)
45
+ - [isScrollable](#isscrollable)
46
+ - [isTouchSupport](#istouchsupport)
47
+ - [Remove](#remove)
48
+ - [removeAllHtmlTags](#removeallhtmltags)
49
+ - [removeAttribute](#removeattribute)
50
+ - [removeSessionStorage](#removesessionstorage)
51
+ - [removeStylePropertyValue](#removestylepropertyvalue)
52
+ - [Set](#set)
53
+ - [set100vh](#set100vh)
54
+ - [set100vw](#set100vw)
55
+ - [setAttribute](#setattribute)
56
+ - [setScrollPositionToCenter](#setscrollpositiontocenter)
57
+ - [setSessionStorage](#setsessionstorage)
58
+ - [setStylePropertyValue](#setstylepropertyvalue)
59
+ - [To](#to)
60
+ - [toBoolean](#toboolean)
61
+ - [toPositiveNumber](#topositivenumber)
62
+ - [Transform](#transform)
63
+ - [wrapTextWithSpans](#wraptextwithspans)
64
+ - [Wait](#wait)
65
+ - [sleep](#sleep)
66
+ - [waitForAllMediaLoaded](#waitforallmedialoaded)
67
+
68
+ ## Control
69
+
70
+ ### bgScrollStop
71
+
72
+ スクロールを止める関数です。
73
+
74
+ ``` ts
75
+ import { bgScrollStop } from 'umaki'
76
+
77
+ bgScrollStop()
78
+ ```
79
+
80
+ ### pd
81
+
82
+ デフォルトのイベント動作を防ぐ関数です。
83
+
84
+ ``` ts
85
+ import { pd } from 'umaki'
86
+
87
+ document.getElementById('myElement').addEventListener('click', pd)
88
+ ```
89
+
90
+ ### scrollToHash
91
+
92
+ 特定のハッシュ位置にスクロールする関数です。
93
+
94
+ ``` ts
95
+ import { scrollToHash } from 'umaki'
96
+
97
+ ;(async(() => {
98
+ await scrollToHash('#target')
99
+ console.log('スクロール完了')
100
+ }))()
101
+ ```
102
+
103
+ ### videoPlayControl
104
+
105
+ ビデオ要素の再生を制御する関数です。
106
+
107
+ ``` ts
108
+ import { videoPlayControl } from 'umaki'
109
+
110
+ const videoElement = document.getElementById('myVideo')
111
+ videoPlayControl(videoElement, true) // 再生
112
+ videoPlayControl(videoElement, false) // 一時停止
113
+ ```
114
+
115
+ ## Convert
116
+
117
+ ### changeDateStringToSpecificFormat
118
+
119
+ 日付文字列を特定のフォーマットに変換する関数です。
120
+
121
+ ```ts
122
+ import { changeDateStringToSpecificFormat } from 'umaki'
123
+
124
+ const date = '2023-10-05'
125
+ const formattedDate = changeDateStringToSpecificFormat(date, 'MM/DD/YYYY')
126
+ console.log(formattedDate) // '10/05/2023'
127
+ ```
128
+
129
+ ### jsonStringToJsonObject
130
+
131
+ JSON文字列をJSONオブジェクトに変換する関数です。
132
+
133
+ ```ts
134
+ import { jsonStringToJsonObject } from 'umaki'
135
+
136
+ const jsonString = '{"name": "John", "age": 30}'
137
+ const jsonObject = jsonStringToJsonObject(jsonString)
138
+ console.log(jsonObject) // { name: 'John', age: 30 }
139
+ ```
140
+
141
+ ## Get
142
+
143
+ ### getAspectRatio
144
+
145
+ 指定された幅と高さのアスペクト比を返す関数です。
146
+
147
+ ```ts
148
+ import { getAspectRatio } from 'umaki'
149
+
150
+ const aspectRatio = getAspectRatio(1920, 1080)
151
+ console.log(aspectRatio) // { w: 16, h: 9 }
152
+ ```
153
+
154
+ ### getClassNames
155
+
156
+ 指定されたHTML要素のクラス名を配列として取得する関数です。
157
+
158
+ ```ts
159
+ import { getClassNames } from 'umaki'
160
+
161
+ const element = document.createElement('div')
162
+ element.className = 'class1 class2 class3'
163
+ const classNames = getClassNames(element)
164
+ console.log(classNames) // ['class1', 'class2', 'class3']
165
+ ```
166
+
167
+ ### getDocumentHeight
168
+
169
+ ドキュメントの高さを取得する関数です。
170
+
171
+ ```ts
172
+ import { getDocumentHeight } from 'umaki'
173
+
174
+ const height = getDocumentHeight()
175
+ console.log(height) // ドキュメントの高さを表示
176
+ ```
177
+
178
+ ### getEventPaths
179
+
180
+ イベントのパスを取得する関数です。
181
+
182
+ ```ts
183
+ import { getEventPaths } from 'umaki'
184
+
185
+ document.addEventListener('click', (event) => {
186
+ const paths = getEventPaths(event)
187
+ console.log(paths) // イベントパスを表示
188
+ })
189
+ ```
190
+
191
+ ### getGcd
192
+
193
+ 2つの数値の最大公約数を計算する関数です。
194
+
195
+ ```ts
196
+ import { getGcd } from 'umaki'
197
+
198
+ const gcd = getGcd(48, 18)
199
+ console.log(gcd) // 6
200
+ ```
201
+
202
+ ### getOrientation
203
+
204
+ デバイスの現在の向きを取得する関数です。
205
+
206
+ ```ts
207
+ import { getOrientation } from 'umaki'
208
+
209
+ const orientation = getOrientation()
210
+ console.log(orientation) // 'landscape' または 'portrait'
211
+ ```
212
+
213
+ ### getParentList
214
+
215
+ 指定されたHTML要素の親要素を再帰的に取得する関数です。
216
+
217
+ ```ts
218
+ import { getParentList } from 'umaki'
219
+
220
+ const element = document.createElement('div')
221
+ const parentList = getParentList(element)
222
+ console.log(parentList) // 親要素のリストを表示
223
+ ```
224
+
225
+ ### getQueryParams
226
+
227
+ URLのクエリパラメータを取得する関数です。
228
+
229
+ ```ts
230
+ import { getQueryParams } from 'umaki'
231
+
232
+ const params = getQueryParams('test')
233
+ console.log(params) // クエリパラメータの値を表示
234
+ ```
235
+
236
+ ### getRem
237
+
238
+ ピクセル値をrem単位に変換する関数です。
239
+
240
+ ```ts
241
+ import { getRem } from 'umaki'
242
+
243
+ const remValue = getRem(16)
244
+ console.log(remValue) // '1rem'
245
+ ```
246
+
247
+ ### getScrollbarWidth
248
+
249
+ スクロールバーの幅を取得する関数です。
250
+
251
+ ```ts
252
+ import { getScrollbarWidth } from 'umaki'
253
+
254
+ const scrollbarWidth = getScrollbarWidth()
255
+ console.log(scrollbarWidth) // スクロールバーの幅を表示
256
+ ```
257
+
258
+ ### getSessionStorage
259
+
260
+ セッションストレージから値を取得する関数です。
261
+
262
+ ```ts
263
+ import { getSessionStorage } from 'umaki'
264
+
265
+ const value = getSessionStorage('testKey')
266
+ console.log(value) // セッションストレージの値を表示
267
+ ```
268
+
269
+ ### getStringLength
270
+
271
+ 文字列の長さを取得する関数です(Unicode文字を考慮)。
272
+
273
+ ```ts
274
+ import { getStringLength } from 'umaki'
275
+
276
+ const length = getStringLength('こんにちは')
277
+ console.log(length) // 5
278
+ ```
279
+
280
+ ### getStylePropertyValue
281
+
282
+ 指定されたCSSカスタムプロパティの値を取得する関数です。
283
+
284
+ ```ts
285
+ import { getStylePropertyValue } from 'umaki'
286
+
287
+ const value = getStylePropertyValue('--custom-property')
288
+ console.log(value) // カスタムプロパティの値を表示
289
+ ```
290
+
291
+ ### getStylePropertyValueToNumber
292
+
293
+ 指定されたCSSカスタムプロパティの値を数値として取得する関数です。
294
+
295
+ ```ts
296
+ import { getStylePropertyValueToNumber } from 'umaki'
297
+
298
+ const value = getStylePropertyValueToNumber('--custom-property')
299
+ console.log(value) // カスタムプロパティの数値を表示
300
+ ```
301
+
302
+ ### getUaData
303
+
304
+ ユーザーエージェント情報を取得する関数です。
305
+
306
+ ```ts
307
+ import { getUaData } from 'umaki'
308
+
309
+ const uaData = getUaData()
310
+ console.log(uaData) // ユーザーエージェント情報を表示
311
+ ```
312
+
313
+ ## Is
314
+
315
+ ### isBetweenDateTime
316
+
317
+ 現在の日付が指定された2つの日付の間にあるかどうかをチェックする関数です。
318
+
319
+ ```ts
320
+ import { isBetweenDateTime } from 'umaki'
321
+
322
+ const dateA = '2023-10-01'
323
+ const dateB = '2023-10-10'
324
+ const result = isBetweenDateTime(dateA, dateB)
325
+ console.log(result) // true または false
326
+ ```
327
+
328
+ ### isExistAllElements
329
+
330
+ すべての要素が存在するかどうかをチェックする関数です。
331
+
332
+ ```ts
333
+ import { isExistAllElements } from 'umaki'
334
+
335
+ const elements = [document.createElement('div'), document.createElement('span')]
336
+ const result = isExistAllElements(elements)
337
+ console.log(result) // true または false
338
+ ```
339
+
340
+ ### isIpad
341
+
342
+ デバイスがiPadかどうかをチェックする関数です。
343
+
344
+ ```ts
345
+ import { isIpad } from 'umaki'
346
+
347
+ const result = isIpad()
348
+ console.log(result) // true または false
349
+ ```
350
+
351
+ ### isKeyExists
352
+
353
+ オブジェクトに特定のキーが存在するかどうかをチェックする関数です。
354
+
355
+ ```ts
356
+ import { isKeyExists } from 'umaki'
357
+
358
+ const obj = { a: 1, b: 2 }
359
+ const result = isKeyExists(obj, 'a')
360
+ console.log(result) // true または false
361
+ ```
362
+
363
+ ### isSafari
364
+
365
+ ブラウザがSafariかどうかをチェックする関数です。
366
+
367
+ ```ts
368
+ import { isSafari } from 'umaki'
369
+
370
+ const result = isSafari()
371
+ console.log(result) // true または false
372
+ ```
373
+
374
+ ### isScrollable
375
+
376
+ 要素がスクロール可能かどうかをチェックする関数です。
377
+
378
+ ```ts
379
+ import { isScrollable } from 'umaki'
380
+
381
+ const element = document.createElement('div')
382
+ element.style.overflow = 'auto'
383
+ element.innerHTML = '<div style="height: 200px;"></div>'
384
+ const result = isScrollable(element)
385
+ console.log(result) // true または false
386
+ ```
387
+
388
+ ### isTouchSupport
389
+
390
+ デバイスがタッチサポートを持っているかどうかをチェックする関数です。
391
+
392
+ ```ts
393
+ import { isTouchSupport } from 'umaki'
394
+
395
+ const result = isTouchSupport()
396
+ console.log(result) // true または false
397
+ ```
398
+
399
+ ## Remove
400
+
401
+ ### removeAllHtmlTags
402
+
403
+ 文字列からすべてのHTMLタグを削除する関数です。
404
+
405
+ ```ts
406
+ import { removeAllHtmlTags } from 'umaki'
407
+
408
+ const input = '<p>Hello <strong>World</strong>!</p>'
409
+ const output = removeAllHtmlTags(input)
410
+ console.log(output) // 'Hello World!'
411
+ ```
412
+
413
+ ### removeAttribute
414
+
415
+ 指定されたHTML要素から属性を削除する関数です。
416
+
417
+ ```ts
418
+ import { removeAttribute } from 'umaki'
419
+
420
+ const element = document.createElement('div')
421
+ element.setAttribute('data-test', 'value')
422
+ removeAttribute(element, 'data-test')
423
+ console.log(element.hasAttribute('data-test')) // false
424
+ ```
425
+
426
+ ### removeSessionStorage
427
+
428
+ セッションストレージから指定されたキーのアイテムを削除する関数です。
429
+
430
+ ```ts
431
+ import { removeSessionStorage } from 'umaki'
432
+
433
+ const key = 'testKey'
434
+ removeSessionStorage(key)
435
+ console.log(sessionStorage.getItem(key)) // null
436
+ ```
437
+
438
+ ### removeStylePropertyValue
439
+
440
+ 指定されたCSSカスタムプロパティを削除する関数です。
441
+
442
+ ```ts
443
+ import { removeStylePropertyValue } from 'umaki'
444
+
445
+ const key = '--custom-property'
446
+ removeStylePropertyValue(key)
447
+ console.log(getComputedStyle(document.documentElement).getPropertyValue(key)) // ''
448
+ ```
449
+
450
+ ## Set
451
+
452
+ ### set100vh
453
+
454
+ モバイルデバイスでのビューポート単位の問題を解決するために、CSS変数を100vhに設定する関数です。
455
+
456
+ ```ts
457
+ import { set100vh } from 'umaki'
458
+
459
+ set100vh()
460
+ ```
461
+
462
+ ### set100vw
463
+
464
+ スクロールバーの幅を除いた100vwの値をCSS変数に設定する関数です。
465
+
466
+ ```ts
467
+ import { set100vw } from 'umaki'
468
+
469
+ set100vw()
470
+ ```
471
+
472
+ ### setAttribute
473
+
474
+ 指定されたHTML要素に属性を設定する関数です。
475
+
476
+ ```ts
477
+ import { setAttribute } from 'umaki'
478
+
479
+ const element = document.createElement('div')
480
+ setAttribute(element, 'data-test', 'value')
481
+ console.log(element.getAttribute('data-test')) // 'value'
482
+ ```
483
+
484
+ ### setScrollPositionToCenter
485
+
486
+ ルート要素の水平スクロール位置を調整して、ターゲット要素を中央に配置する関数です。
487
+
488
+ ```ts
489
+ import { setScrollPositionToCenter } from 'umaki'
490
+
491
+ const rootElement = document.getElementById('root')
492
+ const targetElement = document.getElementById('target')
493
+ setScrollPositionToCenter(rootElement, targetElement)
494
+ ```
495
+
496
+ ### setSessionStorage
497
+
498
+ セッションストレージに値を設定する関数です。
499
+
500
+ ```ts
501
+ import { setSessionStorage } from 'umaki'
502
+
503
+ const key = 'testKey'
504
+ const value = 'testValue'
505
+ setSessionStorage(key, value)
506
+ console.log(sessionStorage.getItem(key)) // 'testValue'
507
+ ```
508
+
509
+ ### setStylePropertyValue
510
+
511
+ ルート要素にCSSカスタムプロパティを設定する関数です。
512
+
513
+ ```ts
514
+ import { setStylePropertyValue } from 'umaki'
515
+
516
+ const key = '--custom-color'
517
+ const value = 'blue'
518
+ setStylePropertyValue(key, value)
519
+ console.log(getComputedStyle(document.documentElement).getPropertyValue(key)) // 'blue'
520
+ ```
521
+
522
+ ## To
523
+
524
+ ### toBoolean
525
+
526
+ 文字列をブール値に変換する関数です。
527
+
528
+ ```ts
529
+ import { toBoolean } from 'umaki'
530
+
531
+ console.log(toBoolean('true')) // true
532
+ console.log(toBoolean('false')) // false
533
+ console.log(toBoolean('random')) // false
534
+ ```
535
+
536
+ ### toPositiveNumber
537
+
538
+ 数値を正の数に変換する関数です。負の数の場合は絶対値を返します。
539
+
540
+ ```ts
541
+ import { toPositiveNumber } from 'umaki'
542
+
543
+ console.log(toPositiveNumber(5)) // 5
544
+ console.log(toPositiveNumber(-5)) // 5
545
+ console.log(toPositiveNumber(0)) // 0
546
+ console.log(toPositiveNumber(-3.14)) // 3.14
547
+ console.log(toPositiveNumber(3.14)) // 3.14
548
+ ```
549
+
550
+ ## Transform
551
+
552
+ ### wrapTextWithSpans
553
+
554
+ HTML要素のテキストコンテンツの各文字を個別の<span>要素でラップする関数です。
555
+
556
+ ```ts
557
+ import { wrapTextWithSpans } from 'umaki'
558
+
559
+ const element = document.createElement('div')
560
+ element.textContent = 'hello'
561
+ wrapTextWithSpans(element)
562
+ console.log(element.innerHTML) // '<span>h</span><span>e</span><span>l</span><span>l</span><span>o</span>'
563
+ ```
564
+
565
+ ## Wait
566
+
567
+ ### sleep
568
+
569
+ 指定した時間だけ処理を一時停止する関数です。
570
+
571
+ ```ts
572
+ import { sleep } from 'umaki'
573
+
574
+ ;(async () => {
575
+ console.log('Start')
576
+ await sleep(1) // 1秒間待機
577
+ console.log('End')
578
+ })()
579
+ ```
580
+
581
+ ### waitForAllMediaLoaded
582
+
583
+ ドキュメント内のすべての画像とビデオが完全に読み込まれるのを待つ関数です。
584
+
585
+ ```ts
586
+ import { waitForAllMediaLoaded } from 'umaki'
587
+
588
+ ;(async () => {
589
+ const allMediaLoaded = await waitForAllMediaLoaded()
590
+ console.log(allMediaLoaded) // true または false
591
+ })()
592
+ ```
@@ -0,0 +1,8 @@
1
+ export * from './libs/control';
2
+ export * from './libs/convert';
3
+ export * from './libs/get';
4
+ export * from './libs/is';
5
+ export * from './libs/remove';
6
+ export * from './libs/set';
7
+ export * from './libs/transform';
8
+ export * from './libs/wait';