@demos-europe/demosplan-ui 0.3.21 → 0.3.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 (54) hide show
  1. package/.idea/shelf/Uncommitted_changes_before_Checkout_at_26_07_2024_16_29_[Changes]/shelved.patch +30800 -0
  2. package/.idea/shelf/Uncommitted_changes_before_Checkout_at_26_07_2024_16_29__Changes_.xml +4 -0
  3. package/.idea/workspace.xml +129 -46
  4. package/.yarn/install-state.gz +0 -0
  5. package/CHANGELOG.md +21 -0
  6. package/dist/demosplan-ui.umd.js +1 -1
  7. package/package.json +19 -6
  8. package/scripts/buildTokens.js +118 -0
  9. package/scripts/utils/transformTokens.js +249 -0
  10. package/src/components/DpDataTable/DpDataTable.vue +6 -2
  11. package/src/components/DpDataTable/DpTableHeader.vue +6 -2
  12. package/src/components/DpEditor/libs/editorCustomLink.js +3 -0
  13. package/src/lib/DpApi.js +2 -2
  14. package/tailwind.config.js +20 -50
  15. package/tokens/dist/js/boxShadow.js +10 -10
  16. package/tokens/dist/js/breakpoints.js +1 -1
  17. package/tokens/dist/js/color.brand.js +1 -1
  18. package/tokens/dist/js/color.data.js +1 -1
  19. package/tokens/dist/js/color.palette.js +1 -1
  20. package/tokens/dist/js/color.ui-tailwind.js +1 -1
  21. package/tokens/dist/js/color.ui.js +68 -68
  22. package/tokens/dist/js/fontSize.js +86 -98
  23. package/tokens/dist/js/rounded.js +1 -1
  24. package/tokens/dist/js/space.js +1 -1
  25. package/tokens/dist/js/zIndex.js +18 -18
  26. package/tokens/dist/scss/_boxShadow.scss +1 -1
  27. package/tokens/dist/scss/_breakpoints.scss +1 -1
  28. package/tokens/dist/scss/_color.brand.scss +1 -1
  29. package/tokens/dist/scss/_color.data.scss +1 -1
  30. package/tokens/dist/scss/_color.palette.scss +1 -1
  31. package/tokens/dist/scss/_color.ui.scss +1 -1
  32. package/tokens/dist/scss/_fontSize.scss +13 -7
  33. package/tokens/dist/scss/_rounded.scss +1 -1
  34. package/tokens/dist/scss/_space.scss +1 -1
  35. package/tokens/dist/scss/_zIndex.scss +1 -1
  36. package/tokens/dist/tailwind/backgroundColor.js +22 -22
  37. package/tokens/dist/tailwind/borderColor.js +7 -7
  38. package/tokens/dist/tailwind/boxShadow.js +6 -0
  39. package/tokens/dist/tailwind/breakpoints.js +6 -0
  40. package/tokens/dist/tailwind/color.js +37 -3
  41. package/tokens/dist/tailwind/fontSize.js +16 -0
  42. package/tokens/dist/tailwind/rounded.js +8 -0
  43. package/tokens/dist/tailwind/space.js +20 -0
  44. package/tokens/dist/tailwind/textColor.js +35 -35
  45. package/tokens/dist/tailwind/zIndex.js +10 -0
  46. package/tokens/src/boxShadow.json +5 -5
  47. package/tokens/src/color/color.ui.json +397 -0
  48. package/tokens/src/fontSize.json +47 -23
  49. package/tokens/src/zIndex.json +1 -1
  50. package/yarn-error.log +13974 -0
  51. package/.idea/shelf/Uncommitted_changes_before_Update_at_17_07_2024_15_21_[Changes]/shelved.patch +0 -36
  52. package/.idea/shelf/Uncommitted_changes_before_Update_at_17_07_2024_15_21__Changes_.xml +0 -4
  53. package/buildTokens.js +0 -240
  54. package/tokens/src/color/color.ui-tailwind.json +0 -401
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@demos-europe/demosplan-ui",
3
- "version": "0.3.21",
3
+ "version": "0.3.24",
4
4
  "license": "MIT",
5
- "private": false,
6
5
  "description": "Vue components, Vue directives, Design Token and Scss files to build interfaces for demosPlan.",
7
6
  "main": "./dist/demosplan-ui.umd.js",
8
7
  "dependencies": {
@@ -65,24 +64,35 @@
65
64
  "@storybook/addon-essentials": "7.6.17",
66
65
  "@storybook/addon-links": "7.6.17",
67
66
  "@storybook/addon-styling-webpack": "^0.0.6",
68
- "@storybook/vue": "7.6.17",
67
+ "@storybook/blocks": "^7.0.27",
68
+ "@storybook/components": "^7.0.27",
69
+ "@storybook/core-events": "^7.0.27",
70
+ "@storybook/preview-api": "^7.0.27",
71
+ "@storybook/theming": "^7.0.27",
72
+ "@storybook/types": "^7.0.27",
69
73
  "@storybook/vue-webpack5": "7.6.17",
74
+ "@storybook/vue3": "^7.0.27",
75
+ "@types/eslint": "^9",
70
76
  "@types/jest": "^29.5.1",
71
77
  "@types/qs": "^6.9.7",
72
78
  "@typescript-eslint/eslint-plugin": "^5.4.0",
73
79
  "@typescript-eslint/parser": "^5.4.0",
74
80
  "@vue/cli-plugin-typescript": "~5.0.0",
81
+ "@vue/cli-service": "^5.0.8",
75
82
  "@vue/eslint-config-typescript": "^12.0.0",
76
83
  "@vue/test-utils": "^1.3.5",
77
84
  "@vue/vue2-jest": "^29.2.4",
78
85
  "@webpack-cli/generators": "^3.0.0",
79
86
  "autoprefixer": "^10.4.14",
80
87
  "babel-core": "^7.0.0-bridge.0",
88
+ "babel-helper-vue-jsx-merge-props": "^2.0.3",
81
89
  "babel-jest": "^29.5.0",
82
90
  "babel-loader": "^9.1.2",
83
91
  "babel-plugin-syntax-jsx": "^6.18.0",
84
92
  "babel-plugin-transform-vue-jsx": "^3.7.0",
85
93
  "css-loader": "^7.0.0",
94
+ "eslint": "^8.57.0",
95
+ "eslint-plugin-vue": "^9.27.0",
86
96
  "glob": "^10.3.1",
87
97
  "jest": "^29.5.0",
88
98
  "jest-environment-jsdom": "^29.3.1",
@@ -94,6 +104,7 @@
94
104
  "postcss": "^8.4.26",
95
105
  "postcss-loader": "^8.0.0",
96
106
  "prop-types": "^15.8.1",
107
+ "prosemirror-model": "^1.18.1",
97
108
  "react": "^18.2.0",
98
109
  "react-dom": "^18.2.0",
99
110
  "storybook": "7.6.17",
@@ -105,6 +116,7 @@
105
116
  "ts-jest": "^29.1.0",
106
117
  "ts-loader": "^9.4.4",
107
118
  "typescript": "~5.5.3",
119
+ "vue": "^2.7.15",
108
120
  "vue-jest": "^3.0.7",
109
121
  "vue-loader": "^15",
110
122
  "vue-template-compiler": "^2.7.15",
@@ -113,7 +125,7 @@
113
125
  "webpack-cli": "^5.0.0"
114
126
  },
115
127
  "engines": {
116
- "node": ">= 18.13.0"
128
+ "node": ">= 18.19.0"
117
129
  },
118
130
  "peerDependencies": {
119
131
  "prosemirror-history": "^1.3.0",
@@ -154,7 +166,7 @@
154
166
  },
155
167
  "scripts": {
156
168
  "build:storybook": "storybook build",
157
- "build:tokens": "node buildTokens.js",
169
+ "build:tokens": "node scripts/buildTokens.js",
158
170
  "prepack": "yarn build && yarn build:tokens",
159
171
  "storybook": "storybook dev -p 6006",
160
172
  "build": "yarn test && yarn build:prod",
@@ -162,5 +174,6 @@
162
174
  "build:prod": "webpack --mode=production --define-process-env-node-env=production",
163
175
  "test": "jest",
164
176
  "watch": "webpack --watch"
165
- }
177
+ },
178
+ "packageManager": "yarn@4.2.2"
166
179
  }
@@ -0,0 +1,118 @@
1
+ const glob = require('glob')
2
+ const StyleDictionary = require('style-dictionary')
3
+ const {
4
+ transformScssTokens,
5
+ transformTailwindTokens
6
+ } = require('./utils/transformTokens')
7
+
8
+ const prefix = 'dp-'
9
+
10
+ const tokensPath = 'tokens/src/**/*.json'
11
+
12
+ const files = glob
13
+ .sync(tokensPath)
14
+ .map(filePath => filePath
15
+ .replace('tokens/src/', '')
16
+ .replace('color/', '')
17
+ .replace('.json', ''))
18
+ .filter(filePath => !filePath.startsWith('_')) // Do not render tokens only used internally
19
+
20
+ // Define custom output groups for Tailwind, rather than just grouping them by file path
21
+ const corePlugins = ['fontSize', 'boxShadow', 'breakpoints', 'rounded', 'space', 'zIndex']
22
+ const corePluginsColor = ['color', 'textColor', 'backgroundColor', 'borderColor']
23
+
24
+ // Adds prefix to variables. Keeps uppercase path parts, which is needed later.
25
+ StyleDictionary.registerTransform({
26
+ name: 'name/scss',
27
+ type: 'name',
28
+ transformer: (token) => prefix + token.path.join('-')
29
+ })
30
+
31
+ // Adds prefix transform to default scss transform group
32
+ StyleDictionary.registerTransformGroup({
33
+ name: 'custom/scss',
34
+ transforms: StyleDictionary.transformGroup.scss.concat(['name/scss'])
35
+ })
36
+
37
+ // Adds prefix to variables. Keeps uppercase path parts, which is needed later.
38
+ StyleDictionary.registerTransform({
39
+ name: 'name/web',
40
+ type: 'name',
41
+ transformer: (token) => token.path.join('-')
42
+ })
43
+
44
+ // Adds prefix transform to default scss transform group
45
+ StyleDictionary.registerTransformGroup({
46
+ name: 'custom/web',
47
+ transforms: StyleDictionary.transformGroup.web.concat(['name/web'])
48
+ })
49
+
50
+ /**
51
+ * Custom format that generates javascript modules ready to be used as Tailwind config files.
52
+ * The values use a nested set of css variables to enable theming on multiple levels.
53
+ */
54
+ StyleDictionary.registerFormat({
55
+ name: 'tailwind/variables',
56
+ formatter: (formatterArguments) => transformTailwindTokens(formatterArguments, corePluginsColor)
57
+ })
58
+
59
+ /**
60
+ * This format is a customized version of the implementation in `formattedVariables`.
61
+ * It applies some transformations to scss variables according to the conventions in demosplan-ui.
62
+ * See https://github.com/amzn/style-dictionary/blob/17f4cb2f30bd002dfd55d6ef8c5bee4138de8d64/lib/common/formatHelpers/formattedVariables.js#L46
63
+ */
64
+ StyleDictionary.registerFormat({
65
+ name: 'scss/customVariables',
66
+ formatter: transformScssTokens
67
+ })
68
+
69
+ const StyleDictionaryExtended = StyleDictionary.extend({
70
+ source: [tokensPath],
71
+ platforms: {
72
+ js: {
73
+ transformGroup: 'js',
74
+ buildPath: 'tokens/dist/js/',
75
+ files: files.map((filePath) => {
76
+ return {
77
+ destination: `${filePath}.js`,
78
+ format: 'javascript/module',
79
+ filter: (token) => {
80
+ return token.filePath.includes(filePath) && token.$status !== 'Deprecated'
81
+ },
82
+ options: {
83
+ outputReferences: true
84
+ }
85
+ }
86
+ })
87
+ },
88
+ scss: {
89
+ transformGroup: 'custom/scss',
90
+ prefix,
91
+ buildPath: 'tokens/dist/scss/',
92
+ files: files
93
+ .map((filePath) => {
94
+ return {
95
+ destination: `_${filePath}.scss`,
96
+ format: 'scss/customVariables',
97
+ filter: (token) => token.filePath.includes(filePath),
98
+ options: {
99
+ outputReferences: true
100
+ }
101
+ }
102
+ })
103
+ },
104
+ web: {
105
+ transformGroup: 'custom/web',
106
+ prefix,
107
+ buildPath: 'tokens/dist/tailwind/',
108
+ files: [...corePlugins, ...corePluginsColor].map((plugin) => {
109
+ return {
110
+ destination: `${plugin}.js`,
111
+ format: 'tailwind/variables'
112
+ }
113
+ }),
114
+ },
115
+ }
116
+ })
117
+
118
+ StyleDictionaryExtended.buildAllPlatforms()
@@ -0,0 +1,249 @@
1
+ const StyleDictionary = require("style-dictionary");
2
+ const {
3
+ createPropertyFormatter,
4
+ fileHeader,
5
+ sortByReference
6
+ } = StyleDictionary.formatHelpers
7
+
8
+ // Resolve token values with fallback, for css variables nesting
9
+ const resolveValue = (token, dictionary) => {
10
+ let value = token.value
11
+ const seen = new Set()
12
+
13
+ while (dictionary.usesReference(value)) {
14
+ seen.add(value)
15
+ value = dictionary.getReferences(value)[0].value
16
+ if (seen.has(value)) break
17
+ }
18
+
19
+ return value
20
+ }
21
+
22
+ // Turn a dash-case-string into a lowerCamelString
23
+ const dashToLowerCamel = (str) => {
24
+ return str.replace(/-([a-z])/g, function (g) {
25
+ return g[1].toUpperCase()
26
+ })
27
+ }
28
+
29
+ // Turn a lowerCamelString into a dash-case-string
30
+ const lowerCamelToDash = (str) => {
31
+ return str.replace(/([A-Z])/g, '-$1').toLowerCase()
32
+ }
33
+
34
+ // Build Css variables chain to resolve aliases
35
+ const transformTailwindTokenValue = (token, formatterArguments) => {
36
+ const { dictionary, platform } = formatterArguments
37
+ const varName = `--${platform.prefix}${transformTailwindTokenName(token, true).replace(/\./g, '-')}`
38
+ let fallback = resolveValue(token, dictionary)
39
+
40
+ let current = token
41
+ let cssVar = `var(${varName}`
42
+ while (current.original && current.original.value.startsWith('{')) {
43
+ const ref = dictionary.getReferences(current.original.value)[0]
44
+ let refName = transformTailwindTokenName(ref, true)
45
+ refName = `--${platform.prefix}${refName.replace(/\./g, '-')}`
46
+ cssVar += `, var(${refName}`
47
+
48
+ current = ref
49
+ }
50
+
51
+ // Add final fallback, close with brackets corresponding to the amount of "var" usages found
52
+ cssVar += `, ${fallback}` + ')'.repeat(cssVar.match(/var\(/g).length)
53
+
54
+ return cssVar
55
+ }
56
+
57
+ const transformTailwindTokensGrouped = (formatterArguments, corePluginsColor) => {
58
+ const { dictionary, file } = formatterArguments
59
+ const groupedTokens = {}
60
+
61
+ corePluginsColor.forEach(plugin => {
62
+ groupedTokens[plugin] = {}
63
+ })
64
+
65
+ dictionary.allTokens.forEach(token => {
66
+ // Do not include legacy ui and palette colors
67
+ if (token.path[0] !== 'color' || token.path[0] === 'color' && ['ui', 'palette'].includes(token.path[1])) {
68
+ return false
69
+ }
70
+
71
+ const tokenName = transformTailwindTokenName(token)
72
+ const replaced = transformTailwindTokenValue(token, formatterArguments)
73
+
74
+ // Sort token definition into respective group
75
+ corePluginsColor.forEach(plugin => {
76
+ if (token.path[2] === plugin || ['brand', 'data'].includes(token.path[1]) && plugin === 'color') {
77
+ groupedTokens[plugin][tokenName] = replaced
78
+ }
79
+ })
80
+ })
81
+
82
+ return `module.exports = ${JSON.stringify(groupedTokens[file.destination.replace('.js', '')], null, 2)};`
83
+ }
84
+
85
+ const isDestination = (file, token) => {
86
+ const filePart = file.destination.replace('.js', '')
87
+ const dashedTokenPath = dashToLowerCamel(token.path[0])
88
+ return dashedTokenPath === filePart
89
+ }
90
+
91
+ const isDeprecated = (token) => token['$status'] === 'Deprecated'
92
+
93
+ const isTailwindExcluded = (token) => {
94
+ return token.path[0] === 'fontSize' && token.path[1] === 'scale'
95
+ }
96
+
97
+ const transformTailwindTokensFlat = (formatterArguments) => {
98
+ const { dictionary, file } = formatterArguments
99
+ const tokens = {}
100
+
101
+ dictionary.allTokens.forEach(token => {
102
+ if (!isDestination(file, token) || isDeprecated(token) || isTailwindExcluded(token)) {
103
+ return
104
+ }
105
+
106
+ const tokenName = transformTailwindTokenName(token)
107
+ tokens[tokenName] = transformTailwindTokenValue(token, formatterArguments)
108
+ })
109
+
110
+ return `module.exports = ${JSON.stringify(tokens, null, 2)};`
111
+ }
112
+
113
+ // Extract variable name from Scss variables declaration
114
+ const getScssVariableName = (declaration) => {
115
+ const regex = /\$([\w.-]+)\s*:/
116
+ const match = declaration.match(regex)
117
+
118
+ if (match) {
119
+ return match[1]
120
+ }
121
+
122
+ return null
123
+ }
124
+
125
+ // Replace string in Scss variable name via regex
126
+ const replaceScssVariableName = (declaration, searchRegex, replaceStr) => {
127
+ const variableName = getScssVariableName(declaration)
128
+ if (variableName) {
129
+ const updatedVariableName = variableName.replace(searchRegex, replaceStr)
130
+ return declaration.replace(variableName, updatedVariableName)
131
+ }
132
+
133
+ return declaration
134
+ }
135
+
136
+ // Transforms that apply to both Scss and Tailwind platforms
137
+ const transformDeclarationDefault = (declaration, tokenPath) => {
138
+ // The domain part within font-size tokens should not be part of the variable name.
139
+ if (tokenPath[0] === 'fontSize') {
140
+ declaration = declaration.replace(/-(scale|brand|heading|ui)/g, '')
141
+ }
142
+
143
+ // The domain part within color tokens should not be part of the variable name.
144
+ if (tokenPath[0] === 'color') {
145
+ declaration = declaration.replace(/-(brand|data|palette|ui-tailwind|ui)/g, '')
146
+ }
147
+
148
+ return declaration
149
+ }
150
+
151
+ // Transforms that only apply to Tailwind token name
152
+ const transformTailwindTokenName = (token, keepPluginName = false) => {
153
+ let declaration = token.name
154
+ const tokenPath = token.path
155
+
156
+ declaration = transformDeclarationDefault(declaration, tokenPath)
157
+
158
+ // Within css variable declarations, we want to keep plugin names
159
+ if (!keepPluginName) {
160
+ if (tokenPath[0] === 'color' || tokenPath[1] === 'ui-tailwind') {
161
+ declaration = declaration.replace(/color-/g, '')
162
+ }
163
+
164
+ if (tokenPath[0] === 'color' && tokenPath[1] === 'ui-tailwind') {
165
+ declaration = declaration.replace(/(textColor|backgroundColor|borderColor)-/g, '')
166
+ }
167
+
168
+ if (['boxShadow', 'breakpoints', 'fontSize', 'rounded', 'space', 'zIndex'].includes(tokenPath[0])) {
169
+ declaration = declaration.replace(/(boxShadow|breakpoints|fontSize|rounded|space|zIndex)-/g, '')
170
+ }
171
+ }
172
+
173
+ // Handle special cases with css var naming
174
+ if (tokenPath[1] === 'ui-tailwind' && tokenPath[2] !== 'color') {
175
+ declaration = declaration.replace(/color-/g, '')
176
+ } else if (tokenPath[1] === 'ui-tailwind' && tokenPath[2] === 'color') {
177
+ declaration = declaration.replace(/color-color-/g, 'color-')
178
+ }
179
+
180
+ // "DEFAULT" is a Tailwind convention which should not be part of the declaration key.
181
+ declaration = declaration.replace(/-DEFAULT/g, '')
182
+
183
+ return declaration
184
+ }
185
+
186
+ // Transforms that only apply to Scss platform
187
+ const transformDeclarationScss = (declaration, tokenPath) => {
188
+ declaration = transformDeclarationDefault(declaration, tokenPath)
189
+
190
+ // The key "z-index" should be shortened in the variable name to match Tailwind syntax
191
+ if (tokenPath[0] === 'zIndex') {
192
+ declaration = declaration.replace(/(z-index|zIndex)-/g, 'z-')
193
+ }
194
+
195
+ // Scss does not like variable names with dots in them.
196
+ declaration = replaceScssVariableName(declaration, /\./g, '_')
197
+
198
+ // Where possible, the lowerCamel case is used for naming in token sources. In Scss, dash-case is the convention.
199
+ declaration = declaration.replace(/(fontSize|boxShadow|zIndex)/g, lowerCamelToDash)
200
+
201
+ // "DEFAULT" is a Tailwind convention that should not be part of the Scss name.
202
+ declaration = declaration.replace(/-DEFAULT/g, '')
203
+
204
+ return declaration
205
+ }
206
+
207
+ const transformScssTokens = ({dictionary, options, file}) => {
208
+ const { outputReferences, formatting } = options
209
+
210
+ let { allTokens } = dictionary
211
+
212
+ if (outputReferences) {
213
+ allTokens = [...allTokens].sort(sortByReference(dictionary))
214
+ }
215
+
216
+ const propertyFormatter = createPropertyFormatter({ outputReferences, dictionary, format: 'sass', formatting })
217
+
218
+ const tokens = allTokens
219
+ .map(token => {
220
+ /**
221
+ * Within color.ui.json, legacy tokens for scss and tailwind tokens are separated into two top-tier
222
+ * properties "ui" and "ui-tailwind". For Scss, only the tokens in the "ui" group should be rendered.
223
+ */
224
+ if (token.path[1] === 'ui-tailwind') {
225
+ return
226
+ }
227
+
228
+ // First, the token is formatted with the default Scss propertyFormatter
229
+ const formattedTokenDeclaration = propertyFormatter(token)
230
+
231
+ // Then, our specific transforms are applied to each line.
232
+ return transformDeclarationScss(formattedTokenDeclaration, token.path)
233
+ })
234
+ .filter(function(strVal) { return !!strVal })
235
+ .join('\n')
236
+
237
+ return fileHeader({file, commentStyle: 'short'}) + '\n' + tokens + '\n'
238
+ }
239
+
240
+ const transformTailwindTokens = (formatterArguments, corePluginsColor) => {
241
+ const { file } = formatterArguments
242
+ const isColorTokenFile = corePluginsColor.some(plugin => file.destination.startsWith(plugin))
243
+
244
+ return isColorTokenFile
245
+ ? transformTailwindTokensGrouped(formatterArguments, corePluginsColor)
246
+ : transformTailwindTokensFlat(formatterArguments)
247
+ }
248
+
249
+ module.exports = { transformScssTokens, transformTailwindTokens }
@@ -34,8 +34,12 @@
34
34
  @toggle-expand-all="toggleExpandAll"
35
35
  @toggle-select-all="toggleSelectAll"
36
36
  @toggle-wrap-all="toggleWrapAll">
37
- <template v-slot:[`header-${field}`] v-for="field in fields">
38
- <slot :name="`header-${field}`" />
37
+ <template
38
+ v-for="field in headerFields"
39
+ v-slot:[`header-${field.field}`]="field">
40
+ <slot
41
+ :name="`header-${field.field}`"
42
+ v-bind="field" />
39
43
  </template>
40
44
  </dp-table-header>
41
45
  </thead>
@@ -33,14 +33,18 @@
33
33
  :header-field="hf"
34
34
  :next-header="headerFields[idx + 1]"
35
35
  :idx="idx">
36
- <slot :name="`header-${hf.field}`">
36
+ <slot
37
+ :name="`header-${hf.field}`"
38
+ v-bind="hf">
37
39
  <span v-if="hf.label" v-text="hf.label" />
38
40
  </slot>
39
41
  </dp-resizable-column>
40
42
  <th
41
43
  v-else
42
44
  scope="col">
43
- <slot :name="`header-${hf.field}`">
45
+ <slot
46
+ :name="`header-${hf.field}`"
47
+ v-bind="hf">
44
48
  <span v-if="hf.label" v-text="hf.label" />
45
49
  </slot>
46
50
  </th>
@@ -22,6 +22,9 @@ export default Link.extend({
22
22
  },
23
23
  target: {
24
24
  default: null
25
+ },
26
+ class: {
27
+ default: null
25
28
  }
26
29
  }
27
30
  },
package/src/lib/DpApi.js CHANGED
@@ -190,9 +190,9 @@ const checkResponse = function (response, messages) {
190
190
  if (response.status >= 400) {
191
191
  // @improve handle 404, 500 specially?
192
192
  reject(response.data)
193
- } else if (response.status === 200) {
193
+ } else if (response.status >= 200 && response.status < 400) {
194
194
  // Got data!
195
- resolve(response.data)
195
+ resolve(response.data ? response.data : null)
196
196
  } else {
197
197
  // Got no data
198
198
  resolve(null)
@@ -1,43 +1,28 @@
1
1
  const plugin = require('tailwindcss/plugin')
2
2
 
3
- /**
4
- * Transform a StyleDictionary js module representation of the tokens object
5
- * into a simplified object to be consumable for the Tailwind config.
6
- * It filters out tokens that are aliases for other tokens.
7
- * @param tokens The original object
8
- * @return {{[p: string]: unknown}}
9
- */
10
- const tokensToTailwind = (tokens) => {
11
- const tokensArray = Object.values(tokens)
12
- const filteredTokens = tokensArray.filter(({ original }) => original.value.includes('{') === false)
13
- return Object.fromEntries(filteredTokens.map(({ attributes, value }) => [attributes.type, value]))
3
+ const tailwindTheme = {
4
+ borderRadius: require('./tokens/dist/tailwind/rounded'),
5
+ boxShadow: require('./tokens/dist/tailwind/boxShadow'),
6
+ fontSize: require('./tokens/dist/tailwind/fontSize'),
7
+ screens: require('./tokens/dist/tailwind/breakpoints'),
8
+ spacing: require('./tokens/dist/tailwind/space'),
9
+ zIndex: require('./tokens/dist/tailwind/zIndex'),
10
+ colors: require('./tokens/dist/tailwind/color')
14
11
  }
15
12
 
16
- const borderRadius = tokensToTailwind(require('./tokens/dist/js/rounded').rounded)
17
- const boxShadow = tokensToTailwind(require('./tokens/dist/js/boxShadow')['box-shadow'])
18
- const spacing = tokensToTailwind(require('./tokens/dist/js/space').space)
19
- const screens = tokensToTailwind(require('./tokens/dist/js/breakpoints').breakpoints)
20
- const zIndex = tokensToTailwind(require('./tokens/dist/js/zIndex')['z-index'])
13
+ const tailwindCorePluginsColor = ['backgroundColor', 'borderColor', 'textColor']
21
14
 
22
- const colors = {
23
- ...require('./tokens/dist/tailwind/color'),
24
- ...require('./tokens/dist/tailwind/color.brand'),
25
- ...require('./tokens/dist/tailwind/color.data'),
26
- }
27
-
28
- const backgroundColor = {
29
- ...colors,
30
- ...require('./tokens/dist/tailwind/backgroundColor'),
31
- }
32
-
33
- const borderColor = {
34
- ...colors,
35
- ...require('./tokens/dist/tailwind/borderColor'),
36
- }
15
+ tailwindCorePluginsColor.forEach(corePlugin => {
16
+ tailwindTheme[corePlugin] = {
17
+ ...tailwindTheme.colors,
18
+ ...require(`./tokens/dist/tailwind/${corePlugin}`)
19
+ }
20
+ })
37
21
 
38
- const textColor = {
39
- ...colors,
40
- ...require('./tokens/dist/tailwind/textColor'),
22
+ tailwindTheme.extend = {
23
+ flexShrink: {
24
+ 2: '2'
25
+ }
41
26
  }
42
27
 
43
28
  module.exports = {
@@ -72,20 +57,5 @@ module.exports = {
72
57
  })
73
58
  })
74
59
  ],
75
- theme: {
76
- backgroundColor,
77
- borderColor,
78
- borderRadius,
79
- boxShadow,
80
- colors,
81
- screens,
82
- spacing,
83
- textColor,
84
- zIndex,
85
- extend: {
86
- flexShrink: {
87
- 2: '2'
88
- }
89
- }
90
- }
60
+ theme: tailwindTheme
91
61
  }
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 22 Jul 2024 09:37:27 GMT
3
+ * Generated on Mon, 29 Jul 2024 13:31:38 GMT
4
4
  */
5
5
 
6
6
  module.exports = {
7
- "box-shadow": {
7
+ "boxShadow": {
8
8
  "DEFAULT": {
9
9
  "$description": "Default elevation. Use for Cards + Buttons.",
10
10
  "value": "0 1px 4px rgb(0 0 0 / 22%), 0 1px 2px rgb(0 0 0 / 26%)",
@@ -20,11 +20,11 @@ module.exports = {
20
20
  },
21
21
  "name": "BoxShadowDefault",
22
22
  "attributes": {
23
- "category": "box-shadow",
23
+ "category": "boxShadow",
24
24
  "type": "DEFAULT"
25
25
  },
26
26
  "path": [
27
- "box-shadow",
27
+ "boxShadow",
28
28
  "DEFAULT"
29
29
  ]
30
30
  },
@@ -43,11 +43,11 @@ module.exports = {
43
43
  },
44
44
  "name": "BoxShadowMd",
45
45
  "attributes": {
46
- "category": "box-shadow",
46
+ "category": "boxShadow",
47
47
  "type": "md"
48
48
  },
49
49
  "path": [
50
- "box-shadow",
50
+ "boxShadow",
51
51
  "md"
52
52
  ]
53
53
  },
@@ -66,11 +66,11 @@ module.exports = {
66
66
  },
67
67
  "name": "BoxShadowLg",
68
68
  "attributes": {
69
- "category": "box-shadow",
69
+ "category": "boxShadow",
70
70
  "type": "lg"
71
71
  },
72
72
  "path": [
73
- "box-shadow",
73
+ "boxShadow",
74
74
  "lg"
75
75
  ]
76
76
  },
@@ -89,11 +89,11 @@ module.exports = {
89
89
  },
90
90
  "name": "BoxShadowXl",
91
91
  "attributes": {
92
- "category": "box-shadow",
92
+ "category": "boxShadow",
93
93
  "type": "xl"
94
94
  },
95
95
  "path": [
96
- "box-shadow",
96
+ "boxShadow",
97
97
  "xl"
98
98
  ]
99
99
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 22 Jul 2024 09:37:27 GMT
3
+ * Generated on Mon, 29 Jul 2024 13:31:38 GMT
4
4
  */
5
5
 
6
6
  module.exports = {