storybook 10.1.0-alpha.9 → 10.1.0-beta.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.
- package/dist/_browser-chunks/Color-FTG7SQDA.js +1097 -0
- package/dist/_browser-chunks/WithTooltip-LMROHDUP.js +1651 -0
- package/dist/_browser-chunks/chunk-2FRVAXCZ.js +7 -0
- package/dist/_browser-chunks/{chunk-FDWKXLBI.js → chunk-2XZMBGTA.js} +44 -109
- package/dist/_browser-chunks/chunk-3IAH5M2U.js +171 -0
- package/dist/_browser-chunks/chunk-3OXGAGBE.js +779 -0
- package/dist/_browser-chunks/{chunk-TMDZCWME.js → chunk-3PJE6VLG.js} +1 -3
- package/dist/_browser-chunks/{chunk-VAMFPZY3.js → chunk-45UGUKRX.js} +2 -7
- package/dist/_browser-chunks/chunk-6XWLIJQL.js +11 -0
- package/dist/_browser-chunks/{chunk-MM7DTO55.js → chunk-A242L54C.js} +10 -16
- package/dist/_browser-chunks/chunk-AIOS4NGK.js +252 -0
- package/dist/_browser-chunks/chunk-AS2HQEYC.js +14 -0
- package/dist/_browser-chunks/chunk-AXG2BOBL.js +836 -0
- package/dist/_browser-chunks/{chunk-MH6AXFXB.js → chunk-CHUV5WSW.js} +0 -5
- package/dist/_browser-chunks/chunk-EUVGDK4H.js +93 -0
- package/dist/_browser-chunks/chunk-EZSQOHRI.js +18 -0
- package/dist/_browser-chunks/{chunk-CADGRH3P.js → chunk-FNXWN6IK.js} +3 -8
- package/dist/_browser-chunks/chunk-FQ7SLVLR.js +66 -0
- package/dist/_browser-chunks/chunk-GFLS4VP3.js +64 -0
- package/dist/_browser-chunks/chunk-GFY5R5EY.js +47 -0
- package/dist/_browser-chunks/{chunk-L2D73C6Z.js → chunk-H6XK3RSC.js} +13 -21
- package/dist/_browser-chunks/chunk-IPA5A322.js +71 -0
- package/dist/_browser-chunks/chunk-JP7NCOJX.js +37 -0
- package/dist/_browser-chunks/chunk-KJHJLCBK.js +11 -0
- package/dist/_browser-chunks/{chunk-OWPZQM2D.js → chunk-L4RMQ7D7.js} +60 -110
- package/dist/_browser-chunks/chunk-P4F4UVXX.js +951 -0
- package/dist/_browser-chunks/{chunk-AB7OOPUX.js → chunk-QKODTO7K.js} +0 -5
- package/dist/_browser-chunks/chunk-RP5RXKFU.js +2491 -0
- package/dist/_browser-chunks/chunk-SL75JR6Y.js +9 -0
- package/dist/_browser-chunks/chunk-SS2NHR7W.js +2969 -0
- package/dist/_browser-chunks/chunk-UD6FQLAF.js +1481 -0
- package/dist/_browser-chunks/chunk-VYJQ7RU5.js +2853 -0
- package/dist/_browser-chunks/chunk-WJYERY3R.js +136 -0
- package/dist/_browser-chunks/chunk-XJNX76GA.js +85 -0
- package/dist/_browser-chunks/{chunk-F4Q6SGTB.js → chunk-YKE5S47A.js} +177 -399
- package/dist/_browser-chunks/{chunk-SN4J4IQ3.js → chunk-ZUWEVLDX.js} +1 -7
- package/dist/_browser-chunks/{formatter-OMEEQ6HG.js → formatter-QJ4M4OGQ.js} +4 -9
- package/dist/_browser-chunks/{syntaxhighlighter-CAVLW7PM.js → syntaxhighlighter-IQDEPFLK.js} +704 -1848
- package/dist/_node-chunks/{builder-manager-SM3UWERX.js → builder-manager-BDAQHXFI.js} +510 -1019
- package/dist/_node-chunks/camelcase-3C7DZZPX.js +37 -0
- package/dist/_node-chunks/chunk-2IIQTGNE.js +6024 -0
- package/dist/_node-chunks/chunk-56U5LEMP.js +3043 -0
- package/dist/_node-chunks/chunk-7LIRCAQE.js +20 -0
- package/dist/_node-chunks/chunk-7RN6TXKP.js +603 -0
- package/dist/_node-chunks/chunk-7SJ7PZNL.js +4523 -0
- package/dist/_node-chunks/{chunk-HHSTA6QS.js → chunk-BG4RDXG7.js} +8 -10
- package/dist/_node-chunks/chunk-CBQKMXLQ.js +18 -0
- package/dist/_node-chunks/chunk-CN2IW2KQ.js +1564 -0
- package/dist/_node-chunks/chunk-CQMAU6UQ.js +943 -0
- package/dist/_node-chunks/{chunk-EBUEXRH5.js → chunk-D6ND3TVY.js} +116 -276
- package/dist/_node-chunks/chunk-DC355CYB.js +61 -0
- package/dist/_node-chunks/{chunk-SGM3ZCCT.js → chunk-EVK2SBW5.js} +292 -688
- package/dist/_node-chunks/chunk-IXWEUXJ2.js +119 -0
- package/dist/_node-chunks/{chunk-F6EFOEC7.js → chunk-KVRF22SH.js} +469 -983
- package/dist/_node-chunks/chunk-LEDP4QQW.js +919 -0
- package/dist/_node-chunks/{chunk-GHIBZRKD.js → chunk-MMVV6DGG.js} +8133 -8887
- package/dist/_node-chunks/chunk-O5CGEVRI.js +29 -0
- package/dist/_node-chunks/chunk-OZZO56XN.js +299 -0
- package/dist/_node-chunks/chunk-POT2EVGD.js +78 -0
- package/dist/_node-chunks/chunk-R5YGFSTV.js +3781 -0
- package/dist/_node-chunks/chunk-SQCTM2OS.js +23 -0
- package/dist/_node-chunks/chunk-UFOFO5H7.js +54 -0
- package/dist/_node-chunks/chunk-VBF7ALJF.js +72 -0
- package/dist/_node-chunks/chunk-W6MAMTUF.js +70 -0
- package/dist/_node-chunks/chunk-WURL4XOT.js +46662 -0
- package/dist/_node-chunks/chunk-XGK6MVKR.js +61 -0
- package/dist/_node-chunks/chunk-YV3GDSDT.js +765 -0
- package/dist/_node-chunks/{chunk-ATDHMMIZ.js → chunk-YWV55YW3.js} +15 -24
- package/dist/_node-chunks/dist-KEP4IFRN.js +121 -0
- package/dist/_node-chunks/globby-4WUBTDCN.js +3452 -0
- package/dist/_node-chunks/lib-JVOEKTYM.js +366 -0
- package/dist/_node-chunks/mdx-N42X6CFJ-C5WFYYXR.js +14329 -0
- package/dist/_node-chunks/p-limit-LDY632RS.js +116 -0
- package/dist/actions/decorator.js +21 -42
- package/dist/actions/index.js +3 -3
- package/dist/babel/index.d.ts +671 -335
- package/dist/babel/index.js +10 -11
- package/dist/bin/core.js +601 -1548
- package/dist/bin/dispatcher.js +36 -36
- package/dist/bin/loader.js +24 -38
- package/dist/channels/index.js +98 -234
- package/dist/cli/index.d.ts +1479 -133
- package/dist/cli/index.js +30 -8540
- package/dist/client-logger/index.js +31 -61
- package/dist/common/index.d.ts +139 -62
- package/dist/common/index.js +66 -51
- package/dist/components/index.d.ts +575 -273
- package/dist/components/index.js +14863 -4313
- package/dist/core-events/index.js +2 -66
- package/dist/core-server/index.d.ts +3 -2
- package/dist/core-server/index.js +2908 -8518
- package/dist/core-server/presets/common-manager.css +2 -2
- package/dist/core-server/presets/common-manager.js +2521 -5233
- package/dist/core-server/presets/common-override-preset.js +31 -60
- package/dist/core-server/presets/common-preset.js +663 -962
- package/dist/csf/index.js +534 -1179
- package/dist/csf-tools/index.js +9 -9
- package/dist/docs-tools/index.js +6 -6
- package/dist/highlight/index.js +2 -2
- package/dist/instrumenter/index.js +199 -415
- package/dist/manager/globals-runtime.js +59044 -67141
- package/dist/manager/globals.js +2 -3
- package/dist/manager/manager-stores.d.ts +1 -0
- package/dist/manager/manager-stores.js +23 -0
- package/dist/manager/runtime.js +11511 -10953
- package/dist/manager-api/index.d.ts +1811 -2
- package/dist/manager-api/index.js +1348 -2401
- package/dist/manager-errors.d.ts +9 -0
- package/dist/manager-errors.js +3 -3
- package/dist/mocking-utils/index.d.ts +1126 -0
- package/dist/mocking-utils/index.js +1181 -0
- package/dist/node-logger/index.d.ts +192 -24
- package/dist/node-logger/index.js +23 -4471
- package/dist/preview/globals.js +2 -3
- package/dist/preview/runtime.js +10799 -22393
- package/dist/preview-api/index.d.ts +68 -69
- package/dist/preview-api/index.js +13 -13
- package/dist/preview-errors.d.ts +9 -0
- package/dist/preview-errors.js +4 -4
- package/dist/router/index.js +347 -899
- package/dist/server-errors.d.ts +34 -1
- package/dist/server-errors.js +17 -10
- package/dist/telemetry/index.d.ts +24 -3
- package/dist/telemetry/index.js +25 -24
- package/dist/test/index.js +6131 -11916
- package/dist/theming/create.d.ts +1 -0
- package/dist/theming/create.js +4 -4
- package/dist/theming/index.d.ts +3366 -2599
- package/dist/theming/index.js +501 -1091
- package/dist/types/index.d.ts +72 -8
- package/dist/types/index.js +27 -12
- package/dist/viewport/index.js +3 -3
- package/package.json +26 -17
- package/dist/_browser-chunks/Color-7ZNS6F6B.js +0 -1676
- package/dist/_browser-chunks/WithTooltip-SK46ZJ2J.js +0 -13
- package/dist/_browser-chunks/chunk-6A7OIVEL.js +0 -66
- package/dist/_browser-chunks/chunk-B4A3ADP3.js +0 -3816
- package/dist/_browser-chunks/chunk-BOOOPFZF.js +0 -2335
- package/dist/_browser-chunks/chunk-FSBVR7H5.js +0 -106
- package/dist/_browser-chunks/chunk-FUOHXXZT.js +0 -23
- package/dist/_browser-chunks/chunk-GTKOCWCT.js +0 -17
- package/dist/_browser-chunks/chunk-HHW4FUMO.js +0 -12
- package/dist/_browser-chunks/chunk-JVSKG4YS.js +0 -4052
- package/dist/_browser-chunks/chunk-LASUB7TL.js +0 -76
- package/dist/_browser-chunks/chunk-LYCSRYYR.js +0 -101
- package/dist/_browser-chunks/chunk-NVV6MIOE.js +0 -243
- package/dist/_browser-chunks/chunk-OBXWFEPB.js +0 -852
- package/dist/_browser-chunks/chunk-OPCDBBL3.js +0 -48
- package/dist/_browser-chunks/chunk-PB6FZ3WE.js +0 -130
- package/dist/_browser-chunks/chunk-RNE2IUTB.js +0 -1300
- package/dist/_browser-chunks/chunk-RW5PKMWM.js +0 -4182
- package/dist/_browser-chunks/chunk-SYS437NN.js +0 -122
- package/dist/_browser-chunks/chunk-U46RQHA4.js +0 -12
- package/dist/_browser-chunks/chunk-UTNZYD2N.js +0 -311
- package/dist/_browser-chunks/chunk-VUAFL5XK.js +0 -20
- package/dist/_browser-chunks/chunk-XDGMHOV7.js +0 -2197
- package/dist/_browser-chunks/chunk-XW6KSYKF.js +0 -16
- package/dist/_browser-chunks/chunk-Y3M7TW6K.js +0 -1041
- package/dist/_browser-chunks/chunk-ZNRFDIVA.js +0 -233
- package/dist/_node-chunks/camelcase-H5QSGQLK.js +0 -18
- package/dist/_node-chunks/chunk-3THWHQOC.js +0 -61
- package/dist/_node-chunks/chunk-45YUOLTU.js +0 -69
- package/dist/_node-chunks/chunk-4QSNCPAU.js +0 -64656
- package/dist/_node-chunks/chunk-744PQSOU.js +0 -79
- package/dist/_node-chunks/chunk-74Z2U7QG.js +0 -1544
- package/dist/_node-chunks/chunk-7MB7TFPO.js +0 -1198
- package/dist/_node-chunks/chunk-A7GS4RFT.js +0 -697
- package/dist/_node-chunks/chunk-BIA3A5UM.js +0 -61
- package/dist/_node-chunks/chunk-C5G7CLWX.js +0 -1657
- package/dist/_node-chunks/chunk-DLFUKMYJ.js +0 -1531
- package/dist/_node-chunks/chunk-EMRGRXKT.js +0 -111
- package/dist/_node-chunks/chunk-EX46EHHY.js +0 -420
- package/dist/_node-chunks/chunk-F76QKNOJ.js +0 -304
- package/dist/_node-chunks/chunk-HDCRUTEF.js +0 -220
- package/dist/_node-chunks/chunk-HUYAOIPH.js +0 -90
- package/dist/_node-chunks/chunk-IBJZQZJC.js +0 -101
- package/dist/_node-chunks/chunk-KZN2RDDT.js +0 -6712
- package/dist/_node-chunks/chunk-LYUNFU3F.js +0 -4741
- package/dist/_node-chunks/chunk-N44SIS6K.js +0 -28
- package/dist/_node-chunks/chunk-NILZM6KR.js +0 -18
- package/dist/_node-chunks/chunk-PC4ZRP6W.js +0 -34
- package/dist/_node-chunks/chunk-TJNGOQUH.js +0 -4272
- package/dist/_node-chunks/chunk-UBSYLHIL.js +0 -1250
- package/dist/_node-chunks/chunk-UTCLXPOC.js +0 -1518
- package/dist/_node-chunks/chunk-WOXXODXP.js +0 -5029
- package/dist/_node-chunks/chunk-XC4MEUA6.js +0 -1586
- package/dist/_node-chunks/chunk-YRXXMKRR.js +0 -2256
- package/dist/_node-chunks/dist-SL73W244.js +0 -175
- package/dist/_node-chunks/globby-ZSHAUQZ5.js +0 -5222
- package/dist/_node-chunks/lib-U2VIPUTI.js +0 -518
- package/dist/_node-chunks/mdx-N42X6CFJ-ZLHD33JK.js +0 -22017
- package/dist/_node-chunks/p-limit-K5BS5MSV.js +0 -168
- package/dist/_node-chunks/plugin-5PD4YIUH.js +0 -129
- package/dist/_node-chunks/plugin-MONDT2WL.js +0 -159
- package/dist/_node-chunks/webpack-inject-mocker-runtime-plugin-EUZJRG3W.js +0 -69102
- package/dist/_node-chunks/webpack-mock-plugin-T4LDXEHE.js +0 -124
- package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +0 -36
- package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +0 -33
|
@@ -1,251 +1,150 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_hjmvusgt1gv from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_hjmvusgt1gv from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_hjmvusgt1gv from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_hjmvusgt1gv.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_hjmvusgt1gv.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_hjmvusgt1gv.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
12
|
import {
|
|
13
|
-
__name,
|
|
14
13
|
__require
|
|
15
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-UFOFO5H7.js";
|
|
16
15
|
|
|
17
16
|
// ../node_modules/@storybook/docs-mdx/dist/chunk-H6DQNFQR.js
|
|
18
|
-
var __create = Object.create
|
|
19
|
-
|
|
20
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
21
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
22
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
23
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
24
|
-
var __require2 = ((x) => typeof __require !== "undefined" ? __require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
25
|
-
get: /* @__PURE__ */ __name((a, b) => (typeof __require !== "undefined" ? __require : a)[b], "get")
|
|
17
|
+
var __create = Object.create, __defProp = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __getOwnPropNames = Object.getOwnPropertyNames, __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty, __require2 = ((x) => typeof __require < "u" ? __require : typeof Proxy < "u" ? new Proxy(x, {
|
|
18
|
+
get: (a, b) => (typeof __require < "u" ? __require : a)[b]
|
|
26
19
|
}) : x)(function(x) {
|
|
27
|
-
if (typeof __require
|
|
20
|
+
if (typeof __require < "u")
|
|
28
21
|
return __require.apply(this, arguments);
|
|
29
22
|
throw new Error('Dynamic require of "' + x + '" is not supported');
|
|
30
|
-
})
|
|
31
|
-
var __commonJS = /* @__PURE__ */ __name((cb, mod) => /* @__PURE__ */ __name(function __require22() {
|
|
23
|
+
}), __commonJS = (cb, mod) => function() {
|
|
32
24
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
33
|
-
},
|
|
34
|
-
var __export = /* @__PURE__ */ __name((target, all2) => {
|
|
25
|
+
}, __export = (target, all2) => {
|
|
35
26
|
for (var name2 in all2)
|
|
36
|
-
__defProp(target, name2, { get: all2[name2], enumerable:
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
27
|
+
__defProp(target, name2, { get: all2[name2], enumerable: !0 });
|
|
28
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
29
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
40
30
|
for (let key of __getOwnPropNames(from))
|
|
41
|
-
|
|
42
|
-
__defProp(to, key, { get: /* @__PURE__ */ __name(() => from[key], "get"), enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
43
|
-
}
|
|
31
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
44
32
|
return to;
|
|
45
|
-
},
|
|
46
|
-
var __toESM = /* @__PURE__ */ __name((mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
33
|
+
}, __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
47
34
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
48
35
|
// file that has been converted to a CommonJS file using a Babel-
|
|
49
36
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
50
37
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
51
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable:
|
|
38
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
52
39
|
mod
|
|
53
|
-
)),
|
|
54
|
-
var require_inline_style_parser = __commonJS({
|
|
40
|
+
)), require_inline_style_parser = __commonJS({
|
|
55
41
|
"node_modules/inline-style-parser/index.js"(exports, module) {
|
|
56
|
-
var COMMENT_REGEX = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;
|
|
57
|
-
|
|
58
|
-
var WHITESPACE_REGEX = /^\s*/;
|
|
59
|
-
var PROPERTY_REGEX = /^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/;
|
|
60
|
-
var COLON_REGEX = /^:\s*/;
|
|
61
|
-
var VALUE_REGEX = /^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/;
|
|
62
|
-
var SEMICOLON_REGEX = /^[;\s]*/;
|
|
63
|
-
var TRIM_REGEX = /^\s+|\s+$/g;
|
|
64
|
-
var NEWLINE = "\n";
|
|
65
|
-
var FORWARD_SLASH = "/";
|
|
66
|
-
var ASTERISK = "*";
|
|
67
|
-
var EMPTY_STRING = "";
|
|
68
|
-
var TYPE_COMMENT = "comment";
|
|
69
|
-
var TYPE_DECLARATION = "declaration";
|
|
42
|
+
var COMMENT_REGEX = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g, NEWLINE_REGEX = /\n/g, WHITESPACE_REGEX = /^\s*/, PROPERTY_REGEX = /^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/, COLON_REGEX = /^:\s*/, VALUE_REGEX = /^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/, SEMICOLON_REGEX = /^[;\s]*/, TRIM_REGEX = /^\s+|\s+$/g, NEWLINE = `
|
|
43
|
+
`, FORWARD_SLASH = "/", ASTERISK = "*", EMPTY_STRING = "", TYPE_COMMENT = "comment", TYPE_DECLARATION = "declaration";
|
|
70
44
|
module.exports = function(style, options) {
|
|
71
|
-
if (typeof style
|
|
45
|
+
if (typeof style != "string")
|
|
72
46
|
throw new TypeError("First argument must be a string");
|
|
73
|
-
}
|
|
74
47
|
if (!style)
|
|
75
48
|
return [];
|
|
76
49
|
options = options || {};
|
|
77
|
-
var lineno = 1;
|
|
78
|
-
var column = 1;
|
|
50
|
+
var lineno = 1, column = 1;
|
|
79
51
|
function updatePosition(str) {
|
|
80
52
|
var lines = str.match(NEWLINE_REGEX);
|
|
81
|
-
|
|
82
|
-
lineno += lines.length;
|
|
53
|
+
lines && (lineno += lines.length);
|
|
83
54
|
var i = str.lastIndexOf(NEWLINE);
|
|
84
55
|
column = ~i ? str.length - i : column + str.length;
|
|
85
56
|
}
|
|
86
|
-
__name(updatePosition, "updatePosition");
|
|
87
57
|
function position2() {
|
|
88
58
|
var start2 = { line: lineno, column };
|
|
89
59
|
return function(node) {
|
|
90
|
-
node.position = new Position(start2);
|
|
91
|
-
whitespace2();
|
|
92
|
-
return node;
|
|
60
|
+
return node.position = new Position(start2), whitespace2(), node;
|
|
93
61
|
};
|
|
94
62
|
}
|
|
95
|
-
__name(position2, "position2");
|
|
96
63
|
function Position(start2) {
|
|
97
|
-
this.start = start2;
|
|
98
|
-
this.end = { line: lineno, column };
|
|
99
|
-
this.source = options.source;
|
|
64
|
+
this.start = start2, this.end = { line: lineno, column }, this.source = options.source;
|
|
100
65
|
}
|
|
101
|
-
__name(Position, "Position");
|
|
102
66
|
Position.prototype.content = style;
|
|
103
67
|
var errorsList = [];
|
|
104
68
|
function error(msg) {
|
|
105
69
|
var err = new Error(
|
|
106
70
|
options.source + ":" + lineno + ":" + column + ": " + msg
|
|
107
71
|
);
|
|
108
|
-
err.reason = msg
|
|
109
|
-
err.filename = options.source;
|
|
110
|
-
err.line = lineno;
|
|
111
|
-
err.column = column;
|
|
112
|
-
err.source = style;
|
|
113
|
-
if (options.silent) {
|
|
72
|
+
if (err.reason = msg, err.filename = options.source, err.line = lineno, err.column = column, err.source = style, options.silent)
|
|
114
73
|
errorsList.push(err);
|
|
115
|
-
|
|
74
|
+
else
|
|
116
75
|
throw err;
|
|
117
|
-
}
|
|
118
76
|
}
|
|
119
|
-
__name(error, "error");
|
|
120
77
|
function match(re2) {
|
|
121
78
|
var m = re2.exec(style);
|
|
122
|
-
if (
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
style = style.slice(str.length);
|
|
127
|
-
return m;
|
|
79
|
+
if (m) {
|
|
80
|
+
var str = m[0];
|
|
81
|
+
return updatePosition(str), style = style.slice(str.length), m;
|
|
82
|
+
}
|
|
128
83
|
}
|
|
129
|
-
__name(match, "match");
|
|
130
84
|
function whitespace2() {
|
|
131
85
|
match(WHITESPACE_REGEX);
|
|
132
86
|
}
|
|
133
|
-
__name(whitespace2, "whitespace2");
|
|
134
87
|
function comments(rules) {
|
|
135
88
|
var c;
|
|
136
|
-
rules = rules || [];
|
|
137
|
-
|
|
138
|
-
if (c !== false) {
|
|
139
|
-
rules.push(c);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
89
|
+
for (rules = rules || []; c = comment2(); )
|
|
90
|
+
c !== !1 && rules.push(c);
|
|
142
91
|
return rules;
|
|
143
92
|
}
|
|
144
|
-
__name(comments, "comments");
|
|
145
93
|
function comment2() {
|
|
146
94
|
var pos = position2();
|
|
147
|
-
if (FORWARD_SLASH != style.charAt(0) || ASTERISK != style.charAt(1))
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
95
|
+
if (!(FORWARD_SLASH != style.charAt(0) || ASTERISK != style.charAt(1))) {
|
|
96
|
+
for (var i = 2; EMPTY_STRING != style.charAt(i) && (ASTERISK != style.charAt(i) || FORWARD_SLASH != style.charAt(i + 1)); )
|
|
97
|
+
++i;
|
|
98
|
+
if (i += 2, EMPTY_STRING === style.charAt(i - 1))
|
|
99
|
+
return error("End of comment missing");
|
|
100
|
+
var str = style.slice(2, i - 2);
|
|
101
|
+
return column += 2, updatePosition(str), style = style.slice(i), column += 2, pos({
|
|
102
|
+
type: TYPE_COMMENT,
|
|
103
|
+
comment: str
|
|
104
|
+
});
|
|
156
105
|
}
|
|
157
|
-
var str = style.slice(2, i - 2);
|
|
158
|
-
column += 2;
|
|
159
|
-
updatePosition(str);
|
|
160
|
-
style = style.slice(i);
|
|
161
|
-
column += 2;
|
|
162
|
-
return pos({
|
|
163
|
-
type: TYPE_COMMENT,
|
|
164
|
-
comment: str
|
|
165
|
-
});
|
|
166
106
|
}
|
|
167
|
-
__name(comment2, "comment2");
|
|
168
107
|
function declaration() {
|
|
169
|
-
var pos = position2();
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
value: val ? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING)) : EMPTY_STRING
|
|
181
|
-
});
|
|
182
|
-
match(SEMICOLON_REGEX);
|
|
183
|
-
return ret;
|
|
108
|
+
var pos = position2(), prop = match(PROPERTY_REGEX);
|
|
109
|
+
if (prop) {
|
|
110
|
+
if (comment2(), !match(COLON_REGEX))
|
|
111
|
+
return error("property missing ':'");
|
|
112
|
+
var val = match(VALUE_REGEX), ret = pos({
|
|
113
|
+
type: TYPE_DECLARATION,
|
|
114
|
+
property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)),
|
|
115
|
+
value: val ? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING)) : EMPTY_STRING
|
|
116
|
+
});
|
|
117
|
+
return match(SEMICOLON_REGEX), ret;
|
|
118
|
+
}
|
|
184
119
|
}
|
|
185
|
-
__name(declaration, "declaration");
|
|
186
120
|
function declarations() {
|
|
187
121
|
var decls = [];
|
|
188
122
|
comments(decls);
|
|
189
|
-
var decl;
|
|
190
|
-
|
|
191
|
-
if (decl !== false) {
|
|
192
|
-
decls.push(decl);
|
|
193
|
-
comments(decls);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
123
|
+
for (var decl; decl = declaration(); )
|
|
124
|
+
decl !== !1 && (decls.push(decl), comments(decls));
|
|
196
125
|
return decls;
|
|
197
126
|
}
|
|
198
|
-
|
|
199
|
-
whitespace2();
|
|
200
|
-
return declarations();
|
|
127
|
+
return whitespace2(), declarations();
|
|
201
128
|
};
|
|
202
129
|
function trim(str) {
|
|
203
130
|
return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING;
|
|
204
131
|
}
|
|
205
|
-
__name(trim, "trim");
|
|
206
132
|
}
|
|
207
|
-
})
|
|
208
|
-
var require_style_to_object = __commonJS({
|
|
133
|
+
}), require_style_to_object = __commonJS({
|
|
209
134
|
"node_modules/style-to-object/index.js"(exports, module) {
|
|
210
135
|
var parse = require_inline_style_parser();
|
|
211
136
|
function StyleToObject2(style, iterator) {
|
|
212
137
|
var output = null;
|
|
213
|
-
if (!style || typeof style
|
|
138
|
+
if (!style || typeof style != "string")
|
|
214
139
|
return output;
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
var declarations = parse(style);
|
|
218
|
-
var hasIterator = typeof iterator === "function";
|
|
219
|
-
var property;
|
|
220
|
-
var value;
|
|
221
|
-
for (var i = 0, len = declarations.length; i < len; i++) {
|
|
222
|
-
declaration = declarations[i];
|
|
223
|
-
property = declaration.property;
|
|
224
|
-
value = declaration.value;
|
|
225
|
-
if (hasIterator) {
|
|
226
|
-
iterator(property, value, declaration);
|
|
227
|
-
} else if (value) {
|
|
228
|
-
output || (output = {});
|
|
229
|
-
output[property] = value;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
140
|
+
for (var declaration, declarations = parse(style), hasIterator = typeof iterator == "function", property, value, i = 0, len = declarations.length; i < len; i++)
|
|
141
|
+
declaration = declarations[i], property = declaration.property, value = declaration.value, hasIterator ? iterator(property, value, declaration) : value && (output || (output = {}), output[property] = value);
|
|
232
142
|
return output;
|
|
233
143
|
}
|
|
234
|
-
|
|
235
|
-
module.exports = StyleToObject2;
|
|
236
|
-
module.exports.default = StyleToObject2;
|
|
144
|
+
module.exports = StyleToObject2, module.exports.default = StyleToObject2;
|
|
237
145
|
}
|
|
238
146
|
});
|
|
239
|
-
function ok() {
|
|
240
|
-
}
|
|
241
|
-
__name(ok, "ok");
|
|
242
|
-
function unreachable() {
|
|
243
|
-
}
|
|
244
|
-
__name(unreachable, "unreachable");
|
|
245
147
|
var Schema = class {
|
|
246
|
-
static {
|
|
247
|
-
__name(this, "Schema");
|
|
248
|
-
}
|
|
249
148
|
/**
|
|
250
149
|
* @constructor
|
|
251
150
|
* @param {Properties} property
|
|
@@ -253,82 +152,56 @@ var Schema = class {
|
|
|
253
152
|
* @param {string} [space]
|
|
254
153
|
*/
|
|
255
154
|
constructor(property, normal, space) {
|
|
256
|
-
this.property = property;
|
|
257
|
-
this.normal = normal;
|
|
258
|
-
if (space) {
|
|
259
|
-
this.space = space;
|
|
260
|
-
}
|
|
155
|
+
this.property = property, this.normal = normal, space && (this.space = space);
|
|
261
156
|
}
|
|
262
157
|
};
|
|
263
158
|
Schema.prototype.property = {};
|
|
264
159
|
Schema.prototype.normal = {};
|
|
265
160
|
Schema.prototype.space = null;
|
|
266
161
|
function merge(definitions, space) {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
while (++index < definitions.length) {
|
|
271
|
-
Object.assign(property, definitions[index].property);
|
|
272
|
-
Object.assign(normal, definitions[index].normal);
|
|
273
|
-
}
|
|
162
|
+
let property = {}, normal = {}, index = -1;
|
|
163
|
+
for (; ++index < definitions.length; )
|
|
164
|
+
Object.assign(property, definitions[index].property), Object.assign(normal, definitions[index].normal);
|
|
274
165
|
return new Schema(property, normal, space);
|
|
275
166
|
}
|
|
276
|
-
__name(merge, "merge");
|
|
277
167
|
function normalize(value) {
|
|
278
168
|
return value.toLowerCase();
|
|
279
169
|
}
|
|
280
|
-
__name(normalize, "normalize");
|
|
281
170
|
var Info = class {
|
|
282
|
-
static {
|
|
283
|
-
__name(this, "Info");
|
|
284
|
-
}
|
|
285
171
|
/**
|
|
286
172
|
* @constructor
|
|
287
173
|
* @param {string} property
|
|
288
174
|
* @param {string} attribute
|
|
289
175
|
*/
|
|
290
176
|
constructor(property, attribute) {
|
|
291
|
-
this.property = property;
|
|
292
|
-
this.attribute = attribute;
|
|
177
|
+
this.property = property, this.attribute = attribute;
|
|
293
178
|
}
|
|
294
179
|
};
|
|
295
180
|
Info.prototype.space = null;
|
|
296
|
-
Info.prototype.boolean =
|
|
297
|
-
Info.prototype.booleanish =
|
|
298
|
-
Info.prototype.overloadedBoolean =
|
|
299
|
-
Info.prototype.number =
|
|
300
|
-
Info.prototype.commaSeparated =
|
|
301
|
-
Info.prototype.spaceSeparated =
|
|
302
|
-
Info.prototype.commaOrSpaceSeparated =
|
|
303
|
-
Info.prototype.mustUseProperty =
|
|
304
|
-
Info.prototype.defined =
|
|
181
|
+
Info.prototype.boolean = !1;
|
|
182
|
+
Info.prototype.booleanish = !1;
|
|
183
|
+
Info.prototype.overloadedBoolean = !1;
|
|
184
|
+
Info.prototype.number = !1;
|
|
185
|
+
Info.prototype.commaSeparated = !1;
|
|
186
|
+
Info.prototype.spaceSeparated = !1;
|
|
187
|
+
Info.prototype.commaOrSpaceSeparated = !1;
|
|
188
|
+
Info.prototype.mustUseProperty = !1;
|
|
189
|
+
Info.prototype.defined = !1;
|
|
305
190
|
var types_exports = {};
|
|
306
191
|
__export(types_exports, {
|
|
307
|
-
boolean:
|
|
308
|
-
booleanish:
|
|
309
|
-
commaOrSpaceSeparated:
|
|
310
|
-
commaSeparated:
|
|
311
|
-
number:
|
|
312
|
-
overloadedBoolean:
|
|
313
|
-
spaceSeparated:
|
|
192
|
+
boolean: () => boolean,
|
|
193
|
+
booleanish: () => booleanish,
|
|
194
|
+
commaOrSpaceSeparated: () => commaOrSpaceSeparated,
|
|
195
|
+
commaSeparated: () => commaSeparated,
|
|
196
|
+
number: () => number,
|
|
197
|
+
overloadedBoolean: () => overloadedBoolean,
|
|
198
|
+
spaceSeparated: () => spaceSeparated
|
|
314
199
|
});
|
|
315
|
-
var powers = 0;
|
|
316
|
-
var boolean = increment();
|
|
317
|
-
var booleanish = increment();
|
|
318
|
-
var overloadedBoolean = increment();
|
|
319
|
-
var number = increment();
|
|
320
|
-
var spaceSeparated = increment();
|
|
321
|
-
var commaSeparated = increment();
|
|
322
|
-
var commaOrSpaceSeparated = increment();
|
|
200
|
+
var powers = 0, boolean = increment(), booleanish = increment(), overloadedBoolean = increment(), number = increment(), spaceSeparated = increment(), commaSeparated = increment(), commaOrSpaceSeparated = increment();
|
|
323
201
|
function increment() {
|
|
324
202
|
return 2 ** ++powers;
|
|
325
203
|
}
|
|
326
|
-
|
|
327
|
-
var checks = Object.keys(types_exports);
|
|
328
|
-
var DefinedInfo = class extends Info {
|
|
329
|
-
static {
|
|
330
|
-
__name(this, "DefinedInfo");
|
|
331
|
-
}
|
|
204
|
+
var checks = Object.keys(types_exports), DefinedInfo = class extends Info {
|
|
332
205
|
/**
|
|
333
206
|
* @constructor
|
|
334
207
|
* @param {string} property
|
|
@@ -338,48 +211,32 @@ var DefinedInfo = class extends Info {
|
|
|
338
211
|
*/
|
|
339
212
|
constructor(property, attribute, mask, space) {
|
|
340
213
|
let index = -1;
|
|
341
|
-
super(property, attribute)
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
while (++index < checks.length) {
|
|
345
|
-
const check = checks[index];
|
|
214
|
+
if (super(property, attribute), mark(this, "space", space), typeof mask == "number")
|
|
215
|
+
for (; ++index < checks.length; ) {
|
|
216
|
+
let check = checks[index];
|
|
346
217
|
mark(this, checks[index], (mask & types_exports[check]) === types_exports[check]);
|
|
347
218
|
}
|
|
348
|
-
}
|
|
349
219
|
}
|
|
350
220
|
};
|
|
351
|
-
DefinedInfo.prototype.defined =
|
|
221
|
+
DefinedInfo.prototype.defined = !0;
|
|
352
222
|
function mark(values, key, value) {
|
|
353
|
-
|
|
354
|
-
values[key] = value;
|
|
355
|
-
}
|
|
223
|
+
value && (values[key] = value);
|
|
356
224
|
}
|
|
357
|
-
__name(mark, "mark");
|
|
358
225
|
var own = {}.hasOwnProperty;
|
|
359
226
|
function create(definition) {
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
let prop;
|
|
363
|
-
for (prop in definition.properties) {
|
|
227
|
+
let property = {}, normal = {}, prop;
|
|
228
|
+
for (prop in definition.properties)
|
|
364
229
|
if (own.call(definition.properties, prop)) {
|
|
365
|
-
|
|
366
|
-
const info = new DefinedInfo(
|
|
230
|
+
let value = definition.properties[prop], info = new DefinedInfo(
|
|
367
231
|
prop,
|
|
368
232
|
definition.transform(definition.attributes || {}, prop),
|
|
369
233
|
value,
|
|
370
234
|
definition.space
|
|
371
235
|
);
|
|
372
|
-
|
|
373
|
-
info.mustUseProperty = true;
|
|
374
|
-
}
|
|
375
|
-
property[prop] = info;
|
|
376
|
-
normal[normalize(prop)] = prop;
|
|
377
|
-
normal[normalize(info.attribute)] = prop;
|
|
236
|
+
definition.mustUseProperty && definition.mustUseProperty.includes(prop) && (info.mustUseProperty = !0), property[prop] = info, normal[normalize(prop)] = prop, normal[normalize(info.attribute)] = prop;
|
|
378
237
|
}
|
|
379
|
-
}
|
|
380
238
|
return new Schema(property, normal, definition.space);
|
|
381
239
|
}
|
|
382
|
-
__name(create, "create");
|
|
383
240
|
var xlink = create({
|
|
384
241
|
space: "xlink",
|
|
385
242
|
transform(_, prop) {
|
|
@@ -394,8 +251,7 @@ var xlink = create({
|
|
|
394
251
|
xLinkTitle: null,
|
|
395
252
|
xLinkType: null
|
|
396
253
|
}
|
|
397
|
-
})
|
|
398
|
-
var xml = create({
|
|
254
|
+
}), xml = create({
|
|
399
255
|
space: "xml",
|
|
400
256
|
transform(_, prop) {
|
|
401
257
|
return "xml:" + prop.slice(3).toLowerCase();
|
|
@@ -405,18 +261,15 @@ var xml = create({
|
|
|
405
261
|
function caseSensitiveTransform(attributes, attribute) {
|
|
406
262
|
return attribute in attributes ? attributes[attribute] : attribute;
|
|
407
263
|
}
|
|
408
|
-
__name(caseSensitiveTransform, "caseSensitiveTransform");
|
|
409
264
|
function caseInsensitiveTransform(attributes, property) {
|
|
410
265
|
return caseSensitiveTransform(attributes, property.toLowerCase());
|
|
411
266
|
}
|
|
412
|
-
__name(caseInsensitiveTransform, "caseInsensitiveTransform");
|
|
413
267
|
var xmlns = create({
|
|
414
268
|
space: "xmlns",
|
|
415
269
|
attributes: { xmlnsxlink: "xmlns:xlink" },
|
|
416
270
|
transform: caseInsensitiveTransform,
|
|
417
271
|
properties: { xmlns: null, xmlnsXLink: null }
|
|
418
|
-
})
|
|
419
|
-
var aria = create({
|
|
272
|
+
}), aria = create({
|
|
420
273
|
transform(_, prop) {
|
|
421
274
|
return prop === "role" ? prop : "aria-" + prop.slice(4).toLowerCase();
|
|
422
275
|
},
|
|
@@ -471,8 +324,7 @@ var aria = create({
|
|
|
471
324
|
ariaValueText: null,
|
|
472
325
|
role: null
|
|
473
326
|
}
|
|
474
|
-
})
|
|
475
|
-
var html = create({
|
|
327
|
+
}), html = create({
|
|
476
328
|
space: "html",
|
|
477
329
|
attributes: {
|
|
478
330
|
acceptcharset: "accept-charset",
|
|
@@ -831,8 +683,7 @@ var html = create({
|
|
|
831
683
|
security: null,
|
|
832
684
|
unselectable: null
|
|
833
685
|
}
|
|
834
|
-
})
|
|
835
|
-
var svg = create({
|
|
686
|
+
}), svg = create({
|
|
836
687
|
space: "svg",
|
|
837
688
|
attributes: {
|
|
838
689
|
accentHeight: "accent-height",
|
|
@@ -1391,44 +1242,32 @@ var svg = create({
|
|
|
1391
1242
|
z: null,
|
|
1392
1243
|
zoomAndPan: null
|
|
1393
1244
|
}
|
|
1394
|
-
});
|
|
1395
|
-
var valid = /^data[-\w.:]+$/i;
|
|
1396
|
-
var dash = /-[a-z]/g;
|
|
1397
|
-
var cap = /[A-Z]/g;
|
|
1245
|
+
}), valid = /^data[-\w.:]+$/i, dash = /-[a-z]/g, cap = /[A-Z]/g;
|
|
1398
1246
|
function find(schema, value) {
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
let Type = Info;
|
|
1402
|
-
if (normal in schema.normal) {
|
|
1247
|
+
let normal = normalize(value), prop = value, Type = Info;
|
|
1248
|
+
if (normal in schema.normal)
|
|
1403
1249
|
return schema.property[schema.normal[normal]];
|
|
1404
|
-
}
|
|
1405
1250
|
if (normal.length > 4 && normal.slice(0, 4) === "data" && valid.test(value)) {
|
|
1406
1251
|
if (value.charAt(4) === "-") {
|
|
1407
|
-
|
|
1252
|
+
let rest = value.slice(5).replace(dash, camelcase);
|
|
1408
1253
|
prop = "data" + rest.charAt(0).toUpperCase() + rest.slice(1);
|
|
1409
1254
|
} else {
|
|
1410
|
-
|
|
1255
|
+
let rest = value.slice(4);
|
|
1411
1256
|
if (!dash.test(rest)) {
|
|
1412
1257
|
let dashes = rest.replace(cap, kebab);
|
|
1413
|
-
|
|
1414
|
-
dashes = "-" + dashes;
|
|
1415
|
-
}
|
|
1416
|
-
value = "data" + dashes;
|
|
1258
|
+
dashes.charAt(0) !== "-" && (dashes = "-" + dashes), value = "data" + dashes;
|
|
1417
1259
|
}
|
|
1418
1260
|
}
|
|
1419
1261
|
Type = DefinedInfo;
|
|
1420
1262
|
}
|
|
1421
1263
|
return new Type(prop, value);
|
|
1422
1264
|
}
|
|
1423
|
-
__name(find, "find");
|
|
1424
1265
|
function kebab($0) {
|
|
1425
1266
|
return "-" + $0.toLowerCase();
|
|
1426
1267
|
}
|
|
1427
|
-
__name(kebab, "kebab");
|
|
1428
1268
|
function camelcase($0) {
|
|
1429
1269
|
return $0.charAt(1).toUpperCase();
|
|
1430
1270
|
}
|
|
1431
|
-
__name(camelcase, "camelcase");
|
|
1432
1271
|
var hastToReact = {
|
|
1433
1272
|
classId: "classID",
|
|
1434
1273
|
dataType: "datatype",
|
|
@@ -1447,222 +1286,151 @@ var hastToReact = {
|
|
|
1447
1286
|
xLinkTitle: "xlinkTitle",
|
|
1448
1287
|
xLinkType: "xlinkType",
|
|
1449
1288
|
xmlnsXLink: "xmlnsXlink"
|
|
1450
|
-
};
|
|
1451
|
-
var html2 = merge([xml, xlink, xmlns, aria, html], "html");
|
|
1452
|
-
var svg2 = merge([xml, xlink, xmlns, aria, svg], "svg");
|
|
1453
|
-
var pointEnd = point("end");
|
|
1454
|
-
var pointStart = point("start");
|
|
1289
|
+
}, html2 = merge([xml, xlink, xmlns, aria, html], "html"), svg2 = merge([xml, xlink, xmlns, aria, svg], "svg"), pointEnd = point("end"), pointStart = point("start");
|
|
1455
1290
|
function point(type) {
|
|
1456
1291
|
return point2;
|
|
1457
1292
|
function point2(node) {
|
|
1458
|
-
|
|
1459
|
-
if (typeof point3.line
|
|
1293
|
+
let point3 = node && node.position && node.position[type] || {};
|
|
1294
|
+
if (typeof point3.line == "number" && point3.line > 0 && typeof point3.column == "number" && point3.column > 0)
|
|
1460
1295
|
return {
|
|
1461
1296
|
line: point3.line,
|
|
1462
1297
|
column: point3.column,
|
|
1463
|
-
offset: typeof point3.offset
|
|
1298
|
+
offset: typeof point3.offset == "number" && point3.offset > -1 ? point3.offset : void 0
|
|
1464
1299
|
};
|
|
1465
|
-
}
|
|
1466
1300
|
}
|
|
1467
|
-
__name(point2, "point2");
|
|
1468
1301
|
}
|
|
1469
|
-
__name(point, "point");
|
|
1470
1302
|
function position(node) {
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
if (start2 && end) {
|
|
1303
|
+
let start2 = pointStart(node), end = pointEnd(node);
|
|
1304
|
+
if (start2 && end)
|
|
1474
1305
|
return { start: start2, end };
|
|
1475
|
-
}
|
|
1476
1306
|
}
|
|
1477
|
-
__name(position, "position");
|
|
1478
1307
|
var own2 = {}.hasOwnProperty;
|
|
1479
1308
|
function zwitch(key, options) {
|
|
1480
|
-
|
|
1309
|
+
let settings = options || {};
|
|
1481
1310
|
function one(value, ...parameters) {
|
|
1482
|
-
let fn = one.invalid;
|
|
1483
|
-
const handlers2 = one.handlers;
|
|
1311
|
+
let fn = one.invalid, handlers2 = one.handlers;
|
|
1484
1312
|
if (value && own2.call(value, key)) {
|
|
1485
|
-
|
|
1313
|
+
let id = String(value[key]);
|
|
1486
1314
|
fn = own2.call(handlers2, id) ? handlers2[id] : one.unknown;
|
|
1487
1315
|
}
|
|
1488
|
-
if (fn)
|
|
1316
|
+
if (fn)
|
|
1489
1317
|
return fn.call(this, value, ...parameters);
|
|
1490
|
-
}
|
|
1491
1318
|
}
|
|
1492
|
-
|
|
1493
|
-
one.handlers = settings.handlers || {};
|
|
1494
|
-
one.invalid = settings.invalid;
|
|
1495
|
-
one.unknown = settings.unknown;
|
|
1496
|
-
return one;
|
|
1319
|
+
return one.handlers = settings.handlers || {}, one.invalid = settings.invalid, one.unknown = settings.unknown, one;
|
|
1497
1320
|
}
|
|
1498
|
-
__name(zwitch, "zwitch");
|
|
1499
1321
|
function comment(node, state) {
|
|
1500
|
-
|
|
1501
|
-
state.inherit(node, result);
|
|
1502
|
-
|
|
1503
|
-
const expression = {
|
|
1322
|
+
let result = { type: "Block", value: node.value };
|
|
1323
|
+
state.inherit(node, result), state.comments.push(result);
|
|
1324
|
+
let expression = {
|
|
1504
1325
|
type: "JSXEmptyExpression",
|
|
1505
1326
|
// @ts-expect-error: `comments` is custom.
|
|
1506
|
-
comments: [Object.assign({}, result, { leading:
|
|
1327
|
+
comments: [Object.assign({}, result, { leading: !1, trailing: !0 })]
|
|
1507
1328
|
};
|
|
1508
1329
|
state.patch(node, expression);
|
|
1509
|
-
|
|
1510
|
-
state.patch(node, container);
|
|
1511
|
-
return container;
|
|
1330
|
+
let container = { type: "JSXExpressionContainer", expression };
|
|
1331
|
+
return state.patch(node, container), container;
|
|
1512
1332
|
}
|
|
1513
|
-
__name(comment, "comment");
|
|
1514
1333
|
function stringify(values, options) {
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
(settings.padRight ? " " : "") + "," + (settings.padLeft === false ? "" : " ")
|
|
1334
|
+
let settings = options || {};
|
|
1335
|
+
return (values[values.length - 1] === "" ? [...values, ""] : values).join(
|
|
1336
|
+
(settings.padRight ? " " : "") + "," + (settings.padLeft === !1 ? "" : " ")
|
|
1519
1337
|
).trim();
|
|
1520
1338
|
}
|
|
1521
|
-
|
|
1522
|
-
var startRe = /[$_\p{ID_Start}]/u;
|
|
1523
|
-
var contRe = /[$_\u{200C}\u{200D}\p{ID_Continue}]/u;
|
|
1524
|
-
var contReJsx = /[-$_\u{200C}\u{200D}\p{ID_Continue}]/u;
|
|
1525
|
-
var nameRe = /^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u;
|
|
1526
|
-
var nameReJsx = /^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u;
|
|
1527
|
-
var emptyOptions = {};
|
|
1339
|
+
var startRe = /[$_\p{ID_Start}]/u, contRe = /[$_\u{200C}\u{200D}\p{ID_Continue}]/u, contReJsx = /[-$_\u{200C}\u{200D}\p{ID_Continue}]/u, nameRe = /^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u, nameReJsx = /^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u, emptyOptions = {};
|
|
1528
1340
|
function start(code) {
|
|
1529
|
-
return code ? startRe.test(String.fromCodePoint(code)) :
|
|
1341
|
+
return code ? startRe.test(String.fromCodePoint(code)) : !1;
|
|
1530
1342
|
}
|
|
1531
|
-
__name(start, "start");
|
|
1532
1343
|
function cont(code, options) {
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
return code ? re2.test(String.fromCodePoint(code)) : false;
|
|
1344
|
+
let re2 = (options || emptyOptions).jsx ? contReJsx : contRe;
|
|
1345
|
+
return code ? re2.test(String.fromCodePoint(code)) : !1;
|
|
1536
1346
|
}
|
|
1537
|
-
__name(cont, "cont");
|
|
1538
1347
|
function name(name2, options) {
|
|
1539
|
-
|
|
1540
|
-
const re2 = settings.jsx ? nameReJsx : nameRe;
|
|
1541
|
-
return re2.test(name2);
|
|
1348
|
+
return ((options || emptyOptions).jsx ? nameReJsx : nameRe).test(name2);
|
|
1542
1349
|
}
|
|
1543
|
-
__name(name, "name");
|
|
1544
1350
|
function stringify2(values) {
|
|
1545
1351
|
return values.join(" ").trim();
|
|
1546
1352
|
}
|
|
1547
|
-
|
|
1548
|
-
var import_index = __toESM(require_style_to_object(), 1);
|
|
1549
|
-
var style_to_object_default = import_index.default;
|
|
1550
|
-
var own3 = {}.hasOwnProperty;
|
|
1551
|
-
var cap2 = /[A-Z]/g;
|
|
1552
|
-
var dashSomething = /-([a-z])/g;
|
|
1553
|
-
var tableCellElement = /* @__PURE__ */ new Set(["td", "th"]);
|
|
1353
|
+
var import_index = __toESM(require_style_to_object(), 1), style_to_object_default = import_index.default, own3 = {}.hasOwnProperty, cap2 = /[A-Z]/g, dashSomething = /-([a-z])/g, tableCellElement = /* @__PURE__ */ new Set(["td", "th"]);
|
|
1554
1354
|
function element(node, state) {
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
schema = svg2;
|
|
1560
|
-
state.schema = schema;
|
|
1561
|
-
}
|
|
1562
|
-
const children = state.all(node);
|
|
1563
|
-
const attributes = [];
|
|
1564
|
-
let prop;
|
|
1565
|
-
let alignValue;
|
|
1566
|
-
let styleProperties;
|
|
1567
|
-
for (prop in props) {
|
|
1355
|
+
let parentSchema = state.schema, schema = parentSchema, props = node.properties || {};
|
|
1356
|
+
parentSchema.space === "html" && node.tagName.toLowerCase() === "svg" && (schema = svg2, state.schema = schema);
|
|
1357
|
+
let children = state.all(node), attributes = [], prop, alignValue, styleProperties;
|
|
1358
|
+
for (prop in props)
|
|
1568
1359
|
if (own3.call(props, prop)) {
|
|
1569
|
-
let value = props[prop];
|
|
1570
|
-
|
|
1571
|
-
let attributeValue;
|
|
1572
|
-
if (value === null || value === void 0 || value === false || typeof value === "number" && Number.isNaN(value) || !value && info.boolean) {
|
|
1360
|
+
let value = props[prop], info = find(schema, prop), attributeValue;
|
|
1361
|
+
if (value == null || value === !1 || typeof value == "number" && Number.isNaN(value) || !value && info.boolean)
|
|
1573
1362
|
continue;
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
type: "Property",
|
|
1590
|
-
method: false,
|
|
1591
|
-
shorthand: false,
|
|
1592
|
-
computed: false,
|
|
1593
|
-
key: name(cssProp) ? { type: "Identifier", name: cssProp } : { type: "Literal", value: cssProp },
|
|
1594
|
-
value: { type: "Literal", value: String(styleObject[cssProp]) },
|
|
1595
|
-
kind: "init"
|
|
1596
|
-
});
|
|
1597
|
-
}
|
|
1598
|
-
}
|
|
1599
|
-
styleProperties = cssProperties;
|
|
1600
|
-
attributeValue = {
|
|
1363
|
+
if (prop = state.elementAttributeNameCase === "react" && info.space ? hastToReact[info.property] || info.property : info.attribute, Array.isArray(value) && (value = info.commaSeparated ? stringify(value) : stringify2(value)), prop === "style") {
|
|
1364
|
+
let styleObject = typeof value == "object" ? value : parseStyle(String(value), node.tagName);
|
|
1365
|
+
state.stylePropertyNameCase === "css" && (styleObject = transformStylesToCssCasing(styleObject));
|
|
1366
|
+
let cssProperties = [], cssProp;
|
|
1367
|
+
for (cssProp in styleObject)
|
|
1368
|
+
own3.call(styleObject, cssProp) && cssProperties.push({
|
|
1369
|
+
type: "Property",
|
|
1370
|
+
method: !1,
|
|
1371
|
+
shorthand: !1,
|
|
1372
|
+
computed: !1,
|
|
1373
|
+
key: name(cssProp) ? { type: "Identifier", name: cssProp } : { type: "Literal", value: cssProp },
|
|
1374
|
+
value: { type: "Literal", value: String(styleObject[cssProp]) },
|
|
1375
|
+
kind: "init"
|
|
1376
|
+
});
|
|
1377
|
+
styleProperties = cssProperties, attributeValue = {
|
|
1601
1378
|
type: "JSXExpressionContainer",
|
|
1602
1379
|
expression: { type: "ObjectExpression", properties: cssProperties }
|
|
1603
1380
|
};
|
|
1604
|
-
} else if (value ===
|
|
1381
|
+
} else if (value === !0)
|
|
1605
1382
|
attributeValue = null;
|
|
1606
|
-
|
|
1383
|
+
else if (state.tableCellAlignToStyle && tableCellElement.has(node.tagName) && prop === "align") {
|
|
1607
1384
|
alignValue = String(value);
|
|
1608
1385
|
continue;
|
|
1609
|
-
} else
|
|
1386
|
+
} else
|
|
1610
1387
|
attributeValue = { type: "Literal", value: String(value) };
|
|
1611
|
-
}
|
|
1612
|
-
if (name(prop, { jsx: true })) {
|
|
1613
|
-
attributes.push({
|
|
1614
|
-
type: "JSXAttribute",
|
|
1615
|
-
name: { type: "JSXIdentifier", name: prop },
|
|
1616
|
-
value: attributeValue
|
|
1617
|
-
});
|
|
1618
|
-
} else {
|
|
1619
|
-
attributes.push({
|
|
1620
|
-
type: "JSXSpreadAttribute",
|
|
1621
|
-
argument: {
|
|
1622
|
-
type: "ObjectExpression",
|
|
1623
|
-
properties: [
|
|
1624
|
-
{
|
|
1625
|
-
type: "Property",
|
|
1626
|
-
method: false,
|
|
1627
|
-
shorthand: false,
|
|
1628
|
-
computed: false,
|
|
1629
|
-
key: { type: "Literal", value: String(prop) },
|
|
1630
|
-
// @ts-expect-error No need to worry about `style` (which has a
|
|
1631
|
-
// `JSXExpressionContainer` value) because that’s a valid identifier.
|
|
1632
|
-
value: attributeValue || { type: "Literal", value: true },
|
|
1633
|
-
kind: "init"
|
|
1634
|
-
}
|
|
1635
|
-
]
|
|
1636
|
-
}
|
|
1637
|
-
});
|
|
1638
|
-
}
|
|
1639
|
-
}
|
|
1640
|
-
}
|
|
1641
|
-
if (alignValue !== void 0) {
|
|
1642
|
-
if (!styleProperties) {
|
|
1643
|
-
styleProperties = [];
|
|
1644
|
-
attributes.push({
|
|
1388
|
+
name(prop, { jsx: !0 }) ? attributes.push({
|
|
1645
1389
|
type: "JSXAttribute",
|
|
1646
|
-
name: { type: "JSXIdentifier", name:
|
|
1647
|
-
value:
|
|
1648
|
-
|
|
1649
|
-
|
|
1390
|
+
name: { type: "JSXIdentifier", name: prop },
|
|
1391
|
+
value: attributeValue
|
|
1392
|
+
}) : attributes.push({
|
|
1393
|
+
type: "JSXSpreadAttribute",
|
|
1394
|
+
argument: {
|
|
1395
|
+
type: "ObjectExpression",
|
|
1396
|
+
properties: [
|
|
1397
|
+
{
|
|
1398
|
+
type: "Property",
|
|
1399
|
+
method: !1,
|
|
1400
|
+
shorthand: !1,
|
|
1401
|
+
computed: !1,
|
|
1402
|
+
key: { type: "Literal", value: String(prop) },
|
|
1403
|
+
// @ts-expect-error No need to worry about `style` (which has a
|
|
1404
|
+
// `JSXExpressionContainer` value) because that’s a valid identifier.
|
|
1405
|
+
value: attributeValue || { type: "Literal", value: !0 },
|
|
1406
|
+
kind: "init"
|
|
1407
|
+
}
|
|
1408
|
+
]
|
|
1650
1409
|
}
|
|
1651
1410
|
});
|
|
1652
1411
|
}
|
|
1653
|
-
|
|
1412
|
+
if (alignValue !== void 0) {
|
|
1413
|
+
styleProperties || (styleProperties = [], attributes.push({
|
|
1414
|
+
type: "JSXAttribute",
|
|
1415
|
+
name: { type: "JSXIdentifier", name: "style" },
|
|
1416
|
+
value: {
|
|
1417
|
+
type: "JSXExpressionContainer",
|
|
1418
|
+
expression: { type: "ObjectExpression", properties: styleProperties }
|
|
1419
|
+
}
|
|
1420
|
+
}));
|
|
1421
|
+
let cssProp = state.stylePropertyNameCase === "css" ? transformStyleToCssCasing("textAlign") : "textAlign";
|
|
1654
1422
|
styleProperties.push({
|
|
1655
1423
|
type: "Property",
|
|
1656
|
-
method:
|
|
1657
|
-
shorthand:
|
|
1658
|
-
computed:
|
|
1424
|
+
method: !1,
|
|
1425
|
+
shorthand: !1,
|
|
1426
|
+
computed: !1,
|
|
1659
1427
|
key: name(cssProp) ? { type: "Identifier", name: cssProp } : { type: "Literal", value: cssProp },
|
|
1660
1428
|
value: { type: "Literal", value: alignValue },
|
|
1661
1429
|
kind: "init"
|
|
1662
1430
|
});
|
|
1663
1431
|
}
|
|
1664
1432
|
state.schema = parentSchema;
|
|
1665
|
-
|
|
1433
|
+
let result = {
|
|
1666
1434
|
type: "JSXElement",
|
|
1667
1435
|
openingElement: {
|
|
1668
1436
|
type: "JSXOpeningElement",
|
|
@@ -1676,214 +1444,125 @@ function element(node, state) {
|
|
|
1676
1444
|
} : null,
|
|
1677
1445
|
children
|
|
1678
1446
|
};
|
|
1679
|
-
state.inherit(node, result);
|
|
1680
|
-
return result;
|
|
1447
|
+
return state.inherit(node, result), result;
|
|
1681
1448
|
}
|
|
1682
|
-
__name(element, "element");
|
|
1683
1449
|
function parseStyle(value, tagName) {
|
|
1684
|
-
|
|
1450
|
+
let result = {};
|
|
1685
1451
|
try {
|
|
1686
1452
|
style_to_object_default(value, iterator);
|
|
1687
1453
|
} catch (error) {
|
|
1688
|
-
|
|
1454
|
+
let cause = (
|
|
1689
1455
|
/** @type {Error} */
|
|
1690
1456
|
error
|
|
1691
1457
|
);
|
|
1692
|
-
|
|
1458
|
+
throw new Error(
|
|
1693
1459
|
"Could not parse `style` attribute on `" + tagName + "`",
|
|
1694
1460
|
{ cause }
|
|
1695
1461
|
);
|
|
1696
|
-
throw exception;
|
|
1697
1462
|
}
|
|
1698
1463
|
return result;
|
|
1699
1464
|
function iterator(name2, value2) {
|
|
1700
1465
|
let key = name2;
|
|
1701
|
-
|
|
1702
|
-
if (key.slice(0, 4) === "-ms-")
|
|
1703
|
-
key = "ms-" + key.slice(4);
|
|
1704
|
-
key = key.replace(dashSomething, toCamel);
|
|
1705
|
-
}
|
|
1706
|
-
result[key] = value2;
|
|
1466
|
+
key.slice(0, 2) !== "--" && (key.slice(0, 4) === "-ms-" && (key = "ms-" + key.slice(4)), key = key.replace(dashSomething, toCamel)), result[key] = value2;
|
|
1707
1467
|
}
|
|
1708
|
-
__name(iterator, "iterator");
|
|
1709
1468
|
}
|
|
1710
|
-
__name(parseStyle, "parseStyle");
|
|
1711
1469
|
function transformStylesToCssCasing(domCasing) {
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
if (own3.call(domCasing, from)) {
|
|
1716
|
-
cssCasing[transformStyleToCssCasing(from)] = domCasing[from];
|
|
1717
|
-
}
|
|
1718
|
-
}
|
|
1470
|
+
let cssCasing = {}, from;
|
|
1471
|
+
for (from in domCasing)
|
|
1472
|
+
own3.call(domCasing, from) && (cssCasing[transformStyleToCssCasing(from)] = domCasing[from]);
|
|
1719
1473
|
return cssCasing;
|
|
1720
1474
|
}
|
|
1721
|
-
__name(transformStylesToCssCasing, "transformStylesToCssCasing");
|
|
1722
1475
|
function transformStyleToCssCasing(from) {
|
|
1723
1476
|
let to = from.replace(cap2, toDash);
|
|
1724
|
-
|
|
1725
|
-
to = "-" + to;
|
|
1726
|
-
return to;
|
|
1477
|
+
return to.slice(0, 3) === "ms-" && (to = "-" + to), to;
|
|
1727
1478
|
}
|
|
1728
|
-
__name(transformStyleToCssCasing, "transformStyleToCssCasing");
|
|
1729
1479
|
function toCamel(_, $1) {
|
|
1730
1480
|
return $1.toUpperCase();
|
|
1731
1481
|
}
|
|
1732
|
-
__name(toCamel, "toCamel");
|
|
1733
1482
|
function toDash($0) {
|
|
1734
1483
|
return "-" + $0.toLowerCase();
|
|
1735
1484
|
}
|
|
1736
|
-
|
|
1737
|
-
var own4 = {}.hasOwnProperty;
|
|
1738
|
-
var emptyComments = [];
|
|
1485
|
+
var own4 = {}.hasOwnProperty, emptyComments = [];
|
|
1739
1486
|
function attachComments(tree, comments) {
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
walk(tree, { comments: list, index: 0 });
|
|
1487
|
+
let list = comments ? [...comments].sort(compare) : emptyComments;
|
|
1488
|
+
list.length > 0 && walk(tree, { comments: list, index: 0 });
|
|
1743
1489
|
}
|
|
1744
|
-
__name(attachComments, "attachComments");
|
|
1745
1490
|
function walk(node, state) {
|
|
1746
|
-
if (state.index === state.comments.length)
|
|
1491
|
+
if (state.index === state.comments.length)
|
|
1747
1492
|
return;
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
const comments = [];
|
|
1751
|
-
let key;
|
|
1752
|
-
for (key in node) {
|
|
1493
|
+
let children = [], comments = [], key;
|
|
1494
|
+
for (key in node)
|
|
1753
1495
|
if (own4.call(node, key)) {
|
|
1754
|
-
|
|
1755
|
-
if (value && typeof value
|
|
1496
|
+
let value = node[key];
|
|
1497
|
+
if (value && typeof value == "object" && key !== "comments")
|
|
1756
1498
|
if (Array.isArray(value)) {
|
|
1757
1499
|
let index2 = -1;
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
}
|
|
1762
|
-
}
|
|
1763
|
-
} else if (typeof value.type === "string") {
|
|
1764
|
-
children.push(value);
|
|
1765
|
-
}
|
|
1766
|
-
}
|
|
1500
|
+
for (; ++index2 < value.length; )
|
|
1501
|
+
value[index2] && typeof value[index2].type == "string" && children.push(value[index2]);
|
|
1502
|
+
} else typeof value.type == "string" && children.push(value);
|
|
1767
1503
|
}
|
|
1768
|
-
}
|
|
1769
|
-
children.sort(compare);
|
|
1770
|
-
comments.push(...slice(state, node, false, { leading: true, trailing: false }));
|
|
1504
|
+
children.sort(compare), comments.push(...slice(state, node, !1, { leading: !0, trailing: !1 }));
|
|
1771
1505
|
let index = -1;
|
|
1772
|
-
|
|
1506
|
+
for (; ++index < children.length; )
|
|
1773
1507
|
walk(children[index], state);
|
|
1774
|
-
}
|
|
1775
1508
|
comments.push(
|
|
1776
|
-
...slice(state, node,
|
|
1777
|
-
leading:
|
|
1509
|
+
...slice(state, node, !0, {
|
|
1510
|
+
leading: !1,
|
|
1778
1511
|
trailing: children.length > 0
|
|
1779
1512
|
})
|
|
1780
|
-
);
|
|
1781
|
-
if (comments.length > 0) {
|
|
1782
|
-
node.comments = comments;
|
|
1783
|
-
}
|
|
1513
|
+
), comments.length > 0 && (node.comments = comments);
|
|
1784
1514
|
}
|
|
1785
|
-
__name(walk, "walk");
|
|
1786
1515
|
function slice(state, node, compareEnd, fields) {
|
|
1787
|
-
|
|
1788
|
-
|
|
1516
|
+
let result = [];
|
|
1517
|
+
for (; state.comments[state.index] && compare(state.comments[state.index], node, compareEnd) < 1; )
|
|
1789
1518
|
result.push(Object.assign({}, state.comments[state.index++], fields));
|
|
1790
|
-
}
|
|
1791
1519
|
return result;
|
|
1792
1520
|
}
|
|
1793
|
-
__name(slice, "slice");
|
|
1794
1521
|
function compare(left, right, compareEnd) {
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
return left.range[0] - right.range[compareEnd ? 1 : 0];
|
|
1798
|
-
}
|
|
1799
|
-
if (left.loc && left.loc.start && right.loc && right.loc[field]) {
|
|
1800
|
-
return left.loc.start.line - right.loc[field].line || left.loc.start.column - right.loc[field].column;
|
|
1801
|
-
}
|
|
1802
|
-
if ("start" in left && field in right) {
|
|
1803
|
-
return left.start - right[field];
|
|
1804
|
-
}
|
|
1805
|
-
return Number.NaN;
|
|
1522
|
+
let field = compareEnd ? "end" : "start";
|
|
1523
|
+
return left.range && right.range ? left.range[0] - right.range[compareEnd ? 1 : 0] : left.loc && left.loc.start && right.loc && right.loc[field] ? left.loc.start.line - right.loc[field].line || left.loc.start.column - right.loc[field].column : "start" in left && field in right ? left.start - right[field] : Number.NaN;
|
|
1806
1524
|
}
|
|
1807
|
-
__name(compare, "compare");
|
|
1808
1525
|
function mdxExpression(node, state) {
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
let expression;
|
|
1812
|
-
|
|
1813
|
-
state.comments.push(...comments);
|
|
1814
|
-
attachComments(estree, estree.comments);
|
|
1815
|
-
expression = estree.body[0] && estree.body[0].type === "ExpressionStatement" && estree.body[0].expression || void 0;
|
|
1816
|
-
}
|
|
1817
|
-
if (!expression) {
|
|
1818
|
-
expression = { type: "JSXEmptyExpression" };
|
|
1819
|
-
state.patch(node, expression);
|
|
1820
|
-
}
|
|
1821
|
-
const result = { type: "JSXExpressionContainer", expression };
|
|
1822
|
-
state.inherit(node, result);
|
|
1823
|
-
return result;
|
|
1526
|
+
let estree = node.data && node.data.estree, comments = estree && estree.comments || [], expression;
|
|
1527
|
+
estree && (state.comments.push(...comments), attachComments(estree, estree.comments), expression = estree.body[0] && estree.body[0].type === "ExpressionStatement" && estree.body[0].expression || void 0), expression || (expression = { type: "JSXEmptyExpression" }, state.patch(node, expression));
|
|
1528
|
+
let result = { type: "JSXExpressionContainer", expression };
|
|
1529
|
+
return state.inherit(node, result), result;
|
|
1824
1530
|
}
|
|
1825
|
-
__name(mdxExpression, "mdxExpression");
|
|
1826
1531
|
function mdxJsxElement(node, state) {
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
schema = svg2;
|
|
1833
|
-
state.schema = schema;
|
|
1834
|
-
}
|
|
1835
|
-
const children = state.all(node);
|
|
1836
|
-
const attributes = [];
|
|
1837
|
-
while (++index < attrs.length) {
|
|
1838
|
-
const attr = attrs[index];
|
|
1839
|
-
const value = attr.value;
|
|
1840
|
-
let attributeValue;
|
|
1532
|
+
let parentSchema = state.schema, schema = parentSchema, attrs = node.attributes || [], index = -1;
|
|
1533
|
+
node.name && parentSchema.space === "html" && node.name.toLowerCase() === "svg" && (schema = svg2, state.schema = schema);
|
|
1534
|
+
let children = state.all(node), attributes = [];
|
|
1535
|
+
for (; ++index < attrs.length; ) {
|
|
1536
|
+
let attr = attrs[index], value = attr.value, attributeValue;
|
|
1841
1537
|
if (attr.type === "mdxJsxAttribute") {
|
|
1842
|
-
if (value
|
|
1538
|
+
if (value == null)
|
|
1843
1539
|
attributeValue = null;
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
let expression;
|
|
1848
|
-
if (estree) {
|
|
1849
|
-
state.comments.push(...comments);
|
|
1850
|
-
attachComments(estree, estree.comments);
|
|
1851
|
-
expression = estree.body[0] && estree.body[0].type === "ExpressionStatement" && estree.body[0].expression || void 0;
|
|
1852
|
-
}
|
|
1853
|
-
attributeValue = {
|
|
1540
|
+
else if (typeof value == "object") {
|
|
1541
|
+
let estree = value.data && value.data.estree, comments = estree && estree.comments || [], expression;
|
|
1542
|
+
estree && (state.comments.push(...comments), attachComments(estree, estree.comments), expression = estree.body[0] && estree.body[0].type === "ExpressionStatement" && estree.body[0].expression || void 0), attributeValue = {
|
|
1854
1543
|
type: "JSXExpressionContainer",
|
|
1855
1544
|
expression: expression || { type: "JSXEmptyExpression" }
|
|
1856
|
-
};
|
|
1857
|
-
|
|
1858
|
-
} else {
|
|
1545
|
+
}, state.inherit(value, attributeValue);
|
|
1546
|
+
} else
|
|
1859
1547
|
attributeValue = { type: "Literal", value: String(value) };
|
|
1860
|
-
|
|
1861
|
-
const attribute = {
|
|
1548
|
+
let attribute = {
|
|
1862
1549
|
type: "JSXAttribute",
|
|
1863
1550
|
name: state.createJsxAttributeName(attr.name),
|
|
1864
1551
|
value: attributeValue
|
|
1865
1552
|
};
|
|
1866
|
-
state.inherit(attr, attribute);
|
|
1867
|
-
attributes.push(attribute);
|
|
1553
|
+
state.inherit(attr, attribute), attributes.push(attribute);
|
|
1868
1554
|
} else {
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
let
|
|
1872
|
-
if (estree) {
|
|
1873
|
-
state.comments.push(...comments);
|
|
1874
|
-
attachComments(estree, estree.comments);
|
|
1875
|
-
argumentValue = estree.body[0] && estree.body[0].type === "ExpressionStatement" && estree.body[0].expression && estree.body[0].expression.type === "ObjectExpression" && estree.body[0].expression.properties && estree.body[0].expression.properties[0] && estree.body[0].expression.properties[0].type === "SpreadElement" && estree.body[0].expression.properties[0].argument || void 0;
|
|
1876
|
-
}
|
|
1877
|
-
const attribute = {
|
|
1555
|
+
let estree = attr.data && attr.data.estree, comments = estree && estree.comments || [], argumentValue;
|
|
1556
|
+
estree && (state.comments.push(...comments), attachComments(estree, estree.comments), argumentValue = estree.body[0] && estree.body[0].type === "ExpressionStatement" && estree.body[0].expression && estree.body[0].expression.type === "ObjectExpression" && estree.body[0].expression.properties && estree.body[0].expression.properties[0] && estree.body[0].expression.properties[0].type === "SpreadElement" && estree.body[0].expression.properties[0].argument || void 0);
|
|
1557
|
+
let attribute = {
|
|
1878
1558
|
type: "JSXSpreadAttribute",
|
|
1879
1559
|
argument: argumentValue || { type: "ObjectExpression", properties: [] }
|
|
1880
1560
|
};
|
|
1881
|
-
state.inherit(attr, attribute);
|
|
1882
|
-
attributes.push(attribute);
|
|
1561
|
+
state.inherit(attr, attribute), attributes.push(attribute);
|
|
1883
1562
|
}
|
|
1884
1563
|
}
|
|
1885
1564
|
state.schema = parentSchema;
|
|
1886
|
-
|
|
1565
|
+
let result = node.name ? {
|
|
1887
1566
|
type: "JSXElement",
|
|
1888
1567
|
openingElement: {
|
|
1889
1568
|
type: "JSXOpeningElement",
|
|
@@ -1902,67 +1581,42 @@ function mdxJsxElement(node, state) {
|
|
|
1902
1581
|
closingFragment: { type: "JSXClosingFragment" },
|
|
1903
1582
|
children
|
|
1904
1583
|
};
|
|
1905
|
-
state.inherit(node, result);
|
|
1906
|
-
return result;
|
|
1584
|
+
return state.inherit(node, result), result;
|
|
1907
1585
|
}
|
|
1908
|
-
__name(mdxJsxElement, "mdxJsxElement");
|
|
1909
1586
|
function mdxjsEsm(node, state) {
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
if (estree) {
|
|
1913
|
-
state.comments.push(...comments);
|
|
1914
|
-
attachComments(estree, comments);
|
|
1915
|
-
state.esm.push(...estree.body);
|
|
1916
|
-
}
|
|
1587
|
+
let estree = node.data && node.data.estree, comments = estree && estree.comments || [];
|
|
1588
|
+
estree && (state.comments.push(...comments), attachComments(estree, comments), state.esm.push(...estree.body));
|
|
1917
1589
|
}
|
|
1918
|
-
__name(mdxjsEsm, "mdxjsEsm");
|
|
1919
1590
|
var re = /[ \t\n\f\r]/g;
|
|
1920
1591
|
function whitespace(thing) {
|
|
1921
|
-
return typeof thing
|
|
1592
|
+
return typeof thing == "object" ? thing.type === "text" ? empty(thing.value) : !1 : empty(thing);
|
|
1922
1593
|
}
|
|
1923
|
-
__name(whitespace, "whitespace");
|
|
1924
1594
|
function empty(value) {
|
|
1925
1595
|
return value.replace(re, "") === "";
|
|
1926
1596
|
}
|
|
1927
|
-
__name(empty, "empty");
|
|
1928
1597
|
function root(node, state) {
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
while (++index < children.length) {
|
|
1934
|
-
const child = children[index];
|
|
1935
|
-
if (child.type === "JSXExpressionContainer" && child.expression.type === "Literal" && whitespace(String(child.expression.value))) {
|
|
1936
|
-
if (queue)
|
|
1937
|
-
queue.push(child);
|
|
1938
|
-
} else {
|
|
1939
|
-
if (queue)
|
|
1940
|
-
cleanChildren.push(...queue);
|
|
1941
|
-
cleanChildren.push(child);
|
|
1942
|
-
queue = [];
|
|
1943
|
-
}
|
|
1598
|
+
let children = state.all(node), cleanChildren = [], index = -1, queue;
|
|
1599
|
+
for (; ++index < children.length; ) {
|
|
1600
|
+
let child = children[index];
|
|
1601
|
+
child.type === "JSXExpressionContainer" && child.expression.type === "Literal" && whitespace(String(child.expression.value)) ? queue && queue.push(child) : (queue && cleanChildren.push(...queue), cleanChildren.push(child), queue = []);
|
|
1944
1602
|
}
|
|
1945
|
-
|
|
1603
|
+
let result = {
|
|
1946
1604
|
type: "JSXFragment",
|
|
1947
1605
|
openingFragment: { type: "JSXOpeningFragment" },
|
|
1948
1606
|
closingFragment: { type: "JSXClosingFragment" },
|
|
1949
1607
|
children: cleanChildren
|
|
1950
1608
|
};
|
|
1951
|
-
state.inherit(node, result);
|
|
1952
|
-
return result;
|
|
1609
|
+
return state.inherit(node, result), result;
|
|
1953
1610
|
}
|
|
1954
|
-
__name(root, "root");
|
|
1955
1611
|
function text(node, state) {
|
|
1956
|
-
|
|
1612
|
+
let value = String(node.value || "");
|
|
1957
1613
|
if (value) {
|
|
1958
|
-
|
|
1614
|
+
let result = { type: "Literal", value };
|
|
1959
1615
|
state.inherit(node, result);
|
|
1960
|
-
|
|
1961
|
-
state.patch(node, container);
|
|
1962
|
-
return container;
|
|
1616
|
+
let container = { type: "JSXExpressionContainer", expression: result };
|
|
1617
|
+
return state.patch(node, container), container;
|
|
1963
1618
|
}
|
|
1964
1619
|
}
|
|
1965
|
-
__name(text, "text");
|
|
1966
1620
|
var handlers = {
|
|
1967
1621
|
comment,
|
|
1968
1622
|
doctype: ignore,
|
|
@@ -1977,11 +1631,9 @@ var handlers = {
|
|
|
1977
1631
|
};
|
|
1978
1632
|
function ignore() {
|
|
1979
1633
|
}
|
|
1980
|
-
|
|
1981
|
-
var own5 = {}.hasOwnProperty;
|
|
1982
|
-
var tableElements = /* @__PURE__ */ new Set(["table", "tbody", "thead", "tfoot", "tr"]);
|
|
1634
|
+
var own5 = {}.hasOwnProperty, tableElements = /* @__PURE__ */ new Set(["table", "tbody", "thead", "tfoot", "tr"]);
|
|
1983
1635
|
function createState(options) {
|
|
1984
|
-
|
|
1636
|
+
let one = zwitch("type", {
|
|
1985
1637
|
invalid,
|
|
1986
1638
|
unknown,
|
|
1987
1639
|
handlers: { ...handlers, ...options.handlers }
|
|
@@ -1991,7 +1643,7 @@ function createState(options) {
|
|
|
1991
1643
|
elementAttributeNameCase: options.elementAttributeNameCase || "react",
|
|
1992
1644
|
schema: options.space === "svg" ? svg2 : html2,
|
|
1993
1645
|
stylePropertyNameCase: options.stylePropertyNameCase || "dom",
|
|
1994
|
-
tableCellAlignToStyle: options.tableCellAlignToStyle !==
|
|
1646
|
+
tableCellAlignToStyle: options.tableCellAlignToStyle !== !1,
|
|
1995
1647
|
// Results.
|
|
1996
1648
|
comments: [],
|
|
1997
1649
|
esm: [],
|
|
@@ -2006,103 +1658,66 @@ function createState(options) {
|
|
|
2006
1658
|
function handle(node) {
|
|
2007
1659
|
return one(node, this);
|
|
2008
1660
|
}
|
|
2009
|
-
__name(handle, "handle");
|
|
2010
1661
|
}
|
|
2011
|
-
__name(createState, "createState");
|
|
2012
1662
|
function invalid(value) {
|
|
2013
1663
|
throw new Error("Cannot handle value `" + value + "`, expected node");
|
|
2014
1664
|
}
|
|
2015
|
-
__name(invalid, "invalid");
|
|
2016
1665
|
function unknown(node) {
|
|
2017
|
-
|
|
2018
|
-
ok("type" in node);
|
|
2019
|
-
throw new Error("Cannot handle unknown node `" + node.type + "`");
|
|
1666
|
+
throw "type" in node, new Error("Cannot handle unknown node `" + node.type + "`");
|
|
2020
1667
|
}
|
|
2021
|
-
__name(unknown, "unknown");
|
|
2022
1668
|
function all(parent) {
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
const child = children[index];
|
|
2029
|
-
if (ignoreLineBreak && child.type === "text" && child.value === "\n") {
|
|
1669
|
+
let children = parent.children || [], index = -1, results = [], ignoreLineBreak = this.schema.space === "html" && parent.type === "element" && tableElements.has(parent.tagName.toLowerCase());
|
|
1670
|
+
for (; ++index < children.length; ) {
|
|
1671
|
+
let child = children[index];
|
|
1672
|
+
if (ignoreLineBreak && child.type === "text" && child.value === `
|
|
1673
|
+
`)
|
|
2030
1674
|
continue;
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
if (Array.isArray(result)) {
|
|
2034
|
-
results.push(...result);
|
|
2035
|
-
} else if (result) {
|
|
2036
|
-
results.push(result);
|
|
2037
|
-
}
|
|
1675
|
+
let result = this.handle(child);
|
|
1676
|
+
Array.isArray(result) ? results.push(...result) : result && results.push(result);
|
|
2038
1677
|
}
|
|
2039
1678
|
return results;
|
|
2040
1679
|
}
|
|
2041
|
-
__name(all, "all");
|
|
2042
1680
|
function inherit(from, to) {
|
|
2043
|
-
|
|
1681
|
+
let left = (
|
|
2044
1682
|
/** @type {Record<string, unknown> | undefined} */
|
|
2045
1683
|
from.data
|
|
2046
|
-
);
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
for (key in left) {
|
|
2052
|
-
if (own5.call(left, key) && key !== "estree") {
|
|
2053
|
-
if (!right)
|
|
2054
|
-
right = {};
|
|
2055
|
-
right[key] = left[key];
|
|
2056
|
-
}
|
|
2057
|
-
}
|
|
2058
|
-
if (right) {
|
|
2059
|
-
to.data = right;
|
|
2060
|
-
}
|
|
1684
|
+
), right, key;
|
|
1685
|
+
if (patch(from, to), left) {
|
|
1686
|
+
for (key in left)
|
|
1687
|
+
own5.call(left, key) && key !== "estree" && (right || (right = {}), right[key] = left[key]);
|
|
1688
|
+
right && (to.data = right);
|
|
2061
1689
|
}
|
|
2062
1690
|
}
|
|
2063
|
-
__name(inherit, "inherit");
|
|
2064
1691
|
function patch(from, to) {
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
start: { line: p.start.line, column: p.start.column - 1 },
|
|
2071
|
-
end: { line: p.end.line, column: p.end.column - 1 }
|
|
2072
|
-
};
|
|
2073
|
-
to.range = [p.start.offset, p.end.offset];
|
|
2074
|
-
}
|
|
1692
|
+
let p = position(from);
|
|
1693
|
+
p && p.start.offset !== void 0 && p.end.offset !== void 0 && (to.start = p.start.offset, to.end = p.end.offset, to.loc = {
|
|
1694
|
+
start: { line: p.start.line, column: p.start.column - 1 },
|
|
1695
|
+
end: { line: p.end.line, column: p.end.column - 1 }
|
|
1696
|
+
}, to.range = [p.start.offset, p.end.offset]);
|
|
2075
1697
|
}
|
|
2076
|
-
__name(patch, "patch");
|
|
2077
1698
|
function createJsxAttributeName(name2) {
|
|
2078
|
-
|
|
2079
|
-
if (node.type === "JSXMemberExpression")
|
|
1699
|
+
let node = createJsxNameFromString(name2);
|
|
1700
|
+
if (node.type === "JSXMemberExpression")
|
|
2080
1701
|
throw new Error("Member expressions in attribute names are not supported");
|
|
2081
|
-
}
|
|
2082
1702
|
return node;
|
|
2083
1703
|
}
|
|
2084
|
-
__name(createJsxAttributeName, "createJsxAttributeName");
|
|
2085
1704
|
function createJsxElementName(name2) {
|
|
2086
1705
|
return createJsxNameFromString(name2);
|
|
2087
1706
|
}
|
|
2088
|
-
__name(createJsxElementName, "createJsxElementName");
|
|
2089
1707
|
function createJsxNameFromString(name2) {
|
|
2090
1708
|
if (name2.includes(".")) {
|
|
2091
|
-
|
|
2092
|
-
let part = names.shift();
|
|
2093
|
-
ok(part, "Expected `part` to be defined");
|
|
1709
|
+
let names = name2.split("."), part = names.shift();
|
|
2094
1710
|
let node = { type: "JSXIdentifier", name: part };
|
|
2095
|
-
|
|
1711
|
+
for (; part = names.shift(); )
|
|
2096
1712
|
node = {
|
|
2097
1713
|
type: "JSXMemberExpression",
|
|
2098
1714
|
object: node,
|
|
2099
1715
|
property: { type: "JSXIdentifier", name: part }
|
|
2100
1716
|
};
|
|
2101
|
-
}
|
|
2102
1717
|
return node;
|
|
2103
1718
|
}
|
|
2104
1719
|
if (name2.includes(":")) {
|
|
2105
|
-
|
|
1720
|
+
let parts = name2.split(":");
|
|
2106
1721
|
return {
|
|
2107
1722
|
type: "JSXNamespacedName",
|
|
2108
1723
|
namespace: { type: "JSXIdentifier", name: parts[0] },
|
|
@@ -2111,43 +1726,32 @@ function createJsxNameFromString(name2) {
|
|
|
2111
1726
|
}
|
|
2112
1727
|
return { type: "JSXIdentifier", name: name2 };
|
|
2113
1728
|
}
|
|
2114
|
-
__name(createJsxNameFromString, "createJsxNameFromString");
|
|
2115
1729
|
function toEstree(tree, options) {
|
|
2116
|
-
|
|
2117
|
-
let result = state.handle(tree);
|
|
2118
|
-
const body = state.esm;
|
|
1730
|
+
let state = createState(options || {}), result = state.handle(tree), body = state.esm;
|
|
2119
1731
|
if (result) {
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
}
|
|
2129
|
-
const statement = { type: "ExpressionStatement", expression: result };
|
|
2130
|
-
state.patch(tree, statement);
|
|
2131
|
-
body.push(statement);
|
|
1732
|
+
result.type !== "JSXFragment" && result.type !== "JSXElement" && (result = {
|
|
1733
|
+
type: "JSXFragment",
|
|
1734
|
+
openingFragment: { type: "JSXOpeningFragment" },
|
|
1735
|
+
closingFragment: { type: "JSXClosingFragment" },
|
|
1736
|
+
children: [result]
|
|
1737
|
+
}, state.patch(tree, result));
|
|
1738
|
+
let statement = { type: "ExpressionStatement", expression: result };
|
|
1739
|
+
state.patch(tree, statement), body.push(statement);
|
|
2132
1740
|
}
|
|
2133
|
-
|
|
1741
|
+
let program = {
|
|
2134
1742
|
type: "Program",
|
|
2135
1743
|
body,
|
|
2136
1744
|
sourceType: "module",
|
|
2137
1745
|
comments: state.comments
|
|
2138
1746
|
};
|
|
2139
|
-
state.patch(tree, program);
|
|
2140
|
-
return program;
|
|
1747
|
+
return state.patch(tree, program), program;
|
|
2141
1748
|
}
|
|
2142
|
-
__name(toEstree, "toEstree");
|
|
2143
1749
|
|
|
2144
1750
|
export {
|
|
2145
1751
|
__require2 as __require,
|
|
2146
1752
|
__commonJS,
|
|
2147
1753
|
__export,
|
|
2148
1754
|
__toESM,
|
|
2149
|
-
ok,
|
|
2150
|
-
unreachable,
|
|
2151
1755
|
pointEnd,
|
|
2152
1756
|
pointStart,
|
|
2153
1757
|
position,
|