-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
195 lines (173 loc) · 7.86 KB
/
Copy pathindex.html
File metadata and controls
195 lines (173 loc) · 7.86 KB
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
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Flow - Fluxogramas a partir de algoritmos</title>
<link rel="icon" href="https://www.jetbrains.com/favicon.ico" type="image/x-icon">
<!-- Google Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Barlow:wght@300;400;600;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;600;700&display=swap" rel="stylesheet">
<!-- AOS CSS -->
<link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet">
<!-- Bootstrap 5 CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Vue 3 CDN -->
<script src="https://unpkg.com/vue@3"></script>
<!-- html2canvas CDN -->
<script src="https://cdn.jsdelivr.net/npm/html2canvas@1.4.1/dist/html2canvas.min.js"></script>
<!-- Custom CSS -->
<link rel="stylesheet" href="assets/style.css">
</head>
<body class="bg-body-tertiary">
<div id="app" class="container py-5">
<div class="row mb-4">
<div class="col-12" data-aos="fade-up">
<div class="text-center card">
<div class="card-header"></div>
<div class="card-body">
<h1 class="fw-bold text-primary m-0 p-0">Flow</h1>
<p class="text-muted m-0 p-0">Crie fluxogramas a partir de algoritmos</p>
</div>
</div>
</div>
</div>
<div class="row">
<!-- Coluna de Entrada -->
<div class="col-lg-5 mb-4" data-aos="fade-up" data-aos-delay="100">
<div class="card p-4 shadow-sm rounded">
<h5 class="fw-bold mb-3 fs-3">Definição</h5>
<span class="text-muted d-block mb-1 text-small">Use o formato:</span>
<div class="mb-3 font-monospace child-font-family-inherit">
<code>entrada: item1, item2</code><br>
<code>processamento: calculo1; calculo2</code><br>
<code>decisao: condicao</code><br>
<code>saida: resultado</code><br>
<code>variaveis: v1, v2</code><br>
<code>descricao: este programa faz X e Y a partir de Z e A</code>
</div>
<label for="inputText">
<textarea
v-model="inputText"
id="inputText"
class="form-control mb-3 font-monospace"
rows="10"
placeholder="Cole ou escreva aqui o fluxo do seu algoritmo, conforme o formato acima..."
></textarea>
</label>
<div v-if="flowchartBlocks.length > 0" class="mb-3">
<span class="text-muted d-block mb-1 text-small">O que foi extraído:</span>
<details>
<summary>Verifique</summary>
<div>
<span v-for="block in flowchartBlocks.filter(f => f.text)" class="d-block">
<code class="font-monospace">{{ block.type }}: {{ block.text }}</code>
</span>
<span v-if="variables.length > 0" class="d-block">
<code class="font-monospace">variáveis: {{ variables.join(', ') }}</code>
</span>
<span v-if="description" class="d-block">
<code class="font-monospace">descrição: {{ description }}</code>
</span>
</div>
</details>
</div>
<div class="d-flex flex-wrap gap-1 align-items-center justify-content-center">
<button
@click="generateFlowchart"
class="btn btn-primary flex-grow-1 text-uppercase"
:disabled="inputText.length === 0"
>
Gerar Fluxograma
</button>
<button
@click="resetForm"
class="btn btn-secondary text-uppercase"
:disabled="inputText.length === 0"
>
Limpar
</button>
</div>
<div class="mt-3">
<span class="text-muted d-block mb-1 text-small text-body-tertiary">Exemplos</span>
<div class="d-flex align-items-center flex-wrap gap-1">
<button @click="showExample(1)" class="text-small btn btn-outline-secondary btn-sm mb-2">Cálculo de Média</button>
<button @click="showExample(2)" class="text-small btn btn-outline-secondary btn-sm mb-2">Cálculo de Gratificação Salário</button>
<button @click="showExample(3)" class="text-small btn btn-outline-secondary btn-sm mb-2">Verificação de Idade</button>
</div>
</div>
</div>
</div>
<!-- Coluna do Fluxograma -->
<div class="col-lg-7" data-aos="fade-up" data-aos-delay="150">
<div class="card p-4 shadow-sm rounded">
<div class="d-flex justify-content-between flex-column mb-3">
<h5 class="fw-bold m-0 fs-3 text-left">Fluxograma</h5>
<div id="variables-display" class="mt-3">
<div v-show="variables.length">
<span class="d-block mb-1 text-body-tertiary text-small">Variáveis</span>
</div>
<span v-for="variable in variables" class="badge text-bg-light border me-1 mb-1 fs-6">{{variable}}</span>
</div>
</div>
<div ref="flowchart" id="flowchart-container" class="d-flex flex-column align-items-center p-4 bg-white rounded-4" style="min-height: 400px;">
<span v-if="flowchartBlocks.length === 0" class="text-muted">O fluxograma aparecerá aqui...</span>
<div v-else class="d-flex flex-column align-items-center">
<template v-for="block in flowchartBlocks" :key="block.id">
<div v-if="block.type === 'output'" :class="block.classes">
<canvas :id="'canvas-' + block.id" width="220" height="100"></canvas>
</div>
<div v-else :class="block.classes">
<span v-if="block.type === 'io' || block.type === 'decision'">{{block.text}}</span>
<template v-else-if="block.type !== 'arrow'">{{block.text}}</template>
</div>
</template>
</div>
</div>
<div v-if="description" class="mt-3">
<span class="d-block mb-1 text-body-tertiary text-small">Descrição do algoritmo</span>
<p class="m-0 p-0">{{description}}</p>
</div>
<div class="mt-3">
<div class="d-flex flex-wrap gap-1 align-items-center justify-content-center">
<button
@click="copyHowImage"
class="btn btn-primary flex-grow-1 flex-shrink-1 text-uppercase"
:disabled="flowchartBlocks.length === 0"
>
Copiar como imagem
</button>
<button
@click="downloadHowImage"
class="btn btn-secondary flex-grow-1 flex-shrink-1 text-uppercase"
:disabled="flowchartBlocks.length === 0"
>
Baixar como imagem
</button>
</div>
</div>
</div>
</div>
</div>
<div id="toast-container" class="toast-container position-fixed bottom-0 end-0 p-3"></div>
</div>
<template id="toast-template">
<div class="toast" role="alert" aria-live="assertive" aria-atomic="true">
<div class="toast-header">
<span class="p-1 rounded-circle bg-success me-2"></span>
<strong class="me-auto">Nova notificação</strong>
<small class="text-body-secondary">agora</small>
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
<div class="toast-body"></div>
</div>
</template>
<!-- AOS JS -->
<script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
<!-- Custom JS -->
<script src="assets/scripts.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>