@castlabs/ui 7.12.0 → 7.14.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.
- package/dist/castlabs-ui-editor.common.js +2 -2
- package/dist/castlabs-ui-editor.common.js.map +1 -1
- package/dist/castlabs-ui-editor.umd.js +2 -2
- package/dist/castlabs-ui-editor.umd.js.map +1 -1
- package/dist/castlabs-ui.common.js +3 -3
- package/dist/castlabs-ui.common.js.map +1 -1
- package/dist/castlabs-ui.core.js +47 -8
- package/dist/castlabs-ui.css +1 -1
- package/dist/castlabs-ui.module.d.ts +1 -0
- package/dist/castlabs-ui.module.js +47 -8
- package/dist/castlabs-ui.umd.js +4 -4
- package/dist/castlabs-ui.umd.js.map +1 -1
- package/package.json +7 -7
- package/plugins/matomo/README.md +5 -0
- package/plugins/matomo/index.ts +93 -0
- package/plugins/matomo/vue-matomo.d.ts +1 -0
- package/src/components/navigation/ClNavTop/style.scss +2 -1
- package/src/components/section/ClSectionDetails/style.scss +10 -0
- package/src/components/table/ClTableCel/Links/style.scss +5 -5
- package/src/components/table/ClTableCel/style.variables.scss +13 -0
- package/src/components/widget/ClCookieBanner/style.scss +1 -1
- package/src/components/widget/ClPage/style.scss +55 -0
- package/src/styles/abstracts/color.scss +3 -0
- package/src/styles/layout/meta.scss +1 -1
- package/src/styles/layout/typography.scss +10 -1
- package/src/styles/ui.scss +1 -0
- package/types/castlabs-ui.module.d.ts +1 -0
- package/types/index.d.ts +43 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@castlabs/ui",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.14.0",
|
|
4
4
|
"repository": "https://github.com/castlabs/ui-styleguide",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "A vanilla HTML/CS/JS & Vue.js component library for Castlabs.",
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
"simplebar": "6.3.3"
|
|
43
43
|
},
|
|
44
44
|
"optionalDependencies": {
|
|
45
|
-
"@rollup/rollup-linux-x64-gnu": "4.57.
|
|
45
|
+
"@rollup/rollup-linux-x64-gnu": "4.57.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@castlabs/ui-editor": "file:../castlabs-ui-editor",
|
|
49
49
|
"@tsconfig/node22": "22.0.5",
|
|
50
50
|
"@types/jsdom": "27.0.0",
|
|
51
|
-
"@types/node": "
|
|
52
|
-
"@vitejs/plugin-vue": "6.0.
|
|
51
|
+
"@types/node": "25.2.0",
|
|
52
|
+
"@vitejs/plugin-vue": "6.0.4",
|
|
53
53
|
"@vitest/eslint-plugin": "1.6.6",
|
|
54
54
|
"@vue/eslint-config-prettier": "10.2.0",
|
|
55
55
|
"@vue/eslint-config-typescript": "14.6.0",
|
|
@@ -65,12 +65,12 @@
|
|
|
65
65
|
"gulp-concat": "2.6.1",
|
|
66
66
|
"gulp-replace": "1.1.4",
|
|
67
67
|
"gulp": "5.0.1",
|
|
68
|
-
"jsdom": "
|
|
68
|
+
"jsdom": "28.0.0",
|
|
69
69
|
"npm-run-all": "4.1.5",
|
|
70
70
|
"sass": "1.97.3",
|
|
71
|
-
"stylelint-config-sass-guidelines": "
|
|
71
|
+
"stylelint-config-sass-guidelines": "13.0.0",
|
|
72
72
|
"stylelint-config-standard-vue": "1.0.0",
|
|
73
|
-
"stylelint-config-standard": "
|
|
73
|
+
"stylelint-config-standard": "40.0.0",
|
|
74
74
|
"stylelint-order": "7.0.1",
|
|
75
75
|
"stylelint-scss": "7.0.0",
|
|
76
76
|
"typescript": "5.9.3",
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provide matomo integration without dependency to external package.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import VueMatomo from 'vue-matomo'
|
|
6
|
+
import type { App } from 'vue'
|
|
7
|
+
import type { Router, RouteLocationNormalized } from 'vue-router'
|
|
8
|
+
|
|
9
|
+
export function setCookie (name: string, value: string, days = 365, path = '/') {
|
|
10
|
+
document.cookie = `${name}=${value}; max-age=${60 * 60 * 24 * days}; path=${path}; SameSite=Lax;`
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function getCookie (cname: string): string {
|
|
14
|
+
for (const cookie of document?.cookie?.split(/; */) ?? []) {
|
|
15
|
+
const [name, value] = cookie.split('=')
|
|
16
|
+
if (name === cname) return value ?? ''
|
|
17
|
+
}
|
|
18
|
+
return ''
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function getPaq () {
|
|
22
|
+
// cast potentialy non-exsisting _paq for typescript
|
|
23
|
+
return (window as unknown as { _paq: (string | number)[][] })?._paq ?? []
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function hasCookieConsent (what: string): boolean {
|
|
27
|
+
const value = getCookie('cl_banner_nok')
|
|
28
|
+
for (const token of value.split('|')) {
|
|
29
|
+
if (token === `+${what}`) return true
|
|
30
|
+
}
|
|
31
|
+
return false
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function enableMatomo (record = false, env = 'PROD') {
|
|
35
|
+
// Enable detailed matomo tracking if user gave consent.
|
|
36
|
+
const _paq = getPaq()
|
|
37
|
+
if (hasCookieConsent('mtm') && getCookie('mtm_cookie_consent') === '') {
|
|
38
|
+
// make Matomo create cookie 'mtm_cookie_consent' to remember consent. ~13 months=9480 hours.
|
|
39
|
+
_paq.push(['rememberCookieConsentGiven', 9480])
|
|
40
|
+
}
|
|
41
|
+
if (record) trackPage(document?.title, window?.location?.pathname, env)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function trackPage (title: string, path: string, env: string) {
|
|
45
|
+
// Instruct Matomo to do the actual page tracking.
|
|
46
|
+
|
|
47
|
+
let prettyPath = path
|
|
48
|
+
const urnRegexp = /urn:[a-zA-Z]+:[a-zA-Z]+:[a-fA-F0-9]{32}/g
|
|
49
|
+
const foundUrns = [...prettyPath.matchAll(urnRegexp)]
|
|
50
|
+
foundUrns.forEach(elem => {
|
|
51
|
+
prettyPath = prettyPath.replace(elem.toString(), (elem[0].split(':')[2] ?? '').toUpperCase())
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
const prettyTitle = `${window?.location?.hostname} / ${title.replace(/ *\|[^|]*$/, '')}${env === 'PROD' ? '' : env}`
|
|
55
|
+
|
|
56
|
+
const _paq = getPaq()
|
|
57
|
+
_paq.push(['setDocumentTitle', prettyTitle])
|
|
58
|
+
_paq.push(['setCustomUrl', prettyPath])
|
|
59
|
+
_paq.push(['trackPageView'])
|
|
60
|
+
_paq.push(['enableLinkTracking'])
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function trackViaMatomo (to: RouteLocationNormalized, env: string) {
|
|
64
|
+
if (!to.meta.analyticsIgnore) {
|
|
65
|
+
// matomo settings
|
|
66
|
+
enableMatomo()
|
|
67
|
+
trackPage(to.meta.title as string, to.fullPath, env)
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export default {
|
|
72
|
+
install: (app: App, router: Router, env = 'PROD', siteId = 1) => {
|
|
73
|
+
console.log('setup matomo', env, siteId)
|
|
74
|
+
app.use(VueMatomo, {
|
|
75
|
+
host: 'https://castlabs.matomo.cloud',
|
|
76
|
+
siteId: siteId,
|
|
77
|
+
enableLinkTracking: false,
|
|
78
|
+
requireConsent: false,
|
|
79
|
+
trackInitialView: false,
|
|
80
|
+
disableCookies: false,
|
|
81
|
+
requireCookieConsent: true,
|
|
82
|
+
enableHeartBeatTimer: true,
|
|
83
|
+
heartBeatTimerInterval: 15,
|
|
84
|
+
trackerFileName: 'matomo',
|
|
85
|
+
cookieDomain: '*.castlabs.com',
|
|
86
|
+
domains: ['*.castlabs.com']
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
router.afterEach((to: RouteLocationNormalized) => {
|
|
90
|
+
trackViaMatomo(to, env)
|
|
91
|
+
})
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare module 'vue-matomo'
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
@use '../../../../styles/global' as *;
|
|
2
2
|
|
|
3
3
|
.cl-table-data {
|
|
4
|
+
$bg-color: var(--cl-color-background);
|
|
5
|
+
$bg: linear-gradient(90deg, transparent 0, $bg-color $spacing-tiny, $bg-color 100%);
|
|
6
|
+
|
|
4
7
|
.cl-th-links {
|
|
5
8
|
@extend %cl-p-label;
|
|
6
9
|
|
|
7
|
-
background
|
|
10
|
+
background: $bg;
|
|
8
11
|
position: sticky;
|
|
9
12
|
right: 0;
|
|
10
13
|
text-align: end;
|
|
@@ -17,15 +20,12 @@
|
|
|
17
20
|
}
|
|
18
21
|
|
|
19
22
|
.cl-td-links {
|
|
23
|
+
background: $bg;
|
|
20
24
|
overflow-wrap: unset;
|
|
21
25
|
position: sticky;
|
|
22
26
|
right: 0;
|
|
23
27
|
white-space: nowrap;
|
|
24
28
|
|
|
25
|
-
// a {
|
|
26
|
-
// @extend %cl-a-text;
|
|
27
|
-
// }
|
|
28
|
-
|
|
29
29
|
:not(:first-child) {
|
|
30
30
|
margin-left: $spacing-tiny;
|
|
31
31
|
|
|
@@ -25,4 +25,17 @@
|
|
|
25
25
|
td:not(:last-child) {
|
|
26
26
|
border-right: $brand-line-width dotted var(--cl-color-line);
|
|
27
27
|
}
|
|
28
|
+
|
|
29
|
+
&.cl-tight {
|
|
30
|
+
td {
|
|
31
|
+
padding-bottom: $table-padding-vertical * 0.5;
|
|
32
|
+
padding-top: $table-padding-vertical * 0.5;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
td,
|
|
36
|
+
th {
|
|
37
|
+
padding-left: $table-padding-horizontal * 0.5;
|
|
38
|
+
padding-right: $table-padding-horizontal * 0.5;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
28
41
|
}
|
|
@@ -11,3 +11,58 @@
|
|
|
11
11
|
margin: 0;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
+
|
|
15
|
+
// --- .cl-page-fullscreen variant ---------------------------------------------
|
|
16
|
+
|
|
17
|
+
.cl-page-fullscreen {
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
height: calc(100vh - $header-nav-height);
|
|
21
|
+
overflow: hidden; // no scrolling
|
|
22
|
+
|
|
23
|
+
main:has(&) + footer {
|
|
24
|
+
// hide footer in .cl-page-fullscreen pages (but footer sits outside main)
|
|
25
|
+
display: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
section:first-child {
|
|
29
|
+
flex: 0 0 auto;
|
|
30
|
+
margin-top: 0;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
section:not(:first-child) {
|
|
34
|
+
flex: 1 1 auto;
|
|
35
|
+
margin-top: 0;
|
|
36
|
+
overflow-y: scroll;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.cl-section-fullscreen {
|
|
41
|
+
height: 100%;
|
|
42
|
+
|
|
43
|
+
.container,
|
|
44
|
+
.container-fluid,
|
|
45
|
+
.row,
|
|
46
|
+
.col-12,
|
|
47
|
+
.cl-table-scroll {
|
|
48
|
+
height: 100%;
|
|
49
|
+
margin-bottom: 0 !important;
|
|
50
|
+
margin-top: 0 !important;
|
|
51
|
+
padding-bottom: 0 !important;
|
|
52
|
+
padding-top: 0 !important;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
table {
|
|
56
|
+
display: block;
|
|
57
|
+
max-height: 100%;
|
|
58
|
+
max-width: 100%;
|
|
59
|
+
overflow: scroll auto;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
th {
|
|
63
|
+
background: $color-ci-haze !important;
|
|
64
|
+
position: sticky;
|
|
65
|
+
top: 0;
|
|
66
|
+
z-index: 1;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -210,6 +210,7 @@ $color-opacity-active: 0.8;
|
|
|
210
210
|
#{'--cl-color-active'}: $color-ci-berry;
|
|
211
211
|
#{'--cl-color-background'}: $color-ci-eggshell;
|
|
212
212
|
#{'--cl-color-border'}: $color-ci-night;
|
|
213
|
+
#{'--cl-color-code'}: $color-ci-petrol;
|
|
213
214
|
#{'--cl-color-disabled-background'}: $color-disabled;
|
|
214
215
|
#{'--cl-color-disabled-border'}: $color-disabled;
|
|
215
216
|
#{'--cl-color-disabled-text'}: $color-ci-eggshell;
|
|
@@ -244,6 +245,7 @@ $color-opacity-active: 0.8;
|
|
|
244
245
|
%cl-color-text-light {
|
|
245
246
|
// for backgrounds that require 'white' text
|
|
246
247
|
#{'--cl-color-accent'}: $color-ci-eggshell;
|
|
248
|
+
#{'--cl-color-code'}: $color-ci-eggshell;
|
|
247
249
|
#{'--cl-color-focus'}: $color-ci-eggshell;
|
|
248
250
|
#{'--cl-color-icon'}: $color-ci-eggshell;
|
|
249
251
|
#{'--cl-color-input-background'}: transparent;
|
|
@@ -256,6 +258,7 @@ $color-opacity-active: 0.8;
|
|
|
256
258
|
%cl-color-text-dark {
|
|
257
259
|
// for backgrounds that require 'black' text
|
|
258
260
|
#{'--cl-color-accent'}: $color-ci-night;
|
|
261
|
+
#{'--cl-color-code'}: $color-ci-petrol;
|
|
259
262
|
#{'--cl-color-focus'}: $color-ci-night;
|
|
260
263
|
#{'--cl-color-icon'}: $color-ci-night;
|
|
261
264
|
#{'--cl-color-input-background'}: transparent;
|
|
@@ -193,7 +193,6 @@ main {
|
|
|
193
193
|
// --- code & monospace --------------------------------------------------------
|
|
194
194
|
|
|
195
195
|
kbd,
|
|
196
|
-
code,
|
|
197
196
|
samp {
|
|
198
197
|
@extend %cl-p-pre;
|
|
199
198
|
|
|
@@ -201,14 +200,24 @@ main {
|
|
|
201
200
|
}
|
|
202
201
|
|
|
203
202
|
code {
|
|
203
|
+
@extend %cl-p-pre;
|
|
204
|
+
|
|
205
|
+
color: var(--cl-color-text);
|
|
204
206
|
margin-left: 0.1em;
|
|
205
207
|
margin-right: 0.1em;
|
|
206
208
|
}
|
|
207
209
|
|
|
210
|
+
p code,
|
|
211
|
+
li code {
|
|
212
|
+
color: var(--cl-color-code);
|
|
213
|
+
}
|
|
214
|
+
|
|
208
215
|
pre {
|
|
209
216
|
@extend %cl-p-pre-box;
|
|
210
217
|
@include cl-color-focus-outline;
|
|
211
218
|
|
|
219
|
+
color: var(--cl-color-text);
|
|
220
|
+
|
|
212
221
|
code {
|
|
213
222
|
padding: 0;
|
|
214
223
|
}
|
package/src/styles/ui.scss
CHANGED
|
@@ -75,6 +75,7 @@ $castlabs-ui-asset-postfix: '' !default;
|
|
|
75
75
|
@use '../components/navigation/ClNavSide/ClNavSideMenu/style' as *;
|
|
76
76
|
@use '../components/navigation/ClNavSide/style' as *;
|
|
77
77
|
@use '../components/navigation/ClNavTop/style' as *;
|
|
78
|
+
@use '../components/section/ClSectionDetails/style' as *;
|
|
78
79
|
@use '../components/section/ClSectionForm/style' as *;
|
|
79
80
|
@use '../components/section/ClSectionHeadline/style' as *;
|
|
80
81
|
@use '../components/section/ClSectionMainSide/style' as *;
|
|
@@ -25,6 +25,7 @@ declare module '@castlabs/ui/dist/castlabs-ui.module.js' {
|
|
|
25
25
|
export function clFormatDate (date: Date): string
|
|
26
26
|
export function clFormatTimeUTC (date: Date): string
|
|
27
27
|
export function clFormatDateTimeUTC (date: Date, seconds?: boolean): string
|
|
28
|
+
export function clFormatDateTimeTabularUTC (date: Date, year?:boolean, month?:boolean, day?:boolean, time?:boolean, seconds?:boolean): string
|
|
28
29
|
export function clFormatDuration (from: Date, until: Date, seconds?: boolean, ms?: boolean): string
|
|
29
30
|
export function clFormatPeriod (date: Date): string
|
|
30
31
|
export function clFormatNumber (amount: number, decimalPlaces?: number): string
|
package/types/index.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import type { App, DefineComponent } from 'vue'
|
|
2
2
|
|
|
3
|
-
import * as CONST from '../src/utils/const'
|
|
4
|
-
import * as CS from '../src/utils/cs'
|
|
5
|
-
|
|
6
3
|
declare function install (Vue: App): void
|
|
7
4
|
export default install
|
|
8
5
|
|
|
@@ -26,6 +23,7 @@ export const ClNavSide: DefineComponent
|
|
|
26
23
|
export const ClNavTop: DefineComponent
|
|
27
24
|
export const ClPage: DefineComponent
|
|
28
25
|
export const ClPagination: DefineComponent
|
|
26
|
+
export const ClSectionDetails: DefineComponent
|
|
29
27
|
export const ClSectionForm: DefineComponent
|
|
30
28
|
export const ClSectionHeadline: DefineComponent
|
|
31
29
|
export const ClSectionMain: DefineComponent
|
|
@@ -85,6 +83,7 @@ export function clFormatFilesize (bytes: number): string
|
|
|
85
83
|
export function clFormatDate (date: Date): string
|
|
86
84
|
export function clFormatTimeUTC (date: Date): string
|
|
87
85
|
export function clFormatDateTimeUTC (date: Date, seconds?: boolean): string
|
|
86
|
+
export function clFormatDateTimeTabularUTC (date: Date, year?:boolean, month?:boolean, day?:boolean, time?:boolean, seconds?:boolean): string
|
|
88
87
|
export function clFormatDuration (from: Date, until: Date, seconds?: boolean, ms?: boolean): string
|
|
89
88
|
export function clFormatPeriod (date: Date): string
|
|
90
89
|
export function clFormatNumber (amount: number, decimalPlaces?: number): string
|
|
@@ -253,7 +252,45 @@ export function csGetNav (
|
|
|
253
252
|
export function csFilterMemberships (memberships: CsMembership[], rid?: string, sid?: string): CsMembership[]
|
|
254
253
|
export function csGetAccountUrl(env: string): string
|
|
255
254
|
|
|
256
|
-
// ---
|
|
255
|
+
// --- utils/const.js ----------------------------------------------------------------
|
|
256
|
+
|
|
257
|
+
export const CONST: {
|
|
258
|
+
COLOR: Record<string, string>
|
|
259
|
+
SPACING: Record<string, string>
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// --- utils/cs.js ----------------------------------------------------------------
|
|
263
|
+
|
|
264
|
+
type CsApp = {
|
|
265
|
+
id: string
|
|
266
|
+
subtitle: string
|
|
267
|
+
title: string
|
|
268
|
+
services: string[]
|
|
269
|
+
roles: string[]
|
|
270
|
+
urlManage: (env: string, oid: string) => string
|
|
271
|
+
urlPlan: (env: string, oid: string) => string
|
|
272
|
+
sidenav: boolean
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
type CsNavEntry = {
|
|
276
|
+
id: string
|
|
277
|
+
title: string
|
|
278
|
+
subtitle: string
|
|
279
|
+
url: string
|
|
280
|
+
locked: boolean,
|
|
281
|
+
disabled: boolean,
|
|
282
|
+
badge: string | undefined
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
export const CS: {
|
|
286
|
+
SERVICE: Record<string, string>
|
|
287
|
+
ROLE: Record<string, string>
|
|
288
|
+
STATE: Record<string, number | null>
|
|
289
|
+
LICENSE_STATE: Record<string, number | null>
|
|
290
|
+
PLAN: Record<string, number | null>
|
|
291
|
+
APPS: Record<string, CsApp>
|
|
292
|
+
}
|
|
257
293
|
|
|
258
|
-
export
|
|
259
|
-
export
|
|
294
|
+
export function csGetNav (memberships: CsMembership[], oid: string, env: string): CsNavEntry[]
|
|
295
|
+
export function csFilterMemberships (memberships: CsMembership[], rid: string, sid: string): CsMembership[]
|
|
296
|
+
export function csGetAccountUrl (env: string): string
|