@kimdw-rtk/ui 0.0.7 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/dist/_virtual/cjs.js +5 -0
  2. package/dist/_virtual/cssesc.js +5 -0
  3. package/dist/_virtual/jsx-runtime.js +5 -0
  4. package/dist/_virtual/jsx-runtime2.js +3 -0
  5. package/dist/_virtual/picocolors.js +5 -0
  6. package/dist/_virtual/picocolors2.js +3 -0
  7. package/dist/_virtual/react-jsx-runtime.development.js +3 -0
  8. package/dist/_virtual/react-jsx-runtime.production.min.js +3 -0
  9. package/dist/components/Accordion/Accordion.css.js +8 -5
  10. package/dist/components/Accordion/Accordion.js +13 -8
  11. package/dist/components/Accordion/AccordionContent.css.js +7 -4
  12. package/dist/components/Accordion/AccordionContent.js +18 -16
  13. package/dist/components/Accordion/AccordionContext.js +5 -2
  14. package/dist/components/Accordion/AccordionTrigger.css.js +7 -4
  15. package/dist/components/Accordion/AccordionTrigger.js +9 -7
  16. package/dist/components/Alert/index.js +49 -5
  17. package/dist/components/Box/Box.css.js +6 -3
  18. package/dist/components/Box/index.js +13 -7
  19. package/dist/components/Button/Button.css.js +11 -8
  20. package/dist/components/Button/index.js +57 -11
  21. package/dist/components/Card/Card.css.js +9 -6
  22. package/dist/components/Card/Card.js +14 -7
  23. package/dist/components/Card/CardContent.css.js +6 -3
  24. package/dist/components/Card/CardContent.js +12 -6
  25. package/dist/components/Card/CardInteraction.css.js +5 -2
  26. package/dist/components/Card/CardInteraction.js +53 -8
  27. package/dist/components/Card/CardThumbnail.css.js +5 -2
  28. package/dist/components/Card/CardThumbnail.js +12 -6
  29. package/dist/components/Chip/Chip.css.js +9 -6
  30. package/dist/components/Chip/Chip.js +14 -7
  31. package/dist/components/Confirm/index.js +48 -5
  32. package/dist/components/Dialog/Dialog.css.js +7 -4
  33. package/dist/components/Dialog/Dialog.js +51 -7
  34. package/dist/components/Dialog/DialogContent.css.js +8 -5
  35. package/dist/components/Dialog/DialogContent.js +51 -7
  36. package/dist/components/Dialog/DialogFooter.js +50 -6
  37. package/dist/components/Dialog/DialogHeader.css.js +7 -4
  38. package/dist/components/Dialog/DialogHeader.js +52 -8
  39. package/dist/components/Navigation/NavigationAside.css.js +5 -2
  40. package/dist/components/Navigation/NavigationAside.js +12 -7
  41. package/dist/components/Navigation/NavigationBar.css.js +8 -5
  42. package/dist/components/Navigation/NavigationBar.js +14 -7
  43. package/dist/components/Navigation/NavigationContainer.css.js +5 -2
  44. package/dist/components/Navigation/NavigationContainer.js +12 -6
  45. package/dist/components/Navigation/NavigationDrawer.css.js +9 -6
  46. package/dist/components/Navigation/NavigationDrawer.js +52 -8
  47. package/dist/components/Navigation/NavigationItem.css.js +9 -5
  48. package/dist/components/Navigation/NavigationItem.js +12 -6
  49. package/dist/components/Navigation/NavigationLogo.css.js +5 -2
  50. package/dist/components/Navigation/NavigationLogo.js +12 -6
  51. package/dist/components/Navigation/NavigationMenu.css.js +8 -5
  52. package/dist/components/Navigation/NavigationMenu.js +14 -7
  53. package/dist/components/Range/Range.css.js +12 -9
  54. package/dist/components/Range/Range.js +17 -11
  55. package/dist/components/ScrollArea/ScrollArea.css.js +10 -7
  56. package/dist/components/ScrollArea/ScrollArea.js +16 -10
  57. package/dist/components/Select/Select.css.js +6 -3
  58. package/dist/components/Select/Select.js +18 -12
  59. package/dist/components/Select/SelectContext.js +5 -2
  60. package/dist/components/Select/SelectOption.css.js +6 -3
  61. package/dist/components/Select/SelectOption.js +8 -6
  62. package/dist/components/Select/SelectOptionList.css.js +7 -4
  63. package/dist/components/Select/SelectOptionList.js +12 -8
  64. package/dist/components/Select/SelectTrigger.css.js +9 -6
  65. package/dist/components/Select/SelectTrigger.js +14 -9
  66. package/dist/components/Skeleton/Skeleton.css.js +7 -4
  67. package/dist/components/Skeleton/index.js +12 -6
  68. package/dist/components/Table/Table.css.js +6 -3
  69. package/dist/components/Table/Table.js +14 -7
  70. package/dist/components/Table/TableBody.js +11 -5
  71. package/dist/components/Table/TableCell.css.js +8 -5
  72. package/dist/components/Table/TableCell.js +13 -7
  73. package/dist/components/Table/TableHead.css.js +6 -3
  74. package/dist/components/Table/TableHead.js +13 -7
  75. package/dist/components/Table/TableHeader.js +11 -5
  76. package/dist/components/Table/TableRow.css.js +5 -2
  77. package/dist/components/Table/TableRow.js +12 -6
  78. package/dist/components/Tabs/Tabs.js +12 -7
  79. package/dist/components/Tabs/TabsContent.js +12 -7
  80. package/dist/components/Tabs/TabsList.css.js +6 -3
  81. package/dist/components/Tabs/TabsList.js +12 -6
  82. package/dist/components/Tabs/TabsProvider.js +5 -3
  83. package/dist/components/Tabs/TabsTrigger.css.js +6 -3
  84. package/dist/components/Tabs/TabsTrigger.js +13 -8
  85. package/dist/components/TextField/TextField.css.js +9 -6
  86. package/dist/components/TextField/index.js +14 -7
  87. package/dist/components/Toast/Toast.css.js +9 -6
  88. package/dist/components/Toast/index.js +54 -9
  89. package/dist/components/Typography/Typography.css.js +5 -2
  90. package/dist/components/Typography/index.js +13 -8
  91. package/dist/contexts/UIProvider.js +52 -6
  92. package/dist/hooks/useDialog/index.js +52 -7
  93. package/dist/hooks/useMouseScroll/index.js +4 -2
  94. package/dist/hooks/usePointerSlider/index.js +5 -3
  95. package/dist/hooks/useRipple/index.js +24 -22
  96. package/dist/hooks/useRipple/ripple.css.js +8 -5
  97. package/dist/hooks/useToast/ToastContainer.css.js +5 -2
  98. package/dist/hooks/useToast/ToastContainer.js +7 -4
  99. package/dist/hooks/useToast/ToastProvider.js +53 -10
  100. package/dist/hooks/useToast/index.js +5 -2
  101. package/dist/index.js +79 -8
  102. package/dist/node_modules/.pnpm/@emotion_hash@0.9.2/node_modules/@emotion/hash/dist/emotion-hash.esm.js +55 -0
  103. package/dist/node_modules/.pnpm/@vanilla-extract_css@1.17.4_babel-plugin-macros@3.1.0/node_modules/@vanilla-extract/css/adapter/dist/vanilla-extract-css-adapter.esm.js +51 -0
  104. package/dist/node_modules/.pnpm/@vanilla-extract_css@1.17.4_babel-plugin-macros@3.1.0/node_modules/@vanilla-extract/css/dist/taggedTemplateLiteral-10998315.esm.js +12 -0
  105. package/dist/node_modules/.pnpm/@vanilla-extract_css@1.17.4_babel-plugin-macros@3.1.0/node_modules/@vanilla-extract/css/dist/transformCss-0dba36bf.esm.js +955 -0
  106. package/dist/node_modules/.pnpm/@vanilla-extract_css@1.17.4_babel-plugin-macros@3.1.0/node_modules/@vanilla-extract/css/dist/vanilla-extract-css.esm.js +390 -0
  107. package/dist/node_modules/.pnpm/@vanilla-extract_css@1.17.4_babel-plugin-macros@3.1.0/node_modules/@vanilla-extract/css/fileScope/dist/vanilla-extract-css-fileScope.esm.js +20 -0
  108. package/dist/node_modules/.pnpm/@vanilla-extract_css@1.17.4_babel-plugin-macros@3.1.0/node_modules/@vanilla-extract/css/functionSerializer/dist/vanilla-extract-css-functionSerializer.esm.js +11 -0
  109. package/dist/node_modules/.pnpm/@vanilla-extract_css@1.17.4_babel-plugin-macros@3.1.0/node_modules/@vanilla-extract/css/injectStyles/dist/vanilla-extract-css-injectStyles.esm.js +22 -0
  110. package/dist/node_modules/.pnpm/@vanilla-extract_private@1.0.9/node_modules/@vanilla-extract/private/dist/vanilla-extract-private.esm.js +37 -0
  111. package/dist/node_modules/.pnpm/@vanilla-extract_recipes@0.5.7_@vanilla-extract_css@1.17.4_babel-plugin-macros@3.1.0_/node_modules/@vanilla-extract/recipes/dist/createRuntimeFn-62c9670f.esm.js +111 -0
  112. package/dist/node_modules/.pnpm/@vanilla-extract_recipes@0.5.7_@vanilla-extract_css@1.17.4_babel-plugin-macros@3.1.0_/node_modules/@vanilla-extract/recipes/dist/vanilla-extract-recipes.esm.js +43 -0
  113. package/dist/node_modules/.pnpm/@vanilla-extract_sprinkles@1.6.5_@vanilla-extract_css@1.17.4_babel-plugin-macros@3.1.0_/node_modules/@vanilla-extract/sprinkles/dist/createSprinkles-74286718.esm.js +190 -0
  114. package/dist/node_modules/.pnpm/@vanilla-extract_sprinkles@1.6.5_@vanilla-extract_css@1.17.4_babel-plugin-macros@3.1.0_/node_modules/@vanilla-extract/sprinkles/dist/vanilla-extract-sprinkles.esm.js +146 -0
  115. package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.js +3 -0
  116. package/dist/node_modules/.pnpm/css-what@6.2.2/node_modules/css-what/lib/es/parse.js +423 -0
  117. package/dist/node_modules/.pnpm/css-what@6.2.2/node_modules/css-what/lib/es/types.js +28 -0
  118. package/dist/node_modules/.pnpm/cssesc@3.0.0/node_modules/cssesc/cssesc.js +119 -0
  119. package/dist/node_modules/.pnpm/dedent@1.6.0_babel-plugin-macros@3.1.0/node_modules/dedent/dist/dedent.js +68 -0
  120. package/dist/node_modules/.pnpm/deep-object-diff@1.1.9/node_modules/deep-object-diff/mjs/diff.js +39 -0
  121. package/dist/node_modules/.pnpm/deep-object-diff@1.1.9/node_modules/deep-object-diff/mjs/utils.js +8 -0
  122. package/dist/node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js +142 -0
  123. package/dist/node_modules/.pnpm/lru-cache@10.4.3/node_modules/lru-cache/dist/esm/index.js +1542 -0
  124. package/dist/node_modules/.pnpm/lucide-react@0.503.0_react@18.3.1/node_modules/lucide-react/dist/esm/Icon.js +45 -0
  125. package/dist/node_modules/.pnpm/lucide-react@0.503.0_react@18.3.1/node_modules/lucide-react/dist/esm/createLucideIcon.js +30 -0
  126. package/dist/node_modules/.pnpm/lucide-react@0.503.0_react@18.3.1/node_modules/lucide-react/dist/esm/defaultAttributes.js +20 -0
  127. package/dist/node_modules/.pnpm/lucide-react@0.503.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/align-justify.js +18 -0
  128. package/dist/node_modules/.pnpm/lucide-react@0.503.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/chevron-down.js +14 -0
  129. package/dist/node_modules/.pnpm/lucide-react@0.503.0_react@18.3.1/node_modules/lucide-react/dist/esm/icons/x.js +17 -0
  130. package/dist/node_modules/.pnpm/lucide-react@0.503.0_react@18.3.1/node_modules/lucide-react/dist/esm/shared/src/utils.js +28 -0
  131. package/dist/node_modules/.pnpm/media-query-parser@2.0.2/node_modules/media-query-parser/dist/media-query-parser.esm.js +1385 -0
  132. package/dist/node_modules/.pnpm/modern-ahocorasick@1.1.0/node_modules/modern-ahocorasick/dist/index.js +101 -0
  133. package/dist/node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js +86 -0
  134. package/dist/node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.development.js +1325 -0
  135. package/dist/node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.production.min.js +24 -0
  136. package/dist/node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.js +19 -0
  137. package/dist/styles/globalStyle.css.js +5 -2
  138. package/dist/styles/layers.css.js +6 -3
  139. package/dist/styles/overlay.css.js +7 -4
  140. package/dist/styles/sprinkles.css.js +16 -9
  141. package/dist/styles/sx.js +7 -2
  142. package/dist/themes/darkTheme.css.js +5 -2
  143. package/dist/themes/lightTheme.css.js +5 -2
  144. package/dist/themes/theme.css.js +7 -4
  145. package/dist/tokens/scale/color.js +5 -3
  146. package/dist/tokens/semantic/breakpoint.js +4 -6
  147. package/dist/tokens/semantic/color.js +3 -1
  148. package/dist/tokens/semantic/spacing.js +3 -1
  149. package/dist/tokens/semantic/typography.js +3 -1
  150. package/dist/utils/sprinklesUtils.js +8 -3
  151. package/dist/utils/styleUtils.css.js +10 -5
  152. package/package.json +10 -5
  153. package/dist/components/Accordion/Accordion.spec.js +0 -5
  154. package/dist/components/Accordion/index.js +0 -3
  155. package/dist/components/Box/Box.spec.js +0 -5
  156. package/dist/components/Button/Button.spec.js +0 -19
  157. package/dist/components/Card/Card.spec.js +0 -16
  158. package/dist/components/Card/index.js +0 -4
  159. package/dist/components/Chip/Chip.spec.js +0 -5
  160. package/dist/components/Chip/index.js +0 -1
  161. package/dist/components/Dialog/Dialog.spec.js +0 -16
  162. package/dist/components/Dialog/DialogFooter.css.js +0 -15
  163. package/dist/components/Dialog/index.js +0 -4
  164. package/dist/components/Navigation/Navigation.spec.js +0 -11
  165. package/dist/components/Navigation/index.js +0 -7
  166. package/dist/components/Range/Range.spec.js +0 -5
  167. package/dist/components/Range/index.js +0 -1
  168. package/dist/components/ScrollArea/ScrollArea.spec.js +0 -5
  169. package/dist/components/ScrollArea/index.js +0 -1
  170. package/dist/components/Select/Select.spec.js +0 -35
  171. package/dist/components/Select/index.js +0 -2
  172. package/dist/components/Skeleton/Skeleton.spec.js +0 -5
  173. package/dist/components/Table/Table.spec.js +0 -10
  174. package/dist/components/Table/index.js +0 -6
  175. package/dist/components/Tabs/Tabs.spec.js +0 -22
  176. package/dist/components/Tabs/index.js +0 -4
  177. package/dist/components/TextField/TextField.spec.js +0 -5
  178. package/dist/components/Toast/Toast.spec.js +0 -5
  179. package/dist/components/Typography/Typography.spec.js +0 -28
  180. package/dist/components/index.js +0 -18
  181. package/dist/contexts/index.js +0 -1
  182. package/dist/hooks/index.js +0 -5
  183. package/dist/hooks/useDialog/useDialog.spec.js +0 -53
  184. package/dist/styles/index.js +0 -4
  185. package/dist/tests/uiTest.js +0 -36
  186. package/dist/themes/index.js +0 -3
  187. package/dist/tokens/index.js +0 -5
  188. package/dist/types/index.js +0 -1
  189. package/dist/types/ui.types.js +0 -1
  190. package/dist/utils/index.js +0 -1
@@ -0,0 +1,423 @@
1
+ import { SelectorType, AttributeAction } from './types.js';
2
+
3
+ const reName = /^[^\\#]?(?:\\(?:[\da-f]{1,6}\s?|.)|[\w\-\u00b0-\uFFFF])+/;
4
+ const reEscape = /\\([\da-f]{1,6}\s?|(\s)|.)/gi;
5
+ const actionTypes = new Map([
6
+ [126 /* Tilde */, AttributeAction.Element],
7
+ [94 /* Circumflex */, AttributeAction.Start],
8
+ [36 /* Dollar */, AttributeAction.End],
9
+ [42 /* Asterisk */, AttributeAction.Any],
10
+ [33 /* ExclamationMark */, AttributeAction.Not],
11
+ [124 /* Pipe */, AttributeAction.Hyphen],
12
+ ]);
13
+ // Pseudos, whose data property is parsed as well.
14
+ const unpackPseudos = new Set([
15
+ "has",
16
+ "not",
17
+ "matches",
18
+ "is",
19
+ "where",
20
+ "host",
21
+ "host-context",
22
+ ]);
23
+ /**
24
+ * Checks whether a specific selector is a traversal.
25
+ * This is useful eg. in swapping the order of elements that
26
+ * are not traversals.
27
+ *
28
+ * @param selector Selector to check.
29
+ */
30
+ function isTraversal(selector) {
31
+ switch (selector.type) {
32
+ case SelectorType.Adjacent:
33
+ case SelectorType.Child:
34
+ case SelectorType.Descendant:
35
+ case SelectorType.Parent:
36
+ case SelectorType.Sibling:
37
+ case SelectorType.ColumnCombinator:
38
+ return true;
39
+ default:
40
+ return false;
41
+ }
42
+ }
43
+ const stripQuotesFromPseudos = new Set(["contains", "icontains"]);
44
+ // Unescape function taken from https://github.com/jquery/sizzle/blob/master/src/sizzle.js#L152
45
+ function funescape(_, escaped, escapedWhitespace) {
46
+ const high = parseInt(escaped, 16) - 0x10000;
47
+ // NaN means non-codepoint
48
+ return high !== high || escapedWhitespace
49
+ ? escaped
50
+ : high < 0
51
+ ? // BMP codepoint
52
+ String.fromCharCode(high + 0x10000)
53
+ : // Supplemental Plane codepoint (surrogate pair)
54
+ String.fromCharCode((high >> 10) | 0xd800, (high & 0x3ff) | 0xdc00);
55
+ }
56
+ function unescapeCSS(str) {
57
+ return str.replace(reEscape, funescape);
58
+ }
59
+ function isQuote(c) {
60
+ return c === 39 /* SingleQuote */ || c === 34 /* DoubleQuote */;
61
+ }
62
+ function isWhitespace(c) {
63
+ return (c === 32 /* Space */ ||
64
+ c === 9 /* Tab */ ||
65
+ c === 10 /* NewLine */ ||
66
+ c === 12 /* FormFeed */ ||
67
+ c === 13 /* CarriageReturn */);
68
+ }
69
+ /**
70
+ * Parses `selector`, optionally with the passed `options`.
71
+ *
72
+ * @param selector Selector to parse.
73
+ * @param options Options for parsing.
74
+ * @returns Returns a two-dimensional array.
75
+ * The first dimension represents selectors separated by commas (eg. `sub1, sub2`),
76
+ * the second contains the relevant tokens for that selector.
77
+ */
78
+ function parse(selector) {
79
+ const subselects = [];
80
+ const endIndex = parseSelector(subselects, `${selector}`, 0);
81
+ if (endIndex < selector.length) {
82
+ throw new Error(`Unmatched selector: ${selector.slice(endIndex)}`);
83
+ }
84
+ return subselects;
85
+ }
86
+ function parseSelector(subselects, selector, selectorIndex) {
87
+ let tokens = [];
88
+ function getName(offset) {
89
+ const match = selector.slice(selectorIndex + offset).match(reName);
90
+ if (!match) {
91
+ throw new Error(`Expected name, found ${selector.slice(selectorIndex)}`);
92
+ }
93
+ const [name] = match;
94
+ selectorIndex += offset + name.length;
95
+ return unescapeCSS(name);
96
+ }
97
+ function stripWhitespace(offset) {
98
+ selectorIndex += offset;
99
+ while (selectorIndex < selector.length &&
100
+ isWhitespace(selector.charCodeAt(selectorIndex))) {
101
+ selectorIndex++;
102
+ }
103
+ }
104
+ function readValueWithParenthesis() {
105
+ selectorIndex += 1;
106
+ const start = selectorIndex;
107
+ let counter = 1;
108
+ for (; counter > 0 && selectorIndex < selector.length; selectorIndex++) {
109
+ if (selector.charCodeAt(selectorIndex) ===
110
+ 40 /* LeftParenthesis */ &&
111
+ !isEscaped(selectorIndex)) {
112
+ counter++;
113
+ }
114
+ else if (selector.charCodeAt(selectorIndex) ===
115
+ 41 /* RightParenthesis */ &&
116
+ !isEscaped(selectorIndex)) {
117
+ counter--;
118
+ }
119
+ }
120
+ if (counter) {
121
+ throw new Error("Parenthesis not matched");
122
+ }
123
+ return unescapeCSS(selector.slice(start, selectorIndex - 1));
124
+ }
125
+ function isEscaped(pos) {
126
+ let slashCount = 0;
127
+ while (selector.charCodeAt(--pos) === 92 /* BackSlash */)
128
+ slashCount++;
129
+ return (slashCount & 1) === 1;
130
+ }
131
+ function ensureNotTraversal() {
132
+ if (tokens.length > 0 && isTraversal(tokens[tokens.length - 1])) {
133
+ throw new Error("Did not expect successive traversals.");
134
+ }
135
+ }
136
+ function addTraversal(type) {
137
+ if (tokens.length > 0 &&
138
+ tokens[tokens.length - 1].type === SelectorType.Descendant) {
139
+ tokens[tokens.length - 1].type = type;
140
+ return;
141
+ }
142
+ ensureNotTraversal();
143
+ tokens.push({ type });
144
+ }
145
+ function addSpecialAttribute(name, action) {
146
+ tokens.push({
147
+ type: SelectorType.Attribute,
148
+ name,
149
+ action,
150
+ value: getName(1),
151
+ namespace: null,
152
+ ignoreCase: "quirks",
153
+ });
154
+ }
155
+ /**
156
+ * We have finished parsing the current part of the selector.
157
+ *
158
+ * Remove descendant tokens at the end if they exist,
159
+ * and return the last index, so that parsing can be
160
+ * picked up from here.
161
+ */
162
+ function finalizeSubselector() {
163
+ if (tokens.length &&
164
+ tokens[tokens.length - 1].type === SelectorType.Descendant) {
165
+ tokens.pop();
166
+ }
167
+ if (tokens.length === 0) {
168
+ throw new Error("Empty sub-selector");
169
+ }
170
+ subselects.push(tokens);
171
+ }
172
+ stripWhitespace(0);
173
+ if (selector.length === selectorIndex) {
174
+ return selectorIndex;
175
+ }
176
+ loop: while (selectorIndex < selector.length) {
177
+ const firstChar = selector.charCodeAt(selectorIndex);
178
+ switch (firstChar) {
179
+ // Whitespace
180
+ case 32 /* Space */:
181
+ case 9 /* Tab */:
182
+ case 10 /* NewLine */:
183
+ case 12 /* FormFeed */:
184
+ case 13 /* CarriageReturn */: {
185
+ if (tokens.length === 0 ||
186
+ tokens[0].type !== SelectorType.Descendant) {
187
+ ensureNotTraversal();
188
+ tokens.push({ type: SelectorType.Descendant });
189
+ }
190
+ stripWhitespace(1);
191
+ break;
192
+ }
193
+ // Traversals
194
+ case 62 /* GreaterThan */: {
195
+ addTraversal(SelectorType.Child);
196
+ stripWhitespace(1);
197
+ break;
198
+ }
199
+ case 60 /* LessThan */: {
200
+ addTraversal(SelectorType.Parent);
201
+ stripWhitespace(1);
202
+ break;
203
+ }
204
+ case 126 /* Tilde */: {
205
+ addTraversal(SelectorType.Sibling);
206
+ stripWhitespace(1);
207
+ break;
208
+ }
209
+ case 43 /* Plus */: {
210
+ addTraversal(SelectorType.Adjacent);
211
+ stripWhitespace(1);
212
+ break;
213
+ }
214
+ // Special attribute selectors: .class, #id
215
+ case 46 /* Period */: {
216
+ addSpecialAttribute("class", AttributeAction.Element);
217
+ break;
218
+ }
219
+ case 35 /* Hash */: {
220
+ addSpecialAttribute("id", AttributeAction.Equals);
221
+ break;
222
+ }
223
+ case 91 /* LeftSquareBracket */: {
224
+ stripWhitespace(1);
225
+ // Determine attribute name and namespace
226
+ let name;
227
+ let namespace = null;
228
+ if (selector.charCodeAt(selectorIndex) === 124 /* Pipe */) {
229
+ // Equivalent to no namespace
230
+ name = getName(1);
231
+ }
232
+ else if (selector.startsWith("*|", selectorIndex)) {
233
+ namespace = "*";
234
+ name = getName(2);
235
+ }
236
+ else {
237
+ name = getName(0);
238
+ if (selector.charCodeAt(selectorIndex) === 124 /* Pipe */ &&
239
+ selector.charCodeAt(selectorIndex + 1) !==
240
+ 61 /* Equal */) {
241
+ namespace = name;
242
+ name = getName(1);
243
+ }
244
+ }
245
+ stripWhitespace(0);
246
+ // Determine comparison operation
247
+ let action = AttributeAction.Exists;
248
+ const possibleAction = actionTypes.get(selector.charCodeAt(selectorIndex));
249
+ if (possibleAction) {
250
+ action = possibleAction;
251
+ if (selector.charCodeAt(selectorIndex + 1) !==
252
+ 61 /* Equal */) {
253
+ throw new Error("Expected `=`");
254
+ }
255
+ stripWhitespace(2);
256
+ }
257
+ else if (selector.charCodeAt(selectorIndex) === 61 /* Equal */) {
258
+ action = AttributeAction.Equals;
259
+ stripWhitespace(1);
260
+ }
261
+ // Determine value
262
+ let value = "";
263
+ let ignoreCase = null;
264
+ if (action !== "exists") {
265
+ if (isQuote(selector.charCodeAt(selectorIndex))) {
266
+ const quote = selector.charCodeAt(selectorIndex);
267
+ let sectionEnd = selectorIndex + 1;
268
+ while (sectionEnd < selector.length &&
269
+ (selector.charCodeAt(sectionEnd) !== quote ||
270
+ isEscaped(sectionEnd))) {
271
+ sectionEnd += 1;
272
+ }
273
+ if (selector.charCodeAt(sectionEnd) !== quote) {
274
+ throw new Error("Attribute value didn't end");
275
+ }
276
+ value = unescapeCSS(selector.slice(selectorIndex + 1, sectionEnd));
277
+ selectorIndex = sectionEnd + 1;
278
+ }
279
+ else {
280
+ const valueStart = selectorIndex;
281
+ while (selectorIndex < selector.length &&
282
+ ((!isWhitespace(selector.charCodeAt(selectorIndex)) &&
283
+ selector.charCodeAt(selectorIndex) !==
284
+ 93 /* RightSquareBracket */) ||
285
+ isEscaped(selectorIndex))) {
286
+ selectorIndex += 1;
287
+ }
288
+ value = unescapeCSS(selector.slice(valueStart, selectorIndex));
289
+ }
290
+ stripWhitespace(0);
291
+ // See if we have a force ignore flag
292
+ const forceIgnore = selector.charCodeAt(selectorIndex) | 0x20;
293
+ // If the forceIgnore flag is set (either `i` or `s`), use that value
294
+ if (forceIgnore === 115 /* LowerS */) {
295
+ ignoreCase = false;
296
+ stripWhitespace(1);
297
+ }
298
+ else if (forceIgnore === 105 /* LowerI */) {
299
+ ignoreCase = true;
300
+ stripWhitespace(1);
301
+ }
302
+ }
303
+ if (selector.charCodeAt(selectorIndex) !==
304
+ 93 /* RightSquareBracket */) {
305
+ throw new Error("Attribute selector didn't terminate");
306
+ }
307
+ selectorIndex += 1;
308
+ const attributeSelector = {
309
+ type: SelectorType.Attribute,
310
+ name,
311
+ action,
312
+ value,
313
+ namespace,
314
+ ignoreCase,
315
+ };
316
+ tokens.push(attributeSelector);
317
+ break;
318
+ }
319
+ case 58 /* Colon */: {
320
+ if (selector.charCodeAt(selectorIndex + 1) === 58 /* Colon */) {
321
+ tokens.push({
322
+ type: SelectorType.PseudoElement,
323
+ name: getName(2).toLowerCase(),
324
+ data: selector.charCodeAt(selectorIndex) ===
325
+ 40 /* LeftParenthesis */
326
+ ? readValueWithParenthesis()
327
+ : null,
328
+ });
329
+ continue;
330
+ }
331
+ const name = getName(1).toLowerCase();
332
+ let data = null;
333
+ if (selector.charCodeAt(selectorIndex) ===
334
+ 40 /* LeftParenthesis */) {
335
+ if (unpackPseudos.has(name)) {
336
+ if (isQuote(selector.charCodeAt(selectorIndex + 1))) {
337
+ throw new Error(`Pseudo-selector ${name} cannot be quoted`);
338
+ }
339
+ data = [];
340
+ selectorIndex = parseSelector(data, selector, selectorIndex + 1);
341
+ if (selector.charCodeAt(selectorIndex) !==
342
+ 41 /* RightParenthesis */) {
343
+ throw new Error(`Missing closing parenthesis in :${name} (${selector})`);
344
+ }
345
+ selectorIndex += 1;
346
+ }
347
+ else {
348
+ data = readValueWithParenthesis();
349
+ if (stripQuotesFromPseudos.has(name)) {
350
+ const quot = data.charCodeAt(0);
351
+ if (quot === data.charCodeAt(data.length - 1) &&
352
+ isQuote(quot)) {
353
+ data = data.slice(1, -1);
354
+ }
355
+ }
356
+ data = unescapeCSS(data);
357
+ }
358
+ }
359
+ tokens.push({ type: SelectorType.Pseudo, name, data });
360
+ break;
361
+ }
362
+ case 44 /* Comma */: {
363
+ finalizeSubselector();
364
+ tokens = [];
365
+ stripWhitespace(1);
366
+ break;
367
+ }
368
+ default: {
369
+ if (selector.startsWith("/*", selectorIndex)) {
370
+ const endIndex = selector.indexOf("*/", selectorIndex + 2);
371
+ if (endIndex < 0) {
372
+ throw new Error("Comment was not terminated");
373
+ }
374
+ selectorIndex = endIndex + 2;
375
+ // Remove leading whitespace
376
+ if (tokens.length === 0) {
377
+ stripWhitespace(0);
378
+ }
379
+ break;
380
+ }
381
+ let namespace = null;
382
+ let name;
383
+ if (firstChar === 42 /* Asterisk */) {
384
+ selectorIndex += 1;
385
+ name = "*";
386
+ }
387
+ else if (firstChar === 124 /* Pipe */) {
388
+ name = "";
389
+ if (selector.charCodeAt(selectorIndex + 1) === 124 /* Pipe */) {
390
+ addTraversal(SelectorType.ColumnCombinator);
391
+ stripWhitespace(2);
392
+ break;
393
+ }
394
+ }
395
+ else if (reName.test(selector.slice(selectorIndex))) {
396
+ name = getName(0);
397
+ }
398
+ else {
399
+ break loop;
400
+ }
401
+ if (selector.charCodeAt(selectorIndex) === 124 /* Pipe */ &&
402
+ selector.charCodeAt(selectorIndex + 1) !== 124 /* Pipe */) {
403
+ namespace = name;
404
+ if (selector.charCodeAt(selectorIndex + 1) ===
405
+ 42 /* Asterisk */) {
406
+ name = "*";
407
+ selectorIndex += 2;
408
+ }
409
+ else {
410
+ name = getName(1);
411
+ }
412
+ }
413
+ tokens.push(name === "*"
414
+ ? { type: SelectorType.Universal, namespace }
415
+ : { type: SelectorType.Tag, name, namespace });
416
+ }
417
+ }
418
+ }
419
+ finalizeSubselector();
420
+ return selectorIndex;
421
+ }
422
+
423
+ export { isTraversal, parse };
@@ -0,0 +1,28 @@
1
+ var SelectorType;
2
+ (function (SelectorType) {
3
+ SelectorType["Attribute"] = "attribute";
4
+ SelectorType["Pseudo"] = "pseudo";
5
+ SelectorType["PseudoElement"] = "pseudo-element";
6
+ SelectorType["Tag"] = "tag";
7
+ SelectorType["Universal"] = "universal";
8
+ // Traversals
9
+ SelectorType["Adjacent"] = "adjacent";
10
+ SelectorType["Child"] = "child";
11
+ SelectorType["Descendant"] = "descendant";
12
+ SelectorType["Parent"] = "parent";
13
+ SelectorType["Sibling"] = "sibling";
14
+ SelectorType["ColumnCombinator"] = "column-combinator";
15
+ })(SelectorType || (SelectorType = {}));
16
+ var AttributeAction;
17
+ (function (AttributeAction) {
18
+ AttributeAction["Any"] = "any";
19
+ AttributeAction["Element"] = "element";
20
+ AttributeAction["End"] = "end";
21
+ AttributeAction["Equals"] = "equals";
22
+ AttributeAction["Exists"] = "exists";
23
+ AttributeAction["Hyphen"] = "hyphen";
24
+ AttributeAction["Not"] = "not";
25
+ AttributeAction["Start"] = "start";
26
+ })(AttributeAction || (AttributeAction = {}));
27
+
28
+ export { AttributeAction, SelectorType };
@@ -0,0 +1,119 @@
1
+ /*! https://mths.be/cssesc v3.0.0 by @mathias */
2
+
3
+ var cssesc_1;
4
+ var hasRequiredCssesc;
5
+
6
+ function requireCssesc () {
7
+ if (hasRequiredCssesc) return cssesc_1;
8
+ hasRequiredCssesc = 1;
9
+
10
+ var object = {};
11
+ var hasOwnProperty = object.hasOwnProperty;
12
+ var merge = function merge(options, defaults) {
13
+ if (!options) {
14
+ return defaults;
15
+ }
16
+ var result = {};
17
+ for (var key in defaults) {
18
+ // `if (defaults.hasOwnProperty(key) { … }` is not needed here, since
19
+ // only recognized option names are used.
20
+ result[key] = hasOwnProperty.call(options, key) ? options[key] : defaults[key];
21
+ }
22
+ return result;
23
+ };
24
+
25
+ var regexAnySingleEscape = /[ -,\.\/:-@\[-\^`\{-~]/;
26
+ var regexSingleEscape = /[ -,\.\/:-@\[\]\^`\{-~]/;
27
+ var regexExcessiveSpaces = /(^|\\+)?(\\[A-F0-9]{1,6})\x20(?![a-fA-F0-9\x20])/g;
28
+
29
+ // https://mathiasbynens.be/notes/css-escapes#css
30
+ var cssesc = function cssesc(string, options) {
31
+ options = merge(options, cssesc.options);
32
+ if (options.quotes != 'single' && options.quotes != 'double') {
33
+ options.quotes = 'single';
34
+ }
35
+ var quote = options.quotes == 'double' ? '"' : '\'';
36
+ var isIdentifier = options.isIdentifier;
37
+
38
+ var firstChar = string.charAt(0);
39
+ var output = '';
40
+ var counter = 0;
41
+ var length = string.length;
42
+ while (counter < length) {
43
+ var character = string.charAt(counter++);
44
+ var codePoint = character.charCodeAt();
45
+ var value = void 0;
46
+ // If it’s not a printable ASCII character…
47
+ if (codePoint < 0x20 || codePoint > 0x7E) {
48
+ if (codePoint >= 0xD800 && codePoint <= 0xDBFF && counter < length) {
49
+ // It’s a high surrogate, and there is a next character.
50
+ var extra = string.charCodeAt(counter++);
51
+ if ((extra & 0xFC00) == 0xDC00) {
52
+ // next character is low surrogate
53
+ codePoint = ((codePoint & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000;
54
+ } else {
55
+ // It’s an unmatched surrogate; only append this code unit, in case
56
+ // the next code unit is the high surrogate of a surrogate pair.
57
+ counter--;
58
+ }
59
+ }
60
+ value = '\\' + codePoint.toString(16).toUpperCase() + ' ';
61
+ } else {
62
+ if (options.escapeEverything) {
63
+ if (regexAnySingleEscape.test(character)) {
64
+ value = '\\' + character;
65
+ } else {
66
+ value = '\\' + codePoint.toString(16).toUpperCase() + ' ';
67
+ }
68
+ } else if (/[\t\n\f\r\x0B]/.test(character)) {
69
+ value = '\\' + codePoint.toString(16).toUpperCase() + ' ';
70
+ } else if (character == '\\' || !isIdentifier && (character == '"' && quote == character || character == '\'' && quote == character) || isIdentifier && regexSingleEscape.test(character)) {
71
+ value = '\\' + character;
72
+ } else {
73
+ value = character;
74
+ }
75
+ }
76
+ output += value;
77
+ }
78
+
79
+ if (isIdentifier) {
80
+ if (/^-[-\d]/.test(output)) {
81
+ output = '\\-' + output.slice(1);
82
+ } else if (/\d/.test(firstChar)) {
83
+ output = '\\3' + firstChar + ' ' + output.slice(1);
84
+ }
85
+ }
86
+
87
+ // Remove spaces after `\HEX` escapes that are not followed by a hex digit,
88
+ // since they’re redundant. Note that this is only possible if the escape
89
+ // sequence isn’t preceded by an odd number of backslashes.
90
+ output = output.replace(regexExcessiveSpaces, function ($0, $1, $2) {
91
+ if ($1 && $1.length % 2) {
92
+ // It’s not safe to remove the space, so don’t.
93
+ return $0;
94
+ }
95
+ // Strip the space.
96
+ return ($1 || '') + $2;
97
+ });
98
+
99
+ if (!isIdentifier && options.wrap) {
100
+ return quote + output + quote;
101
+ }
102
+ return output;
103
+ };
104
+
105
+ // Expose default options (so they can be overridden globally).
106
+ cssesc.options = {
107
+ 'escapeEverything': false,
108
+ 'isIdentifier': false,
109
+ 'quotes': 'single',
110
+ 'wrap': false
111
+ };
112
+
113
+ cssesc.version = '3.0.0';
114
+
115
+ cssesc_1 = cssesc;
116
+ return cssesc_1;
117
+ }
118
+
119
+ export { requireCssesc as __require };
@@ -0,0 +1,68 @@
1
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
5
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
6
+ const dedent = createDedent({});
7
+ function createDedent(options) {
8
+ dedent.withOptions = newOptions => createDedent(_objectSpread(_objectSpread({}, options), newOptions));
9
+ return dedent;
10
+ function dedent(strings, ...values) {
11
+ const raw = typeof strings === "string" ? [strings] : strings.raw;
12
+ const {
13
+ escapeSpecialCharacters = Array.isArray(strings),
14
+ trimWhitespace = true
15
+ } = options;
16
+
17
+ // first, perform interpolation
18
+ let result = "";
19
+ for (let i = 0; i < raw.length; i++) {
20
+ let next = raw[i];
21
+ if (escapeSpecialCharacters) {
22
+ // handle escaped newlines, backticks, and interpolation characters
23
+ next = next.replace(/\\\n[ \t]*/g, "").replace(/\\`/g, "`").replace(/\\\$/g, "$").replace(/\\\{/g, "{");
24
+ }
25
+ result += next;
26
+ if (i < values.length) {
27
+ // eslint-disable-next-line @typescript-eslint/restrict-plus-operands
28
+ result += values[i];
29
+ }
30
+ }
31
+
32
+ // now strip indentation
33
+ const lines = result.split("\n");
34
+ let mindent = null;
35
+ for (const l of lines) {
36
+ const m = l.match(/^(\s+)\S+/);
37
+ if (m) {
38
+ const indent = m[1].length;
39
+ if (!mindent) {
40
+ // this is the first indented line
41
+ mindent = indent;
42
+ } else {
43
+ mindent = Math.min(mindent, indent);
44
+ }
45
+ }
46
+ }
47
+ if (mindent !== null) {
48
+ const m = mindent; // appease TypeScript
49
+ result = lines
50
+ // https://github.com/typescript-eslint/typescript-eslint/issues/7140
51
+ // eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with
52
+ .map(l => l[0] === " " || l[0] === "\t" ? l.slice(m) : l).join("\n");
53
+ }
54
+
55
+ // dedent eats leading and trailing whitespace too
56
+ if (trimWhitespace) {
57
+ result = result.trim();
58
+ }
59
+
60
+ // handle escaped newlines at the end to ensure they don't get stripped too
61
+ if (escapeSpecialCharacters) {
62
+ result = result.replace(/\\n/g, "\n");
63
+ }
64
+ return result;
65
+ }
66
+ }
67
+
68
+ export { dedent as default };
@@ -0,0 +1,39 @@
1
+ import { isObject, hasOwnProperty, makeObjectWithoutPrototype, isDate, isEmptyObject } from './utils.js';
2
+
3
+ const diff = (lhs, rhs) => {
4
+ if (lhs === rhs) return {}; // equal return no diff
5
+
6
+ if (!isObject(lhs) || !isObject(rhs)) return rhs; // return updated rhs
7
+
8
+ const deletedValues = Object.keys(lhs).reduce((acc, key) => {
9
+ if (!hasOwnProperty(rhs, key)) {
10
+ acc[key] = undefined;
11
+
12
+ }
13
+
14
+ return acc;
15
+ }, makeObjectWithoutPrototype());
16
+
17
+ if (isDate(lhs) || isDate(rhs)) {
18
+ if (lhs.valueOf() == rhs.valueOf()) return {};
19
+ return rhs;
20
+ }
21
+
22
+ return Object.keys(rhs).reduce((acc, key) => {
23
+ if (!hasOwnProperty(lhs, key)){
24
+ acc[key] = rhs[key]; // return added r key
25
+ return acc;
26
+ }
27
+
28
+ const difference = diff(lhs[key], rhs[key]);
29
+
30
+ // If the difference is empty, and the lhs is an empty object or the rhs is not an empty object
31
+ if (isEmptyObject(difference) && !isDate(difference) && (isEmptyObject(lhs[key]) || !isEmptyObject(rhs[key])))
32
+ return acc; // return no diff
33
+
34
+ acc[key] = difference; // return updated key
35
+ return acc; // return updated key
36
+ }, deletedValues);
37
+ };
38
+
39
+ export { diff as default };
@@ -0,0 +1,8 @@
1
+ const isDate = d => d instanceof Date;
2
+ const isEmpty = o => Object.keys(o).length === 0;
3
+ const isObject = o => o != null && typeof o === 'object';
4
+ const hasOwnProperty = (o, ...args) => Object.prototype.hasOwnProperty.call(o, ...args);
5
+ const isEmptyObject = (o) => isObject(o) && isEmpty(o);
6
+ const makeObjectWithoutPrototype = () => Object.create(null);
7
+
8
+ export { hasOwnProperty, isDate, isEmpty, isEmptyObject, isObject, makeObjectWithoutPrototype };