@simple-reporting/base 1.0.23 → 1.0.24

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 (39) hide show
  1. package/dev/index.html +1 -1
  2. package/dev/livingdocs.config.json +6 -6
  3. package/dev/package.json +1 -1
  4. package/dev/src/Dialog.vue +3 -0
  5. package/package.json +2 -1
  6. package/scripts/beaver.js +14 -18
  7. package/scripts/build/variables.d.ts +6 -0
  8. package/scripts/build/variables.js +6 -0
  9. package/scripts/build.js +56 -16
  10. package/scripts/dotenv.d.ts +1 -0
  11. package/scripts/dotenv.js +8 -0
  12. package/scripts/init.js +1 -1
  13. package/scripts/ldd/mapLdd.js +2 -2
  14. package/scripts/utils.d.ts +1 -0
  15. package/scripts/utils.js +22 -0
  16. package/scss/colors/functions.scss +2 -10
  17. package/scss/colors/mixins.scss +0 -18
  18. package/scss/colors/root.scss +10 -0
  19. package/scss/core-styles.scss +4 -1
  20. package/scss/fonts/root.scss +4 -0
  21. package/scss/grid/functions.scss +8 -6
  22. package/scss/grid/mixins.scss +0 -77
  23. package/scss/grid/root.scss +80 -0
  24. package/scss/helpers/root.scss +4 -0
  25. package/scss/init-root.scss +12 -0
  26. package/scss/meta/root.scss +4 -0
  27. package/scss/spacer/functions.scss +2 -1
  28. package/scss/spacer/mixins.scss +0 -52
  29. package/scss/spacer/root.scss +55 -0
  30. package/scss/system/functions.scss +70 -5
  31. package/scss/system/root.scss +0 -3
  32. package/scss/system/variables.scss +1 -0
  33. package/scss/typography/functions.scss +12 -12
  34. package/scss/typography/mixins.scss +0 -221
  35. package/scss/typography/root.scss +226 -0
  36. package/srl/.srl/components/Srl/Article/Dialog/Button.vue +18 -20
  37. package/srl/.srl/components/Srl/Page/Dialog.vue +17 -19
  38. package/srl/.srl/utils/pageState.ts +2 -2
  39. package/srl/srl/pdf.scss +0 -2
@@ -0,0 +1,226 @@
1
+ @use "sass:map";
2
+ @use "sass:string";
3
+ @use "variables";
4
+ @use "../colors";
5
+ @use "../system";
6
+
7
+ @mixin _register-typo-variables(
8
+ $typo,
9
+ $map,
10
+ $media: false,
11
+ $mediaBehavior: false
12
+ ) {
13
+ @if not $media {
14
+ $defaults: map.merge(
15
+ (
16
+ font-family: unset,
17
+ font-size: unset,
18
+ line-height: unset,
19
+ font-style: normal,
20
+ font-weight: unset,
21
+ letter-spacing: unset,
22
+ margin-top: 0,
23
+ margin-bottom: 0,
24
+ ),
25
+ $map
26
+ );
27
+
28
+ @if (map.has-key($map, font-family)) {
29
+ @include system.add-root-style(
30
+ #{variables.$variable-prefix}typo-#{$typo}-font-family,
31
+ string.unquote(map.get($defaults, font-family))
32
+ );
33
+ }
34
+
35
+ @include system.add-root-style(
36
+ #{variables.$variable-prefix}typo-#{$typo}-font-size,
37
+ system.size-unit(map.get($defaults, font-size))
38
+ );
39
+
40
+ @include system.add-root-style(
41
+ #{variables.$variable-prefix}typo-#{$typo}-line-height,
42
+ system.size-unit(map.get($defaults, line-height), em)
43
+ );
44
+
45
+ @include system.add-root-style(
46
+ #{variables.$variable-prefix}typo-#{$typo}-font-style,
47
+ string.unquote(map.get($defaults, font-style))
48
+ );
49
+
50
+ @include system.add-root-style(
51
+ #{variables.$variable-prefix}typo-#{$typo}-font-weight,
52
+ map.get($defaults, font-weight)
53
+ );
54
+
55
+ @if (map.has-key($map, color)) {
56
+ @include system.add-root-style(
57
+ #{variables.$variable-prefix}typo-#{$typo}-font-color,
58
+ colors.get(map.get($defaults, color))
59
+ );
60
+ }
61
+
62
+ @if (map.has-key($map, letter-spacing)) {
63
+ @include system.add-root-style(
64
+ #{variables.$variable-prefix}typo-#{$typo}-letter-spacing,
65
+ system.size-unit(map.get($defaults, letter-spacing))
66
+ );
67
+ }
68
+
69
+ @if (map.has-key($map, text-transform)) {
70
+ @include system.add-root-style(
71
+ #{variables.$variable-prefix}typo-#{$typo}-text-transform,
72
+ map.get($defaults, text-transform)
73
+ );
74
+ }
75
+
76
+ @include system.add-root-style(
77
+ #{variables.$variable-prefix}typo-#{$typo}-margin-top,
78
+ system.size-unit(map.get($defaults, margin-top))
79
+ );
80
+
81
+ @include system.add-root-style(
82
+ #{variables.$variable-prefix}typo-#{$typo}-margin-bottom,
83
+ system.size-unit(map.get($defaults, margin-bottom))
84
+ );
85
+
86
+ @if map.has-key($map, media) {
87
+ @each $breakpoint, $breakpointValue in map.get($map, media) {
88
+ @if $breakpoint == up {
89
+ @each $upBreakpoint, $upBreakpointValue in $breakpointValue {
90
+ @include _register-typo-variables(
91
+ $typo,
92
+ $upBreakpointValue,
93
+ $upBreakpoint,
94
+ up
95
+ );
96
+ }
97
+ } @else if $breakpoint == down {
98
+ @each $downBreakpoint, $downBreakpointValue in $breakpointValue {
99
+ @include _register-typo-variables(
100
+ $typo,
101
+ $downBreakpointValue,
102
+ $downBreakpoint,
103
+ down
104
+ );
105
+ }
106
+ } @else {
107
+ @include _register-typo-variables(
108
+ $typo,
109
+ $breakpointValue,
110
+ $breakpoint
111
+ );
112
+ }
113
+ }
114
+ }
115
+ } @else {
116
+ @if (map.has-key($map, font-family)) {
117
+ @include system.add-root-style(
118
+ #{variables.$variable-prefix}typo-#{$typo}-font-family,
119
+ string.unquote(map.get($map, font-family)),
120
+ $media,
121
+ $mediaBehavior
122
+ );
123
+ }
124
+
125
+ @if (map.has-key($map, font-size)) {
126
+ @include system.add-root-style(
127
+ #{variables.$variable-prefix}typo-#{$typo}-font-size,
128
+ system.size-unit(map.get($map, font-size)),
129
+ $media,
130
+ $mediaBehavior
131
+ );
132
+ }
133
+
134
+ @if map.has-key($map, line-height) {
135
+ @include system.add-root-style(
136
+ #{variables.$variable-prefix}typo-#{$typo}-line-height,
137
+ system.size-unit(map.get($map, line-height), em),
138
+ $media,
139
+ $mediaBehavior
140
+ );
141
+ }
142
+
143
+ @if map.has-key($map, font-style) {
144
+ @include system.add-root-style(
145
+ #{variables.$variable-prefix}typo-#{$typo}-font-style,
146
+ string.unquote(map.get($map, font-style)),
147
+ $media,
148
+ $mediaBehavior
149
+ );
150
+ }
151
+
152
+ @if map.has-key($map, font-weight) {
153
+ @include system.add-root-style(
154
+ #{variables.$variable-prefix}typo-#{$typo}-font-weight,
155
+ map.get($map, font-weight),
156
+ $media,
157
+ $mediaBehavior
158
+ );
159
+ }
160
+
161
+ @if (map.has-key($map, color)) {
162
+ @include system.add-root-style(
163
+ #{variables.$variable-prefix}typo-#{$typo}-font-color,
164
+ colors.get(map.get($defaults, color))
165
+ );
166
+ }
167
+
168
+ @if (map.has-key($map, letter-spacing)) {
169
+ @include system.add-root-style(
170
+ #{variables.$variable-prefix}typo-#{$typo}-letter-spacing,
171
+ system.size-unit(map.get($defaults, letter-spacing)),
172
+ $media,
173
+ $mediaBehavior
174
+ );
175
+ }
176
+
177
+ @if (map.has-key($map, text-transform)) {
178
+ @include system.add-root-style(
179
+ #{variables.$variable-prefix}typo-#{$typo}-text-transform,
180
+ map.get($defaults, text-transform),
181
+ $media,
182
+ $mediaBehavior
183
+ );
184
+ }
185
+
186
+ @if map.has-key($map, margin-top) {
187
+ @if $media == print {
188
+ @include system.add-root-style(
189
+ #{variables.$variable-prefix}typo-#{$typo}-margin-top,
190
+ system.size-unit(map.get($map, margin-top), in),
191
+ $media,
192
+ $mediaBehavior
193
+ );
194
+ } @else {
195
+ @include system.add-root-style(
196
+ #{variables.$variable-prefix}typo-#{$typo}-margin-top,
197
+ system.size-unit(map.get($map, margin-top)),
198
+ $media,
199
+ $mediaBehavior
200
+ );
201
+ }
202
+ }
203
+
204
+ @if map.has-key($map, margin-bottom) {
205
+ @if $media == print {
206
+ @include system.add-root-style(
207
+ #{variables.$variable-prefix}typo-#{$typo}-margin-bottom,
208
+ system.size-unit(map.get($map, margin-bottom), in),
209
+ $media,
210
+ $mediaBehavior
211
+ );
212
+ } @else {
213
+ @include system.add-root-style(
214
+ #{variables.$variable-prefix}typo-#{$typo}-margin-bottom,
215
+ system.size-unit(map.get($map, margin-bottom)),
216
+ $media,
217
+ $mediaBehavior
218
+ );
219
+ }
220
+ }
221
+ }
222
+ }
223
+
224
+ @each $typo, $values in variables.$typography {
225
+ @include _register-typo-variables($typo, $values);
226
+ }
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { ref, useId } from 'vue'
2
+ import { computed, ref } from 'vue'
3
3
  import { useArticles, useConfig } from '#composables';
4
4
  import { prepareHtmlContent, isDialogStored, addDialogToStorage, getDialogFromStorage } from '#utils';
5
5
 
@@ -10,10 +10,22 @@ const props = defineProps<{
10
10
 
11
11
  const config = useConfig();
12
12
  const articles = useArticles();
13
- const id = ref<string>(`srl-page__dialog-${useId()}`);
13
+ const id = ref<string>(`srl-page__dialog-${props.uuid.replaceAll(' ', '_')}`);
14
14
  const content = ref<string>('');
15
- const dialog = ref<SrlPageDialog | null>(null);
16
- let dialogStored = false
15
+
16
+ const dialog = isDialogStored(props.uuid)?
17
+ getDialogFromStorage(props.uuid):
18
+ ref<SrlPageDialog | null>(null);
19
+
20
+ if (!isDialogStored(props.uuid)) {
21
+ addDialogToStorage(props.uuid, dialog);
22
+ loadContent();
23
+ }
24
+
25
+ const state = computed<boolean>(() => {
26
+ return dialog.value ?
27
+ dialog.value.dialogState : false
28
+ });
17
29
 
18
30
  async function loadContent() {
19
31
  const article = articles.value.find((article) => article.uuid === props.uuid);
@@ -37,22 +49,8 @@ async function loadContent() {
37
49
  }
38
50
  }
39
51
 
40
- if (isDialogStored(props.uuid)) {
41
- dialogStored = true;
42
- } else {
43
- addDialogToStorage(props.uuid, dialog);
44
- loadContent();
45
- }
46
-
47
52
  async function open() {
48
- if (dialog.value) {
49
- dialog.value.open();
50
- } else {
51
- const storage = getDialogFromStorage(props.uuid);
52
- storage ?
53
- storage.open():
54
- console.warn(`Dialog with uuid ${props.uuid} not found in storage.`);
55
- }
53
+ dialog.value?.open();
56
54
  }
57
55
  </script>
58
56
 
@@ -62,7 +60,7 @@ async function open() {
62
60
  type="button"
63
61
  :aria-controls="id"
64
62
  aria-haspopup="dialog"
65
- :aria-expanded="dialog?.dialogState ?? false"
63
+ :aria-expanded="state"
66
64
  @click="open"
67
65
  >
68
66
  <slot />
@@ -1,25 +1,23 @@
1
1
  <script setup lang="ts">
2
- import { ref } from 'vue';
2
+ import { computed, ref } from 'vue'
3
3
  import SrlPageCustomDialog from '@/Dialog.vue';
4
4
  import Autoload from '@/Autoload.ts';
5
5
 
6
6
  const props = withDefaults(
7
- defineProps<{
8
- header?: string;
9
- content?: string;
10
- }>(),
11
- {
12
- header: '',
13
- content: '',
14
- },
7
+ defineProps<{
8
+ header?: string;
9
+ content?: string;
10
+ }>(),
11
+ {
12
+ header: '',
13
+ content: '',
14
+ },
15
15
  );
16
16
 
17
17
  const $el = ref<HTMLDialogElement | null>(null);
18
- const dialogState = ref<boolean>(false);
19
-
20
18
  const header = ref<string>(props.header);
21
19
  const content = ref<string>(props.content);
22
-
20
+ const dialogState = ref<boolean>(false);
23
21
  function setDialogContent(template: string) {
24
22
  content.value = template;
25
23
  }
@@ -30,15 +28,15 @@ function setDialogContentAndOpen(template: string) {
30
28
  }
31
29
 
32
30
  function open() {
33
- $el.value?.showModal();
34
31
  dialogState.value = true;
32
+ $el.value?.showModal();
35
33
  $el.value?.querySelector('.srl-dialog__main')?.focus();
36
34
  Autoload.init($el.value);
37
35
  }
38
36
 
39
37
  function close() {
40
- $el.value?.close();
41
38
  dialogState.value = false;
39
+ $el.value?.close();
42
40
  }
43
41
 
44
42
  function clearContent() {
@@ -58,11 +56,11 @@ defineExpose({
58
56
 
59
57
  <template>
60
58
  <dialog
61
- ref="$el"
62
- id="srl-page__dialog"
63
- class="srl-page__dialog"
64
- aria-modal="true"
65
- @click.stop="close"
59
+ ref="$el"
60
+ id="srl-page__dialog"
61
+ class="srl-page__dialog"
62
+ aria-modal="true"
63
+ @click.stop="close"
66
64
  >
67
65
  <SrlAriaTabChain @click.stop>
68
66
  <SrlPageCustomDialog :header="header" :content="content" @close="close" />
@@ -42,9 +42,9 @@ export function addDialogToStorage(uuid: string, refSrlPageDialog: Ref<SrlPageDi
42
42
  pageState.dialogStorage[uuid] = refSrlPageDialog
43
43
  }
44
44
 
45
- export function getDialogFromStorage(uuid: string): SrlPageDialog | null {
45
+ export function getDialogFromStorage(uuid: string): Ref<SrlPageDialog> | null {
46
46
  return isDialogStored(uuid)?
47
- pageState.dialogStorage[uuid].value : null
47
+ pageState.dialogStorage[uuid] : null
48
48
  }
49
49
 
50
50
  export function getDialogStorage() : DialogStorage {
package/srl/srl/pdf.scss DELETED
@@ -1,2 +0,0 @@
1
- @use 'config';
2
- @forward '@simple-reporting/base/scss/pdf';