zimjs 15.0.6 → 15.0.7

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.
package/README.md CHANGED
@@ -51,7 +51,6 @@ ZIM CODEPEN TOPIC<br>
51
51
  https://codepen.io/topic/zim/
52
52
 
53
53
  ZIM LEARN has many code and video tutorials including:<br>
54
-
55
54
  ZIM Bits - 64 common techniques, ZIM Capture, What IZ tutorials, ZIM Badges, Code Zero and more!<br>
56
55
  https://zimjs.com/learn.html
57
56
 
@@ -69,23 +68,121 @@ to see descriptions, examples, methods, properties, events, source, bits, vids,
69
68
  https://zimjs.com/docs.html
70
69
 
71
70
  ## NPM
72
- Here is ZIM on NPM: https://www.npmjs.com/package/zimjs
73
- Use:
71
+ Here is ZIM on NPM: https://www.npmjs.com/package/zimjs<br>
72
+ These steps describe setting up ZIM with Vite and NPM for vanilla JavaScript or TypeScript.<br>
73
+ There are also templates for VUE, Svelte, React and Angular further down.
74
+
75
+ A. SETUP<br>
76
+ - Open a folder in an IDE such as VS Code (The project folder will be made inside this folder)
77
+ - Open a terminal - see Terminal in the menu - or CTRL SHIFT `
78
+ - Check to see if you have node - type: <pre>node - v
79
+ - If not then install from https://nodejs.org
80
+ - Run Vite - type: <pre>npm create vite</pre>
81
+ - If this needs to install, press y for yes
82
+ - Give the project a name - it will make a directory
83
+ - Select a framework - use arrow to see all options
84
+ - Eg. choose Vanilla
85
+ - Select a variant
86
+ - Eg. choose JavaScript
87
+ - Change to your project folder - type: <pre>cd yourProject</pre>
88
+ - Get the ZIM package and dependencies - type: <pre>npm i zimjs</pre>
89
+
90
+ B. TEMPLATE<br>
91
+ - replace the code in main.js with the template:
74
92
  ```javascript
93
+ // ZIM - JavaScript Canvas Framework - https://zimjs.com - code creativity
75
94
  import zim from "zimjs";
76
- // or
77
- import {Frame, Circle} from "zimjs";
78
95
 
79
- // to remove the zim namespace requirement on all use:
80
- zim.zimplify();
96
+ // make ZIM global - if this is not used then would use zim.Frame() and zim.Circle()
97
+ zimplify();
98
+
99
+ // or make all globals except need to use zim.Blob and zim.Window
100
+ // these are two classes that have occassionally conflicted with other libraries
101
+ // zimplify(["Blob", "Window"]);
102
+
103
+ // See Docs under Frame for FIT, FILL, FULL, and TAG
104
+ new Frame(FIT, 1024, 768, light, dark, ready);
105
+ function ready() {
106
+
107
+ // given F (Frame), S (Stage), W (width), H (height)
108
+ // put code here
109
+
110
+ new Circle(100, purple)
111
+ .center()
112
+ .drag();
113
+
114
+ } // end ready
115
+ ```
116
+ - or with TypeScript - replace the src/main.ts code with:
117
+ ```javascript
118
+ // ZIM - JavaScript Canvas Framework - https://zimjs.com - code creativity
119
+ import {Frame, Circle} from "zimjs";
81
120
 
82
- // or make all globals but use zim.Blob and zim.Window (two potential culprits)
83
- zim.zimplify([Blob, Window]);
121
+ // See Docs under Frame for FIT, FILL, FULL, and TAG
122
+ new Frame(FIT, 1024, 768, light, dark, ready);
123
+ function ready() {
124
+
125
+ // given F (Frame), S (Stage), W (width), H (height)
126
+ // put code here
127
+
128
+ new Circle(100, purple)
129
+ .center()
130
+ .drag();
131
+
132
+ } // end ready
133
+ ```
134
+ - In the index.html file, replace the Vite icon with:
135
+ ```html
136
+ <link rel="apple-touch-icon-precomposed" sizes="57x57" href="https://zimjs.com/icons/apple-touch-icon-57x57.png" />
137
+ <link rel="apple-touch-icon-precomposed" sizes="114x114" href="https://zimjs.com/icons/apple-touch-icon-114x114.png" />
138
+ <link rel="apple-touch-icon-precomposed" sizes="72x72" href="https://zimjs.com/icons/apple-touch-icon-72x72.png" />
139
+ <link rel="apple-touch-icon-precomposed" sizes="144x144" href="https://zimjs.com/icons/apple-touch-icon-144x144.png" />
140
+ <link rel="apple-touch-icon-precomposed" sizes="60x60" href="https://zimjs.com/icons/apple-touch-icon-60x60.png" />
141
+ <link rel="apple-touch-icon-precomposed" sizes="120x120" href="https://zimjs.com/icons/apple-touch-icon-120x120.png" />
142
+ <link rel="apple-touch-icon-precomposed" sizes="76x76" href="https://zimjs.com/icons/apple-touch-icon-76x76.png" />
143
+ <link rel="apple-touch-icon-precomposed" sizes="152x152" href="https://zimjs.com/icons/apple-touch-icon-152x152.png" />
144
+ <link rel="apple-touch-icon-precomposed" sizes="180x180" href="https://zimjs.com/icons/apple-touch-icon.png" />
145
+ <link rel="icon" type="image/png" sizes="32x32" href="https://zimjs.com/icons/favicon-32x32.png" />
146
+ <link rel="icon" type="image/png" sizes="192x192" href="https://zimjs.com/icons/android-chrome-192x192.png" />
147
+ <link rel="icon" type="image/png" sizes="512x512" href="https://zimjs.com/icons/android-chrome-512x512.png" />
84
148
  ```
149
+ - Replace the title with your app title
150
+
151
+ C. DEVELOPMENT
152
+ - Start a Dev server - type: <pre>npm run dev</pre>
153
+ - Alt-click the Local link in the terminal
154
+ - This opens up a browser to see the file with the purple circle
155
+ - Make edits to your ZIM app
156
+ - See https://zimjs.com/learn for how to use ZIM
157
+ - See https://zimjs.co/docs for reference to commands
158
+ - When done developing use CTRL C to exit the dev terminal
159
+
160
+ D. DEPLOYMENT
161
+ - Bundle the files for distribution - type:<pre>npm run build</pre>
162
+ - This makes a dist/ folder with the minified code
163
+ - Currently, Vite puts the js code in /assets/
164
+ - Which means to run it in a browser, it needs to be in the root
165
+ - Or you can remove the / and use assets/ to run relatively
166
+ - like with "open in default browser" extension locally
167
+ - For local images and sounds see https://zimjs.com/tips.html#IMAGES
168
+
169
+ E. NOTICE
170
+ - ZIM is a front-end framework at https://zimjs.com
171
+ - We make so much without npm at all...
172
+ - You can avoid all of the above by going to https://zimjs.com/code
173
+ - pressing the copy button and pasting into an empty html file
174
+ - Then view the html file in a browser
175
+ - This takes 1 minute and kids can do it
176
+ - You can also use ZIM online at https://zimjs.com/editor
177
+
178
+ F. OTHER FRAMEWORKS
179
+ - See the sections below for using ZIM with other frameworks
180
+ - The setup is the same as above but the app code is as follows
85
181
 
86
182
  ## VUE, SVELTE, REACT, ANGULAR
87
183
  ZIM can be used in other frameworks. Thank you <a href=https://github.com/yoanhg421>@yoanhg421</a> for the setup<br>
88
184
  See https://github.com/yoanhg421/zimjs-templates for full files.<br>
185
+ Follow the SETUP instructions above and then adjust the code as follows:<br>
89
186
  ### VUE - with zim namespace
90
187
  ```javascript
91
188
  <script setup>