nadesiko3 3.2.27

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 (283) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +107 -0
  3. package/bin/cnako3 +10 -0
  4. package/bin/cnako3.bat +11 -0
  5. package/bin/nako3server.bat +6 -0
  6. package/demo/ace_editor.html +90 -0
  7. package/demo/ace_editor_tabs.html +162 -0
  8. package/demo/basic.html +71 -0
  9. package/demo/browsers.html +128 -0
  10. package/demo/css/basic.css +3 -0
  11. package/demo/css/common.css +157 -0
  12. package/demo/css/editor.css +8 -0
  13. package/demo/css/flow.css +3 -0
  14. package/demo/css/index.css +3 -0
  15. package/demo/extlib/ace@1.4.12/ace.js +17 -0
  16. package/demo/extlib/ace@1.4.12/ext-code_lens.min.js +1 -0
  17. package/demo/extlib/ace@1.4.12/ext-language_tools.min.js +1 -0
  18. package/demo/extlib/ace@1.4.12/ext-options.min.js +1 -0
  19. package/demo/extlib/ace@1.4.12/ext-settings_menu.js +8 -0
  20. package/demo/extlib/ace@1.4.12/keybinding-vscode.js +8 -0
  21. package/demo/extlib/ace@1.4.12/theme-monokai.js +8 -0
  22. package/demo/extlib/ace@1.4.12/theme-xcode.js +8 -0
  23. package/demo/extlib/chart.js@3.2.1/chart.min.js +13 -0
  24. package/demo/extlib/pure-min.css +11 -0
  25. package/demo/flow.html +97 -0
  26. package/demo/graph.html +53 -0
  27. package/demo/image/nako.png +0 -0
  28. package/demo/image/nakopad-icon256.png +0 -0
  29. package/demo/image/turtle.fla +0 -0
  30. package/demo/image/turtle.png +0 -0
  31. package/demo/index.html +134 -0
  32. package/demo/js/common.js +17 -0
  33. package/demo/js/turtle3d_test.js +44 -0
  34. package/demo/js/turtle_test.js +44 -0
  35. package/demo/runscript.html +47 -0
  36. package/demo/runscript2.html +33 -0
  37. package/demo/turtle.html +58 -0
  38. package/demo/turtle2.html +141 -0
  39. package/demo/turtle3.html +278 -0
  40. package/demo/turtle3d.html +58 -0
  41. package/demo/turtle3d2.html +107 -0
  42. package/demo/version.html +24 -0
  43. package/doc/SETUP.md +172 -0
  44. package/doc/about.md +34 -0
  45. package/doc/browsers.md +60 -0
  46. package/doc/docgen.md +21 -0
  47. package/doc/editor.md +44 -0
  48. package/doc/files.md +37 -0
  49. package/doc/plugins.md +195 -0
  50. package/doc/release.md +78 -0
  51. package/doc/win32.md +57 -0
  52. package/package.json +196 -0
  53. package/release/_hash.txt +65 -0
  54. package/release/_script-tags.txt +13 -0
  55. package/release/command.json +1 -0
  56. package/release/command.json.js +1 -0
  57. package/release/command_cnako3.json +1 -0
  58. package/release/command_list.json +1 -0
  59. package/release/editor.js +2 -0
  60. package/release/editor.js.LICENSE.txt +32 -0
  61. package/release/josi.json +48 -0
  62. package/release/nako_gen_async.js +1 -0
  63. package/release/nako_gen_async.js.LICENSE.txt +595 -0
  64. package/release/plugin_caniuse.js +1 -0
  65. package/release/plugin_caniuse.js.LICENSE.txt +411 -0
  66. package/release/plugin_csv.js +1 -0
  67. package/release/plugin_csv.js.LICENSE.txt +367 -0
  68. package/release/plugin_datetime.js +1 -0
  69. package/release/plugin_datetime.js.LICENSE.txt +471 -0
  70. package/release/plugin_kansuji.js +1 -0
  71. package/release/plugin_kansuji.js.LICENSE.txt +491 -0
  72. package/release/plugin_markup.js +1 -0
  73. package/release/plugin_markup.js.LICENSE.txt +363 -0
  74. package/release/plugin_turtle.js +1 -0
  75. package/release/plugin_turtle.js.LICENSE.txt +435 -0
  76. package/release/plugin_webworker.js +1 -0
  77. package/release/plugin_webworker.js.LICENSE.txt +491 -0
  78. package/release/version.js +2 -0
  79. package/release/version.js.LICENSE.txt +32 -0
  80. package/release/wnako3.js +2 -0
  81. package/release/wnako3.js.LICENSE.txt +1 -0
  82. package/release/wnako3webworker.js +1 -0
  83. package/release/wnako3webworker.js.LICENSE.txt +847 -0
  84. package/release/yoyakugo.json +30 -0
  85. package/src/browsers.md +60 -0
  86. package/src/cnako3.js +466 -0
  87. package/src/commander_ja.js +154 -0
  88. package/src/enako3.js +69 -0
  89. package/src/era.json +22 -0
  90. package/src/index.js +5 -0
  91. package/src/nako3.js +836 -0
  92. package/src/nako3_assert.js +37 -0
  93. package/src/nako3editorfix.sfd +106 -0
  94. package/src/nako3editorfix.woff +0 -0
  95. package/src/nako3server.js +51 -0
  96. package/src/nako_colors.js +86 -0
  97. package/src/nako_errors.js +176 -0
  98. package/src/nako_gen.js +1459 -0
  99. package/src/nako_gen_async.js +1622 -0
  100. package/src/nako_global.js +113 -0
  101. package/src/nako_indent.js +480 -0
  102. package/src/nako_josi_list.js +46 -0
  103. package/src/nako_lex_rules.js +259 -0
  104. package/src/nako_lexer.js +576 -0
  105. package/src/nako_logger.js +138 -0
  106. package/src/nako_parser3.js +1768 -0
  107. package/src/nako_parser_base.js +265 -0
  108. package/src/nako_parser_const.js +37 -0
  109. package/src/nako_prepare.js +293 -0
  110. package/src/nako_reserved_words.js +35 -0
  111. package/src/nako_source_mapping.js +251 -0
  112. package/src/nako_test.js +37 -0
  113. package/src/nako_version.js +8 -0
  114. package/src/plugin_browser.js +191 -0
  115. package/src/plugin_browser_ajax.js +352 -0
  116. package/src/plugin_browser_audio.js +109 -0
  117. package/src/plugin_browser_canvas.js +462 -0
  118. package/src/plugin_browser_chart.js +296 -0
  119. package/src/plugin_browser_color.js +49 -0
  120. package/src/plugin_browser_crypto.js +26 -0
  121. package/src/plugin_browser_dialog.js +53 -0
  122. package/src/plugin_browser_dom_basic.js +322 -0
  123. package/src/plugin_browser_dom_event.js +193 -0
  124. package/src/plugin_browser_dom_parts.js +163 -0
  125. package/src/plugin_browser_geolocation.js +51 -0
  126. package/src/plugin_browser_hotkey.js +25 -0
  127. package/src/plugin_browser_html.js +59 -0
  128. package/src/plugin_browser_in_worker.js +44 -0
  129. package/src/plugin_browser_location.js +21 -0
  130. package/src/plugin_browser_speech.js +111 -0
  131. package/src/plugin_browser_storage.js +121 -0
  132. package/src/plugin_browser_system.js +12 -0
  133. package/src/plugin_browser_websocket.js +73 -0
  134. package/src/plugin_caniuse.js +24 -0
  135. package/src/plugin_csv.js +57 -0
  136. package/src/plugin_datetime.js +414 -0
  137. package/src/plugin_express.js +212 -0
  138. package/src/plugin_kansuji.js +224 -0
  139. package/src/plugin_keigo.js +55 -0
  140. package/src/plugin_markup.js +32 -0
  141. package/src/plugin_math.js +319 -0
  142. package/src/plugin_node.js +1018 -0
  143. package/src/plugin_promise.js +94 -0
  144. package/src/plugin_system.js +2109 -0
  145. package/src/plugin_test.js +38 -0
  146. package/src/plugin_turtle.js +646 -0
  147. package/src/plugin_webworker.js +334 -0
  148. package/src/plugin_weykturtle3d.js +1216 -0
  149. package/src/plugin_worker.js +92 -0
  150. package/src/repl.nako3 +63 -0
  151. package/src/turtle-elephant.png +0 -0
  152. package/src/turtle-panda.png +0 -0
  153. package/src/turtle64.png +0 -0
  154. package/src/wnako3.js +162 -0
  155. package/src/wnako3_editor.css +215 -0
  156. package/src/wnako3_editor.js +1645 -0
  157. package/src/wnako3_editor_marker_red.png +0 -0
  158. package/src/wnako3_editor_marker_red.xcf +0 -0
  159. package/src/wnako3_editor_marker_yellow.png +0 -0
  160. package/src/wnako3_editor_marker_yellow.xcf +0 -0
  161. package/src/wnako3webworker.js +70 -0
  162. package/test/ace_editor/karma.config.js +94 -0
  163. package/test/ace_editor/test/.babelrc.json +3 -0
  164. package/test/ace_editor/test/ace_editor_test.js +178 -0
  165. package/test/ace_editor/test/html/custom_context.html +140 -0
  166. package/test/async/async_basic_test.js +124 -0
  167. package/test/browser/karma.config.js +212 -0
  168. package/test/browser/test/.babelrc.json +3 -0
  169. package/test/browser/test/compare_util.js +50 -0
  170. package/test/browser/test/html/canvas_basic.html +1 -0
  171. package/test/browser/test/html/div_basic.html +2 -0
  172. package/test/browser/test/html/event_dom_form.html +4 -0
  173. package/test/browser/test/html/event_dom_scrolldiv.html +5 -0
  174. package/test/browser/test/image/canvas_test1.png +0 -0
  175. package/test/browser/test/image/canvas_test2.png +0 -0
  176. package/test/browser/test/image/canvas_test3.png +0 -0
  177. package/test/browser/test/image/canvas_test4.png +0 -0
  178. package/test/browser/test/image/canvas_test7.png +0 -0
  179. package/test/browser/test/image/canvas_test8.png +0 -0
  180. package/test/browser/test/image/canvas_test_blank.png +0 -0
  181. package/test/browser/test/image/elephant_kana.png +0 -0
  182. package/test/browser/test/image/panda_kana.png +0 -0
  183. package/test/browser/test/image/turtle_kana.png +0 -0
  184. package/test/browser/test/import_plugin_checker.js +24 -0
  185. package/test/browser/test/plugin_browser_test.js +52 -0
  186. package/test/browser/test/plugin_browser_test_ajax.js +123 -0
  187. package/test/browser/test/plugin_browser_test_color.js +18 -0
  188. package/test/browser/test/plugin_browser_test_dialog.js +72 -0
  189. package/test/browser/test/plugin_browser_test_dom_event.js +598 -0
  190. package/test/browser/test/plugin_browser_test_dom_parts.js +125 -0
  191. package/test/browser/test/plugin_browser_test_system.js +9 -0
  192. package/test/browser/test/plugin_turtle_test.js +817 -0
  193. package/test/browser/test/plugin_webworker_test.js +87 -0
  194. package/test/browser/test/require_test.js +71 -0
  195. package/test/bundled/karma.config.base.js +117 -0
  196. package/test/bundled/karma.config.js +86 -0
  197. package/test/bundled/test/.babelrc.json +3 -0
  198. package/test/bundled/test/bundled_test.js +69 -0
  199. package/test/bundled/test/html/custom_context.html +65 -0
  200. package/test/bundled/test/html/custom_debug.html +66 -0
  201. package/test/bundled/test4b.cmd +52 -0
  202. package/test/bundled/test_base/.babelrc.json +3 -0
  203. package/test/bundled/test_base/_checktool_test.js +25 -0
  204. package/test/bundled/test_base/basic_ajax_test.js +56 -0
  205. package/test/bundled/test_base/basic_async_test.js +18 -0
  206. package/test/bundled/test_base/basic_test.js +153 -0
  207. package/test/bundled/test_base/calc_test.js +132 -0
  208. package/test/bundled/test_base/css/browsers_box.css +114 -0
  209. package/test/bundled/test_base/html/custom_context.html +69 -0
  210. package/test/bundled/test_base/html/custom_debug.html +71 -0
  211. package/test/bundled/test_base/js/browsers_box.js +72 -0
  212. package/test/bundled/test_base/plugin_csv_test.js +37 -0
  213. package/test/bundled/test_base/plugin_datetime_test.js +115 -0
  214. package/test/bundled/test_base/plugin_kansuji_test.js +49 -0
  215. package/test/bundled/test_base/plugin_system_test.js +410 -0
  216. package/test/bundled/test_base/plugin_webworker_test.js +53 -0
  217. package/test/bundled/test_base/resources/ok.txt +1 -0
  218. package/test/bundled/test_base/test_utils.js +191 -0
  219. package/test/common/array_test.js +40 -0
  220. package/test/common/basic_test.js +317 -0
  221. package/test/common/calc_test.js +139 -0
  222. package/test/common/debug_test.js +16 -0
  223. package/test/common/error_test.js +16 -0
  224. package/test/common/flow_test.js +360 -0
  225. package/test/common/func_call.js +136 -0
  226. package/test/common/func_test.js +149 -0
  227. package/test/common/indent_test.js +362 -0
  228. package/test/common/lex_test.js +146 -0
  229. package/test/common/literal_test.js +72 -0
  230. package/test/common/nako_logger_test.js +26 -0
  231. package/test/common/plugin_browser_test.js +24 -0
  232. package/test/common/plugin_browser_ut_audio_test.js +88 -0
  233. package/test/common/plugin_browser_ut_color_test.js +21 -0
  234. package/test/common/plugin_browser_ut_dialog_test.js +100 -0
  235. package/test/common/plugin_browser_ut_html_test.js +13 -0
  236. package/test/common/plugin_browser_ut_system_test.js +10 -0
  237. package/test/common/plugin_csv_test.js +39 -0
  238. package/test/common/plugin_datetime_test.js +120 -0
  239. package/test/common/plugin_kansuji_test.js +59 -0
  240. package/test/common/plugin_promise_test.js +18 -0
  241. package/test/common/plugin_system_test.js +451 -0
  242. package/test/common/prepare_test.js +93 -0
  243. package/test/common/re_test.js +20 -0
  244. package/test/common/variable_scope_test.js +105 -0
  245. package/test/jsconfig.json +19 -0
  246. package/test/karma.config.js +91 -0
  247. package/test/node/add_test.nako3 +1 -0
  248. package/test/node/async_test.js +80 -0
  249. package/test/node/commander_ja_test.js +82 -0
  250. package/test/node/error_message_test.js +244 -0
  251. package/test/node/kai_test.nako3 +6 -0
  252. package/test/node/node_test.js +43 -0
  253. package/test/node/plugin_broken.js.txt +3 -0
  254. package/test/node/plugin_browser_ut_ajax_test.js +355 -0
  255. package/test/node/plugin_browser_ut_location_test.js +32 -0
  256. package/test/node/plugin_markup_test.js +44 -0
  257. package/test/node/plugin_math_test.js +42 -0
  258. package/test/node/plugin_node_test.js +93 -0
  259. package/test/node/plugin_test.js +16 -0
  260. package/test/node/relative_import_test_1.nako3 +1 -0
  261. package/test/node/relative_import_test_2.nako3 +2 -0
  262. package/test/node/require_nako3_test.js +59 -0
  263. package/test/node/requiretest.nako3 +4 -0
  264. package/test/node/requiretest_indirect.nako3 +1 -0
  265. package/test/node/requiretest_name.nako3 +5 -0
  266. package/test/node/runtime_error.nako3 +2 -0
  267. package/test/node/side_effects_test.js +106 -0
  268. package/test/node/sjis.txt +5 -0
  269. package/test/node/syntax_error.nako3 +2 -0
  270. package/test/node/wnako3_editor_test.js +360 -0
  271. package/tools/README.md +7 -0
  272. package/tools/nako3edit/html/edit.html +83 -0
  273. package/tools/nako3edit/html/edit_plugin.js +6 -0
  274. package/tools/nako3edit/html/files.html +49 -0
  275. package/tools/nako3edit/html/nako3edit.css +66 -0
  276. package/tools/nako3edit/index.nako3 +145 -0
  277. package/tools/nako3edit/run.js +12 -0
  278. package/tools/nako3server/html/edit.html +104 -0
  279. package/tools/nako3server/html/edit_plugin.js +6 -0
  280. package/tools/nako3server/html/files.html +53 -0
  281. package/tools/nako3server/html/nako3edit.css +66 -0
  282. package/tools/nako3server/index.nako3 +129 -0
  283. package/tools/nako3server/run.js +12 -0
@@ -0,0 +1,352 @@
1
+ // @ts-nocheck
2
+ /* eslint-disable quote-props */
3
+ module.exports = {
4
+ // @AJAXとHTTP
5
+ 'AJAX送信時': { // @非同期通信(Ajax)でURLにデータを送信し、成功するとcallbackが実行される。その際『対象』にデータが代入される。『AJAXオプション』を指定できる。 // @AJAXそうしんしたとき
6
+ type: 'func',
7
+ josi: [['の'], ['まで', 'へ', 'に']],
8
+ pure: true,
9
+ fn: function (callback, url, sys) {
10
+ let options = sys.__v0['AJAXオプション']
11
+ if (options === '') { options = { method: 'GET' } }
12
+ fetch(url, options).then(res => {
13
+ return res.text()
14
+ }).then(text => {
15
+ sys.__v0['対象'] = text
16
+ callback(text)
17
+ }).catch(err => {
18
+ console.log('[fetch.error]', err)
19
+ sys.__v0['AJAX:ONERROR'](err)
20
+ })
21
+ },
22
+ return_none: true
23
+ },
24
+ 'AJAX受信': { // @「!非同期モード」で非同期通信(Ajax)でURLからデータを受信する。『AJAXオプション』を指定できる。結果は変数『対象』に入る// @AJAXじゅしん
25
+ type: 'func',
26
+ josi: [['から', 'を']],
27
+ pure: true,
28
+ fn: function (url, sys) {
29
+ if (sys.__genMode !== '非同期モード') {
30
+ throw new Error('『AJAX受信』を使うには、プログラムの冒頭で「!非同期モード」と宣言してください。')
31
+ }
32
+ sys.async = true
33
+ let options = sys.__v0['AJAXオプション']
34
+ if (options === '') { options = { method: 'GET' } }
35
+ // fetch 実行
36
+ fetch(url, options).then(res => {
37
+ if (res.ok) { // 成功したとき
38
+ return res.text()
39
+ } else { // 失敗したとき
40
+ throw new Error('status=' + res.status)
41
+ }
42
+ }).then(text => {
43
+ sys.__v0['対象'] = text
44
+ sys.nextAsync(sys)
45
+ }).catch(err => {
46
+ console.error('[AJAX受信のエラー]', err)
47
+ sys.__errorAsync(err, sys)
48
+ })
49
+ },
50
+ return_none: true
51
+ },
52
+ 'AJAX受信時': { // @非同期通信(Ajax)を利用してURLからデータを受信した時callbackが実行される。その際『対象』にデータが代入される。『AJAXオプション』を指定できる。 // @AJAXじゅしんしたとき
53
+ type: 'func',
54
+ josi: [['で'], ['から', 'を']],
55
+ pure: true,
56
+ fn: function (callback, url, sys) {
57
+ sys.__exec('AJAX送信時', [callback, url, sys])
58
+ },
59
+ return_none: true
60
+ },
61
+ 'GET送信時': { // @非同期通信(Ajax)でURLにデータを送信し、成功するとcallbackが実行される。その際『対象』にデータが代入される。 // @GETそうしんしたとき
62
+ type: 'func',
63
+ josi: [['の'], ['まで', 'へ', 'に']],
64
+ pure: false,
65
+ fn: function (callback, url, sys) {
66
+ sys.__exec('AJAX送信時', [callback, url, sys])
67
+ },
68
+ return_none: true
69
+ },
70
+ 'POSTデータ生成': { // @連想配列をkey=value&key=value...の形式に変換する // @POSTでーたせいせい
71
+ type: 'func',
72
+ josi: [['の', 'を']],
73
+ pure: true,
74
+ fn: function (params, sys) {
75
+ const flist = []
76
+ for (const key in params) {
77
+ const v = params[key]
78
+ const kv = encodeURIComponent(key) + '=' + encodeURIComponent(v)
79
+ flist.push(kv)
80
+ }
81
+ return flist.join('&')
82
+ }
83
+ },
84
+ 'POST送信時': { // @AjaxでURLにPARAMSをPOST送信し『対象』にデータを設定 // @POSTそうしんしたとき
85
+ type: 'func',
86
+ josi: [['の'], ['まで', 'へ', 'に'], ['を']],
87
+ pure: false,
88
+ fn: function (callback, url, params, sys) {
89
+ const bodyData = sys.__exec('POSTデータ生成', [params, sys])
90
+ const options = {
91
+ method: 'POST',
92
+ headers: {
93
+ 'Content-Type': 'application/x-www-form-urlencoded'
94
+ },
95
+ body: bodyData
96
+ }
97
+ fetch(url, options).then(res => {
98
+ return res.text()
99
+ }).then(text => {
100
+ sys.__v0['対象'] = text
101
+ callback(text)
102
+ }).catch(err => {
103
+ sys.__v0['AJAX:ONERROR'](err)
104
+ })
105
+ }
106
+ },
107
+ 'POSTフォーム送信時': { // @AjaxでURLにPARAMSをフォームとしてPOST送信し『対象』にデータを設定 // @POSTふぉーむそうしんしたとき
108
+ type: 'func',
109
+ josi: [['の'], ['まで', 'へ', 'に'], ['を']],
110
+ pure: true,
111
+ fn: function (callback, url, params, sys) {
112
+ const fd = new FormData()
113
+ for (const key in params) { fd.set(key, params[key]) }
114
+
115
+ const options = {
116
+ method: 'POST',
117
+ body: fd
118
+ }
119
+ fetch(url, options).then(res => {
120
+ return res.text()
121
+ }).then(text => {
122
+ sys.__v0['対象'] = text
123
+ callback(text)
124
+ }).catch(err => {
125
+ sys.__v0['AJAX:ONERROR'](err)
126
+ })
127
+ }
128
+ },
129
+ 'AJAX失敗時': { // @Ajax命令でエラーが起きたとき // @AJAXえらーしっぱいしたとき
130
+ type: 'func',
131
+ josi: [['の']],
132
+ pure: true,
133
+ fn: function (callback, sys) {
134
+ sys.__v0['AJAX:ONERROR'] = callback
135
+ }
136
+ },
137
+ 'AJAXオプション': { type: 'const', value: '' }, // @AJAXおぷしょん
138
+ 'AJAXオプション設定': { // @Ajax命令でオプションを設定 // @AJAXおぷしょんせってい
139
+ type: 'func',
140
+ josi: [['に', 'へ', 'と']],
141
+ pure: true,
142
+ fn: function (option, sys) {
143
+ sys.__v0['AJAXオプション'] = option
144
+ },
145
+ return_none: true
146
+ },
147
+ 'AJAX送信': { // @逐次実行構文にて、非同期通信(Ajax)でURLにデータを送信する。成功すると『対象』にデータが代入される。 // @AJAXそうしん
148
+ type: 'func',
149
+ josi: [['まで', 'へ', 'に']],
150
+ pure: true,
151
+ fn: function (url, sys) {
152
+ if (!sys.resolve) { throw new Error('『AJAX送信』は『逐次実行』構文内で利用する必要があります。') }
153
+ sys.__exec('AJAX逐次送信', [url, sys])
154
+ },
155
+ return_none: true
156
+ },
157
+ 'AJAX逐次送信': { // @逐次実行構文にて、非同期通信(Ajax)でURLにデータを送信する。成功すると『対象』にデータが代入される。 // @AJAXちくじそうしん
158
+ type: 'func',
159
+ josi: [['まで', 'へ', 'に']],
160
+ pure: true,
161
+ fn: function (url, sys) {
162
+ if (!sys.resolve) { throw new Error('『AJAX逐次送信』は『逐次実行』構文内で利用する必要があります。') }
163
+ sys.resolveCount++
164
+ const resolve = sys.resolve
165
+ const reject = sys.reject
166
+ let options = sys.__v0['AJAXオプション']
167
+ if (options === '') { options = { method: 'GET' } }
168
+ fetch(url, options).then(res => {
169
+ return res.text()
170
+ }).then(text => {
171
+ sys.__v0['対象'] = text
172
+ resolve()
173
+ }).catch(err => {
174
+ reject(err.message)
175
+ })
176
+ },
177
+ return_none: true
178
+ },
179
+ 'AJAX保障送信': { // @非同期通信(Ajax)でURLにデータの送信を開始する非同期処理オブジェクト(Promise)を作成する。 // @AJAXほしょうそうしん
180
+ type: 'func',
181
+ josi: [['まで', 'へ', 'に']],
182
+ pure: true,
183
+ fn: function (url, sys) {
184
+ let options = sys.__v0['AJAXオプション']
185
+ if (options === '') { options = { method: 'GET' } }
186
+ return fetch(url, options)
187
+ },
188
+ return_none: false
189
+ },
190
+ 'HTTP取得': { // @逐次実行構文にて、非同期通信(Ajax)でURLにデータを送信する。成功すると『対象』にデータが代入される。失敗すると『AJAX失敗時』を実行。 // @HTTPしゅとく
191
+ type: 'func',
192
+ josi: [['の', 'から', 'を']],
193
+ pure: false,
194
+ fn: function (url, sys) {
195
+ if (!sys.resolve) { throw new Error('『HTTP取得』は『逐次実行』構文内で利用する必要があります。') }
196
+ sys.__exec('AJAX逐次送信', [url, sys])
197
+ },
198
+ return_none: true
199
+ },
200
+ 'HTTP逐次取得': { // @逐次実行構文にて、非同期通信(Ajax)でURLにデータを送信する。成功すると『対象』にデータが代入される。失敗すると『AJAX失敗時』を実行。 // @HTTPちくじしゅとく
201
+ type: 'func',
202
+ josi: [['の', 'から', 'を']],
203
+ pure: false,
204
+ fn: function (url, sys) {
205
+ if (!sys.resolve) { throw new Error('『HTTP逐次取得』は『逐次実行』構文内で利用する必要があります。') }
206
+ sys.__exec('AJAX逐次送信', [url, sys])
207
+ },
208
+ return_none: true
209
+ },
210
+ 'HTTP保障取得': { // @非同期通信(Ajax)でURLにデータの送信を開始する非同期処理オブジェクト(Promise)を作成する。 // @HTTPほしょうしゅとく
211
+ type: 'func',
212
+ josi: [['の', 'から', 'を']],
213
+ pure: true,
214
+ fn: function (url, sys) {
215
+ return sys.__exec('AJAX保障送信', [url, sys])
216
+ },
217
+ return_none: false
218
+ },
219
+ 'POST逐次送信': { // @逐次実行構文にて、AjaxでURLにPARAMSをPOST送信し『対象』にデータを設定。失敗すると『AJAX失敗時』を実行。 // @POSTちくじそうしん
220
+ type: 'func',
221
+ josi: [['まで', 'へ', 'に'], ['を']],
222
+ pure: false,
223
+ fn: function (url, params, sys) {
224
+ if (!sys.resolve) { throw new Error('『POST送信』は『逐次実行』構文内で利用する必要があります。') }
225
+ sys.resolveCount++
226
+ const resolve = sys.resolve
227
+ const reject = sys.reject
228
+ const bodyData = sys.__exec('POSTデータ生成', [params, sys])
229
+ const options = {
230
+ method: 'POST',
231
+ headers: {
232
+ 'Content-Type': 'application/x-www-form-urlencoded'
233
+ },
234
+ body: bodyData
235
+ }
236
+ fetch(url, options).then(res => {
237
+ return res.text()
238
+ }).then(text => {
239
+ sys.__v0['対象'] = text
240
+ resolve(text)
241
+ }).catch(err => {
242
+ reject(err.message)
243
+ })
244
+ },
245
+ return_none: true
246
+ },
247
+ 'POST送信': { // @逐次実行構文にて、AjaxでURLにPARAMSをPOST送信し『対象』にデータを設定。失敗すると『AJAX失敗時』を実行。 // @POSTそうしん
248
+ type: 'func',
249
+ josi: [['まで', 'へ', 'に'], ['を']],
250
+ pure: false,
251
+ fn: function (url, params, sys) {
252
+ if (!sys.resolve) { throw new Error('『POST送信』は『逐次実行』構文内で利用する必要があります。') }
253
+ sys.__exec('POST逐次送信', [url, params, sys])
254
+ },
255
+ return_none: true
256
+ },
257
+ 'POST保障送信': { // @非同期通信(Ajax)でURLにPARAMSをPOST送信を開始する非同期処理オブジェクト(Promise)を作成する。 // @POSTほしょうそうしん
258
+ type: 'func',
259
+ josi: [['まで', 'へ', 'に'], ['を']],
260
+ pure: true,
261
+ fn: function (url, params, sys) {
262
+ const bodyData = sys.__exec('POSTデータ生成', [params, sys])
263
+ const options = {
264
+ method: 'POST',
265
+ headers: {
266
+ 'Content-Type': 'application/x-www-form-urlencoded'
267
+ },
268
+ body: bodyData
269
+ }
270
+ return fetch(url, options)
271
+ },
272
+ return_none: false
273
+ },
274
+ 'POSTフォーム逐次送信': { // @逐次実行構文にて、AjaxでURLにPARAMSをフォームとしてPOST送信し『対象』にデータを設定。失敗すると『AJAX失敗時』を実行。 // @POSTふぉーむちくじそうしん
275
+ type: 'func',
276
+ josi: [['まで', 'へ', 'に'], ['を']],
277
+ pure: true,
278
+ fn: function (url, params, sys) {
279
+ if (!sys.resolve) { throw new Error('『POSTフォーム逐次送信』は『逐次実行』構文内で利用する必要があります。') }
280
+ sys.resolveCount++
281
+ const resolve = sys.resolve
282
+ const reject = sys.reject
283
+ const fd = new FormData()
284
+ for (const key in params) { fd.set(key, params[key]) }
285
+
286
+ const options = {
287
+ method: 'POST',
288
+ body: fd
289
+ }
290
+ fetch(url, options).then(res => {
291
+ return res.text()
292
+ }).then(text => {
293
+ sys.__v0['対象'] = text
294
+ resolve(text)
295
+ }).catch(err => {
296
+ reject(err.message)
297
+ })
298
+ },
299
+ return_none: true
300
+ },
301
+ 'POSTフォーム送信': { // @逐次実行構文にて、AjaxでURLにPARAMSをフォームとしてPOST送信し『対象』にデータを設定。失敗すると『AJAX失敗時』を実行。 // @POSTふぉーむそうしん
302
+ type: 'func',
303
+ josi: [['まで', 'へ', 'に'], ['を']],
304
+ pure: false,
305
+ fn: function (url, params, sys) {
306
+ if (!sys.resolve) { throw new Error('『POSTフォーム送信』は『逐次実行』構文内で利用する必要があります。') }
307
+ sys.__exec('POSTフォーム逐次送信', [url, params, sys])
308
+ },
309
+ return_none: true
310
+ },
311
+ 'POSTフォーム保障送信': { // @非同期通信(Ajax)でURLにPARAMSをフォームとしてPOST送信を開始する非同期処理オブジェクト(Promise)を作成する。 // @POSTふぉーむほしょうそうしん
312
+ type: 'func',
313
+ josi: [['まで', 'へ', 'に'], ['を']],
314
+ pure: true,
315
+ fn: function (url, params, sys) {
316
+ const fd = new FormData()
317
+ for (const key in params) { fd.set(key, params[key]) }
318
+
319
+ const options = {
320
+ method: 'POST',
321
+ body: fd
322
+ }
323
+ return fetch(url, options)
324
+ },
325
+ return_none: false
326
+ },
327
+ 'AJAX内容取得': { // @非同期通信(Ajax)の応答から内容を指定した形式で取り出すための非同期処理オブジェクト(Promise)を返す。 // @AJAXないようしゅとく
328
+ type: 'func',
329
+ josi: [['から'], ['で']],
330
+ pure: true,
331
+ fn: function (res, type, sys) {
332
+ type = type.toString().toUpperCase()
333
+ if (type === 'TEXT' || type === 'テキスト') {
334
+ return res.text()
335
+ } else
336
+ if (type === 'JSON') {
337
+ return res.json()
338
+ } else
339
+ if (type === 'BLOB') {
340
+ return res.blob()
341
+ } else
342
+ if (type === 'ARRAY' || type === '配列') {
343
+ return res.arrayBuffer()
344
+ } else
345
+ if (type === 'BODY' || type === '本体') {
346
+ return res.body
347
+ }
348
+ return res.body()
349
+ },
350
+ return_none: false
351
+ }
352
+ }
@@ -0,0 +1,109 @@
1
+ /* eslint-disable quote-props */
2
+ module.exports = {
3
+ // @オーディオ
4
+ 'オーディオ開': { // @オーディオファイルのURLを指定して、オーディオを読み込み、Audioオブジェクトを返す // @おーでぃおひらく
5
+ type: 'func',
6
+ josi: [['を', 'の']],
7
+ pure: true,
8
+ fn: function (url, sys) {
9
+ const a = new Audio()
10
+ a.src = url
11
+ return a
12
+ },
13
+ return_none: false
14
+ },
15
+ 'オーディオ再生': { // @AudioオブジェクトOBJを指定してオーディを再生 // @おーでぃおさいせい
16
+ type: 'func',
17
+ josi: [['を']],
18
+ pure: true,
19
+ fn: function (obj, sys) {
20
+ if (!obj) { throw new Error('オーディオ再生する前に、オーディオ開くで音声ファイルを読み込んでください') }
21
+ obj.loop = false
22
+ obj.play()
23
+ },
24
+ return_none: true
25
+ },
26
+ 'オーディオループ再生': { // @AudioオブジェクトOBJを指定してオーディをループ再生する // @おーでぃおるーぷさいせい
27
+ type: 'func',
28
+ josi: [['を']],
29
+ pure: true,
30
+ fn: function (obj, sys) {
31
+ if (!obj) { throw new Error('オーディオ再生する前に、オーディオ開くで音声ファイルを読み込んでください') }
32
+ obj.loop = true
33
+ obj.play()
34
+ },
35
+ return_none: true
36
+ },
37
+ 'オーディオ停止': { // @AudioオブジェクトOBJを指定してオーディを停止 // @おーでぃおていし
38
+ type: 'func',
39
+ josi: [['を']],
40
+ pure: true,
41
+ fn: function (obj, sys) {
42
+ if (!obj) { throw new Error('オーディオ停止する前に、オーディオ開くで音声ファイルを読み込んでください') }
43
+ obj.pause()
44
+ obj.currentTime = 0 // 暫定
45
+ // オーディオ停止で再生位置が0に戻らない問題(#715)
46
+ setTimeout(() => {
47
+ obj.currentTime = 0 // しっかりと設定
48
+ }, 10)
49
+ },
50
+ return_none: true
51
+ },
52
+ 'オーディオ一時停止': { // @AudioオブジェクトOBJを指定してオーディを一時停止 // @おーでぃおいちじていし
53
+ type: 'func',
54
+ josi: [['を']],
55
+ pure: true,
56
+ fn: function (obj, sys) {
57
+ if (!obj) { throw new Error('オーディオ一時停止する前に、オーディオ開くで音声ファイルを読み込んでください') }
58
+ obj.pause()
59
+ },
60
+ return_none: true
61
+ },
62
+ 'オーディオ音量取得': { // @AudioオブジェクトOBJの音量を取得して返す // @おーでぃおおんりょうしゅとく
63
+ type: 'func',
64
+ josi: [['の', 'から']],
65
+ pure: true,
66
+ fn: function (obj, sys) {
67
+ if (!obj) { throw new Error('オーディオ長取得する前に、オーディオ開くで音声ファイルを読み込んでください') }
68
+ return obj.volume
69
+ }
70
+ },
71
+ 'オーディオ音量設定': { // @AudioオブジェクトOBJの音量をV(0-1)に設定する // @おーでぃおおんりょうせってい
72
+ type: 'func',
73
+ josi: [['を'], ['に', 'へ']],
74
+ pure: true,
75
+ fn: function (obj, v, sys) {
76
+ if (!obj) { throw new Error('オーディオ長取得する前に、オーディオ開くで音声ファイルを読み込んでください') }
77
+ obj.volume = v
78
+ },
79
+ return_none: true
80
+ },
81
+ 'オーディオ長取得': { // @AudioオブジェクトOBJを指定してオーディの長さを取得して返す // @おーでぃおながさしゅとく
82
+ type: 'func',
83
+ josi: [['の', 'から']],
84
+ pure: true,
85
+ fn: function (obj, sys) {
86
+ if (!obj) { throw new Error('オーディオ長取得する前に、オーディオ開くで音声ファイルを読み込んでください') }
87
+ return obj.duration
88
+ }
89
+ },
90
+ 'オーディオ再生位置取得': { // @AudioオブジェクトOBJを指定してオーディの再生位置を取得して返す // @おーでぃおさいせいいちしゅとく
91
+ type: 'func',
92
+ josi: [['の', 'から']],
93
+ pure: true,
94
+ fn: function (obj, sys) {
95
+ if (!obj) { throw new Error('オーディオ再生位置取得する前に、オーディオ開くで音声ファイルを読み込んでください') }
96
+ return obj.currentTime
97
+ }
98
+ },
99
+ 'オーディオ再生位置設定': { // @AudioオブジェクトOBJを指定してオーディの位置を数値Vで設定する // @おーでぃおさいせい
100
+ type: 'func',
101
+ josi: [['を'], ['に', 'へ']],
102
+ pure: true,
103
+ fn: function (obj, v, sys) {
104
+ if (!obj) { throw new Error('オーディオ停止する前に、オーディオ開くで音声ファイルを読み込んでください') }
105
+ obj.currentTime = v
106
+ },
107
+ return_none: true
108
+ }
109
+ }