generated from dynaboard/template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdynaboard.yml
982 lines (953 loc) · 24.7 KB
/
dynaboard.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
runtimeVersion: 0.4.0
name: Simple Calculator
description: A simple calcuator program
type: com.dynaboard/project
nodes:
ROOT_NODE:
type: ROOT_NODE
name: ROOT_NODE
slots:
themes:
- nodeID: b883a7ba-0ce2-4bf0-9ac6-1895e8e819e5
orderKey: a0
pages:
- nodeID: 5513f466-9af1-4f8b-97b1-df1e12fe955c
orderKey: a0
resources:
- nodeID: fa4847ca-2dfe-4d21-a985-5f0ba17a2d0c
orderKey: a3
properties:
selectedTheme: b883a7ba-0ce2-4bf0-9ac6-1895e8e819e5
01ef9382-9814-4cea-99eb-b67a1d420723:
type: CONTAINER
name: app
slots:
canvas:
- nodeID: 374e8df4-2a48-46fd-acaf-d81a29aadcd1
orderKey: a0
properties:
top: '12'
heightMode: FIXED
height: '34'
widthMode: FILL
width: '12'
boxShadow: '0'
layoutStyle: HORIZONTAL_STACK
distributeContent: center
alignContent: center
spacing: '0'
backgroundColor: transparent
025b6bb8-2ba4-4cac-a4c0-735c4781e8d2:
type: BUTTON
name: seven
properties:
top: '8'
left: '32'
heightMode: FIXED
height: 64px
widthMode: FIXED
width: 64px
text: '7'
onClick:
function:
ref: 42aed45d-7fbe-47ea-8178-7f8a3629f5de
backgroundColor: accent.purple.400
padding: 8px
065092ff-8afa-43cb-9b2b-daaac913ac1d:
type: FUNCTION
name: divide
properties:
value: ''
action:
targetNode:
ref: fa4847ca-2dfe-4d21-a985-5f0ba17a2d0c
actionType: CALL_CLIENT_FUNCTION
code: |-
const screenVal = +String(calcScreen.value ?? "0").trim() ?? 0
register1.value = screenVal
register2.value = "÷"
calcScreen.value = " "
return screenVal
onSuccess: ''
onFailure: ''
0f3d50f9-bc38-4849-95cb-88a71d700fc9:
type: CONTAINER
name: row2
slots:
canvas:
- nodeID: 5abcea7f-8b70-492e-ba62-3d3978870451
orderKey: Zw
- nodeID: 4f6d1b9a-3661-41f0-b91d-d011e3fc2753
orderKey: Zx
- nodeID: 2bad68b6-d2ac-4681-83aa-264b75728e8e
orderKey: Zy
- nodeID: a81d8c41-a5c0-4e07-bc47-456f4a3689c9
orderKey: Zz
- nodeID: 12fe8e7d-5882-42e5-bb0c-5d4120b82145
orderKey: a0
properties:
top: '240'
left: '96'
heightMode: FIXED
height: 72px
widthMode: FILL
width: fill
boxShadow: '0'
layoutStyle: HORIZONTAL_STACK
distributeContent: ''
padding: '4'
spacing: 8px
backgroundColor: transparent
10233c3c-15f1-4d63-940e-c39b48439dee:
type: BUTTON
name: clearButton
properties:
top: '40'
left: '400'
heightMode: FIXED
height: fill
widthMode: FILL
width: 96px
text: Clear
onClick:
function:
ref: b75dcae7-335e-4c3d-8301-b9d5cf5ef9cc
backgroundColor: accent.purple.400
padding: 8px
127e07a8-d794-4fd1-a848-a33203c3eb66:
type: BUTTON
name: one
properties:
top: '32'
left: '32'
heightMode: FIXED
height: 64px
widthMode: FIXED
width: 64px
text: '1'
onClick:
function:
ref: 7107ca8e-5555-44b7-adc2-478c6fd7e15d
backgroundColor: accent.purple.400
padding: 8px
12fe8e7d-5882-42e5-bb0c-5d4120b82145:
type: BUTTON
name: modbutton
properties:
heightMode: FIXED
height: fill
widthMode: FILL
width: 96px
text: modulo
onClick:
function:
ref: eda1b99b-13d0-4354-bf1a-6099ca5b1b37
backgroundColor: accent.purple.400
padding: 8px
20a77996-e255-4996-861e-ef4922070bd3:
type: TEXT
name: text1
properties:
top: '32'
left: '16'
heightMode: FILL
height: fill
widthMode: FIXED
width: 50px
styles: |-
element.styles {
font-size: 64px;
background: transparent;
font-weight: 700;
font-family: monospace;
border-radius: 8px;
text-align: right;
padding: 4px 8px;
}
value: '{{register2.value}}'
overflow: auto
226769f0-5241-4754-9de9-099c0cde3ecd:
type: FUNCTION
name: type5
properties:
value: ''
action:
targetNode:
ref: fa4847ca-2dfe-4d21-a985-5f0ba17a2d0c
actionType: CALL_CLIENT_FUNCTION
code: |-
calcScreen.value = (calcScreen.value ?? "") + "5"
return calcScreen.value
onSuccess: ''
onFailure: ''
2bad68b6-d2ac-4681-83aa-264b75728e8e:
type: BUTTON
name: six
properties:
top: '32'
left: '336'
heightMode: FIXED
height: 64px
widthMode: FIXED
width: 64px
text: '6'
onClick:
function:
ref: 74258f4c-b7bd-4575-b726-4ac39f76cb07
backgroundColor: accent.purple.400
padding: 8px
348f891d-cd13-43cb-a854-265481ff9443:
type: BUTTON
name: times
properties:
top: '32'
left: '288'
heightMode: FIXED
height: 64px
widthMode: FIXED
width: 64px
text: x
onClick:
function:
ref: 91e30ace-1cb1-4350-9247-f07050296bf5
backgroundColor: accent.purple.400
padding: 8px
374e8df4-2a48-46fd-acaf-d81a29aadcd1:
type: CONTAINER
name: calculatorBody
slots:
canvas:
- nodeID: f77bea61-4afb-4917-9466-439fe1122f6a
orderKey: Zz
- nodeID: 812931ba-c14f-465e-9860-13aa948ff82e
orderKey: ZzG
properties:
top: NaN
left: NaN
heightMode: FIXED
height: 448px
widthMode: FIXED
width: 448px
styles: |-
element.styles {
border-radius: 16px;
border: 3px solid #000;
}
boxShadow: lg
layoutStyle: VERTICAL_STACK
distributeContent: ''
backgroundColor: surface.200
38076ba6-1008-4ff4-b793-7fc09594f570:
type: TEXT
name: calcScreen
properties:
top: '0'
left: '80'
heightMode: FILL
height: fill
widthMode: FILL
width: 352px
styles: |-
element.styles {
font-size: 64px;
line-height: 64px;
background: transparent;
font-weight: 700;
font-family: monospace;
border-radius: 8px;
text-align: right;
padding: 4px 8px;
}
value: ' '
fontSize: sm
textAlign: right
fontWeight: '700'
overflowX: hidden
overflowY: hidden
overflow: auto
textOverflow: clip
42aed45d-7fbe-47ea-8178-7f8a3629f5de:
type: FUNCTION
name: type7
properties:
value: ''
action:
targetNode:
ref: fa4847ca-2dfe-4d21-a985-5f0ba17a2d0c
actionType: CALL_CLIENT_FUNCTION
code: |-
calcScreen.value = (calcScreen.value ?? "") + "7"
return calcScreen.value
onSuccess: ''
onFailure: ''
42e3a26c-dd32-4636-91c1-e456f5c6d881:
type: FUNCTION
name: type0
properties:
value: ''
action:
targetNode:
ref: fa4847ca-2dfe-4d21-a985-5f0ba17a2d0c
actionType: CALL_CLIENT_FUNCTION
code: |-
calcScreen.value = (calcScreen.value ?? "") + "0"
return calcScreen.value
onSuccess: ''
onFailure: ''
4ae87ece-de5a-4d34-8c2e-eb6c11772080:
type: BUTTON
name: dividebutton
properties:
top: '32'
left: '288'
heightMode: FIXED
height: 64px
widthMode: FIXED
width: 64px
styles: |-
element.styles {
font-size: 18px;
}
text: ÷
onClick:
function:
ref: 065092ff-8afa-43cb-9b2b-daaac913ac1d
backgroundColor: accent.purple.400
padding: 8px
4b673347-e5f0-42b9-9e35-ed5f0a305fde:
type: BUTTON
name: three
properties:
top: '32'
left: '320'
heightMode: FIXED
height: 64px
widthMode: FIXED
width: 64px
text: '3'
onClick:
function:
ref: 99af1ce0-1477-40f6-87ac-90b33432ee5c
backgroundColor: accent.purple.400
padding: 8px
4f6d1b9a-3661-41f0-b91d-d011e3fc2753:
type: BUTTON
name: five
properties:
top: '32'
left: '176'
heightMode: FIXED
height: 64px
widthMode: FIXED
width: 64px
text: '5'
onClick:
function:
ref: 226769f0-5241-4754-9de9-099c0cde3ecd
backgroundColor: accent.purple.400
padding: 8px
5430b404-f44a-4a1f-aa3a-49b369edcc79:
type: FUNCTION
name: type4
properties:
value: ''
action:
targetNode:
ref: fa4847ca-2dfe-4d21-a985-5f0ba17a2d0c
actionType: CALL_CLIENT_FUNCTION
code: |-
calcScreen.value = (calcScreen.value ?? "") + "4"
return calcScreen.value
onSuccess: ''
onFailure: ''
5513f466-9af1-4f8b-97b1-df1e12fe955c:
type: PAGE
name: index
slots:
functions:
- nodeID: af0b49b3-ba0e-4c78-aa7c-2ff034742ac3
orderKey: a4
- nodeID: eda1b99b-13d0-4354-bf1a-6099ca5b1b37
orderKey: a48
- nodeID: 065092ff-8afa-43cb-9b2b-daaac913ac1d
orderKey: a4G
- nodeID: 91e30ace-1cb1-4350-9247-f07050296bf5
orderKey: a4V
- nodeID: c1546291-b3f5-4cbd-8437-0192cea31b36
orderKey: a5
- nodeID: fd36ae4c-f161-4074-92b1-881fed6e42d4
orderKey: a6
- nodeID: 58051bb0-2d96-46b8-a33a-5f92a197fdc0
orderKey: a7
- nodeID: eba87622-4a71-4bc5-a76d-d2781df51c30
orderKey: a8
- nodeID: 42aed45d-7fbe-47ea-8178-7f8a3629f5de
orderKey: a9
- nodeID: 74258f4c-b7bd-4575-b726-4ac39f76cb07
orderKey: aA
- nodeID: 226769f0-5241-4754-9de9-099c0cde3ecd
orderKey: aB
- nodeID: 5430b404-f44a-4a1f-aa3a-49b369edcc79
orderKey: aC
- nodeID: 99af1ce0-1477-40f6-87ac-90b33432ee5c
orderKey: aCV
- nodeID: 89fb386a-d6bd-4a2e-b93f-e44c382ce8e1
orderKey: aE
- nodeID: 7107ca8e-5555-44b7-adc2-478c6fd7e15d
orderKey: aF
- nodeID: 42e3a26c-dd32-4636-91c1-e456f5c6d881
orderKey: aG
- nodeID: b75dcae7-335e-4c3d-8301-b9d5cf5ef9cc
orderKey: a6V
variables:
- nodeID: eb7439a4-1169-4b6e-827e-09830ac16741
orderKey: aI
- nodeID: e7e27edc-ebac-4357-8eeb-8618a0c14c2a
orderKey: aJ
canvas:
- nodeID: 75e90fc6-a3ef-401c-bea0-f89738deffdb
orderKey: a4
- nodeID: 01ef9382-9814-4cea-99eb-b67a1d420723
orderKey: a5
properties:
gridRowHeight: 16px
title: Simple Calculator
padding: '4'
spacing: '4'
columnSize: 79.328125
rowSize: 16
headerProps: {}
leftSidebarProps: {}
rightSidebarProps: {}
footerProps: {}
58051bb0-2d96-46b8-a33a-5f92a197fdc0:
type: FUNCTION
name: type9
properties:
value: ''
action:
targetNode:
ref: fa4847ca-2dfe-4d21-a985-5f0ba17a2d0c
actionType: CALL_CLIENT_FUNCTION
code: |-
calcScreen.value = (calcScreen.value ?? "") + "9"
return calcScreen.value
onSuccess: ''
onFailure: ''
5abcea7f-8b70-492e-ba62-3d3978870451:
type: BUTTON
name: four
properties:
top: '16'
left: '32'
heightMode: FIXED
height: 64px
widthMode: FIXED
width: 64px
text: '4'
onClick:
function:
ref: 5430b404-f44a-4a1f-aa3a-49b369edcc79
backgroundColor: accent.purple.400
padding: 8px
5ffa49b8-fbe7-482a-a06e-8359a373f9de:
type: BUTTON
name: equalsbutton
properties:
heightMode: FIXED
height: fill
widthMode: FILL
width: 96px
text: '='
onClick:
function:
ref: af0b49b3-ba0e-4c78-aa7c-2ff034742ac3
backgroundColor: accent.purple.400
padding: 8px
7107ca8e-5555-44b7-adc2-478c6fd7e15d:
type: FUNCTION
name: type1
properties:
value: ''
action:
targetNode:
ref: fa4847ca-2dfe-4d21-a985-5f0ba17a2d0c
actionType: CALL_CLIENT_FUNCTION
code: |-
calcScreen.value = (calcScreen.value ?? "") + "1"
return calcScreen.value
onSuccess: ''
onFailure: ''
74258f4c-b7bd-4575-b726-4ac39f76cb07:
type: FUNCTION
name: type6
properties:
value: ''
action:
targetNode:
ref: fa4847ca-2dfe-4d21-a985-5f0ba17a2d0c
actionType: CALL_CLIENT_FUNCTION
code: |-
calcScreen.value = (calcScreen.value ?? "") + "6"
return calcScreen.value
onSuccess: ''
onFailure: ''
75e90fc6-a3ef-401c-bea0-f89738deffdb:
type: CONTAINER
name: Readme
slots:
canvas:
- nodeID: b41fc109-374f-42cb-bd2e-30bae23e4a33
orderKey: a0
properties:
heightMode: AUTO
height: '13'
widthMode: FILL
width: '12'
layoutStyle: HORIZONTAL_STACK
alignContent: center
812931ba-c14f-465e-9860-13aa948ff82e:
type: CONTAINER
name: buttonsContainer
slots:
canvas:
- nodeID: d1017f94-3ca8-40d2-9c30-a3cde7eec616
orderKey: Zx
- nodeID: 0f3d50f9-bc38-4849-95cb-88a71d700fc9
orderKey: Zy
- nodeID: 87dd0e5e-cd51-4180-839a-1c231d3002e6
orderKey: Zz
- nodeID: 850e6f07-738f-4f8d-b88e-45f3a8bb79fb
orderKey: a0
properties:
top: '208'
left: '144'
heightMode: FIXED
height: 304px
widthMode: FILL
width: fill
boxShadow: '0'
layoutStyle: VERTICAL_STACK
distributeContent: ''
padding: '0'
spacing: 4px
backgroundColor: transparent
850e6f07-738f-4f8d-b88e-45f3a8bb79fb:
type: CONTAINER
name: row4
slots:
canvas:
- nodeID: f39e845a-518c-420a-a459-7bebb24019dd
orderKey: Zz
- nodeID: 348f891d-cd13-43cb-a854-265481ff9443
orderKey: a0
properties:
top: '336'
left: '48'
heightMode: FIXED
height: 72px
widthMode: FILL
width: fill
boxShadow: '0'
layoutStyle: HORIZONTAL_STACK
distributeContent: ''
padding: 4px
spacing: 8px
backgroundColor: transparent
87dd0e5e-cd51-4180-839a-1c231d3002e6:
type: CONTAINER
name: row3
slots:
canvas:
- nodeID: 127e07a8-d794-4fd1-a848-a33203c3eb66
orderKey: Zu
- nodeID: eee607ed-ccc6-4f98-9fa2-c4442fb11eab
orderKey: Zv
- nodeID: 4b673347-e5f0-42b9-9e35-ed5f0a305fde
orderKey: Zy
- nodeID: 4ae87ece-de5a-4d34-8c2e-eb6c11772080
orderKey: Zz
- nodeID: 5ffa49b8-fbe7-482a-a06e-8359a373f9de
orderKey: a0
properties:
top: '368'
left: '128'
heightMode: FIXED
height: 72px
widthMode: FILL
width: fill
boxShadow: '0'
layoutStyle: HORIZONTAL_STACK
distributeContent: ''
padding: 4px
spacing: 8px
backgroundColor: transparent
89fb386a-d6bd-4a2e-b93f-e44c382ce8e1:
type: FUNCTION
name: type2
properties:
value: ''
action:
targetNode:
ref: fa4847ca-2dfe-4d21-a985-5f0ba17a2d0c
actionType: CALL_CLIENT_FUNCTION
code: |-
calcScreen.value = (calcScreen.value ?? "") + "2"
return calcScreen.value
onSuccess: ''
onFailure: ''
91e30ace-1cb1-4350-9247-f07050296bf5:
type: FUNCTION
name: multiply
properties:
value: ''
action:
targetNode:
ref: fa4847ca-2dfe-4d21-a985-5f0ba17a2d0c
actionType: CALL_CLIENT_FUNCTION
code: |-
const screenVal = +String(calcScreen.value ?? "0").trim() ?? 0
register1.value = screenVal
register2.value = "x"
calcScreen.value = " "
return screenVal
onSuccess: ''
onFailure: ''
98b0e93b-f3e6-417f-bb7d-5b17a2593143:
type: BUTTON
name: nine
properties:
top: '8'
left: '128'
heightMode: FIXED
height: 64px
widthMode: FIXED
width: 64px
styles: |-
element.styles {
}
text: '9'
onClick:
function:
ref: 58051bb0-2d96-46b8-a33a-5f92a197fdc0
backgroundColor: accent.purple.400
padding: 8px
99af1ce0-1477-40f6-87ac-90b33432ee5c:
type: FUNCTION
name: type3
properties:
value: ''
action:
targetNode:
ref: fa4847ca-2dfe-4d21-a985-5f0ba17a2d0c
actionType: CALL_CLIENT_FUNCTION
code: |-
calcScreen.value = (calcScreen.value ?? "") + "3"
return calcScreen.value
onSuccess: ''
onFailure: ''
a3a8ca58-06e2-4a21-8b90-6458e39081fe:
type: BUTTON
name: eight
properties:
top: '8'
left: '80'
heightMode: FIXED
height: 64px
widthMode: FIXED
width: 64px
text: '8'
onClick:
function:
ref: eba87622-4a71-4bc5-a76d-d2781df51c30
backgroundColor: accent.purple.400
padding: 8px
a81d8c41-a5c0-4e07-bc47-456f4a3689c9:
type: BUTTON
name: minus
properties:
top: '40'
left: '272'
heightMode: FIXED
height: 64px
widthMode: FIXED
width: 64px
text: '-'
onClick:
function:
ref: c1546291-b3f5-4cbd-8437-0192cea31b36
backgroundColor: accent.purple.400
padding: 8px
af0b49b3-ba0e-4c78-aa7c-2ff034742ac3:
type: FUNCTION
name: equals
properties:
value: ''
action:
targetNode:
ref: fa4847ca-2dfe-4d21-a985-5f0ba17a2d0c
actionType: CALL_CLIENT_FUNCTION
code: |-
function handleEquals() {
const registerVal = +(register1.value ?? "0")
const screenVal = +String(calcScreen.value ?? "0").trim() ?? 0
const lastOperand = register2.value.trim()
if (!lastOperand || !lastOperand.length) {
return registerVal
} else if (lastOperand === "+") {
return registerVal + screenVal
} else if (lastOperand === "-") {
return registerVal - screenVal
} else if (lastOperand === "x") {
return registerVal * screenVal
} else if (lastOperand === "÷") {
if (registerVal !== 0) {
return registerVal / screenVal
} else {
return 0
}
} else if (lastOperand === "%") {
return registerVal % screenVal
}
}
const result = handleEquals()
register1.value = 0
register2.value = " "
calcScreen.value = String(result ?? 0)
return result
onSuccess: ''
onFailure: ''
b41fc109-374f-42cb-bd2e-30bae23e4a33:
type: TEXT
name: text2
properties:
top: '32'
left: '64'
heightMode: FILL
height: fill
widthMode: FILL
width: fill
value: >-
# Simple Calculator
**Supports addition, subtraction, multiplication, division, and
modulo.**
To use, simply press the buttons to type in a number, an operation, then
another number, then press the equals button. Clear removes all state.
lineHeight: '1.5'
styles: |-
element.styles {
h1, h2, h3, p {
margin-bottom: 10px;
}
}
renderMode: markdown
overflow: auto
b75dcae7-335e-4c3d-8301-b9d5cf5ef9cc:
type: FUNCTION
name: clear
properties:
value: ''
action:
targetNode:
ref: fa4847ca-2dfe-4d21-a985-5f0ba17a2d0c
actionType: CALL_CLIENT_FUNCTION
code: |-
calcScreen.value = " "
register1.value = 0
register2.value = " "
return calcScreen.value
onSuccess: ''
onFailure: ''
b883a7ba-0ce2-4bf0-9ac6-1895e8e819e5:
type: THEME
name: theme1
properties:
theme: |-
return {
colors: {
kevin: {
test: "#f00f00"
}
}
}
c1546291-b3f5-4cbd-8437-0192cea31b36:
type: FUNCTION
name: subtract
properties:
value: ''
action:
targetNode:
ref: fa4847ca-2dfe-4d21-a985-5f0ba17a2d0c
actionType: CALL_CLIENT_FUNCTION
code: |-
const screenVal = +String(calcScreen.value ?? "0").trim() ?? 0
register1.value = screenVal
register2.value = "-"
calcScreen.value = " "
return screenVal
onSuccess: ''
onFailure: ''
d1017f94-3ca8-40d2-9c30-a3cde7eec616:
type: CONTAINER
name: row1
slots:
canvas:
- nodeID: 025b6bb8-2ba4-4cac-a4c0-735c4781e8d2
orderKey: Zw
- nodeID: a3a8ca58-06e2-4a21-8b90-6458e39081fe
orderKey: Zx
- nodeID: 98b0e93b-f3e6-417f-bb7d-5b17a2593143
orderKey: Zy
- nodeID: e5872a95-bc06-4f48-bc5e-47f7106911c6
orderKey: Zz
- nodeID: 10233c3c-15f1-4d63-940e-c39b48439dee
orderKey: a0
properties:
top: '80'
left: '128'
heightMode: FIXED
height: 72px
widthMode: FILL
width: fill
boxShadow: '0'
layoutStyle: HORIZONTAL_STACK
padding: 4px
spacing: 8px
backgroundColor: transparent
e5872a95-bc06-4f48-bc5e-47f7106911c6:
type: BUTTON
name: plus
properties:
top: '16'
left: '256'
heightMode: FIXED
height: 64px
widthMode: FIXED
width: 64px
text: +
onClick:
function:
ref: fd36ae4c-f161-4074-92b1-881fed6e42d4
backgroundColor: accent.purple.400
padding: 8px
e7e27edc-ebac-4357-8eeb-8618a0c14c2a:
type: LOCAL_VARIABLE
name: register1
properties:
value: '{{ 0 }}'
eb7439a4-1169-4b6e-827e-09830ac16741:
type: LOCAL_VARIABLE
name: register2
properties:
value: ' '
eba87622-4a71-4bc5-a76d-d2781df51c30:
type: FUNCTION
name: type8
properties:
value: ''
action:
targetNode:
ref: fa4847ca-2dfe-4d21-a985-5f0ba17a2d0c
actionType: CALL_CLIENT_FUNCTION
code: |-
calcScreen.value = (calcScreen.value ?? "") + "8"
return calcScreen.value
onSuccess: ''
onFailure: ''
eda1b99b-13d0-4354-bf1a-6099ca5b1b37:
type: FUNCTION
name: modulo
properties:
value: ''
action:
targetNode:
ref: fa4847ca-2dfe-4d21-a985-5f0ba17a2d0c
actionType: CALL_CLIENT_FUNCTION
code: |-
const screenVal = +String(calcScreen.value ?? "0").trim() ?? 0
register1.value = screenVal
register2.value = "%"
calcScreen.value = " "
return screenVal
onSuccess: ''
onFailure: ''
eee607ed-ccc6-4f98-9fa2-c4442fb11eab:
type: BUTTON
name: two
properties:
top: '32'
left: '192'
heightMode: FIXED
height: 64px
widthMode: FIXED
width: 64px
text: '2'
onClick:
function:
ref: 89fb386a-d6bd-4a2e-b93f-e44c382ce8e1
backgroundColor: accent.purple.400
padding: 8px
f39e845a-518c-420a-a459-7bebb24019dd:
type: BUTTON
name: zero
properties:
top: '32'
left: '48'
heightMode: FIXED
height: 64px
widthMode: FIXED
width: '{{3*64 + 16}}px'
text: '0'
onClick:
function:
ref: 42e3a26c-dd32-4636-91c1-e456f5c6d881
backgroundColor: accent.purple.400
padding: 8px
f77bea61-4afb-4917-9466-439fe1122f6a:
type: CONTAINER
name: screenContainer
slots:
canvas:
- nodeID: 20a77996-e255-4996-861e-ef4922070bd3
orderKey: a0
- nodeID: 38076ba6-1008-4ff4-b793-7fc09594f570
orderKey: a1
properties:
top: '96'
left: '112'
heightMode: FIXED
height: 96px
widthMode: FILL
width: fill
styles: |-
element.styles {
border: 1px solid #000;
border-radius: 8px;
overflow: hidden;
}
boxShadow: '0'
layoutStyle: HORIZONTAL_STACK
distributeContent: ''
padding: '4'
spacing: '0'
backgroundColor: surface.400
fa4847ca-2dfe-4d21-a985-5f0ba17a2d0c:
type: RESOURCE/TYPESCRIPT_CLIENT
name: typescript_client1
fd36ae4c-f161-4074-92b1-881fed6e42d4:
type: FUNCTION
name: add
properties:
value: ''
action:
targetNode:
ref: fa4847ca-2dfe-4d21-a985-5f0ba17a2d0c
actionType: CALL_CLIENT_FUNCTION
code: |-
const screenVal = +String(calcScreen.value ?? "0").trim() ?? 0
register1.value = screenVal
register2.value = "+"
calcScreen.value = " "
return screenVal
onSuccess: ''
onFailure: ''