@stacksjs/components 0.2.70 → 0.2.72

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.
@@ -7,10 +7,10 @@
7
7
  * @returns Object with value, setValue, and removeValue
8
8
  */
9
9
  export declare function useLocalStorage<T>(key: string, initialValue: T, options?: UseLocalStorageOptions<T>): {
10
- value: T
11
- setValue: (newValue: T | ((_prev: T) => T)) => void
12
- removeValue: () => void
13
- };
10
+ value: T
11
+ setValue: (newValue: T | ((_prev: T) => T)) => void
12
+ removeValue: () => void
13
+ };
14
14
  /**
15
15
  * Reactive localStorage hook with cross-tab synchronization
16
16
  *
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  // @bun
2
- // ../../../../../../../tmp/stx-components-build-ZzY4r2/stubs/stub-0.js
2
+ // ../../../../../../../tmp/stx-components-build-C5TNbr/stubs/stub-0.js
3
3
  var stub_0_default = { __stx: true, src: "./components/CodeBlock.stx" };
4
- // ../../../../../../../tmp/stx-components-build-ZzY4r2/stubs/stub-1.js
4
+ // ../../../../../../../tmp/stx-components-build-C5TNbr/stubs/stub-1.js
5
5
  var stub_1_default = { __stx: true, src: "./components/Footer.stx" };
6
- // ../../../../../../../tmp/stx-components-build-ZzY4r2/stubs/stub-2.js
6
+ // ../../../../../../../tmp/stx-components-build-C5TNbr/stubs/stub-2.js
7
7
  var stub_2_default = { __stx: true, src: "./components/Hero.stx" };
8
- // ../../../../../../../tmp/stx-components-build-ZzY4r2/stubs/stub-3.js
8
+ // ../../../../../../../tmp/stx-components-build-C5TNbr/stubs/stub-3.js
9
9
  var stub_3_default = { __stx: true, src: "./components/Installation.stx" };
10
10
  // src/composables/useCopyCode.ts
11
11
  function useCopyCode(options) {
@@ -215,71 +215,71 @@ export type AriaLive = 'off' | 'polite' | 'assertive';
215
215
  * ARIA role types
216
216
  */
217
217
  export type AriaRole = | 'alert'
218
- | 'alertdialog'
219
- | 'application'
220
- | 'article'
221
- | 'banner'
222
- | 'button'
223
- | 'cell'
224
- | 'checkbox'
225
- | 'columnheader'
226
- | 'combobox'
227
- | 'complementary'
228
- | 'contentinfo'
229
- | 'definition'
230
- | 'dialog'
231
- | 'directory'
232
- | 'document'
233
- | 'feed'
234
- | 'figure'
235
- | 'form'
236
- | 'grid'
237
- | 'gridcell'
238
- | 'group'
239
- | 'heading'
240
- | 'img'
241
- | 'link'
242
- | 'list'
243
- | 'listbox'
244
- | 'listitem'
245
- | 'log'
246
- | 'main'
247
- | 'marquee'
248
- | 'math'
249
- | 'menu'
250
- | 'menubar'
251
- | 'menuitem'
252
- | 'menuitemcheckbox'
253
- | 'menuitemradio'
254
- | 'navigation'
255
- | 'none'
256
- | 'note'
257
- | 'option'
258
- | 'presentation'
259
- | 'progressbar'
260
- | 'radio'
261
- | 'radiogroup'
262
- | 'region'
263
- | 'row'
264
- | 'rowgroup'
265
- | 'rowheader'
266
- | 'scrollbar'
267
- | 'search'
268
- | 'searchbox'
269
- | 'separator'
270
- | 'slider'
271
- | 'spinbutton'
272
- | 'status'
273
- | 'switch'
274
- | 'tab'
275
- | 'table'
276
- | 'tablist'
277
- | 'tabpanel'
278
- | 'term'
279
- | 'textbox'
280
- | 'timer'
281
- | 'toolbar'
282
- | 'tooltip'
283
- | 'tree'
284
- | 'treegrid'
285
- | 'treeitem';
218
+ | 'alertdialog'
219
+ | 'application'
220
+ | 'article'
221
+ | 'banner'
222
+ | 'button'
223
+ | 'cell'
224
+ | 'checkbox'
225
+ | 'columnheader'
226
+ | 'combobox'
227
+ | 'complementary'
228
+ | 'contentinfo'
229
+ | 'definition'
230
+ | 'dialog'
231
+ | 'directory'
232
+ | 'document'
233
+ | 'feed'
234
+ | 'figure'
235
+ | 'form'
236
+ | 'grid'
237
+ | 'gridcell'
238
+ | 'group'
239
+ | 'heading'
240
+ | 'img'
241
+ | 'link'
242
+ | 'list'
243
+ | 'listbox'
244
+ | 'listitem'
245
+ | 'log'
246
+ | 'main'
247
+ | 'marquee'
248
+ | 'math'
249
+ | 'menu'
250
+ | 'menubar'
251
+ | 'menuitem'
252
+ | 'menuitemcheckbox'
253
+ | 'menuitemradio'
254
+ | 'navigation'
255
+ | 'none'
256
+ | 'note'
257
+ | 'option'
258
+ | 'presentation'
259
+ | 'progressbar'
260
+ | 'radio'
261
+ | 'radiogroup'
262
+ | 'region'
263
+ | 'row'
264
+ | 'rowgroup'
265
+ | 'rowheader'
266
+ | 'scrollbar'
267
+ | 'search'
268
+ | 'searchbox'
269
+ | 'separator'
270
+ | 'slider'
271
+ | 'spinbutton'
272
+ | 'status'
273
+ | 'switch'
274
+ | 'tab'
275
+ | 'table'
276
+ | 'tablist'
277
+ | 'tabpanel'
278
+ | 'term'
279
+ | 'textbox'
280
+ | 'timer'
281
+ | 'toolbar'
282
+ | 'tooltip'
283
+ | 'tree'
284
+ | 'treegrid'
285
+ | 'treeitem';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/components",
3
3
  "type": "module",
4
- "version": "0.2.70",
4
+ "version": "0.2.72",
5
5
  "description": "A modern component library built with STX, featuring headwind utility classes and TypeScript syntax highlighting.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -58,14 +58,14 @@
58
58
  },
59
59
  "dependencies": {
60
60
  "@cwcss/crosswind": "^0.2.0",
61
- "@stacksjs/stx": "0.2.70",
62
- "bun-plugin-stx": "0.2.70",
61
+ "@stacksjs/stx": "0.2.72",
62
+ "bun-plugin-stx": "0.2.72",
63
63
  "ts-syntax-highlighter": "^0.2.1"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@types/bun": "^1.3.11",
67
67
  "bun-plugin-dtsx": "^0.21.17",
68
- "pickier": "^0.1.20",
68
+ "pickier": "^0.1.35",
69
69
  "typescript": "^6.0.2"
70
70
  }
71
71
  }
@@ -36,10 +36,10 @@ export function useLocalStorage<T>(
36
36
  initialValue: T,
37
37
  options: UseLocalStorageOptions<T> = {},
38
38
  ): {
39
- value: T
40
- setValue: (newValue: T | ((_prev: T) => T)) => void
41
- removeValue: () => void
42
- } {
39
+ value: T
40
+ setValue: (newValue: T | ((_prev: T) => T)) => void
41
+ removeValue: () => void
42
+ } {
43
43
  const {
44
44
  serializer = JSON.stringify,
45
45
  deserializer = JSON.parse,
@@ -28,76 +28,76 @@ export type AriaLive = 'off' | 'polite' | 'assertive'
28
28
  /**
29
29
  * ARIA role types
30
30
  */
31
- export type AriaRole =
32
- | 'alert'
33
- | 'alertdialog'
34
- | 'application'
35
- | 'article'
36
- | 'banner'
37
- | 'button'
38
- | 'cell'
39
- | 'checkbox'
40
- | 'columnheader'
41
- | 'combobox'
42
- | 'complementary'
43
- | 'contentinfo'
44
- | 'definition'
45
- | 'dialog'
46
- | 'directory'
47
- | 'document'
48
- | 'feed'
49
- | 'figure'
50
- | 'form'
51
- | 'grid'
52
- | 'gridcell'
53
- | 'group'
54
- | 'heading'
55
- | 'img'
56
- | 'link'
57
- | 'list'
58
- | 'listbox'
59
- | 'listitem'
60
- | 'log'
61
- | 'main'
62
- | 'marquee'
63
- | 'math'
64
- | 'menu'
65
- | 'menubar'
66
- | 'menuitem'
67
- | 'menuitemcheckbox'
68
- | 'menuitemradio'
69
- | 'navigation'
70
- | 'none'
71
- | 'note'
72
- | 'option'
73
- | 'presentation'
74
- | 'progressbar'
75
- | 'radio'
76
- | 'radiogroup'
77
- | 'region'
78
- | 'row'
79
- | 'rowgroup'
80
- | 'rowheader'
81
- | 'scrollbar'
82
- | 'search'
83
- | 'searchbox'
84
- | 'separator'
85
- | 'slider'
86
- | 'spinbutton'
87
- | 'status'
88
- | 'switch'
89
- | 'tab'
90
- | 'table'
91
- | 'tablist'
92
- | 'tabpanel'
93
- | 'term'
94
- | 'textbox'
95
- | 'timer'
96
- | 'toolbar'
97
- | 'tooltip'
98
- | 'tree'
99
- | 'treegrid'
100
- | 'treeitem'
31
+ export type AriaRole =
32
+ | 'alert'
33
+ | 'alertdialog'
34
+ | 'application'
35
+ | 'article'
36
+ | 'banner'
37
+ | 'button'
38
+ | 'cell'
39
+ | 'checkbox'
40
+ | 'columnheader'
41
+ | 'combobox'
42
+ | 'complementary'
43
+ | 'contentinfo'
44
+ | 'definition'
45
+ | 'dialog'
46
+ | 'directory'
47
+ | 'document'
48
+ | 'feed'
49
+ | 'figure'
50
+ | 'form'
51
+ | 'grid'
52
+ | 'gridcell'
53
+ | 'group'
54
+ | 'heading'
55
+ | 'img'
56
+ | 'link'
57
+ | 'list'
58
+ | 'listbox'
59
+ | 'listitem'
60
+ | 'log'
61
+ | 'main'
62
+ | 'marquee'
63
+ | 'math'
64
+ | 'menu'
65
+ | 'menubar'
66
+ | 'menuitem'
67
+ | 'menuitemcheckbox'
68
+ | 'menuitemradio'
69
+ | 'navigation'
70
+ | 'none'
71
+ | 'note'
72
+ | 'option'
73
+ | 'presentation'
74
+ | 'progressbar'
75
+ | 'radio'
76
+ | 'radiogroup'
77
+ | 'region'
78
+ | 'row'
79
+ | 'rowgroup'
80
+ | 'rowheader'
81
+ | 'scrollbar'
82
+ | 'search'
83
+ | 'searchbox'
84
+ | 'separator'
85
+ | 'slider'
86
+ | 'spinbutton'
87
+ | 'status'
88
+ | 'switch'
89
+ | 'tab'
90
+ | 'table'
91
+ | 'tablist'
92
+ | 'tabpanel'
93
+ | 'term'
94
+ | 'textbox'
95
+ | 'timer'
96
+ | 'toolbar'
97
+ | 'tooltip'
98
+ | 'tree'
99
+ | 'treegrid'
100
+ | 'treeitem'
101
101
 
102
102
  /**
103
103
  * Focus trap options
@@ -504,54 +504,54 @@ export function createRovingTabindex(
504
504
 
505
505
  switch (event.key) {
506
506
  case 'ArrowRight':
507
- if (orientation === 'horizontal' || orientation === 'both') {
508
- newIndex = currentIndex + 1
509
- if (newIndex > maxIndex) {
510
- newIndex = loop ? 0 : maxIndex
511
- }
512
- handled = true
507
+ if (orientation === 'horizontal' || orientation === 'both') {
508
+ newIndex = currentIndex + 1
509
+ if (newIndex > maxIndex) {
510
+ newIndex = loop ? 0 : maxIndex
513
511
  }
514
- break
512
+ handled = true
513
+ }
514
+ break
515
515
 
516
516
  case 'ArrowLeft':
517
- if (orientation === 'horizontal' || orientation === 'both') {
518
- newIndex = currentIndex - 1
519
- if (newIndex < 0) {
520
- newIndex = loop ? maxIndex : 0
521
- }
522
- handled = true
517
+ if (orientation === 'horizontal' || orientation === 'both') {
518
+ newIndex = currentIndex - 1
519
+ if (newIndex < 0) {
520
+ newIndex = loop ? maxIndex : 0
523
521
  }
524
- break
522
+ handled = true
523
+ }
524
+ break
525
525
 
526
526
  case 'ArrowDown':
527
- if (orientation === 'vertical' || orientation === 'both') {
528
- newIndex = currentIndex + 1
529
- if (newIndex > maxIndex) {
530
- newIndex = loop ? 0 : maxIndex
531
- }
532
- handled = true
527
+ if (orientation === 'vertical' || orientation === 'both') {
528
+ newIndex = currentIndex + 1
529
+ if (newIndex > maxIndex) {
530
+ newIndex = loop ? 0 : maxIndex
533
531
  }
534
- break
532
+ handled = true
533
+ }
534
+ break
535
535
 
536
536
  case 'ArrowUp':
537
- if (orientation === 'vertical' || orientation === 'both') {
538
- newIndex = currentIndex - 1
539
- if (newIndex < 0) {
540
- newIndex = loop ? maxIndex : 0
541
- }
542
- handled = true
537
+ if (orientation === 'vertical' || orientation === 'both') {
538
+ newIndex = currentIndex - 1
539
+ if (newIndex < 0) {
540
+ newIndex = loop ? maxIndex : 0
543
541
  }
544
- break
542
+ handled = true
543
+ }
544
+ break
545
545
 
546
546
  case 'Home':
547
- newIndex = 0
548
- handled = true
549
- break
547
+ newIndex = 0
548
+ handled = true
549
+ break
550
550
 
551
551
  case 'End':
552
- newIndex = maxIndex
553
- handled = true
554
- break
552
+ newIndex = maxIndex
553
+ handled = true
554
+ break
555
555
  }
556
556
 
557
557
  if (handled) {
@@ -207,13 +207,13 @@ export function createKeyframes(name: string, frames: Record<string, Record<stri
207
207
  const keyframesRule = `
208
208
  @keyframes ${name} {
209
209
  ${Object.entries(frames)
210
- .map(([percentage, styles]) => {
211
- const styleString = Object.entries(styles)
212
- .map(([prop, value]) => `${prop}: ${value};`)
213
- .join(' ')
214
- return `${percentage} { ${styleString} }`
215
- })
216
- .join('\n')}
210
+ .map(([percentage, styles]) => {
211
+ const styleString = Object.entries(styles)
212
+ .map(([prop, value]) => `${prop}: ${value};`)
213
+ .join(' ')
214
+ return `${percentage} { ${styleString} }`
215
+ })
216
+ .join('\n')}
217
217
  }
218
218
  `
219
219
 
@@ -13,7 +13,6 @@
13
13
  * })
14
14
  * ```
15
15
  */
16
-
17
16
  import process from 'node:process'
18
17
 
19
18
  /**
@@ -91,7 +91,7 @@ export const PropTypes: {
91
91
  string: new Validator<string>(
92
92
  value => typeof value === 'string',
93
93
  (value, propName, componentName) =>
94
- `Invalid prop \`${propName}\` of type \`${typeof value}\` supplied to \`${componentName}\`, expected \`string\`.`,
94
+ `Invalid prop \`${propName}\` of type \`${typeof value}\` supplied to \`${componentName}\`, expected \`string\`.`,
95
95
  ),
96
96
 
97
97
  /**
@@ -100,7 +100,7 @@ export const PropTypes: {
100
100
  number: new Validator<number>(
101
101
  value => typeof value === 'number' && !Number.isNaN(value),
102
102
  (value, propName, componentName) =>
103
- `Invalid prop \`${propName}\` of type \`${typeof value}\` supplied to \`${componentName}\`, expected \`number\`.`,
103
+ `Invalid prop \`${propName}\` of type \`${typeof value}\` supplied to \`${componentName}\`, expected \`number\`.`,
104
104
  ),
105
105
 
106
106
  /**
@@ -109,7 +109,7 @@ export const PropTypes: {
109
109
  boolean: new Validator<boolean>(
110
110
  value => typeof value === 'boolean',
111
111
  (value, propName, componentName) =>
112
- `Invalid prop \`${propName}\` of type \`${typeof value}\` supplied to \`${componentName}\`, expected \`boolean\`.`,
112
+ `Invalid prop \`${propName}\` of type \`${typeof value}\` supplied to \`${componentName}\`, expected \`boolean\`.`,
113
113
  ),
114
114
 
115
115
  /**
@@ -117,7 +117,7 @@ export const PropTypes: {
117
117
  */
118
118
  func: new Validator<(...args: any[]) => any>(
119
119
  value => typeof value === 'function',
120
- (value, propName, componentName) =>
120
+ (value, propName, componentName) =>
121
121
  `Invalid prop \`${propName}\` of type \`${typeof value}\` supplied to \`${componentName}\`, expected \`function\`.`,
122
122
  ),
123
123
 
@@ -127,7 +127,7 @@ export const PropTypes: {
127
127
  object: new Validator<object>(
128
128
  value => typeof value === 'object' && value !== null && !Array.isArray(value),
129
129
  (value, propName, componentName) =>
130
- `Invalid prop \`${propName}\` of type \`${typeof value}\` supplied to \`${componentName}\`, expected \`object\`.`,
130
+ `Invalid prop \`${propName}\` of type \`${typeof value}\` supplied to \`${componentName}\`, expected \`object\`.`,
131
131
  ),
132
132
 
133
133
  /**
@@ -136,7 +136,7 @@ export const PropTypes: {
136
136
  array: new Validator<any[]>(
137
137
  value => Array.isArray(value),
138
138
  (value, propName, componentName) =>
139
- `Invalid prop \`${propName}\` of type \`${typeof value}\` supplied to \`${componentName}\`, expected \`array\`.`,
139
+ `Invalid prop \`${propName}\` of type \`${typeof value}\` supplied to \`${componentName}\`, expected \`array\`.`,
140
140
  ),
141
141
 
142
142
  /**
@@ -156,7 +156,7 @@ export const PropTypes: {
156
156
  return new Validator(
157
157
  value => validValues.includes(value),
158
158
  (value, propName, componentName) =>
159
- `Invalid prop \`${propName}\` of value \`${value}\` supplied to \`${componentName}\`, expected one of [${validValues.map(v => JSON.stringify(v)).join(', ')}].`,
159
+ `Invalid prop \`${propName}\` of value \`${value}\` supplied to \`${componentName}\`, expected one of [${validValues.map(v => JSON.stringify(v)).join(', ')}].`,
160
160
  )
161
161
  },
162
162
 
@@ -168,9 +168,9 @@ export const PropTypes: {
168
168
  oneOfType(validators: Validator[]): Validator {
169
169
  return new Validator(
170
170
  (value, propName, componentName) =>
171
- validators.some(v => v.validate(value, propName, componentName)),
171
+ validators.some(v => v.validate(value, propName, componentName)),
172
172
  (_value, propName, componentName) =>
173
- `Invalid prop \`${propName}\` supplied to \`${componentName}\`, expected one of the specified types.`,
173
+ `Invalid prop \`${propName}\` supplied to \`${componentName}\`, expected one of the specified types.`,
174
174
  )
175
175
  },
176
176
 
@@ -187,7 +187,7 @@ export const PropTypes: {
187
187
  return value.every((item, index) => validator.validate(item, `${propName}[${index}]`, componentName))
188
188
  },
189
189
  (_value, propName, componentName) =>
190
- `Invalid prop \`${propName}\` supplied to \`${componentName}\`, expected array of specified type.`,
190
+ `Invalid prop \`${propName}\` supplied to \`${componentName}\`, expected array of specified type.`,
191
191
  )
192
192
  },
193
193
 
@@ -214,7 +214,7 @@ export const PropTypes: {
214
214
  return true
215
215
  },
216
216
  (_value, propName, componentName) =>
217
- `Invalid prop \`${propName}\` supplied to \`${componentName}\`, expected object matching specified shape.`,
217
+ `Invalid prop \`${propName}\` supplied to \`${componentName}\`, expected object matching specified shape.`,
218
218
  )
219
219
  },
220
220
 
@@ -227,7 +227,7 @@ export const PropTypes: {
227
227
  return new Validator(
228
228
  value => value instanceof expectedClass,
229
229
  (_value, propName, componentName) =>
230
- `Invalid prop \`${propName}\` supplied to \`${componentName}\`, expected instance of \`${expectedClass.name}\`.`,
230
+ `Invalid prop \`${propName}\` supplied to \`${componentName}\`, expected instance of \`${expectedClass.name}\`.`,
231
231
  )
232
232
  },
233
233
 
@@ -257,7 +257,7 @@ export const PropTypes: {
257
257
  return new Validator(
258
258
  value => typeof value === 'number' && value >= min,
259
259
  (value, propName, componentName) =>
260
- `Invalid prop \`${propName}\` of value \`${value}\` supplied to \`${componentName}\`, expected value >= ${min}.`,
260
+ `Invalid prop \`${propName}\` of value \`${value}\` supplied to \`${componentName}\`, expected value >= ${min}.`,
261
261
  )
262
262
  },
263
263
 
@@ -270,7 +270,7 @@ export const PropTypes: {
270
270
  return new Validator(
271
271
  value => typeof value === 'number' && value <= max,
272
272
  (value, propName, componentName) =>
273
- `Invalid prop \`${propName}\` of value \`${value}\` supplied to \`${componentName}\`, expected value <= ${max}.`,
273
+ `Invalid prop \`${propName}\` of value \`${value}\` supplied to \`${componentName}\`, expected value <= ${max}.`,
274
274
  )
275
275
  },
276
276
 
@@ -284,7 +284,7 @@ export const PropTypes: {
284
284
  return new Validator(
285
285
  value => typeof value === 'number' && value >= min && value <= max,
286
286
  (value, propName, componentName) =>
287
- `Invalid prop \`${propName}\` of value \`${value}\` supplied to \`${componentName}\`, expected value between ${min} and ${max}.`,
287
+ `Invalid prop \`${propName}\` of value \`${value}\` supplied to \`${componentName}\`, expected value between ${min} and ${max}.`,
288
288
  )
289
289
  },
290
290
 
@@ -297,7 +297,7 @@ export const PropTypes: {
297
297
  return new Validator(
298
298
  value => typeof value === 'string' && pattern.test(value),
299
299
  (value, propName, componentName) =>
300
- `Invalid prop \`${propName}\` of value \`${value}\` supplied to \`${componentName}\`, expected value matching pattern ${pattern}.`,
300
+ `Invalid prop \`${propName}\` of value \`${value}\` supplied to \`${componentName}\`, expected value matching pattern ${pattern}.`,
301
301
  )
302
302
  },
303
303
 
@@ -307,7 +307,7 @@ export const PropTypes: {
307
307
  email: new Validator<string>(
308
308
  value => typeof value === 'string' && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value),
309
309
  (value, propName, componentName) =>
310
- `Invalid prop \`${propName}\` of value \`${value}\` supplied to \`${componentName}\`, expected valid email address.`,
310
+ `Invalid prop \`${propName}\` of value \`${value}\` supplied to \`${componentName}\`, expected valid email address.`,
311
311
  ),
312
312
 
313
313
  /**
@@ -326,7 +326,7 @@ export const PropTypes: {
326
326
  }
327
327
  },
328
328
  (value, propName, componentName) =>
329
- `Invalid prop \`${propName}\` of value \`${value}\` supplied to \`${componentName}\`, expected valid URL.`,
329
+ `Invalid prop \`${propName}\` of value \`${value}\` supplied to \`${componentName}\`, expected valid URL.`,
330
330
  ),
331
331
  }
332
332