@tonguetoquill/collection 0.12.1 → 0.13.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tonguetoquill/collection",
3
- "version": "0.12.1",
3
+ "version": "0.13.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nibsbin/tonguetoquill-collection.git"
@@ -13,7 +13,7 @@ main:
13
13
  award:
14
14
  title: Award
15
15
  type: string
16
- category:
16
+ category_if_applicable:
17
17
  title: Category (If Applicable)
18
18
  type: string
19
19
  award_period:
@@ -25,25 +25,28 @@ main:
25
25
  majcom_fldcom_foa_or_dru:
26
26
  title: MAJCOM/FLDCOM/FOA/DRU
27
27
  type: string
28
- dafscduty_title:
28
+ dafsc_duty_title:
29
29
  title: DAFSC/Duty Title
30
30
  type: string
31
- nominees_telephone:
31
+ nominees_telephone_dsn_commercial:
32
32
  title: Nominee's Telephone (DSN/Commercial)
33
33
  type: string
34
- unitoffice_symbol:
34
+ unit_office_symbol_street_address_base_state_zip:
35
35
  title: Unit/Office Symbol/Street Address/Base/State/Zip Code
36
36
  type: string
37
- unit_commander:
38
- title: Rank/Name of Unit Commander & Telephone
37
+ unit_commander_rank_name_and_telephone:
38
+ title: Rank/Name of Unit Commander & Telephone (DSN/Commercial)
39
39
  type: string
40
40
  accomplishments:
41
41
  title: Specific Accomplishments (Page 1)
42
- type: string
42
+ type: markdown
43
43
  ui:
44
44
  multiline: true
45
- accomplishments_continued:
46
- title: Specific Accomplishments (Continued - Page 2)
45
+ rankname_of_nominee_page_2:
46
+ title: Rank/Name of Nominee (Page 2 — optional; defaults to Page 1)
47
47
  type: string
48
+ accomplishments_continued:
49
+ title: Specific Accomplishments (Continued — Page 2)
50
+ type: markdown
48
51
  ui:
49
52
  multiline: true
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  QUILL: daf1206@0.1.0
3
3
  award: "AIR AND SPACE ACHIEVEMENT MEDAL"
4
- category: "asdfasdfasdf"
5
- award_period: "1 Jan 24 - 31 Dec 24 asdfasdfasdf"
4
+ category: "Terrestrial"
5
+ award_period: "1 Jan 24 - 31 Dec 24"
6
6
  rankname_of_nominee: "SSgt Doe, John A."
7
7
  majcom_fldcom_foa_or_dru: "ACC"
8
8
  dafscduty_title: "1D7X1 / Cyber Operator"
@@ -17,7 +17,7 @@
17
17
  SPECIFIC_ACCOMPLISHMENTS_Use_Performance_Statements_IAW_DAFMAN_362806_Continued: "", // text
18
18
  ) = render-form(
19
19
  schema: json("FIELDS.json"),
20
- backgrounds: ("page1.png", "page2.png",),
20
+ backgrounds: ("page1.svg", "page2.svg",),
21
21
  values: (
22
22
  "AWARD": AWARD,
23
23
  "CATEGORY If Applicable": CATEGORY_If_Applicable,
@@ -3,21 +3,41 @@
3
3
 
4
4
  /// Global configuration for text rendering.
5
5
  /// Adjust these to change the overall form text appearance.
6
- #let FORM_MAX_TEXT_SIZE = 11pt
7
- #let FORM_MIN_TEXT_SIZE = 5pt
6
+ #let FORM_MAX_TEXT_SIZE = 14pt
7
+ #let FORM_MIN_TEXT_SIZE = 6pt
8
8
  #let FORM_MIN_CHARS_PER_LINE = 7
9
9
 
10
+ /// Coerce any user-supplied scalar value to a plain string.
11
+ /// Accepts the same types as Typst's built-in str(), plus content –
12
+ /// content is extracted via repr() with its surrounding square brackets stripped.
13
+ /// This lets callers write `[Hello]` (content) instead of `"Hello"` (string).
14
+ #let to-str(value) = {
15
+ if type(value) == content {
16
+ let r = repr(value)
17
+ // repr([hello]) → "[hello]" — strip the outer square brackets
18
+ if r.starts-with("[") and r.ends-with("]") {
19
+ r.slice(1, r.len() - 1)
20
+ } else {
21
+ r
22
+ }
23
+ } else {
24
+ str(value)
25
+ }
26
+ }
27
+
10
28
  /// Should this field shrink text to a single line rather than word-wrap?
11
29
  /// True for short/narrow fields with brief content (grades, ranks, dates).
30
+ /// `display` may be a string or content; char-count is skipped for content.
12
31
  #let should-shrink-to-fit(display, width, height) = {
13
32
  let aspect = width / height
14
- let char-count = display.len()
33
+ // content has no .len(); treat as "long" so only the dimension conditions apply
34
+ let char-count = if type(display) == str { display.len() } else { 99 }
15
35
  char-count <= 10 or height < 20pt or aspect > 4.0
16
36
  }
17
37
 
18
38
  /// Render a text-like field with shrink-to-fit and word-wrap fallback.
19
39
  #let render-text-field(display, width, height, x-inset, y-inset) = {
20
- set par(leading: 0.5em)
40
+ set par(leading: 0.25em)
21
41
  context {
22
42
  let avail-w = width - 2 * x-inset
23
43
  let avail-h = height - 2 * y-inset
@@ -81,8 +101,14 @@
81
101
  /// - field (dictionary): raw field entry from the schema
82
102
  #let render-field(field-type, value, width, height, field) = {
83
103
  if field-type == "text" {
84
- if value != none and str(value) != "" {
85
- render-text-field(str(value), width, height, 1.5pt, 1pt)
104
+ if value != none {
105
+ // Pass content through directly so styling (bold, italic, …) is preserved;
106
+ // for plain strings, skip empty values.
107
+ if type(value) == content {
108
+ render-text-field(value, width, height, 1.5pt, 1pt)
109
+ } else if str(value) != "" {
110
+ render-text-field(str(value), width, height, 1.5pt, 1pt)
111
+ }
86
112
  }
87
113
  } else if field-type == "checkbox" {
88
114
  if value == true {
@@ -104,16 +130,17 @@
104
130
  )
105
131
  }
106
132
  } else if field-type == "combobox" or field-type == "listbox" {
107
- let display = if value != none { str(value) } else { "" }
108
- // Resolve export value display label when options are present
133
+ // Default: render the raw value, preserving content styling if present.
134
+ // Override with the schema's display label when the export value matches.
135
+ let display = value
109
136
  if field.at("options", default: none) != none and value != none {
110
137
  for opt in field.options {
111
- if str(opt.at(0)) == str(value) {
138
+ if str(opt.at(0)) == to-str(value) {
112
139
  display = str(opt.at(1))
113
140
  }
114
141
  }
115
142
  }
116
- if display != "" {
143
+ if display != none and to-str(display) != "" {
117
144
  render-text-field(display, width, height, 2pt, 1pt)
118
145
  }
119
146
  }
@@ -129,10 +156,10 @@
129
156
  if group-value == none { return false }
130
157
  let ev = field.at("export_value", default: none)
131
158
  if ev != none {
132
- return str(ev) == str(group-value)
159
+ return str(ev) == to-str(group-value)
133
160
  }
134
161
  // Fallback: match against the stringified index
135
- str(index-in-group) == str(group-value)
162
+ str(index-in-group) == to-str(group-value)
136
163
  }
137
164
 
138
165
  /// Draw a debug overlay rectangle with a label for a field.