@threadlabs/looma 0.43.2 → 0.44.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.
Files changed (47) hide show
  1. package/components/ui-callout/ui-callout.html +4 -4
  2. package/components/ui-dialog/ui-dialog.html +0 -4
  3. package/components/ui-editor-footnote-editor/ui-editor-footnote-editor.html +4 -50
  4. package/components/ui-editor-footnote-editor/ui-editor-footnote-editor.js +10 -31
  5. package/dist/index.js +1 -1
  6. package/docs/README.md +55 -17
  7. package/docs/card.html +1 -1
  8. package/docs/catalog-view.js +11 -5
  9. package/docs/catalog-view.mjs +4 -3
  10. package/docs/catalog.json +73 -109
  11. package/docs/catalog.mjs +1 -1
  12. package/docs/customizer-render.mjs +9 -8
  13. package/docs/customizer.js +8 -8
  14. package/docs/documentation.css +2 -2
  15. package/docs/examples/ui-editor-footnote-editor/examples/01-note.behavior.js +9 -0
  16. package/docs/fonts.mjs +1 -1
  17. package/docs/index.mjs +1 -1
  18. package/docs/render.mjs +17 -6
  19. package/docs/site.mjs +14 -5
  20. package/docs/theme.mjs +96 -16
  21. package/editor/chunks/extensions.js +10 -0
  22. package/editor/extensions/footnote.d.ts +1 -0
  23. package/editor/footnote-editing.d.ts +16 -27
  24. package/package.json +4 -3
  25. package/styles/ui-callout.css +4 -4
  26. package/styles/ui-dialog.css +0 -8
  27. package/theme-dark.css +9 -9
  28. package/theme-high-contrast.css +4 -0
  29. package/theme-light.css +6 -6
  30. package/tokens.css +20 -18
  31. package/vanilla/UiEditorFootnoteEditor.d.ts +0 -5
  32. package/vanilla/UiEditorFootnoteEditor.js +20 -68
  33. package/vue/UiCallout.vue +4 -4
  34. package/vue/UiDialog.vue +0 -7
  35. package/vue/UiEditorFootnoteEditor.d.ts +11 -29
  36. package/vue/UiEditorFootnoteEditor.vue +21 -173
  37. package/vue/chunks/UiCallout.js +1 -1
  38. package/vue/chunks/UiDialog.js +1 -1
  39. package/vue/chunks/UiEditorFootnoteEditor.js +34 -226
  40. package/vue/chunks/UiEditorImageToolbar.js +1 -1
  41. package/vue/chunks/UiEditorLinkForm.js +1 -1
  42. package/vue/chunks/compact.js +565 -0
  43. package/vue/components.css +320 -327
  44. package/vue/editor/LoomaEditor.d.ts +2 -2
  45. package/vue/editor/compact/index.js +1 -562
  46. package/vue/editor/index.js +173 -80
  47. package/vue/index.js +2 -2
package/docs/README.md CHANGED
@@ -12,25 +12,34 @@ In a project with a `package.json`, install Looma and its documentation tools:
12
12
 
13
13
  ```sh
14
14
  pnpm add @threadlabs/looma @nextwebwg/html-next@1.0.0-alpha.69
15
- pnpm add -D 'markupress@>=0.10.2 <1' '@threadlabs/markupkit@>=0.2.0 <1' vite
15
+ pnpm add -D 'markupress@>=0.12.0 <1' '@threadlabs/markupkit@>=0.2.0 <1' vite
16
16
  pnpm exec looma-docs init --title "The Fellowship"
17
17
  pnpm exec looma-docs dev
18
18
  ```
19
19
 
20
- Use the tool versions accepted by Looma's optional peer dependencies. Markupress 0.10.2 and later compatible 0.x releases supply the shared Looma site header, mobile home-page navigation, and one appearance button that cycles Automatic, Light and Dark. Regular component imports do not load the documentation server. Vue and Tiptap remain optional; install them when your own authored documentation mounts the Vue editor.
20
+ Use the tool versions accepted by Looma's optional peer dependencies. Markupress 0.12.0 and later compatible 0.x releases render authored documentation with Expressmark’s standard syntax and supply section navigation with category overview links, a full-height sidebar, the shared Looma site header, mobile home-page navigation, and one appearance button that cycles Automatic, Light and Dark. Regular component imports do not load the documentation server. Vue and Tiptap remain optional; install them when your own authored documentation mounts the Vue editor.
21
21
 
22
22
  Initialization creates three project-owned files:
23
23
 
24
- | File | Purpose |
25
- | --- | --- |
26
- | `looma.docs.json` | Documentation title, content, discovery roots and theme paths. |
27
- | `looma.theme.json` | Editable semantic decisions. |
28
- | `looma.theme.css` | Generated theme, including the shared derivation rules. |
24
+ ::: table
25
+
26
+ - File: `looma.docs.json`
27
+ Purpose: Documentation title, content, discovery roots and theme paths.
28
+
29
+ - File: `looma.theme.json`
30
+ Purpose: Editable semantic decisions.
31
+
32
+ - File: `looma.theme.css`
33
+ Purpose: Generated theme, including the shared derivation rules.
34
+
35
+ :::
29
36
 
30
37
  Import `./looma.theme.css` after Looma's tokens and palette in your application's entry point. The initializer prints that import; it leaves existing application files intact. Commit the configuration, recipe and CSS. Add `.looma/` to your project's ignore file: it contains disposable generated documentation and tooling files.
31
38
 
32
39
  The CSS includes generated derivation rules as well as values. Re-export or save your recipe after a Looma upgrade to adopt updated rules.
33
40
 
41
+ Component navigation keeps every category linked and lists reference pages only beneath the current category. Category links open galleries with the matching filter selected; individual links open their references. Section selection survives reload and browser history, and overview cards render before JavaScript. The Section dropdown navigates between galleries; Filter components narrows only the cards on the current page, and changing sections starts with a fresh filter. Markupress supplies the section navigation and its continuous sidebar background. Editor references have their own section, with concise display names independent of component tags.
42
+
34
43
  Open the local address printed by `dev`, choose **Customize**, and save your theme. Saving updates those shared theme files and rebuilds the documentation. Your application consumes the same CSS import. A static or public site instead offers CSS and recipe downloads.
35
44
 
36
45
  Starting points set a complete identity across color, typography, shape, spacing,
@@ -92,7 +101,16 @@ Documentation navigation stays out of the customization workspace. **Material &
92
101
 
93
102
  Material starts with Finish, Transparency and Frosting. Advanced material contains the light source and its color, edge light, glow, depth and decorative rim extent. The quiet grid stays fixed across the customizer while the page scrolls; content plates remain opaque.
94
103
 
95
- A refined preset keeps its name with “customized” beside it. **Reset material** resets only material and light; **Reset palette** resets only the palette. These family choices are recorded in the recipe's optional `presets` mapping. The `values` mapping remains the complete source of the generated theme; a preset is a named combination of those values.
104
+ The starting themes make different choices within the same controls:
105
+
106
+ - **Clear:** gray neutrals, restrained status tints and minimal depth.
107
+ - **Gold:** warm primary actions, plum links and selection, rounded polished surfaces, and Lato/Fraunces.
108
+ - **Bookish:** wine guidance and confirmations, coral and leather accents, restrained risk colors, and Open Sans/Newsreader.
109
+ - **Editorial:** flat ink-and-paper surfaces, rust links, serif type, and primary-color statuses distinguished by icons and labels.
110
+ - **Night:** cool supporting accents, amber warnings, glass material, and IBM Plex Sans/Mono.
111
+ - **Garden:** forest, clay and gold, soft rounded surfaces, and Nunito Sans/Lora.
112
+
113
+ A refined preset keeps its name with “customized” beside it. **Reset material** resets only material and light; **Reset palette** resets only the palette. Status color relationships offer **Semantic colors**, **Less color**, and **Primary + icons**. **Reset status colors** restores the selected status relationship without changing brand colors, type, or material; advanced per-status relationships remain available. These family choices are recorded in the recipe's optional `presets` mapping. The `values` mapping remains the complete source of the generated theme; a preset is a named combination of those values.
96
114
 
97
115
  Number controls accept arithmetic such as `1rem / 1.2` or `150ms * 2`, calculate on entry and show the result. Unit changes preserve the quantity. Sliders include exact entry, and curve handles support dragging and arrow keys alongside numeric coordinates. LightEditor keeps its coordinate fields under **Exact position**. Light and curve drags preserve the grab offset; Escape or pointer cancellation restores the gesture start without creating a saved edit.
98
116
 
@@ -126,15 +144,30 @@ locally saved CSS. System font uses the operating system and needs no download.
126
144
 
127
145
  The [public token reference](https://github.com/threadlabs-studio/looma/blob/main/apps/docs-next/docs/03.%28Foundations%29/tokens.md#optional-semantic-theme-recipe) lists defaults, customizer ranges, dependencies and derived outputs for every family. The recipe's `values` keys map to public CSS properties or generator decisions as follows. Values are strings; omitted keys take defaults and unknown keys are rejected.
128
146
 
129
- | Family | Recipe decisions → CSS properties |
130
- | --- | --- |
131
- | Base colors | `action` → `--ui-accent`; `canvas` → `--ui-surface`; `surface` → `--ui-surface-raised`; `text` → `--ui-text` |
132
- | Palette generation (recipe only) | `warmth`, `color-intensity`, `palette-relationship`, optional `secondary-action`/`tertiary-action`, `neutral-source`, `neutral-strength`, `neutral-border-contrast`, `status-chroma`, each status’s `*-source`, and `selection-accent`/`focus-accent`/`link-accent`; compiled into resolved color roles, with no matching CSS custom properties |
133
- | Type | `body-font` → `--ui-font-sans`; `display-font` → `--ui-font-display`; `text-size` → `--ui-font-size`; `label-size` → `--ui-field-label-font-size` (`inherit` follows body); `text-weight` → `--ui-font-medium` |
134
- | Rhythm & spacing | `rhythm` → `--ui-rhythm`; `control-roominess` → `--ui-control-roominess`; `spacing` → `--ui-spacing`; `scale-contrast` → `--ui-scale-ratio`; `space-curve` → `--ui-space-curve`; `corner-roundness` → `--ui-radius-md`; `line-weight` → `--ui-border-width` |
135
- | Depth and transmission | `outer-depth` → `--ui-outer-depth`; `inner-depth` → `--ui-inner-depth`; `glassiness` → `--ui-glassiness`; `surface-separation` → `--ui-surface-separation`; `translucency` → `--ui-overlay-translucency` |
136
- | Finish and illumination | `finish` → `--ui-finish`; `edge-light` → `--ui-edge-light`; `glow` → `--ui-glow`; `light-x` → `--ui-light-x`; `light-y` → `--ui-light-y`; `light-spread` → `--ui-light-spread`; `light-strength` → `--ui-light-strength` |
137
- | Motion | `response-time` → `--ui-motion-fast`; `response-curve` → `--ui-motion-ease` |
147
+ ::: table
148
+
149
+ - Family: Base colors
150
+ Recipe decisions → CSS properties: `action` → `--ui-accent`; `canvas` → `--ui-surface`; `surface` → `--ui-surface-raised`; `text` → `--ui-text`
151
+
152
+ - Family: Palette generation (recipe only)
153
+ Recipe decisions → CSS properties: `warmth`, `color-intensity`, `palette-relationship`, optional `secondary-action`/`tertiary-action`, `neutral-source`, `neutral-strength`, `neutral-border-contrast`, `status-chroma`, each status’s `*-source`, and `selection-accent`/`focus-accent`/`link-accent`; compiled into resolved color roles, with no matching CSS custom properties
154
+
155
+ - Family: Type
156
+ Recipe decisions → CSS properties: `body-font` → `--ui-font-sans`; `display-font` → `--ui-font-display`; `text-size` → `--ui-font-size`; `label-size` → `--ui-field-label-font-size` (`inherit` follows body); `text-weight` → `--ui-font-medium`
157
+
158
+ - Family: Rhythm & spacing
159
+ Recipe decisions → CSS properties: `rhythm` → `--ui-rhythm`; `control-roominess` → `--ui-control-roominess`; `spacing` → `--ui-spacing`; `scale-contrast` → `--ui-scale-ratio`; `space-curve` → `--ui-space-curve`; `corner-roundness` → `--ui-radius-md`; `line-weight` → `--ui-border-width`
160
+
161
+ - Family: Depth and transmission
162
+ Recipe decisions → CSS properties: `outer-depth` → `--ui-outer-depth`; `inner-depth` → `--ui-inner-depth`; `glassiness` → `--ui-glassiness`; `surface-separation` → `--ui-surface-separation`; `translucency` → `--ui-overlay-translucency`
163
+
164
+ - Family: Finish and illumination
165
+ Recipe decisions → CSS properties: `finish` → `--ui-finish`; `edge-light` → `--ui-edge-light`; `glow` → `--ui-glow`; `light-x` → `--ui-light-x`; `light-y` → `--ui-light-y`; `light-spread` → `--ui-light-spread`; `light-strength` → `--ui-light-strength`
166
+
167
+ - Family: Motion
168
+ Recipe decisions → CSS properties: `response-time` → `--ui-motion-fast`; `response-curve` → `--ui-motion-ease`
169
+
170
+ :::
138
171
 
139
172
  Palette generation decisions exist only in the JSON recipe; edit it and regenerate to change resolved colors. Geometry, material and motion properties feed the included CSS recipe. `--ui-control-size` remains a derived public height role: author numeric roominess (default 2.5, range 2–4) instead of an absolute control size. Spacing (default 1, range 0.75–1.5) changes space without changing heights. Base text defaults to `16px` and sets the document root. Type and geometry derive from `1rem` once; the base editor accepts only px. Other relative length inputs preserve their units; editor ranges convert through the chosen root, and generated guards keep the documented pixel bounds. Visible size samples report actual rem/px heights. Set the base on `:root`; opposite-mode boundaries retain that same rem root.
140
173
 
@@ -229,13 +262,18 @@ Place a `docs.json` beside it to join a shared category:
229
262
  ```json
230
263
  {
231
264
  "title": "Office status",
265
+ "summary": "The office’s current status.",
232
266
  "description": "A status for the Fellowship office.",
233
267
  "group": "display"
234
268
  }
235
269
  ```
236
270
 
271
+ An optional `summary` supplies the short card text; `description` supplies the full reference introduction. Cards use `description` when no summary is authored.
272
+
237
273
  Looma's category IDs are listed in its published catalog. Components without a category appear in **Project components**. A discovery root can declare additional `groups` as `{ "id": "…", "label": "…" }` entries. The top-level `categories` mapping explicitly maps category IDs when combining catalogs.
238
274
 
275
+ A component card should demonstrate its defining feature, including a non-default configuration when that makes the behavior clear. A feature demonstration does not require changing the component’s default.
276
+
239
277
  Put authored examples in an `examples/` directory beside the resource. Each `.html` example starts with a metadata comment:
240
278
 
241
279
  ```html
package/docs/card.html CHANGED
@@ -57,7 +57,7 @@
57
57
  .example-heading p { margin: var(--ui-space-2) 0 0 !important; color: var(--ui-text-secondary); font-size: var(--ui-font-size-sm); }
58
58
  :host([reference]) .preview { min-block-size: 11rem; display: grid !important; align-items: center !important; border-block-end: 0; }
59
59
  :host([reference]) .preview::before { display: none; }
60
- .preview { position: relative; min-block-size: 13rem; overflow: hidden; border-block-end: var(--ui-border-width) solid var(--ui-border); background: color-mix(in srgb, var(--_card-accent) 5%, var(--ui-surface)); }
60
+ .preview { position: relative; min-block-size: 13rem; overflow: hidden; border-block-end: var(--ui-border-width) solid var(--ui-border); background: var(--ui-surface-raised); }
61
61
  .preview::before { position: absolute; inset-block-start: 0; inset-inline-start: 0; inline-size: 3.5rem; block-size: 3px; background: var(--_card-accent); content: ""; z-index: 1; }
62
62
  .stage { inline-size: var(--_preview-width, 100%); max-inline-size: 100%; min-inline-size: 0; }
63
63
  footer { display: flex !important; align-items: center !important; justify-content: space-between !important; gap: var(--ui-space-2) !important; }
@@ -1,18 +1,24 @@
1
1
  /** Native catalog entries own their visibility; component previews keep their own layout. */
2
2
  export function connect(host) {
3
- const { query, category, count } = host.refs;
3
+ const { query, category, count, filters } = host.refs;
4
4
  const groups = [...host.element.querySelectorAll('[data-catalog-group]')];
5
5
  const items = [...host.element.querySelectorAll('[data-catalog-search]')];
6
+ query.value = '';
6
7
  const filter = () => {
7
8
  const words = query.value.toLocaleLowerCase().trim().split(/\s+/).filter(Boolean);
8
9
  let visible = 0;
9
10
  for (const item of items) {
10
- item.hidden = Boolean(category.value && item.dataset.category !== category.value) || !words.every(word => item.dataset.catalogSearch.toLocaleLowerCase().includes(word));
11
+ item.hidden = !words.every(word => item.dataset.catalogSearch.toLocaleLowerCase().includes(word));
11
12
  if (!item.hidden) visible++;
12
13
  }
13
14
  for (const group of groups) group.hidden = ![...group.querySelectorAll('[data-catalog-search]')].some(item => !item.hidden);
14
- count.textContent = visible === 0 ? 'No components match. Try another name or category.' : `${visible} component${visible === 1 ? '' : 's'}`;
15
+ count.textContent = visible === 0 ? 'No components match. Try another name or section.' : `${visible} component${visible === 1 ? '' : 's'}`;
15
16
  };
16
- query.addEventListener('input', filter); category.addEventListener('change', filter); filter();
17
- return () => { query.removeEventListener('input', filter); category.removeEventListener('change', filter); };
17
+ const chooseCategory = () => {
18
+ const destination = new URL(category.selectedOptions[0].dataset.href, location.href);
19
+ location.assign(destination.href);
20
+ };
21
+ query.addEventListener('input', filter); category.addEventListener('change', chooseCategory); filter();
22
+ filters.hidden = false;
23
+ return () => { query.removeEventListener('input', filter); category.removeEventListener('change', chooseCategory); };
18
24
  }
@@ -1,12 +1,13 @@
1
1
  import { escapeHtml as escape } from './catalog.mjs';
2
2
 
3
3
  /** Catalog filtering wraps the same server-rendered documentation cards. */
4
- export function catalogResource(groups) {
4
+ export function catalogResource(groups, base = '/') {
5
5
  return `<link rel="component" href="@threadlabs/looma/components/ui-form-field/ui-form-field.html">
6
6
  <link rel="component" href="@threadlabs/looma/components/ui-input/ui-input.html">
7
7
  <link rel="component" href="@threadlabs/looma/components/ui-select/ui-select.html">
8
8
  <link rel="component" href="@threadlabs/looma/components/ui-cluster/ui-cluster.html">
9
+ <link rel="component" href="@threadlabs/looma/components/ui-grid/ui-grid.html">
9
10
  <link rel="component" href="@threadlabs/looma/components/ui-stack/ui-stack.html">
10
- <template component="looma-catalog" module="./catalog-view.js"><defs></defs>
11
- <ui-stack gap="xl"><ui-cluster align="end"><ui-form-field><label slot="label" for="catalog-query">Find a component</label><ui-input id="catalog-query" $ref="query" type="search" placeholder="Name, tag or purpose"></ui-input></ui-form-field><ui-form-field><label slot="label" for="catalog-category">Category</label><ui-select id="catalog-category" $ref="category"><option value="">All categories</option>${groups.map(group => `<option value="${escape(group.id)}">${escape(group.label)}</option>`).join('')}</ui-select></ui-form-field></ui-cluster><p $ref="count" role="status" aria-live="polite"></p><slot></slot></ui-stack></template>`;
11
+ <template component="looma-catalog" module="./catalog-view.js"><defs><prop name="category" type="string" default="">The category represented by this gallery.</prop><prop name="total" type="number" default="0">Number of cards before text filtering.</prop></defs>
12
+ <ui-stack gap="xl"><div $ref="filters" hidden><ui-grid columns="2" min="md"><ui-form-field><label slot="label" for="catalog-query">Filter components</label><ui-input id="catalog-query" $ref="query" type="search" placeholder="Name, tag or purpose"></ui-input></ui-form-field><ui-cluster align="end"><ui-form-field><label slot="label" for="catalog-category">Section</label><ui-select id="catalog-category" $ref="category"><option value="" data-href="${escape(base)}components/" from:selected="$category = ''">All sections</option>${groups.map(group => `<option value="${escape(group.id)}" data-href="${escape(base)}components/${escape(group.id)}/" from:selected="${escape(`$category = ${JSON.stringify(group.id)}`)}">${escape(group.label)}</option>`).join('')}</ui-select></ui-form-field></ui-cluster></ui-grid></div><p $ref="count" role="status" aria-live="polite">{$total} components</p><slot></slot></ui-stack></template>`;
12
13
  }