@tidbcloud/uikit 2.0.0-beta.103 → 2.0.0-beta.104
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/CHANGELOG.md +6 -0
- package/dist/_virtual/BufferList.cjs +4 -0
- package/dist/_virtual/BufferList.js +4 -0
- package/dist/_virtual/___vite-browser-external.cjs +6 -0
- package/dist/_virtual/___vite-browser-external.js +6 -0
- package/dist/_virtual/__vite-browser-external.cjs +4 -0
- package/dist/_virtual/__vite-browser-external.js +4 -0
- package/dist/_virtual/_commonjsHelpers.cjs +25 -0
- package/dist/_virtual/_commonjsHelpers.js +25 -0
- package/dist/_virtual/index.cjs +2 -2
- package/dist/_virtual/index.js +2 -2
- package/dist/_virtual/index2.cjs +2 -2
- package/dist/_virtual/index2.js +2 -2
- package/dist/_virtual/index3.cjs +4 -0
- package/dist/_virtual/index3.js +4 -0
- package/dist/_virtual/index4.cjs +4 -0
- package/dist/_virtual/index4.js +4 -0
- package/dist/_virtual/index5.cjs +4 -0
- package/dist/_virtual/index5.js +4 -0
- package/dist/_virtual/index6.cjs +4 -0
- package/dist/_virtual/index6.js +4 -0
- package/dist/_virtual/index7.cjs +4 -0
- package/dist/_virtual/index7.js +4 -0
- package/dist/_virtual/inherits_browser.cjs +4 -0
- package/dist/_virtual/inherits_browser.js +4 -0
- package/dist/_virtual/readable-browser.cjs +4 -0
- package/dist/_virtual/readable-browser.js +4 -0
- package/dist/_virtual/readable.cjs +4 -0
- package/dist/_virtual/readable.js +4 -0
- package/dist/_virtual/string_decoder.cjs +4 -0
- package/dist/_virtual/string_decoder.js +4 -0
- package/dist/_virtual/util.cjs +4 -0
- package/dist/_virtual/util.js +4 -0
- package/dist/node_modules/.pnpm/@emotion_server@11.11.0/node_modules/@emotion/server/create-instance/dist/emotion-server-create-instance.browser.esm.cjs +176 -0
- package/dist/node_modules/.pnpm/@emotion_server@11.11.0/node_modules/@emotion/server/create-instance/dist/emotion-server-create-instance.browser.esm.js +176 -0
- package/dist/node_modules/.pnpm/buffer-from@0.1.2/node_modules/buffer-from/index.cjs +46 -0
- package/dist/node_modules/.pnpm/buffer-from@0.1.2/node_modules/buffer-from/index.js +46 -0
- package/dist/node_modules/.pnpm/core-util-is@1.0.3/node_modules/core-util-is/lib/util.cjs +69 -0
- package/dist/node_modules/.pnpm/core-util-is@1.0.3/node_modules/core-util-is/lib/util.js +69 -0
- package/dist/node_modules/.pnpm/duplexer2@0.1.4/node_modules/duplexer2/index.cjs +64 -0
- package/dist/node_modules/.pnpm/duplexer2@0.1.4/node_modules/duplexer2/index.js +64 -0
- package/dist/node_modules/.pnpm/html-tokenize@2.0.1/node_modules/html-tokenize/index.cjs +199 -0
- package/dist/node_modules/.pnpm/html-tokenize@2.0.1/node_modules/html-tokenize/index.js +199 -0
- package/dist/node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.cjs +31 -0
- package/dist/node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.js +31 -0
- package/dist/node_modules/.pnpm/isarray@0.0.1/node_modules/isarray/index.cjs +6 -0
- package/dist/node_modules/.pnpm/isarray@0.0.1/node_modules/isarray/index.js +6 -0
- package/dist/node_modules/.pnpm/isarray@1.0.0/node_modules/isarray/index.cjs +7 -0
- package/dist/node_modules/.pnpm/isarray@1.0.0/node_modules/isarray/index.js +7 -0
- package/dist/node_modules/.pnpm/multipipe@1.0.2/node_modules/multipipe/index.cjs +67 -0
- package/dist/node_modules/.pnpm/multipipe@1.0.2/node_modules/multipipe/index.js +67 -0
- package/dist/node_modules/.pnpm/object-assign@4.1.1/node_modules/object-assign/index.cjs +56 -63
- package/dist/node_modules/.pnpm/object-assign@4.1.1/node_modules/object-assign/index.js +56 -63
- package/dist/node_modules/.pnpm/process-nextick-args@2.0.1/node_modules/process-nextick-args/index.cjs +43 -0
- package/dist/node_modules/.pnpm/process-nextick-args@2.0.1/node_modules/process-nextick-args/index.js +43 -0
- package/dist/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/factoryWithTypeCheckers.cjs +1 -1
- package/dist/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/factoryWithTypeCheckers.js +2 -2
- package/dist/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.cjs +1 -1
- package/dist/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.js +1 -1
- package/dist/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.cjs +1 -1
- package/dist/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.js +1 -1
- package/dist/node_modules/.pnpm/readable-stream@1.0.34/node_modules/readable-stream/lib/_stream_duplex.cjs +54 -0
- package/dist/node_modules/.pnpm/readable-stream@1.0.34/node_modules/readable-stream/lib/_stream_duplex.js +54 -0
- package/dist/node_modules/.pnpm/readable-stream@1.0.34/node_modules/readable-stream/lib/_stream_passthrough.cjs +20 -0
- package/dist/node_modules/.pnpm/readable-stream@1.0.34/node_modules/readable-stream/lib/_stream_passthrough.js +20 -0
- package/dist/node_modules/.pnpm/readable-stream@1.0.34/node_modules/readable-stream/lib/_stream_readable.cjs +607 -0
- package/dist/node_modules/.pnpm/readable-stream@1.0.34/node_modules/readable-stream/lib/_stream_readable.js +607 -0
- package/dist/node_modules/.pnpm/readable-stream@1.0.34/node_modules/readable-stream/lib/_stream_transform.cjs +95 -0
- package/dist/node_modules/.pnpm/readable-stream@1.0.34/node_modules/readable-stream/lib/_stream_transform.js +95 -0
- package/dist/node_modules/.pnpm/readable-stream@1.0.34/node_modules/readable-stream/lib/_stream_writable.cjs +240 -0
- package/dist/node_modules/.pnpm/readable-stream@1.0.34/node_modules/readable-stream/lib/_stream_writable.js +240 -0
- package/dist/node_modules/.pnpm/readable-stream@1.0.34/node_modules/readable-stream/readable.cjs +24 -0
- package/dist/node_modules/.pnpm/readable-stream@1.0.34/node_modules/readable-stream/readable.js +24 -0
- package/dist/node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_duplex.cjs +83 -0
- package/dist/node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_duplex.js +83 -0
- package/dist/node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_passthrough.cjs +19 -0
- package/dist/node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_passthrough.js +19 -0
- package/dist/node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_readable.cjs +702 -0
- package/dist/node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_readable.js +702 -0
- package/dist/node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_transform.cjs +100 -0
- package/dist/node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_transform.js +100 -0
- package/dist/node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_writable.cjs +453 -0
- package/dist/node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_writable.js +453 -0
- package/dist/node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/internal/streams/BufferList.cjs +85 -0
- package/dist/node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/internal/streams/BufferList.js +85 -0
- package/dist/node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/internal/streams/destroy.cjs +66 -0
- package/dist/node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/internal/streams/destroy.js +66 -0
- package/dist/node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/internal/streams/stream-browser.cjs +5 -0
- package/dist/node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/internal/streams/stream-browser.js +5 -0
- package/dist/node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/readable-browser.cjs +19 -0
- package/dist/node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/readable-browser.js +19 -0
- package/dist/node_modules/.pnpm/safe-buffer@5.1.2/node_modules/safe-buffer/index.cjs +59 -0
- package/dist/node_modules/.pnpm/safe-buffer@5.1.2/node_modules/safe-buffer/index.js +59 -0
- package/dist/node_modules/.pnpm/string_decoder@0.10.31/node_modules/string_decoder/index.cjs +143 -0
- package/dist/node_modules/.pnpm/string_decoder@0.10.31/node_modules/string_decoder/index.js +143 -0
- package/dist/node_modules/.pnpm/string_decoder@1.1.1/node_modules/string_decoder/lib/string_decoder.cjs +242 -0
- package/dist/node_modules/.pnpm/string_decoder@1.1.1/node_modules/string_decoder/lib/string_decoder.js +242 -0
- package/dist/node_modules/.pnpm/through@2.3.8/node_modules/through/index.cjs +91 -0
- package/dist/node_modules/.pnpm/through@2.3.8/node_modules/through/index.js +91 -0
- package/dist/node_modules/.pnpm/util-deprecate@1.0.2/node_modules/util-deprecate/browser.cjs +35 -0
- package/dist/node_modules/.pnpm/util-deprecate@1.0.2/node_modules/util-deprecate/browser.js +35 -0
- package/dist/utils/emotion.d.cts +1 -0
- package/dist/utils/emotion.d.ts +1 -0
- package/dist/utils/index.cjs +2 -0
- package/dist/utils/index.js +4 -2
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const __viteBrowserExternal = require("./__vite-browser-external.cjs");
|
|
4
|
+
const _commonjsHelpers = require("./_commonjsHelpers.cjs");
|
|
5
|
+
const require$$1 = /* @__PURE__ */ _commonjsHelpers.getAugmentedNamespace(__viteBrowserExternal);
|
|
6
|
+
exports.default = require$$1;
|
|
@@ -4,5 +4,30 @@ var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof win
|
|
|
4
4
|
function getDefaultExportFromCjs(x) {
|
|
5
5
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
6
6
|
}
|
|
7
|
+
function getAugmentedNamespace(n) {
|
|
8
|
+
if (n.__esModule) return n;
|
|
9
|
+
var f = n.default;
|
|
10
|
+
if (typeof f == "function") {
|
|
11
|
+
var a = function a2() {
|
|
12
|
+
if (this instanceof a2) {
|
|
13
|
+
return Reflect.construct(f, arguments, this.constructor);
|
|
14
|
+
}
|
|
15
|
+
return f.apply(this, arguments);
|
|
16
|
+
};
|
|
17
|
+
a.prototype = f.prototype;
|
|
18
|
+
} else a = {};
|
|
19
|
+
Object.defineProperty(a, "__esModule", { value: true });
|
|
20
|
+
Object.keys(n).forEach(function(k) {
|
|
21
|
+
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
22
|
+
Object.defineProperty(a, k, d.get ? d : {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function() {
|
|
25
|
+
return n[k];
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
return a;
|
|
30
|
+
}
|
|
7
31
|
exports.commonjsGlobal = commonjsGlobal;
|
|
32
|
+
exports.getAugmentedNamespace = getAugmentedNamespace;
|
|
8
33
|
exports.getDefaultExportFromCjs = getDefaultExportFromCjs;
|
|
@@ -2,7 +2,32 @@ var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof win
|
|
|
2
2
|
function getDefaultExportFromCjs(x) {
|
|
3
3
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
4
4
|
}
|
|
5
|
+
function getAugmentedNamespace(n) {
|
|
6
|
+
if (n.__esModule) return n;
|
|
7
|
+
var f = n.default;
|
|
8
|
+
if (typeof f == "function") {
|
|
9
|
+
var a = function a2() {
|
|
10
|
+
if (this instanceof a2) {
|
|
11
|
+
return Reflect.construct(f, arguments, this.constructor);
|
|
12
|
+
}
|
|
13
|
+
return f.apply(this, arguments);
|
|
14
|
+
};
|
|
15
|
+
a.prototype = f.prototype;
|
|
16
|
+
} else a = {};
|
|
17
|
+
Object.defineProperty(a, "__esModule", { value: true });
|
|
18
|
+
Object.keys(n).forEach(function(k) {
|
|
19
|
+
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
20
|
+
Object.defineProperty(a, k, d.get ? d : {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function() {
|
|
23
|
+
return n[k];
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
return a;
|
|
28
|
+
}
|
|
5
29
|
export {
|
|
6
30
|
commonjsGlobal,
|
|
31
|
+
getAugmentedNamespace,
|
|
7
32
|
getDefaultExportFromCjs
|
|
8
33
|
};
|
package/dist/_virtual/index.cjs
CHANGED
package/dist/_virtual/index.js
CHANGED
package/dist/_virtual/index2.cjs
CHANGED
package/dist/_virtual/index2.js
CHANGED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const index$1 = require("../../../../../../through@2.3.8/node_modules/through/index.cjs");
|
|
4
|
+
const index = require("../../../../../../html-tokenize@2.0.1/node_modules/html-tokenize/index.cjs");
|
|
5
|
+
const index$2 = require("../../../../../../multipipe@1.0.2/node_modules/multipipe/index.cjs");
|
|
6
|
+
var createExtractCritical = function createExtractCritical2(cache) {
|
|
7
|
+
return function(html) {
|
|
8
|
+
var RGX = new RegExp(cache.key + "-([a-zA-Z0-9-_]+)", "gm");
|
|
9
|
+
var o = {
|
|
10
|
+
html,
|
|
11
|
+
ids: [],
|
|
12
|
+
css: ""
|
|
13
|
+
};
|
|
14
|
+
var match;
|
|
15
|
+
var ids = {};
|
|
16
|
+
while ((match = RGX.exec(html)) !== null) {
|
|
17
|
+
if (ids[match[1]] === void 0) {
|
|
18
|
+
ids[match[1]] = true;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
o.ids = Object.keys(cache.inserted).filter(function(id) {
|
|
22
|
+
if ((ids[id] !== void 0 || cache.registered[cache.key + "-" + id] === void 0) && cache.inserted[id] !== true) {
|
|
23
|
+
o.css += cache.inserted[id];
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
return o;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
var createExtractCriticalToChunks = function createExtractCriticalToChunks2(cache) {
|
|
31
|
+
return function(html) {
|
|
32
|
+
var RGX = new RegExp(cache.key + "-([a-zA-Z0-9-_]+)", "gm");
|
|
33
|
+
var o = {
|
|
34
|
+
html,
|
|
35
|
+
styles: []
|
|
36
|
+
};
|
|
37
|
+
var match;
|
|
38
|
+
var ids = {};
|
|
39
|
+
while ((match = RGX.exec(html)) !== null) {
|
|
40
|
+
if (ids[match[1]] === void 0) {
|
|
41
|
+
ids[match[1]] = true;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
var regularCssIds = [];
|
|
45
|
+
var regularCss = "";
|
|
46
|
+
Object.keys(cache.inserted).forEach(function(id) {
|
|
47
|
+
if ((ids[id] !== void 0 || cache.registered[cache.key + "-" + id] === void 0) && cache.inserted[id] !== true) {
|
|
48
|
+
if (cache.registered[cache.key + "-" + id]) {
|
|
49
|
+
regularCssIds.push(id);
|
|
50
|
+
regularCss += cache.inserted[id];
|
|
51
|
+
} else {
|
|
52
|
+
o.styles.push({
|
|
53
|
+
key: cache.key + "-global",
|
|
54
|
+
ids: [id],
|
|
55
|
+
css: cache.inserted[id]
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
o.styles.push({
|
|
61
|
+
key: cache.key,
|
|
62
|
+
ids: regularCssIds,
|
|
63
|
+
css: regularCss
|
|
64
|
+
});
|
|
65
|
+
return o;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
function generateStyleTag(cssKey, ids, styles, nonceString) {
|
|
69
|
+
return '<style data-emotion="' + cssKey + " " + ids + '"' + nonceString + ">" + styles + "</style>";
|
|
70
|
+
}
|
|
71
|
+
var createRenderStylesToString = function createRenderStylesToString2(cache, nonceString) {
|
|
72
|
+
return function(html) {
|
|
73
|
+
var inserted = cache.inserted, cssKey = cache.key, registered = cache.registered;
|
|
74
|
+
var regex = new RegExp("<|" + cssKey + "-([a-zA-Z0-9-_]+)", "gm");
|
|
75
|
+
var seen = {};
|
|
76
|
+
var result = "";
|
|
77
|
+
var globalIds = "";
|
|
78
|
+
var globalStyles = "";
|
|
79
|
+
for (var id in inserted) {
|
|
80
|
+
if (inserted.hasOwnProperty(id)) {
|
|
81
|
+
var style = inserted[id];
|
|
82
|
+
var key = cssKey + "-" + id;
|
|
83
|
+
if (style !== true && registered[key] === void 0) {
|
|
84
|
+
globalStyles += style;
|
|
85
|
+
globalIds += " " + id;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (globalStyles !== "") {
|
|
90
|
+
result = generateStyleTag(cssKey, globalIds.substring(1), globalStyles, nonceString);
|
|
91
|
+
}
|
|
92
|
+
var ids = "";
|
|
93
|
+
var styles = "";
|
|
94
|
+
var lastInsertionPoint = 0;
|
|
95
|
+
var match;
|
|
96
|
+
while ((match = regex.exec(html)) !== null) {
|
|
97
|
+
if (match[0] === "<") {
|
|
98
|
+
if (ids !== "") {
|
|
99
|
+
result += generateStyleTag(cssKey, ids.substring(1), styles, nonceString);
|
|
100
|
+
ids = "";
|
|
101
|
+
styles = "";
|
|
102
|
+
}
|
|
103
|
+
result += html.substring(lastInsertionPoint, match.index);
|
|
104
|
+
lastInsertionPoint = match.index;
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
var _id = match[1];
|
|
108
|
+
var _style = inserted[_id];
|
|
109
|
+
if (_style === true || _style === void 0 || seen[_id]) {
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
seen[_id] = true;
|
|
113
|
+
styles += _style;
|
|
114
|
+
ids += " " + _id;
|
|
115
|
+
}
|
|
116
|
+
result += html.substring(lastInsertionPoint);
|
|
117
|
+
return result;
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
var createRenderStylesToNodeStream = function createRenderStylesToNodeStream2(cache, nonceString) {
|
|
121
|
+
return function() {
|
|
122
|
+
var insed = {};
|
|
123
|
+
var tokenStream = index.default();
|
|
124
|
+
var inlineStream = index$1.default(function write(thing) {
|
|
125
|
+
var type = thing[0], data = thing[1];
|
|
126
|
+
if (type === "open") {
|
|
127
|
+
var css = "";
|
|
128
|
+
var ids = {};
|
|
129
|
+
var match;
|
|
130
|
+
var fragment = data.toString();
|
|
131
|
+
var regex = new RegExp(cache.key + "-([a-zA-Z0-9-_]+)", "gm");
|
|
132
|
+
while ((match = regex.exec(fragment)) !== null) {
|
|
133
|
+
if (match !== null && insed[match[1]] === void 0) {
|
|
134
|
+
ids[match[1]] = true;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
Object.keys(cache.inserted).forEach(function(id) {
|
|
138
|
+
if (cache.inserted[id] !== true && insed[id] === void 0 && (ids[id] === true || cache.registered[cache.key + "-" + id] === void 0 && (ids[id] = true))) {
|
|
139
|
+
insed[id] = true;
|
|
140
|
+
css += cache.inserted[id];
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
if (css !== "") {
|
|
144
|
+
this.queue('<style data-emotion="' + cache.key + " " + Object.keys(ids).join(" ") + '"' + nonceString + ">" + css + "</style>");
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
this.queue(data);
|
|
148
|
+
}, function end() {
|
|
149
|
+
this.queue(null);
|
|
150
|
+
});
|
|
151
|
+
return index$2.default(tokenStream, inlineStream);
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
var createConstructStyleTagsFromChunks = function createConstructStyleTagsFromChunks2(cache, nonceString) {
|
|
155
|
+
return function(criticalData) {
|
|
156
|
+
var styleTagsString = "";
|
|
157
|
+
criticalData.styles.forEach(function(item) {
|
|
158
|
+
styleTagsString += generateStyleTag(item.key, item.ids.join(" "), item.css, nonceString);
|
|
159
|
+
});
|
|
160
|
+
return styleTagsString;
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
function createEmotionServer(cache) {
|
|
164
|
+
if (cache.compat !== true) {
|
|
165
|
+
cache.compat = true;
|
|
166
|
+
}
|
|
167
|
+
var nonceString = cache.nonce !== void 0 ? ' nonce="' + cache.nonce + '"' : "";
|
|
168
|
+
return {
|
|
169
|
+
extractCritical: createExtractCritical(cache),
|
|
170
|
+
extractCriticalToChunks: createExtractCriticalToChunks(cache),
|
|
171
|
+
renderStylesToString: createRenderStylesToString(cache, nonceString),
|
|
172
|
+
renderStylesToNodeStream: createRenderStylesToNodeStream(cache, nonceString),
|
|
173
|
+
constructStyleTagsFromChunks: createConstructStyleTagsFromChunks(cache, nonceString)
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
exports.default = createEmotionServer;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import through from "../../../../../../through@2.3.8/node_modules/through/index.js";
|
|
2
|
+
import tokenize from "../../../../../../html-tokenize@2.0.1/node_modules/html-tokenize/index.js";
|
|
3
|
+
import pipe from "../../../../../../multipipe@1.0.2/node_modules/multipipe/index.js";
|
|
4
|
+
var createExtractCritical = function createExtractCritical2(cache) {
|
|
5
|
+
return function(html) {
|
|
6
|
+
var RGX = new RegExp(cache.key + "-([a-zA-Z0-9-_]+)", "gm");
|
|
7
|
+
var o = {
|
|
8
|
+
html,
|
|
9
|
+
ids: [],
|
|
10
|
+
css: ""
|
|
11
|
+
};
|
|
12
|
+
var match;
|
|
13
|
+
var ids = {};
|
|
14
|
+
while ((match = RGX.exec(html)) !== null) {
|
|
15
|
+
if (ids[match[1]] === void 0) {
|
|
16
|
+
ids[match[1]] = true;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
o.ids = Object.keys(cache.inserted).filter(function(id) {
|
|
20
|
+
if ((ids[id] !== void 0 || cache.registered[cache.key + "-" + id] === void 0) && cache.inserted[id] !== true) {
|
|
21
|
+
o.css += cache.inserted[id];
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
return o;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
var createExtractCriticalToChunks = function createExtractCriticalToChunks2(cache) {
|
|
29
|
+
return function(html) {
|
|
30
|
+
var RGX = new RegExp(cache.key + "-([a-zA-Z0-9-_]+)", "gm");
|
|
31
|
+
var o = {
|
|
32
|
+
html,
|
|
33
|
+
styles: []
|
|
34
|
+
};
|
|
35
|
+
var match;
|
|
36
|
+
var ids = {};
|
|
37
|
+
while ((match = RGX.exec(html)) !== null) {
|
|
38
|
+
if (ids[match[1]] === void 0) {
|
|
39
|
+
ids[match[1]] = true;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
var regularCssIds = [];
|
|
43
|
+
var regularCss = "";
|
|
44
|
+
Object.keys(cache.inserted).forEach(function(id) {
|
|
45
|
+
if ((ids[id] !== void 0 || cache.registered[cache.key + "-" + id] === void 0) && cache.inserted[id] !== true) {
|
|
46
|
+
if (cache.registered[cache.key + "-" + id]) {
|
|
47
|
+
regularCssIds.push(id);
|
|
48
|
+
regularCss += cache.inserted[id];
|
|
49
|
+
} else {
|
|
50
|
+
o.styles.push({
|
|
51
|
+
key: cache.key + "-global",
|
|
52
|
+
ids: [id],
|
|
53
|
+
css: cache.inserted[id]
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
o.styles.push({
|
|
59
|
+
key: cache.key,
|
|
60
|
+
ids: regularCssIds,
|
|
61
|
+
css: regularCss
|
|
62
|
+
});
|
|
63
|
+
return o;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
function generateStyleTag(cssKey, ids, styles, nonceString) {
|
|
67
|
+
return '<style data-emotion="' + cssKey + " " + ids + '"' + nonceString + ">" + styles + "</style>";
|
|
68
|
+
}
|
|
69
|
+
var createRenderStylesToString = function createRenderStylesToString2(cache, nonceString) {
|
|
70
|
+
return function(html) {
|
|
71
|
+
var inserted = cache.inserted, cssKey = cache.key, registered = cache.registered;
|
|
72
|
+
var regex = new RegExp("<|" + cssKey + "-([a-zA-Z0-9-_]+)", "gm");
|
|
73
|
+
var seen = {};
|
|
74
|
+
var result = "";
|
|
75
|
+
var globalIds = "";
|
|
76
|
+
var globalStyles = "";
|
|
77
|
+
for (var id in inserted) {
|
|
78
|
+
if (inserted.hasOwnProperty(id)) {
|
|
79
|
+
var style = inserted[id];
|
|
80
|
+
var key = cssKey + "-" + id;
|
|
81
|
+
if (style !== true && registered[key] === void 0) {
|
|
82
|
+
globalStyles += style;
|
|
83
|
+
globalIds += " " + id;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (globalStyles !== "") {
|
|
88
|
+
result = generateStyleTag(cssKey, globalIds.substring(1), globalStyles, nonceString);
|
|
89
|
+
}
|
|
90
|
+
var ids = "";
|
|
91
|
+
var styles = "";
|
|
92
|
+
var lastInsertionPoint = 0;
|
|
93
|
+
var match;
|
|
94
|
+
while ((match = regex.exec(html)) !== null) {
|
|
95
|
+
if (match[0] === "<") {
|
|
96
|
+
if (ids !== "") {
|
|
97
|
+
result += generateStyleTag(cssKey, ids.substring(1), styles, nonceString);
|
|
98
|
+
ids = "";
|
|
99
|
+
styles = "";
|
|
100
|
+
}
|
|
101
|
+
result += html.substring(lastInsertionPoint, match.index);
|
|
102
|
+
lastInsertionPoint = match.index;
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
var _id = match[1];
|
|
106
|
+
var _style = inserted[_id];
|
|
107
|
+
if (_style === true || _style === void 0 || seen[_id]) {
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
seen[_id] = true;
|
|
111
|
+
styles += _style;
|
|
112
|
+
ids += " " + _id;
|
|
113
|
+
}
|
|
114
|
+
result += html.substring(lastInsertionPoint);
|
|
115
|
+
return result;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
var createRenderStylesToNodeStream = function createRenderStylesToNodeStream2(cache, nonceString) {
|
|
119
|
+
return function() {
|
|
120
|
+
var insed = {};
|
|
121
|
+
var tokenStream = tokenize();
|
|
122
|
+
var inlineStream = through(function write(thing) {
|
|
123
|
+
var type = thing[0], data = thing[1];
|
|
124
|
+
if (type === "open") {
|
|
125
|
+
var css = "";
|
|
126
|
+
var ids = {};
|
|
127
|
+
var match;
|
|
128
|
+
var fragment = data.toString();
|
|
129
|
+
var regex = new RegExp(cache.key + "-([a-zA-Z0-9-_]+)", "gm");
|
|
130
|
+
while ((match = regex.exec(fragment)) !== null) {
|
|
131
|
+
if (match !== null && insed[match[1]] === void 0) {
|
|
132
|
+
ids[match[1]] = true;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
Object.keys(cache.inserted).forEach(function(id) {
|
|
136
|
+
if (cache.inserted[id] !== true && insed[id] === void 0 && (ids[id] === true || cache.registered[cache.key + "-" + id] === void 0 && (ids[id] = true))) {
|
|
137
|
+
insed[id] = true;
|
|
138
|
+
css += cache.inserted[id];
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
if (css !== "") {
|
|
142
|
+
this.queue('<style data-emotion="' + cache.key + " " + Object.keys(ids).join(" ") + '"' + nonceString + ">" + css + "</style>");
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
this.queue(data);
|
|
146
|
+
}, function end() {
|
|
147
|
+
this.queue(null);
|
|
148
|
+
});
|
|
149
|
+
return pipe(tokenStream, inlineStream);
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
var createConstructStyleTagsFromChunks = function createConstructStyleTagsFromChunks2(cache, nonceString) {
|
|
153
|
+
return function(criticalData) {
|
|
154
|
+
var styleTagsString = "";
|
|
155
|
+
criticalData.styles.forEach(function(item) {
|
|
156
|
+
styleTagsString += generateStyleTag(item.key, item.ids.join(" "), item.css, nonceString);
|
|
157
|
+
});
|
|
158
|
+
return styleTagsString;
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
function createEmotionServer(cache) {
|
|
162
|
+
if (cache.compat !== true) {
|
|
163
|
+
cache.compat = true;
|
|
164
|
+
}
|
|
165
|
+
var nonceString = cache.nonce !== void 0 ? ' nonce="' + cache.nonce + '"' : "";
|
|
166
|
+
return {
|
|
167
|
+
extractCritical: createExtractCritical(cache),
|
|
168
|
+
extractCriticalToChunks: createExtractCriticalToChunks(cache),
|
|
169
|
+
renderStylesToString: createRenderStylesToString(cache, nonceString),
|
|
170
|
+
renderStylesToNodeStream: createRenderStylesToNodeStream(cache, nonceString),
|
|
171
|
+
constructStyleTagsFromChunks: createConstructStyleTagsFromChunks(cache, nonceString)
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
export {
|
|
175
|
+
createEmotionServer as default
|
|
176
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
var toString = Object.prototype.toString;
|
|
4
|
+
var isModern = typeof Buffer.alloc === "function" && typeof Buffer.allocUnsafe === "function" && typeof Buffer.from === "function";
|
|
5
|
+
function isArrayBuffer(input) {
|
|
6
|
+
return toString.call(input).slice(8, -1) === "ArrayBuffer";
|
|
7
|
+
}
|
|
8
|
+
function fromArrayBuffer(obj, byteOffset, length) {
|
|
9
|
+
byteOffset >>>= 0;
|
|
10
|
+
var maxLength = obj.byteLength - byteOffset;
|
|
11
|
+
if (maxLength < 0) {
|
|
12
|
+
throw new RangeError("'offset' is out of bounds");
|
|
13
|
+
}
|
|
14
|
+
if (length === void 0) {
|
|
15
|
+
length = maxLength;
|
|
16
|
+
} else {
|
|
17
|
+
length >>>= 0;
|
|
18
|
+
if (length > maxLength) {
|
|
19
|
+
throw new RangeError("'length' is out of bounds");
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return isModern ? Buffer.from(obj.slice(byteOffset, byteOffset + length)) : new Buffer(new Uint8Array(obj.slice(byteOffset, byteOffset + length)));
|
|
23
|
+
}
|
|
24
|
+
function fromString(string, encoding) {
|
|
25
|
+
if (typeof encoding !== "string" || encoding === "") {
|
|
26
|
+
encoding = "utf8";
|
|
27
|
+
}
|
|
28
|
+
if (!Buffer.isEncoding(encoding)) {
|
|
29
|
+
throw new TypeError('"encoding" must be a valid string encoding');
|
|
30
|
+
}
|
|
31
|
+
return isModern ? Buffer.from(string, encoding) : new Buffer(string, encoding);
|
|
32
|
+
}
|
|
33
|
+
function bufferFrom(value, encodingOrOffset, length) {
|
|
34
|
+
if (typeof value === "number") {
|
|
35
|
+
throw new TypeError('"value" argument must not be a number');
|
|
36
|
+
}
|
|
37
|
+
if (isArrayBuffer(value)) {
|
|
38
|
+
return fromArrayBuffer(value, encodingOrOffset, length);
|
|
39
|
+
}
|
|
40
|
+
if (typeof value === "string") {
|
|
41
|
+
return fromString(value, encodingOrOffset);
|
|
42
|
+
}
|
|
43
|
+
return isModern ? Buffer.from(value) : new Buffer(value);
|
|
44
|
+
}
|
|
45
|
+
var bufferFrom_1 = bufferFrom;
|
|
46
|
+
exports.bufferFrom_1 = bufferFrom_1;
|