hr-design-system-handlebars 0.43.1 → 0.44.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.
Files changed (45) hide show
  1. package/.storybook/main.js +1 -0
  2. package/.storybook/preview.js +3 -0
  3. package/CHANGELOG.md +12 -0
  4. package/{scripts → build/scripts}/build.js +2 -2
  5. package/build/scripts/jsoninclude.js +140 -0
  6. package/config.js +11 -0
  7. package/dist/assets/index.css +35 -0
  8. package/gulpfile.js +36 -2
  9. package/package.json +9 -4
  10. package/src/assets/fixtures/teaser/teaser_comment.json +16 -0
  11. package/src/assets/fixtures/teaser/teaser_labels.inc.json +18 -0
  12. package/src/assets/fixtures/teaser/teaser_standard_lg_serif.json +10 -0
  13. package/src/assets/fixtures/teaser/teaser_standard_md_serif.json +10 -0
  14. package/src/assets/fixtures/teaser/teaser_standard_sm_serif.json +10 -0
  15. package/src/assets/fixtures/teaser/teaser_standard_xl_serif.json +10 -0
  16. package/src/assets/fixtures/teaser/teaser_standard_xxl_serif.json +4 -0
  17. package/src/assets/fixtures/teaser/teaser_standard_xxl_serif_comments.json +4 -0
  18. package/src/assets/fixtures/teaser/teaser_standard_xxl_serif_label.json +28 -0
  19. package/src/assets/fixtures/teaser/teasers.inc.json +254 -0
  20. package/src/stories/Colors.stories.mdx +28 -28
  21. package/src/stories/Fixtures.stories.mdx +93 -0
  22. package/src/stories/Introduction.stories.mdx +85 -93
  23. package/src/stories/SvgOptimization.stories.mdx +1 -1
  24. package/src/stories/Typography.stories.mdx +1 -1
  25. package/src/stories/conventions-and-datastructure.stories.mdx +241 -0
  26. package/src/stories/views/components/Teaser/data/teasers.json +324 -0
  27. package/src/stories/views/components/Teaser/data/ticker_label.json +13 -1
  28. package/src/stories/views/components/Teaser/fixtures/teaser-standard-lg-serif.json +1 -0
  29. package/src/stories/views/components/Teaser/fixtures/teaser-standard-md-serif.json +1 -0
  30. package/src/stories/views/components/Teaser/fixtures/teaser-standard-sm-serif.json +1 -0
  31. package/src/stories/views/components/Teaser/fixtures/teaser-standard-xl-serif.json +1 -0
  32. package/src/stories/views/components/Teaser/fixtures/teaser-standard-xxl-serif.json +1 -0
  33. package/src/stories/views/components/Teaser/fixtures/teaser_comment.json +1 -0
  34. package/src/stories/views/components/Teaser/fixtures/teaser_commentLink.json +1 -0
  35. package/src/stories/views/components/Teaser/fixtures/teaser_standard_lg_serif.json +1 -0
  36. package/src/stories/views/components/Teaser/fixtures/teaser_standard_md_serif.json +1 -0
  37. package/src/stories/views/components/Teaser/fixtures/teaser_standard_sm_serif.json +1 -0
  38. package/src/stories/views/components/Teaser/fixtures/teaser_standard_xl_serif.json +1 -0
  39. package/src/stories/views/components/Teaser/fixtures/teaser_standard_xxl_serif copy.json +1 -0
  40. package/src/stories/views/components/Teaser/fixtures/teaser_standard_xxl_serif.json +1 -0
  41. package/src/stories/views/components/Teaser/fixtures/teaser_standard_xxl_serif_comments.json +1 -0
  42. package/src/stories/views/components/Teaser/fixtures/teaser_standard_xxl_serif_label.json +1 -0
  43. package/src/stories/views/components/Teaser/fixtures/xxlTeaserStandard--serif.json +1 -0
  44. package/src/stories/views/components/Teaser/fixtures/xxlTeaserStandard--serifLabel.json +1 -0
  45. package/src/stories/views/components/Teaser/teaser-standard.stories.mdx +49 -54
@@ -33,6 +33,7 @@ module.exports = {
33
33
  // Make whatever fine-grained changes you need
34
34
  config.resolve.alias = {
35
35
  ...config.resolve.alias,
36
+ scripts: path.resolve(__dirname, '../scripts'),
36
37
  components: path.resolve(__dirname, '../src/stories/views/components'),
37
38
  tailwind$: path.resolve(__dirname, '../src/assets/tailwind.css'),
38
39
  hrQueryNew$: path.resolve(
@@ -96,6 +96,9 @@ export const parameters = {
96
96
  options: {
97
97
  storySort: {
98
98
  order: [
99
+ 'Einführung',
100
+ 'Grundlegendes',
101
+ ['Konventionen und Datenstrukturen', 'Testdatenbereitstellung', '*'],
99
102
  'Komponenten',
100
103
  [
101
104
  'Page',
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # v0.44.0 (Mon May 02 2022)
2
+
3
+ #### 🚀 Enhancement
4
+
5
+ - Feature/dpe 1550 [#224](https://github.com/mumprod/hr-design-system-handlebars/pull/224) ([@szuelch](https://github.com/szuelch))
6
+
7
+ #### Authors: 1
8
+
9
+ - [@szuelch](https://github.com/szuelch)
10
+
11
+ ---
12
+
1
13
  # v0.43.1 (Thu Apr 28 2022)
2
14
 
3
15
  #### 🐛 Bug Fix
@@ -1,7 +1,7 @@
1
1
  const { execSync } = require('child_process')
2
- const { resolve, join } = require('path')
2
+ const { resolve } = require('path')
3
3
 
4
- const root = resolve(__dirname, '..')
4
+ const root = resolve(__dirname, '../..')
5
5
  const run = (cmd) => execSync(cmd, { stdio: 'inherit', cwd: root })
6
6
 
7
7
  // Copy hbs files into the dist folder
@@ -0,0 +1,140 @@
1
+ /**
2
+ * jsoninclude - JSON Parser that includes JSON from other files.
3
+ */
4
+ ;(function () {
5
+ 'use strict'
6
+
7
+ const _ = require('underscore'),
8
+ fs = require('fs'),
9
+ options = require('../../config.js')
10
+
11
+ JSON.minify = JSON.minify || require('node-json-minify')
12
+
13
+ /**
14
+ * Set value for a object property path given as String.
15
+ */
16
+ var setObjectValue = function (obj, value, path) {
17
+ var aPath = path.split('.'),
18
+ parent = obj
19
+
20
+ for (var i = 0; i < aPath.length - 1; i++) {
21
+ if (!parent.hasOwnProperty(aPath[i])) {
22
+ console.warn("Can't set object value. Wrong path: " + path)
23
+ return
24
+ }
25
+
26
+ parent = parent[aPath[i]]
27
+ }
28
+
29
+ parent[aPath[aPath.length - 1]] = value
30
+ }
31
+
32
+ /**
33
+ * Get value for a object property path given as String.
34
+ */
35
+ var getObjectValue = function (obj, path) {
36
+ var aPath = path.split('.'),
37
+ parent = obj
38
+
39
+ for (var i = 0; i < aPath.length; i++) {
40
+ if (!parent.hasOwnProperty(aPath[i])) {
41
+ console.warn("Can't get object value. Wrong path: " + path)
42
+ return {}
43
+ }
44
+
45
+ parent = parent[aPath[i]]
46
+ }
47
+
48
+ return parent
49
+ }
50
+
51
+ const loadInclude = function (includePath) {
52
+ try {
53
+ return fs.readFileSync(`${options.paths.assets.fixtures}/${includePath}`, 'UTF-8')
54
+ } catch (error) {
55
+ console.error(`Can\'t read file: ${options.paths.assets.fixtures}/${includePath}`)
56
+ return JSON.stringify({})
57
+ }
58
+ }
59
+
60
+ /**
61
+ * JSON.parse reviver function to execute jsoninclude features.
62
+ */
63
+ var executeJSONInclude = function (k, v) {
64
+ if (v['@->jsoninclude'] !== undefined && v['@->jsoninclude'] !== '') {
65
+ try {
66
+ //read include
67
+
68
+ let includedStringifiedJson = loadInclude(v['@->jsoninclude'])
69
+ //parse as JSON
70
+ let includeJSON = parse(includedStringifiedJson)
71
+ //get specified content
72
+ if (v['@->contentpath'] !== undefined) {
73
+ includeJSON = getObjectValue(includeJSON, v['@->contentpath'])
74
+ }
75
+ if (v['@->extends'] !== undefined) {
76
+ includeJSON = _.extend(includeJSON, v['@->extends'])
77
+ }
78
+
79
+ //override values
80
+ if (v['@->overrides'] !== undefined) {
81
+ for (var i = 0; i < v['@->overrides'].length; i++) {
82
+ if (
83
+ v['@->overrides'][i]['@->contentpath'] !== undefined &&
84
+ v['@->overrides'][i]['@->value'] !== undefined
85
+ ) {
86
+ setObjectValue(
87
+ includeJSON,
88
+ v['@->overrides'][i]['@->value'],
89
+ v['@->overrides'][i]['@->contentpath']
90
+ )
91
+ }
92
+ }
93
+ }
94
+ return includeJSON
95
+ } catch (e) {
96
+ console.error(
97
+ "Can't parse JSONInclude! " + type(e) === '[object Object]'
98
+ ? JSON.stringify(e, null, 4)
99
+ : e
100
+ )
101
+ throw {
102
+ orig: e,
103
+ message: e.message,
104
+ json: v,
105
+ via: k,
106
+ }
107
+ }
108
+ }
109
+
110
+ //nothing to do
111
+ return v
112
+ }
113
+
114
+ /**
115
+ * Parse a string as JSON and transforming the value produced by parsing.
116
+ */
117
+ var parse = function (text) {
118
+ try {
119
+ return JSON.parse(JSON.minify(text), executeJSONInclude)
120
+ } catch (e) {
121
+ console.error(`Can't parse json! ${e}`)
122
+ throw {
123
+ orig: e,
124
+ message: e.message,
125
+ json: text,
126
+ via: 'Bla',
127
+ }
128
+ }
129
+ }
130
+
131
+ module.exports = {
132
+ /**
133
+ * Create jsoninclude Object to parse JSON.
134
+ *
135
+ * @param reader Callback to read include file.
136
+ * @returns jsoninclude Object.
137
+ */
138
+ parse: parse,
139
+ }
140
+ })()
package/config.js ADDED
@@ -0,0 +1,11 @@
1
+ module.exports = {
2
+ paths: {
3
+ root: './',
4
+ assets: {
5
+ fixtures: 'src/assets/fixtures',
6
+ },
7
+ dist: {
8
+ components: 'src/stories/views/components',
9
+ },
10
+ },
11
+ }
@@ -1554,6 +1554,9 @@ Ensure the default browser behavior of the `hidden` attribute.
1554
1554
  .mt-6 {
1555
1555
  margin-top: 1.5rem;
1556
1556
  }
1557
+ .\!mt-4 {
1558
+ margin-top: 1rem !important;
1559
+ }
1557
1560
  .ml-2 {
1558
1561
  margin-left: 0.5rem;
1559
1562
  }
@@ -1993,6 +1996,18 @@ Ensure the default browser behavior of the `hidden` attribute.
1993
1996
  --tw-border-opacity: 1;
1994
1997
  border-color: rgba(255, 255, 255, var(--tw-border-opacity));
1995
1998
  }
1999
+ .bg-red-200 {
2000
+ --tw-bg-opacity: 1;
2001
+ background-color: rgba(254, 202, 202, var(--tw-bg-opacity));
2002
+ }
2003
+ .\!bg-white {
2004
+ --tw-bg-opacity: 1 !important;
2005
+ background-color: rgba(255, 255, 255, var(--tw-bg-opacity)) !important;
2006
+ }
2007
+ .bg-green-200 {
2008
+ --tw-bg-opacity: 1;
2009
+ background-color: rgba(187, 247, 208, var(--tw-bg-opacity));
2010
+ }
1996
2011
  .bg-labelMedia {
1997
2012
  background-color: #006dc1;
1998
2013
  background-color: var(--color-label-media);
@@ -2088,6 +2103,12 @@ Ensure the default browser behavior of the `hidden` attribute.
2088
2103
  .p-10 {
2089
2104
  padding: 2.5rem;
2090
2105
  }
2106
+ .p-4 {
2107
+ padding: 1rem;
2108
+ }
2109
+ .\!p-4 {
2110
+ padding: 1rem !important;
2111
+ }
2091
2112
  .p-2 {
2092
2113
  padding: 0.5rem;
2093
2114
  }
@@ -2269,6 +2290,12 @@ Ensure the default browser behavior of the `hidden` attribute.
2269
2290
  .leading-6 {
2270
2291
  line-height: 1.5rem;
2271
2292
  }
2293
+ .\!leading-6 {
2294
+ line-height: 1.5rem !important;
2295
+ }
2296
+ .\!leading-8 {
2297
+ line-height: 2rem !important;
2298
+ }
2272
2299
  .leading-5\.5 {
2273
2300
  line-height: 1.375rem;
2274
2301
  }
@@ -2282,6 +2309,14 @@ Ensure the default browser behavior of the `hidden` attribute.
2282
2309
  --tw-text-opacity: 1;
2283
2310
  color: rgba(124, 58, 237, var(--tw-text-opacity));
2284
2311
  }
2312
+ .\!text-red-900 {
2313
+ --tw-text-opacity: 1 !important;
2314
+ color: rgba(127, 29, 29, var(--tw-text-opacity)) !important;
2315
+ }
2316
+ .\!text-green-900 {
2317
+ --tw-text-opacity: 1 !important;
2318
+ color: rgba(20, 83, 45, var(--tw-text-opacity)) !important;
2319
+ }
2285
2320
  .text-white {
2286
2321
  --tw-text-opacity: 1;
2287
2322
  color: rgba(255, 255, 255, var(--tw-text-opacity));
package/gulpfile.js CHANGED
@@ -1,4 +1,4 @@
1
- const { src, dest, series } = require('gulp')
1
+ const { src, dest, series, watch } = require('gulp')
2
2
  const mergeStream = require('merge-stream')
3
3
  const glob = require('glob')
4
4
  const svgStore = require('gulp-svgstore')
@@ -6,6 +6,11 @@ const svgMin = require('gulp-svgmin')
6
6
  const path = require('path')
7
7
  const cheerio = require('gulp-cheerio')
8
8
  const rename = require('gulp-rename')
9
+ const jsonTransform = require('gulp-json-transform')
10
+ const JSONIncluder = require('./build/scripts/jsoninclude.js')
11
+ const log = require('fancy-log')
12
+
13
+ const options = require('./config.js')
9
14
 
10
15
  // css file paths
11
16
  const iconsDirRoot = 'src/assets/icons'
@@ -148,7 +153,7 @@ function minimizeSvgSrcFiles() {
148
153
  .pipe(
149
154
  cheerio({
150
155
  run: function ($, file) {
151
- console.log(file.basename)
156
+ log(file.basename)
152
157
  if (
153
158
  file.dirname.includes('unweather') &&
154
159
  file.basename === 'regiomap.src.svg'
@@ -199,4 +204,33 @@ function minimizeSvgSrcFiles() {
199
204
  )
200
205
  }
201
206
 
207
+ function parseJson() {
208
+ return src([
209
+ `${options.paths.assets.fixtures}/**/*.json`,
210
+ `!${options.paths.assets.fixtures}/**/*.inc.json`,
211
+ ])
212
+ .pipe(
213
+ jsonTransform(function (data, file) {
214
+ const jsonWithIncludes = JSONIncluder.parse(JSON.stringify(data))
215
+ return jsonWithIncludes
216
+ })
217
+ )
218
+ .pipe(
219
+ rename(function (path) {
220
+ return {
221
+ dirname: `${path.dirname}/fixtures`,
222
+ basename: path.basename,
223
+ extname: path.extname,
224
+ }
225
+ })
226
+ )
227
+ .pipe(dest(options.paths.dist.components))
228
+ }
229
+
230
+ function watchForChanges() {
231
+ watch(`${options.paths.assets.fixtures}/**/*.json`, series(parseJson))
232
+ log('Watching for Changes..\n')
233
+ }
234
+
202
235
  exports.default = series(createSvgMaps, createSvgMapsForBrands, minimizeSvgSrcFiles)
236
+ exports.parseJson = series(parseJson, watchForChanges)
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "license": "MIT",
7
7
  "main": "dist/index.js",
8
8
  "repository": "https://github.com/szuelch/hr-design-system-handlebars",
9
- "version": "0.43.1",
9
+ "version": "0.44.0",
10
10
  "scripts": {
11
11
  "test": "echo \"Error: no test specified\" && exit 1",
12
12
  "storybook": "start-storybook -p 6006 public",
@@ -15,11 +15,12 @@
15
15
  "build-storybook-docs": "build-storybook --docs",
16
16
  "build-storybook-docs-with-tailwind": "npm run build:tailwind && npm run build-storybook-docs",
17
17
  "build:tailwind": "postcss src/assets/tailwind.css -o dist/assets/index.css",
18
- "build": "npm run clean && npm run build:tailwind && node ./scripts/build.js",
18
+ "build": "npm run clean && npm run build:tailwind && node ./build/scripts/build.js",
19
19
  "chromatic": "npx chromatic --project-token 84f1628f224a",
20
20
  "clean": "rimraf dist",
21
21
  "release": "npx auto shipit --base-branch=main",
22
- "optimize-svgs": "gulp"
22
+ "optimize-svgs": "gulp",
23
+ "parseJson": "gulp parseJson"
23
24
  },
24
25
  "browserslist": [
25
26
  "last 2 versions",
@@ -48,17 +49,20 @@
48
49
  "chromatic": "^5.6.2",
49
50
  "copyfiles": "^2.4.1",
50
51
  "cross-env": "^7.0.3",
52
+ "fancy-log": "^2.0.0",
51
53
  "file-loader": "^6.2.0",
52
54
  "glob": "^7.1.7",
53
55
  "gulp": "^4.0.2",
54
56
  "gulp-cheerio": "^1.0.0",
55
57
  "gulp-cli": "^2.3.0",
58
+ "gulp-json-transform": "^0.4.8",
56
59
  "gulp-rename": "^2.0.0",
57
60
  "gulp-svgmin": "^4.0.1",
58
61
  "gulp-svgstore": "^8.0.0",
59
62
  "handlebars": "^4.7.6",
60
63
  "handlebars-loader": "^1.7.1",
61
64
  "merge-stream": "^2.0.0",
65
+ "node-json-minify": "^3.0.0",
62
66
  "path": "^0.12.7",
63
67
  "postcss": "^8.4.5",
64
68
  "postcss-cli": "^8.3.1",
@@ -67,7 +71,8 @@
67
71
  "rimraf": "^3.0.2",
68
72
  "storybook-conditional-toolbar-selector": "^1.0.3",
69
73
  "tailwindcss": "^3.0.23",
70
- "tailwindcss-important": "^1.0.0"
74
+ "tailwindcss-important": "^1.0.0",
75
+ "underscore": "^1.13.2"
71
76
  },
72
77
  "dependencies": {
73
78
  "@alpine-collective/toolkit": "^1.0.0",
@@ -0,0 +1,16 @@
1
+ {
2
+ "commentLink": {
3
+ "link": {
4
+ "url": "/teaser1-comments",
5
+ "webviewUrl": "/teaser1-comments#webview",
6
+ "isTargetBlank": false,
7
+ "readMoreText": {
8
+ "readMoreScreenreader": "Zu den Kommentaren des Artikels"
9
+ },
10
+ "content": {
11
+ "commentNumber": "666",
12
+ "hasOneComment": false
13
+ }
14
+ }
15
+ }
16
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "ticker": {
3
+ "type": "Ticker",
4
+ "loca": "ticker",
5
+ "byline": {
6
+ "bylineSsi": "BylineText aus ssi",
7
+ "bylineText": "BylineText"
8
+ }
9
+ },
10
+ "media": {
11
+ "type": "Media",
12
+ "loca": "media",
13
+ "byline": {
14
+ "bylineSsi": "BylineText aus ssi",
15
+ "bylineText": "BylineText"
16
+ }
17
+ }
18
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "@->jsoninclude": "teaser/teasers.inc.json",
3
+ "@->contentpath": "teaser",
4
+ "@->overrides": [
5
+ {
6
+ "@->contentpath": "teasersize",
7
+ "@->value": "lg"
8
+ }
9
+ ]
10
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "@->jsoninclude": "teaser/teasers.inc.json",
3
+ "@->contentpath": "teaser",
4
+ "@->overrides": [
5
+ {
6
+ "@->contentpath": "teasersize",
7
+ "@->value": "md"
8
+ }
9
+ ]
10
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "@->jsoninclude": "teaser/teasers.inc.json",
3
+ "@->contentpath": "teaser",
4
+ "@->overrides": [
5
+ {
6
+ "@->contentpath": "teasersize",
7
+ "@->value": "sm"
8
+ }
9
+ ]
10
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "@->jsoninclude": "teaser/teasers.inc.json",
3
+ "@->contentpath": "teaser",
4
+ "@->overrides": [
5
+ {
6
+ "@->contentpath": "teasersize",
7
+ "@->value": "xl"
8
+ }
9
+ ]
10
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "@->jsoninclude": "teaser/teasers.inc.json",
3
+ "@->contentpath": "teaser"
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "@->jsoninclude": "teaser/teasers.inc.json",
3
+ "@->contentpath": "teaserWithComments"
4
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "@->jsoninclude": "teaser/teasers.inc.json",
3
+ "@->contentpath": "teaser",
4
+ "@->overrides": [
5
+ {
6
+ "@->contentpath": "topline",
7
+ "@->value": ""
8
+ },
9
+ {
10
+ "@->contentpath": "link.content.topline",
11
+ "@->value": ""
12
+ },
13
+ {
14
+ "@->contentpath": "label",
15
+ "@->value": {
16
+ "@->jsoninclude": "teaser/teaser_labels.inc.json",
17
+ "@->contentpath": "ticker"
18
+ }
19
+ },
20
+ {
21
+ "@->contentpath": "link.content.label",
22
+ "@->value": {
23
+ "@->jsoninclude": "teaser/teaser_labels.inc.json",
24
+ "@->contentpath": "ticker"
25
+ }
26
+ }
27
+ ]
28
+ }