hayun-vite 1.1.2 → 1.2.0

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.
@@ -110,4 +110,8 @@ const appSettingData = {
110
110
 
111
111
  }
112
112
 
113
- export { officeData, patientData, appSettingData }
113
+ const currentData = {
114
+ appSettingData, officeData, patientData
115
+ }
116
+
117
+ export { currentData }
package/index.html CHANGED
@@ -4,8 +4,9 @@
4
4
  <head>
5
5
  <meta charset="UTF-8" />
6
6
  <link rel="icon" type="image/svg+xml" href="vite.svg" />
7
- <link rel="stylesheet" href="/styles-tailwind.css">
8
- <link rel="stylesheet" href="/styles.css">
7
+ <link rel="stylesheet" href="style-font.css">
8
+ <link rel="stylesheet" href="styles.css">
9
+ <link rel="stylesheet" href="styles-tailwind.css">
9
10
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
10
11
  <title>hayun</title>
11
12
  </head>
@@ -16,23 +17,34 @@
16
17
  <!-- <button id="log">Log Current Data</button> -->
17
18
 
18
19
  <script type="module">
19
- import { patientData } from "/data/currentData.js"
20
- import speechUI from "/src/Speech/SpeechUI"
21
- import formsUI from "/src/Forms/ui.js"
22
- // console.log(patientData.sessions[0].speech);
20
+ import { currentData } from "/data/currentData.js"
21
+ import speechUI from "/src/Speech/SpeechUI.js"
22
+ import formsUI from "/src/Forms/FormsUI.js"
23
+ import reflexUI from "/src/Reflex/ReflexUI.js"
24
+
25
+ const { appSettingData, officeData, patientData } = currentData
23
26
  let data = patientData.sessions[0].speech
24
- // speechUI({ data })
25
- // console.log(speechUI);
26
27
  speechUI.draw({ containerId: '#app' })
27
- // speechUI.update({ data })
28
- // speechUI.draw()
29
28
  speechUI.update({ data })
30
29
 
30
+ // فراخوانی متد آپدیت بدون پارامتر مقادیر وارد شده کاربر را به دیتاآبجکت جاری میفرستد
31
+ // setInterval(() => { speechUI.update() }, 3000);
31
32
 
33
+ // Accoustic Reflexes Section
34
+ data = patientData.sessions[0].reflex
35
+ reflexUI.draw({ containerId: '#app' })
36
+ reflexUI.update({ data })
32
37
 
33
-
38
+ // formsUI Section
34
39
  // data = patientData.sessions[0]
35
- // formsUI({ data })
40
+ // formsUI.draw({ containerId: '#app' })
41
+ // formsUI.update({ patientData, sessionIndex: 0 })
42
+
43
+ // setInterval(() => {
44
+ // formsUI.update({ patientData, sessionIndex: 0 })
45
+ // console.log('forms update!');
46
+
47
+ // }, 2000)
36
48
 
37
49
 
38
50
  // document.querySelector('#log').addEventListener('click', () => {
package/index.js CHANGED
@@ -1,10 +1,13 @@
1
1
  import Audiogram from './src/Audiogram/Audiogram'
2
2
  import dims from './src/Audiogram/dims'
3
- import { officeData, patientData } from './assets/data/sampleData'
3
+ // import { officeData, patientData } from './assets/data/sampleData'
4
4
  import Forms from './src/Forms/Forms'
5
5
  import combo_template from './assets/templates/templCombo'
6
+ import './styles.css'
7
+ import formsUI from './src/Forms/FormsUI'
6
8
  // import './src/style.css'
7
9
  // import './src/Speech/ui.js'
10
+ import { currentData } from './data/currentData'
8
11
 
9
12
 
10
13
 
@@ -12,7 +15,7 @@ import combo_template from './assets/templates/templCombo'
12
15
  // import rasa_tymp_reflex_template from './assets/templates/rasa_tymp_reflex'
13
16
 
14
17
  import logo0 from './assets/logos/logo-0_mm_20w_22h_300p.png'
15
- import logo1 from './assets/logos/logo-1.png'
18
+ import logo1 from './assets/logos/logo-1.png'
16
19
  import logo2 from './assets/logos/logo-2.png'
17
20
  import Speech from './src/Speech/Speech'
18
21
  // import { ReflexUI } from './src/components'
@@ -24,8 +27,7 @@ const logos = [logo0, logo1, logo2]
24
27
 
25
28
 
26
29
  export {
27
- Audiogram, Forms, dims, officeData,
28
- patientData, combo_template,
29
- logos, Speech, speechUI
30
+ Audiogram, Forms, dims, currentData, combo_template,
31
+ logos, Speech, speechUI, formsUI
30
32
 
31
33
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hayun-vite",
3
3
  "private": false,
4
- "version": "1.1.2",
4
+ "version": "1.2.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
@@ -15,12 +15,6 @@
15
15
  "main": "index.js",
16
16
  "dependencies": {
17
17
  "@tailwindcss/vite": "^4.1.10",
18
- "esbuild": "^0.24.2",
19
- "nanoid": "^3.3.8",
20
- "picocolors": "^1.1.1",
21
- "postcss": "^8.5.1",
22
- "rollup": "^4.34.6",
23
- "source-map-js": "^1.2.1",
24
18
  "tailwindcss": "^4.1.10"
25
19
  },
26
20
  "author": "",
package/src/Form/Form.js CHANGED
@@ -132,8 +132,17 @@ export default class Form {
132
132
  return svg
133
133
  }
134
134
 
135
- update({ data, officeData, patientData, sessionIndex = 0 }) {
136
- console.log(data);
135
+ update({ officeData, patientData, sessionIndex }) {
136
+ // جداکردن دیتای مربوط به سکشن های مختلف
137
+ const currentPatientData = patientData.sessions[sessionIndex]
138
+ const data = {
139
+ audiogram: currentPatientData.audiogram,
140
+ speech: currentPatientData.speech,
141
+ tympanogram: currentPatientData.tympanogram,
142
+ reflex: currentPatientData.reflex,
143
+
144
+ }
145
+ this.patient?.update(patientData)
137
146
  data?.audiogram?.R && this.RAudiogram?.update({ data: data.audiogram.R, side: 'R' })
138
147
  data?.audiogram?.L && this.LAudiogram?.update({ data: data.audiogram.L, side: 'L' })
139
148
  data?.speech?.R && this.RSpeech?.update(data?.speech?.R)
@@ -1,4 +1,4 @@
1
- // import '../styles.css' // برای تست منتقل شد به فایل ایندکس اصلی اچ‌تی‌ام‌ال و برای توسعه منتقل شده به ایندکس جی اس
1
+ // import '../../styles.css' // برای تست منتقل شد به فایل ایندکس اصلی اچ‌تی‌ام‌ال و برای توسعه منتقل شده به ایندکس جی اس
2
2
  import printForm from "./printForm.js"
3
3
  import Form from "../Form/Form.js"
4
4
  import putGrid from "../common/putGrid.js"
@@ -69,7 +69,7 @@ export default class Forms {
69
69
  // this.selectedForm = forms[index]
70
70
  selectedIndex = index
71
71
  this.selectedIndex = selectedIndex
72
- this.update({ data: this.data })
72
+ this.update({ data: this.data }) // با مقادیر قبلی آپدیت را انجام بده
73
73
  })
74
74
  }) // سمی‌کالن واجب
75
75
 
@@ -110,10 +110,25 @@ export default class Forms {
110
110
  }
111
111
 
112
112
  // این تابع یک بار از بیرون کلاس فراخوانی میشه و یک بار وقتی از داخل تمپلت فرم را عوض میکنیم
113
- update({ data, officeData, patientData, sessionIndex = 0 }) {
114
- // این تابع دیگه فقط با پارامتر دیتا کار میکنه
115
- this.forms[this.selectedIndex].update({ data })
116
- this.data = data
113
+ update({ data, officeData, patientData, sessionIndex } = {}) {
114
+
115
+
116
+ // پارامتر اول برای آپدیت داخلی استفاده می‌شود
117
+ if (data) {
118
+
119
+ officeData = this.data.officeData
120
+ patientData = this.data.patientData
121
+ sessionIndex = this.data.sessionIndex
122
+ }
123
+ // console.log(patientData);
124
+
125
+
126
+ this.forms[this.selectedIndex].update({ officeData, patientData, sessionIndex })
127
+
128
+ this.data.officeData = officeData
129
+ this.data.patientData = patientData
130
+ this.data.sessionIndex = sessionIndex
131
+
117
132
  // console.log('I`M FROM Forms.update METHOD !!!!!!!!!!!!!!');
118
133
  //
119
134
  // اگر هر دو دیتا وجود داشت ادامه بده
@@ -0,0 +1,34 @@
1
+ import { officeData, patientData } from "../../assets/data/sampleData";
2
+ import templAudiometry from "../../assets/templates/templAudiometry";
3
+ import templCombo from "../../assets/templates/templCombo";
4
+ import Forms from "./Forms";
5
+
6
+ class formsUI {
7
+ constructor() {
8
+ this.data = {}
9
+
10
+ }
11
+
12
+ draw({ containerId = '#app' }) {
13
+ document.querySelector(containerId).insertAdjacentHTML('beforeend', `
14
+ <div id="forms"></div>
15
+ `);
16
+
17
+ const container = document.getElementById('forms')
18
+ this.forms = new Forms({ container, templates: [templCombo, templAudiometry], mode: 'develop' });
19
+ }
20
+
21
+ update({ officeData, patientData, sessionIndex }) {
22
+ officeData && (this.officeData = officeData);
23
+ patientData && (this.patientData = patientData);
24
+ this.currentSessionPatientData = patientData.sessions[sessionIndex]
25
+ this.forms.update({ officeData, patientData, sessionIndex })
26
+ }
27
+
28
+ }
29
+
30
+ export default new formsUI()
31
+
32
+
33
+
34
+
@@ -117,12 +117,56 @@ export default class Reflex {
117
117
 
118
118
  // جایگذاری داده های رفلکس
119
119
  update(data) {
120
- console.log(data);
121
-
122
120
  for (const key in data) {
123
121
  for (const freq in data[key]) {
124
122
  this.chart.querySelector(`text[name=${key}-${freq}]`).innerHTML = data?.[key]?.[freq] || "";
125
123
  }
126
124
  }
127
125
  }
126
+
127
+ createUserInput({ container }) {
128
+ // استایل دهی نسبی به کانتینر
129
+ // برای قرار دادن اینپوت ها در مختصات کانتینر
130
+ container.style.position = 'relative'
131
+ const width = 70 // به دست آوردن پهنای اینپوت برای محاسبه مختصات نقطه مرکزش
132
+ const height = 30 // به دست آوردن پهنای اینپوت برای محاسبه مختصات نقطه مرکزش
133
+
134
+ let style = `
135
+ all: revert;
136
+ width: ${width}px;
137
+ height: ${height}px;
138
+ box-sizing: border-box;
139
+ border: none;
140
+ /* Ensures padding doesn't increase height */
141
+ position: absolute;
142
+ padding-top: 4px;
143
+ text-align: center;
144
+ font-size: 24px;
145
+ font-weight: bold;
146
+ font-family: Vazirmatn;
147
+ `
148
+ const color = (this.side === 'R') ? 'crimson' : 'blue';
149
+ // ایجاد یک المنت اینپوت
150
+ // let input
151
+ // آماده سازی اولین نود اینپوت از داکیومنت و سپس ساختن بقیه نودها از روی آن
152
+ // const firstInput = input // نگهداری اولین اینپوت برای برگشت و فوکوس کردن بهش
153
+ let inputDims = this.inputDims
154
+
155
+ inputDims.forEach(dims => {
156
+ const input = document.createElement('input')
157
+ // input.className = 'user-input'
158
+ input.name = dims.name
159
+ input.type = 'text'
160
+ input.maxLength = 4
161
+ input.autocomplete = 'off'
162
+ input.placeholder = '---'
163
+ input.style = style
164
+ input.style.color = color
165
+ input.style.left = dims.x - width / 2 + 'px'
166
+ input.style.top = dims.y - height / 2 + 'px'
167
+ container.appendChild(input)
168
+ // input = input.cloneNode() // در آخر یک المنت اضافه ایجاد شده است - باگ بی آزار
169
+ })
170
+ // firstInput.focus()
171
+ }
128
172
  }
@@ -0,0 +1,78 @@
1
+ import Reflex from "./Reflex";
2
+
3
+ class ReflexUI {
4
+ constructor() {
5
+ this.data = { R: '', L: '' }
6
+ }
7
+ draw({ containerId = '#app' }) {
8
+ document.querySelector(containerId).insertAdjacentHTML('beforeend', `
9
+ <div name = "reflexes" class="border">
10
+ <h1 class="center title">Acoustic Reflexes</h1>
11
+ <div class="center">
12
+ <div>
13
+ <h2 class="side center red">Right</h2>
14
+ <section id="r-reflex"></section>
15
+ </div>
16
+ <div>
17
+ <h2 class="side center blue">Left</h2>
18
+ <section id="l-reflex"></section>
19
+ </div>
20
+ </div>
21
+ </div>
22
+ `);
23
+
24
+ // ابعاد جداول تمپانوگرام
25
+ const dims = {
26
+ "name": "RTympanogram",
27
+ "w": 100,
28
+ "h": 30,
29
+ "margin": {
30
+ "left": 1,
31
+ "top": 0,
32
+ "right": 10,
33
+ "bottom": 0
34
+ },
35
+ "display": "inline",
36
+ "width": 100 * 6,
37
+ "height": 30 * 6
38
+ }
39
+
40
+ this.rcontainer = document.getElementById('r-reflex')
41
+ this.rchart = new Reflex({ container: this.rcontainer, dims, side: 'R' })
42
+
43
+ // فراخوانی متد ایجاد اینپوت روی چارت اسپیچ
44
+ // this.rchart.createUserInput({ container: this.rcontainer })
45
+
46
+ this.lcontainer = document.getElementById('l-reflex')
47
+ this.lchart = new Reflex({ container: this.lcontainer, dims, side: 'L' })
48
+ // this.lchart.createUserInput({ container: this.lcontainer })
49
+
50
+ }
51
+
52
+ update({ data } = {}) {
53
+ if (data) {
54
+ this.rchart.update(data.R, this.rcontainer)
55
+ this.lchart.update(data.L, this.lcontainer)
56
+ this.data = { R: data.R, L: data.L }
57
+ } else
58
+ // اگر این تابع بدون پارامتر فراخوانی شود مقادیر اینپوت کاربر گرفته و دیتاآبجکت را آپدیت کند
59
+ {
60
+ console.log('without param');
61
+
62
+ // this.rchart.fetchInputUserData()
63
+ // this.lchart.fetchInputUserData()
64
+ // this.data.R = this.rchart.data
65
+ // this.data.L = this.lchart.data
66
+ }
67
+
68
+ }
69
+ }
70
+
71
+ export default new ReflexUI()
72
+
73
+
74
+
75
+
76
+
77
+
78
+
@@ -136,8 +136,6 @@ export default class Speech {
136
136
  }
137
137
 
138
138
  update(data, container) {
139
- console.log(data);
140
-
141
139
  this.data = data
142
140
  // انتخاب اینکه اینپوت های کاربر را آپدیت کنه یا اس وی جی تکست ها رو
143
141
  // بر حسب اینکه پارامتر کانتینر باشه یا نباشه
@@ -180,7 +178,7 @@ export default class Speech {
180
178
  inputDims.forEach(dims => {
181
179
  const input = document.createElement('input')
182
180
  // input.className = 'user-input'
183
- input.name = 'SAT'
181
+ input.name = dims.name
184
182
  input.type = 'text'
185
183
  input.maxLength = 4
186
184
  input.autocomplete = 'off'
@@ -189,7 +187,6 @@ export default class Speech {
189
187
  input.style.color = color
190
188
  input.style.left = dims.x - width / 2 + 'px'
191
189
  input.style.top = dims.y - height / 2 + 'px'
192
- input.name = dims.name
193
190
  container.appendChild(input)
194
191
  // input = input.cloneNode() // در آخر یک المنت اضافه ایجاد شده است - باگ بی آزار
195
192
  })
@@ -203,9 +200,6 @@ export default class Speech {
203
200
  const value = this.container.querySelector(`input[name= ${name}]`).value
204
201
  this.data[name] = value // جایگزین کردن پراپرتی آبجکت دیتای جاری و اینجا
205
202
  })
206
-
207
- console.log(this.data);
208
-
209
203
  }
210
204
 
211
205
  }
@@ -1,6 +1,4 @@
1
1
  import Speech from "./Speech"
2
- import units from "./units"
3
-
4
2
 
5
3
  class SpeechUI {
6
4
  constructor() {
@@ -8,23 +6,20 @@ class SpeechUI {
8
6
  }
9
7
 
10
8
  draw({ containerId = '#app' } = {}) {
11
-
12
- const {styles} = units
13
-
9
+
14
10
  document.querySelector(containerId).insertAdjacentHTML('beforeend', `
15
- <div name="speechs" style="${styles.border}">
16
- <h1 style="${styles.center + styles.title}">Speech Tests</h1>
17
- <div style="${styles.center}">
11
+ <div name="speechs" class="border">
12
+ <h1 class="center title">Speech Tests</h1>
13
+ <div class="center">
18
14
  <div>
19
- <h2 style="${styles.side + styles.center + styles.red}">Right</h2>
15
+ <h2 class="side center red">Right</h2>
20
16
  <section id="r-speech"></section>
21
17
  </div>
22
18
  <div>
23
- <h2 style="${styles.side + styles.center + styles.blue}">Left</h2>
19
+ <h2 class="side center blue">Left</h2>
24
20
  <section id="l-speech"></section>
25
21
  </div>
26
22
  </div>
27
- <button id="update">Update</button>
28
23
  </div>
29
24
  `)
30
25
 
@@ -64,21 +59,24 @@ class SpeechUI {
64
59
  // فراخوانی متد ایجاد اینپوت روی چارت اسپیچ
65
60
  this.lchart.createUserInput({ container: this.lcontainer })
66
61
 
67
- document.querySelector('#update').addEventListener('click', () => {
68
- // مقادیر ورودی را بخوان و دیتای کلاس را آپدیت کن و آخر هم دیتای دریافتی تابع را جایگزین کن
69
- // console.log(chart.data);
62
+
63
+ }
64
+
65
+ update({ data } = {}) {
66
+ if (data) {
67
+ this.rchart.update(data.R, this.rcontainer)
68
+ this.lchart.update(data.L, this.lcontainer)
69
+ this.data = { R: data.R, L: data.L }
70
+ } else
71
+ // اگر این تابع بدون پارامتر فراخوانی شود مقادیر اینپوت کاربر گرفته و دیتاآبجکت را آپدیت کند
72
+ {
73
+ console.log('without param');
74
+
70
75
  this.rchart.fetchInputUserData()
71
76
  this.lchart.fetchInputUserData()
72
77
  this.data.R = this.rchart.data
73
78
  this.data.L = this.lchart.data
74
-
75
- })
76
- }
77
-
78
- update({ data = {} } = {}) {
79
- this.rchart.update(data.R, this.rcontainer)
80
- this.lchart.update(data.L, this.lcontainer)
81
- this.data = { R: data.R, L: data.L }
79
+ }
82
80
 
83
81
  }
84
82
  }
package/style-font.css ADDED
@@ -0,0 +1,10 @@
1
+ /* این فقط در تست پکیج در فایل اصلی لینک یا ایمپورت میشه با ارسالش به پروژه خطای کنسول پیدا میکنیم */
2
+
3
+ @font-face {
4
+ font-family: 'Vazirmatn';
5
+ src: url('fonts/webfonts/Vazirmatn[wght].woff2') format('woff2 supports variations'),
6
+ url('fonts/webfonts/Vazirmatn[wght].woff2') format('woff2-variations');
7
+ font-weight: 100 900;
8
+ font-style: normal;
9
+ font-display: swap;
10
+ }
package/styles.css CHANGED
@@ -1,30 +1,11 @@
1
- @font-face {
2
- font-family: 'Vazirmatn';
3
- src: url('fonts/webfonts/Vazirmatn[wght].woff2') format('woff2 supports variations'),
4
- url('fonts/webfonts/Vazirmatn[wght].woff2') format('woff2-variations');
5
- font-weight: 100 900;
6
- font-style: normal;
7
- font-display: swap;
8
- }
9
-
10
- /* body {
11
- font-family: Vazirmatn;
12
- user-select: none;
13
-
14
- } */
15
-
16
-
17
-
18
1
  h2.side {
19
2
  font: 1.5rem Vazirmatn;
20
3
  font-weight: 500;
21
4
  margin: 0rem 0em 0em 0em;
22
- /* all: initial; */
23
- /* margin: auto; */
5
+ /* all: initial; */
6
+ /* margin: auto; */
24
7
  }
25
8
 
26
-
27
-
28
9
  h1.title {
29
10
  /* all: unset; */
30
11
  /* all: initial; */
@@ -34,9 +15,9 @@ h1.title {
34
15
  }
35
16
 
36
17
  .center {
37
- display: flex;
38
- align-items: center;
39
- justify-content: space-evenly;
18
+ display: flex;
19
+ align-items: center;
20
+ justify-content: space-evenly;
40
21
  }
41
22
 
42
23
  .blue {
@@ -74,6 +55,68 @@ input.user-input[type="text"]:focus {
74
55
  /* optional: reset margin if browser adds any */
75
56
  }
76
57
 
77
- /* input.restore-native {
78
- all: revert;
79
- } */
58
+ .text-box {
59
+ /* font-family: Arial, Helvetica, sans-serif !important; */
60
+ font-size: 0.8mm;
61
+ /* font-weight: bold; */
62
+ direction: rtl !important;
63
+ user-select: none;
64
+ /* dominant-baseline: middle; /* تراز عمودی*/
65
+ }
66
+
67
+ .persian {
68
+ font-family: Vazirmatn;
69
+ /* font-size: 0.8mm; */
70
+ /* text-anchor: start; */
71
+ }
72
+
73
+ /*تراز افقی*/
74
+ .align {
75
+ text-anchor: start;
76
+ }
77
+
78
+ .bold {
79
+ font-weight: bold;
80
+ }
81
+
82
+ .container {
83
+ display: flex;
84
+ /* Use flexbox to align items */
85
+ align-items: center;
86
+ /* Center items vertically */
87
+ }
88
+
89
+ .left {
90
+ /* background-color: lightblue; */
91
+ padding: 20px;
92
+ margin-right: 10px;
93
+ /* Space between the two divs */
94
+ }
95
+
96
+ .right {
97
+ /* background-color: lightgreen; */
98
+ margin-left: 10px;
99
+
100
+ /* padding: 20px; */
101
+ }
102
+
103
+ .button-form {
104
+ border-radius: 8px;
105
+ border: 1px solid transparent;
106
+ padding: 0.6em 1.2em;
107
+ font-size: 1em;
108
+ font-weight: 500;
109
+ /* font-family: inherit; */
110
+ background-color: #7472e2;
111
+ color: #ffffff;
112
+ cursor: pointer;
113
+ transition: border-color 0.25s;
114
+ border-color: #fefefe;
115
+
116
+ }
117
+
118
+ .button-form:hover {
119
+ background-color: #1c15e1;
120
+
121
+ border-color: #fefefe;
122
+ }
package/assets/rasa.png DELETED
Binary file
Binary file