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
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017 kujirahand
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,107 @@
1
+ # 日本語プログラミング言語「なでしこ3」
2
+
3
+ [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE)
4
+ [![npm version](https://badge.fury.io/js/nadesiko3.svg)](https://www.npmjs.com/package/nadesiko3)
5
+ ![Node.js CI](https://github.com/kujirahand/nadesiko3/workflows/Node.js%20CI/badge.svg)
6
+
7
+ ## 「なでしこ3」とは
8
+
9
+ 「なでしこ3」とは、日本語のプログラミング言語です。HTML5/JavaScriptをベースとしているので、PC/スマホ/タブレットなど、さまざまな環境で動作させることができます。
10
+
11
+ 日本語プログラミング言語は、読みやすく理解しやすいのが特徴で、初めてでも楽しくプログラミングを覚えることができます。また、バッチ処理や定型処理などを手軽に記述できます。
12
+
13
+ - [なでしこのWebサイト](https://nadesi.com/top/)
14
+ - [なでしこ3のWebサイト](https://nadesi.com/doc3/)
15
+ - [なでしこ3(GitHub Pages)](https://kujirahand.github.io/nadesiko3/)
16
+
17
+ ## 対応機器/ブラウザ
18
+
19
+ [doc/browsers.md](doc/browsers.md) をご覧ください。
20
+
21
+ ## ブラウザで利用する場合
22
+
23
+ 以下、Webエディタ上で、なでしこを実行できます。
24
+
25
+ - [なでしこ3簡易エディタ](https://nadesi.com/doc3/index.php?%E3%81%AA%E3%81%A7%E3%81%97%E3%81%933%E7%B0%A1%E6%98%93%E3%82%A8%E3%83%87%E3%82%A3%E3%82%BF)
26
+ - [なでしこ3貯蔵庫(プログラム一覧)](https://n3s.nadesi.com/)
27
+ - [なでしこエディタの一覧](https://nadesi.com/doc3/index.php?%E3%81%AA%E3%81%A7%E3%81%97%E3%81%933%E3%82%A8%E3%83%87%E3%82%A3%E3%82%BF%E3%81%AE%E4%B8%80%E8%A6%A7)
28
+
29
+ ## 各OSごとに利用する方法
30
+
31
+ なでしこ3をPC向けにローカル環境で動作させることも可能です。
32
+
33
+ - [OS別のインストール方法](https://nadesi.com/doc3/index.php?OS%E5%88%A5)
34
+
35
+ ### Windowsで利用する
36
+
37
+ 以下のリンクを開いて、「Source code(zip)」をクリックしてダウンロードします。
38
+ これは、Node.jsや必要なモジュール一式を梱包したものです。
39
+
40
+ - [なでしこ3のWindows配布パッケージ](https://github.com/kujirahand/nadesiko3win32/releases)
41
+
42
+ 解凍したら「nako3edit.vbs」(PC版)または「start.vbs」(Web版)をクリックします。すると、なでしこエディタが起動します。
43
+
44
+ ### npm でインストール
45
+
46
+ 先にNode.jsをインストールします。
47
+ 次いで、コマンドラインから以下のコマンドを実行します。
48
+
49
+ ```bash
50
+ npm install -g nadesiko3
51
+ ```
52
+
53
+ すると、cnako3というコマンドで、なでしこを利用できます。
54
+
55
+ ```bash
56
+ # なでしこのサーバーを起動
57
+ npm start
58
+ # なでしこエディタ(PC版)を起動
59
+ npm run nako3edit
60
+ # なでしこエディタ(WEB版)を起動
61
+ npm run nako3server
62
+ ```
63
+
64
+ ### Gitからインストール
65
+
66
+ また、以下のコマンドを実行すると、ブラウザ上になでしこの簡易エディタが起動します。
67
+
68
+ ```bash
69
+ git clone https://github.com/kujirahand/nadesiko3.git
70
+ cd nadesiko3
71
+ npm install
72
+ ```
73
+
74
+ #### 追加インストール(macOS/Linux)
75
+
76
+ 必要に応じて以下のコマンドをインストールします。
77
+
78
+ macOS:
79
+
80
+ ```bash
81
+ # 『圧縮』『解凍』命令のために
82
+ brew install p7zip
83
+ ```
84
+
85
+ Ubuntu/Debian:
86
+
87
+ ```bash
88
+ # 『圧縮』『解凍』命令のために
89
+ sudo apt install p7zip-full
90
+ # 『キー送信』命令のために
91
+ sudo apt install xdotool
92
+ ```
93
+
94
+ 全てのコマンドが正しく動くかを確認するには、以下のコマンドを実行します。
95
+
96
+ ```bash
97
+ npm test
98
+ ```
99
+
100
+ ## GUI(Electron)を使う
101
+
102
+ Electronを使うと手軽にGUIを構築できます。Electronについては、[doc/SETUP.md](doc/SETUP.md)を参考にしてください。
103
+
104
+ ## なでしこ3の開発に参加する
105
+
106
+ なでしこ3自身を開発するために、開発環境を整えようという方は、 [doc/SETUP.md](doc/SETUP.md) をご覧ください。
107
+ また、なでしこ3開発者向けの[Gitter](https://gitter.im/nadesiko3/community)への参加も可能です。
package/bin/cnako3 ADDED
@@ -0,0 +1,10 @@
1
+ #!/bin/bash
2
+ ROOT_DIR=$(
3
+ cd $(dirname "$0")
4
+ cd ..
5
+ pwd
6
+ )
7
+ SRC_DIR=$ROOT_DIR/src
8
+ NAKO_JS=$SRC_DIR/cnako3.js
9
+
10
+ /usr/bin/env node "$NAKO_JS" $*
package/bin/cnako3.bat ADDED
@@ -0,0 +1,11 @@
1
+ @echo off
2
+
3
+ pushd %~dp0..
4
+ set ROOT_DIR=%CD%
5
+ popd
6
+
7
+ SET SRC_DIR=%ROOT_DIR%\src
8
+ SET CNAKO_JS=%SRC_DIR%\cnako3.js
9
+ SET NODE_EXE=%ROOT_DIR%\nodejs\node.exe
10
+
11
+ %NODE_EXE% %CNAKO_JS% %1 %2 %3 %4 %5 %6 %7 %8 %9
@@ -0,0 +1,6 @@
1
+ @echo off
2
+ SET ROOT_DIR=%~dp0\..
3
+ cd %ROOT_DIR%
4
+ call npm run server
5
+ pause
6
+
@@ -0,0 +1,90 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>Nadesiko3 Editor</title>
8
+ <link rel="stylesheet" href="../src/wnako3_editor.css">
9
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/ace.js" integrity="sha512-GZ1RIgZaSc8rnco/8CXfRdCpDxRCphenIiZ2ztLy3XQfCbQUSCuk8IudvNHxkRA3oUg6q0qejgN/qqyG1duv5Q==" crossorigin="anonymous"></script>
10
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/ext-language_tools.min.js" integrity="sha512-8qx1DL/2Wsrrij2TWX5UzvEaYOFVndR7BogdpOyF4ocMfnfkw28qt8ULkXD9Tef0bLvh3TpnSAljDC7uyniEuQ==" crossorigin="anonymous"></script>
11
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/ext-options.min.js" integrity="sha512-oHR+WVzBiVZ6njlMVlDDLUIOLRDfUUfRQ55PfkZvgjwuvGqL4ohCTxaahJIxTmtya4jgyk0zmOxDMuLzbfqQDA==" crossorigin="anonymous"></script>
12
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/ext-code_lens.min.js" integrity="sha512-gsDyyKTnOmSWRDzUbpYcPjzVsEyFGSWeWefzVKvbMULPR2ElIlKKsOtU3ycfybN9kncZXKLFSsUiG3cgJUbc/g==" crossorigin="anonymous"></script>
13
+ <script src="../release/wnako3.js"></script>
14
+ <script src="../release/version.js"></script>
15
+ <script src="../release/plugin_markup.js"></script>
16
+ <script src="../release/plugin_csv.js"></script>
17
+ <script src="../release/plugin_kansuji.js"></script>
18
+ <script src="../release/plugin_datetime.js"></script>
19
+ <script src="../release/plugin_turtle.js"></script>
20
+ <script src="../release/plugin_caniuse.js"></script>
21
+ <script src="../release/plugin_webworker.js"></script>
22
+
23
+ <!-- mochaを一番最後に読み込む必要がある -->
24
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/mocha/8.3.0/mocha.min.js" integrity="sha512-LA/TpBXau/JNubKzHQhdi5vGkRLyQjs1vpuk2W1nc8WNgf/pCqBplD8MzlzeKJQTZPvkEZi0HqBDfRC2EyLMXw==" crossorigin="anonymous"></script>
25
+ </head>
26
+ <body>
27
+ 単純な例
28
+ <div id="editor1">もしはいならば
29
+ 「こんにちは」を表示
30
+ ここまで
31
+ </div>
32
+ インデント構文
33
+ <div id="editor2">!インデント構文
34
+ Nを1から3まで繰り返す
35
+ Nを表示
36
+
37
+ 「1行目
38
+ 2行目」を表示
39
+
40
+ /*
41
+ 範囲コメント
42
+ */
43
+ </div>
44
+ コンパイルエラーの表示
45
+ <div id="editor3">
46
+   「{」を表示
47
+ </div>
48
+ readonly
49
+ <div id="editor4" data-nako3-readonly="true">1+2を表示
50
+ </div>
51
+ コンパイルエラーの表示の無効化
52
+ <div id="editor5" data-nako3-disable-marker="true">
53
+ 「{」を表示
54
+ </div>
55
+ エディタのリサイズ
56
+ <div id="editor8" data-nako3-resizable="true"></div>
57
+ 長いプログラム
58
+ <div id="editor6"></div>
59
+ 実行時エラーの表示
60
+ <div id="editor7">Aを表示
61
+ 1のエラー発生
62
+ </div>
63
+ テストの定義にcode lensを表示する
64
+ <div id="editor9">●テスト:足すとは
65
+ ここまで
66
+
67
+ ●テスト:引くとは
68
+ ここまで
69
+ </div>
70
+ <script>
71
+ // text.repeat(n)
72
+ function repeat(text, n) {
73
+ var s = ''
74
+ for (var i = 0; i < n; i++) {
75
+ s += text
76
+ }
77
+ return s
78
+ }
79
+ navigator.nako3.setupEditor("editor1")
80
+ navigator.nako3.setupEditor("editor2")
81
+ navigator.nako3.setupEditor("editor3")
82
+ navigator.nako3.setupEditor("editor4")
83
+ navigator.nako3.setupEditor("editor5")
84
+ navigator.nako3.setupEditor("editor6").editor.setValue(repeat("A=1\nB=2\nA+Bを表示\n", 200), -1)
85
+ navigator.nako3.setupEditor("editor7").run({ preCode: 'A=1\n' }).promise // 他のエディタも連続して実行するならこれをawaitすること。
86
+ navigator.nako3.setupEditor("editor8").editor.setValue(repeat("A=1\nB=2\nA+Bを表示\n", 30), -1)
87
+ navigator.nako3.setupEditor("editor9").codeLensListeners.push({ name: 'test', callback: function () {} })
88
+ </script>
89
+ </body>
90
+ </html>
@@ -0,0 +1,162 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>Nadesiko3 Editor</title>
8
+ <link rel="stylesheet" href="../src/wnako3_editor.css">
9
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/ace.js" integrity="sha512-GZ1RIgZaSc8rnco/8CXfRdCpDxRCphenIiZ2ztLy3XQfCbQUSCuk8IudvNHxkRA3oUg6q0qejgN/qqyG1duv5Q==" crossorigin="anonymous"></script>
10
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/ext-language_tools.min.js" integrity="sha512-8qx1DL/2Wsrrij2TWX5UzvEaYOFVndR7BogdpOyF4ocMfnfkw28qt8ULkXD9Tef0bLvh3TpnSAljDC7uyniEuQ==" crossorigin="anonymous"></script>
11
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/ext-options.min.js" integrity="sha512-oHR+WVzBiVZ6njlMVlDDLUIOLRDfUUfRQ55PfkZvgjwuvGqL4ohCTxaahJIxTmtya4jgyk0zmOxDMuLzbfqQDA==" crossorigin="anonymous"></script>
12
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/ext-code_lens.min.js" integrity="sha512-gsDyyKTnOmSWRDzUbpYcPjzVsEyFGSWeWefzVKvbMULPR2ElIlKKsOtU3ycfybN9kncZXKLFSsUiG3cgJUbc/g==" crossorigin="anonymous"></script>
13
+ <script src="../release/wnako3.js"></script>
14
+ <script src="../release/version.js"></script>
15
+ <script src="../release/plugin_markup.js"></script>
16
+ <script src="../release/plugin_csv.js"></script>
17
+ <script src="../release/plugin_kansuji.js"></script>
18
+ <script src="../release/plugin_datetime.js"></script>
19
+ <script src="../release/plugin_turtle.js"></script>
20
+ <script src="../release/plugin_caniuse.js"></script>
21
+ <script src="../release/plugin_webworker.js"></script>
22
+
23
+ <!-- mochaを一番最後に読み込む必要がある -->
24
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/mocha/8.3.0/mocha.min.js" integrity="sha512-LA/TpBXau/JNubKzHQhdi5vGkRLyQjs1vpuk2W1nc8WNgf/pCqBplD8MzlzeKJQTZPvkEZi0HqBDfRC2EyLMXw==" crossorigin="anonymous"></script>
25
+
26
+ <style>
27
+ /* ボタンの高さを揃える */
28
+ .toolbar button, .toolbar input {
29
+ font-size: 12px;
30
+ height: 28px;
31
+ margin: 0;
32
+ padding: 0;
33
+ box-sizing: border-box;
34
+ vertical-align: top;
35
+ }
36
+
37
+ /* 出力の文字サイズと文字色 */
38
+ #output {
39
+ font-size: 13px;
40
+ color: rgb(77, 77, 77);
41
+ }
42
+ </style>
43
+ </head>
44
+ <body>
45
+ <div class="toolbar">
46
+ <button id="add">📁 ファイルを追加</button>
47
+ <button id="remove">🗑 ファイルを削除</button>
48
+ <span id="file-list"></span>
49
+ </div>
50
+ <div id="editor" data-nako3-resizable="true"></div>
51
+ <div class="toolbar">
52
+ <button id="run">表示中のファイルを実行</button>
53
+ </div>
54
+ <div id="output"></div>
55
+ <script>
56
+ /** @type {import('../src/wnako3.js')} */
57
+ const nako3 = navigator.nako3
58
+ const { editor, editorMarkers, editorTabs, retokenize, run, codeLensListeners } = nako3.setupEditor('editor')
59
+
60
+ /** @type {Map<number, HTMLButtonElement>} */
61
+ const tabButtons = new Map()
62
+ /** @type {Map<number, import('../src/wnako3_editor.js').EditorTabState>} */
63
+ const hiddenTabStates = new Map()
64
+
65
+ let fileCount = 0
66
+ let activeFile = 1
67
+
68
+ // タブの切り替え
69
+ const switchTab = (fileName) => {
70
+ hiddenTabStates.set(activeFile, editorTabs.getTab())
71
+ editorTabs.setTab(hiddenTabStates.get(fileName))
72
+ activeFile = fileName
73
+ }
74
+
75
+ // ファイルの追加
76
+ const addFile = () => {
77
+ const id = ++fileCount
78
+
79
+ // <button class="file">{id}.nako3</button> を挿入する。
80
+ const button = document.createElement('button')
81
+ button.innerText = id + '.nako3'
82
+ button.classList.add('file')
83
+ button.addEventListener('click', () => {
84
+ tabButtons.get(activeFile).disabled = false
85
+ button.disabled = true
86
+ switchTab(id)
87
+ })
88
+ document.getElementById('file-list').appendChild(button)
89
+ tabButtons.set(id, button)
90
+
91
+ // エディタの状態を生成
92
+ hiddenTabStates.set(id, editorTabs.newTab(`// ${id}.nako3\n`))
93
+ }
94
+ document.getElementById('add').addEventListener('click', () => { addFile() })
95
+
96
+ // ファイルの削除
97
+ const removeFile = () => {
98
+ if (tabButtons.size <= 1) {
99
+ alert('全てのファイルを削除することはできません。')
100
+ return
101
+ }
102
+ const input = prompt('削除するファイル名を指定してください。', tabButtons.size + '.nako3')
103
+ if (input === null) {
104
+ return
105
+ }
106
+ const id = +input.replace(/\.nako3$/, '')
107
+ if (!Number.isInteger(id)) {
108
+ alert(`${id}.nako3 は存在しません。`)
109
+ return
110
+ }
111
+ if (id === activeFile) {
112
+ alert(`表示中のファイルは削除できません。`)
113
+ return
114
+ }
115
+ document.getElementById('file-list').removeChild(tabButtons.get(id))
116
+ tabButtons.delete(id)
117
+ }
118
+ document.getElementById('remove').addEventListener('click', () => { removeFile() })
119
+
120
+ // 実行
121
+ document.getElementById('run').addEventListener('click', () => {
122
+ /** @type {Record<string, string>} */
123
+ const localFiles = {}
124
+ for (const [k, v] of hiddenTabStates) {
125
+ localFiles[`${k}.nako3`] = v.content
126
+ }
127
+ run({ outputContainer: document.getElementById('output'), file: `${activeFile}.nako3`, localFiles })
128
+ })
129
+
130
+ // テスト実行
131
+ codeLensListeners.push({
132
+ name: 'test',
133
+ callback: (/** @type {string | undefined} */testName) => {
134
+ /** @type {Record<string, string>} */
135
+ const localFiles = {}
136
+ for (const [k, v] of hiddenTabStates) {
137
+ localFiles[`${k}.nako3`] = v.content
138
+ }
139
+ run({ outputContainer: document.getElementById('output'), file: `${activeFile}.nako3`, localFiles, method: 'test', testName })
140
+ },
141
+ })
142
+
143
+ // 1.nako3の値を設定する
144
+ addFile()
145
+ tabButtons.get(1).disabled = true
146
+ editor.setValue(`\
147
+ !「2.nako3」を取り込む
148
+
149
+ 「1.nako3」を表示
150
+ Aを表示
151
+ `)
152
+ editor.session.selection.clearSelection()
153
+
154
+ // 2.nako3の値を設定する
155
+ addFile()
156
+ hiddenTabStates.get(2).content = `\
157
+ 「2.nako3」を表示
158
+ A=2
159
+ `
160
+ </script>
161
+ </body>
162
+ </html>
@@ -0,0 +1,71 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <title>なでしこ3</title>
7
+ <!-- common -->
8
+ <link rel="stylesheet" type="text/css" href="css/common.css">
9
+ <!-- basic -->
10
+ <link rel="stylesheet" type="text/css" href="css/basic.css">
11
+ <link rel="stylesheet" href="../src/wnako3_editor.css">
12
+ <script src="extlib/ace@1.4.12/ace.js" integrity="sha512-GZ1RIgZaSc8rnco/8CXfRdCpDxRCphenIiZ2ztLy3XQfCbQUSCuk8IudvNHxkRA3oUg6q0qejgN/qqyG1duv5Q==" crossorigin="anonymous"></script>
13
+ <script src="extlib/ace@1.4.12/ext-language_tools.min.js" integrity="sha512-8qx1DL/2Wsrrij2TWX5UzvEaYOFVndR7BogdpOyF4ocMfnfkw28qt8ULkXD9Tef0bLvh3TpnSAljDC7uyniEuQ==" crossorigin="anonymous"></script>
14
+ <script src="extlib/ace@1.4.12/ext-options.min.js" integrity="sha512-oHR+WVzBiVZ6njlMVlDDLUIOLRDfUUfRQ55PfkZvgjwuvGqL4ohCTxaahJIxTmtya4jgyk0zmOxDMuLzbfqQDA==" crossorigin="anonymous"></script>
15
+ <script src="extlib/ace@1.4.12/ext-code_lens.min.js" integrity="sha512-gsDyyKTnOmSWRDzUbpYcPjzVsEyFGSWeWefzVKvbMULPR2ElIlKKsOtU3ycfybN9kncZXKLFSsUiG3cgJUbc/g==" crossorigin="anonymous"></script>
16
+ </head>
17
+ <body>
18
+ <h1>なでしこ3デモ</h1>
19
+ <hr>
20
+ <h3>試してみよう!</h3>
21
+ <div class="sbox">
22
+ <h4>簡単な計算</h4>
23
+ <div class="editor-component">
24
+ <script type="application/json">
25
+ {
26
+ "title": "簡単な計算",
27
+ "code": "1+2を表示。\n100÷5を表示。\n(1 + 2)×3を表示。"
28
+ }
29
+ </script>
30
+ </div>
31
+ </div>
32
+
33
+ <div class="sbox">
34
+ <h4>変数を使った計算</h4>
35
+ <div class="editor-component">
36
+ <script type="application/json">
37
+ {
38
+ "title": "変数を使った計算",
39
+ "code": "価格=500\n個数=3\n税率=0.08\n合計額=価格×個数\n税額=合計額×税率\n支払い=合計額+税額\n「お支払いは、{支払い}円です!」と表示。"
40
+ }
41
+ </script>
42
+ </div>
43
+ </div>
44
+
45
+ <div class="sbox">
46
+ <h4>BMIの計算</h4>
47
+ <div class="editor-component">
48
+ <script type="application/json">
49
+ {
50
+ "title": "BMIの計算",
51
+ "code": "身長=160\n体重=50\n身長M=身長÷100\nBMI=体重÷(身長M×身長M)\n適正体重=身長M×身長M×22\n肥満度=(体重/適正体重)\n「BMI ... {BMI}」を表示。\n「肥満度 ... {肥満度}」を表示。\n「適正体重 ... {適正体重}」を表示。"
52
+ }
53
+ </script>
54
+ </div>
55
+ </div>
56
+
57
+ <div class="sbox">
58
+ <h3>その他</h3>
59
+ <ul>
60
+ <li><a href="browsers.html">対応機器/Webブラウザ</a></li>
61
+ </ul>
62
+ </div>
63
+
64
+ <!-- editor -->
65
+ <!--React.jsのスクリプトはHTMLの末尾で読み込む-->
66
+ <script src="../release/wnako3.js"></script>
67
+ <script src="../release/editor.js"></script>
68
+ <script src="../release/plugin_turtle.js"></script>
69
+ <script src="../release/plugin_markup.js"></script>
70
+ </body>
71
+ </html>
@@ -0,0 +1,128 @@
1
+ <h1>対応機器/ブラウザ</h1>
2
+
3
+ <ul>
4
+ <li>ブラウザ
5
+ <ul>
6
+ <li>モバイル
7
+ <ul>
8
+ <li>Chrome for Android
9
+ <ul>
10
+ <li>80</li>
11
+ </ul>
12
+ </li>
13
+ <li>Firefox for Android
14
+ <ul>
15
+ <li>68</li>
16
+ </ul>
17
+ </li>
18
+ <li>QQ Browser
19
+ <ul>
20
+ <li>1.2</li>
21
+ </ul>
22
+ </li>
23
+ <li>UC Browser for Android
24
+ <ul>
25
+ <li>12.12</li>
26
+ </ul>
27
+ </li>
28
+ <li>Android Browser
29
+ <ul>
30
+ <li>80</li>
31
+ </ul>
32
+ </li>
33
+ <li>Baidu Browser
34
+ <ul>
35
+ <li>7.12</li>
36
+ </ul>
37
+ </li>
38
+ <li>iOS Safari
39
+ <ul>
40
+ <li>13.3</li>
41
+ <li>13.2</li>
42
+ <li>13.0-13.1</li>
43
+ <li>12.2-12.4</li>
44
+ <li>12.0-12.1</li>
45
+ <li>11.3-11.4</li>
46
+ <li>10.3</li>
47
+ <li>9.3</li>
48
+ </ul>
49
+ </li>
50
+ <li>KaiOS Browser
51
+ <ul>
52
+ <li>2.5</li>
53
+ </ul>
54
+ </li>
55
+ <li>Opera Mini
56
+ <ul>
57
+ <li>all</li>
58
+ </ul>
59
+ </li>
60
+ <li>Opera Mobile
61
+ <ul>
62
+ <li>46</li>
63
+ </ul>
64
+ </li>
65
+ <li>Samsung Internet
66
+ <ul>
67
+ <li>11.1</li>
68
+ <li>10.1</li>
69
+ </ul>
70
+ </li>
71
+ </ul>
72
+ </li>
73
+ <li>PC
74
+ <ul>
75
+ <li>Chrome
76
+ <ul>
77
+ <li>80</li>
78
+ <li>79</li>
79
+ <li>49</li>
80
+ </ul>
81
+ </li>
82
+ <li>Edge
83
+ <ul>
84
+ <li>80</li>
85
+ <li>79</li>
86
+ <li>18</li>
87
+ </ul>
88
+ </li>
89
+ <li>Firefox
90
+ <ul>
91
+ <li>74</li>
92
+ <li>73</li>
93
+ <li>72</li>
94
+ <li>68</li>
95
+ </ul>
96
+ </li>
97
+ <li>Internet Explorer
98
+ <ul>
99
+ <li>11</li>
100
+ </ul>
101
+ </li>
102
+ <li>Opera
103
+ <ul>
104
+ <li>66</li>
105
+ <li>65</li>
106
+ </ul>
107
+ </li>
108
+ <li>Safari
109
+ <ul>
110
+ <li>13</li>
111
+ <li>12.1</li>
112
+ </ul>
113
+ </li>
114
+ </ul>
115
+ </li>
116
+ </ul>
117
+ </li>
118
+ <li>PC (Windows/macOS/Linux)
119
+ <ul>
120
+ <li>Node
121
+ <ul>
122
+ <li>12.16.0</li>
123
+ <li>10.19.0</li>
124
+ </ul>
125
+ </li>
126
+ </ul>
127
+ </li>
128
+ </ul>
@@ -0,0 +1,3 @@
1
+ .sbox {
2
+ border: 1px solid gray;
3
+ }