@forumone/throughline-design-contract 0.4.0 → 0.5.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 (2) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # @forumone/throughline-design-contract
2
2
 
3
+ ## 0.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 45724ee: A contract can say a boolean starts ticked, and be believed
8
+
9
+ `boolean` fields were generated as `{ type: 'checkbox', defaultValue: false }`,
10
+ with the `false` hardcoded. That made a component's own default unreachable from
11
+ the CMS. A checkbox is stored ticked or unticked and never absent, so `coerce`
12
+ always had a value to turn into a real boolean, the prop was never `undefined`,
13
+ and a signature default like `hasFacade = true` could not apply. Every boolean a
14
+ contract described arrived at its component as `false`, whatever the component
15
+ said.
16
+
17
+ It was not theoretical. `VideoEmbed.hasFacade` exists to keep a provider's
18
+ iframe — several hundred kilobytes and its third-party cookies — off the page
19
+ until a reader presses play, and its contract says "Leave on". Every embed an
20
+ author added shipped with it off: the YouTube iframe was in the server HTML from
21
+ first paint, setting cookies on readers who never pressed play, on a site whose
22
+ stated rule is that no third-party tracking runs before consent.
23
+
24
+ So `ContentField` gains an optional `defaultValue`, read by the checkbox branch
25
+ and rejected on any other field type — anywhere else it is a value the author
26
+ expects to take effect and nothing ever would.
27
+
28
+ `allOrNothing` had to learn about it too. That rule treats `false` as "nobody
29
+ touched this", which is right for a checkbox that starts unticked and exactly
30
+ wrong for one that starts ticked: left alone, a group holding a ticked-by-default
31
+ boolean would never look empty, and the rule would demand the group's required
32
+ children of an author who had typed nothing. It now takes a field's declared
33
+ default into account rather than the value alone.
34
+
35
+ **Existing stored values are untouched.** `defaultValue` applies to a field an
36
+ author has not yet filled in, so blocks already saved keep whatever is in the
37
+ database; a `VideoEmbed` saved before this change still renders without its
38
+ facade until someone edits it.
39
+
3
40
  ## 0.4.0
4
41
 
5
42
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forumone/throughline-design-contract",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "The contract every AI-ready design system satisfies to be consumable by Throughline.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -47,8 +47,8 @@
47
47
  "eslint": "^9.15.0",
48
48
  "typescript": "^5.6.0",
49
49
  "vitest": "^2.1.0",
50
- "@forumone/throughline-tsconfig": "0.0.0",
51
- "@forumone/throughline-eslint-config": "0.0.0"
50
+ "@forumone/throughline-eslint-config": "0.0.0",
51
+ "@forumone/throughline-tsconfig": "0.0.0"
52
52
  },
53
53
  "scripts": {
54
54
  "build": "tsc -b",