@gramlot/gramlot 0.3.1 → 0.3.3
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/dist/gramlot.js +203 -74
- package/dist/gramlot.min.js +42 -24
- package/package.json +1 -1
- package/src/builder/source.js +1 -0
- package/src/components/border-container.js +399 -0
- package/src/components/choice-editor.js +3 -1
- package/src/components/container.js +25 -0
- package/src/components/layout.js +6 -23
- package/src/components/popup.js +3 -3
- package/src/components/registry.js +5 -3
- package/src/components/selected-container.js +289 -0
- package/src/index-page-runtime.d.ts +3 -1
- package/src/index-page-runtime.js +137 -53
- package/src/index-page-styles.js +1 -1
- package/src/renderer/attributes.js +4 -1
- package/src/renderer/gramlot-renderer.js +6 -3
- package/src/view/html.js +30 -6
- package/themes/gramlot-base/theme.css +3 -2
- package/themes/joanna/theme.css +9 -0
- package/themes/mimi/theme.css +9 -0
- package/tools/gramlot-tools-inspector.js +549 -35
- package/tools/inspector-agent.js +259 -5
package/dist/gramlot.js
CHANGED
|
@@ -22095,7 +22095,7 @@ function annotation2(parameter) {
|
|
|
22095
22095
|
});
|
|
22096
22096
|
return alternatives.length === 1 ? alternatives[0] : { kind: "union", items: alternatives };
|
|
22097
22097
|
}
|
|
22098
|
-
function defineComponent({ name, tag: tag2, base, mixins = [], parameters: parameters2 = {}, subTags = "", presentationDefaults = [], dataScope = false, command = false, implementation }) {
|
|
22098
|
+
function defineComponent({ name, tag: tag2, base, mixins = [], parameters: parameters2 = {}, subTags = "", presentationDefaults = [], dataScope = false, command = false, childParameters = {}, sourceContext = false, implementation }) {
|
|
22099
22099
|
webcomponentCode({ code: tag2 });
|
|
22100
22100
|
if (!/^[a-zA-Z][a-zA-Z0-9]*$/.test(name)) throw new TypeError("Invalid component authoring name");
|
|
22101
22101
|
const effective = { ...base.parameters };
|
|
@@ -22117,6 +22117,8 @@ function defineComponent({ name, tag: tag2, base, mixins = [], parameters: param
|
|
|
22117
22117
|
command,
|
|
22118
22118
|
mixins: Object.freeze([...mixins]),
|
|
22119
22119
|
parameters: freeze(structuredClone(effective)),
|
|
22120
|
+
childParameters: freeze(structuredClone(childParameters)),
|
|
22121
|
+
sourceContext,
|
|
22120
22122
|
implementation
|
|
22121
22123
|
});
|
|
22122
22124
|
}
|
|
@@ -22173,7 +22175,9 @@ var ComponentCollection = class {
|
|
|
22173
22175
|
parameters: structuredClone(component.parameters),
|
|
22174
22176
|
presentationDefaults: [...component.presentationDefaults],
|
|
22175
22177
|
dataScope: component.dataScope,
|
|
22176
|
-
command: component.command
|
|
22178
|
+
command: component.command,
|
|
22179
|
+
...Object.keys(component.childParameters).length ? { childParameters: structuredClone(component.childParameters) } : {},
|
|
22180
|
+
...component.sourceContext ? { sourceContext: true } : {}
|
|
22177
22181
|
} }
|
|
22178
22182
|
}]))
|
|
22179
22183
|
};
|
|
@@ -22417,12 +22421,12 @@ ChoiceGroup.parameters = {
|
|
|
22417
22421
|
// src/components/popup.js
|
|
22418
22422
|
var VIEWPORT_MARGIN = 8;
|
|
22419
22423
|
var ANCHOR_GAP = 3;
|
|
22420
|
-
function positionPopup(popup, anchor, { align = "start", matchWidth = false } = {}) {
|
|
22424
|
+
function positionPopup(popup, anchor, { align = "start", matchWidth = false, inset = 0 } = {}) {
|
|
22421
22425
|
const view = anchor.ownerDocument.defaultView;
|
|
22422
22426
|
const field = anchor.getBoundingClientRect();
|
|
22423
22427
|
const availableWidth = Math.max(0, view.innerWidth - 2 * VIEWPORT_MARGIN);
|
|
22424
22428
|
popup.style.setProperty("--gramlot-popup-available-width", `${availableWidth}px`);
|
|
22425
|
-
if (matchWidth) popup.style.width = `${Math.min(field.width, availableWidth)}px`;
|
|
22429
|
+
if (matchWidth) popup.style.width = `${Math.min(Math.max(0, field.width - 2 * inset), availableWidth)}px`;
|
|
22426
22430
|
popup.style.removeProperty("--gramlot-popup-available-height");
|
|
22427
22431
|
const natural = popup.getBoundingClientRect();
|
|
22428
22432
|
const below = Math.max(0, view.innerHeight - VIEWPORT_MARGIN - field.bottom - ANCHOR_GAP);
|
|
@@ -22430,7 +22434,7 @@ function positionPopup(popup, anchor, { align = "start", matchWidth = false } =
|
|
|
22430
22434
|
const upwards = natural.height > below && above > below;
|
|
22431
22435
|
popup.style.setProperty("--gramlot-popup-available-height", `${upwards ? above : below}px`);
|
|
22432
22436
|
const size = popup.getBoundingClientRect();
|
|
22433
|
-
const left = align === "end" ? field.right - size.width : field.left;
|
|
22437
|
+
const left = align === "end" ? field.right - size.width - inset : field.left + inset;
|
|
22434
22438
|
const top = upwards ? field.top - size.height - ANCHOR_GAP : field.bottom + ANCHOR_GAP;
|
|
22435
22439
|
popup.style.left = `${Math.max(VIEWPORT_MARGIN, Math.min(left, view.innerWidth - size.width - VIEWPORT_MARGIN))}px`;
|
|
22436
22440
|
popup.style.top = `${Math.max(VIEWPORT_MARGIN, Math.min(top, view.innerHeight - size.height - VIEWPORT_MARGIN))}px`;
|
|
@@ -22851,6 +22855,7 @@ var GramlotBuilderBagNode = class extends SourceBagNode {
|
|
|
22851
22855
|
codeAttributes() {
|
|
22852
22856
|
const own2 = [
|
|
22853
22857
|
...CODE_ATTRIBUTES[this.nodeTag] ?? [],
|
|
22858
|
+
...Object.entries(this.parentNode?._getMeta("gramlot_component")?.childParameters ?? {}).filter(([, spec]) => spec.inline).map(([name]) => name),
|
|
22854
22859
|
...this._getMeta("gramlot_component")?.command ? ["action", "_ask_if"] : [],
|
|
22855
22860
|
...typeof this.getAttr("remote") === "string" ? REMOTE_CODE_ATTRIBUTES : []
|
|
22856
22861
|
];
|
|
@@ -23309,7 +23314,8 @@ var BINDING_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
|
23309
23314
|
"_userChanges",
|
|
23310
23315
|
"remote",
|
|
23311
23316
|
"_cachedRemote",
|
|
23312
|
-
"_onRemote"
|
|
23317
|
+
"_onRemote",
|
|
23318
|
+
"onClose"
|
|
23313
23319
|
]);
|
|
23314
23320
|
var BINDING_ATTRIBUTE_PREFIXES = ["default_", "attr_", "fire_", "connect_on", "subscribe_", "selfsubscribe_", "formsubscribe_", "remote_"];
|
|
23315
23321
|
var NATIVE_ATTRIBUTES = {
|
|
@@ -23334,6 +23340,9 @@ function requireStyleClassAttributes(node, attrs, prefixes = []) {
|
|
|
23334
23340
|
}
|
|
23335
23341
|
}
|
|
23336
23342
|
function requireNoScriptAttributes(node, attrs, prefixes = []) {
|
|
23343
|
+
if (attrs.onClose != null && !node.parentNode?._getMeta("gramlot_component")?.childParameters?.onClose) {
|
|
23344
|
+
throw new Error("onClose is only supported on a tab/stack panel");
|
|
23345
|
+
}
|
|
23337
23346
|
for (const [name, value] of Object.entries(withoutNullValues(withoutBindingAttributes(attrs)))) {
|
|
23338
23347
|
const prefix = prefixes.find((candidate) => name.startsWith(candidate));
|
|
23339
23348
|
const bare = prefix ? name.slice(prefix.length) : name;
|
|
@@ -24918,7 +24927,8 @@ function domPropertyName(name) {
|
|
|
24918
24927
|
return PROPERTY_NAMES.get(camel.toLowerCase()) ?? camel;
|
|
24919
24928
|
}
|
|
24920
24929
|
var HtmlElement = class {
|
|
24921
|
-
constructor({ metadataAttributes = [] } = {}) {
|
|
24930
|
+
constructor({ metadataAttributes = [], invokeScript = null } = {}) {
|
|
24931
|
+
this.invokeScript = invokeScript;
|
|
24922
24932
|
this.metadataAttributes = /* @__PURE__ */ new Set([...META_ATTRS, "_text", ...metadataAttributes]);
|
|
24923
24933
|
}
|
|
24924
24934
|
definition(node) {
|
|
@@ -24963,6 +24973,17 @@ var HtmlElement = class {
|
|
|
24963
24973
|
return node.getRelativeData(".");
|
|
24964
24974
|
};
|
|
24965
24975
|
}
|
|
24976
|
+
if (meta.gramlot_component?.sourceContext) {
|
|
24977
|
+
element.setSourceContext({
|
|
24978
|
+
publish: (topic, payload) => node.publish(topic, payload),
|
|
24979
|
+
writeParameter: (name, value) => {
|
|
24980
|
+
const pointer = node.getAttr(name);
|
|
24981
|
+
if (node.pointerType(pointer) === "^" && !Object.is(node.getRelativeData(pointer.slice(1)), value)) {
|
|
24982
|
+
node.setRelativeData(pointer.slice(1), value);
|
|
24983
|
+
}
|
|
24984
|
+
}
|
|
24985
|
+
});
|
|
24986
|
+
}
|
|
24966
24987
|
const text = document.createTextNode(this.text(node));
|
|
24967
24988
|
if (namespace !== XHTML_NS || !meta.void) element.append(text);
|
|
24968
24989
|
const record2 = { element, text, tag: tag2 };
|
|
@@ -24988,13 +25009,25 @@ var HtmlElement = class {
|
|
|
24988
25009
|
const isHtml = element.namespaceURI === XHTML_NS;
|
|
24989
25010
|
const renderAttributes = this.definition(node).meta.render_attributes ?? {};
|
|
24990
25011
|
const previous = record2.attrs ?? {};
|
|
24991
|
-
|
|
24992
|
-
|
|
24993
|
-
|
|
24994
|
-
|
|
24995
|
-
|
|
25012
|
+
const adapt = (values) => {
|
|
25013
|
+
requireNoScriptAttributes(node, values, node.builder.constructor.dialectPrefixes);
|
|
25014
|
+
requireStyleClassAttributes(node, values, node.builder.constructor.dialectPrefixes);
|
|
25015
|
+
return node.builder.renderer_html.adaptAttrs(values);
|
|
25016
|
+
};
|
|
25017
|
+
const parent = node.parentNode;
|
|
25018
|
+
if (parent?._getMeta("gramlot_component")?.childParameters) {
|
|
25019
|
+
const Parent = element.ownerDocument.defaultView.customElements.get(parent._getMeta("render_tag"));
|
|
25020
|
+
attrs = Parent.projectChild(element, attrs, {
|
|
25021
|
+
adapt,
|
|
25022
|
+
invoke: (name, code, keywords) => this.invokeScript(node, name, code, keywords),
|
|
25023
|
+
publish: (topic, payload) => node.publish(topic, payload),
|
|
25024
|
+
publishParent: (topic, payload) => parent.publish(topic, payload),
|
|
25025
|
+
remove: () => node.parentBag.popNode(node.label)
|
|
24996
25026
|
});
|
|
24997
25027
|
}
|
|
25028
|
+
if (this.definition(node).meta.gramlot_component) {
|
|
25029
|
+
attrs = element.projectAttributes(attrs, adapt);
|
|
25030
|
+
}
|
|
24998
25031
|
attrs = Object.fromEntries(sourceAttributeItems({ ...attrs, ...renderAttributes }));
|
|
24999
25032
|
const controlled = ControlAdapter.classFor(element, attrs) !== null;
|
|
25000
25033
|
if (textValue2 === DEFAULT_TEXT) textValue2 = this.text(node);
|
|
@@ -27045,7 +27078,15 @@ var GramlotRenderer = class extends GramlotHtmlRenderer {
|
|
|
27045
27078
|
this._binding = binding;
|
|
27046
27079
|
this.source = source;
|
|
27047
27080
|
this.destination = destination;
|
|
27048
|
-
this.html = new HtmlElement({
|
|
27081
|
+
this.html = new HtmlElement({
|
|
27082
|
+
metadataAttributes: ["__ref"],
|
|
27083
|
+
invokeScript: (node, name, code, keywords) => this.inlineCompiler.compile(
|
|
27084
|
+
node,
|
|
27085
|
+
name,
|
|
27086
|
+
code,
|
|
27087
|
+
node.parentNode._getMeta("gramlot_component").childParameters[name].inline
|
|
27088
|
+
)(keywords)
|
|
27089
|
+
});
|
|
27049
27090
|
this.records = /* @__PURE__ */ new Map();
|
|
27050
27091
|
this.references = new References(source);
|
|
27051
27092
|
this.pending = [];
|
|
@@ -27534,9 +27575,10 @@ var GramlotRenderer = class extends GramlotHtmlRenderer {
|
|
|
27534
27575
|
/** Component parameters use resolved Source values, before HTML-only filtering (e.g. validate_*). */
|
|
27535
27576
|
componentAttributes(node, attrs) {
|
|
27536
27577
|
const component = node._getMeta("gramlot_component");
|
|
27537
|
-
|
|
27578
|
+
const childParameters = node.parentNode?._getMeta("gramlot_component")?.childParameters;
|
|
27579
|
+
if (!component && !childParameters) return attrs;
|
|
27538
27580
|
const resolved2 = this.#resolvedAttributes.get(node);
|
|
27539
|
-
const parameters2 = Object.fromEntries([.../* @__PURE__ */ new Set([...Object.keys(component
|
|
27581
|
+
const parameters2 = Object.fromEntries([.../* @__PURE__ */ new Set([...Object.keys(component?.parameters ?? {}), ...Object.keys(childParameters ?? {}), ...Object.keys(resolved2).filter((name) => name.startsWith("validate_"))])].filter((name) => Object.hasOwn(resolved2, name)).map((name) => [name, resolved2[name]]));
|
|
27540
27582
|
return { ...attrs, ...parameters2 };
|
|
27541
27583
|
}
|
|
27542
27584
|
/**
|
|
@@ -28825,7 +28867,7 @@ var IndexPage = class extends Page {
|
|
|
28825
28867
|
};
|
|
28826
28868
|
|
|
28827
28869
|
// src/index-page-styles.js
|
|
28828
|
-
var appearanceStyles = { "base": "", "compact": '/* Gramlot Compact: load after gramlot-base/theme.css. Colors and behavior stay in Base. */\n@layer gramlot.tokens {\n :root {\n --gramlot-field-height: 28px;\n --gramlot-field-line-height: 1.35;\n --gramlot-field-padding: .25rem .5rem;\n --gramlot-field-font-size: 1rem;\n --gramlot-space-1: .2rem;\n --gramlot-space-2: .4rem;\n --gramlot-space-3: .5rem;\n --gramlot-space-4: .6rem;\n --gramlot-space-6: .9rem;\n --gramlot-space-8: 1.2rem;\n --gramlot-space-12: 1.8rem;\n --gramlot-radius-sm: .25rem;\n --gramlot-radius: .35rem;\n --gramlot-radius-lg: .4rem;\n }\n}\n\n@layer gramlot.base {\n html { font-size: 13px; }\n body { line-height: 1.35; }\n :where(h1, h2, h3, h4, h5, h6, p, ul, ol, dl, blockquote, pre, figure) { margin-block: 0 .5rem; }\n h1 { font-size: 1.35rem; }\n h2 { font-size: 1.15rem; }\n h3 { font-size: 1.05rem; }\n pre { padding: .5rem; }\n blockquote { padding-inline-start: .6rem; }\n hr { margin-block: 1rem; }\n}\n\n@layer gramlot.components {\n :where(button, input[type="button"], input[type="submit"], input[type="reset"], .button) {\n min-block-size: 28px;\n padding: .25rem .5rem;\n font-size: 1rem;\n line-height: 1.35;\n }\n :where(label) { font-size: .95rem; }\n :where(input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="hidden"]), select, textarea) {\n min-block-size: var(--gramlot-field-height);\n padding: var(--gramlot-field-padding);\n font-size: var(--gramlot-field-font-size);\n line-height: var(--gramlot-field-line-height);\n }\n :where(textarea) { min-block-size: 5rem; }\n :where(input[type="color"]) { min-block-size: 28px; }\n :where(input[type="file"])::file-selector-button { margin-inline-end: .5rem; padding: .25rem .5rem; }\n :where(fieldset) { margin-block-end: .6rem; padding: .5rem; }\n :where(table) { font-size: 1rem; }\n :where(th, td) { padding: .4rem .5rem; }\n :where(details) { padding: .4rem .5rem; }\n :where(details[open] > summary) { margin-block-end: .5rem; }\n :where(dialog) { padding: .75rem; }\n}\n\n@layer gramlot.utilities {\n .example-page { inline-size: min(100% - 1.2rem, var(--gramlot-page-width)); padding-block: .6rem; }\n .card { padding: .6rem; box-shadow: none; }\n}\n', "mimi": '/* Gramlot Compact: load after gramlot-base/theme.css. Colors and behavior stay in Base. */\n@layer gramlot.tokens {\n :root {\n --gramlot-field-height: 28px;\n --gramlot-field-line-height: 1.35;\n --gramlot-field-padding: .25rem .5rem;\n --gramlot-field-font-size: 1rem;\n --gramlot-space-1: .2rem;\n --gramlot-space-2: .4rem;\n --gramlot-space-3: .5rem;\n --gramlot-space-4: .6rem;\n --gramlot-space-6: .9rem;\n --gramlot-space-8: 1.2rem;\n --gramlot-space-12: 1.8rem;\n --gramlot-radius-sm: .25rem;\n --gramlot-radius: .35rem;\n --gramlot-radius-lg: .4rem;\n }\n}\n\n@layer gramlot.base {\n html { font-size: 13px; }\n body { line-height: 1.35; }\n :where(h1, h2, h3, h4, h5, h6, p, ul, ol, dl, blockquote, pre, figure) { margin-block: 0 .5rem; }\n h1 { font-size: 1.35rem; }\n h2 { font-size: 1.15rem; }\n h3 { font-size: 1.05rem; }\n pre { padding: .5rem; }\n blockquote { padding-inline-start: .6rem; }\n hr { margin-block: 1rem; }\n}\n\n@layer gramlot.components {\n :where(button, input[type="button"], input[type="submit"], input[type="reset"], .button) {\n min-block-size: 28px;\n padding: .25rem .5rem;\n font-size: 1rem;\n line-height: 1.35;\n }\n :where(label) { font-size: .95rem; }\n :where(input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="hidden"]), select, textarea) {\n min-block-size: var(--gramlot-field-height);\n padding: var(--gramlot-field-padding);\n font-size: var(--gramlot-field-font-size);\n line-height: var(--gramlot-field-line-height);\n }\n :where(textarea) { min-block-size: 5rem; }\n :where(input[type="color"]) { min-block-size: 28px; }\n :where(input[type="file"])::file-selector-button { margin-inline-end: .5rem; padding: .25rem .5rem; }\n :where(fieldset) { margin-block-end: .6rem; padding: .5rem; }\n :where(table) { font-size: 1rem; }\n :where(th, td) { padding: .4rem .5rem; }\n :where(details) { padding: .4rem .5rem; }\n :where(details[open] > summary) { margin-block-end: .5rem; }\n :where(dialog) { padding: .75rem; }\n}\n\n@layer gramlot.utilities {\n .example-page { inline-size: min(100% - 1.2rem, var(--gramlot-page-width)); padding-block: .6rem; }\n .card { padding: .6rem; box-shadow: none; }\n}\n\n/* Gramlot adaptation of legacy mimi; load after Base and Compact. */\n@layer gramlot.tokens {\n :root {\n --gramlot-background: #EDEEF0;\n --gramlot-surface: #F5F5F6;\n --gramlot-surface-subtle: #E0E1E3;\n --gramlot-ink: #3C3D40;\n --gramlot-text-secondary: #6B6E72;\n --gramlot-border: #BDBFC2;\n --gramlot-border-control: #9EA0A3;\n --gramlot-navigation: #48494C;\n --gramlot-navigation-text: #FFFFFF;\n --gramlot-action: #0071E3;\n --gramlot-action-hover: #005BBB;\n --gramlot-brand-blue: #0071E3;\n --gramlot-brand-yellow: #9EA0A3;\n --gramlot-selected: #E8F1FC;\n --gramlot-focus-ring: #0071E3;\n --gramlot-field-background: #FFFFFF;\n --gramlot-field-readonly-background: #E0E1E3;\n --gramlot-error: #B3261E;\n --gramlot-error-background: #FFF1F0;\n --gramlot-shadow: 0 1px 4px rgb(0 0 0 / 6%);\n --gramlot-radius-sm: 4px;\n --gramlot-radius: 3px;\n --gramlot-radius-lg: 3px;\n --gramlot-field-height: 18px;\n --gramlot-field-padding: 1px 3px;\n --gramlot-field-line-height: 1.15;\n --gramlot-field-font-size: 1rem;\n --gramlot-label-size: .9em;\n --gramlot-label-gap: 2px;\n --gramlot-label-color: var(--gramlot-text-secondary);\n --gramlot-space-4: 6px;\n --gramlot-font-ui: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;\n }\n @media (prefers-color-scheme: dark) {\n :root:not([data-theme="light"]) {\n --gramlot-background: #242527;\n --gramlot-surface: #303134;\n --gramlot-surface-subtle: #3C3D40;\n --gramlot-ink: #F2F2F7;\n --gramlot-text-secondary: #C7C7CC;\n --gramlot-border: #6B6E72;\n --gramlot-border-control: #8E8E93;\n --gramlot-navigation: #1C1C1E;\n --gramlot-action: #78B7FF;\n --gramlot-action-hover: #A6CFFF;\n --gramlot-brand-blue: #3478CA;\n --gramlot-selected: #254163;\n --gramlot-focus-ring: #78B7FF;\n --gramlot-field-background: #202124;\n --gramlot-field-readonly-background: #3C3D40;\n --gramlot-error: #FFB4AB;\n --gramlot-error-background: #482524;\n --gramlot-shadow: 0 1px 4px rgb(0 0 0 / 20%);\n }\n }\n :root[data-theme="dark"] {\n --gramlot-background: #242527;\n --gramlot-surface: #303134;\n --gramlot-surface-subtle: #3C3D40;\n --gramlot-ink: #F2F2F7;\n --gramlot-text-secondary: #C7C7CC;\n --gramlot-border: #6B6E72;\n --gramlot-border-control: #8E8E93;\n --gramlot-navigation: #1C1C1E;\n --gramlot-action: #78B7FF;\n --gramlot-action-hover: #A6CFFF;\n --gramlot-brand-blue: #3478CA;\n --gramlot-selected: #254163;\n --gramlot-focus-ring: #78B7FF;\n --gramlot-field-background: #202124;\n --gramlot-field-readonly-background: #3C3D40;\n --gramlot-error: #FFB4AB;\n --gramlot-error-background: #482524;\n --gramlot-shadow: 0 1px 4px rgb(0 0 0 / 20%);\n }\n}\n@layer gramlot.base {\n html { font-size: 12px; }\n}\n@layer gramlot.components {\n :where(label) { font-size: var(--gramlot-label-size); font-weight: normal; color: var(--gramlot-label-color); margin-block-end: var(--gramlot-label-gap); }\n :where(button, input[type="button"], input[type="submit"], input[type="reset"], .button) { min-block-size: 24px; padding: 2px 8px; font-weight: 500; }\n}\n@layer gramlot.utilities {\n .card { box-shadow: var(--gramlot-shadow); }\n}\n', "joanna": '/* Gramlot Compact: load after gramlot-base/theme.css. Colors and behavior stay in Base. */\n@layer gramlot.tokens {\n :root {\n --gramlot-field-height: 28px;\n --gramlot-field-line-height: 1.35;\n --gramlot-field-padding: .25rem .5rem;\n --gramlot-field-font-size: 1rem;\n --gramlot-space-1: .2rem;\n --gramlot-space-2: .4rem;\n --gramlot-space-3: .5rem;\n --gramlot-space-4: .6rem;\n --gramlot-space-6: .9rem;\n --gramlot-space-8: 1.2rem;\n --gramlot-space-12: 1.8rem;\n --gramlot-radius-sm: .25rem;\n --gramlot-radius: .35rem;\n --gramlot-radius-lg: .4rem;\n }\n}\n\n@layer gramlot.base {\n html { font-size: 13px; }\n body { line-height: 1.35; }\n :where(h1, h2, h3, h4, h5, h6, p, ul, ol, dl, blockquote, pre, figure) { margin-block: 0 .5rem; }\n h1 { font-size: 1.35rem; }\n h2 { font-size: 1.15rem; }\n h3 { font-size: 1.05rem; }\n pre { padding: .5rem; }\n blockquote { padding-inline-start: .6rem; }\n hr { margin-block: 1rem; }\n}\n\n@layer gramlot.components {\n :where(button, input[type="button"], input[type="submit"], input[type="reset"], .button) {\n min-block-size: 28px;\n padding: .25rem .5rem;\n font-size: 1rem;\n line-height: 1.35;\n }\n :where(label) { font-size: .95rem; }\n :where(input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="hidden"]), select, textarea) {\n min-block-size: var(--gramlot-field-height);\n padding: var(--gramlot-field-padding);\n font-size: var(--gramlot-field-font-size);\n line-height: var(--gramlot-field-line-height);\n }\n :where(textarea) { min-block-size: 5rem; }\n :where(input[type="color"]) { min-block-size: 28px; }\n :where(input[type="file"])::file-selector-button { margin-inline-end: .5rem; padding: .25rem .5rem; }\n :where(fieldset) { margin-block-end: .6rem; padding: .5rem; }\n :where(table) { font-size: 1rem; }\n :where(th, td) { padding: .4rem .5rem; }\n :where(details) { padding: .4rem .5rem; }\n :where(details[open] > summary) { margin-block-end: .5rem; }\n :where(dialog) { padding: .75rem; }\n}\n\n@layer gramlot.utilities {\n .example-page { inline-size: min(100% - 1.2rem, var(--gramlot-page-width)); padding-block: .6rem; }\n .card { padding: .6rem; box-shadow: none; }\n}\n\n/* Gramlot adaptation of legacy joanna; load after Base and Compact. */\n@layer gramlot.tokens {\n :root {\n --gramlot-background: #F2F2F7;\n --gramlot-surface: #FFFFFF;\n --gramlot-surface-subtle: #F2F2F7;\n --gramlot-ink: #3A3A3C;\n --gramlot-text-secondary: #636366;\n --gramlot-border: #D1D1D6;\n --gramlot-border-control: #AEAEB2;\n --gramlot-navigation: #3A3A3C;\n --gramlot-navigation-text: #FFFFFF;\n --gramlot-action: #007AFF;\n --gramlot-action-hover: #0061CC;\n --gramlot-brand-blue: #007AFF;\n --gramlot-brand-yellow: #AEAEB2;\n --gramlot-selected: #E0EFFF;\n --gramlot-focus-ring: #007AFF;\n --gramlot-field-background: #FFFFFF;\n --gramlot-field-readonly-background: #F2F2F7;\n --gramlot-error: #B3261E;\n --gramlot-error-background: #FFF1F0;\n --gramlot-shadow: 0 1px 4px rgb(0 0 0 / 6%);\n --gramlot-radius-sm: 6px;\n --gramlot-radius: 6px;\n --gramlot-radius-lg: 6px;\n --gramlot-field-height: 20px;\n --gramlot-field-padding: 1px 3px;\n --gramlot-field-line-height: 1.15;\n --gramlot-field-font-size: 1rem;\n --gramlot-label-size: .8em;\n --gramlot-label-gap: 2px;\n --gramlot-label-color: var(--gramlot-text-secondary);\n --gramlot-space-4: 6px;\n --gramlot-font-ui: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;\n }\n @media (prefers-color-scheme: dark) {\n :root:not([data-theme="light"]) {\n --gramlot-background: #1C1C1E;\n --gramlot-surface: #2C2C2E;\n --gramlot-surface-subtle: #3A3A3C;\n --gramlot-ink: #F2F2F7;\n --gramlot-text-secondary: #C7C7CC;\n --gramlot-border: #636366;\n --gramlot-border-control: #8E8E93;\n --gramlot-navigation: #1C1C1E;\n --gramlot-action: #78B7FF;\n --gramlot-action-hover: #A6CFFF;\n --gramlot-brand-blue: #3478CA;\n --gramlot-selected: #254163;\n --gramlot-focus-ring: #78B7FF;\n --gramlot-field-background: #202124;\n --gramlot-field-readonly-background: #3A3A3C;\n --gramlot-error: #FFB4AB;\n --gramlot-error-background: #482524;\n --gramlot-shadow: 0 1px 4px rgb(0 0 0 / 20%);\n }\n }\n :root[data-theme="dark"] {\n --gramlot-background: #1C1C1E;\n --gramlot-surface: #2C2C2E;\n --gramlot-surface-subtle: #3A3A3C;\n --gramlot-ink: #F2F2F7;\n --gramlot-text-secondary: #C7C7CC;\n --gramlot-border: #636366;\n --gramlot-border-control: #8E8E93;\n --gramlot-navigation: #1C1C1E;\n --gramlot-action: #78B7FF;\n --gramlot-action-hover: #A6CFFF;\n --gramlot-brand-blue: #3478CA;\n --gramlot-selected: #254163;\n --gramlot-focus-ring: #78B7FF;\n --gramlot-field-background: #202124;\n --gramlot-field-readonly-background: #3A3A3C;\n --gramlot-error: #FFB4AB;\n --gramlot-error-background: #482524;\n --gramlot-shadow: 0 1px 4px rgb(0 0 0 / 20%);\n }\n}\n@layer gramlot.base {\n html { font-size: 13px; }\n}\n@layer gramlot.components {\n :where(label) { font-size: var(--gramlot-label-size); font-weight: normal; color: var(--gramlot-label-color); margin-block-end: var(--gramlot-label-gap); }\n :where(button, input[type="button"], input[type="submit"], input[type="reset"], .button) { min-block-size: 26px; padding: 2px 8px; font-weight: 500; }\n}\n@layer gramlot.utilities {\n .card { box-shadow: var(--gramlot-shadow); }\n}\n' };
|
|
28870
|
+
var appearanceStyles = { "base": "", "compact": '/* Gramlot Compact: load after gramlot-base/theme.css. Colors and behavior stay in Base. */\n@layer gramlot.tokens {\n :root {\n --gramlot-field-height: 28px;\n --gramlot-field-line-height: 1.35;\n --gramlot-field-padding: .25rem .5rem;\n --gramlot-field-font-size: 1rem;\n --gramlot-space-1: .2rem;\n --gramlot-space-2: .4rem;\n --gramlot-space-3: .5rem;\n --gramlot-space-4: .6rem;\n --gramlot-space-6: .9rem;\n --gramlot-space-8: 1.2rem;\n --gramlot-space-12: 1.8rem;\n --gramlot-radius-sm: .25rem;\n --gramlot-radius: .35rem;\n --gramlot-radius-lg: .4rem;\n }\n}\n\n@layer gramlot.base {\n html { font-size: 13px; }\n body { line-height: 1.35; }\n :where(h1, h2, h3, h4, h5, h6, p, ul, ol, dl, blockquote, pre, figure) { margin-block: 0 .5rem; }\n h1 { font-size: 1.35rem; }\n h2 { font-size: 1.15rem; }\n h3 { font-size: 1.05rem; }\n pre { padding: .5rem; }\n blockquote { padding-inline-start: .6rem; }\n hr { margin-block: 1rem; }\n}\n\n@layer gramlot.components {\n :where(button, input[type="button"], input[type="submit"], input[type="reset"], .button) {\n min-block-size: 28px;\n padding: .25rem .5rem;\n font-size: 1rem;\n line-height: 1.35;\n }\n :where(label) { font-size: .95rem; }\n :where(input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="hidden"]), select, textarea) {\n min-block-size: var(--gramlot-field-height);\n padding: var(--gramlot-field-padding);\n font-size: var(--gramlot-field-font-size);\n line-height: var(--gramlot-field-line-height);\n }\n :where(textarea) { min-block-size: 5rem; }\n :where(input[type="color"]) { min-block-size: 28px; }\n :where(input[type="file"])::file-selector-button { margin-inline-end: .5rem; padding: .25rem .5rem; }\n :where(fieldset) { margin-block-end: .6rem; padding: .5rem; }\n :where(table) { font-size: 1rem; }\n :where(th, td) { padding: .4rem .5rem; }\n :where(details) { padding: .4rem .5rem; }\n :where(details[open] > summary) { margin-block-end: .5rem; }\n :where(dialog) { padding: .75rem; }\n}\n\n@layer gramlot.utilities {\n .example-page { inline-size: min(100% - 1.2rem, var(--gramlot-page-width)); padding-block: .6rem; }\n .card { padding: .6rem; box-shadow: none; }\n}\n', "mimi": '/* Gramlot Compact: load after gramlot-base/theme.css. Colors and behavior stay in Base. */\n@layer gramlot.tokens {\n :root {\n --gramlot-field-height: 28px;\n --gramlot-field-line-height: 1.35;\n --gramlot-field-padding: .25rem .5rem;\n --gramlot-field-font-size: 1rem;\n --gramlot-space-1: .2rem;\n --gramlot-space-2: .4rem;\n --gramlot-space-3: .5rem;\n --gramlot-space-4: .6rem;\n --gramlot-space-6: .9rem;\n --gramlot-space-8: 1.2rem;\n --gramlot-space-12: 1.8rem;\n --gramlot-radius-sm: .25rem;\n --gramlot-radius: .35rem;\n --gramlot-radius-lg: .4rem;\n }\n}\n\n@layer gramlot.base {\n html { font-size: 13px; }\n body { line-height: 1.35; }\n :where(h1, h2, h3, h4, h5, h6, p, ul, ol, dl, blockquote, pre, figure) { margin-block: 0 .5rem; }\n h1 { font-size: 1.35rem; }\n h2 { font-size: 1.15rem; }\n h3 { font-size: 1.05rem; }\n pre { padding: .5rem; }\n blockquote { padding-inline-start: .6rem; }\n hr { margin-block: 1rem; }\n}\n\n@layer gramlot.components {\n :where(button, input[type="button"], input[type="submit"], input[type="reset"], .button) {\n min-block-size: 28px;\n padding: .25rem .5rem;\n font-size: 1rem;\n line-height: 1.35;\n }\n :where(label) { font-size: .95rem; }\n :where(input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="hidden"]), select, textarea) {\n min-block-size: var(--gramlot-field-height);\n padding: var(--gramlot-field-padding);\n font-size: var(--gramlot-field-font-size);\n line-height: var(--gramlot-field-line-height);\n }\n :where(textarea) { min-block-size: 5rem; }\n :where(input[type="color"]) { min-block-size: 28px; }\n :where(input[type="file"])::file-selector-button { margin-inline-end: .5rem; padding: .25rem .5rem; }\n :where(fieldset) { margin-block-end: .6rem; padding: .5rem; }\n :where(table) { font-size: 1rem; }\n :where(th, td) { padding: .4rem .5rem; }\n :where(details) { padding: .4rem .5rem; }\n :where(details[open] > summary) { margin-block-end: .5rem; }\n :where(dialog) { padding: .75rem; }\n}\n\n@layer gramlot.utilities {\n .example-page { inline-size: min(100% - 1.2rem, var(--gramlot-page-width)); padding-block: .6rem; }\n .card { padding: .6rem; box-shadow: none; }\n}\n\n/* Gramlot adaptation of legacy mimi; load after Base and Compact. */\n@layer gramlot.tokens {\n :root {\n --gramlot-tab-height: 24px;\n --gramlot-tab-padding: 3px 10px;\n --gramlot-tab-radius: 3px;\n --gramlot-tab-gap: 2px;\n --gramlot-tab-strip-padding: 3px;\n --gramlot-tab-background: var(--gramlot-background);\n --gramlot-tab-selected-background: var(--gramlot-surface);\n --gramlot-tab-selected-color: var(--gramlot-ink);\n --gramlot-tab-border: var(--gramlot-border);\n --gramlot-background: #EDEEF0;\n --gramlot-surface: #F5F5F6;\n --gramlot-surface-subtle: #E0E1E3;\n --gramlot-ink: #3C3D40;\n --gramlot-text-secondary: #6B6E72;\n --gramlot-border: #BDBFC2;\n --gramlot-border-control: #9EA0A3;\n --gramlot-navigation: #48494C;\n --gramlot-navigation-text: #FFFFFF;\n --gramlot-action: #0071E3;\n --gramlot-action-hover: #005BBB;\n --gramlot-brand-blue: #0071E3;\n --gramlot-brand-yellow: #9EA0A3;\n --gramlot-selected: #E8F1FC;\n --gramlot-focus-ring: #0071E3;\n --gramlot-field-background: #FFFFFF;\n --gramlot-field-readonly-background: #E0E1E3;\n --gramlot-error: #B3261E;\n --gramlot-error-background: #FFF1F0;\n --gramlot-shadow: 0 1px 4px rgb(0 0 0 / 6%);\n --gramlot-radius-sm: 4px;\n --gramlot-radius: 3px;\n --gramlot-radius-lg: 3px;\n --gramlot-field-height: 18px;\n --gramlot-field-padding: 1px 3px;\n --gramlot-field-line-height: 1.15;\n --gramlot-field-font-size: 1rem;\n --gramlot-label-size: .9em;\n --gramlot-label-gap: 2px;\n --gramlot-label-color: var(--gramlot-text-secondary);\n --gramlot-space-4: 6px;\n --gramlot-font-ui: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;\n }\n @media (prefers-color-scheme: dark) {\n :root:not([data-theme="light"]) {\n --gramlot-background: #242527;\n --gramlot-surface: #303134;\n --gramlot-surface-subtle: #3C3D40;\n --gramlot-ink: #F2F2F7;\n --gramlot-text-secondary: #C7C7CC;\n --gramlot-border: #6B6E72;\n --gramlot-border-control: #8E8E93;\n --gramlot-navigation: #1C1C1E;\n --gramlot-action: #78B7FF;\n --gramlot-action-hover: #A6CFFF;\n --gramlot-brand-blue: #3478CA;\n --gramlot-selected: #254163;\n --gramlot-focus-ring: #78B7FF;\n --gramlot-field-background: #202124;\n --gramlot-field-readonly-background: #3C3D40;\n --gramlot-error: #FFB4AB;\n --gramlot-error-background: #482524;\n --gramlot-shadow: 0 1px 4px rgb(0 0 0 / 20%);\n }\n }\n :root[data-theme="dark"] {\n --gramlot-background: #242527;\n --gramlot-surface: #303134;\n --gramlot-surface-subtle: #3C3D40;\n --gramlot-ink: #F2F2F7;\n --gramlot-text-secondary: #C7C7CC;\n --gramlot-border: #6B6E72;\n --gramlot-border-control: #8E8E93;\n --gramlot-navigation: #1C1C1E;\n --gramlot-action: #78B7FF;\n --gramlot-action-hover: #A6CFFF;\n --gramlot-brand-blue: #3478CA;\n --gramlot-selected: #254163;\n --gramlot-focus-ring: #78B7FF;\n --gramlot-field-background: #202124;\n --gramlot-field-readonly-background: #3C3D40;\n --gramlot-error: #FFB4AB;\n --gramlot-error-background: #482524;\n --gramlot-shadow: 0 1px 4px rgb(0 0 0 / 20%);\n }\n}\n@layer gramlot.base {\n html { font-size: 12px; }\n}\n@layer gramlot.components {\n :where(label) { font-size: var(--gramlot-label-size); font-weight: normal; color: var(--gramlot-label-color); margin-block-end: var(--gramlot-label-gap); }\n :where(button, input[type="button"], input[type="submit"], input[type="reset"], .button) { min-block-size: 24px; padding: 2px 8px; font-weight: 500; }\n}\n@layer gramlot.utilities {\n .card { box-shadow: var(--gramlot-shadow); }\n}\n', "joanna": '/* Gramlot Compact: load after gramlot-base/theme.css. Colors and behavior stay in Base. */\n@layer gramlot.tokens {\n :root {\n --gramlot-field-height: 28px;\n --gramlot-field-line-height: 1.35;\n --gramlot-field-padding: .25rem .5rem;\n --gramlot-field-font-size: 1rem;\n --gramlot-space-1: .2rem;\n --gramlot-space-2: .4rem;\n --gramlot-space-3: .5rem;\n --gramlot-space-4: .6rem;\n --gramlot-space-6: .9rem;\n --gramlot-space-8: 1.2rem;\n --gramlot-space-12: 1.8rem;\n --gramlot-radius-sm: .25rem;\n --gramlot-radius: .35rem;\n --gramlot-radius-lg: .4rem;\n }\n}\n\n@layer gramlot.base {\n html { font-size: 13px; }\n body { line-height: 1.35; }\n :where(h1, h2, h3, h4, h5, h6, p, ul, ol, dl, blockquote, pre, figure) { margin-block: 0 .5rem; }\n h1 { font-size: 1.35rem; }\n h2 { font-size: 1.15rem; }\n h3 { font-size: 1.05rem; }\n pre { padding: .5rem; }\n blockquote { padding-inline-start: .6rem; }\n hr { margin-block: 1rem; }\n}\n\n@layer gramlot.components {\n :where(button, input[type="button"], input[type="submit"], input[type="reset"], .button) {\n min-block-size: 28px;\n padding: .25rem .5rem;\n font-size: 1rem;\n line-height: 1.35;\n }\n :where(label) { font-size: .95rem; }\n :where(input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="hidden"]), select, textarea) {\n min-block-size: var(--gramlot-field-height);\n padding: var(--gramlot-field-padding);\n font-size: var(--gramlot-field-font-size);\n line-height: var(--gramlot-field-line-height);\n }\n :where(textarea) { min-block-size: 5rem; }\n :where(input[type="color"]) { min-block-size: 28px; }\n :where(input[type="file"])::file-selector-button { margin-inline-end: .5rem; padding: .25rem .5rem; }\n :where(fieldset) { margin-block-end: .6rem; padding: .5rem; }\n :where(table) { font-size: 1rem; }\n :where(th, td) { padding: .4rem .5rem; }\n :where(details) { padding: .4rem .5rem; }\n :where(details[open] > summary) { margin-block-end: .5rem; }\n :where(dialog) { padding: .75rem; }\n}\n\n@layer gramlot.utilities {\n .example-page { inline-size: min(100% - 1.2rem, var(--gramlot-page-width)); padding-block: .6rem; }\n .card { padding: .6rem; box-shadow: none; }\n}\n\n/* Gramlot adaptation of legacy joanna; load after Base and Compact. */\n@layer gramlot.tokens {\n :root {\n --gramlot-tab-height: 26px;\n --gramlot-tab-padding: 3px 10px;\n --gramlot-tab-radius: 6px;\n --gramlot-tab-gap: 2px;\n --gramlot-tab-strip-padding: 3px;\n --gramlot-tab-background: var(--gramlot-background);\n --gramlot-tab-selected-background: var(--gramlot-surface);\n --gramlot-tab-selected-color: var(--gramlot-ink);\n --gramlot-tab-border: var(--gramlot-border);\n --gramlot-background: #F2F2F7;\n --gramlot-surface: #FFFFFF;\n --gramlot-surface-subtle: #F2F2F7;\n --gramlot-ink: #3A3A3C;\n --gramlot-text-secondary: #636366;\n --gramlot-border: #D1D1D6;\n --gramlot-border-control: #AEAEB2;\n --gramlot-navigation: #3A3A3C;\n --gramlot-navigation-text: #FFFFFF;\n --gramlot-action: #007AFF;\n --gramlot-action-hover: #0061CC;\n --gramlot-brand-blue: #007AFF;\n --gramlot-brand-yellow: #AEAEB2;\n --gramlot-selected: #E0EFFF;\n --gramlot-focus-ring: #007AFF;\n --gramlot-field-background: #FFFFFF;\n --gramlot-field-readonly-background: #F2F2F7;\n --gramlot-error: #B3261E;\n --gramlot-error-background: #FFF1F0;\n --gramlot-shadow: 0 1px 4px rgb(0 0 0 / 6%);\n --gramlot-radius-sm: 6px;\n --gramlot-radius: 6px;\n --gramlot-radius-lg: 6px;\n --gramlot-field-height: 20px;\n --gramlot-field-padding: 1px 3px;\n --gramlot-field-line-height: 1.15;\n --gramlot-field-font-size: 1rem;\n --gramlot-label-size: .8em;\n --gramlot-label-gap: 2px;\n --gramlot-label-color: var(--gramlot-text-secondary);\n --gramlot-space-4: 6px;\n --gramlot-font-ui: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;\n }\n @media (prefers-color-scheme: dark) {\n :root:not([data-theme="light"]) {\n --gramlot-background: #1C1C1E;\n --gramlot-surface: #2C2C2E;\n --gramlot-surface-subtle: #3A3A3C;\n --gramlot-ink: #F2F2F7;\n --gramlot-text-secondary: #C7C7CC;\n --gramlot-border: #636366;\n --gramlot-border-control: #8E8E93;\n --gramlot-navigation: #1C1C1E;\n --gramlot-action: #78B7FF;\n --gramlot-action-hover: #A6CFFF;\n --gramlot-brand-blue: #3478CA;\n --gramlot-selected: #254163;\n --gramlot-focus-ring: #78B7FF;\n --gramlot-field-background: #202124;\n --gramlot-field-readonly-background: #3A3A3C;\n --gramlot-error: #FFB4AB;\n --gramlot-error-background: #482524;\n --gramlot-shadow: 0 1px 4px rgb(0 0 0 / 20%);\n }\n }\n :root[data-theme="dark"] {\n --gramlot-background: #1C1C1E;\n --gramlot-surface: #2C2C2E;\n --gramlot-surface-subtle: #3A3A3C;\n --gramlot-ink: #F2F2F7;\n --gramlot-text-secondary: #C7C7CC;\n --gramlot-border: #636366;\n --gramlot-border-control: #8E8E93;\n --gramlot-navigation: #1C1C1E;\n --gramlot-action: #78B7FF;\n --gramlot-action-hover: #A6CFFF;\n --gramlot-brand-blue: #3478CA;\n --gramlot-selected: #254163;\n --gramlot-focus-ring: #78B7FF;\n --gramlot-field-background: #202124;\n --gramlot-field-readonly-background: #3A3A3C;\n --gramlot-error: #FFB4AB;\n --gramlot-error-background: #482524;\n --gramlot-shadow: 0 1px 4px rgb(0 0 0 / 20%);\n }\n}\n@layer gramlot.base {\n html { font-size: 13px; }\n}\n@layer gramlot.components {\n :where(label) { font-size: var(--gramlot-label-size); font-weight: normal; color: var(--gramlot-label-color); margin-block-end: var(--gramlot-label-gap); }\n :where(button, input[type="button"], input[type="submit"], input[type="reset"], .button) { min-block-size: 26px; padding: 2px 8px; font-weight: 500; }\n}\n@layer gramlot.utilities {\n .card { box-shadow: var(--gramlot-shadow); }\n}\n' };
|
|
28829
28871
|
|
|
28830
28872
|
// src/index-theme.js
|
|
28831
28873
|
var THEME_READY = "index:theme-ready";
|
|
@@ -28836,7 +28878,9 @@ var APPEARANCES = /* @__PURE__ */ new Set(["base", "compact", "mimi", "joanna"])
|
|
|
28836
28878
|
// src/index-page-runtime.js
|
|
28837
28879
|
function mountIndexPage(renderer, root, onSelection = () => {
|
|
28838
28880
|
}, prepareEntry = () => {
|
|
28839
|
-
}) {
|
|
28881
|
+
}, { containerLayout = false, state: suppliedState = null, createEntry = null, onLoad = () => {
|
|
28882
|
+
} } = {}) {
|
|
28883
|
+
if (createEntry && !containerLayout) throw new TypeError("Deferred index entries require containerLayout");
|
|
28840
28884
|
const shell = renderer.records.get(root).element;
|
|
28841
28885
|
const document = shell.ownerDocument;
|
|
28842
28886
|
const window2 = document.defaultView;
|
|
@@ -28869,7 +28913,7 @@ function mountIndexPage(renderer, root, onSelection = () => {
|
|
|
28869
28913
|
restoreChoice(appearance, preferences.appearance, APPEARANCES);
|
|
28870
28914
|
const families = [...shell.querySelectorAll(".index-sidebar details")];
|
|
28871
28915
|
const Bag2 = root.builder.data.constructor;
|
|
28872
|
-
const state = new Bag2();
|
|
28916
|
+
const state = suppliedState ?? new Bag2();
|
|
28873
28917
|
const opened = new Bag2();
|
|
28874
28918
|
state.setItem("opened", opened);
|
|
28875
28919
|
state.setItem("keyboard", keyboard?.checked ?? false);
|
|
@@ -28930,38 +28974,83 @@ function mountIndexPage(renderer, root, onSelection = () => {
|
|
|
28930
28974
|
const updatePanels = () => {
|
|
28931
28975
|
if (navigationToggle) {
|
|
28932
28976
|
const visible = state.getItem("navigationVisible");
|
|
28933
|
-
set(sidebar, { hidden: !visible });
|
|
28934
|
-
set(sidebarHandle, { hidden: !visible });
|
|
28977
|
+
set(sidebar, containerLayout ? { drawer: visible ? true : "close" } : { hidden: !visible });
|
|
28978
|
+
if (!containerLayout) set(sidebarHandle, { hidden: !visible });
|
|
28935
28979
|
set(navigationToggle, { aria_expanded: String(visible) });
|
|
28936
28980
|
set(shell, { data_navigation_hidden: String(!visible) });
|
|
28937
28981
|
}
|
|
28938
28982
|
if (codeSidebar) {
|
|
28939
28983
|
const available = Boolean(entries.get(state.getItem("active"))?.code);
|
|
28940
28984
|
const visible = available && state.getItem("codeVisible");
|
|
28941
|
-
set(codeSidebar, { hidden: !visible });
|
|
28942
|
-
set(codeHandle, { hidden: !visible });
|
|
28985
|
+
set(codeSidebar, containerLayout ? { hidden: !available, drawer: visible ? true : "close" } : { hidden: !visible });
|
|
28986
|
+
if (!containerLayout) set(codeHandle, { hidden: !visible });
|
|
28943
28987
|
set(codeToggle, { disabled: !available, aria_expanded: String(visible) });
|
|
28944
28988
|
set(shell, { data_code_visible: String(visible) });
|
|
28945
28989
|
}
|
|
28946
28990
|
};
|
|
28991
|
+
const prepare = (entry) => {
|
|
28992
|
+
entry.panel = byId(`panel-${entry.key}`);
|
|
28993
|
+
entry.tab = containerLayout ? entry.panel : byId(`tab-${entry.key}`);
|
|
28994
|
+
entry.code = byId(`codepane-${entry.key}`);
|
|
28995
|
+
if (entry.key === "intro") return;
|
|
28996
|
+
prepareEntry(entry, { byId, node, set, listen });
|
|
28997
|
+
entry.frame = byId(`frame-${entry.key}`);
|
|
28998
|
+
if (entry.frame) listen(entry.frame, "load", () => send(entry.frame));
|
|
28999
|
+
};
|
|
29000
|
+
const openEntry = (entry) => {
|
|
29001
|
+
if (opened.getItem(entry.key)) return;
|
|
29002
|
+
opened.setItem(entry.key, true);
|
|
29003
|
+
set(containerLayout ? entry.panel : entry.tab, { hidden: false });
|
|
29004
|
+
if (entry.frame) set(entry.frame, { src: entry.open.getAttribute("href") });
|
|
29005
|
+
};
|
|
29006
|
+
let selecting = false;
|
|
28947
29007
|
function select(key) {
|
|
28948
|
-
|
|
28949
|
-
|
|
28950
|
-
|
|
28951
|
-
|
|
28952
|
-
|
|
28953
|
-
|
|
28954
|
-
|
|
28955
|
-
|
|
28956
|
-
|
|
28957
|
-
|
|
28958
|
-
|
|
28959
|
-
|
|
28960
|
-
|
|
28961
|
-
|
|
28962
|
-
|
|
28963
|
-
|
|
28964
|
-
|
|
29008
|
+
if (selecting || disposed) return;
|
|
29009
|
+
const requested = entries.get(key);
|
|
29010
|
+
if (!requested) return;
|
|
29011
|
+
state.setItem("requested", key);
|
|
29012
|
+
if (!requested.panel) {
|
|
29013
|
+
onLoad(key, "loading");
|
|
29014
|
+
if (!requested.loading) {
|
|
29015
|
+
requested.loading = Promise.resolve().then(() => {
|
|
29016
|
+
if (!disposed) return createEntry(requested);
|
|
29017
|
+
}).then(() => {
|
|
29018
|
+
if (disposed) return;
|
|
29019
|
+
prepare(requested);
|
|
29020
|
+
openEntry(requested);
|
|
29021
|
+
if (state.getItem("requested") === key) {
|
|
29022
|
+
onLoad(key, "ready");
|
|
29023
|
+
select(key);
|
|
29024
|
+
}
|
|
29025
|
+
}).catch((error) => {
|
|
29026
|
+
if (!disposed && state.getItem("requested") === key) onLoad(key, "error", error);
|
|
29027
|
+
}).finally(() => {
|
|
29028
|
+
requested.loading = null;
|
|
29029
|
+
});
|
|
29030
|
+
}
|
|
29031
|
+
return;
|
|
29032
|
+
}
|
|
29033
|
+
onLoad(key, "ready");
|
|
29034
|
+
selecting = true;
|
|
29035
|
+
try {
|
|
29036
|
+
const entry = entries.get(key);
|
|
29037
|
+
openEntry(entry);
|
|
29038
|
+
if (entry.family) set(entry.family, { open: true });
|
|
29039
|
+
for (const [current, item] of entries) {
|
|
29040
|
+
const active = current === key;
|
|
29041
|
+
if (!containerLayout) {
|
|
29042
|
+
set(item.tab, { aria_selected: String(active), tabindex: active && state.getItem("keyboard") ? 0 : -1 });
|
|
29043
|
+
set(item.panel, { hidden: !active });
|
|
29044
|
+
}
|
|
29045
|
+
if (item.code) set(item.code, { hidden: !active });
|
|
29046
|
+
if (item.open) set(item.open, { aria_current: active ? "page" : null });
|
|
29047
|
+
}
|
|
29048
|
+
if (state.getItem("active") !== key) state.setItem("active", key);
|
|
29049
|
+
updatePanels();
|
|
29050
|
+
updateInspector();
|
|
29051
|
+
} finally {
|
|
29052
|
+
selecting = false;
|
|
29053
|
+
}
|
|
28965
29054
|
}
|
|
28966
29055
|
const sidebarMaximum = () => Math.max(120, Math.min(460, Math.floor(window2.innerWidth * 0.6)));
|
|
28967
29056
|
const applyWidths = () => set(shell, { style: `--sidebar-width: ${state.getItem("sidebarWidth")}px; --code-width: ${state.getItem("codeWidth") ?? 420}px` });
|
|
@@ -29028,10 +29117,37 @@ function mountIndexPage(renderer, root, onSelection = () => {
|
|
|
29028
29117
|
});
|
|
29029
29118
|
}
|
|
29030
29119
|
set(shell, { data_resizing: null });
|
|
29031
|
-
|
|
29032
|
-
|
|
29033
|
-
|
|
29034
|
-
|
|
29120
|
+
if (!containerLayout) {
|
|
29121
|
+
const savedWidth = preferences.sidebarWidth;
|
|
29122
|
+
const width = typeof savedWidth === "number" && Number.isFinite(savedWidth) && savedWidth >= 120 && savedWidth <= 460 ? savedWidth : sidebar.getBoundingClientRect().width || Number(sidebarHandle.getAttribute("aria-valuenow"));
|
|
29123
|
+
state.setItem("preferredSidebarWidth", width);
|
|
29124
|
+
setSidebarWidth(width);
|
|
29125
|
+
} else {
|
|
29126
|
+
const gramlot = renderer.binding.gramlot;
|
|
29127
|
+
for (const [pane, property, widthProperty] of [[sidebar, "navigationVisible", "sidebarWidth"], [codeSidebar, "codeVisible", "codeWidth"]]) {
|
|
29128
|
+
const source = node(pane);
|
|
29129
|
+
const savedWidth = preferences[widthProperty];
|
|
29130
|
+
if (typeof savedWidth === "number" && Number.isFinite(savedWidth) && savedWidth > 0) set(pane, { width: `${savedWidth}px` });
|
|
29131
|
+
const handle2 = gramlot.subscribe(`${source.getAttr("node_id")}_closable_change`, ({ open }) => {
|
|
29132
|
+
if (source.getAttr("hidden") === true || source.getAttr("drawer") === false) return;
|
|
29133
|
+
state.setItem(property, open);
|
|
29134
|
+
set(pane, { drawer: open ? true : "close" });
|
|
29135
|
+
set(property === "navigationVisible" ? navigationToggle : codeToggle, { aria_expanded: String(open) });
|
|
29136
|
+
set(shell, { [property === "navigationVisible" ? "data_navigation_hidden" : "data_code_visible"]: String(property === "navigationVisible" ? !open : open) });
|
|
29137
|
+
savePreferences();
|
|
29138
|
+
});
|
|
29139
|
+
releases.push(() => gramlot.unsubscribe(handle2));
|
|
29140
|
+
}
|
|
29141
|
+
const border = shell.querySelector("[data-index-regions]");
|
|
29142
|
+
const handle = gramlot.subscribe(`${node(border).getAttr("node_id")}_splitter_resize`, ({ region, size }) => {
|
|
29143
|
+
set(region === "left" ? sidebar : codeSidebar, { width: size });
|
|
29144
|
+
state.setItem(region === "left" ? "preferredSidebarWidth" : "preferredCodeWidth", Number.parseFloat(size));
|
|
29145
|
+
savePreferences();
|
|
29146
|
+
});
|
|
29147
|
+
releases.push(() => gramlot.unsubscribe(handle));
|
|
29148
|
+
state.setItem("preferredSidebarWidth", preferences.sidebarWidth);
|
|
29149
|
+
state.setItem("preferredCodeWidth", preferences.codeWidth);
|
|
29150
|
+
}
|
|
29035
29151
|
listen(navigationToggle, "click", () => {
|
|
29036
29152
|
state.setItem("navigationVisible", !state.getItem("navigationVisible"));
|
|
29037
29153
|
updatePanels();
|
|
@@ -29042,11 +29158,11 @@ function mountIndexPage(renderer, root, onSelection = () => {
|
|
|
29042
29158
|
updatePanels();
|
|
29043
29159
|
savePreferences();
|
|
29044
29160
|
});
|
|
29045
|
-
if (codeHandle) {
|
|
29161
|
+
if (!containerLayout && codeHandle) {
|
|
29046
29162
|
const saved = preferences.codeWidth;
|
|
29047
|
-
const
|
|
29048
|
-
state.setItem("preferredCodeWidth",
|
|
29049
|
-
setCodeWidth(
|
|
29163
|
+
const width = typeof saved === "number" && Number.isFinite(saved) && saved >= 200 ? saved : 420;
|
|
29164
|
+
state.setItem("preferredCodeWidth", width);
|
|
29165
|
+
setCodeWidth(width);
|
|
29050
29166
|
listen(codeHandle, "keydown", (event) => {
|
|
29051
29167
|
const current = state.getItem("codeWidth");
|
|
29052
29168
|
const value = event.key === "ArrowLeft" ? current + 10 : event.key === "ArrowRight" ? current - 10 : event.key === "Home" ? 200 : event.key === "End" ? codeMaximum() : null;
|
|
@@ -29064,24 +29180,27 @@ function mountIndexPage(renderer, root, onSelection = () => {
|
|
|
29064
29180
|
});
|
|
29065
29181
|
listen(window2, "resize", () => setCodeWidth(state.getItem("preferredCodeWidth")));
|
|
29066
29182
|
}
|
|
29067
|
-
|
|
29068
|
-
|
|
29069
|
-
|
|
29070
|
-
|
|
29071
|
-
|
|
29072
|
-
|
|
29073
|
-
|
|
29074
|
-
|
|
29075
|
-
sidebarHandle,
|
|
29076
|
-
|
|
29077
|
-
|
|
29078
|
-
|
|
29079
|
-
|
|
29080
|
-
|
|
29081
|
-
|
|
29082
|
-
|
|
29083
|
-
|
|
29084
|
-
|
|
29183
|
+
if (!containerLayout) {
|
|
29184
|
+
listen(sidebarHandle, "keydown", (event) => {
|
|
29185
|
+
const current = state.getItem("sidebarWidth");
|
|
29186
|
+
const value = event.key === "ArrowLeft" ? current - 10 : event.key === "ArrowRight" ? current + 10 : event.key === "Home" ? 120 : event.key === "End" ? sidebarMaximum() : null;
|
|
29187
|
+
if (value == null) return;
|
|
29188
|
+
event.preventDefault();
|
|
29189
|
+
setSidebarWidth(value, true);
|
|
29190
|
+
});
|
|
29191
|
+
listen(sidebarHandle, "pointerdown", (event) => beginDrag(
|
|
29192
|
+
sidebarHandle,
|
|
29193
|
+
event,
|
|
29194
|
+
(x) => setSidebarWidth(Math.round(x - shell.getBoundingClientRect().left), true)
|
|
29195
|
+
));
|
|
29196
|
+
listen(sidebarHandle, "lostpointercapture", () => {
|
|
29197
|
+
if (drag?.handle === sidebarHandle) stopDrag();
|
|
29198
|
+
});
|
|
29199
|
+
listen(window2, "resize", () => setSidebarWidth(state.getItem("preferredSidebarWidth")));
|
|
29200
|
+
}
|
|
29201
|
+
const choices = createEntry ? [byId("panel-intro"), ...shell.querySelectorAll('.index-sidebar a[id^="open-"]')] : containerLayout ? byId("index-pages").children : shell.querySelectorAll(".index-tabs button");
|
|
29202
|
+
for (const tab of choices) {
|
|
29203
|
+
const key = tab.id.slice(createEntry && tab.id.startsWith("open-") ? "open-".length : containerLayout ? "panel-".length : "tab-".length);
|
|
29085
29204
|
const entry = {
|
|
29086
29205
|
key,
|
|
29087
29206
|
tab,
|
|
@@ -29090,14 +29209,14 @@ function mountIndexPage(renderer, root, onSelection = () => {
|
|
|
29090
29209
|
open: key === "intro" ? null : byId(`open-${key}`)
|
|
29091
29210
|
};
|
|
29092
29211
|
entries.set(key, entry);
|
|
29093
|
-
if (!tab.hidden) opened.setItem(key, true);
|
|
29094
|
-
if (tab.getAttribute("aria-selected") === "true") state.setItem("active", key);
|
|
29095
|
-
listen(tab, "click", () => select(key));
|
|
29212
|
+
if (entry.panel && (containerLayout ? node(entry.panel).getAttr("hidden") !== true : !tab.hidden)) opened.setItem(key, true);
|
|
29213
|
+
if (!containerLayout && tab.getAttribute("aria-selected") === "true") state.setItem("active", key);
|
|
29214
|
+
if (!containerLayout) listen(tab, "click", () => select(key));
|
|
29096
29215
|
if (entry.open) listen(entry.open, "click", (event) => {
|
|
29097
29216
|
event.preventDefault();
|
|
29098
29217
|
select(key);
|
|
29099
29218
|
});
|
|
29100
|
-
listen(tab, "keydown", (event) => {
|
|
29219
|
+
if (!containerLayout) listen(tab, "keydown", (event) => {
|
|
29101
29220
|
if (!state.getItem("keyboard") || !["ArrowLeft", "ArrowRight", "Home", "End"].includes(event.key)) return;
|
|
29102
29221
|
const keys = [...entries.keys()].filter((key2) => opened.getItem(key2));
|
|
29103
29222
|
const index = keys.indexOf(key);
|
|
@@ -29108,10 +29227,20 @@ function mountIndexPage(renderer, root, onSelection = () => {
|
|
|
29108
29227
|
});
|
|
29109
29228
|
if (key === "intro") continue;
|
|
29110
29229
|
entry.family = entry.open.closest("details");
|
|
29111
|
-
|
|
29112
|
-
|
|
29113
|
-
|
|
29114
|
-
|
|
29230
|
+
if (entry.panel) prepare(entry);
|
|
29231
|
+
}
|
|
29232
|
+
if (containerLayout) {
|
|
29233
|
+
const pages2 = byId("index-pages");
|
|
29234
|
+
listen(pages2, "click", (event) => {
|
|
29235
|
+
if (event.target === pages2 && event.composedPath().some((element) => element instanceof window2.Element && element.getAttribute("role") === "tab")) {
|
|
29236
|
+
select(state.getItem("active"));
|
|
29237
|
+
}
|
|
29238
|
+
});
|
|
29239
|
+
const subscription = `${shell.id}-selection`;
|
|
29240
|
+
state.subscribe(subscription, { any: (event) => {
|
|
29241
|
+
if (event.node === state.getNode("active")) select(state.getItem("active"));
|
|
29242
|
+
} });
|
|
29243
|
+
releases.push(() => state.unsubscribe(subscription, { any: true }));
|
|
29115
29244
|
}
|
|
29116
29245
|
listen(document, "pointermove", (event) => {
|
|
29117
29246
|
if (!drag || event.pointerId !== drag.pointerId) return;
|
|
@@ -29126,7 +29255,7 @@ function mountIndexPage(renderer, root, onSelection = () => {
|
|
|
29126
29255
|
set(keyboard, { checked: keyboard?.checked ?? false });
|
|
29127
29256
|
for (const [key, entry] of entries) {
|
|
29128
29257
|
if (entry.open) set(entry.open, { tabindex: keyboard?.checked ?? false ? 0 : -1 });
|
|
29129
|
-
set(entry.tab, { tabindex: (keyboard?.checked ?? false) && key === state.getItem("active") ? 0 : -1 });
|
|
29258
|
+
if (!containerLayout) set(entry.tab, { tabindex: (keyboard?.checked ?? false) && key === state.getItem("active") ? 0 : -1 });
|
|
29130
29259
|
}
|
|
29131
29260
|
});
|
|
29132
29261
|
listen(appearance, "change", () => {
|