@simple-reporting/base 1.0.12 → 1.0.14

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 (40) hide show
  1. package/dev/package.json +15 -15
  2. package/dev/src/assets/scss/app.scss +1 -0
  3. package/dev/src/assets/scss/components/note/accordion.scss +108 -0
  4. package/dev/src/assets/scss/editor.scss +45 -0
  5. package/dev/src/assets/scss/general.scss +1 -0
  6. package/dev/src/components/BypassLinks.vue +3 -5
  7. package/dev/tsconfig.json +1 -1
  8. package/dev/vite.config.ts +1 -1
  9. package/livingdocs/040.Media/030.video/ld-conf.json +1 -1
  10. package/livingdocs/100.Misc/010.anchor/anchor.html +3 -6
  11. package/livingdocs/100.Misc/010.anchor/scss/editor.scss +1 -12
  12. package/livingdocs/110.PDF/010.pdf-pagebreak/pdf-pagebreak.html +2 -2
  13. package/livingdocs/110.PDF/010.pdf-pagebreak/scss/editor.scss +0 -8
  14. package/livingdocs/110.PDF/030.pdf-publication-title/pdf-publication-title.html +2 -5
  15. package/livingdocs/110.PDF/030.pdf-publication-title/scss/editor.scss +0 -11
  16. package/livingdocs/110.PDF/040.pdf-chapter-title/pdf-chapter-title.html +2 -5
  17. package/livingdocs/110.PDF/040.pdf-chapter-title/scss/editor.scss +0 -5
  18. package/package.json +7 -7
  19. package/plugins/viteSrlPlugin.js +270 -0
  20. package/scripts/prepare.d.ts +1 -1
  21. package/scripts/prepare.js +3 -58
  22. package/srl/components/Srl/Menu/Item/Content/Icon.vue +17 -1
  23. package/srl/components/Srl/Menu/Item/Content/IconAfter.vue +26 -3
  24. package/srl/components/Srl/Menu/Item/Content/IconBefore.vue +27 -3
  25. package/srl/components/Srl/Menu/Item/Content/Image.vue +13 -1
  26. package/srl/components/Srl/Menu/Item/Content/ImageAfter.vue +21 -2
  27. package/srl/components/Srl/Menu/Item/Content/ImageBefore.vue +21 -2
  28. package/srl/components/Srl/Menu/Item/Content/Text.vue +14 -3
  29. package/srl/components/Srl/Menu/Item/Content.vue +21 -2
  30. package/srl/components/Srl/Menu/Item.vue +124 -77
  31. package/srl/components/Srl/Menu/List.vue +97 -57
  32. package/srl/components/Srl/Note/Accordion/Content.vue +54 -3
  33. package/srl/components/Srl/Note/Accordion/Toggle.vue +14 -4
  34. package/srl/components/Srl/Note/Accordion.vue +30 -7
  35. package/srl/plugins/vueSrlPlugin.ts +4 -7
  36. package/srl/tsconfig.srl.json +89 -0
  37. package/srl/types/components.d.ts +3 -0
  38. package/srl/utils/html.ts +3 -3
  39. package/srl/utils/uri.ts +3 -1
  40. package/srl/plugins/viteSrlPlugin.ts +0 -224
@@ -1,17 +1,40 @@
1
1
  <script setup lang="ts">
2
- import { ref, useId } from 'vue'
2
+ import { computed, ref, useId } from 'vue'
3
3
 
4
+ const rootEl = ref<HTMLElement | null>(null)
4
5
  const id = ref(useId())
5
- const accordion = ref<HTMLDivElement>()
6
- const open = ref(false)
7
-
6
+ const state = ref(false)
8
7
  function toggle() {
9
- open.value = !open.value
8
+ state.value ?
9
+ close() :
10
+ open()
11
+ }
12
+
13
+ function open() {
14
+ state.value = true
15
+ rootEl.value.querySelector<HTMLDivElement>(`#${id.value}`)?.focus()
10
16
  }
17
+
18
+ function close() {
19
+ state.value = false
20
+ }
21
+
22
+ const accordion = computed(() => {
23
+ const propId = id.value
24
+ const propState = state.value
25
+ return {
26
+ id: propId,
27
+ state: propState,
28
+ toggle,
29
+ open,
30
+ close,
31
+ }
32
+ })
33
+
11
34
  </script>
12
35
 
13
36
  <template>
14
- <div ref="accordion">
15
- <slot :id="id" :open="open" :toggle="toggle"/>
37
+ <div ref="rootEl">
38
+ <slot :accordion="accordion"/>
16
39
  </div>
17
40
  </template>
@@ -1,13 +1,10 @@
1
- import { defineComponent, type App } from 'vue';
1
+ import { defineComponent, type App, defineAsyncComponent } from 'vue'
2
2
  import SrlAriaTabChain from '#components/Srl/Aria/TabChain.vue';
3
3
  import SrlArticleAutoload from '#components/Srl/Article/Autoload.vue';
4
4
  import SrlArticleRoot from '#components/Srl/Article/Root.vue';
5
5
  import SrlArticleDialogButton from '#components/Srl/Article/DialogButton.vue';
6
6
  import SrlMenu from '#components/Srl/Menu/List.vue';
7
7
  import SrlPageDialog from '#components/Srl/Page/Dialog.vue';
8
- import SrlNoteAccordion from '#components/Srl/Note/Accordion.vue';
9
- import SrlNoteAccordionToggle from '#components/Srl/Note/Accordion/Toggle.vue';
10
- import SrlNoteAccordionContent from '#components/Srl/Note/Accordion/Content.vue';
11
8
 
12
9
  import asyncLdComponent from './asyncLdComponent.ts';
13
10
 
@@ -16,15 +13,15 @@ export default {
16
13
  app.component('SrlAriaTabChain', defineComponent(SrlAriaTabChain));
17
14
  app.component('SrlArticleAutoload', defineComponent(SrlArticleAutoload));
18
15
  app.component('SrlArticleRoot', defineComponent(SrlArticleRoot));
19
- app.component('SrlNoteAccordion', defineComponent(SrlNoteAccordion));
20
- app.component('SrlNoteAccordionToggle', defineComponent(SrlNoteAccordionToggle));
21
- app.component('SrlNoteAccordionContent', defineComponent(SrlNoteAccordionContent));
22
16
  app.component(
23
17
  'SrlArticleDialogButton',
24
18
  defineComponent(SrlArticleDialogButton),
25
19
  );
26
20
  app.component('SrlPageDialog', defineComponent(SrlPageDialog));
27
21
  app.component('SrlMenu', defineComponent(SrlMenu));
22
+ app.component('SrlNoteAccordion', defineAsyncComponent(() => import('#components/Srl/Note/Accordion.vue')));
23
+ app.component('SrlNoteAccordionToggle', defineAsyncComponent(() => import('#components/Srl/Note/Accordion/Toggle.vue')));
24
+ app.component('SrlNoteAccordionContent', defineAsyncComponent(() => import('#components/Srl/Note/Accordion/Content.vue')));
28
25
  asyncLdComponent(app);
29
26
  },
30
27
  };
@@ -0,0 +1,89 @@
1
+ {
2
+ "extends": "@vue/tsconfig/tsconfig.dom.json",
3
+ "include": [
4
+ "../env.d.ts",
5
+ "../src/**/*",
6
+ "../src/**/*.vue",
7
+ "./**/*",
8
+ "./**/*.vue",
9
+ "../livingdocs/**/*",
10
+ "../livingdocs/**/*.vue",
11
+ "./**/*.d.ts"
12
+ ],
13
+ "exclude": [
14
+ "../src/**/__tests__/*"
15
+ ],
16
+ "compilerOptions": {
17
+ "composite": true,
18
+ "tsBuildInfoFile": "../node_modules/.tmp/tsconfig.app.tsbuildinfo",
19
+ "baseUrl": ".",
20
+ "paths": {
21
+ "@/*": [
22
+ "../src/*"
23
+ ],
24
+ "~/*": [
25
+ "../*"
26
+ ],
27
+ "#srl": [
28
+ "./"
29
+ ],
30
+ "#srl/*": [
31
+ "./*"
32
+ ],
33
+ "#components": [
34
+ "./components"
35
+ ],
36
+ "#components/*": [
37
+ "./components/*"
38
+ ],
39
+ "#composables": [
40
+ "./composables"
41
+ ],
42
+ "#composables/*": [
43
+ "./composables/*"
44
+ ],
45
+ "#utils": [
46
+ "./utils"
47
+ ],
48
+ "#utils/*": [
49
+ "./utils/*"
50
+ ],
51
+ "#plugins": [
52
+ "./plugins"
53
+ ],
54
+ "#plugins/*": [
55
+ "./plugins/*"
56
+ ],
57
+ "#types": [
58
+ "./types"
59
+ ],
60
+ "#types/*": [
61
+ "./types/*"
62
+ ],
63
+ "#imports": [
64
+ "./imports"
65
+ ],
66
+ "#imports/*": [
67
+ "./imports/*"
68
+ ],
69
+ "#ld": [
70
+ "../livingdocs"
71
+ ],
72
+ "#ld/*": [
73
+ "../livingdocs/*"
74
+ ],
75
+ "assets": [
76
+ "../src/assets"
77
+ ],
78
+ "assets/*": [
79
+ "../src/assets/*"
80
+ ],
81
+ "srl": [
82
+ "./srl"
83
+ ],
84
+ "srl/*": [
85
+ "./srl/*"
86
+ ]
87
+ }
88
+ }
89
+ }
@@ -10,6 +10,9 @@ interface _GlobalComponents {
10
10
  SrlArticleRoot: (typeof import('../components/Srl/Article/Root.vue'))['default'];
11
11
  SrlMenu: (typeof import('../components/Srl/Menu/List.vue'))['default'];
12
12
  SrlPageDialog: (typeof import('../components/Srl/Page/Dialog.vue'))['default'];
13
+ SrlNoteAccordion: (typeof import('../components/Srl/Note/Accordion.vue'))['default'];
14
+ SrlNoteAccordionToggle: (typeof import('../components/Srl/Note/Accordion/Toggle.vue'))['default'];
15
+ SrlNoteAccordionContent: (typeof import('../components/Srl/Note/Accordion/Content.vue'))['default'];
13
16
  }
14
17
 
15
18
  declare module '@vue/runtime-core' {
package/srl/utils/html.ts CHANGED
@@ -36,7 +36,7 @@ function replaceAccordionContainer(text: string): string {
36
36
  const innerContent = replaceAccordionContainer(text.slice(openTagRegex.lastIndex, end - 6));
37
37
 
38
38
  result += text.slice(lastIndex, start);
39
- result += `<srl-note-accordion v-slot="{ id, open, toggle }"${attrs}>${innerContent}</srl-note-accordion>`;
39
+ result += `<srl-note-accordion v-slot="{ accordion }"${attrs}>${innerContent}</srl-note-accordion>`;
40
40
  lastIndex = end;
41
41
  openTagRegex.lastIndex = end;
42
42
  }
@@ -61,7 +61,7 @@ function replaceAccordionToggle(text: string): string {
61
61
  const innerContent = text.slice(contentStart, end);
62
62
 
63
63
  result += text.slice(lastIndex, start);
64
- result += `<srl-note-accordion-toggle :id="id" :open="open" :toggle="toggle"${attrs}>${innerContent}</srl-note-accordion-toggle>`;
64
+ result += `<srl-note-accordion-toggle :accordion="accordion"${attrs}>${innerContent}</srl-note-accordion-toggle>`;
65
65
  lastIndex = end + closeTag.length;
66
66
  openTagRegex.lastIndex = lastIndex;
67
67
  }
@@ -97,7 +97,7 @@ function replaceAccordionContent(text: string): string {
97
97
  const innerContent = replaceAccordionContent(text.slice(openTagRegex.lastIndex, end - 6));
98
98
 
99
99
  result += text.slice(lastIndex, start);
100
- result += `<srl-note-accordion-content :id="id" :open="open"${attrs}>${innerContent}</srl-note-accordion-content>`;
100
+ result += `<srl-note-accordion-content :accordion="accordion"${attrs}>${innerContent}</srl-note-accordion-content>`;
101
101
  lastIndex = end;
102
102
  openTagRegex.lastIndex = end;
103
103
  }
package/srl/utils/uri.ts CHANGED
@@ -2,6 +2,7 @@ export function isRouterPath(path: string): boolean {
2
2
  return (
3
3
  (path.startsWith('/') || path.startsWith('./')) &&
4
4
  !path.startsWith('//') &&
5
+ !path.startsWith('javascript:') &&
5
6
  !path.endsWith('.html') &&
6
7
  !path.endsWith('.htm') &&
7
8
  !path.endsWith('.php') &&
@@ -42,7 +43,8 @@ export function isExternalPath(path: string): boolean {
42
43
  path.startsWith('wss') ||
43
44
  path.startsWith('irc') ||
44
45
  path.startsWith('gopher') ||
45
- path.startsWith('whatsapp')
46
+ path.startsWith('whatsapp') ||
47
+ path.startsWith('javascript:')
46
48
  );
47
49
  }
48
50
 
@@ -1,224 +0,0 @@
1
- import { type Plugin } from 'vite';
2
- import { fileURLToPath, URL } from 'node:url';
3
- import { readFileSync } from 'node:fs';
4
- import { join } from 'node:path/posix';
5
- import { execSync } from 'node:child_process';
6
- import folders from '@simple-reporting/base/scripts/folders.js';
7
- import { beaver } from '@simple-reporting/base/scripts/beaver.js';
8
- import { packageName } from '@simple-reporting/base/scripts/config';
9
- import { updatePackageJson, updateLivingDocsJson, updateNsWowJson } from '@simple-reporting/base/scripts/utils';
10
- import {
11
- map,
12
- mapLdd,
13
- mapJs,
14
- mapScss,
15
- } from '@simple-reporting/base/scripts/build.js';
16
- import chalk from 'chalk';
17
-
18
- const msgBoxLength = 60;
19
-
20
- function centerText(text: string): string {
21
- const padding = Math.max(0, (msgBoxLength - text.length) / 2);
22
- return (
23
- ' '.repeat(Math.floor(padding)) + text + ' '.repeat(Math.ceil(padding))
24
- );
25
- }
26
-
27
- function isVersionGreater(v1, v2) {
28
- const a = v1.split('.').map(Number);
29
- const b = v2.split('.').map(Number);
30
- for (let i = 0; i < 3; i++) {
31
- if (a[i] > b[i]) return true;
32
- if (a[i] < b[i]) return false;
33
- }
34
- return false; // gleich
35
- }
36
-
37
- function checkSrlVersion() {
38
- try {
39
- const pkgPath = join(folders.packagePath, 'package.json');
40
- const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
41
- const current = pkg.version;
42
- if (!current) return;
43
-
44
- const tag = `v${current.split('.')[0]}-lts`;
45
-
46
- const latest = execSync(`npm view ${packageName}@${tag} version`)
47
- .toString()
48
- .trim();
49
-
50
- if (isVersionGreater(latest, current)) {
51
- console.log('');
52
- console.log(chalk.bgWhiteBright(centerText('')));
53
- console.log(
54
- chalk.bgWhiteBright.redBright.bold(centerText('Attention !!!')),
55
- );
56
- console.log(
57
- chalk.bgWhiteBright.black.bold(
58
- centerText(`New ${packageName} version available.`),
59
- ),
60
- );
61
- console.log(
62
- chalk.bgWhiteBright.black.bold(
63
- centerText(`Update: ${current} => ${latest}`),
64
- ),
65
- );
66
- console.log(
67
- chalk.bgWhiteBright.black.bold(
68
- centerText(`Run: npm update -S ${packageName}`),
69
- ),
70
- );
71
- console.log(chalk.bgWhiteBright(centerText('')));
72
- console.log('');
73
- }
74
- } catch (e) {}
75
- }
76
-
77
- let timer: NodeJS.Timeout | null = null;
78
-
79
- function triggerAction(callback) {
80
- !timer || clearTimeout(timer);
81
- timer = setTimeout(async () => {
82
- await callback();
83
- }, 200);
84
- }
85
-
86
- async function startActions() {
87
- checkSrlVersion();
88
- await beaver(0);
89
- await map();
90
- await mapJs();
91
- }
92
-
93
- export default function viteSrlPlugin(): Plugin {
94
- return {
95
- name: 'vite-srl-plugin',
96
- config(config) {
97
- startActions();
98
-
99
- config.base = './';
100
-
101
- config.resolve = config.resolve || {};
102
- config.resolve.alias['~'] = fileURLToPath(
103
- new URL('../..', import.meta.url),
104
- );
105
- config.resolve.alias['@'] = fileURLToPath(
106
- new URL('../../src', import.meta.url),
107
- );
108
- config.resolve.alias['#components'] = fileURLToPath(
109
- new URL('../components', import.meta.url),
110
- );
111
- config.resolve.alias['#composables'] = fileURLToPath(
112
- new URL('../composables', import.meta.url),
113
- );
114
- config.resolve.alias['#plugins'] = fileURLToPath(
115
- new URL('../plugins', import.meta.url),
116
- );
117
- config.resolve.alias['#types'] = fileURLToPath(
118
- new URL('../types', import.meta.url),
119
- );
120
- config.resolve.alias['#utils'] = fileURLToPath(
121
- new URL('../utils', import.meta.url),
122
- );
123
- config.resolve.alias['#imports'] = fileURLToPath(
124
- new URL('../imports', import.meta.url),
125
- );
126
- config.resolve.alias['#ld'] = fileURLToPath(
127
- new URL('../../livingdocs', import.meta.url),
128
- );
129
- config.resolve.alias['assets'] = fileURLToPath(
130
- new URL('../../src/assets', import.meta.url),
131
- );
132
- config.resolve.alias['srl'] = fileURLToPath(
133
- new URL('../srl', import.meta.url),
134
- );
135
- config.resolve.alias['vue'] = 'vue/dist/vue.esm-bundler.js';
136
- },
137
- configureServer(server) {
138
- const fontPath = join(folders.srlAssets, 'fonts');
139
-
140
- server.watcher.on('change', async (path) => {
141
- if (path.endsWith('/package.json')) {
142
- await updatePackageJson();
143
- }
144
- if (path.endsWith('/livingdocs.config.json')) {
145
- await updateLivingDocsJson();
146
- }
147
- if (path.endsWith('/srl.config.json')) {
148
- await updateNsWowJson();
149
- triggerAction(beaver);
150
- }
151
- });
152
-
153
- server.watcher.on('add', (path) => {
154
- if (
155
- path.endsWith('/general.scss') ||
156
- path.endsWith('/app.scss') ||
157
- path.endsWith('/ldd.scss') ||
158
- path.endsWith('/editor.scss') ||
159
- path.endsWith('/pdf.scss') ||
160
- path.endsWith('/word.scss') ||
161
- path.endsWith('/xbrl.scss') ||
162
- (
163
- path.startsWith(fontPath) &&
164
- path.endsWith('.scss')
165
- )
166
- ) {
167
- triggerAction(mapScss);
168
- }
169
-
170
- if (
171
- path.includes('livingdocs') &&
172
- (path.endsWith('/app.js') || path.endsWith('/app.ts'))
173
- ) {
174
- triggerAction(mapJs);
175
- }
176
-
177
- if (
178
- path.includes('livingdocs') &&
179
- (path.endsWith('/properties.json') ||
180
- path.endsWith('/properties.ts') ||
181
- path.endsWith('/properties.js') ||
182
- path.endsWith('.vue'))
183
- ) {
184
- triggerAction(mapLdd);
185
- }
186
- });
187
-
188
- server.watcher.on('unlink', (path) => {
189
- if (
190
- path.endsWith('/general.scss') ||
191
- path.endsWith('/app.scss') ||
192
- path.endsWith('/ldd.scss') ||
193
- path.endsWith('/editor.scss') ||
194
- path.endsWith('/pdf.scss') ||
195
- path.endsWith('/word.scss') ||
196
- path.endsWith('/xbrl.scss')||
197
- (
198
- path.startsWith(fontPath) &&
199
- path.endsWith('.scss')
200
- )
201
- ) {
202
- triggerAction(mapScss);
203
- }
204
-
205
- if (
206
- path.includes('livingdocs') &&
207
- (path.endsWith('/app.js') || path.endsWith('/app.ts'))
208
- ) {
209
- triggerAction(mapJs);
210
- }
211
-
212
- if (
213
- path.includes('livingdocs') &&
214
- (path.endsWith('/properties.json') ||
215
- path.endsWith('/properties.ts') ||
216
- path.endsWith('/properties.js') ||
217
- path.endsWith('.vue'))
218
- ) {
219
- triggerAction(mapLdd);
220
- }
221
- });
222
- },
223
- };
224
- }