@avlcodemonkey/nilla-components 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/LICENSE +21 -0
  3. package/README.md +219 -3
  4. package/THIRD_PARTY_NOTICES.md +48 -0
  5. package/css/alert.css +48 -0
  6. package/css/autocomplete.css +38 -0
  7. package/css/dialog.css +61 -0
  8. package/css/file-to-textarea.css +8 -0
  9. package/css/html-editor.css +172 -0
  10. package/css/json.css +44 -0
  11. package/css/list.css +37 -0
  12. package/css/nav-toggle.css +92 -0
  13. package/css/nilla.css +16 -0
  14. package/css/pjax.css +58 -0
  15. package/css/slider-input.css +16 -0
  16. package/css/table.css +99 -0
  17. package/css/tokens.css +44 -0
  18. package/css/unsaved-changes.css +10 -0
  19. package/css/vendor/wysi.css +406 -0
  20. package/docs/llms.txt +319 -0
  21. package/package.json +121 -5
  22. package/src/components/Alert.js +24 -0
  23. package/src/components/Autocomplete.js +127 -0
  24. package/src/components/BaseComponent.js +78 -0
  25. package/src/components/BaseDialog.js +151 -0
  26. package/src/components/ConfirmDialog.js +34 -0
  27. package/src/components/CopyToClipboard.js +66 -0
  28. package/src/components/DateFormatter.js +51 -0
  29. package/src/components/DateTimeInput.js +63 -0
  30. package/src/components/DisplayToggle.js +53 -0
  31. package/src/components/FileToTextarea.js +81 -0
  32. package/src/components/HtmlEditor.js +309 -0
  33. package/src/components/InfoDialog.js +38 -0
  34. package/src/components/JsonFormatter.js +23 -0
  35. package/src/components/List.js +237 -0
  36. package/src/components/ListSortable.js +8 -0
  37. package/src/components/NavToggle.js +119 -0
  38. package/src/components/PJax.js +888 -0
  39. package/src/components/Share.js +41 -0
  40. package/src/components/SliderInput.js +26 -0
  41. package/src/components/Table.js +758 -0
  42. package/src/components/TimeOffsetSelect.js +29 -0
  43. package/src/components/UnsavedChanges.js +187 -0
  44. package/src/constants/Fetch.js +7 -0
  45. package/src/constants/HttpHeaders.js +19 -0
  46. package/src/constants/HttpMethods.js +14 -0
  47. package/src/constants/SortDirection.js +11 -0
  48. package/src/constants/TableElements.js +25 -0
  49. package/src/constants/TableSettings.js +14 -0
  50. package/src/errors/FetchError.js +7 -0
  51. package/src/events/ListReorderEvent.js +19 -0
  52. package/src/events/PJaxErrorEvent.js +38 -0
  53. package/src/events/PJaxNavigatingEvent.js +46 -0
  54. package/src/index.js +26 -0
  55. package/src/locales/en.json +55 -0
  56. package/src/locales/es.js +9 -0
  57. package/src/locales/es.json +55 -0
  58. package/src/models/TableSort.js +20 -0
  59. package/src/utils/ajaxHeaders.js +10 -0
  60. package/src/utils/announce.js +40 -0
  61. package/src/utils/defineElement.js +13 -0
  62. package/src/utils/editor/blockTools.js +256 -0
  63. package/src/utils/editor/elements.js +18 -0
  64. package/src/utils/editor/input.js +350 -0
  65. package/src/utils/editor/selection.js +125 -0
  66. package/src/utils/editor/tableTools.js +497 -0
  67. package/src/utils/escape.js +20 -0
  68. package/src/utils/fetchJsonArray.js +29 -0
  69. package/src/utils/filterArray.js +18 -0
  70. package/src/utils/formActionUrl.js +10 -0
  71. package/src/utils/formData.js +118 -0
  72. package/src/utils/index.js +18 -0
  73. package/src/utils/indexedCompare.js +18 -0
  74. package/src/utils/isSameOrigin.js +12 -0
  75. package/src/utils/locale.js +36 -0
  76. package/src/utils/notifyChange.js +10 -0
  77. package/src/utils/numberSetting.js +14 -0
  78. package/src/utils/pageLanguage.js +13 -0
  79. package/src/utils/parseUtcDate.js +22 -0
  80. package/src/utils/randomId.js +17 -0
  81. package/src/utils/registerTabTrap.js +60 -0
  82. package/src/utils/renderTemplate.js +44 -0
  83. package/src/utils/requestTimeout.js +12 -0
  84. package/src/utils/response.js +28 -0
  85. package/src/utils/sortedCompare.js +67 -0
  86. package/src/utils/storage.js +40 -0
  87. package/src/vendor/autocomplete.js +515 -0
  88. package/src/vendor/formatDate.js +236 -0
  89. package/src/vendor/licenses/autocomplete.LICENSE.md +21 -0
  90. package/src/vendor/licenses/fecha.LICENSE.md +21 -0
  91. package/src/vendor/licenses/pretty-print-json.LICENSE.md +21 -0
  92. package/src/vendor/licenses/wysi.LICENSE.md +21 -0
  93. package/src/vendor/prettyPrintJson.js +108 -0
  94. package/src/vendor/wyzi.js +2024 -0
@@ -0,0 +1,406 @@
1
+ /* stylelint-disable */
2
+ /*!
3
+ * Based on Wysi ~ Copyright (c) 2023 Momo Bassit ~ MIT License ~ https://github.com/mdbassit/Wysi
4
+ * Modified for nilla-components: table, code and quote tools. Colors come from the nilla theme tokens.
5
+ */
6
+ :root {
7
+ --wysi-primary: var(--nilla-primary, #027ffe);
8
+ --wysi-hover: var(--nilla-primary-hover, #0266cb);
9
+ --wysi-highlight: var(--nilla-highlight, #cce5ff);
10
+ }
11
+
12
+ #wysi-svg-icons {
13
+ display: none;
14
+ }
15
+
16
+ .wysi-wrapper {
17
+ display: flex;
18
+ flex-direction: column;
19
+ position: relative;
20
+ border-radius: 5px;
21
+ font-size: 16px;
22
+ line-height: 1.5;
23
+ outline: 1px solid rgba(160, 160, 160, .3);
24
+ }
25
+
26
+ /* Fix for external styles interfering with the editor */
27
+ .wysi-wrapper {
28
+ display: inline-flex;
29
+ width: 100%;
30
+ font-weight: normal !important;
31
+ font-style: normal !important;
32
+ }
33
+
34
+ .wysi-wrapper:focus-within {
35
+ outline-color: var(--wysi-primary);
36
+ }
37
+
38
+ .wysi-wrapper + textarea {
39
+ display: none;
40
+ }
41
+
42
+ .wysi-toolbar {
43
+ display: flex;
44
+ flex-wrap: wrap;
45
+ position: sticky;
46
+ top: 0;
47
+ z-index: 1;
48
+ padding: 5px;
49
+ border-radius: 5px 5px 0 0;
50
+ background-color: var(--nilla-surface);
51
+ box-sizing: border-box;
52
+ }
53
+
54
+ .wysi-autohide .wysi-toolbar {
55
+ display: none;
56
+ }
57
+
58
+ .wysi-autohide:focus-within .wysi-toolbar {
59
+ display: flex;
60
+ flex-wrap: nowrap;
61
+ position: absolute;
62
+ min-width: 100%;
63
+ left: 50%;
64
+ transform: translate(-50%, -100%);
65
+ margin-top: -5px;
66
+ border-radius: 5px;
67
+ outline: 1px solid rgba(160, 160, 160, .3);
68
+ }
69
+
70
+ .wysi-toolbar *,
71
+ .wysi-toolbar *:before,
72
+ .wysi-toolbar *:after {
73
+ box-sizing: inherit;
74
+ }
75
+
76
+ .wysi-toolbar button {
77
+ display: inline-flex;
78
+ align-items: center;
79
+ width: auto;
80
+ height: 30px;
81
+ margin: 0 5px 0 0;
82
+ padding: 0;
83
+ border: 0;
84
+ border-radius: 3px;
85
+ color: var(--nilla-color);
86
+ background-color: transparent;
87
+ font-family: inherit;
88
+ font-size: 1em;
89
+ font-weight: 400;
90
+ text-transform: none;
91
+ box-shadow: none;
92
+ cursor: pointer;
93
+ }
94
+
95
+ .wysi-popover > button,
96
+ .wysi-toolbar > button {
97
+ justify-content: center;
98
+ width: 30px;
99
+ }
100
+
101
+ .wysi-toolbar button:hover,
102
+ .wysi-toolbar button:focus,
103
+ .wysi-listbox button[aria-expanded="true"] {
104
+ background-color: var(--nilla-background);
105
+ }
106
+
107
+ .wysi-toolbar button[aria-pressed="true"] {
108
+ color: var(--wysi-primary);
109
+ background-color: var(--wysi-highlight);
110
+ }
111
+
112
+ .wysi-toolbar button * {
113
+ pointer-events: none;
114
+ }
115
+
116
+ .wysi-toolbar svg {
117
+ width: 1.5em;
118
+ height: 1.5em;
119
+ fill: currentColor;
120
+ }
121
+
122
+ .wysi-listbox {
123
+ position: relative;
124
+ line-height: 0;
125
+ }
126
+
127
+ .wysi-listbox > button {
128
+ justify-content: space-between;
129
+ width: 40px;
130
+ padding: 0 4px 0 2px;
131
+ }
132
+
133
+ .wysi-listbox > button:after {
134
+ content: '';
135
+ display: block;
136
+ width: 6px;
137
+ height: 6px;
138
+ transform: rotateZ(45deg);
139
+ border: solid currentColor;
140
+ border-width: 0 1.5px 1.5px 0;
141
+ box-sizing: border-box;
142
+ }
143
+
144
+ .wysi-listbox div {
145
+ position: absolute;
146
+ margin-top: -1px;
147
+ z-index: 1;
148
+ border-radius: 0 0 3px 3px;
149
+ background-color: var(--nilla-background);
150
+ box-shadow: 0 10px 20px rgba(0, 0, 0, .15);
151
+ overflow: hidden;
152
+ }
153
+
154
+ .wysi-listbox > button[aria-expanded="false"] + div {
155
+ display: none;
156
+ }
157
+
158
+ .wysi-listbox div button {
159
+ display: flex;
160
+ width: 100%;
161
+ height: 30px;
162
+ padding: 0 10px;
163
+ border-radius: 3px;
164
+ text-align: left;
165
+ cursor: pointer;
166
+ }
167
+
168
+ .wysi-listbox div button:focus {
169
+ background-color: var(--nilla-surface);
170
+ }
171
+
172
+ /** Format tool **/
173
+ .wysi-format button {
174
+ font-size: .875em;
175
+ }
176
+
177
+ .wysi-format > button {
178
+ width: 120px;
179
+ padding: 0 10px;
180
+ }
181
+
182
+ .wysi-format div {
183
+ min-width: 160px;
184
+ padding: 5px;
185
+ }
186
+
187
+ .wysi-format button[data-option^="h"] {
188
+ font-weight: bold;
189
+ }
190
+
191
+ .wysi-format button[data-option="h1"] {
192
+ font-size: 1.25em;
193
+ }
194
+
195
+ .wysi-format button[data-option="h2"] {
196
+ font-size: 1.125em;
197
+ }
198
+
199
+ .wysi-format button[data-option="h3"] {
200
+ font-size: 1em;
201
+ }
202
+ /** End of Format tool **/
203
+
204
+ .wysi-popover {
205
+ position: relative;
206
+ margin-right: 5px;
207
+ line-height: 0;
208
+ }
209
+
210
+ .wysi-popover > button {
211
+ margin: 0;
212
+ }
213
+
214
+ .wysi-popover > button[aria-expanded="false"] + div {
215
+ display: none;
216
+ }
217
+
218
+ .wysi-popover div {
219
+ display: flex;
220
+ flex-wrap: wrap;
221
+ justify-content: flex-end;
222
+ position: absolute;
223
+ width: 250px;
224
+ left: 50%;
225
+ transform: translateX(-50%);
226
+ z-index: 1;
227
+ padding: 15px;
228
+ border-radius: 5px;
229
+ background-color: var(--nilla-background);
230
+ font-size: .875em;
231
+ line-height: 1;
232
+ box-shadow: 0 5px 25px rgba(0, 0, 0, .2);
233
+ }
234
+
235
+ .wysi-popover div:before {
236
+ content: '';
237
+ display: block;
238
+ position: absolute;
239
+ width: 10px;
240
+ height: 6px;
241
+ left: 50%;
242
+ top: -6px;
243
+ transform: translateX(-50%);
244
+ border-style: solid;
245
+ border-width: 0 5px 6px 5px;
246
+ border-color: transparent;
247
+ border-bottom-color: var(--nilla-background);
248
+ }
249
+
250
+ .wysi-popover label {
251
+ width: 100%;
252
+ margin-bottom: 8px;
253
+ font-size: 1em;
254
+ }
255
+
256
+ .wysi-popover span {
257
+ display: block;
258
+ width: 100%;
259
+ margin-bottom: 5px;
260
+ line-height: 1.5;
261
+ }
262
+
263
+ .wysi-popover input[type] {
264
+ width: 100%;
265
+ height: 26px;
266
+ margin: 0;
267
+ padding: 0 10px;
268
+ border: 1px solid var(--nilla-border);
269
+ border-radius: 13px;
270
+ color: var(--nilla-color);
271
+ background-color: transparent;
272
+ font-family: inherit;
273
+ font-size: inherit;
274
+ box-sizing: inherit;
275
+ box-shadow: none;
276
+ }
277
+
278
+ .wysi-popover div button {
279
+ height: 26px;
280
+ margin: 15px 0 0 5px;
281
+ padding: 0 15px;
282
+ border: 1px solid var(--nilla-border);
283
+ border-radius: 13px;
284
+ font-size: .9em;
285
+ }
286
+
287
+ .wysi-popover div button:hover,
288
+ .wysi-popover div button:focus {
289
+ background-color: var(--nilla-surface);
290
+ }
291
+
292
+ .wysi-popover div button:last-of-type {
293
+ border: 0;
294
+ color: var(--nilla-primary-inverse);
295
+ background-color: var(--wysi-primary);
296
+ }
297
+
298
+ .wysi-popover div button:last-of-type:hover,
299
+ .wysi-popover div button:last-of-type:focus {
300
+ background-color: var(--wysi-hover);
301
+ }
302
+
303
+ .wysi-popover div button[data-action="unlink"] {
304
+ margin: 15px auto 0 0;
305
+ padding: 0 4px;
306
+ }
307
+
308
+ .wysi-segmented {
309
+ display: flex;
310
+ position: relative;
311
+ width: 100%;
312
+ height: 26px;
313
+ margin: 0 0 8px 0;
314
+ padding: 0;
315
+ border: 1px solid var(--nilla-border);
316
+ border-radius: 13px;
317
+ align-items: center;
318
+ overflow: hidden;
319
+ }
320
+
321
+ .wysi-segmented:focus-within {
322
+ outline: 2px solid var(--wysi-primary);
323
+ }
324
+
325
+ .wysi-segmented legend {
326
+ position: absolute;
327
+ opacity: 0;
328
+ }
329
+
330
+ .wysi-segmented input {
331
+ position: absolute;
332
+ width: 100%;
333
+ height: 100%;
334
+ margin: 0;
335
+ padding: 0;
336
+ border: 0;
337
+ left: 0;
338
+ top: 0;
339
+ opacity: 0;
340
+ pointer-events: none;
341
+ }
342
+
343
+ .wysi-segmented input + label {
344
+ position: relative;
345
+ display: block;
346
+ margin: 0;
347
+ z-index: 1;
348
+ font-size: .875em;
349
+ text-align: center;
350
+ line-height: 26px;
351
+ cursor: pointer;
352
+ }
353
+
354
+ .wysi-segmented input:checked + label {
355
+ color: var(--nilla-color);
356
+ background-color: var(--wysi-highlight);
357
+ }
358
+
359
+ .wysi-separator {
360
+ width: 5px;
361
+ height: 30px;
362
+ margin-right: 10px;
363
+ border-right: 1px solid var(--nilla-border);
364
+ }
365
+
366
+ .wysi-newline {
367
+ flex-basis: 100%;
368
+ }
369
+
370
+ .wysi-editor {
371
+ min-height: 200px;
372
+ max-height: 200px;
373
+ padding: 1em;
374
+ outline: none;
375
+ overflow: auto;
376
+ }
377
+
378
+ .wysi-autogrow .wysi-editor {
379
+ max-height: none !important;
380
+ }
381
+
382
+ .wysi-editor > :first-child {
383
+ margin-top: 0;
384
+ }
385
+
386
+ .wysi-editor blockquote {
387
+ margin-left: 0;
388
+ margin-right: 0;
389
+ padding-left: 1.5em;
390
+ padding-right: 1.5em;
391
+ border-left: 3px solid var(--nilla-border);
392
+ font-style: italic;
393
+ }
394
+
395
+ .wysi-editor img:hover,
396
+ .wysi-editor img.wysi-selected {
397
+ outline: 3px solid var(--nilla-border);
398
+ }
399
+
400
+ .wysi-editor img:hover {
401
+ outline-color: var(--nilla-muted);
402
+ }
403
+
404
+ .wysi-wrapper:focus-within img.wysi-selected {
405
+ outline-color: var(--wysi-primary);
406
+ }