@sitecore/sc-contenthub-blok 0.0.21 → 0.0.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 (124) hide show
  1. package/dist/BlokTheme.js +2 -2
  2. package/dist/BlokTheme.js.map +1 -1
  3. package/dist/Components/BlokBadge/BlokBadge.js +4 -1
  4. package/dist/Components/BlokBadge/BlokBadge.js.map +1 -1
  5. package/dist/Components/BlokButton/BlokButton.js +1 -1
  6. package/dist/Components/BlokButton/BlokButton.js.map +1 -1
  7. package/dist/Components/BlokButtonSelect/BlokButtonSelect.d.ts +7 -0
  8. package/dist/Components/BlokButtonSelect/BlokButtonSelect.js +184 -0
  9. package/dist/Components/BlokButtonSelect/BlokButtonSelect.js.map +1 -0
  10. package/dist/Components/BlokButtonSelect/BlokButtonSelect.spec.d.ts +1 -0
  11. package/dist/Components/BlokButtonSelect/BlokButtonSelect.spec.js +58 -0
  12. package/dist/Components/BlokButtonSelect/BlokButtonSelect.spec.js.map +1 -0
  13. package/dist/Components/BlokButtonSelect/BlokButtonSelect.stories.d.ts +8 -0
  14. package/dist/Components/BlokButtonSelect/BlokButtonSelect.stories.js +59 -0
  15. package/dist/Components/BlokButtonSelect/BlokButtonSelect.stories.js.map +1 -0
  16. package/dist/Components/BlokSearchBox/BlokSearchBox.d.ts +106 -0
  17. package/dist/Components/BlokSearchBox/BlokSearchBox.js +316 -0
  18. package/dist/Components/BlokSearchBox/BlokSearchBox.js.map +1 -0
  19. package/dist/Components/BlokSearchBox/BlokSearchBox.spec.d.ts +1 -0
  20. package/dist/Components/BlokSearchBox/BlokSearchBox.spec.js +88 -0
  21. package/dist/Components/BlokSearchBox/BlokSearchBox.spec.js.map +1 -0
  22. package/dist/Components/BlokSearchBox/BlokSearchBox.stories.d.ts +9 -0
  23. package/dist/Components/BlokSearchBox/BlokSearchBox.stories.js +38 -0
  24. package/dist/Components/BlokSearchBox/BlokSearchBox.stories.js.map +1 -0
  25. package/dist/Components/BlokSelect/BlokSelect.d.ts +99 -0
  26. package/dist/Components/BlokSelect/BlokSelect.js +247 -0
  27. package/dist/Components/BlokSelect/BlokSelect.js.map +1 -0
  28. package/dist/Components/BlokSelect/BlokSelect.spec.d.ts +1 -0
  29. package/dist/Components/BlokSelect/BlokSelect.spec.js +54 -0
  30. package/dist/Components/BlokSelect/BlokSelect.spec.js.map +1 -0
  31. package/dist/Components/BlokSelect/BlokSelect.stories.d.ts +8 -0
  32. package/dist/Components/BlokSelect/BlokSelect.stories.js +59 -0
  33. package/dist/Components/BlokSelect/BlokSelect.stories.js.map +1 -0
  34. package/dist/Components/BlokTag/BlokTag.js +9 -1
  35. package/dist/Components/BlokTag/BlokTag.js.map +1 -1
  36. package/dist/Foundations/utils.d.ts +28 -0
  37. package/dist/Foundations/utils.js +21 -1
  38. package/dist/Foundations/utils.js.map +1 -1
  39. package/dist/customHooks/useIsMounted.d.ts +7 -0
  40. package/dist/customHooks/useIsMounted.js +19 -0
  41. package/dist/customHooks/useIsMounted.js.map +1 -0
  42. package/esm/BlokTheme.js +2 -2
  43. package/esm/BlokTheme.js.map +1 -1
  44. package/esm/Components/BlokBadge/BlokBadge.js +4 -1
  45. package/esm/Components/BlokBadge/BlokBadge.js.map +1 -1
  46. package/esm/Components/BlokButton/BlokButton.js +1 -1
  47. package/esm/Components/BlokButton/BlokButton.js.map +1 -1
  48. package/esm/Components/BlokButtonSelect/BlokButtonSelect.js +179 -0
  49. package/esm/Components/BlokButtonSelect/BlokButtonSelect.js.map +1 -0
  50. package/esm/Components/BlokSearchBox/BlokSearchBox.js +312 -0
  51. package/esm/Components/BlokSearchBox/BlokSearchBox.js.map +1 -0
  52. package/esm/Components/BlokSelect/BlokSelect.js +242 -0
  53. package/esm/Components/BlokSelect/BlokSelect.js.map +1 -0
  54. package/esm/Components/BlokTag/BlokTag.js +9 -1
  55. package/esm/Components/BlokTag/BlokTag.js.map +1 -1
  56. package/esm/Foundations/utils.js +18 -0
  57. package/esm/Foundations/utils.js.map +1 -1
  58. package/esm/customHooks/useIsMounted.js +17 -0
  59. package/esm/customHooks/useIsMounted.js.map +1 -0
  60. package/node_modules/@emotion/cache/node_modules/stylis/LICENSE +21 -0
  61. package/node_modules/@emotion/cache/node_modules/stylis/README.md +161 -0
  62. package/node_modules/@emotion/cache/node_modules/stylis/dist/stylis.mjs +2 -0
  63. package/node_modules/@emotion/cache/node_modules/stylis/dist/stylis.mjs.map +1 -0
  64. package/node_modules/@emotion/cache/node_modules/stylis/dist/umd/package.json +1 -0
  65. package/node_modules/@emotion/cache/node_modules/stylis/dist/umd/stylis.js +2 -0
  66. package/node_modules/@emotion/cache/node_modules/stylis/dist/umd/stylis.js.map +1 -0
  67. package/node_modules/@emotion/cache/node_modules/stylis/index.js +7 -0
  68. package/node_modules/@emotion/cache/node_modules/stylis/package.json +167 -0
  69. package/node_modules/@emotion/cache/node_modules/stylis/src/Enum.js +21 -0
  70. package/node_modules/@emotion/cache/node_modules/stylis/src/Middleware.js +108 -0
  71. package/node_modules/@emotion/cache/node_modules/stylis/src/Parser.js +191 -0
  72. package/node_modules/@emotion/cache/node_modules/stylis/src/Prefixer.js +145 -0
  73. package/node_modules/@emotion/cache/node_modules/stylis/src/Serializer.js +36 -0
  74. package/node_modules/@emotion/cache/node_modules/stylis/src/Tokenizer.js +246 -0
  75. package/node_modules/@emotion/cache/node_modules/stylis/src/Utility.js +115 -0
  76. package/node_modules/@emotion/css-prettifier/node_modules/stylis/LICENSE +21 -0
  77. package/node_modules/@emotion/css-prettifier/node_modules/stylis/README.md +161 -0
  78. package/node_modules/@emotion/css-prettifier/node_modules/stylis/dist/stylis.mjs +2 -0
  79. package/node_modules/@emotion/css-prettifier/node_modules/stylis/dist/stylis.mjs.map +1 -0
  80. package/node_modules/@emotion/css-prettifier/node_modules/stylis/dist/umd/package.json +1 -0
  81. package/node_modules/@emotion/css-prettifier/node_modules/stylis/dist/umd/stylis.js +2 -0
  82. package/node_modules/@emotion/css-prettifier/node_modules/stylis/dist/umd/stylis.js.map +1 -0
  83. package/node_modules/@emotion/css-prettifier/node_modules/stylis/index.js +7 -0
  84. package/node_modules/@emotion/css-prettifier/node_modules/stylis/package.json +167 -0
  85. package/node_modules/@emotion/css-prettifier/node_modules/stylis/src/Enum.js +21 -0
  86. package/node_modules/@emotion/css-prettifier/node_modules/stylis/src/Middleware.js +108 -0
  87. package/node_modules/@emotion/css-prettifier/node_modules/stylis/src/Parser.js +191 -0
  88. package/node_modules/@emotion/css-prettifier/node_modules/stylis/src/Prefixer.js +145 -0
  89. package/node_modules/@emotion/css-prettifier/node_modules/stylis/src/Serializer.js +36 -0
  90. package/node_modules/@emotion/css-prettifier/node_modules/stylis/src/Tokenizer.js +246 -0
  91. package/node_modules/@emotion/css-prettifier/node_modules/stylis/src/Utility.js +115 -0
  92. package/node_modules/@emotion/jest/node_modules/stylis/LICENSE +21 -0
  93. package/node_modules/@emotion/jest/node_modules/stylis/README.md +161 -0
  94. package/node_modules/@emotion/jest/node_modules/stylis/dist/stylis.mjs +2 -0
  95. package/node_modules/@emotion/jest/node_modules/stylis/dist/stylis.mjs.map +1 -0
  96. package/node_modules/@emotion/jest/node_modules/stylis/dist/umd/package.json +1 -0
  97. package/node_modules/@emotion/jest/node_modules/stylis/dist/umd/stylis.js +2 -0
  98. package/node_modules/@emotion/jest/node_modules/stylis/dist/umd/stylis.js.map +1 -0
  99. package/node_modules/@emotion/jest/node_modules/stylis/index.js +7 -0
  100. package/node_modules/@emotion/jest/node_modules/stylis/package.json +167 -0
  101. package/node_modules/@emotion/jest/node_modules/stylis/src/Enum.js +21 -0
  102. package/node_modules/@emotion/jest/node_modules/stylis/src/Middleware.js +108 -0
  103. package/node_modules/@emotion/jest/node_modules/stylis/src/Parser.js +191 -0
  104. package/node_modules/@emotion/jest/node_modules/stylis/src/Prefixer.js +145 -0
  105. package/node_modules/@emotion/jest/node_modules/stylis/src/Serializer.js +36 -0
  106. package/node_modules/@emotion/jest/node_modules/stylis/src/Tokenizer.js +246 -0
  107. package/node_modules/@emotion/jest/node_modules/stylis/src/Utility.js +115 -0
  108. package/package.json +6 -2
  109. /package/node_modules/{stylis → @emotion/babel-plugin/node_modules/stylis}/LICENSE +0 -0
  110. /package/node_modules/{stylis → @emotion/babel-plugin/node_modules/stylis}/README.md +0 -0
  111. /package/node_modules/{stylis → @emotion/babel-plugin/node_modules/stylis}/dist/stylis.mjs +0 -0
  112. /package/node_modules/{stylis → @emotion/babel-plugin/node_modules/stylis}/dist/stylis.mjs.map +0 -0
  113. /package/node_modules/{stylis → @emotion/babel-plugin/node_modules/stylis}/dist/umd/package.json +0 -0
  114. /package/node_modules/{stylis → @emotion/babel-plugin/node_modules/stylis}/dist/umd/stylis.js +0 -0
  115. /package/node_modules/{stylis → @emotion/babel-plugin/node_modules/stylis}/dist/umd/stylis.js.map +0 -0
  116. /package/node_modules/{stylis → @emotion/babel-plugin/node_modules/stylis}/index.js +0 -0
  117. /package/node_modules/{stylis → @emotion/babel-plugin/node_modules/stylis}/package.json +0 -0
  118. /package/node_modules/{stylis → @emotion/babel-plugin/node_modules/stylis}/src/Enum.js +0 -0
  119. /package/node_modules/{stylis → @emotion/babel-plugin/node_modules/stylis}/src/Middleware.js +0 -0
  120. /package/node_modules/{stylis → @emotion/babel-plugin/node_modules/stylis}/src/Parser.js +0 -0
  121. /package/node_modules/{stylis → @emotion/babel-plugin/node_modules/stylis}/src/Prefixer.js +0 -0
  122. /package/node_modules/{stylis → @emotion/babel-plugin/node_modules/stylis}/src/Serializer.js +0 -0
  123. /package/node_modules/{stylis → @emotion/babel-plugin/node_modules/stylis}/src/Tokenizer.js +0 -0
  124. /package/node_modules/{stylis → @emotion/babel-plugin/node_modules/stylis}/src/Utility.js +0 -0
@@ -0,0 +1,108 @@
1
+ import {MS, MOZ, WEBKIT, RULESET, KEYFRAMES, DECLARATION} from './Enum.js'
2
+ import {match, charat, substr, strlen, sizeof, replace, combine} from './Utility.js'
3
+ import {copy, tokenize} from './Tokenizer.js'
4
+ import {serialize} from './Serializer.js'
5
+ import {prefix} from './Prefixer.js'
6
+
7
+ /**
8
+ * @param {function[]} collection
9
+ * @return {function}
10
+ */
11
+ export function middleware (collection) {
12
+ var length = sizeof(collection)
13
+
14
+ return function (element, index, children, callback) {
15
+ var output = ''
16
+
17
+ for (var i = 0; i < length; i++)
18
+ output += collection[i](element, index, children, callback) || ''
19
+
20
+ return output
21
+ }
22
+ }
23
+
24
+ /**
25
+ * @param {function} callback
26
+ * @return {function}
27
+ */
28
+ export function rulesheet (callback) {
29
+ return function (element) {
30
+ if (!element.root)
31
+ if (element = element.return)
32
+ callback(element)
33
+ }
34
+ }
35
+
36
+ /**
37
+ * @param {object} element
38
+ * @param {number} index
39
+ * @param {object[]} children
40
+ * @param {function} callback
41
+ */
42
+ export function prefixer (element, index, children, callback) {
43
+ if (element.length > -1)
44
+ if (!element.return)
45
+ switch (element.type) {
46
+ case DECLARATION: element.return = prefix(element.value, element.length, children)
47
+ return
48
+ case KEYFRAMES:
49
+ return serialize([copy(element, {value: replace(element.value, '@', '@' + WEBKIT)})], callback)
50
+ case RULESET:
51
+ if (element.length)
52
+ return combine(element.props, function (value) {
53
+ switch (match(value, /(::plac\w+|:read-\w+)/)) {
54
+ // :read-(only|write)
55
+ case ':read-only': case ':read-write':
56
+ return serialize([copy(element, {props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')]})], callback)
57
+ // :placeholder
58
+ case '::placeholder':
59
+ return serialize([
60
+ copy(element, {props: [replace(value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1')]}),
61
+ copy(element, {props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')]}),
62
+ copy(element, {props: [replace(value, /:(plac\w+)/, MS + 'input-$1')]})
63
+ ], callback)
64
+ }
65
+
66
+ return ''
67
+ })
68
+ }
69
+ }
70
+
71
+ /**
72
+ * @param {object} element
73
+ * @param {number} index
74
+ * @param {object[]} children
75
+ */
76
+ export function namespace (element) {
77
+ switch (element.type) {
78
+ case RULESET:
79
+ element.props = element.props.map(function (value) {
80
+ return combine(tokenize(value), function (value, index, children) {
81
+ switch (charat(value, 0)) {
82
+ // \f
83
+ case 12:
84
+ return substr(value, 1, strlen(value))
85
+ // \0 ( + > ~
86
+ case 0: case 40: case 43: case 62: case 126:
87
+ return value
88
+ // :
89
+ case 58:
90
+ if (children[++index] === 'global')
91
+ children[index] = '', children[++index] = '\f' + substr(children[index], index = 1, -1)
92
+ // \s
93
+ case 32:
94
+ return index === 1 ? '' : value
95
+ default:
96
+ switch (index) {
97
+ case 0: element = value
98
+ return sizeof(children) > 1 ? '' : value
99
+ case index = sizeof(children) - 1: case 2:
100
+ return index === 2 ? value + element + element : value + element
101
+ default:
102
+ return value
103
+ }
104
+ }
105
+ })
106
+ })
107
+ }
108
+ }
@@ -0,0 +1,191 @@
1
+ import {COMMENT, RULESET, DECLARATION} from './Enum.js'
2
+ import {abs, charat, trim, from, sizeof, strlen, substr, append, replace, indexof} from './Utility.js'
3
+ import {node, char, prev, next, peek, caret, alloc, dealloc, delimit, whitespace, escaping, identifier, commenter} from './Tokenizer.js'
4
+
5
+ /**
6
+ * @param {string} value
7
+ * @return {object[]}
8
+ */
9
+ export function compile (value) {
10
+ return dealloc(parse('', null, null, null, [''], value = alloc(value), 0, [0], value))
11
+ }
12
+
13
+ /**
14
+ * @param {string} value
15
+ * @param {object} root
16
+ * @param {object?} parent
17
+ * @param {string[]} rule
18
+ * @param {string[]} rules
19
+ * @param {string[]} rulesets
20
+ * @param {number[]} pseudo
21
+ * @param {number[]} points
22
+ * @param {string[]} declarations
23
+ * @return {object}
24
+ */
25
+ export function parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {
26
+ var index = 0
27
+ var offset = 0
28
+ var length = pseudo
29
+ var atrule = 0
30
+ var property = 0
31
+ var previous = 0
32
+ var variable = 1
33
+ var scanning = 1
34
+ var ampersand = 1
35
+ var character = 0
36
+ var type = ''
37
+ var props = rules
38
+ var children = rulesets
39
+ var reference = rule
40
+ var characters = type
41
+
42
+ while (scanning)
43
+ switch (previous = character, character = next()) {
44
+ // (
45
+ case 40:
46
+ if (previous != 108 && charat(characters, length - 1) == 58) {
47
+ if (indexof(characters += replace(delimit(character), '&', '&\f'), '&\f') != -1)
48
+ ampersand = -1
49
+ break
50
+ }
51
+ // " ' [
52
+ case 34: case 39: case 91:
53
+ characters += delimit(character)
54
+ break
55
+ // \t \n \r \s
56
+ case 9: case 10: case 13: case 32:
57
+ characters += whitespace(previous)
58
+ break
59
+ // \
60
+ case 92:
61
+ characters += escaping(caret() - 1, 7)
62
+ continue
63
+ // /
64
+ case 47:
65
+ switch (peek()) {
66
+ case 42: case 47:
67
+ append(comment(commenter(next(), caret()), root, parent), declarations)
68
+ break
69
+ default:
70
+ characters += '/'
71
+ }
72
+ break
73
+ // {
74
+ case 123 * variable:
75
+ points[index++] = strlen(characters) * ampersand
76
+ // } ; \0
77
+ case 125 * variable: case 59: case 0:
78
+ switch (character) {
79
+ // \0 }
80
+ case 0: case 125: scanning = 0
81
+ // ;
82
+ case 59 + offset: if (ampersand == -1) characters = replace(characters, /\f/g, '')
83
+ if (property > 0 && (strlen(characters) - length))
84
+ append(property > 32 ? declaration(characters + ';', rule, parent, length - 1) : declaration(replace(characters, ' ', '') + ';', rule, parent, length - 2), declarations)
85
+ break
86
+ // @ ;
87
+ case 59: characters += ';'
88
+ // { rule/at-rule
89
+ default:
90
+ append(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length), rulesets)
91
+
92
+ if (character === 123)
93
+ if (offset === 0)
94
+ parse(characters, root, reference, reference, props, rulesets, length, points, children)
95
+ else
96
+ switch (atrule === 99 && charat(characters, 3) === 110 ? 100 : atrule) {
97
+ // d l m s
98
+ case 100: case 108: case 109: case 115:
99
+ parse(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length), children), rules, children, length, points, rule ? props : children)
100
+ break
101
+ default:
102
+ parse(characters, reference, reference, reference, [''], children, 0, points, children)
103
+ }
104
+ }
105
+
106
+ index = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo
107
+ break
108
+ // :
109
+ case 58:
110
+ length = 1 + strlen(characters), property = previous
111
+ default:
112
+ if (variable < 1)
113
+ if (character == 123)
114
+ --variable
115
+ else if (character == 125 && variable++ == 0 && prev() == 125)
116
+ continue
117
+
118
+ switch (characters += from(character), character * variable) {
119
+ // &
120
+ case 38:
121
+ ampersand = offset > 0 ? 1 : (characters += '\f', -1)
122
+ break
123
+ // ,
124
+ case 44:
125
+ points[index++] = (strlen(characters) - 1) * ampersand, ampersand = 1
126
+ break
127
+ // @
128
+ case 64:
129
+ // -
130
+ if (peek() === 45)
131
+ characters += delimit(next())
132
+
133
+ atrule = peek(), offset = length = strlen(type = characters += identifier(caret())), character++
134
+ break
135
+ // -
136
+ case 45:
137
+ if (previous === 45 && strlen(characters) == 2)
138
+ variable = 0
139
+ }
140
+ }
141
+
142
+ return rulesets
143
+ }
144
+
145
+ /**
146
+ * @param {string} value
147
+ * @param {object} root
148
+ * @param {object?} parent
149
+ * @param {number} index
150
+ * @param {number} offset
151
+ * @param {string[]} rules
152
+ * @param {number[]} points
153
+ * @param {string} type
154
+ * @param {string[]} props
155
+ * @param {string[]} children
156
+ * @param {number} length
157
+ * @return {object}
158
+ */
159
+ export function ruleset (value, root, parent, index, offset, rules, points, type, props, children, length) {
160
+ var post = offset - 1
161
+ var rule = offset === 0 ? rules : ['']
162
+ var size = sizeof(rule)
163
+
164
+ for (var i = 0, j = 0, k = 0; i < index; ++i)
165
+ for (var x = 0, y = substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x)
166
+ if (z = trim(j > 0 ? rule[x] + ' ' + y : replace(y, /&\f/g, rule[x])))
167
+ props[k++] = z
168
+
169
+ return node(value, root, parent, offset === 0 ? RULESET : type, props, children, length)
170
+ }
171
+
172
+ /**
173
+ * @param {number} value
174
+ * @param {object} root
175
+ * @param {object?} parent
176
+ * @return {object}
177
+ */
178
+ export function comment (value, root, parent) {
179
+ return node(value, root, parent, COMMENT, from(char()), substr(value, 2, -2), 0)
180
+ }
181
+
182
+ /**
183
+ * @param {string} value
184
+ * @param {object} root
185
+ * @param {object?} parent
186
+ * @param {number} length
187
+ * @return {object}
188
+ */
189
+ export function declaration (value, root, parent, length) {
190
+ return node(value, root, parent, DECLARATION, substr(value, 0, length), substr(value, length + 1, -1), length)
191
+ }
@@ -0,0 +1,145 @@
1
+ import {MS, MOZ, WEBKIT} from './Enum.js'
2
+ import {hash, charat, strlen, indexof, replace, substr, match} from './Utility.js'
3
+
4
+ /**
5
+ * @param {string} value
6
+ * @param {number} length
7
+ * @param {object[]} children
8
+ * @return {string}
9
+ */
10
+ export function prefix (value, length, children) {
11
+ switch (hash(value, length)) {
12
+ // color-adjust
13
+ case 5103:
14
+ return WEBKIT + 'print-' + value + value
15
+ // animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
16
+ case 5737: case 4201: case 3177: case 3433: case 1641: case 4457: case 2921:
17
+ // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
18
+ case 5572: case 6356: case 5844: case 3191: case 6645: case 3005:
19
+ // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
20
+ case 6391: case 5879: case 5623: case 6135: case 4599: case 4855:
21
+ // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
22
+ case 4215: case 6389: case 5109: case 5365: case 5621: case 3829:
23
+ return WEBKIT + value + value
24
+ // tab-size
25
+ case 4789:
26
+ return MOZ + value + value
27
+ // appearance, user-select, transform, hyphens, text-size-adjust
28
+ case 5349: case 4246: case 4810: case 6968: case 2756:
29
+ return WEBKIT + value + MOZ + value + MS + value + value
30
+ // writing-mode
31
+ case 5936:
32
+ switch (charat(value, length + 11)) {
33
+ // vertical-l(r)
34
+ case 114:
35
+ return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value
36
+ // vertical-r(l)
37
+ case 108:
38
+ return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value
39
+ // horizontal(-)tb
40
+ case 45:
41
+ return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value
42
+ // default: fallthrough to below
43
+ }
44
+ // flex, flex-direction, scroll-snap-type, writing-mode
45
+ case 6828: case 4268: case 2903:
46
+ return WEBKIT + value + MS + value + value
47
+ // order
48
+ case 6165:
49
+ return WEBKIT + value + MS + 'flex-' + value + value
50
+ // align-items
51
+ case 5187:
52
+ return WEBKIT + value + replace(value, /(\w+).+(:[^]+)/, WEBKIT + 'box-$1$2' + MS + 'flex-$1$2') + value
53
+ // align-self
54
+ case 5443:
55
+ return WEBKIT + value + MS + 'flex-item-' + replace(value, /flex-|-self/g, '') + (!match(value, /flex-|baseline/) ? MS + 'grid-row-' + replace(value, /flex-|-self/g, '') : '') + value
56
+ // align-content
57
+ case 4675:
58
+ return WEBKIT + value + MS + 'flex-line-pack' + replace(value, /align-content|flex-|-self/g, '') + value
59
+ // flex-shrink
60
+ case 5548:
61
+ return WEBKIT + value + MS + replace(value, 'shrink', 'negative') + value
62
+ // flex-basis
63
+ case 5292:
64
+ return WEBKIT + value + MS + replace(value, 'basis', 'preferred-size') + value
65
+ // flex-grow
66
+ case 6060:
67
+ return WEBKIT + 'box-' + replace(value, '-grow', '') + WEBKIT + value + MS + replace(value, 'grow', 'positive') + value
68
+ // transition
69
+ case 4554:
70
+ return WEBKIT + replace(value, /([^-])(transform)/g, '$1' + WEBKIT + '$2') + value
71
+ // cursor
72
+ case 6187:
73
+ return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + '$1'), /(image-set)/, WEBKIT + '$1'), value, '') + value
74
+ // background, background-image
75
+ case 5495: case 3959:
76
+ return replace(value, /(image-set\([^]*)/, WEBKIT + '$1' + '$`$1')
77
+ // justify-content
78
+ case 4968:
79
+ return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + 'box-pack:$3' + MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + WEBKIT + value + value
80
+ // justify-self
81
+ case 4200:
82
+ if (!match(value, /flex-|baseline/)) return MS + 'grid-column-align' + substr(value, length) + value
83
+ break
84
+ // grid-template-(columns|rows)
85
+ case 2592: case 3360:
86
+ return MS + replace(value, 'template-', '') + value
87
+ // grid-(row|column)-start
88
+ case 4384: case 3616:
89
+ if (children && children.some(function (element, index) { return length = index, match(element.props, /grid-\w+-end/) })) {
90
+ return ~indexof(value + (children = children[length].value), 'span') ? value : (MS + replace(value, '-start', '') + value + MS + 'grid-row-span:' + (~indexof(children, 'span') ? match(children, /\d+/) : +match(children, /\d+/) - +match(value, /\d+/)) + ';')
91
+ }
92
+ return MS + replace(value, '-start', '') + value
93
+ // grid-(row|column)-end
94
+ case 4896: case 4128:
95
+ return (children && children.some(function (element) { return match(element.props, /grid-\w+-start/) })) ? value : MS + replace(replace(value, '-end', '-span'), 'span ', '') + value
96
+ // (margin|padding)-inline-(start|end)
97
+ case 4095: case 3583: case 4068: case 2532:
98
+ return replace(value, /(.+)-inline(.+)/, WEBKIT + '$1$2') + value
99
+ // (min|max)?(width|height|inline-size|block-size)
100
+ case 8116: case 7059: case 5753: case 5535:
101
+ case 5445: case 5701: case 4933: case 4677:
102
+ case 5533: case 5789: case 5021: case 4765:
103
+ // stretch, max-content, min-content, fill-available
104
+ if (strlen(value) - 1 - length > 6)
105
+ switch (charat(value, length + 1)) {
106
+ // (m)ax-content, (m)in-content
107
+ case 109:
108
+ // -
109
+ if (charat(value, length + 4) !== 45)
110
+ break
111
+ // (f)ill-available, (f)it-content
112
+ case 102:
113
+ return replace(value, /(.+:)(.+)-([^]+)/, '$1' + WEBKIT + '$2-$3' + '$1' + MOZ + (charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value
114
+ // (s)tretch
115
+ case 115:
116
+ return ~indexof(value, 'stretch') ? prefix(replace(value, 'stretch', 'fill-available'), length, children) + value : value
117
+ }
118
+ break
119
+ // grid-(column|row)
120
+ case 5152: case 5920:
121
+ return replace(value, /(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/, function (_, a, b, c, d, e, f) { return (MS + a + ':' + b + f) + (c ? (MS + a + '-span:' + (d ? e : +e - +b)) + f : '') + value })
122
+ // position: sticky
123
+ case 4949:
124
+ // stick(y)?
125
+ if (charat(value, length + 6) === 121)
126
+ return replace(value, ':', ':' + WEBKIT) + value
127
+ break
128
+ // display: (flex|inline-flex|grid|inline-grid)
129
+ case 6444:
130
+ switch (charat(value, charat(value, 14) === 45 ? 18 : 11)) {
131
+ // (inline-)?fle(x)
132
+ case 120:
133
+ return replace(value, /(.+:)([^;\s!]+)(;|(\s+)?!.+)?/, '$1' + WEBKIT + (charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + WEBKIT + '$2$3' + '$1' + MS + '$2box$3') + value
134
+ // (inline-)?gri(d)
135
+ case 100:
136
+ return replace(value, ':', ':' + MS) + value
137
+ }
138
+ break
139
+ // scroll-margin, scroll-margin-(top|right|bottom|left)
140
+ case 5719: case 2647: case 2135: case 3927: case 2391:
141
+ return replace(value, 'scroll-', 'scroll-snap-') + value
142
+ }
143
+
144
+ return value
145
+ }
@@ -0,0 +1,36 @@
1
+ import {IMPORT, LAYER, COMMENT, RULESET, DECLARATION, KEYFRAMES} from './Enum.js'
2
+ import {strlen, sizeof} from './Utility.js'
3
+
4
+ /**
5
+ * @param {object[]} children
6
+ * @param {function} callback
7
+ * @return {string}
8
+ */
9
+ export function serialize (children, callback) {
10
+ var output = ''
11
+ var length = sizeof(children)
12
+
13
+ for (var i = 0; i < length; i++)
14
+ output += callback(children[i], i, children, callback) || ''
15
+
16
+ return output
17
+ }
18
+
19
+ /**
20
+ * @param {object} element
21
+ * @param {number} index
22
+ * @param {object[]} children
23
+ * @param {function} callback
24
+ * @return {string}
25
+ */
26
+ export function stringify (element, index, children, callback) {
27
+ switch (element.type) {
28
+ case LAYER: if (element.children.length) break
29
+ case IMPORT: case DECLARATION: return element.return = element.return || element.value
30
+ case COMMENT: return ''
31
+ case KEYFRAMES: return element.return = element.value + '{' + serialize(element.children, callback) + '}'
32
+ case RULESET: element.value = element.props.join(',')
33
+ }
34
+
35
+ return strlen(children = serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : ''
36
+ }