@aastrika/ai-elements 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.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,130 @@ see at a glance what to expect when they upgrade.
6
6
  Versions follow semver: a **minor** adds something, a **patch** fixes something,
7
7
  and neither removes anything a host was using.
8
8
 
9
+ ## 0.5.0
10
+
11
+ A visual pass over all three elements. Nothing a host calls has changed — same
12
+ tags, same attributes, same events — but the elements look different, so this is
13
+ a minor rather than a patch.
14
+
15
+ **Changed**
16
+ - The accent is blue (`#0EA5E9`), not gold. A host that sets `--aastrika-primary`
17
+ already overrides it and sees no change; a host that took our default gets the
18
+ new one
19
+ - Neutrals are cool rather than warm, so the elements sit on a white or pale
20
+ page without a cream cast
21
+ - A type scale replaces ad-hoc sizes, and one easing curve replaces four
22
+ durations written out by hand
23
+ - Cards, fields and buttons share one raised treatment: a hairline inside the
24
+ edge, a layered shadow, a 12-18px radius
25
+ - Tables in Reports lay out to a fixed width, so a long content title wraps in
26
+ its own column instead of pushing the action buttons off the row. The actions
27
+ column is sized to hold its buttons, and they sit on the row's centre line
28
+ like every other cell
29
+ - Assessment takes its material on one surface. Pasting links and choosing
30
+ files are two ways of saying the same thing, so they share a control, and
31
+ *Read sources* — which consumes both — sits on its toolbar. The picker and
32
+ the button used to stand side by side at the same size, which read as a
33
+ choice between them
34
+ - The file dropzone's label sits with its icon at the start of the zone rather
35
+ than centred in it, so a wide card no longer shows a small label marooned in
36
+ a lot of empty space
37
+ - Each step's number is joined to the next by a hairline, and step titles are
38
+ set as headings rather than at body size, so the card stack reads as a
39
+ sequence rather than as separate panels
40
+ - The heading scale: a 12px eyebrow and a 16px lead paragraph around the title.
41
+ At 11 and 14 the step from the title to the sentence under it was large
42
+ enough that the sentence read as small print
43
+
44
+ **Fixed**
45
+ - A step that is not your turn yet is readable. It was faded with `opacity`,
46
+ which multiplies through every child and took the headings to roughly 2:1
47
+ contrast — that reads as broken rather than as pending. The surface recedes
48
+ now; the words do not
49
+ - A disabled button, input or select keeps legible text. Browsers grey a
50
+ disabled control's own text with a colour that is not ours, so on a form that
51
+ starts disabled the labels were harder to read than the placeholder beside
52
+ them
53
+ - The main action of a step is readable while it waits. It was white text on a
54
+ 38% tint — about 1.9:1 — so the one button the card is asking you to press
55
+ was the least visible thing on it
56
+ - Cards show the depth they were given. A second rule later in the stylesheet
57
+ replaced the layered shadow with a 1px one, so every card rendered flat
58
+
59
+ **Added**
60
+ - `heading="off"` hides an element's own eyebrow and title, for a host that
61
+ already names the screen in its own chrome. The description is kept either
62
+ way. Defaults to `"on"`, so a host that says nothing sees no change
63
+ - `<aa-icon>` draws the 16 glyphs the elements use as inline SVG, stroked in
64
+ `currentColor`. No icon font, no sprite sheet, no network request
65
+ - Content Studio names the stage of a plan while it runs, with elapsed seconds
66
+ and a bar. A plan takes about a minute; with no feedback the page read as hung
67
+ - `--aastrika-danger`, `--aastrika-danger-line`, `--aastrika-danger-bg` and
68
+ `--aastrika-console-bg` / `--aastrika-console-fg` make the error and log
69
+ colours themeable. They were hardcoded, so a host on a dark page could not
70
+ reach them
71
+ - Every animation is behind `prefers-reduced-motion`
72
+
73
+ **Unchanged**
74
+ - `--aastrika-gold`, `--aastrika-gold-soft` and `--aastrika-gold-deep` still
75
+ work. They now alias the primary set and are removed at 1.0
76
+
77
+ ## 0.4.2
78
+
79
+ **Fixed**
80
+ - The elements now bring their own typeface, text colour and block layout. They
81
+ read `--aastrika-font`, which was documented as the way to set the typeface
82
+ but was never actually applied, so on a host with no font of its own the whole
83
+ feature rendered in the browser's serif default
84
+ - Buttons, inputs and selects inherit that typeface too. Browsers give form
85
+ controls a font of their own, so they stayed in the browser's face even where
86
+ the surrounding text was right
87
+ - The style picker fits as many cards as the width allows instead of always two,
88
+ so a card no longer stretches to hold one very long line on a wide screen
89
+ - The file dropzone keeps the shape of a target rather than stretching into a
90
+ letterbox with its label marooned in the middle
91
+ - Content Studio locks its form while a plan or a production is running. The
92
+ fields stayed editable, so a change made mid-run looked accepted but went
93
+ nowhere — the request had already left
94
+ - A `creator-filter` of only spaces is treated as no filter, rather than
95
+ filtering the report to a creator who cannot exist
96
+ - "Create **an** assessment", not "a"
97
+
98
+ **Added**
99
+ - `--aastrika-max-width` sets how wide a feature runs. It replaces a fixed
100
+ 860px, which a host could only override by reaching into our class names
101
+ - `--aastrika-primary`, `--aastrika-primary-soft`, `--aastrika-primary-deep` and
102
+ `--aastrika-on-primary` name the accent by its role. `--aastrika-gold*` still
103
+ work and now point at these, so nothing needs changing until 1.0
104
+
105
+ **Unchanged**
106
+ - The default palette resolves to exactly the same colours as 0.4.1. The two
107
+ accent variants stay literal rather than mixed from the primary, because no
108
+ mix reproduces them — deriving would have quietly restyled every consumer
109
+
110
+ ## 0.4.1
111
+
112
+ **Fixed**
113
+ - This page now renders on npm. The architecture diagram was mermaid, which npm
114
+ shows as raw source, and the callouts used GitHub alert syntax. No code change
115
+
116
+ ## 0.4.0
117
+
118
+ **Changed**
119
+ - Generating a quiz now starts the work and polls for it, instead of waiting on
120
+ one long request. Nothing to change in your code — same tag, same inputs, same
121
+ `assessmentReady` firing once with the finished set
122
+
123
+ **Why it matters**
124
+ - No 60-second ceiling: gateways and proxies commonly close a request at one
125
+ minute, which capped how many languages could be asked for at once
126
+ - The progress shown is the server's own, not an estimate
127
+ - Closing the tab no longer loses the work
128
+
129
+ **Notes for integrators**
130
+ - Upgrade the service and the package together. A 0.3.0 element cannot read what
131
+ a 0.4.0 service answers, and the reverse leaves the element waiting
132
+
9
133
  ## 0.3.0
10
134
 
11
135
  **Added**
package/README.md CHANGED
@@ -56,7 +56,6 @@ same questions, same answer key, ready to download.
56
56
 
57
57
  </div>
58
58
 
59
- > [!IMPORTANT]
60
59
  > **You also need gateway access.** This package authenticates nobody — your
61
60
  > gateway decides. See [Access](#access) for the groups each feature needs.
62
61
 
@@ -67,7 +66,6 @@ same questions, same answer key, ready to download.
67
66
  | | |
68
67
  |---|---|
69
68
  | **[The three features](#the-three-features)** | What each element actually does |
70
- | **[Setup](#setup)** | Install · access · configure · mount |
71
69
  | **[Configuration](#configuration)** | The three values, and why two are functions |
72
70
  | **[Access](#access)** | Which gateway groups each feature needs |
73
71
  | **[Inputs and events](#inputs-and-events)** | Open the form set up, act on the result |
@@ -133,7 +131,6 @@ fixes wording in place; the correct option is shared, so it is set once.
133
131
  Totals for videos, assessments, people and estimated spend, split by tool, with
134
132
  a searchable table of creators.
135
133
 
136
- > [!WARNING]
137
134
  > **Needs `contentAdmin`, and most consumers should not have it.** Spend figures
138
135
  > are not for a partner's ordinary users. The service applies no role check of
139
136
  > its own — the gateway's ACL is the only thing keeping them apart.
@@ -142,20 +139,6 @@ a searchable table of creators.
142
139
 
143
140
  ---
144
141
 
145
- ## Setup
146
-
147
- The [Quick start](#ship-it-in-three-steps) above is the whole integration. What each step
148
- is actually doing:
149
-
150
- | | Step | Notes |
151
- |---|---|---|
152
- | **1** | `npm i @aastrika/ai-elements` | No peer dependencies, no framework to match. Any bundler, or none |
153
- | **2** | Get gateway access | The package authenticates nobody — your gateway decides. See [Access](#access), then ask the Aastrika platform team |
154
- | **3** | `configure({ ... })` | Once, before the first element renders. Two of the three values are **functions** — see [Configuration](#configuration) |
155
- | **4** | Write the tag | Registration happens on import, so there is no third step |
156
-
157
- ---
158
-
159
142
  <details>
160
143
  <summary><b>React · Angular · Vue · plain HTML</b></summary>
161
144
 
@@ -264,40 +247,19 @@ calling it, as above, prevents both.
264
247
 
265
248
  ## How it fits together
266
249
 
267
- ```mermaid
268
- flowchart LR
269
- subgraph host["Your application"]
270
- cfg["configure()"]
271
- tag["&lt;aastrika-content-studio&gt;"]
272
- end
273
-
274
- subgraph pkg["@aastrika/ai-elements"]
275
- el["Custom element"]
276
- int["Interceptor"]
277
- end
278
-
279
- subgraph svc["Aastrika"]
280
- gw["Gateway<br/>checks the token"]
281
- api["AI service"]
282
- end
283
-
284
- cfg -.->|apiBase · auth · creator| int
285
- tag --> el
286
- el --> int
287
- int -->|"Authorization<br/>creator in the body"| gw
288
- gw --> api
289
- api -.->|JSON| el
290
- el -.->|onError| cfg
291
-
292
- classDef a fill:#0F766E,stroke:none,color:#fff
293
- classDef b fill:#f1f5f4,stroke:#cbd5d3,color:#16181d
294
- class el,int a
295
- class cfg,tag,gw,api b
250
+ ```
251
+ Your application @aastrika/ai-elements Aastrika
252
+ ──────────────── ───────────────────── ────────
253
+ configure() ─────── apiBase ───▶ interceptor ─── Authorization ───▶ gateway
254
+ auth ▲ creator in body │
255
+ creator │ ▼
256
+ <aastrika-… > ────────────────▶ element ◀────────── JSON ──────── AI service
257
+ ▲ │
258
+ └──── onError ────┘
296
259
  ```
297
260
 
298
- **Your application supplies three values. The package does the rest** — builds
299
- every request from `apiBase`, calls your two functions on each one, and renders
300
- into your page, styled through CSS custom properties.
261
+ Your application supplies three values. The package builds every request from
262
+ `apiBase`, calls your two functions on each one, and renders into your page.
301
263
 
302
264
  ---
303
265
 
@@ -312,6 +274,23 @@ Three values. That is the whole contract.
312
274
  | `creator` | **required** | Who is signed into *your* app. A name or email, shown as-is in the usage report |
313
275
  | `onError` | optional | Called whenever a request fails, so your monitoring hears about it |
314
276
 
277
+ **Pick the `creator` value with some care.** It is stamped on the content when
278
+ it is made and never changes afterwards, it is what the usage report groups by,
279
+ and it is shown to whoever reads that report. So it wants to be a person's name
280
+ — "Asha Kumari" reads well, and a login handle or an id does not.
281
+
282
+ Two traps worth knowing, both met in the wild:
283
+
284
+ - **A login handle is not a name.** `creatoruser_if0d` is unreadable, and if you
285
+ switch to it later, the report treats it as a different person from the name
286
+ the same user's earlier content was filed under.
287
+ - **Check your email field is not masked.** Some portals return
288
+ `cr********@yopmail.com` from their profile API. Every user then files content
289
+ under a near-identical string, and the report cannot tell them apart.
290
+
291
+ Returning `null` is a fair answer when you have no good name: the service
292
+ applies its own default rather than recording something meaningless.
293
+
315
294
  ### Why two of them are functions
316
295
 
317
296
  Tokens expire. A string handed over at startup stops working mid-session, and
@@ -325,7 +304,6 @@ getAuthHeaders: async () => ({ Authorization: `Bearer ${await auth.token()}` }),
325
304
  The same goes for `creator`: a function lets you switch user without reloading
326
305
  the page.
327
306
 
328
- > [!NOTE]
329
307
  > **`creator` is attribution, not identity.** It is recorded against whatever
330
308
  > the call creates and the usage report groups by it. Nothing verifies it — the
331
309
  > gateway decides whether the call is allowed at all.
@@ -348,7 +326,6 @@ needs:
348
326
  Deleting anything needs `contentAdmin` as well. Without `contentUpdate` the
349
327
  features still work, but the revise step returns 403.
350
328
 
351
- > [!CAUTION]
352
329
  > **`generate-video` is the only call that spends real money**, and it sits on a
353
330
  > deliberately low rate limit. Users see a cost estimate before triggering it.
354
331
 
@@ -428,27 +405,26 @@ All are **starting values** the user can still change.
428
405
  | | `default-difficulty` | `mixed`, `easy`, `medium`, `hard` |
429
406
  | | `default-translate-into` | Also produce the same questions in these languages, comma-separated: `"ta,or,bn"` |
430
407
  | `reports` | `creator-filter` | Opens filtered to one creator |
408
+ | *all three* | `heading` | `off` hides the element's own eyebrow and title. Defaults to `on` |
409
+
410
+ **`heading="off"`** is for a host whose own chrome already names the screen — a
411
+ breadcrumb or a tab bar — where the element's title would say it a second time.
412
+ The description under the title is kept either way: it says what the feature
413
+ does, which a breadcrumb does not. Use it instead of hiding the title with CSS;
414
+ our class names are ours to rename, and a stylesheet reaching in breaks silently
415
+ when they change.
431
416
 
432
417
  ```html
433
- <aastrika-content-studio default-language="kn" default-aspect-ratio="9:16">
434
- </aastrika-content-studio>
418
+ <!-- your page already shows "AI Studio › Assessment Creation" -->
419
+ <aastrika-assessment heading="off"></aastrika-assessment>
435
420
  ```
436
421
 
437
- ### One quiz, several languages
438
-
439
- `default-translate-into` produces the **same** questions in other languages —
440
- same order, same options, same answer key — so one answer key marks every
441
- language and scores compare across them.
442
-
443
422
  ```html
444
- <aastrika-assessment default-language="hi" default-translate-into="en,mr">
445
- </aastrika-assessment>
423
+ <aastrika-content-studio default-language="kn" default-aspect-ratio="9:16">
424
+ </aastrika-content-studio>
446
425
  ```
447
426
 
448
- The reviewer gets a tab per language. Excel holds every language, one sheet
449
- each; CSV holds one language at a time.
450
-
451
- `assessmentReady` reports what came back:
427
+ ### Translations, in the event
452
428
 
453
429
  ```js
454
430
  el.addEventListener('assessmentReady', (e) => {
@@ -459,8 +435,8 @@ el.addEventListener('assessmentReady', (e) => {
459
435
 
460
436
  `languages` can be shorter than what was asked for. A translation is checked for
461
437
  question count, ids, answer key, clinical numbers and script; one that fails is
462
- dropped rather than stored wrong. What is **not** checked is whether the
463
- translation reads well — that still needs someone who speaks the language.
438
+ dropped rather than stored wrong. What is **not** checked is whether it reads
439
+ well — that still needs someone who speaks the language.
464
440
 
465
441
  ### Events
466
442
 
@@ -74,6 +74,15 @@ export declare const ready: Promise<unknown>;
74
74
 
75
75
  /** `<aastrika-content-studio>` — a document becomes a narrated training video. */
76
76
  interface AastrikaContentStudioElement extends HTMLElement {
77
+ /**
78
+ * `'off'` hides the element's own eyebrow and title. Defaults to `'on'`.
79
+ *
80
+ * For a host that already names the screen in its own chrome — a breadcrumb,
81
+ * a tab bar — where the element's heading would say it a second time. The
82
+ * description below the title is kept either way: it says what the feature
83
+ * does, which a breadcrumb does not.
84
+ */
85
+ heading?: 'on' | 'off';
77
86
  /**
78
87
  * `'on'` shows the segment editor for an uploaded video. Defaults to `'off'`.
79
88
  *
@@ -117,6 +126,15 @@ interface AastrikaContentStudioElement extends HTMLElement {
117
126
 
118
127
  /** `<aastrika-assessment>` — source material becomes a validated MCQ set. */
119
128
  interface AastrikaAssessmentElement extends HTMLElement {
129
+ /**
130
+ * `'off'` hides the element's own eyebrow and title. Defaults to `'on'`.
131
+ *
132
+ * For a host that already names the screen in its own chrome — a breadcrumb,
133
+ * a tab bar — where the element's heading would say it a second time. The
134
+ * description below the title is kept either way: it says what the feature
135
+ * does, which a breadcrumb does not.
136
+ */
137
+ heading?: 'on' | 'off';
120
138
  /** Language the form opens on. */
121
139
  defaultLanguage?: string;
122
140
  /** How many questions to ask for. */
@@ -157,6 +175,15 @@ interface AastrikaAssessmentElement extends HTMLElement {
157
175
 
158
176
  /** `<aastrika-reports>` — usage and spend. Needs `contentAdmin` at the gateway. */
159
177
  interface AastrikaReportsElement extends HTMLElement {
178
+ /**
179
+ * `'off'` hides the element's own eyebrow and title. Defaults to `'on'`.
180
+ *
181
+ * For a host that already names the screen in its own chrome — a breadcrumb,
182
+ * a tab bar — where the element's heading would say it a second time. The
183
+ * description below the title is kept either way: it says what the feature
184
+ * does, which a breadcrumb does not.
185
+ */
186
+ heading?: 'on' | 'off';
160
187
  /** Opens filtered to one creator. The user can still clear it. */
161
188
  creatorFilter?: string;
162
189