zimjs 15.0.1 → 15.0.2

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 (2) hide show
  1. package/README.md +115 -88
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -83,8 +83,9 @@ zim.zimplify();
83
83
  zim.zimplify([Blob, Window]);
84
84
  ```
85
85
 
86
- ## VUE, SVELTE, REACT, etc.
86
+ ## VUE, SVELTE, REACT, ANGULAR
87
87
  ZIM can be used in other frameworks. Thank you <a href=https://github.com/yoanhg421>@yoanhg421</a> for the setup<br>
88
+ See https://github.com/yoanhg421/zimjs-templates for full files.<br>
88
89
  ### VUE - with zim namespace
89
90
  ```javascript
90
91
  <script setup>
@@ -223,99 +224,125 @@ ZIM can be used in other frameworks. Thank you <a href=https://github.com/yoanhg
223
224
  ```
224
225
  ### REACT - with zim namespace
225
226
  ```javascript
226
- <script>
227
- import { Component, ReactNode, StrictMode } from "react";
228
- import "./App.css";
229
- import zim from "zimjs";
230
-
231
- class ZimFrame extends Component {
232
- frame: zim.Frame | undefined;
233
-
234
- componentDidMount(): void {
235
- this.frame = new zim.Frame({
236
- scaling: "zim",
237
- width: 500,
238
- height: 400,
239
- color:light,
240
- ready: () => {
241
- // put code here
242
- new zim.Circle(50, red).center().drag();
243
- }
244
- });
245
- }
246
- componentWillUnmount(): void {
247
- this.frame?.dispose();
248
- }
249
- render(): ReactNode {
250
- return null;
251
- }
252
- }
227
+ import { Component, ReactNode, StrictMode } from "react";
228
+ import "./App.css";
229
+ import zim from "zimjs";
253
230
 
254
- function App() {
255
- return (
256
- <>
257
- <div>
258
- {/* Move StrictMove from the root to here */}
259
- <StrictMode>
260
- <div id='zim'></div>
261
- </StrictMode>
262
- {/* Include ZIM code outside StrictMode */}
263
- <ZimFrame />
264
- </div>
265
- </>
266
- )
267
- }
268
- export default App;
269
- </script>
231
+ class ZimFrame extends Component {
232
+ frame: zim.Frame | undefined;
233
+
234
+ componentDidMount(): void {
235
+ this.frame = new zim.Frame({
236
+ scaling: "zim",
237
+ width: 500,
238
+ height: 400,
239
+ color:light,
240
+ ready: () => {
241
+ // put code here
242
+ new zim.Circle(50, red).center().drag();
243
+ }
244
+ });
245
+ }
246
+ componentWillUnmount(): void {
247
+ this.frame?.dispose();
248
+ }
249
+ render(): ReactNode {
250
+ return null;
251
+ }
252
+ }
253
+
254
+ function App() {
255
+ return (
256
+ <>
257
+ <div>
258
+ {/* Move StrictMove from the root to here */}
259
+ <StrictMode>
260
+ <div id='zim'></div>
261
+ </StrictMode>
262
+ {/* Include ZIM code outside StrictMode */}
263
+ <ZimFrame />
264
+ </div>
265
+ </>
266
+ )
267
+ }
268
+ export default App;
270
269
  ```
271
270
  ### REACT - without zim namespace
272
271
  ```javascript
273
- <script>
274
- import { Component, ReactNode, StrictMode } from "react";
275
- import "./App.css";
276
- import zim from "zimjs";
277
-
278
- zim.zimplify(); // make zim commands global
272
+ import { Component, ReactNode, StrictMode } from "react";
273
+ import "./App.css";
274
+ import zim from "zimjs";
279
275
 
280
- class ZimFrame extends Component {
281
- frame: Frame | undefined;
282
-
283
- componentDidMount(): void {
284
- this.frame = new Frame({
285
- scaling: "zim",
286
- width: 500,
287
- height: 400,
288
- color:light,
289
- ready: () => {
290
- // put code here
291
- new Circle(50, red).center().drag();
292
- }
293
- });
294
- }
295
- componentWillUnmount(): void {
296
- this.frame?.dispose();
297
- }
298
- render(): ReactNode {
299
- return null;
300
- }
301
- }
276
+ zim.zimplify(); // make zim commands global
277
+
278
+ class ZimFrame extends Component {
279
+ frame: Frame | undefined;
280
+
281
+ componentDidMount(): void {
282
+ this.frame = new Frame({
283
+ scaling: "zim",
284
+ width: 500,
285
+ height: 400,
286
+ color:light,
287
+ ready: () => {
288
+ // put code here
289
+ new Circle(50, red).center().drag();
290
+ }
291
+ });
292
+ }
293
+ componentWillUnmount(): void {
294
+ this.frame?.dispose();
295
+ }
296
+ render(): ReactNode {
297
+ return null;
298
+ }
299
+ }
300
+
301
+ function App() {
302
+ return (
303
+ <>
304
+ <div>
305
+ {/* Move StrictMove from the root to here */}
306
+ <StrictMode>
307
+ <div id='zim'></div>
308
+ </StrictMode>
309
+ {/* Include ZIM code outside StrictMode */}
310
+ <ZimFrame />
311
+ </div>
312
+ </>
313
+ )
314
+ }
315
+ export default App;
316
+ ```
317
+ ### ANGULAR - with zim namespace and TypeScript (always)
318
+ ```javascript
319
+ import { AfterContentInit, Component, OnDestroy } from '@angular/core';
320
+ import { Frame, Circle } from 'zimjs';
321
+
322
+ @Component({
323
+ selector: 'app-root',
324
+ templateUrl: './app.component.html',
325
+ styleUrls: ['./app.component.css']
326
+ })
327
+ export class AppComponent implements OnDestroy, AfterContentInit {
328
+ frame: Frame | undefined;
329
+ ngOnDestroy(): void {
330
+ this.frame?.dispose();
331
+ }
332
+
333
+ ngAfterContentInit(): void {
334
+ this.frame = new Frame({
335
+ scaling: FIT,
336
+ width: 600,
337
+ height: 300,
338
+ ready: () => {
339
+ new Circle(50, red).center().drag();
340
+ },
341
+ });
342
+ }
302
343
 
303
- function App() {
304
- return (
305
- <>
306
- <div>
307
- {/* Move StrictMove from the root to here */}
308
- <StrictMode>
309
- <div id='zim'></div>
310
- </StrictMode>
311
- {/* Include ZIM code outside StrictMode */}
312
- <ZimFrame />
313
- </div>
314
- </>
315
- )
316
- }
317
- export default App;
318
- </script>
344
+ title = 'ZIM in Angular';
345
+ }
319
346
  ```
320
347
 
321
348
  ## Issues & Community
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zimjs",
3
- "version": "15.0.1",
3
+ "version": "15.0.2",
4
4
  "type": "module",
5
5
  "main": "./dist/zim.js",
6
6
  "types": "./dist/typings/zim",