@threadlabs/looma 0.53.8 → 0.53.10
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/README.md +16 -0
- package/blocks/editor-workspace.html +53 -0
- package/blocks/editor-workspace.js +15 -0
- package/blocks/list-detail.html +54 -0
- package/blocks/list-detail.js +62 -0
- package/blocks/search-and-open.html +33 -0
- package/blocks/search-and-open.js +53 -0
- package/blocks/settings-form.html +26 -0
- package/blocks/settings-form.js +16 -0
- package/components/shared/behaviors.d.ts +2 -0
- package/components/shared/behaviors.js +2 -0
- package/components/shared/collection-navigation.d.ts +28 -0
- package/components/shared/collection-navigation.js +40 -0
- package/components/shared/deferred-focus.d.ts +8 -0
- package/components/shared/deferred-focus.js +21 -0
- package/components/shared/form-reset.js +14 -6
- package/components/shared/menu-navigation.js +19 -22
- package/components/shared/overlay-dismissal.js +7 -0
- package/components/shared/overlay.js +3 -2
- package/components/ui-combobox/ui-combobox.js +6 -6
- package/components/ui-date-picker/ui-date-picker.js +5 -6
- package/components/ui-date-range-picker/ui-date-range-picker.js +6 -8
- package/components/ui-editor-toolbar/ui-editor-toolbar.js +8 -6
- package/components/ui-listbox/ui-listbox.js +10 -16
- package/components/ui-search-shell/ui-search-shell.js +4 -5
- package/components/ui-sidebar/ui-sidebar.html +7 -0
- package/components/ui-switcher/ui-switcher.html +28 -1
- package/components/ui-tabs/ui-tabs.js +5 -3
- package/dist/index.js +1 -1
- package/docs/catalog.json +49 -4
- package/editor/chunks/expressmark.js +43 -12
- package/editor/chunks/extensions.js +15 -2
- package/editor/extensions/index.js +1 -1
- package/editor/heading-alignment.d.ts +2 -0
- package/editor/index.js +78 -44
- package/package.json +9 -2
- package/styles/ui-sidebar.css +12 -1
- package/styles/ui-switcher.css +22 -1
- package/vanilla/UiSwitcher.d.ts +2 -1
- package/vanilla/UiSwitcher.js +96 -16
package/docs/catalog.json
CHANGED
|
@@ -683,7 +683,7 @@
|
|
|
683
683
|
"tag": "ui-switcher",
|
|
684
684
|
"package": "@threadlabs/looma",
|
|
685
685
|
"root": "div",
|
|
686
|
-
"angularHost": "
|
|
686
|
+
"angularHost": "ng-template",
|
|
687
687
|
"resource": "@threadlabs/looma/components/ui-switcher/ui-switcher.html"
|
|
688
688
|
},
|
|
689
689
|
{
|
|
@@ -780,7 +780,7 @@
|
|
|
780
780
|
],
|
|
781
781
|
"schemaVersion": 1,
|
|
782
782
|
"package": "@threadlabs/looma",
|
|
783
|
-
"version": "0.53.
|
|
783
|
+
"version": "0.53.10",
|
|
784
784
|
"groups": [
|
|
785
785
|
{
|
|
786
786
|
"id": "layout",
|
|
@@ -31651,11 +31651,11 @@
|
|
|
31651
31651
|
]
|
|
31652
31652
|
},
|
|
31653
31653
|
{
|
|
31654
|
-
"angularHost": "
|
|
31654
|
+
"angularHost": "ng-template",
|
|
31655
31655
|
"tag": "ui-switcher",
|
|
31656
31656
|
"package": "@threadlabs/looma",
|
|
31657
31657
|
"root": "div",
|
|
31658
|
-
"description": "Intrinsic
|
|
31658
|
+
"description": "Intrinsic layout that stacks when its container becomes too narrow, with equal columns or a narrower rail beside the detail.",
|
|
31659
31659
|
"designTokens": {
|
|
31660
31660
|
"sources": [
|
|
31661
31661
|
"packages/looma/src/components/ui-switcher/ui-switcher.html"
|
|
@@ -31716,6 +31716,22 @@
|
|
|
31716
31716
|
"stretch"
|
|
31717
31717
|
]
|
|
31718
31718
|
},
|
|
31719
|
+
{
|
|
31720
|
+
"name": "balance",
|
|
31721
|
+
"property": "balance",
|
|
31722
|
+
"description": "Use the start and end slots to give one pane about a third of the row for a rail or inspector. At the same threshold, the start pane stacks above the end pane. Equal uses the default slot and gives children the same width.",
|
|
31723
|
+
"type": "keyword",
|
|
31724
|
+
"valueType": {
|
|
31725
|
+
"kind": "terminal",
|
|
31726
|
+
"name": "keyword"
|
|
31727
|
+
},
|
|
31728
|
+
"default": "equal",
|
|
31729
|
+
"options": [
|
|
31730
|
+
"equal",
|
|
31731
|
+
"narrow-start",
|
|
31732
|
+
"narrow-end"
|
|
31733
|
+
]
|
|
31734
|
+
},
|
|
31719
31735
|
{
|
|
31720
31736
|
"name": "gap",
|
|
31721
31737
|
"property": "gap",
|
|
@@ -31772,6 +31788,17 @@
|
|
|
31772
31788
|
"stretch"
|
|
31773
31789
|
]
|
|
31774
31790
|
},
|
|
31791
|
+
{
|
|
31792
|
+
"name": "balance",
|
|
31793
|
+
"description": "Use the start and end slots to give one pane about a third of the row for a rail or inspector. At the same threshold, the start pane stacks above the end pane. Equal uses the default slot and gives children the same width.",
|
|
31794
|
+
"type": "\"equal\" | \"narrow-start\" | \"narrow-end\"",
|
|
31795
|
+
"default": "equal",
|
|
31796
|
+
"options": [
|
|
31797
|
+
"equal",
|
|
31798
|
+
"narrow-start",
|
|
31799
|
+
"narrow-end"
|
|
31800
|
+
]
|
|
31801
|
+
},
|
|
31775
31802
|
{
|
|
31776
31803
|
"name": "gap",
|
|
31777
31804
|
"description": "Space between items, on the spacing scale: xs is 0.5rem, s 0.75rem, m 1rem (also the default), l 1.5rem, and xl 2rem. The --ui-switcher-gap custom property, set on :root, an ancestor, or the component itself, overrides it.",
|
|
@@ -31806,6 +31833,14 @@
|
|
|
31806
31833
|
{
|
|
31807
31834
|
"name": "default",
|
|
31808
31835
|
"description": "Default child content."
|
|
31836
|
+
},
|
|
31837
|
+
{
|
|
31838
|
+
"name": "start",
|
|
31839
|
+
"description": "Named content for the start region."
|
|
31840
|
+
},
|
|
31841
|
+
{
|
|
31842
|
+
"name": "end",
|
|
31843
|
+
"description": "Named content for the end region."
|
|
31809
31844
|
}
|
|
31810
31845
|
],
|
|
31811
31846
|
"group": "layout",
|
|
@@ -31850,6 +31885,16 @@
|
|
|
31850
31885
|
"resizable": true,
|
|
31851
31886
|
"bindings": "",
|
|
31852
31887
|
"frameworks": {}
|
|
31888
|
+
},
|
|
31889
|
+
{
|
|
31890
|
+
"id": "@threadlabs/looma/ui-switcher/04-list-and-detail",
|
|
31891
|
+
"name": "04-list-and-detail",
|
|
31892
|
+
"title": "A rail beside the detail",
|
|
31893
|
+
"description": "The first pane takes about a third of the room in a row. Resize this example to see both panes stack in reading order.",
|
|
31894
|
+
"markup": "<ui-switcher balance=\"narrow-start\" threshold=\"sm\" align=\"start\">\n <ui-card slot=\"start\" padding=\"sm\">Report index</ui-card>\n <ui-card slot=\"end\" padding=\"sm\">The footbridge is open. The lower path is still muddy after rain.</ui-card>\n</ui-switcher>",
|
|
31895
|
+
"resizable": true,
|
|
31896
|
+
"bindings": "",
|
|
31897
|
+
"frameworks": {}
|
|
31853
31898
|
}
|
|
31854
31899
|
]
|
|
31855
31900
|
},
|
|
@@ -336,6 +336,12 @@ var LoomaReferencePresentation = Extension.create({
|
|
|
336
336
|
}
|
|
337
337
|
});
|
|
338
338
|
//#endregion
|
|
339
|
+
//#region src/editor/heading-alignment.ts
|
|
340
|
+
/** Native HTML heading alignment shared by the editor schema and portable conversion. */
|
|
341
|
+
function isHeadingAlignment(value) {
|
|
342
|
+
return typeof value === "string" && /^(left|center|right|justify)$/.test(value);
|
|
343
|
+
}
|
|
344
|
+
//#endregion
|
|
339
345
|
//#region ../../node_modules/.pnpm/entities@8.1.0/node_modules/entities/dist/decode-codepoint.js
|
|
340
346
|
/**
|
|
341
347
|
* True for NUL, UTF-16 surrogates, and values past U+10FFFF.
|
|
@@ -4944,7 +4950,7 @@ for (const proto of [RunResultRecord.prototype, RunResultWithRootTrivia.prototyp
|
|
|
4944
4950
|
var ESC = "\x1B";
|
|
4945
4951
|
`${ESC}`, `${ESC}`, `${ESC}`, `${ESC}`, `${ESC}`, `${ESC}`;
|
|
4946
4952
|
//#endregion
|
|
4947
|
-
//#region ../../node_modules/.pnpm/expressmark@0.6.
|
|
4953
|
+
//#region ../../node_modules/.pnpm/expressmark@0.6.4/node_modules/expressmark/dist/types.js
|
|
4948
4954
|
var ConversionError = class extends Error {
|
|
4949
4955
|
code;
|
|
4950
4956
|
constructor(code, message) {
|
|
@@ -4980,7 +4986,7 @@ function plainText(node) {
|
|
|
4980
4986
|
return node.value ?? (node.children ?? node.body ?? []).map(plainText).join("");
|
|
4981
4987
|
}
|
|
4982
4988
|
//#endregion
|
|
4983
|
-
//#region ../../node_modules/.pnpm/expressmark@0.6.
|
|
4989
|
+
//#region ../../node_modules/.pnpm/expressmark@0.6.4/node_modules/expressmark/dist/anchors.js
|
|
4984
4990
|
/** The specification's readable anchor for a heading or title text. */
|
|
4985
4991
|
function anchorText(text) {
|
|
4986
4992
|
return text.normalize("NFC").toLowerCase().replace(/[^\p{L}\p{N}\p{M}]+/gu, "-").replace(/^-+|-+$/g, "") || "section";
|
|
@@ -9146,7 +9152,7 @@ var require_launder = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
9146
9152
|
module.exports.naughtyHref = naughtyHref;
|
|
9147
9153
|
}));
|
|
9148
9154
|
//#endregion
|
|
9149
|
-
//#region ../../node_modules/.pnpm/expressmark@0.6.
|
|
9155
|
+
//#region ../../node_modules/.pnpm/expressmark@0.6.4/node_modules/expressmark/dist/html.js
|
|
9150
9156
|
var import_sanitize_html = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
9151
9157
|
var htmlparser = (init_dist(), __toCommonJS(dist_exports));
|
|
9152
9158
|
var escapeStringRegexp = require_escape_string_regexp();
|
|
@@ -10215,6 +10221,22 @@ var policy = {
|
|
|
10215
10221
|
details: ["open"],
|
|
10216
10222
|
ol: ["start"],
|
|
10217
10223
|
li: ["value"],
|
|
10224
|
+
...Object.fromEntries([
|
|
10225
|
+
"h1",
|
|
10226
|
+
"h2",
|
|
10227
|
+
"h3",
|
|
10228
|
+
"h4",
|
|
10229
|
+
"h5",
|
|
10230
|
+
"h6"
|
|
10231
|
+
].map((tag) => [tag, [{
|
|
10232
|
+
name: "align",
|
|
10233
|
+
values: [
|
|
10234
|
+
"left",
|
|
10235
|
+
"center",
|
|
10236
|
+
"right",
|
|
10237
|
+
"justify"
|
|
10238
|
+
]
|
|
10239
|
+
}]])),
|
|
10218
10240
|
td: [
|
|
10219
10241
|
"colspan",
|
|
10220
10242
|
"rowspan",
|
|
@@ -10631,7 +10653,7 @@ function readStartTag(source, start, limit = source.length) {
|
|
|
10631
10653
|
}
|
|
10632
10654
|
}
|
|
10633
10655
|
//#endregion
|
|
10634
|
-
//#region ../../node_modules/.pnpm/expressmark@0.6.
|
|
10656
|
+
//#region ../../node_modules/.pnpm/expressmark@0.6.4/node_modules/expressmark/dist/references.js
|
|
10635
10657
|
function walk(node, visit, skipNotes, active = /* @__PURE__ */ new Set()) {
|
|
10636
10658
|
if (!node || typeof node !== "object" || active.has(node)) return;
|
|
10637
10659
|
if (skipNotes && node.type === "footnoteDefinition") return;
|
|
@@ -10680,7 +10702,7 @@ function linkDefinitions(document) {
|
|
|
10680
10702
|
return definitions;
|
|
10681
10703
|
}
|
|
10682
10704
|
//#endregion
|
|
10683
|
-
//#region ../../node_modules/.pnpm/expressmark@0.6.
|
|
10705
|
+
//#region ../../node_modules/.pnpm/expressmark@0.6.4/node_modules/expressmark/dist/render.js
|
|
10684
10706
|
init_dist();
|
|
10685
10707
|
function isAlignment(value) {
|
|
10686
10708
|
return value === "start" || value === "center" || value === "end";
|
|
@@ -10777,7 +10799,7 @@ function renderHtml(document, options = {}) {
|
|
|
10777
10799
|
return Object.entries(values).map(([key, value]) => {
|
|
10778
10800
|
let name = sourceKey(key);
|
|
10779
10801
|
if (!/^[a-zA-Z][\w:-]*$/.test(name) || value === false) return "";
|
|
10780
|
-
if (!nativeAttributes.has(name) && !name.startsWith("data-") && !name.startsWith("aria-")) name = `data-${name}`;
|
|
10802
|
+
if (!nativeAttributes.has(name) && !(node.type === "heading" && name === "align") && !name.startsWith("data-") && !name.startsWith("aria-")) name = `data-${name}`;
|
|
10781
10803
|
return value === true ? ` ${name}` : ` ${name}="${escapeHtml(String(value))}"`;
|
|
10782
10804
|
}).join("");
|
|
10783
10805
|
}
|
|
@@ -11525,10 +11547,17 @@ function toBareNode(node, path, context) {
|
|
|
11525
11547
|
};
|
|
11526
11548
|
case "paragraph": return plain("paragraph");
|
|
11527
11549
|
case "loomaLineBlock": return plain("lineBlock");
|
|
11528
|
-
case "heading":
|
|
11529
|
-
|
|
11530
|
-
|
|
11531
|
-
|
|
11550
|
+
case "heading":
|
|
11551
|
+
if (attrs.align != null && !isHeadingAlignment(attrs.align)) fail(path, "unsupported heading alignment");
|
|
11552
|
+
return plain("heading", [
|
|
11553
|
+
"level",
|
|
11554
|
+
"id",
|
|
11555
|
+
"align"
|
|
11556
|
+
], {
|
|
11557
|
+
level: Number(attrs.level ?? 1),
|
|
11558
|
+
...attrs.align != null ? { attributes: { align: attrs.align } } : {},
|
|
11559
|
+
...context.headingIds.has(node) ? { id: context.headingIds.get(node) } : context.custom.has(node) ? { id: string(attrs.id) } : {}
|
|
11560
|
+
});
|
|
11532
11561
|
case "blockquote": return block("blockquote");
|
|
11533
11562
|
case "horizontalRule":
|
|
11534
11563
|
fields(node, [], path);
|
|
@@ -12027,13 +12056,15 @@ function fromNode(node, path, context, marks = []) {
|
|
|
12027
12056
|
}];
|
|
12028
12057
|
}
|
|
12029
12058
|
case "heading": {
|
|
12030
|
-
check();
|
|
12059
|
+
check(["align"]);
|
|
12060
|
+
if (attrs.align !== void 0 && !isHeadingAlignment(attrs.align)) fail(path, "unsupported heading alignment");
|
|
12031
12061
|
let body = inline();
|
|
12032
12062
|
if (body.some((child) => child.type === "loomaInlineImage") && body.every((child) => child.type === "loomaInlineImage" || child.type === "text" && !child.text?.trim())) body = body.filter((child) => child.type === "loomaInlineImage");
|
|
12033
12063
|
return [{
|
|
12034
12064
|
type: "heading",
|
|
12035
12065
|
attrs: {
|
|
12036
12066
|
level: node.level ?? 1,
|
|
12067
|
+
...attrs.align !== void 0 ? { align: attrs.align } : {},
|
|
12037
12068
|
...node.id ? { id: node.id } : {}
|
|
12038
12069
|
},
|
|
12039
12070
|
...body.length ? { content: body } : {}
|
|
@@ -12528,4 +12559,4 @@ function markdownToEditorDocument(markdown, options = {}) {
|
|
|
12528
12559
|
return expressmarkToEditorDocument(document);
|
|
12529
12560
|
}
|
|
12530
12561
|
//#endregion
|
|
12531
|
-
export {
|
|
12562
|
+
export { normalizeLoomaChipTone as C, normalizeLoomaCalloutTone as S, __exportAll as T, setReferenceDisplay as _, expressmarkToEditorDocument as a, assignLoomaHeadingIds as b, imageSourceUrls as c, readPictureHtml as d, isHeadingAlignment as f, referenceDisplay as g, getReferenceDisplay as h, editorToMarkdown as i, mapImageSourceUrls as l, LoomaReferencePresentation as m, editorDocumentToExpressmark as n, markdownToEditorDocument as o, LoomaReference as p, editorDocumentToMarkdown as r, imageHtmlSpec as s, EditorMarkdownConversionError as t, normalizeImageSources as u, LOOMA_CALLOUT_TONES as v, splitLoomaFrontmatter as w, loomaHeadingSlug as x, LOOMA_CHIP_TONES as y };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as
|
|
1
|
+
import { C as normalizeLoomaChipTone, S as normalizeLoomaCalloutTone, b as assignLoomaHeadingIds, d as readPictureHtml, f as isHeadingAlignment, g as referenceDisplay, h as getReferenceDisplay, m as LoomaReferencePresentation, o as markdownToEditorDocument, p as LoomaReference, s as imageHtmlSpec, u as normalizeImageSources, w as splitLoomaFrontmatter, x as loomaHeadingSlug, y as LOOMA_CHIP_TONES } from "./expressmark.js";
|
|
2
2
|
import { i as TABLE_CELL_BACKGROUND_PRESETS, n as resolveTableCellAt } from "./table-overlay.js";
|
|
3
3
|
import { a as Bold, c as Document, i as Italic, l as LoomaInputRuleHistory, n as History, o as Text$1, r as HardBreak, s as Paragraph, t as Code } from "./dist.js";
|
|
4
4
|
import { Extension, InputRule, Mark, Node as Node$1, PasteRule, callOrReturn, canInsertNode, combineTransactionSteps, escapeForRegEx, findChildren, findChildrenInRange, findParentNodeClosestToPos, getAttributes, getChangedRanges, getExtensionField, getMarksBetween, getText, getTextSerializersFromSchema, isNodeEmpty, isNodeSelection, markInputRule, markPasteRule, mergeAttributes, nodeInputRule, textInputRule, textblockTypeInputRule, wrappingInputRule } from "@tiptap/core";
|
|
@@ -10371,6 +10371,19 @@ var LoomaCodeBlock = CodeBlockLowlight.extend({
|
|
|
10371
10371
|
})];
|
|
10372
10372
|
}
|
|
10373
10373
|
});
|
|
10374
|
+
var LoomaHeading = Heading.extend({ addAttributes() {
|
|
10375
|
+
return {
|
|
10376
|
+
...this.parent?.(),
|
|
10377
|
+
align: {
|
|
10378
|
+
default: null,
|
|
10379
|
+
parseHTML: (element) => {
|
|
10380
|
+
const align = element.getAttribute("align");
|
|
10381
|
+
return isHeadingAlignment(align) ? align : null;
|
|
10382
|
+
},
|
|
10383
|
+
renderHTML: (attributes) => isHeadingAlignment(attributes.align) ? { align: attributes.align } : {}
|
|
10384
|
+
}
|
|
10385
|
+
};
|
|
10386
|
+
} });
|
|
10374
10387
|
var StoredOnlyHighlight = Highlight.extend({
|
|
10375
10388
|
parseHTML: () => [],
|
|
10376
10389
|
addKeyboardShortcuts: () => ({}),
|
|
@@ -10437,7 +10450,7 @@ function getDefaultEditorExtensions(options = {}) {
|
|
|
10437
10450
|
Italic,
|
|
10438
10451
|
Strike,
|
|
10439
10452
|
Underline,
|
|
10440
|
-
|
|
10453
|
+
LoomaHeading.configure({ levels: [
|
|
10441
10454
|
1,
|
|
10442
10455
|
2,
|
|
10443
10456
|
3,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as
|
|
1
|
+
import { _ as setReferenceDisplay, c as imageSourceUrls, g as referenceDisplay, h as getReferenceDisplay, l as mapImageSourceUrls, m as LoomaReferencePresentation, p as LoomaReference, u as normalizeImageSources, v as LOOMA_CALLOUT_TONES } from "../chunks/expressmark.js";
|
|
2
2
|
import { i as TABLE_CELL_BACKGROUND_PRESETS } from "../chunks/table-overlay.js";
|
|
3
3
|
import { $ as LoomaFootnote, A as createLoomaMentionExtension, C as getActiveTableCellBackground, D as createSiteRelativeLinks, E as LoomaSmartPaste, F as LoomaImage, G as normalizeTableOfContentsConfig, H as LoomaTableOfContents, I as LoomaInlineImage, J as LoomaTabs, M as MAX_MENTION_RESULT_LIMIT, N as filterLoomaMentionItems, O as siteRelativeHref, P as normalizeMentionResultLimit, Q as LOOMA_FOOTNOTE_LABEL, R as normalizeImageDimension, S as getActiveTableCellAlignment, T as setActiveTableCellBackground, U as getTableOfContentsEntries, X as LoomaLinkDefinition, Y as LoomaLineBlock, _ as getDefaultEditorExtensions, at as revealLoomaExpandAt, b as LoomaTableCell, c as handleTableAction, ct as normalizeLoomaChipColor, d as normalizeActiveTableColumnWidths, dt as LOOMA_ACTIVE_BLOCK_CLASS, et as LoomaFootnoteReference, f as shouldShowTextFormattingToolbar, ft as LOOMA_ACTIVE_BLOCK_TYPING_IDLE_MS, g as LoomaTableKit, i as getDefaultSlashCommands, it as LoomaExpand, j as DEFAULT_MENTION_RESULT_LIMIT, k as LoomaMentionSuggestionPluginKey, l as handleTableOverlayAction, lt as LoomaCallout, mt as LoomaActiveBlockPluginKey, n as createLoomaSlashCommandExtension, nt as LoomaFigcaption, ot as LOOMA_CHIP_COLORS, pt as LoomaActiveBlock, q as LoomaTab, r as filterLoomaSlashCommands, rt as LoomaFigure, s as getActiveTableUiState, st as LoomaChip, t as LoomaSlashCommand, tt as findLoomaFootnote, u as insertTableAtRange, ut as LOOMA_ACTIVE_BLOCK_BLUR_GRACE_MS, v as getLoomaTableExtensions, w as setActiveTableCellAlignment, x as LoomaTableHeader, y as LoomaTable, z as normalizeImagePlacement } from "../chunks/extensions.js";
|
|
4
4
|
export { DEFAULT_MENTION_RESULT_LIMIT, LOOMA_ACTIVE_BLOCK_BLUR_GRACE_MS, LOOMA_ACTIVE_BLOCK_CLASS, LOOMA_ACTIVE_BLOCK_TYPING_IDLE_MS, LOOMA_CALLOUT_TONES, LOOMA_CHIP_COLORS, LOOMA_FOOTNOTE_LABEL, LoomaActiveBlock, LoomaActiveBlockPluginKey, LoomaCallout, LoomaChip, LoomaExpand, LoomaFigcaption, LoomaFigure, LoomaFootnote, LoomaFootnoteReference, LoomaImage, LoomaInlineImage, LoomaLineBlock, LoomaLinkDefinition, LoomaMentionSuggestionPluginKey, LoomaReference, LoomaReferencePresentation, LoomaSlashCommand, LoomaSmartPaste, LoomaTab, LoomaTable, LoomaTableCell, LoomaTableHeader, LoomaTableKit, LoomaTableOfContents, LoomaTabs, MAX_MENTION_RESULT_LIMIT, TABLE_CELL_BACKGROUND_PRESETS, createLoomaMentionExtension, createLoomaSlashCommandExtension, createSiteRelativeLinks, filterLoomaMentionItems, filterLoomaSlashCommands, findLoomaFootnote, getActiveTableCellAlignment, getActiveTableCellBackground, getActiveTableUiState, getDefaultEditorExtensions, getDefaultSlashCommands, getLoomaTableExtensions, getReferenceDisplay, getTableOfContentsEntries, handleTableAction, handleTableOverlayAction, imageSourceUrls, insertTableAtRange, mapImageSourceUrls, normalizeActiveTableColumnWidths, normalizeImageDimension, normalizeImagePlacement, normalizeImageSources, normalizeLoomaChipColor, normalizeMentionResultLimit, normalizeTableOfContentsConfig, referenceDisplay, revealLoomaExpandAt, setActiveTableCellAlignment, setActiveTableCellBackground, setReferenceDisplay, shouldShowTextFormattingToolbar, siteRelativeHref };
|
package/editor/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { T as __exportAll, _ as setReferenceDisplay, c as imageSourceUrls, g as referenceDisplay, h as getReferenceDisplay, l as mapImageSourceUrls, m as LoomaReferencePresentation, p as LoomaReference, u as normalizeImageSources, v as LOOMA_CALLOUT_TONES } from "./chunks/expressmark.js";
|
|
2
2
|
import { i as TABLE_CELL_BACKGROUND_PRESETS, n as resolveTableCellAt, r as TABLE_CELL_BACKGROUND_OPTIONS, t as measureTableOverlayGeometry } from "./chunks/table-overlay.js";
|
|
3
3
|
import "./ui.js";
|
|
4
4
|
import { $ as LoomaFootnote, A as createLoomaMentionExtension, B as createImageMedia, C as getActiveTableCellBackground, D as createSiteRelativeLinks, E as LoomaSmartPaste, F as LoomaImage, G as normalizeTableOfContentsConfig, H as LoomaTableOfContents, I as LoomaInlineImage, J as LoomaTabs, K as tableOfContentsTree, L as isLoomaImageName, M as MAX_MENTION_RESULT_LIMIT, N as filterLoomaMentionItems, O as siteRelativeHref, P as normalizeMentionResultLimit, Q as LOOMA_FOOTNOTE_LABEL, R as normalizeImageDimension, S as getActiveTableCellAlignment, T as setActiveTableCellBackground, U as getTableOfContentsEntries, V as imageDeliveryAttributes, W as navigateTableOfContents, X as LoomaLinkDefinition, Y as LoomaLineBlock, Z as LOOMA_FOOTNOTE_INSERTED, _ as getDefaultEditorExtensions, a as NO_TABLE_CAPABILITIES, at as revealLoomaExpandAt, b as LoomaTableCell, c as handleTableAction, ct as normalizeLoomaChipColor, d as normalizeActiveTableColumnWidths, dt as LOOMA_ACTIVE_BLOCK_CLASS, et as LoomaFootnoteReference, f as shouldShowTextFormattingToolbar, ft as LOOMA_ACTIVE_BLOCK_TYPING_IDLE_MS, g as LoomaTableKit, h as selectedTableElement, i as getDefaultSlashCommands, it as LoomaExpand, j as DEFAULT_MENTION_RESULT_LIMIT, k as LoomaMentionSuggestionPluginKey, l as handleTableOverlayAction, lt as LoomaCallout, m as selectedTableCellElement, mt as LoomaActiveBlockPluginKey, n as createLoomaSlashCommandExtension, nt as LoomaFigcaption, o as focusTableOverlayTarget, ot as LOOMA_CHIP_COLORS, p as menuAnchorRect, pt as LoomaActiveBlock, q as LoomaTab, r as filterLoomaSlashCommands, rt as LoomaFigure, s as getActiveTableUiState, st as LoomaChip, t as LoomaSlashCommand, tt as findLoomaFootnote, u as insertTableAtRange, ut as LOOMA_ACTIVE_BLOCK_BLUR_GRACE_MS, v as getLoomaTableExtensions, w as setActiveTableCellAlignment, x as LoomaTableHeader, y as LoomaTable, z as normalizeImagePlacement } from "./chunks/extensions.js";
|
|
@@ -267,6 +267,14 @@ function updateSurfaceMaterial$1(element, role) {
|
|
|
267
267
|
if (!Number.isFinite(previous) || Math.abs(next - previous) >= Math.max(.002, Math.abs(previous) * .04)) element.style.setProperty("--_ui-material-scale", String(next));
|
|
268
268
|
}
|
|
269
269
|
//#endregion
|
|
270
|
+
//#region src/components/shared/overlay-dismissal.js
|
|
271
|
+
function overlayDismissalTarget$1(records, reason) {
|
|
272
|
+
const top = records.at(-1);
|
|
273
|
+
if (!top) return void 0;
|
|
274
|
+
if (top.dismissible === false && (reason === "escape" || reason === "light-dismiss")) return void 0;
|
|
275
|
+
return top.canClose?.(reason) === false ? void 0 : top;
|
|
276
|
+
}
|
|
277
|
+
//#endregion
|
|
270
278
|
//#region src/components/shared/overlay.js
|
|
271
279
|
function stateFor$1(document) {
|
|
272
280
|
const key = Symbol.for("@threadlabs/looma/overlay-stack/v1");
|
|
@@ -290,8 +298,8 @@ function syncModalBackdrops$1(state) {
|
|
|
290
298
|
for (const record of state.records) (record.modalElement ?? record.element).toggleAttribute("data-ui-backdrop-hidden", Boolean(record.modal && record !== topModal));
|
|
291
299
|
}
|
|
292
300
|
function requestClose$1(document, reason, trigger) {
|
|
293
|
-
const record = stateFor$1(document).records
|
|
294
|
-
if (!record
|
|
301
|
+
const record = overlayDismissalTarget$1(stateFor$1(document).records, reason);
|
|
302
|
+
if (!record) return false;
|
|
295
303
|
record.requestClose(reason, trigger);
|
|
296
304
|
return true;
|
|
297
305
|
}
|
|
@@ -3944,6 +3952,14 @@ function updateSurfaceMaterial(element, role) {
|
|
|
3944
3952
|
if (!Number.isFinite(previous) || Math.abs(next - previous) >= Math.max(.002, Math.abs(previous) * .04)) element.style.setProperty("--_ui-material-scale", String(next));
|
|
3945
3953
|
}
|
|
3946
3954
|
//#endregion
|
|
3955
|
+
//#region components/shared/overlay-dismissal.js
|
|
3956
|
+
function overlayDismissalTarget(records, reason) {
|
|
3957
|
+
const top = records.at(-1);
|
|
3958
|
+
if (!top) return void 0;
|
|
3959
|
+
if (top.dismissible === false && (reason === "escape" || reason === "light-dismiss")) return void 0;
|
|
3960
|
+
return top.canClose?.(reason) === false ? void 0 : top;
|
|
3961
|
+
}
|
|
3962
|
+
//#endregion
|
|
3947
3963
|
//#region components/shared/overlay.js
|
|
3948
3964
|
function stateFor(document) {
|
|
3949
3965
|
const key = Symbol.for("@threadlabs/looma/overlay-stack/v1");
|
|
@@ -3967,8 +3983,8 @@ function syncModalBackdrops(state) {
|
|
|
3967
3983
|
for (const record of state.records) (record.modalElement ?? record.element).toggleAttribute("data-ui-backdrop-hidden", Boolean(record.modal && record !== topModal));
|
|
3968
3984
|
}
|
|
3969
3985
|
function requestClose(document, reason, trigger) {
|
|
3970
|
-
const record = stateFor(document).records
|
|
3971
|
-
if (!record
|
|
3986
|
+
const record = overlayDismissalTarget(stateFor(document).records, reason);
|
|
3987
|
+
if (!record) return false;
|
|
3972
3988
|
record.requestClose(reason, trigger);
|
|
3973
3989
|
return true;
|
|
3974
3990
|
}
|
|
@@ -7925,6 +7941,32 @@ function focusAndRevealItem(root, item) {
|
|
|
7925
7941
|
revealActiveItem(root, item);
|
|
7926
7942
|
}
|
|
7927
7943
|
//#endregion
|
|
7944
|
+
//#region components/shared/collection-navigation.js
|
|
7945
|
+
/** Keys used by vertical collection navigation. Horizontal widgets translate their arrow keys.
|
|
7946
|
+
* @type {readonly string[]}
|
|
7947
|
+
*/
|
|
7948
|
+
var collectionNavigationKeys = Object.freeze([
|
|
7949
|
+
"ArrowDown",
|
|
7950
|
+
"ArrowUp",
|
|
7951
|
+
"Home",
|
|
7952
|
+
"End"
|
|
7953
|
+
]);
|
|
7954
|
+
/** Move through an already filtered collection without allocating an index array.
|
|
7955
|
+
* @param {number} length Number of eligible items.
|
|
7956
|
+
* @param {number} current Position in the eligible collection, or -1.
|
|
7957
|
+
* @param {string} key A collection navigation key.
|
|
7958
|
+
* @param {boolean} wrap Whether to wrap at either edge.
|
|
7959
|
+
*/
|
|
7960
|
+
function nextCollectionPosition(length, current, key, wrap) {
|
|
7961
|
+
const last = length - 1;
|
|
7962
|
+
if (last < 0) return -1;
|
|
7963
|
+
if (key === "Home") return 0;
|
|
7964
|
+
if (key === "End") return last;
|
|
7965
|
+
if (key === "ArrowDown") return current === last && wrap ? 0 : Math.min(current + 1, last);
|
|
7966
|
+
if (key === "ArrowUp") return current < 0 || current === 0 && wrap ? last : Math.max(current - 1, 0);
|
|
7967
|
+
return -1;
|
|
7968
|
+
}
|
|
7969
|
+
//#endregion
|
|
7928
7970
|
//#region components/shared/menu-navigation.js
|
|
7929
7971
|
var itemSelector = "[role=\"menuitem\"], [role=\"menuitemcheckbox\"], [role=\"menuitemradio\"]";
|
|
7930
7972
|
var searches = /* @__PURE__ */ new WeakMap();
|
|
@@ -7943,39 +7985,26 @@ function navigateMenu(event, menu) {
|
|
|
7943
7985
|
if (!items.length) return false;
|
|
7944
7986
|
const current = menuItemFrom(event.target);
|
|
7945
7987
|
const index = items.indexOf(current);
|
|
7946
|
-
let next
|
|
7947
|
-
|
|
7948
|
-
|
|
7949
|
-
|
|
7950
|
-
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
|
|
7959
|
-
|
|
7960
|
-
|
|
7961
|
-
|
|
7962
|
-
|
|
7963
|
-
|
|
7964
|
-
|
|
7965
|
-
|
|
7966
|
-
query,
|
|
7967
|
-
time: now
|
|
7968
|
-
});
|
|
7969
|
-
const find = (prefix) => {
|
|
7970
|
-
for (let offset = 1; offset <= items.length; offset += 1) {
|
|
7971
|
-
const candidate = (index + offset + items.length) % items.length;
|
|
7972
|
-
if (label(items[candidate]).startsWith(prefix)) return candidate;
|
|
7973
|
-
}
|
|
7974
|
-
return -1;
|
|
7975
|
-
};
|
|
7976
|
-
next = find(query);
|
|
7977
|
-
if (next < 0 && query.length > 1) next = find(event.key.toLocaleLowerCase());
|
|
7978
|
-
}
|
|
7988
|
+
let next;
|
|
7989
|
+
if (collectionNavigationKeys.includes(event.key)) next = nextCollectionPosition(items.length, index, event.key, true);
|
|
7990
|
+
else {
|
|
7991
|
+
if (event.key.length !== 1 || event.key === " " || event.altKey || event.ctrlKey || event.metaKey) return false;
|
|
7992
|
+
const now = Date.now();
|
|
7993
|
+
const previous = searches.get(menu);
|
|
7994
|
+
const query = `${previous && now - previous.time < 700 ? previous.query : ""}${event.key.toLocaleLowerCase()}`;
|
|
7995
|
+
searches.set(menu, {
|
|
7996
|
+
query,
|
|
7997
|
+
time: now
|
|
7998
|
+
});
|
|
7999
|
+
const find = (prefix) => {
|
|
8000
|
+
for (let offset = 1; offset <= items.length; offset += 1) {
|
|
8001
|
+
const candidate = (index + offset + items.length) % items.length;
|
|
8002
|
+
if (label(items[candidate]).startsWith(prefix)) return candidate;
|
|
8003
|
+
}
|
|
8004
|
+
return -1;
|
|
8005
|
+
};
|
|
8006
|
+
next = find(query);
|
|
8007
|
+
if (next < 0 && query.length > 1) next = find(event.key.toLocaleLowerCase());
|
|
7979
8008
|
}
|
|
7980
8009
|
event.preventDefault();
|
|
7981
8010
|
if (next >= 0) focusAndRevealItem(menu, items[next]);
|
|
@@ -11912,17 +11941,22 @@ var tableOfContentsNodeView = ({ editor, node, getPos }) => {
|
|
|
11912
11941
|
* @lifecycle Returns the function that stops listening.
|
|
11913
11942
|
*/
|
|
11914
11943
|
function afterFormReset(control, callback) {
|
|
11915
|
-
const
|
|
11916
|
-
|
|
11944
|
+
const tree = control.getRootNode();
|
|
11945
|
+
const root = tree.host ? tree : control.ownerDocument;
|
|
11946
|
+
const pending = /* @__PURE__ */ new Set();
|
|
11917
11947
|
const onReset = (event) => {
|
|
11918
|
-
if (event.target
|
|
11948
|
+
if (event.target !== control.form) return;
|
|
11949
|
+
const timer = setTimeout(() => {
|
|
11950
|
+
pending.delete(timer);
|
|
11919
11951
|
if (!event.defaultPrevented) callback();
|
|
11920
11952
|
});
|
|
11953
|
+
pending.add(timer);
|
|
11921
11954
|
};
|
|
11922
|
-
|
|
11955
|
+
root.addEventListener("reset", onReset, { capture: true });
|
|
11923
11956
|
return () => {
|
|
11924
|
-
|
|
11925
|
-
|
|
11957
|
+
root.removeEventListener("reset", onReset, { capture: true });
|
|
11958
|
+
for (const timer of pending) clearTimeout(timer);
|
|
11959
|
+
pending.clear();
|
|
11926
11960
|
};
|
|
11927
11961
|
}
|
|
11928
11962
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@threadlabs/looma",
|
|
3
|
-
"version": "0.53.
|
|
3
|
+
"version": "0.53.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "HTML Next UI components, native DOM support and design tokens.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"./vanilla": "./vanilla/index.js",
|
|
54
54
|
"./vanilla/*": "./vanilla/*",
|
|
55
55
|
"./components/*": "./components/*",
|
|
56
|
+
"./blocks/*": "./blocks/*",
|
|
56
57
|
"./tokens.css": "./tokens.css",
|
|
57
58
|
"./theme-light.css": "./theme-light.css",
|
|
58
59
|
"./theme-dark.css": "./theme-dark.css",
|
|
@@ -75,6 +76,11 @@
|
|
|
75
76
|
"import": "./components/shared/input-modality.js",
|
|
76
77
|
"default": "./components/shared/input-modality.js"
|
|
77
78
|
},
|
|
79
|
+
"./behaviors": {
|
|
80
|
+
"types": "./components/shared/behaviors.d.ts",
|
|
81
|
+
"import": "./components/shared/behaviors.js",
|
|
82
|
+
"default": "./components/shared/behaviors.js"
|
|
83
|
+
},
|
|
78
84
|
"./docs/examples/*": "./docs/examples/*"
|
|
79
85
|
},
|
|
80
86
|
"files": [
|
|
@@ -83,6 +89,7 @@
|
|
|
83
89
|
"markdown/",
|
|
84
90
|
"vanilla/",
|
|
85
91
|
"components/",
|
|
92
|
+
"blocks/",
|
|
86
93
|
"styles/",
|
|
87
94
|
"*.css",
|
|
88
95
|
"README.md",
|
|
@@ -99,7 +106,7 @@
|
|
|
99
106
|
"@nextwebwg/html-next": ">=1.0.0-alpha.92",
|
|
100
107
|
"@js-temporal/polyfill": "^0.5.1",
|
|
101
108
|
"dompurify": "3.4.15",
|
|
102
|
-
"expressmark": ">=0.6.
|
|
109
|
+
"expressmark": ">=0.6.4",
|
|
103
110
|
"highlight.js": "11.11.2",
|
|
104
111
|
"lowlight": "^3.3.0",
|
|
105
112
|
"lucide": "~0.554.0",
|
package/styles/ui-sidebar.css
CHANGED
|
@@ -25,6 +25,13 @@
|
|
|
25
25
|
transition: inline-size var(--ui-motion-layout) var(--ui-motion-layout-ease), visibility var(--ui-motion-layout);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
/* Without a drawer controller, keep navigation in flow and reserve most of the row for content. */
|
|
29
|
+
@media (scripting: none) {
|
|
30
|
+
:scope:where(:is([component~="ui-sidebar"]:not(template), [data-component~="ui-sidebar"]:not([component]))) {
|
|
31
|
+
max-inline-size: 33%;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
28
35
|
:scope:where(:is([component~="ui-sidebar"]:not(template), [data-component~="ui-sidebar"]:not([component])))[data-ui-sidebar-state~="side=end"] {
|
|
29
36
|
border-inline-end: 0;
|
|
30
37
|
border-inline-start: var(--ui-border-width) solid var(--ui-sidebar-border, var(--ui-border-divider));
|
|
@@ -202,7 +209,11 @@
|
|
|
202
209
|
}
|
|
203
210
|
}
|
|
204
211
|
@scope (:is([component~="ui-sidebar"]:not(template), [data-component~="ui-sidebar"]:not([component]))) to (:is([component]:not(template), [data-component]:not([component]))) {
|
|
205
|
-
/*
|
|
212
|
+
/* Without a drawer controller, keep navigation in flow and reserve most of the row for content. */
|
|
213
|
+
@media (scripting: none) {
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/* The panel's content scrolls, and each edge that hides content fades: the scroll fade every
|
|
206
217
|
Looma scroller uses (see ui-scroll-area). */
|
|
207
218
|
|
|
208
219
|
/* Collapsed while docked. */
|
package/styles/ui-switcher.css
CHANGED
|
@@ -26,6 +26,24 @@
|
|
|
26
26
|
grid-template-columns: minmax(0, 1fr);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
/* Reuse the width threshold as the flex basis. Below it, each full-width item
|
|
30
|
+
gets its own line. Above it, grow factors divide the available space. */
|
|
31
|
+
:scope:where(:is([component~="ui-switcher"]:not(template), [data-component~="ui-switcher"]:not([component]))):is([data-ui-switcher-state~="balance=narrow-start"], [data-ui-switcher-state~="balance=narrow-end"]):not([data-ui-switcher-state~="overLimit"]):not([hidden]) {
|
|
32
|
+
display: flex !important;
|
|
33
|
+
flex-flow: row wrap !important;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.start,
|
|
37
|
+
.end {
|
|
38
|
+
flex: 2 1 var(--_switcher-track) !important;
|
|
39
|
+
min-inline-size: 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
:scope:where(:is([component~="ui-switcher"]:not(template), [data-component~="ui-switcher"]:not([component])))[data-ui-switcher-state~="balance=narrow-start"] > .start,
|
|
43
|
+
:scope:where(:is([component~="ui-switcher"]:not(template), [data-component~="ui-switcher"]:not([component])))[data-ui-switcher-state~="balance=narrow-end"] > .end {
|
|
44
|
+
flex-grow: 1 !important;
|
|
45
|
+
}
|
|
46
|
+
|
|
29
47
|
:scope:where(:is([component~="ui-switcher"]:not(template), [data-component~="ui-switcher"]:not([component])))[data-ui-switcher-state~="gap=xs"] {
|
|
30
48
|
--_switcher-gap: var(--ui-space-2);
|
|
31
49
|
}
|
|
@@ -66,5 +84,8 @@
|
|
|
66
84
|
}
|
|
67
85
|
}
|
|
68
86
|
@scope (:is([component~="ui-switcher"]:not(template), [data-component~="ui-switcher"]:not([component]))) to (:is([component]:not(template), [data-component]:not([component]))) {
|
|
69
|
-
/*
|
|
87
|
+
/* Reuse the width threshold as the flex basis. Below it, each full-width item
|
|
88
|
+
gets its own line. Above it, grow factors divide the available space. */
|
|
89
|
+
|
|
90
|
+
/* A component that sets its display still honours the hidden attribute on its root. */
|
|
70
91
|
}
|
package/vanilla/UiSwitcher.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Generated by HTML Next 1.0.0-alpha.92 for Vanilla DOM. Do not edit.
|
|
2
2
|
export interface UiSwitcherEventMap {
|
|
3
3
|
}
|
|
4
|
-
export interface UiSwitcherElement extends
|
|
4
|
+
export interface UiSwitcherElement extends HTMLElement {
|
|
5
5
|
addEventListener<K extends keyof UiSwitcherEventMap>(type: K, listener: (this: UiSwitcherElement, event: UiSwitcherEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
6
6
|
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: UiSwitcherElement, event: HTMLElementEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
7
7
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
@@ -11,6 +11,7 @@ export interface UiSwitcherElement extends HTMLDivElement {
|
|
|
11
11
|
}
|
|
12
12
|
export interface UiSwitcherProps {
|
|
13
13
|
align?: "start" | "center" | "end" | "stretch" | null;
|
|
14
|
+
balance?: "equal" | "narrow-start" | "narrow-end" | null;
|
|
14
15
|
gap?: "xs" | "s" | "m" | "l" | "xl" | null;
|
|
15
16
|
limit?: number | null;
|
|
16
17
|
threshold?: "xs" | "sm" | "md" | "lg" | null;
|