@simple-reporting/base 1.0.13 → 1.0.15
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.
- package/dev/package.json +14 -14
- package/dev/src/assets/scss/editor.scss +45 -0
- package/dev/src/assets/scss/general.scss +1 -0
- package/dev/tsconfig.json +1 -1
- package/dev/vite.config.ts +1 -1
- package/livingdocs/040.Media/010.table/table/download.vue +494 -0
- package/livingdocs/040.Media/010.table/table/responsive.vue +104 -0
- package/livingdocs/040.Media/010.table/table.html +2 -2
- package/livingdocs/040.Media/010.table/table.vue +26 -0
- package/livingdocs/040.Media/030.video/ld-conf.json +1 -1
- package/livingdocs/100.Misc/010.anchor/anchor.html +3 -6
- package/livingdocs/100.Misc/010.anchor/scss/editor.scss +1 -12
- package/livingdocs/110.PDF/010.pdf-pagebreak/pdf-pagebreak.html +2 -2
- package/livingdocs/110.PDF/010.pdf-pagebreak/scss/editor.scss +0 -8
- package/livingdocs/110.PDF/030.pdf-publication-title/pdf-publication-title.html +2 -5
- package/livingdocs/110.PDF/030.pdf-publication-title/scss/editor.scss +0 -11
- package/livingdocs/110.PDF/040.pdf-chapter-title/pdf-chapter-title.html +2 -5
- package/livingdocs/110.PDF/040.pdf-chapter-title/scss/editor.scss +0 -5
- package/package.json +7 -7
- package/plugins/viteSrlPlugin.d.ts +2 -0
- package/{srl/plugins/viteSrlPlugin.ts → plugins/viteSrlPlugin.js} +114 -86
- package/scripts/prepare.d.ts +1 -1
- package/scripts/prepare.js +3 -58
- package/scripts/vue/components.d.ts +1 -0
- package/scripts/vue/components.js +94 -0
- package/srl/components/Srl/Article/{DialogButton.vue → Dialog/Button.vue} +1 -1
- package/srl/components/Srl/Menu/Item/Content.vue +7 -14
- package/srl/components/Srl/Menu/Item.vue +5 -7
- package/srl/components/Srl/{Menu/List.vue → Menu.vue} +2 -3
- package/srl/components/Srl/Note/Accordion/Content.vue +1 -1
- package/srl/components/Srl/Page/Dialog.vue +1 -1
- package/srl/plugins/asyncLdComponent.ts +2 -2
- package/srl/plugins/asyncSrlComponents.ts +2 -0
- package/srl/plugins/initProject.ts +1 -1
- package/srl/plugins/vueSrlPlugin.ts +3 -20
- package/srl/tsconfig.srl.json +89 -0
- package/srl/types/components.d.ts +3 -14
- package/srl/types/global.d.ts +7 -0
- package/srl/types/nswow.d.ts +14 -14
- /package/srl/components/{Srl/Page/App.vue → App.vue} +0 -0
- /package/srl/components/Srl/Menu/Item/Content/{IconAfter.vue → Icon/After.vue} +0 -0
- /package/srl/components/Srl/Menu/Item/Content/{IconBefore.vue → Icon/Before.vue} +0 -0
- /package/srl/components/Srl/Menu/Item/Content/{ImageAfter.vue → Image/After.vue} +0 -0
- /package/srl/components/Srl/Menu/Item/Content/{ImageBefore.vue → Image/Before.vue} +0 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref, watch } from 'vue'
|
|
3
|
+
|
|
4
|
+
const props = withDefaults(defineProps<{
|
|
5
|
+
component?: HTMLDivElement
|
|
6
|
+
containerSelector?: string
|
|
7
|
+
tableSelector?: string
|
|
8
|
+
}>(), {
|
|
9
|
+
containerSelector: '.srl-table__container',
|
|
10
|
+
tableSelector: 'table'
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
const component = ref<HTMLDivElement>()
|
|
14
|
+
const table = ref<HTMLTableElement>()
|
|
15
|
+
const container = ref<HTMLDivElement>()
|
|
16
|
+
|
|
17
|
+
watch(
|
|
18
|
+
props,
|
|
19
|
+
to => {
|
|
20
|
+
!to.component || init(to.component)
|
|
21
|
+
}
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
function init(componentEl: HTMLDivElement | undefined) {
|
|
25
|
+
if (!componentEl) return
|
|
26
|
+
component.value = componentEl
|
|
27
|
+
table.value = componentEl.querySelector(props.tableSelector) as HTMLTableElement
|
|
28
|
+
container.value = componentEl.querySelector(props.containerSelector) as HTMLDivElement
|
|
29
|
+
updateClasses()
|
|
30
|
+
enableDragScroll()
|
|
31
|
+
window.addEventListener('resize', updateClasses)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
defineExpose({
|
|
35
|
+
init
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
function hasHorizontalScrollbar(): boolean {
|
|
39
|
+
return !table.value || !container.value ?
|
|
40
|
+
false :
|
|
41
|
+
table.value?.clientWidth > container.value?.clientWidth
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function hasRowSpan() {
|
|
45
|
+
if (!table.value) return false
|
|
46
|
+
const tableCells = table.value.querySelectorAll('td[rowspan]')
|
|
47
|
+
return tableCells.length > 0
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function updateClasses() {
|
|
51
|
+
const hasScroll = hasHorizontalScrollbar()
|
|
52
|
+
const hasRowspan = hasRowSpan()
|
|
53
|
+
|
|
54
|
+
if (hasScroll && !hasRowspan) {
|
|
55
|
+
component.value?.classList.add('has-shadow', 'responsive-table')
|
|
56
|
+
component.value?.classList.remove('responsive-table-alternative')
|
|
57
|
+
} else if (hasScroll && hasRowspan) {
|
|
58
|
+
component.value?.classList.add('responsive-table-alternative')
|
|
59
|
+
component.value?.classList.remove('has-shadow', 'responsive-table')
|
|
60
|
+
} else {
|
|
61
|
+
component.value?.classList.remove('has-shadow', 'responsive-table', 'responsive-table-alternative')
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function enableDragScroll() {
|
|
66
|
+
let isDragging: boolean = false;
|
|
67
|
+
let startX: number = 0;
|
|
68
|
+
let scrollLeft: number = 0;
|
|
69
|
+
|
|
70
|
+
if (container.value) {
|
|
71
|
+
container.value.addEventListener('mousedown', (e) => {
|
|
72
|
+
if (container.value) {
|
|
73
|
+
isDragging = true;
|
|
74
|
+
startX = e.pageX - container.value.offsetLeft;
|
|
75
|
+
scrollLeft = container.value.scrollLeft;
|
|
76
|
+
container.value.classList.add('dragging');
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
container.value.addEventListener('mousemove', (e) => {
|
|
81
|
+
if (container.value) {
|
|
82
|
+
if (!isDragging) return;
|
|
83
|
+
e.preventDefault();
|
|
84
|
+
const x = e.pageX - container.value.offsetLeft;
|
|
85
|
+
const walk = (x - startX) * 2; // Adjust speed
|
|
86
|
+
container.value.scrollLeft = scrollLeft - walk;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
container.value.addEventListener('mouseup', () => {
|
|
91
|
+
isDragging = false;
|
|
92
|
+
container.value?.classList.remove('dragging');
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
container.value.addEventListener('mouseleave', () => {
|
|
96
|
+
isDragging = false;
|
|
97
|
+
container.value?.classList.remove('dragging');
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
</script>
|
|
102
|
+
|
|
103
|
+
<template>
|
|
104
|
+
</template>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<
|
|
1
|
+
<srl-ld-table class="srl-table">
|
|
2
2
|
<div class="srl-table__container" doc-include="nswow-table">
|
|
3
3
|
<p class="srl-grid srl-paragraph">
|
|
4
4
|
<span class="srl-grid__inner srl-paragraph__text">
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
</span>
|
|
7
7
|
</p>
|
|
8
8
|
</div>
|
|
9
|
-
</
|
|
9
|
+
</srl-ld-table>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
|
|
3
|
+
const props = withDefaults(defineProps<{
|
|
4
|
+
responsive?: boolean
|
|
5
|
+
download?: boolean
|
|
6
|
+
}>(), {
|
|
7
|
+
responsive: false,
|
|
8
|
+
download: false,
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
import { ref } from 'vue'
|
|
12
|
+
import TableResponsive from './table/responsive.vue'
|
|
13
|
+
import TableDownload from './table/download.vue'
|
|
14
|
+
|
|
15
|
+
const component = ref<HTMLDivElement>()
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<div ref="component">
|
|
20
|
+
<TableResponsive v-if="props.responsive" :component="component" />
|
|
21
|
+
<slot/>
|
|
22
|
+
<div v-if="props.download" class="srl-table__download">
|
|
23
|
+
<TableDownload :component="component" />
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
<p class="srl-anchor" data-is-anchor="true">
|
|
2
|
-
<span class="srl-
|
|
3
|
-
Anchor:
|
|
4
|
-
</span>
|
|
5
|
-
<span class="srl-anchor__text" doc-editable="anchor-text">
|
|
1
|
+
<p class="srl-anchor srl-editor-component" data-is-anchor="true">
|
|
2
|
+
<span class="srl-anchor__text srl-editor-component__text" doc-editable="anchor-text">
|
|
6
3
|
Must start with a letter (A–Z or a–z); a number is not allowed. After the
|
|
7
4
|
first letter, any combination of letters (a–z, A–Z), digits (0–9), hyphens
|
|
8
5
|
(-), underscores (_), colons (:), and periods (.) is allowed. The ID must be
|
|
9
6
|
unique and is case-sensitive.
|
|
10
7
|
</span>
|
|
11
|
-
</p>
|
|
8
|
+
</p>
|
|
@@ -2,18 +2,7 @@
|
|
|
2
2
|
@use 'web';
|
|
3
3
|
@use 'assets/scss/placeholders';
|
|
4
4
|
|
|
5
|
-
.srl-anchor {
|
|
6
|
-
border-top: 1px solid #{srl.colors-secondary-1000()};
|
|
7
|
-
border-bottom: 1px solid #{srl.colors-secondary-1000()};
|
|
8
|
-
@include srl.spacer-padding-block(200);
|
|
9
|
-
@extend %srl-grid-base;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.srl-anchor__editor-text {
|
|
13
|
-
@extend %srl-regular-width;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
5
|
.srl-anchor__text {
|
|
17
6
|
@extend %srl-regular-width;
|
|
18
7
|
@include srl.typography-pdf-header()
|
|
19
|
-
}
|
|
8
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
<div class="srl-pdf-pagebreak" data-remove-from-web="complete">
|
|
2
|
-
<span class="srl-pdf-pagebreak__editor-text" data-remove-from-pdf="complete">
|
|
1
|
+
<div class="srl-pdf-pagebreak srl-editor-component" data-remove-from-web="complete">
|
|
2
|
+
<span class="srl-pdf-pagebreak__editor-text srl-editor-component__text" data-remove-from-pdf="complete">
|
|
3
3
|
PDF page break
|
|
4
4
|
</span>
|
|
5
5
|
</div>
|
|
@@ -3,18 +3,10 @@
|
|
|
3
3
|
@use 'assets/scss/placeholders';
|
|
4
4
|
|
|
5
5
|
.srl-pdf-pagebreak {
|
|
6
|
-
border-top: 1px solid #{srl.colors-secondary-1000()};
|
|
7
|
-
border-bottom: 1px solid #{srl.colors-secondary-1000()};
|
|
8
6
|
text-align: center;
|
|
9
|
-
@include srl.spacer-padding-block(200);
|
|
10
|
-
@extend %srl-grid-base;
|
|
11
7
|
}
|
|
12
8
|
|
|
13
9
|
.srl-pdf-pagebreak__editor-text {
|
|
14
10
|
@include srl.typography-editor-label-text();
|
|
15
11
|
@extend %srl-regular-width;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.srl-pdf-pagebreak__text {
|
|
19
|
-
@extend %srl-regular-width;
|
|
20
12
|
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
<p
|
|
2
|
-
class="srl-pdf-publication-title"
|
|
2
|
+
class="srl-pdf-publication-title srl-editor-component"
|
|
3
3
|
data-remove-from-web="complete"
|
|
4
4
|
>
|
|
5
|
-
<span class="srl-pdf-publication-
|
|
6
|
-
PDF publication title:
|
|
7
|
-
</span>
|
|
8
|
-
<span class="srl-pdf-publication-title__text" doc-editable="pdf-publication-titletext">
|
|
5
|
+
<span class="srl-pdf-publication-title__text srl-editor-component__text" doc-editable="pdf-publication-titletext">
|
|
9
6
|
Publication title
|
|
10
7
|
</span>
|
|
11
8
|
</p>
|
|
@@ -2,17 +2,6 @@
|
|
|
2
2
|
@use 'web';
|
|
3
3
|
@use 'assets/scss/placeholders';
|
|
4
4
|
|
|
5
|
-
.srl-pdf-publication-title {
|
|
6
|
-
border-bottom: 1px solid #{srl.colors-primary-1000()};
|
|
7
|
-
@include srl.spacer-padding-block(200);
|
|
8
|
-
@extend %srl-grid-base;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.srl-pdf-publication-title__editor-text {
|
|
12
|
-
@include srl.typography-editor-label-text();
|
|
13
|
-
@extend %srl-regular-width;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
5
|
.srl-pdf-publication-title__text {
|
|
17
6
|
@extend %srl-regular-width;
|
|
18
7
|
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
<p
|
|
2
|
-
class="srl-pdf-chapter-title"
|
|
2
|
+
class="srl-pdf-chapter-title srl-editor-component"
|
|
3
3
|
data-remove-from-web="complete"
|
|
4
4
|
>
|
|
5
|
-
<span class="srl-pdf-chapter-
|
|
6
|
-
PDF chapter title:
|
|
7
|
-
</span>
|
|
8
|
-
<span class="srl-pdf-chapter-title__text" doc-editable="pdf-chapter-title-text">
|
|
5
|
+
<span class="srl-pdf-chapter-title__text srl-editor-component__text" doc-editable="pdf-chapter-title-text">
|
|
9
6
|
Chapter title
|
|
10
7
|
</span>
|
|
11
8
|
</p>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simple-reporting/base",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"description": "Manage srl templates, build and publish",
|
|
5
5
|
"bin": {
|
|
6
6
|
"srl": "cli.js"
|
|
@@ -19,16 +19,16 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@kne/color-palette": "^0.1.0",
|
|
21
21
|
"archiver": "^7.0.1",
|
|
22
|
-
"chalk": "^5.
|
|
22
|
+
"chalk": "^5.6.2",
|
|
23
23
|
"colors": "^1.4.0",
|
|
24
24
|
"commander": "^11.1.0",
|
|
25
25
|
"enquirer": "^2.4.1",
|
|
26
26
|
"fs": "^0.0.1-security",
|
|
27
|
-
"fs-extra": "^11.2
|
|
27
|
+
"fs-extra": "^11.3.2",
|
|
28
28
|
"glob": "^10.4.5",
|
|
29
29
|
"modern-css-reset": "^1.4.0",
|
|
30
30
|
"node-html-parser": "^7.0.1",
|
|
31
|
-
"vite": "^
|
|
31
|
+
"vite": "^6.3.6",
|
|
32
32
|
"write-json": "^3.0.1"
|
|
33
33
|
},
|
|
34
34
|
"keywords": [
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"author": "Michael Dörer",
|
|
42
42
|
"license": "ISC",
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"jest": "^30.
|
|
45
|
-
"prettier": "^3.
|
|
46
|
-
"typescript": "^5.
|
|
44
|
+
"jest": "^30.1.3",
|
|
45
|
+
"prettier": "^3.6.2",
|
|
46
|
+
"typescript": "^5.9.2"
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -1,81 +1,123 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { readFileSync } from 'node:fs';
|
|
4
|
-
import { join } from 'node:path/posix';
|
|
1
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { join, relative } from 'node:path/posix';
|
|
5
3
|
import { execSync } from 'node:child_process';
|
|
6
|
-
import folders from '
|
|
7
|
-
import { beaver } from '
|
|
8
|
-
import { packageName } from '
|
|
9
|
-
import
|
|
4
|
+
import folders from '../scripts/folders.js';
|
|
5
|
+
import { beaver } from '../scripts/beaver.js';
|
|
6
|
+
import { packageName } from '../scripts/config.js';
|
|
7
|
+
import prepare from '../scripts/prepare.js';
|
|
8
|
+
import { updatePackageJson, updateLivingDocsJson, updateNsWowJson } from '../scripts/utils.js';
|
|
10
9
|
import {
|
|
11
10
|
map,
|
|
12
11
|
mapLdd,
|
|
13
12
|
mapJs,
|
|
14
13
|
mapScss,
|
|
15
|
-
} from '
|
|
14
|
+
} from '../scripts/build.js';
|
|
16
15
|
import chalk from 'chalk';
|
|
16
|
+
import { vueComponents } from '../scripts/vue/components.js';
|
|
17
17
|
|
|
18
|
-
const msgBoxLength = 60;
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Output prompts message in a box
|
|
21
|
+
*/
|
|
22
|
+
const msgBoxLength = 60;
|
|
23
|
+
function centerText(text) {
|
|
21
24
|
const padding = Math.max(0, (msgBoxLength - text.length) / 2);
|
|
22
25
|
return (
|
|
23
26
|
' '.repeat(Math.floor(padding)) + text + ' '.repeat(Math.ceil(padding))
|
|
24
27
|
);
|
|
25
28
|
}
|
|
29
|
+
function printPromptsMessage(messages) {
|
|
30
|
+
console.log('');
|
|
31
|
+
console.log(chalk.bgWhiteBright(centerText('')));
|
|
32
|
+
messages.forEach(m => {
|
|
33
|
+
console.log(chalk.bgWhiteBright.black.bold(centerText(m)));
|
|
34
|
+
})
|
|
35
|
+
console.log(chalk.bgWhiteBright(centerText('')));
|
|
36
|
+
console.log('');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const data = {
|
|
40
|
+
version: null
|
|
41
|
+
};
|
|
42
|
+
const srlConfig = readConfigJson();
|
|
43
|
+
|
|
44
|
+
function readConfigJson() {
|
|
45
|
+
const configPath = join(folders.srlRoot, 'config.json');
|
|
46
|
+
if (existsSync(configPath)) {
|
|
47
|
+
const content = readFileSync(configPath, 'utf-8');
|
|
48
|
+
return JSON.parse(content);
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function writeConfigJson(config) {
|
|
54
|
+
const configPath = join(folders.srlRoot, 'config.json');
|
|
55
|
+
writeFileSync(configPath, JSON.stringify(config, null, 2), 'utf-8');
|
|
56
|
+
}
|
|
26
57
|
|
|
27
58
|
function isVersionGreater(v1, v2) {
|
|
28
59
|
const a = v1.split('.').map(Number);
|
|
29
60
|
const b = v2.split('.').map(Number);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
return false; // gleich
|
|
61
|
+
if (a[0] > b[0]) return false;
|
|
62
|
+
if (a[1] > b[1]) return false;
|
|
63
|
+
return a[2] > b[2];
|
|
35
64
|
}
|
|
36
65
|
|
|
37
|
-
function
|
|
66
|
+
function getPackageVersion() {
|
|
38
67
|
try {
|
|
39
68
|
const pkgPath = join(folders.packagePath, 'package.json');
|
|
40
69
|
const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
|
|
41
|
-
|
|
42
|
-
|
|
70
|
+
return pkg.version || null;
|
|
71
|
+
} catch (e) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function checkForUpdates() {
|
|
77
|
+
try {
|
|
78
|
+
if (!data.version) return;
|
|
43
79
|
|
|
44
|
-
const tag = `v${
|
|
80
|
+
const tag = `v${data.version.split('.')[0]}-lts`;
|
|
45
81
|
|
|
46
82
|
const latest = execSync(`npm view ${packageName}@${tag} version`)
|
|
47
83
|
.toString()
|
|
48
84
|
.trim();
|
|
49
85
|
|
|
50
|
-
if (isVersionGreater(latest,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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('');
|
|
86
|
+
if (isVersionGreater(latest, data.version)) {
|
|
87
|
+
printPromptsMessage([
|
|
88
|
+
'Attention !!!',
|
|
89
|
+
`New ${packageName} version available.`,
|
|
90
|
+
`Update: ${data.version} => ${latest}`,
|
|
91
|
+
`Run: npm update -S ${packageName}`,
|
|
92
|
+
])
|
|
73
93
|
}
|
|
74
94
|
} catch (e) {}
|
|
75
95
|
}
|
|
96
|
+
async function startActions() {
|
|
97
|
+
data.version = getPackageVersion();
|
|
98
|
+
checkForUpdates();
|
|
99
|
+
if (!srlConfig || JSON.stringify(srlConfig) !== JSON.stringify(data)) {
|
|
100
|
+
writeConfigJson(data);
|
|
101
|
+
}
|
|
102
|
+
if (srlConfig && srlConfig.version !== data.version) {
|
|
103
|
+
await prepare();
|
|
104
|
+
printPromptsMessage([
|
|
105
|
+
'Srl version changed',
|
|
106
|
+
'Trigger srl prepare',
|
|
107
|
+
]);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
await vueComponents();
|
|
111
|
+
await beaver(0);
|
|
112
|
+
await map();
|
|
113
|
+
await mapJs();
|
|
114
|
+
}
|
|
76
115
|
|
|
77
|
-
let timer: NodeJS.Timeout | null = null;
|
|
78
116
|
|
|
117
|
+
/**
|
|
118
|
+
* Timer to trigger live reload actions
|
|
119
|
+
*/
|
|
120
|
+
let timer = null;
|
|
79
121
|
function triggerAction(callback) {
|
|
80
122
|
!timer || clearTimeout(timer);
|
|
81
123
|
timer = setTimeout(async () => {
|
|
@@ -83,14 +125,7 @@ function triggerAction(callback) {
|
|
|
83
125
|
}, 200);
|
|
84
126
|
}
|
|
85
127
|
|
|
86
|
-
|
|
87
|
-
checkSrlVersion();
|
|
88
|
-
await beaver(0);
|
|
89
|
-
await map();
|
|
90
|
-
await mapJs();
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export default function viteSrlPlugin(): Plugin {
|
|
128
|
+
export default function viteSrlPlugin() {
|
|
94
129
|
return {
|
|
95
130
|
name: 'vite-srl-plugin',
|
|
96
131
|
config(config) {
|
|
@@ -99,42 +134,21 @@ export default function viteSrlPlugin(): Plugin {
|
|
|
99
134
|
config.base = './';
|
|
100
135
|
|
|
101
136
|
config.resolve = config.resolve || {};
|
|
102
|
-
config.resolve.alias
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
config.resolve.alias['
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
config.resolve.alias['#
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
config.resolve.alias['#
|
|
112
|
-
|
|
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
|
-
);
|
|
137
|
+
config.resolve.alias = config.resolve.alias || {};
|
|
138
|
+
config.resolve.alias['~'] = folders.root;
|
|
139
|
+
config.resolve.alias['@'] = folders.srlSrc;
|
|
140
|
+
config.resolve.alias['#components'] = folders.srlComponents;
|
|
141
|
+
config.resolve.alias['#composables'] = folders.srlComposables;
|
|
142
|
+
config.resolve.alias['#plugins'] = folders.srlPlugins;
|
|
143
|
+
config.resolve.alias['#types'] = folders.srlTypes;
|
|
144
|
+
config.resolve.alias['#utils'] = folders.srlUtils;
|
|
145
|
+
config.resolve.alias['#imports'] = folders.srlImports;
|
|
146
|
+
config.resolve.alias['#ld'] = folders.ld;
|
|
147
|
+
config.resolve.alias['assets'] = folders.srlAssets;
|
|
148
|
+
config.resolve.alias['srl'] = folders.srlSystem;
|
|
135
149
|
config.resolve.alias['vue'] = 'vue/dist/vue.esm-bundler.js';
|
|
136
150
|
},
|
|
137
|
-
configureServer(server) {
|
|
151
|
+
async configureServer(server) {
|
|
138
152
|
const fontPath = join(folders.srlAssets, 'fonts');
|
|
139
153
|
|
|
140
154
|
server.watcher.on('change', async (path) => {
|
|
@@ -183,6 +197,13 @@ export default function viteSrlPlugin(): Plugin {
|
|
|
183
197
|
) {
|
|
184
198
|
triggerAction(mapLdd);
|
|
185
199
|
}
|
|
200
|
+
|
|
201
|
+
if (
|
|
202
|
+
path.includes('src/components/Srl') &&
|
|
203
|
+
path.endsWith('.vue')
|
|
204
|
+
) {
|
|
205
|
+
triggerAction(vueComponents);
|
|
206
|
+
}
|
|
186
207
|
});
|
|
187
208
|
|
|
188
209
|
server.watcher.on('unlink', (path) => {
|
|
@@ -218,6 +239,13 @@ export default function viteSrlPlugin(): Plugin {
|
|
|
218
239
|
) {
|
|
219
240
|
triggerAction(mapLdd);
|
|
220
241
|
}
|
|
242
|
+
|
|
243
|
+
if (
|
|
244
|
+
path.includes('src/components/Srl') &&
|
|
245
|
+
path.endsWith('.vue')
|
|
246
|
+
) {
|
|
247
|
+
triggerAction(vueComponents);
|
|
248
|
+
}
|
|
221
249
|
});
|
|
222
250
|
},
|
|
223
251
|
};
|
package/scripts/prepare.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export default prepare;
|
|
2
|
-
declare function prepare(): void
|
|
2
|
+
declare function prepare(): Promise<void>;
|
package/scripts/prepare.js
CHANGED
|
@@ -1,66 +1,11 @@
|
|
|
1
1
|
import folders from './folders.js';
|
|
2
2
|
import fs from 'fs';
|
|
3
|
-
import path from 'path/posix';
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
'.srl/**/*',
|
|
7
|
-
'.srl/**/*.d.ts',
|
|
8
|
-
'.srl/**/*.vue',
|
|
9
|
-
'livingdocs/**/*',
|
|
10
|
-
'livingdocs/**/*.vue',
|
|
11
|
-
];
|
|
12
|
-
|
|
13
|
-
const tsConfigPaths = {
|
|
14
|
-
'@/*': ['./src/*'],
|
|
15
|
-
'~/*': ['./*'],
|
|
16
|
-
'#srl': ['./.srl'],
|
|
17
|
-
'#srl/*': ['./.srl/*'],
|
|
18
|
-
'#components': ['./.srl/components'],
|
|
19
|
-
'#components/*': ['./.srl/components/*'],
|
|
20
|
-
'#composables': ['./.srl/composables'],
|
|
21
|
-
'#composables/*': ['./.srl/composables/*'],
|
|
22
|
-
'#utils': ['./.srl/utils'],
|
|
23
|
-
'#utils/*': ['./.srl/utils/*'],
|
|
24
|
-
'#plugins': ['./.srl/plugins'],
|
|
25
|
-
'#plugins/*': ['./.srl/plugins/*'],
|
|
26
|
-
'#types': ['./.srl/types'],
|
|
27
|
-
'#types/*': ['./.srl/types/*'],
|
|
28
|
-
'#imports': ['./.srl/imports'],
|
|
29
|
-
'#imports/*': ['./.srl/imports/*'],
|
|
30
|
-
'#ld': ['./livingdocs'],
|
|
31
|
-
'#ld/*': ['./livingdocs/*'],
|
|
32
|
-
assets: ['./src/assets'],
|
|
33
|
-
'assets/*': ['./src/assets/*'],
|
|
34
|
-
srl: ['./.srl/srl'],
|
|
35
|
-
'srl/*': ['./.srl/srl/*'],
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
function prepare() {
|
|
4
|
+
async function prepare() {
|
|
39
5
|
if (fs.existsSync(folders.srlRoot)) {
|
|
40
|
-
fs.rmSync(folders.srlRoot, { recursive: true, force: true });
|
|
41
|
-
}
|
|
42
|
-
fs.cpSync(folders.packageSrl, folders.srlRoot, { recursive: true });
|
|
43
|
-
|
|
44
|
-
const tsConfigPath = path.join(folders.root, 'tsconfig.app.json');
|
|
45
|
-
if (fs.existsSync(tsConfigPath)) {
|
|
46
|
-
const tsConfig = JSON.parse(fs.readFileSync(tsConfigPath, 'utf-8'));
|
|
47
|
-
|
|
48
|
-
const mergedIncludes = [
|
|
49
|
-
...(tsConfig.include || []),
|
|
50
|
-
...tsConfigIncludes.filter((i) => !(tsConfig.include || []).includes(i)),
|
|
51
|
-
];
|
|
52
|
-
tsConfig.include = tsConfig.include || [];
|
|
53
|
-
tsConfig.include = mergedIncludes;
|
|
54
|
-
|
|
55
|
-
const mergedPaths = {
|
|
56
|
-
...(tsConfig.compilerOptions?.paths || {}),
|
|
57
|
-
...tsConfigPaths,
|
|
58
|
-
};
|
|
59
|
-
tsConfig.compilerOptions = tsConfig.compilerOptions || {};
|
|
60
|
-
tsConfig.compilerOptions.paths = mergedPaths;
|
|
61
|
-
|
|
62
|
-
fs.writeFileSync(tsConfigPath, JSON.stringify(tsConfig, null, 2));
|
|
6
|
+
await fs.rmSync(folders.srlRoot, { recursive: true, force: true });
|
|
63
7
|
}
|
|
8
|
+
await fs.cpSync(folders.packageSrl, folders.srlRoot, { recursive: true });
|
|
64
9
|
}
|
|
65
10
|
|
|
66
11
|
export default prepare;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function vueComponents(): Promise<void>;
|