@dialpad/dialtone 9.150.1 → 9.150.3
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/css/dialtone-default-theme.css +0 -3
- package/dist/css/dialtone-default-theme.min.css +1 -1
- package/dist/css/dialtone.css +0 -3
- package/dist/css/dialtone.min.css +1 -1
- package/dist/js/dialtone_health_check/deprecated_icons.cjs +105 -0
- package/dist/js/dialtone_health_check/index.cjs +82 -0
- package/dist/js/dialtone_health_check/non_dialtone_properties.cjs +44 -0
- package/dist/js/dialtone_migrate_flex_to_stack/examples-edge-cases.vue +329 -0
- package/dist/js/dialtone_migrate_flex_to_stack/index.mjs +1377 -0
- package/dist/js/dialtone_migration_helper/configs/box-shadows.mjs +19 -0
- package/dist/js/dialtone_migration_helper/configs/colors.mjs +69 -0
- package/dist/js/dialtone_migration_helper/configs/fonts.mjs +49 -0
- package/dist/js/dialtone_migration_helper/configs/size-and-space.mjs +124 -0
- package/dist/js/dialtone_migration_helper/helpers.mjs +212 -0
- package/dist/js/dialtone_migration_helper/index.mjs +135 -0
- package/dist/tokens/doc.json +51865 -51865
- package/dist/vue3/common/utils/index.cjs +1 -1
- package/dist/vue3/common/utils/index.cjs.map +1 -1
- package/dist/vue3/common/utils/index.js +67 -62
- package/dist/vue3/common/utils/index.js.map +1 -1
- package/dist/vue3/lib/combobox-multi-select/combobox-multi-select.cjs +1 -1
- package/dist/vue3/lib/combobox-multi-select/combobox-multi-select.cjs.map +1 -1
- package/dist/vue3/lib/combobox-multi-select/combobox-multi-select.js +79 -75
- package/dist/vue3/lib/combobox-multi-select/combobox-multi-select.js.map +1 -1
- package/dist/vue3/lib/toggle/toggle.cjs +1 -1
- package/dist/vue3/lib/toggle/toggle.cjs.map +1 -1
- package/dist/vue3/lib/toggle/toggle.js +1 -1
- package/dist/vue3/lib/toggle/toggle.js.map +1 -1
- package/dist/vue3/types/common/utils/index.d.ts +3 -3
- package/dist/vue3/types/common/utils/index.d.ts.map +1 -1
- package/dist/vue3/types/components/collapsible/collapsible.vue.d.ts +1 -3
- package/dist/vue3/types/components/toast/layouts/toast_layout_alternate.vue.d.ts +1 -3
- package/dist/vue3/types/components/toast/layouts/toast_layout_default.vue.d.ts +1 -3
- package/dist/vue3/types/components/toast/toast.vue.d.ts +2 -6
- package/dist/vue3/types/recipes/buttons/callbar_button/callbar_button.vue.d.ts +7 -0
- package/dist/vue3/types/recipes/buttons/callbar_button/callbar_button.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/comboboxes/combobox_multi_select/combobox_multi_select.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/leftbar/contact_centers_row/contact_centers_row.vue.d.ts +1 -3
- package/dist/vue3/types/recipes/leftbar/contact_centers_row/contact_centers_row.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/leftbar/contact_row/contact_row.vue.d.ts +1 -3
- package/dist/vue3/types/recipes/leftbar/general_row/general_row.vue.d.ts +1 -3
- package/dist/vue3/types/recipes/leftbar/general_row/general_row.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/leftbar/group_row/group_row.vue.d.ts +1 -3
- package/dist/vue3/types/recipes/leftbar/group_row/group_row.vue.d.ts.map +1 -1
- package/package.json +4 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
description:
|
|
3
|
+
'Updates dialtone 7 variables to dialtone 8 design tokens.\n' +
|
|
4
|
+
'- Replaces var(--bs-{kind}) with var(--dt-shadow-{kind})\n\t' +
|
|
5
|
+
'eg. var(--bs-sm) with var(--dt-shadow-small)\n' +
|
|
6
|
+
'- Replaces @bs-{kind} with var(--dt-shadow-{kind})\n\t' +
|
|
7
|
+
'eg. @bs-card with var(--dt-shadow-card)\n',
|
|
8
|
+
patterns: ['**/*.{css,less,scss,sass,styl,html,vue,md}'],
|
|
9
|
+
expressions: [
|
|
10
|
+
// CSS variables
|
|
11
|
+
{ from: /@bs-sm|var\(--bs-sm\)/gi, to: 'var(--dt-shadow-small)' },
|
|
12
|
+
{ from: /@bs-md|var\(--bs-md\)/gi, to: 'var(--dt-shadow-medium)' },
|
|
13
|
+
{ from: /@bs-lg|var\(--bs-lg\)/gi, to: 'var(--dt-shadow-large)' },
|
|
14
|
+
{ from: /@bs-xl|var\(--bs-xl\)/gi, to: 'var(--dt-shadow-extra-large)' },
|
|
15
|
+
{ from: /@bs-card|var\(--bs-card\)/gi, to: 'var(--dt-shadow-card)' },
|
|
16
|
+
{ from: /@bs-focus-ring|var\(--bs-focus-ring\)/gi, to: 'var(--dt-shadow-focus)' },
|
|
17
|
+
{ from: /@bs-focus-ring-inset|var\(--bs-focus-ring-inset\)/gi, to: 'var(--dt-shadow-focus-inset)' },
|
|
18
|
+
],
|
|
19
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
description:
|
|
3
|
+
'Updates dialtone 7 variables to dialtone 8 design tokens.\n' +
|
|
4
|
+
'- Replaces var(--{color}-{stop}) with var(--dt-color-{color}-{stop})\n\t' +
|
|
5
|
+
'eg. var(--black-200) with var(--dt-color-black-200)\n' +
|
|
6
|
+
'- Replaces @{color}-{stop} with var(--dt-color-{color}-{stop})\n\t' +
|
|
7
|
+
'eg. @red-100 with var(--dt-color-red-100)\n' +
|
|
8
|
+
'- Replaces var(--fc-{kind}) with var(--dt-color-foreground-{kind})\n\t' +
|
|
9
|
+
'eg. var(--fc-success-inverted) with var(--dt-color-foreground-success-inverted)\n',
|
|
10
|
+
patterns: ['**/*.{css,less,scss,sass,styl,html,vue,md}'],
|
|
11
|
+
expressions: [
|
|
12
|
+
// ------------------------------------------------------------ //
|
|
13
|
+
// Colors //
|
|
14
|
+
// ------------------------------------------------------------ //
|
|
15
|
+
// LESS variables
|
|
16
|
+
{
|
|
17
|
+
from: /@(black|purple|magenta|gold|green|red|blue|tan)(-[1-9]00)/g,
|
|
18
|
+
to: 'var(--dt-color-$1$2)',
|
|
19
|
+
},
|
|
20
|
+
// Neutral LESS variables
|
|
21
|
+
{
|
|
22
|
+
from: /@(white|black)/g,
|
|
23
|
+
to: 'var(--dt-color-neutral-$1)',
|
|
24
|
+
},
|
|
25
|
+
// CSS variables
|
|
26
|
+
{
|
|
27
|
+
from: /var\(--(black|purple|orange|magenta|gold|green|red|blue|tan)(-[1-9]00)(-(h|s|l|hsl))?\)/g,
|
|
28
|
+
to: 'var(--dt-color-$1$2$3)',
|
|
29
|
+
},
|
|
30
|
+
// Neutral CSS variables
|
|
31
|
+
{
|
|
32
|
+
from: /var\(--(white|black)(-(h|s|l|hsl))?\)/g,
|
|
33
|
+
to: 'var(--dt-color-neutral-$1$2)',
|
|
34
|
+
},
|
|
35
|
+
// Background colors
|
|
36
|
+
{
|
|
37
|
+
// eslint-disable-next-line max-len
|
|
38
|
+
from: /var\(--bgc-(primary|secondary|moderate|bold|strong|contrast|critical|success|warning|info)(-(subtle|opaque|subtle-opaque|strong))?\)/g,
|
|
39
|
+
to: 'var(--dt-color-surface-$1$2)',
|
|
40
|
+
},
|
|
41
|
+
// Special Background color cases
|
|
42
|
+
{
|
|
43
|
+
// eslint-disable-next-line max-len
|
|
44
|
+
from: /var\(--bgc-(error|danger)(-(subtle|opaque|subtle-opaque|strong))?\)/g,
|
|
45
|
+
to: 'var(--dt-color-surface-critical$2)',
|
|
46
|
+
},
|
|
47
|
+
// Border colors
|
|
48
|
+
{
|
|
49
|
+
// eslint-disable-next-line max-len
|
|
50
|
+
from: /var\(--bc-(default|subtle|moderate|bold|focus|critical|success|warning|brand|ai|accent)(-(inverted|subtle|strong|subtle-inverted|strong-inverted))?\)/g,
|
|
51
|
+
to: 'var(--dt-color-border-$1$2)',
|
|
52
|
+
},
|
|
53
|
+
// Font colors
|
|
54
|
+
{
|
|
55
|
+
// eslint-disable-next-line max-len
|
|
56
|
+
from: /var\(--fc-(primary|secondary|tertiary|muted|placeholder|disabled|critical|success|warning)(-(strong|inverted|strong-inverted))?\)/g,
|
|
57
|
+
to: 'var(--dt-color-foreground-$1$2)',
|
|
58
|
+
},
|
|
59
|
+
// Special Font color cases
|
|
60
|
+
{
|
|
61
|
+
from: /var\(--fc-(error|danger)(-(strong|inverted|strong-inverted))?\)/g,
|
|
62
|
+
to: 'var(--dt-color-foreground-critical$2)',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
from: /d-(fc|bc)-white/g,
|
|
66
|
+
to: 'd-$1-neutral-white',
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
description:
|
|
3
|
+
'Updates dialtone 7 variables to dialtone 8 design tokens.\n' +
|
|
4
|
+
'- Replaces var(--fs-{stop}) with var(--dt-font-size-{stop})\n\t' +
|
|
5
|
+
'eg. var(--fs-200) with var(--dt-font-size-200)\n' +
|
|
6
|
+
'- Replaces @fs-{stop} with var(--dt-font-size-{stop})\n\t' +
|
|
7
|
+
'eg. @fs-100-tv with var(--dt-font-size-100-tv)\n' +
|
|
8
|
+
'- Replaces var(--fw-{kind}) with var(--dt-font-weight-{kind})\n\t' +
|
|
9
|
+
'eg. var(--fw-medium) with var(--dt-font-weight-medium)\n' +
|
|
10
|
+
'- Replaces @fw-{kind} with var(--dt-font-weight-{kind})\n\t' +
|
|
11
|
+
'eg. @fw-semibold with var(--dt-font-weight-semi-bold)\n' +
|
|
12
|
+
'- Replaces var(--lh-{stop}) with var(--dt-font-line-height-{stop})\n\t' +
|
|
13
|
+
'eg. var(--lh-200) with var(--dt-font-line-height-200)\n' +
|
|
14
|
+
'- Replaces @lh-{stop} with var(--dt-font-line-height-{stop})\n\t' +
|
|
15
|
+
'eg. @lh-100 with var(--dt-font-line-height-100)\n' +
|
|
16
|
+
'- Replaces var(--ff-{kind}) with var(--dt-font-family-{kind})\n\t' +
|
|
17
|
+
'eg. var(--ff-mono) with var(--dt-font-family-mono)',
|
|
18
|
+
patterns: ['**/*.{css,less,scss,sass,styl,html,vue,md,json}'],
|
|
19
|
+
expressions: [
|
|
20
|
+
// ------------------------------------------------------------ //
|
|
21
|
+
// Fonts //
|
|
22
|
+
// ------------------------------------------------------------ //
|
|
23
|
+
// Size variables
|
|
24
|
+
{
|
|
25
|
+
from: /@fs(-[0-9]+)(-(mobile|tc8|tv))?|var\(--fs(-[0-9]+)(-(mobile|tc8|tv))?\)/g,
|
|
26
|
+
to: 'var(--dt-font-size$1$2$4$5)',
|
|
27
|
+
},
|
|
28
|
+
// Weight variables
|
|
29
|
+
{
|
|
30
|
+
from: /@fw-(normal|medium|bold)|var\(--fw-(normal|medium|bold)\)/g,
|
|
31
|
+
to: 'var(--dt-font-weight-$1$2)',
|
|
32
|
+
},
|
|
33
|
+
// Special weight case
|
|
34
|
+
{
|
|
35
|
+
from: /@fw-semibold|var\(--fw-semibold\)/g,
|
|
36
|
+
to: 'var(--dt-font-weight-semi-bold)',
|
|
37
|
+
},
|
|
38
|
+
// Line heights
|
|
39
|
+
{
|
|
40
|
+
from: /@lh(-[0-9]+)|var\(--lh(-[0-9]+)\)/g,
|
|
41
|
+
to: 'var(--dt-font-line-height$1$2)',
|
|
42
|
+
},
|
|
43
|
+
// Font family
|
|
44
|
+
{
|
|
45
|
+
from: /var\(--ff-(mono)\)/g,
|
|
46
|
+
to: 'var(--dt-font-family-$1)',
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
description:
|
|
3
|
+
'Updates dialtone 7 variables to dialtone 8 design tokens.\n' +
|
|
4
|
+
'- Replaces var(--{size}-{stop}) with var(--dt-size-{stop})\n\t' +
|
|
5
|
+
'eg. var(--size-200) with var(--dt-size-200)\n' +
|
|
6
|
+
'- Replaces @{size}{stop} with var(--dt-size-{stop})\n\t' +
|
|
7
|
+
'eg. @size4 with var(--dt-size-300)\n' +
|
|
8
|
+
'- Replaces @icon{size} with var(--dt-icon-size-{stop})\n\t' +
|
|
9
|
+
'eg. @icon12 with var(--dt-icon-size-100)\n' +
|
|
10
|
+
'- Replaces var(--su{stop}) with var(--dt-size-{stop})\n\t' +
|
|
11
|
+
'eg. var(--su0) with var(--dt-size-0)\n' +
|
|
12
|
+
'- Replaces @su{stop} with var(--dt-size-{stop})\n\t' +
|
|
13
|
+
'eg. @su8 with var(--dt-size-400)\n' +
|
|
14
|
+
'- Replaces var(--sun{stop}) with var(--dt-size-{stop}-negative)\n\t' +
|
|
15
|
+
'eg. var(--sun1) with var(--dt-size-100-negative)\n' +
|
|
16
|
+
'- Replaces var(--br{stop}) with var(--dt-size-radius-{stop})\n\t' +
|
|
17
|
+
'eg. var(--br4) with var(--dt-size-radius-300)\n' +
|
|
18
|
+
'- Replaces @br{stop} with var(--dt-size-radius-{stop})\n\t' +
|
|
19
|
+
'eg. @br-pill with var(--dt-size-radius-pill)\n',
|
|
20
|
+
patterns: ['**/*.{css,less,scss,sass,styl,html,vue,md}'],
|
|
21
|
+
expressions: [
|
|
22
|
+
// ------------------------------------------------------------ //
|
|
23
|
+
// Size and Space //
|
|
24
|
+
// ------------------------------------------------------------ //
|
|
25
|
+
{
|
|
26
|
+
from: /var\(--(size|space)(-[0-9]+)(-negative)?\)/gi,
|
|
27
|
+
to: 'var(--dt-$1$2$3)',
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
// Size LESS variables
|
|
31
|
+
{ from: /@size0\b|var\(--size0\)/g, to: 'var(--dt-size-0)' },
|
|
32
|
+
{ from: /@size1\b|var\(--size1\)/g, to: 'var(--dt-size-100)' },
|
|
33
|
+
{ from: /@size2\b|var\(--size2\)/g, to: 'var(--dt-size-200)' },
|
|
34
|
+
{ from: /@size4\b|var\(--size4\)/g, to: 'var(--dt-size-300)' },
|
|
35
|
+
{ from: /@size6\b|var\(--size6\)/g, to: 'var(--dt-size-350)' },
|
|
36
|
+
{ from: /@size8\b|var\(--size8\)/g, to: 'var(--dt-size-400)' },
|
|
37
|
+
{ from: /@size12\b|var\(--size12\)/g, to: 'var(--dt-size-450)' },
|
|
38
|
+
{ from: /@size16\b|var\(--size16\)/g, to: 'var(--dt-size-500)' },
|
|
39
|
+
{ from: /@size20\b|var\(--size20\)/g, to: 'var(--dt-size-525)' },
|
|
40
|
+
{ from: /@size24\b|var\(--size24\)/g, to: 'var(--dt-size-550)' },
|
|
41
|
+
{ from: /@size32\b|var\(--size32\)/g, to: 'var(--dt-size-600)' },
|
|
42
|
+
{ from: /@size42\b|var\(--size42\)/g, to: 'var(--dt-size-625)' },
|
|
43
|
+
{ from: /@size48\b|var\(--size48\)/g, to: 'var(--dt-size-650)' },
|
|
44
|
+
{ from: /@size64\b|var\(--size64\)/g, to: 'var(--dt-size-700)' },
|
|
45
|
+
{ from: /@size72\b|var\(--size72\)/g, to: 'var(--dt-size-720)' },
|
|
46
|
+
{ from: /@size84\b|var\(--size84\)/g, to: 'var(--dt-size-730)' },
|
|
47
|
+
{ from: /@size96\b|var\(--size96\)/g, to: 'var(--dt-size-750)' },
|
|
48
|
+
{ from: /@size102\b|var\(--size102\)/g, to: 'var(--dt-size-760)' },
|
|
49
|
+
{ from: /@size114\b|var\(--size114\)/g, to: 'var(--dt-size-775)' },
|
|
50
|
+
{ from: /@size128\b|var\(--size128\)/g, to: 'var(--dt-size-800)' },
|
|
51
|
+
{ from: /@size164\b|var\(--size164\)/g, to: 'var(--dt-size-825)' },
|
|
52
|
+
{ from: /@size216\b|var\(--size216\)/g, to: 'var(--dt-size-875)' },
|
|
53
|
+
{ from: /@size264\b|var\(--size264\)/g, to: 'var(--dt-size-905)' },
|
|
54
|
+
{ from: /@size332\b|var\(--size332\)/g, to: 'var(--dt-size-925)' },
|
|
55
|
+
{ from: /@size464\b|var\(--size464\)/g, to: 'var(--dt-size-975)' },
|
|
56
|
+
{ from: /@size512\b|var\(--size512\)/g, to: 'var(--dt-size-1000)' },
|
|
57
|
+
{ from: /@size628\b|var\(--size628\)/g, to: 'var(--dt-size-1020)' },
|
|
58
|
+
{ from: /@size764\b|var\(--size764\)/g, to: 'var(--dt-size-1040)' },
|
|
59
|
+
{ from: /@size828\b|var\(--size828\)/g, to: 'var(--dt-size-1060)' },
|
|
60
|
+
{ from: /@size912\b|var\(--size912\)/g, to: 'var(--dt-size-1080)' },
|
|
61
|
+
{ from: /@size1024\b|var\(--size1024\)/g, to: 'var(--dt-size-1100)' },
|
|
62
|
+
{ from: /@size1140\b|var\(--size1140\)/g, to: 'var(--dt-size-1115)' },
|
|
63
|
+
{ from: /@size1268\b|var\(--size1268\)/g, to: 'var(--dt-size-1120)' },
|
|
64
|
+
{ from: /@size1340\b|var\(--size1340\)/g, to: 'var(--dt-size-1130)' },
|
|
65
|
+
|
|
66
|
+
// Icon variables
|
|
67
|
+
{ from: /@icon12\b|var\(--icon12\)/g, to: 'var(--dt-icon-size-100)' },
|
|
68
|
+
{ from: /@icon14\b|var\(--icon14\)/g, to: 'var(--dt-icon-size-200)' },
|
|
69
|
+
{ from: /@icon16\b|var\(--icon16\)/g, to: 'var(--dt-size-500)' },
|
|
70
|
+
{ from: /@icon18\b|var\(--icon18\)/g, to: 'var(--dt-icon-size-300)' },
|
|
71
|
+
{ from: /@icon20\b|var\(--icon20\)/g, to: 'var(--dt-icon-size-400)' },
|
|
72
|
+
{ from: /@icon24\b|var\(--icon24\)/g, to: 'var(--dt-icon-size-500)' },
|
|
73
|
+
{ from: /@icon32\b|var\(--icon32\)/g, to: 'var(--dt-icon-size-600)' },
|
|
74
|
+
{ from: /@icon48\b|var\(--icon48\)/g, to: 'var(--dt-size-650)' },
|
|
75
|
+
{ from: /@icon64\b|var\(--icon64\)/g, to: 'var(--dt-size-700)' },
|
|
76
|
+
// Variable prefixed with negative, must go before positive spacing
|
|
77
|
+
{ from: /-@su1\b|-var\(--su1\)|[^-]var\(--sun1\)/g, to: 'var(--dt-space-100-negative)' },
|
|
78
|
+
{ from: /-@su2\b|-var\(--su2\)|[^-]var\(--sun2\)/g, to: 'var(--dt-space-200-negative)' },
|
|
79
|
+
{ from: /-@su4\b|-var\(--su4\)|[^-]var\(--sun4\)/g, to: 'var(--dt-space-300-negative)' },
|
|
80
|
+
{ from: /-@su6\b|-var\(--su6\)|[^-]var\(--sun6\)/g, to: 'var(--dt-space-350-negative)' },
|
|
81
|
+
{ from: /-@su8\b|-var\(--su8\)|[^-]var\(--sun8\)/g, to: 'var(--dt-space-400-negative)' },
|
|
82
|
+
{ from: /-@su12\b|-var\(--su12\)|[^-]var\(--sun12\)/g, to: 'var(--dt-space-450-negative)' },
|
|
83
|
+
{ from: /-@su16\b|-var\(--su16\)|[^-]var\(--sun16\)/g, to: 'var(--dt-space-500-negative)' },
|
|
84
|
+
{ from: /-@su24\b|-var\(--su24\)|[^-]var\(--sun24\)/g, to: 'var(--dt-space-550-negative)' },
|
|
85
|
+
{ from: /-@su32\b|-var\(--su32\)|[^-]var\(--sun32\)/g, to: 'var(--dt-space-600-negative)' },
|
|
86
|
+
{ from: /-@su48\b|-var\(--su48\)|[^-]var\(--sun48\)/g, to: 'var(--dt-space-650-negative)' },
|
|
87
|
+
{ from: /-@su64\b|-var\(--su64\)|[^-]var\(--sun64\)/g, to: 'var(--dt-space-700-negative)' },
|
|
88
|
+
{ from: /-@su72\b|-var\(--su72\)|[^-]var\(--sun72\)/g, to: 'var(--dt-space-720-negative)' },
|
|
89
|
+
{ from: /-@su84\b|-var\(--su84\)|[^-]var\(--sun84\)/g, to: 'var(--dt-space-730-negative)' },
|
|
90
|
+
{ from: /-@su96\b|-var\(--su96\)|[^-]var\(--sun96\)/g, to: 'var(--dt-space-750-negative)' },
|
|
91
|
+
{ from: /-@su102\b|-var\(--su102\)|[^-]var\(--sun102\)/g, to: 'var(--dt-space-760-negative)' },
|
|
92
|
+
{ from: /-@su114\b|-var\(--su114\)|[^-]var\(--sun114\)/g, to: 'var(--dt-space-775-negative)' },
|
|
93
|
+
{ from: /-@su128\b|-var\(--su128\)|[^-]var\(--sun128\)/g, to: 'var(--dt-space-800-negative)' },
|
|
94
|
+
// Positive spacing
|
|
95
|
+
{ from: /@su0\b|var\(--su0\)/g, to: 'var(--dt-space-0)' },
|
|
96
|
+
{ from: /@su1\b|var\(--su1\)/g, to: 'var(--dt-space-100)' },
|
|
97
|
+
{ from: /@su2\b|var\(--su2\)/g, to: 'var(--dt-space-200)' },
|
|
98
|
+
{ from: /@su4\b|var\(--su4\)/g, to: 'var(--dt-space-300)' },
|
|
99
|
+
{ from: /@su6\b|var\(--su6\)/g, to: 'var(--dt-space-350)' },
|
|
100
|
+
{ from: /@su8\b|var\(--su8\)/g, to: 'var(--dt-space-400)' },
|
|
101
|
+
{ from: /@su12\b|var\(--su12\)/g, to: 'var(--dt-space-450)' },
|
|
102
|
+
{ from: /@su16\b|var\(--su16\)/g, to: 'var(--dt-space-500)' },
|
|
103
|
+
{ from: /@su24\b|var\(--su24\)/g, to: 'var(--dt-space-550)' },
|
|
104
|
+
{ from: /@su32\b|var\(--su32\)/g, to: 'var(--dt-space-600)' },
|
|
105
|
+
{ from: /@su48\b|var\(--su48\)/g, to: 'var(--dt-space-650)' },
|
|
106
|
+
{ from: /@su64\b|var\(--su64\)/g, to: 'var(--dt-space-700)' },
|
|
107
|
+
{ from: /@su72\b|var\(--su72\)/g, to: 'var(--dt-space-720)' },
|
|
108
|
+
{ from: /@su84\b|var\(--su84\)/g, to: 'var(--dt-space-730)' },
|
|
109
|
+
{ from: /@su96\b|var\(--su96\)/g, to: 'var(--dt-space-750)' },
|
|
110
|
+
{ from: /@su102\b|var\(--su102\)/g, to: 'var(--dt-space-760)' },
|
|
111
|
+
{ from: /@su114\b|var\(--su114\)/g, to: 'var(--dt-space-775)' },
|
|
112
|
+
{ from: /@su128\b|var\(--su128\)/g, to: 'var(--dt-space-800)' },
|
|
113
|
+
// Border radius
|
|
114
|
+
{ from: /@br-(pill|circle)|var\(--br-(pill|circle)\)/g, to: 'var(--dt-size-radius-$1$2)' },
|
|
115
|
+
{ from: /@br0|var\(--br0\)/g, to: 'var(--dt-size-radius-0)' },
|
|
116
|
+
{ from: /@br2\b|var\(--br2\)/g, to: 'var(--dt-size-radius-200)' },
|
|
117
|
+
{ from: /@br4|var\(--br4\)/g, to: 'var(--dt-size-radius-300)' },
|
|
118
|
+
{ from: /@br8|var\(--br8\)/g, to: 'var(--dt-size-radius-400)' },
|
|
119
|
+
{ from: /@br12|var\(--br12\)/g, to: 'var(--dt-size-450)' },
|
|
120
|
+
{ from: /@br16|var\(--br16\)/g, to: 'var(--dt-size-radius-500)' },
|
|
121
|
+
{ from: /@br24|var\(--br24\)/g, to: 'var(--dt-size-550)' },
|
|
122
|
+
{ from: /@br32|var\(--br32\)/g, to: 'var(--dt-size-radius-600)' },
|
|
123
|
+
],
|
|
124
|
+
};
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { globby } from 'globby';
|
|
3
|
+
import inquirer from 'inquirer';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import fs from 'fs';
|
|
6
|
+
const { readdir, readFile, writeFile } = fs.promises;
|
|
7
|
+
|
|
8
|
+
// confirm prompt for starting operations, display warning and y/n dialog
|
|
9
|
+
export const confirmStart = () => {
|
|
10
|
+
return new Promise((resolve, reject) => {
|
|
11
|
+
inquirer
|
|
12
|
+
.prompt([
|
|
13
|
+
{
|
|
14
|
+
type: 'confirm',
|
|
15
|
+
name: 'yesno',
|
|
16
|
+
prefix: `
|
|
17
|
+
${chalk.bgRed(
|
|
18
|
+
'┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ !!! CAUTION !!! ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓',
|
|
19
|
+
)}
|
|
20
|
+
${chalk.bgRed(
|
|
21
|
+
'┃',
|
|
22
|
+
)} Please be sure you are running this in a code repository where changes can be rolled back. ${chalk.bgRed(
|
|
23
|
+
'┃',
|
|
24
|
+
)}
|
|
25
|
+
${chalk.bgRed(
|
|
26
|
+
'┃',
|
|
27
|
+
)} Modifications will occur to files listed above. Proceed at your own risk. ${chalk.bgRed(
|
|
28
|
+
'┃',
|
|
29
|
+
)}
|
|
30
|
+
${chalk.bgRed(
|
|
31
|
+
'┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛',
|
|
32
|
+
)}\n
|
|
33
|
+
`,
|
|
34
|
+
message: 'Start modification?',
|
|
35
|
+
default: true,
|
|
36
|
+
},
|
|
37
|
+
])
|
|
38
|
+
.then((choice) => {
|
|
39
|
+
resolve(choice.yesno);
|
|
40
|
+
})
|
|
41
|
+
.catch((err) => {
|
|
42
|
+
reject(err);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// return array of all globby pattern matches in one level
|
|
48
|
+
export const doPatternSearch = async (config) => {
|
|
49
|
+
const res = [];
|
|
50
|
+
for (const p of config.patterns) {
|
|
51
|
+
res.push(
|
|
52
|
+
...(await getGlob(p, config.globbyConfig).catch((err) => error('doPatternSearch: ' + err))),
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
return res;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// error and quit
|
|
59
|
+
export const error = (message) => {
|
|
60
|
+
console.log(`\n${chalk.red('!!')} Error: ${message}\n`);
|
|
61
|
+
process.exit(1);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const findMatchedFiles = async (fileList, config) => {
|
|
65
|
+
return getAllFileContents(fileList, config.globbyConfig.cwd).then((globbed) => {
|
|
66
|
+
// filter out minified files
|
|
67
|
+
const filtered = globbed
|
|
68
|
+
.filter((f) => {
|
|
69
|
+
return (f.data.match(/[\n\r]/g) || []).length > 3;
|
|
70
|
+
})
|
|
71
|
+
.filter((f) => {
|
|
72
|
+
config.expressions.forEach((e) => {
|
|
73
|
+
if (e.from.test(f.data)) f.matches++;
|
|
74
|
+
});
|
|
75
|
+
return f.matches > 0;
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
return filtered.reduce((prev, current) => {
|
|
79
|
+
const fn = path.relative(config.globbyConfig.cwd, current.file);
|
|
80
|
+
return [...prev, fn];
|
|
81
|
+
}, []);
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// read file contents of all matched files, return filename and data, default matches (0)
|
|
86
|
+
export const getAllFileContents = (fileList, cwd) => {
|
|
87
|
+
const readPromises = fileList.map(async (file) => {
|
|
88
|
+
file = cwd + path.sep + file;
|
|
89
|
+
return readFile(file, 'utf8')
|
|
90
|
+
.then((data) => {
|
|
91
|
+
return { file, data, matches: 0 };
|
|
92
|
+
})
|
|
93
|
+
.catch((err) => error('getAllFileContents: ' + err));
|
|
94
|
+
});
|
|
95
|
+
return Promise.all(readPromises);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
// return list of files from path
|
|
99
|
+
export const getConfigFileList = (path) => {
|
|
100
|
+
return new Promise((resolve, reject) => {
|
|
101
|
+
readdir(path)
|
|
102
|
+
.then((files) => {
|
|
103
|
+
resolve(
|
|
104
|
+
files.map((file) => ({
|
|
105
|
+
name: file.replace(/-/g, ' ').split('.')[0],
|
|
106
|
+
value: file,
|
|
107
|
+
})),
|
|
108
|
+
);
|
|
109
|
+
})
|
|
110
|
+
.catch((err) => reject(err));
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
// returns globby promise based on search pattern and configuration
|
|
115
|
+
// https://github.com/sindresorhus/globby
|
|
116
|
+
export const getGlob = (pattern, config) => {
|
|
117
|
+
return new Promise((resolve, reject) => {
|
|
118
|
+
globby(pattern, config)
|
|
119
|
+
.then((matches) => resolve(matches))
|
|
120
|
+
.catch((err) => reject(err));
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
// display list of configuration files retreived by readConfigFile
|
|
125
|
+
export const inquireForFile = (folder, options) => {
|
|
126
|
+
return new Promise((resolve, reject) => {
|
|
127
|
+
inquirer
|
|
128
|
+
.prompt([
|
|
129
|
+
{
|
|
130
|
+
type: 'list',
|
|
131
|
+
name: 'file',
|
|
132
|
+
choices: options,
|
|
133
|
+
pageSize: 4,
|
|
134
|
+
prefix: `\n${chalk.green('?')} Choose a migration configuration to use:\n`,
|
|
135
|
+
},
|
|
136
|
+
])
|
|
137
|
+
.then((choice) => {
|
|
138
|
+
const configPath = `${folder}/${choice.file}`;
|
|
139
|
+
resolve(readConfigFile(configPath));
|
|
140
|
+
})
|
|
141
|
+
.catch((err) => {
|
|
142
|
+
reject(err);
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
// for each expression (string.replace(from, to)) iterate over each file and make
|
|
148
|
+
// changes where a match was found. Records number of matches per file.
|
|
149
|
+
// @TODO: could probably be sped up but it already seems pretty fast.
|
|
150
|
+
export const modifyFileContents = async (content, expr) => {
|
|
151
|
+
// filter out files with less than 3 newlines, likely compressed/minified files
|
|
152
|
+
content
|
|
153
|
+
.filter((f) => {
|
|
154
|
+
return (f.data.match(/[\n\r]/g) || []).length > 3;
|
|
155
|
+
})
|
|
156
|
+
.map((f) => {
|
|
157
|
+
expr.forEach((e) => {
|
|
158
|
+
f.data = f.data.replace(e.from, (match) => {
|
|
159
|
+
f.matches++;
|
|
160
|
+
return match.replace(e.from, e.to);
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
return f;
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
// promise map for writing file to the FS
|
|
167
|
+
const writePromises = content.map(async (content) => {
|
|
168
|
+
if (content.matches > 0) {
|
|
169
|
+
return writeFile(content.file, content.data, 'utf8')
|
|
170
|
+
.then(() => {
|
|
171
|
+
return { file: content.file, matches: content.matches };
|
|
172
|
+
})
|
|
173
|
+
.catch((err) => error('writePromises: ' + err));
|
|
174
|
+
} else {
|
|
175
|
+
return { file: content.file, matches: 0 };
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
// write out list of files that changed and how many changes were made
|
|
180
|
+
return await Promise.all(writePromises).then((results) => {
|
|
181
|
+
results.forEach((result) => {
|
|
182
|
+
if (result.matches > 0) {
|
|
183
|
+
// gives a shorter name
|
|
184
|
+
const shortname = path.relative(process.cwd(), result.file);
|
|
185
|
+
console.log(
|
|
186
|
+
`${chalk.yellow('>>')} ${shortname}${chalk.gray(',')} ${chalk.whiteBright(
|
|
187
|
+
result.matches,
|
|
188
|
+
)} changes`,
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
// read configuration file and return array with data and config filename
|
|
196
|
+
export const readConfigFile = async (file) => {
|
|
197
|
+
const config = await import(file);
|
|
198
|
+
return [config.default, path.basename(file)];
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
export default {
|
|
202
|
+
confirmStart,
|
|
203
|
+
doPatternSearch,
|
|
204
|
+
error,
|
|
205
|
+
findMatchedFiles,
|
|
206
|
+
getAllFileContents,
|
|
207
|
+
getConfigFileList,
|
|
208
|
+
getGlob,
|
|
209
|
+
inquireForFile,
|
|
210
|
+
modifyFileContents,
|
|
211
|
+
readConfigFile,
|
|
212
|
+
};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import {
|
|
5
|
+
confirmStart,
|
|
6
|
+
doPatternSearch,
|
|
7
|
+
error,
|
|
8
|
+
findMatchedFiles,
|
|
9
|
+
getConfigFileList,
|
|
10
|
+
getAllFileContents,
|
|
11
|
+
inquireForFile,
|
|
12
|
+
modifyFileContents,
|
|
13
|
+
readConfigFile,
|
|
14
|
+
} from './helpers.mjs';
|
|
15
|
+
import ora from 'ora';
|
|
16
|
+
import { dirname, normalize } from 'path';
|
|
17
|
+
import { fileURLToPath } from 'url';
|
|
18
|
+
import { hideBin } from 'yargs/helpers';
|
|
19
|
+
import yargs from 'yargs';
|
|
20
|
+
|
|
21
|
+
// eslint-disable-next-line complexity
|
|
22
|
+
(async () => {
|
|
23
|
+
// get command line args
|
|
24
|
+
const argv = yargs(hideBin(process.argv))
|
|
25
|
+
.scriptName('dialtone-migration-helper')
|
|
26
|
+
.usage(
|
|
27
|
+
'$0 --cwd "../root/directory" --include "file1.ext" "**/*.ext2" --ignore "**/ignored/**", "**/another_ignored/**"',
|
|
28
|
+
)
|
|
29
|
+
.options({
|
|
30
|
+
cwd: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
description: 'Root directory for scan. Defaults to CWD.',
|
|
33
|
+
default: process.cwd(),
|
|
34
|
+
},
|
|
35
|
+
include: {
|
|
36
|
+
type: 'array',
|
|
37
|
+
description: 'Glob patters to include during search, if omitted, will include all the files on the CWD.',
|
|
38
|
+
},
|
|
39
|
+
ignore: {
|
|
40
|
+
type: 'array',
|
|
41
|
+
description: 'Other glob patterns to ignore during search. .gitignore included by default.',
|
|
42
|
+
},
|
|
43
|
+
force: {
|
|
44
|
+
boolean: true,
|
|
45
|
+
description: 'Skip interactive prompts, use caution!',
|
|
46
|
+
default: false,
|
|
47
|
+
},
|
|
48
|
+
})
|
|
49
|
+
.help().argv;
|
|
50
|
+
|
|
51
|
+
// get list of configuration files
|
|
52
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
53
|
+
const __dirname = dirname(__filename);
|
|
54
|
+
const CONFIG_FOLDER = __dirname + '/configs';
|
|
55
|
+
const configList = await getConfigFileList(CONFIG_FOLDER).catch((err) =>
|
|
56
|
+
error('getConfigFileList: ' + err),
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
// load configuration from arg or list
|
|
60
|
+
const [configData, configFile] = await inquireForFile(CONFIG_FOLDER, configList)
|
|
61
|
+
.catch((err) =>
|
|
62
|
+
error('inquireForFile: ' + err),
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
// set up some globby defaults
|
|
66
|
+
configData.globbyConfig = configData.globbyConfig || {};
|
|
67
|
+
configData.globbyConfig.gitignore = configData.globbyConfig.gitignore || true;
|
|
68
|
+
|
|
69
|
+
console.log(
|
|
70
|
+
`\n${chalk.green('++')} Configuration Loaded! (${configFile}) ${chalk.green('++')}\n`,
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
// take CWD if specified from command line
|
|
74
|
+
const cwd = !argv.cwd ? process.cwd() : normalize(argv.cwd);
|
|
75
|
+
configData.globbyConfig.cwd = configData.globbyConfig.cwd || cwd;
|
|
76
|
+
// push include list to configuration array
|
|
77
|
+
if (argv.include) {
|
|
78
|
+
configData.patterns = argv.include;
|
|
79
|
+
}
|
|
80
|
+
// push ignore list to configuration array
|
|
81
|
+
if (argv.ignore) {
|
|
82
|
+
configData.globbyConfig.ignore = argv.ignore;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// run glob search with configData.patterns
|
|
86
|
+
const globSpinner = ora('Performing pattern search').start();
|
|
87
|
+
const files = await doPatternSearch(configData).then((f) => {
|
|
88
|
+
return findMatchedFiles(f, configData);
|
|
89
|
+
});
|
|
90
|
+
if (files.length <= 0) {
|
|
91
|
+
console.log(
|
|
92
|
+
'\n' +
|
|
93
|
+
chalk.cyan('??') +
|
|
94
|
+
' No matches found! Check your patterns and cwd settings if you think this is an error ' +
|
|
95
|
+
`patterns: [${configData.patterns}] | cwd: [${configData.globbyConfig.cwd}] `,
|
|
96
|
+
);
|
|
97
|
+
process.exit(0);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
globSpinner.stop();
|
|
101
|
+
console.log(`[ ${chalk.whiteBright(files.length)} ] files queued for modification:\n`);
|
|
102
|
+
console.log(files);
|
|
103
|
+
console.log(
|
|
104
|
+
`\n${chalk.yellow('Configuration Description')}${chalk.gray(':')}\n${configData.description}\n`,
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
// kick off file search and replace
|
|
108
|
+
const startModification = () => {
|
|
109
|
+
console.log(`\n${chalk.blue('__')} Starting ...`);
|
|
110
|
+
|
|
111
|
+
getAllFileContents(files, configData.globbyConfig.cwd)
|
|
112
|
+
.then((content) => {
|
|
113
|
+
modifyFileContents(content, configData.expressions).then(() => {
|
|
114
|
+
console.log(`${chalk.magenta('==')} Modification complete!\n`);
|
|
115
|
+
});
|
|
116
|
+
})
|
|
117
|
+
.catch((err) => error('getAllFileContents: ' + err));
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
// begin file modification based on configuration rules
|
|
121
|
+
// start automatically if --force is specified
|
|
122
|
+
if (!argv.force) {
|
|
123
|
+
confirmStart()
|
|
124
|
+
.then((val) => {
|
|
125
|
+
if (val) {
|
|
126
|
+
startModification();
|
|
127
|
+
} else {
|
|
128
|
+
console.log(`\n${chalk.red('__')} Cancelling ...\n`);
|
|
129
|
+
}
|
|
130
|
+
})
|
|
131
|
+
.catch((err) => error('confirmStart ' + err));
|
|
132
|
+
} else {
|
|
133
|
+
startModification();
|
|
134
|
+
}
|
|
135
|
+
})();
|