@fusion.dev/helix-core 0.58.0 → 0.58.1

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.
@@ -6471,6 +6471,14 @@
6471
6471
  "module": "./utils/value-as/value-as.js"
6472
6472
  }
6473
6473
  },
6474
+ {
6475
+ "kind": "js",
6476
+ "name": "isDateValue",
6477
+ "declaration": {
6478
+ "name": "isDateValue",
6479
+ "module": "./utils/value-as/value-as.js"
6480
+ }
6481
+ },
6474
6482
  {
6475
6483
  "kind": "js",
6476
6484
  "name": "numberAsValue",
@@ -11276,6 +11284,24 @@
11276
11284
  ],
11277
11285
  "description": "The date a `YYYY-MM-DD` value names, at midnight UTC, or `null`.\n\nThe range check is not decoration. `2026-02-31` matches the pattern and\n`Date.UTC` rolls it forward to 3 March, so without reading the parts back a\ncontrol would report a date the reader never typed and never saw."
11278
11286
  },
11287
+ {
11288
+ "kind": "function",
11289
+ "name": "isDateValue",
11290
+ "return": {
11291
+ "type": {
11292
+ "text": "boolean"
11293
+ }
11294
+ },
11295
+ "parameters": [
11296
+ {
11297
+ "name": "value",
11298
+ "type": {
11299
+ "text": "string"
11300
+ }
11301
+ }
11302
+ ],
11303
+ "description": "Whether a value names a real day, which is the shape *and* the range.\n\nThe predicate form of the conversion above, here rather than in a family\nbecause a family writing its own gets the shape right and the range wrong.\nTwo did: one tested `\\d{4}-\\d{2}-\\d{2}` and reported `2026-02-31` as whole\nwhile its own `valueAsDate` answered `null`, and the other guarded\n`Number.isNaN(date.getTime())`, which never fires, `Date.UTC(2026, 1, 31)`\nbeing a perfectly good third of March."
11304
+ },
11279
11305
  {
11280
11306
  "kind": "function",
11281
11307
  "name": "dateAsValue",
@@ -11376,6 +11402,14 @@
11376
11402
  "module": "src/utils/value-as/value-as.ts"
11377
11403
  }
11378
11404
  },
11405
+ {
11406
+ "kind": "js",
11407
+ "name": "isDateValue",
11408
+ "declaration": {
11409
+ "name": "isDateValue",
11410
+ "module": "src/utils/value-as/value-as.ts"
11411
+ }
11412
+ },
11379
11413
  {
11380
11414
  "kind": "js",
11381
11415
  "name": "dateAsValue",
package/dist/index.d.ts CHANGED
@@ -64,5 +64,5 @@ export { slotFilled } from './utils/slot-filled/slot-filled.js';
64
64
  export { tellDisclosure } from './utils/tell-disclosure/tell-disclosure.js';
65
65
  export { subscribe } from './utils/ticker/ticker.js';
66
66
  export { type HelixStatusTone, TONE_MARKS, type ToneMark, toneMark, } from './utils/tone-marks/tone-marks.js';
67
- export { dateAsValue, numberAsValue, timeAsValue, valueAsDate, valueAsNumber, valueAsTime, } from './utils/value-as/value-as.js';
67
+ export { dateAsValue, isDateValue, numberAsValue, timeAsValue, valueAsDate, valueAsNumber, valueAsTime, } from './utils/value-as/value-as.js';
68
68
  export { writtenList } from './utils/written-list/written-list.js';
package/dist/index.js CHANGED
@@ -64,5 +64,5 @@ export { slotFilled } from './utils/slot-filled/slot-filled.js';
64
64
  export { tellDisclosure } from './utils/tell-disclosure/tell-disclosure.js';
65
65
  export { subscribe } from './utils/ticker/ticker.js';
66
66
  export { TONE_MARKS, toneMark, } from './utils/tone-marks/tone-marks.js';
67
- export { dateAsValue, numberAsValue, timeAsValue, valueAsDate, valueAsNumber, valueAsTime, } from './utils/value-as/value-as.js';
67
+ export { dateAsValue, isDateValue, numberAsValue, timeAsValue, valueAsDate, valueAsNumber, valueAsTime, } from './utils/value-as/value-as.js';
68
68
  export { writtenList } from './utils/written-list/written-list.js';
@@ -6,6 +6,17 @@
6
6
  * control would report a date the reader never typed and never saw.
7
7
  */
8
8
  export declare const valueAsDate: (value: string) => Date | null;
9
+ /**
10
+ * Whether a value names a real day, which is the shape *and* the range.
11
+ *
12
+ * The predicate form of the conversion above, here rather than in a family
13
+ * because a family writing its own gets the shape right and the range wrong.
14
+ * Two did: one tested `\d{4}-\d{2}-\d{2}` and reported `2026-02-31` as whole
15
+ * while its own `valueAsDate` answered `null`, and the other guarded
16
+ * `Number.isNaN(date.getTime())`, which never fires, `Date.UTC(2026, 1, 31)`
17
+ * being a perfectly good third of March.
18
+ */
19
+ export declare const isDateValue: (value: string) => boolean;
9
20
  /** The `YYYY-MM-DD` value for a date, or the empty string, which is how a control says nothing. */
10
21
  export declare const dateAsValue: (date: Date | null) => string;
11
22
  /**
@@ -11,6 +11,7 @@ export const valueAsDate = (value) => {
11
11
  const rolled = date.getUTCFullYear() !== year || date.getUTCMonth() !== month - 1 || date.getUTCDate() !== day;
12
12
  return rolled ? null : date;
13
13
  };
14
+ export const isDateValue = (value) => valueAsDate(value) !== null;
14
15
  export const dateAsValue = (date) => {
15
16
  if (!date || Number.isNaN(date.getTime())) {
16
17
  return '';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fusion.dev/helix-core",
3
3
  "description": "Helix element primitives: base classes, mixins, decorators, utilities.",
4
- "version": "0.58.0",
4
+ "version": "0.58.1",
5
5
  "license": "MIT",
6
6
  "author": "Ross Sheppard <ross.sheppard@fusion.dev>",
7
7
  "repository": {
@@ -34,12 +34,12 @@
34
34
  "bugs": "https://github.com/project-fusion/fusion/issues",
35
35
  "dependencies": {
36
36
  "@floating-ui/dom": "^1.8.0",
37
- "@fusion.dev/helix-icons": "0.58.0"
37
+ "@fusion.dev/helix-icons": "0.58.1"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@custom-elements-manifest/analyzer": "^0.11.0",
41
- "@fusion.dev/helix-cem": "0.58.0",
42
- "@fusion.dev/helix-testing": "0.58.0",
41
+ "@fusion.dev/helix-cem": "0.58.1",
42
+ "@fusion.dev/helix-testing": "0.58.1",
43
43
  "lit": "^3.2.1"
44
44
  },
45
45
  "homepage": "https://fusion.dev",