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,51 @@
1
+ // @ts-nocheck
2
+ module.exports = {
3
+ // @位置情報
4
+ '位置情報取得時': { // @位置情報を取得してコールバック関数内で変数「対象」に配列で[緯度,経度]を返す // @いちじょうほうしゅとくしたとき
5
+ type: 'func',
6
+ josi: [['の', 'に', 'へ']],
7
+ pure: false,
8
+ fn: function (func, sys) {
9
+ let cb = func
10
+ if (typeof cb === 'string') { cb = sys.__findVar(cb) }
11
+ if (!('geolocation' in navigator)) { throw new Error('関数『位置情報取得時』は使えません。') }
12
+
13
+ navigator.geolocation.getCurrentPosition((position) => {
14
+ sys.__v0['対象'] = [
15
+ position.coords.latitude,
16
+ position.coords.longitude
17
+ ]
18
+ cb(position)
19
+ })
20
+ },
21
+ return_none: true
22
+ },
23
+ '位置情報監視時': { // @位置情報を監視してIDを返す。引数に指定したコールバック関数内で変数「対象」に配列で[緯度,経度]を返す // @いちじょうほうかんししたとき
24
+ type: 'func',
25
+ josi: [['の', 'に', 'へ']],
26
+ pure: false,
27
+ fn: function (func, sys) {
28
+ let cb = func
29
+ if (typeof cb === 'string') { cb = sys.__findVar(cb) }
30
+ if (!('geolocation' in navigator)) { throw new Error('関数『位置情報監視時』は使えません。') }
31
+
32
+ return navigator.geolocation.watchPosition((position) => {
33
+ sys.__v0['対象'] = [
34
+ position.coords.latitude,
35
+ position.coords.longitude
36
+ ]
37
+ cb(position)
38
+ })
39
+ },
40
+ return_none: false
41
+ },
42
+ '位置情報監視停止': { // @『位置情報監視時』で開始した監視を停止する // @いちじょうほうかんしていし
43
+ type: 'func',
44
+ josi: [['の']],
45
+ pure: true,
46
+ fn: function (wid, sys) {
47
+ navigator.geolocation.clearWatch(wid)
48
+ },
49
+ return_none: true
50
+ }
51
+ }
@@ -0,0 +1,25 @@
1
+ // @ts-nocheck
2
+ const hotkeys = require('hotkeys-js')
3
+
4
+ module.exports = {
5
+ // @ホットキー
6
+ 'ホットキー登録': { // @ホットキーKEYにEVENTを登録する // @ほっときーとうろく
7
+ type: 'func',
8
+ josi: [['に', 'で'], ['を']],
9
+ pure: true,
10
+ fn: function (key, fname, sys) {
11
+ hotkeys(key, function (event, handler) {
12
+ event.preventDefault()
13
+ sys.__v1[fname]()
14
+ })
15
+ }
16
+ },
17
+ 'ホットキー解除': { // @ホットキーKEYを解除する // @ほっときーかいじょ
18
+ type: 'func',
19
+ josi: [['を', 'の']],
20
+ pure: true,
21
+ fn: function (key) {
22
+ hotkeys.unbind(key)
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,59 @@
1
+ // @ts-nocheck
2
+ module.exports = {
3
+ // @HTML操作
4
+ 'HTML変換': { // @文字列をHTMLに変換して返す // @HTMLへんかん
5
+ type: 'func',
6
+ josi: [['を']],
7
+ pure: true,
8
+ fn: function (text) {
9
+ return String(text)
10
+ .replace(/&/g, '&')
11
+ .replace(/>/g, '>')
12
+ .replace(/</g, '&lt;')
13
+ }
14
+ },
15
+ // @クリップボード
16
+ 'クリップボード設定': { // @文字列をクリップボードにコピー // @くりっぷぼーどせってい
17
+ type: 'func',
18
+ josi: [['を']],
19
+ pure: true,
20
+ fn: function (text) {
21
+ // Clipboard APIをサポートしているか
22
+ if (navigator.clipboard) {
23
+ navigator.clipboard.writeText(text)
24
+ } else {
25
+ const tmp = document.createElement('div')
26
+ const pre = document.createElement('pre')
27
+ pre.style.webkitUserSelect = 'auto'
28
+ pre.style.userSelect = 'auto'
29
+ tmp.appendChild(pre).textContent = text
30
+ // 画面外へ表示する
31
+ tmp.style.position = 'fixed'
32
+ tmp.right = '200%'
33
+ document.body.appendChild(tmp)
34
+ document.getSelection().selectAllChildren(tmp)
35
+ document.execCommand('copy')
36
+ document.body.removeChild(tmp)
37
+ }
38
+ },
39
+ return_none: true
40
+ },
41
+ 'クリップボード取得時': { // @クリップボードの値を取得した後関数Fを実行する。結果は変数『対象』に代入される(ユーザーの許可が必要)。 // @くりっぷぼーどしゅとくしたとき
42
+ type: 'func',
43
+ josi: [['を']],
44
+ pure: true,
45
+ fn: function (f, sys) {
46
+ // Clipboard APIをサポートしているか
47
+ if (navigator.clipboard) {
48
+ if (typeof (f) === 'string') { f = sys.__findFunc(f, 'クリップボード取得時') }
49
+ const pm = navigator.clipboard.readText()
50
+ pm.then(text => {
51
+ sys.__v0['対象'] = text
52
+ f(sys)
53
+ })
54
+ } else {
55
+ throw new Error('Clipbard APIが利用できません。')
56
+ }
57
+ }
58
+ }
59
+ }
@@ -0,0 +1,44 @@
1
+ // @ts-nocheck
2
+ // plugin_browser_in_worker.js
3
+
4
+ const PartBrowserColor = require('./plugin_browser_color.js')
5
+ const PartBrowserAjax = require('./plugin_browser_ajax.js')
6
+ const PartBrowserHtml = require('./plugin_browser_html.js')
7
+ const PartBrowserWebsocket = require('./plugin_browser_websocket.js')
8
+
9
+ const BrowserParts = [
10
+ PartBrowserColor,
11
+ PartBrowserAjax,
12
+ PartBrowserHtml,
13
+ PartBrowserWebsocket
14
+ ]
15
+
16
+ const PluginBrowserInWorker = {
17
+ '初期化': {
18
+ type: 'func',
19
+ josi: [],
20
+ pure: true,
21
+ fn: function (sys) {
22
+ /* eslint no-global-assign: 0 */
23
+ if (typeof self === 'undefined') { self = {} }
24
+ if (typeof navigator === 'undefined') { navigator = {} }
25
+
26
+ // 定数を初期化
27
+ sys.__v0['AJAX:ONERROR'] = (err) => { console.log(err) }
28
+ // オブジェクトを初期化
29
+ sys.__v0.SELF = self
30
+ sys.__v0.NAVIGATOR = navigator
31
+ }
32
+ }
33
+ }
34
+
35
+ BrowserParts.forEach((a) => {
36
+ const b = {}
37
+ Object.assign(b, a)
38
+ if (typeof b['初期化'] !== 'undefined') {
39
+ delete b['初期化']
40
+ }
41
+ Object.assign(PluginBrowserInWorker, b)
42
+ })
43
+
44
+ module.exports = PluginBrowserInWorker
@@ -0,0 +1,21 @@
1
+ // @ts-nocheck
2
+ module.exports = {
3
+ // @ブラウザ操作
4
+ 'ブラウザ移動': { // @任意のURLにブラウザ移動(ただし移動後スクリプトの実行は停止する) // @ぶらうざいどう
5
+ type: 'func',
6
+ josi: [['に', 'へ']],
7
+ pure: true,
8
+ fn: function (url, sys) {
9
+ window.location.href = url
10
+ }
11
+ },
12
+ 'ブラウザ戻': { // @任意のURLにブラウザ移動(ただし移動後スクリプトの実行は停止する) // @ぶらうざもどる
13
+ type: 'func',
14
+ josi: [],
15
+ pure: true,
16
+ fn: function () {
17
+ window.history.back(-1)
18
+ }
19
+ },
20
+ 'ブラウザURL': { type: 'const', value: '' } // @NぶらうざURL
21
+ }
@@ -0,0 +1,111 @@
1
+ // @ts-nocheck
2
+ module.exports = {
3
+ // @音声合成
4
+ '話': { // @音声合成APIを使って、Sを発話する // @はなす
5
+ type: 'func',
6
+ josi: [['と', 'を', 'の']],
7
+ pure: false,
8
+ fn: function (s, sys) {
9
+ // 話者の特定
10
+ let voice = sys.__v0['話:話者']
11
+ if (!voice) { voice = sys.__exec('話者設定', ['ja', sys]) }
12
+ // インスタンス作成
13
+ const msg = new SpeechSynthesisUtterance(s)
14
+ msg.voice = voice
15
+ if (voice) { msg.lang = voice.lang } // 必ず話者の特定に成功している訳ではない
16
+ msg.rate = sys.__v0['話者速度']
17
+ msg.pitch = sys.__v0['話者声高']
18
+ msg.volume = sys.__v0['話者音量']
19
+ window.speechSynthesis.speak(msg)
20
+ console.log('#話す:', s)
21
+ return s
22
+ }
23
+ },
24
+ '話終時': { // @音声合成APIを使って、Sを発話し発話した後でcallbackを実行 // @はなしおわったとき
25
+ type: 'func',
26
+ josi: [['で'], ['と', 'を', 'の']],
27
+ pure: false,
28
+ fn: function (callback, s, sys) {
29
+ // 話者の特定
30
+ let voice = sys.__v0['話:話者']
31
+ if (!voice) { voice = sys.__exec('話者設定', ['ja', sys]) }
32
+ // インスタンス作成
33
+ const msg = new SpeechSynthesisUtterance(s)
34
+ msg.voice = voice
35
+ if (voice) { msg.lang = voice.lang } // 必ず話者の特定に成功している訳ではない
36
+ msg.rate = sys.__v0['話者速度']
37
+ msg.pitch = sys.__v0['話者声高']
38
+ msg.volume = sys.__v0['話者音量']
39
+ msg.onend = (e) => {
40
+ console.log('#話終時')
41
+ sys.__v0['対象イベント'] = e
42
+ callback(sys)
43
+ }
44
+ window.speechSynthesis.speak(msg)
45
+ console.log('#話す:', s)
46
+ return s
47
+ }
48
+ },
49
+ '話者一覧取得': { // @音声合成APIの話者一覧を得る // @わしゃいちらんしゅとく
50
+ type: 'func',
51
+ josi: [],
52
+ pure: true,
53
+ fn: function (sys) {
54
+ // 対応している?
55
+ if (!('SpeechSynthesisUtterance' in window)) { throw new Error('音声合成APIに対応していません') }
56
+
57
+ return window.speechSynthesis.getVoices()
58
+ }
59
+ },
60
+ '話者設定': { // @音声合成APIの話者を指定する // @わしゃせってい
61
+ type: 'func',
62
+ josi: [['に', 'へ']],
63
+ pure: true,
64
+ fn: function (v, sys) {
65
+ // 対応している?
66
+ if (!('SpeechSynthesisUtterance' in window)) { throw new Error('音声合成APIに対応していません') }
67
+
68
+ // 文字列で値を指定
69
+ if (typeof v === 'string') {
70
+ // 話者を特定する
71
+ const voices = window.speechSynthesis.getVoices()
72
+ for (const i of voices) {
73
+ if (i.lang.indexOf(v) >= 0 || i.name === v) {
74
+ const msg = new SpeechSynthesisUtterance()
75
+ msg.voice = i
76
+ msg.lang = i.lang
77
+ sys.__v0['話:話者'] = i
78
+ console.log('#話者:', i.name)
79
+ return i
80
+ }
81
+ }
82
+ }
83
+ // 話者一覧取得で得たオブジェクトを直接指定した場合
84
+ if (typeof v === 'object') {
85
+ sys.__v0['話:話者'] = v
86
+ return v
87
+ }
88
+ return undefined
89
+ }
90
+ },
91
+ '話者速度': { type: 'const', value: 1.0 }, // @わしゃそくど
92
+ '話者声高': { type: 'const', value: 1.0 }, // @わしゃこわだか
93
+ '話者音量': { type: 'const', value: 1.0 }, // @わしゃこおんりょう
94
+ '話者詳細設定': { // @音声合成APIの話者の設定をオブジェクト形式で設定する。『速度,声高,ピッチ,音量』を指定 // @わしゃしょうさいせってい
95
+ type: 'func',
96
+ josi: [['で', 'に', 'へ']],
97
+ pure: true,
98
+ fn: function (obj, sys) {
99
+ const changeFunc = (key, v) => {
100
+ if (key === '速度') { sys.__v0['話者速度'] = v }
101
+ if (key === '声高' || key === 'ピッチ') { sys.__v0['話者声高'] = v }
102
+ if (key === '音量') { sys.__v0['話者音量'] = v }
103
+ }
104
+ // 一括変更
105
+ for (const key in obj) {
106
+ const v = obj[key]
107
+ changeFunc(key, v)
108
+ }
109
+ }
110
+ }
111
+ }
@@ -0,0 +1,121 @@
1
+ // @ts-nocheck
2
+ module.exports = {
3
+ // @ローカルストレージ
4
+ '保存': { // @ブラウザのlocalStorageのキーKに文字列Vを保存 // @ほぞん
5
+ type: 'func',
6
+ josi: [['を'], ['に', 'へ']],
7
+ pure: false,
8
+ fn: function (v, key, sys) {
9
+ sys.__exec('ローカルストレージ保存', [v, key, sys])
10
+ },
11
+ return_none: true
12
+ },
13
+ '開': { // @ブラウザのlocalStorageからVを読む // @ひらく
14
+ type: 'func',
15
+ josi: [['を', 'から', 'の']],
16
+ pure: false,
17
+ fn: function (key, sys) {
18
+ return sys.__exec('ローカルストレージ読', [key, sys])
19
+ },
20
+ return_none: false
21
+ },
22
+ '読': { // @ブラウザのlocalStorageからVを読む // @よむ
23
+ type: 'func',
24
+ josi: [['を', 'から', 'の']],
25
+ pure: false,
26
+ fn: function (key, sys) {
27
+ return sys.__exec('ローカルストレージ読', [key, sys])
28
+ },
29
+ return_none: false
30
+ },
31
+ '存在': { // @ブラウザのlocalStorageにKEYが存在しているか調べる // @そんざい
32
+ type: 'func',
33
+ josi: [['が']],
34
+ pure: true,
35
+ fn: function (key) {
36
+ const s = window.localStorage.getItem(key)
37
+ return (s !== null)
38
+ },
39
+ return_none: false
40
+ },
41
+ 'ローカルストレージ保存': { // @ブラウザのlocalStorageのKにVを保存 // @ろーかるすとれーじほぞん
42
+ type: 'func',
43
+ josi: [['を'], ['に', 'へ']],
44
+ pure: true,
45
+ fn: function (v, key, sys) {
46
+ let body = v
47
+ if (sys.__v0['保存オプション'] && (sys.__v0['保存オプション'].indexOf('json') >= 0)) {
48
+ body = JSON.stringify(body)
49
+ }
50
+ window.localStorage[key] = body
51
+ },
52
+ return_none: true
53
+ },
54
+ 'ローカルストレージ読': { // @ブラウザのlocalStorageからVを読む // @ろーかるすとれーじよむ
55
+ type: 'func',
56
+ josi: [['を', 'から', 'の']],
57
+ pure: true,
58
+ fn: function (key, sys) {
59
+ const v = window.localStorage[key]
60
+ if (sys.__v0['保存オプション'] && (sys.__v0['保存オプション'].indexOf('json') >= 0)) {
61
+ try {
62
+ return JSON.parse(v)
63
+ } catch (e) {
64
+ console.log('ローカルストレージ『' + key + '』の読み込みに失敗')
65
+ }
66
+ }
67
+ return v
68
+ },
69
+ return_none: false
70
+ },
71
+ 'ローカルストレージキー列挙': { // @ブラウザのlocalStorageのキー一覧を返す // @ろーかるすとれーじきーれっきょ
72
+ type: 'func',
73
+ josi: [[]],
74
+ pure: true,
75
+ fn: function (key) {
76
+ const keys = []
77
+ for (const key in window.localStorage) { keys.push(key) }
78
+
79
+ return keys
80
+ },
81
+ return_none: false
82
+ },
83
+ 'ローカルストレージキー削除': { // @ブラウザのlocalStorageのkeyを削除 // @ろーかるすとれーじきーさくじょ
84
+ type: 'func',
85
+ josi: [['を', 'の']],
86
+ pure: true,
87
+ fn: function (key) {
88
+ window.localStorage.removeItem(key)
89
+ },
90
+ return_none: true
91
+ },
92
+ 'ローカルストレージ全削除': { // @ブラウザのlocalStorageのデータを全部削除する // @ろーかるすとれーじぜんさくじょ
93
+ type: 'func',
94
+ josi: [],
95
+ pure: true,
96
+ fn: function () {
97
+ window.localStorage.clear()
98
+ },
99
+ return_none: true
100
+ },
101
+ 'ローカルストレージ有効確認': { // @ブラウザのlocalStorageが使えるか確認 // @ろーかるすとれーじりようかくにん
102
+ type: 'func',
103
+ josi: [],
104
+ pure: true,
105
+ fn: function () {
106
+ return (typeof window.localStorage !== 'undefined')
107
+ },
108
+ return_none: false
109
+ },
110
+ '保存オプション': { type: 'const', value: 'json' }, // @ ほぞんおぷしょん
111
+ '保存オプション設定': { // @ブラウザのlocalStorageへの保存オプション「json」を設定する // @ほぞんおぷしょんせってい
112
+ type: 'func',
113
+ josi: [['に', 'へ']],
114
+ pure: true,
115
+ fn: function (v, sys) {
116
+ v = v.toUpperCase(v)
117
+ sys.__v0['保存オプション'] = v
118
+ },
119
+ return_none: true
120
+ }
121
+ }
@@ -0,0 +1,12 @@
1
+ module.exports = {
2
+ // @システム
3
+ '終': { // @ブラウザでプログラムの実行を強制終了する // @おわる
4
+ type: 'func',
5
+ josi: [],
6
+ pure: true,
7
+ fn: function () {
8
+ throw new Error('__終わる__')
9
+ },
10
+ return_none: true
11
+ }
12
+ }
@@ -0,0 +1,73 @@
1
+ // @ts-nocheck
2
+ module.exports = {
3
+ // @WebSocket
4
+ 'WS接続完了時': { // @WebSocketでサーバに接続完了した時に実行されるイベントを指定 // @WSせつぞくかんりょうしたとき
5
+ type: 'func',
6
+ josi: [['を']],
7
+ pure: true,
8
+ fn: function (callback, sys) {
9
+ sys.__v0['WS:ONOPEN'] = callback
10
+ },
11
+ return_none: true
12
+ },
13
+ 'WS受信時': { // @WebSocketでサーバからメッセージを受信した時に実行されるイベントを指定 // @WSじゅしんしたとき
14
+ type: 'func',
15
+ josi: [['を']],
16
+ pure: true,
17
+ fn: function (callback, sys) {
18
+ sys.__v0['WS:ONMESSAGE'] = callback
19
+ },
20
+ return_none: true
21
+ },
22
+ 'WSエラー発生時': { // @WebSocketでエラーが発生した時に実行されるイベントを指定 // @WSえらーはっせいじ
23
+ type: 'func',
24
+ josi: [['を']],
25
+ pure: true,
26
+ fn: function (callback, sys) {
27
+ sys.__v0['WS:ONERROR'] = callback
28
+ },
29
+ return_none: true
30
+ },
31
+ 'WS接続': { // @WebSocketサーバsに接続する // @WSせつぞく
32
+ type: 'func',
33
+ josi: [['に', 'へ', 'の']],
34
+ pure: true,
35
+ fn: function (s, sys) {
36
+ const ws = new WebSocket(s)
37
+ ws.onopen = () => {
38
+ const cbOpen = sys.__v0['WS:ONOPEN']
39
+ if (cbOpen) { cbOpen(sys) }
40
+ }
41
+ ws.onerror = (err) => {
42
+ const cbError = sys.__v0['WS:ONERROR']
43
+ if (cbError) { cbError(err, sys) }
44
+ console.log('WSエラー', err)
45
+ }
46
+ ws.onmessage = (e) => {
47
+ sys.__v0['対象'] = e.data
48
+ const cbMsg = sys.__v0['WS:ONMESSAGE']
49
+ if (cbMsg) { cbMsg(sys) }
50
+ }
51
+ sys.__v0['WS:SOCKET'] = ws
52
+ return ws
53
+ }
54
+ },
55
+ 'WS送信': { // @アクティブなWebSocketへsを送信する // @WSそうしん
56
+ type: 'func',
57
+ josi: [['を', 'と']],
58
+ pure: true,
59
+ fn: function (s, sys) {
60
+ const ws = sys.__v0['WS:SOCKET']
61
+ ws.send(s)
62
+ }
63
+ },
64
+ 'WS切断': { // @アクティブなWebSocketを閉じる // @WSせつだん
65
+ type: 'func',
66
+ josi: [],
67
+ pure: true,
68
+ fn: function (sys) {
69
+ const ws = sys.__v0['WS:SOCKET']
70
+ ws.close()
71
+ }
72
+ }
73
+ }
@@ -0,0 +1,24 @@
1
+ // @ts-nocheck
2
+ const PluginCaniuse = {
3
+ '初期化': {
4
+ type: 'func',
5
+ josi: [],
6
+ pure: true,
7
+ fn: function (sys) {
8
+ }
9
+ },
10
+ // @ブラウザサポート
11
+ 'ブラウザ名変換表': { type: 'const', value: require('caniuse-db/data.json').agents }, // @ぶらうざめいへんかんひょう
12
+ '対応ブラウザ一覧取得': { // @対応しているブラウザの一覧を取得する // @たいおうぶらうざいちらんしゅとく
13
+ type: 'func',
14
+ josi: [],
15
+ fn: function () {
16
+ const browserslist = require('browserslist')
17
+ return browserslist()
18
+ }
19
+ }
20
+ }
21
+ module.exports = PluginCaniuse
22
+ // scriptタグで取り込んだ時、自動で登録する
23
+ /* istanbul ignore else */
24
+ if (typeof (navigator) === 'object' && typeof (navigator.nako3)) { navigator.nako3.addPluginObject('PluginCaniuse', PluginCaniuse) }
@@ -0,0 +1,57 @@
1
+ // @ts-nocheck
2
+ const PluginCSV = {
3
+ '初期化': {
4
+ type: 'func',
5
+ josi: [],
6
+ pure: true,
7
+ fn: function (sys) {
8
+ }
9
+ },
10
+ // @CSV操作
11
+ 'CSV取得': { // @CSV形式のデータstrを強制的に二次元配列に変換して返す // @CSVしゅとく
12
+ type: 'func',
13
+ josi: [['を', 'の', 'で']],
14
+ pure: true,
15
+ fn: function (str) {
16
+ const CSV = require('csv-lite-js')
17
+ CSV.options.delimiter = ','
18
+ return CSV.parse(str)
19
+ }
20
+ },
21
+ 'TSV取得': { // @TSV形式のデータstrを強制的に二次元配列に変換して返す // @TSVしゅとく
22
+ type: 'func',
23
+ josi: [['を', 'の', 'で']],
24
+ pure: true,
25
+ fn: function (str) {
26
+ const CSV = require('csv-lite-js')
27
+ CSV.options.delimiter = '\t'
28
+ return CSV.parse(str)
29
+ }
30
+ },
31
+ '表CSV変換': { // @二次元配列AをCSV形式に変換して返す // @ひょうCSVへんかん
32
+ type: 'func',
33
+ josi: [['を']],
34
+ pure: true,
35
+ fn: function (a) {
36
+ const CSV = require('csv-lite-js')
37
+ CSV.options.delimiter = ','
38
+ return CSV.stringify(a)
39
+ }
40
+ },
41
+ '表TSV変換': { // @二次元配列AをTSV形式に変換して返す // @ひょうTSVへんかん
42
+ type: 'func',
43
+ josi: [['を']],
44
+ pure: true,
45
+ fn: function (a) {
46
+ const CSV = require('csv-lite-js')
47
+ CSV.options.delimiter = '\t'
48
+ return CSV.stringify(a)
49
+ }
50
+ }
51
+ }
52
+
53
+ module.exports = PluginCSV
54
+ // scriptタグで取り込んだ時、自動で登録する
55
+ if (typeof (navigator) === 'object' && typeof (navigator.nako3) === 'object') {
56
+ navigator.nako3.addPluginObject('PluginCSV', PluginCSV)
57
+ }