@k2b/ui 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,6 +15,12 @@ import { createFieldMeta, Field, fieldControlAria } from "../internal/field";
15
15
  import { decimalSeparator, useLocale } from "../intl/locale";
16
16
  import { useUiMessages } from "../intl/messages";
17
17
  import { resolveMaybeAccessor } from "./field-contract";
18
+ function fractionDigits(value) {
19
+ if (!Number.isFinite(value)) return 0;
20
+ const [mantissa = "", exponent = "0"] = String(value).split("e");
21
+ const fraction = mantissa.split(".")[1]?.length ?? 0;
22
+ return Math.max(0, fraction - Number(exponent));
23
+ }
18
24
  export function NumberInput(props) {
19
25
  const [local, rest] = splitProps(props, ["activeIcon", "allowNegative", "aria-describedby", "aria-label", "class", "clearLabel", "clearable", "decimalPlaces", "decreaseLabel", "description", "disableSteppers", "error", "icon", "id", "increaseLabel", "label", "locale", "max", "min", "onClear", "onValueCommit", "onValueChange", "prefix", "required", "showSteppers", "step", "suffix", "value"]);
20
26
  const meta = createFieldMeta(local.id);
@@ -28,10 +34,12 @@ export function NumberInput(props) {
28
34
  // follows the effective locale; grouping is never rendered while editing.
29
35
  const display = value => value == null ? "" : String(value).replace(".", separator());
30
36
  const [raw, setRaw] = createSignal(display(value()));
31
- const places = () => Math.max(0, local.decimalPlaces ?? 0);
32
37
  const min = () => local.min ?? -Infinity;
33
38
  const max = () => local.max ?? Infinity;
34
39
  const step = () => local.step ?? 1;
40
+ // `step` and the accepted decimals never disagree: a fractional step implies
41
+ // its own precision unless the caller states `decimalPlaces` explicitly.
42
+ const places = () => Math.max(0, local.decimalPlaces ?? fractionDigits(step()));
35
43
  const filter = input => {
36
44
  let output = "";
37
45
  let decimal = false;
@@ -1 +1 @@
1
- {"version":3,"names":["createEffect","createMemo","createSignal","Show","splitProps","createFieldMeta","Field","fieldControlAria","decimalSeparator","useLocale","useUiMessages","resolveMaybeAccessor","NumberInput","props","local","rest","meta","id","focused","setFocused","value","error","contextLocale","messages","separator","locale","display","String","replace","raw","setRaw","places","Math","max","decimalPlaces","min","Infinity","step","filter","input","output","decimal","character","test","allowNegative","integer","fraction","split","slice","parse","canonical","number","Number","parseInt","isFinite","normalize","clamped","anchor","snapped","round","bounded","toFixed","emit","onValueChange","commit","changeAlreadyEmitted","next","Object","is","onValueCommit","stepBy","direction","disabled","disableSteppers","seed","_$createComponent","class","label","description","required","children","_$ssr","_tmpl$6","_$ssrAttribute","_$escape","undefined","when","showSteppers","_tmpl$","decreaseLabel","decreaseValue","icon","_tmpl$2","activeIcon","prefix","_tmpl$3","_$ssrElement","_$mergeProps","controlId","data-filled","type","role","inputmode","aria-valuemin","aria-valuemax","aria-valuenow","suffix","clearable","readOnly","_tmpl$4","clearLabel","clear","_tmpl$5","increaseLabel","increaseValue"],"sources":["inputs/NumberInput.tsx"],"sourcesContent":["import { createEffect, createMemo, createSignal, type JSX, Show, splitProps } from \"solid-js\";\nimport { createFieldMeta, Field, fieldControlAria } from \"../internal/field\";\nimport { decimalSeparator, useLocale } from \"../intl/locale\";\nimport { useUiMessages } from \"../intl/messages\";\nimport type { ValueFieldProps } from \"./field-contract\";\nimport { resolveMaybeAccessor } from \"./field-contract\";\n\nexport type NumberInputProps = Omit<\n JSX.InputHTMLAttributes<HTMLInputElement>,\n \"max\" | \"min\" | \"onChange\" | \"onInput\" | \"prefix\" | \"step\" | \"type\" | \"value\" | keyof ValueFieldProps<number | null>\n> &\n ValueFieldProps<number | null> & {\n max?: number;\n min?: number;\n step?: number;\n decimalPlaces?: number;\n allowNegative?: boolean;\n clearable?: boolean;\n onClear?: () => void;\n clearLabel?: string;\n increaseLabel?: string;\n decreaseLabel?: string;\n /** Explicit locale for the decimal separator; defaults to the inherited render locale. */\n locale?: string;\n showSteppers?: boolean;\n disableSteppers?: boolean;\n icon?: string;\n activeIcon?: string;\n prefix?: JSX.Element;\n suffix?: JSX.Element;\n };\n\nexport function NumberInput(props: NumberInputProps): JSX.Element {\n const [local, rest] = splitProps(props, [\n \"activeIcon\",\n \"allowNegative\",\n \"aria-describedby\",\n \"aria-label\",\n \"class\",\n \"clearLabel\",\n \"clearable\",\n \"decimalPlaces\",\n \"decreaseLabel\",\n \"description\",\n \"disableSteppers\",\n \"error\",\n \"icon\",\n \"id\",\n \"increaseLabel\",\n \"label\",\n \"locale\",\n \"max\",\n \"min\",\n \"onClear\",\n \"onValueCommit\",\n \"onValueChange\",\n \"prefix\",\n \"required\",\n \"showSteppers\",\n \"step\",\n \"suffix\",\n \"value\",\n ]);\n const meta = createFieldMeta(local.id);\n const [focused, setFocused] = createSignal(false);\n const value = () => resolveMaybeAccessor(local.value);\n const error = () => resolveMaybeAccessor(local.error);\n const contextLocale = useLocale();\n const messages = useUiMessages();\n const separator = createMemo(() => decimalSeparator(local.locale ?? contextLocale()));\n // The visible text keeps the canonical number, only the decimal separator\n // follows the effective locale; grouping is never rendered while editing.\n const display = (value: number | null | undefined) => (value == null ? \"\" : String(value).replace(\".\", separator()));\n const [raw, setRaw] = createSignal(display(value()));\n const places = () => Math.max(0, local.decimalPlaces ?? 0);\n const min = () => local.min ?? -Infinity;\n const max = () => local.max ?? Infinity;\n const step = () => local.step ?? 1;\n\n const filter = (input: string) => {\n let output = \"\";\n let decimal = false;\n for (const character of input) {\n if (/\\d/.test(character)) output += character;\n else if (character === \"-\" && output === \"\" && (local.allowNegative ?? true)) output += character;\n else if ((character === \".\" || character === \",\" || character === separator()) && !decimal && places() > 0) {\n output += separator();\n decimal = true;\n }\n }\n if (decimal) {\n const [integer = \"\", fraction = \"\"] = output.split(separator());\n return `${integer}${separator()}${fraction.slice(0, places())}`;\n }\n return output;\n };\n const parse = (input: string) => {\n const canonical = input.replace(separator(), \".\");\n if (!canonical || canonical === \"-\" || canonical === \".\") return null;\n const number = places() === 0 ? Number.parseInt(canonical, 10) : Number(canonical);\n return Number.isFinite(number) ? number : null;\n };\n const normalize = (value: number | null) => {\n if (value === null) return null;\n const clamped = Math.max(min(), Math.min(max(), value));\n const anchor = Number.isFinite(min()) ? min() : 0;\n const snapped = step() > 0 ? Math.round((clamped - anchor) / step()) * step() + anchor : clamped;\n const bounded = Math.max(min(), Math.min(max(), snapped));\n return places() === 0 ? Math.round(bounded) : Number(bounded.toFixed(places()));\n };\n const emit = (value: number | null) => local.onValueChange?.(value);\n const commit = (value: number | null, changeAlreadyEmitted = false) => {\n const next = normalize(value);\n setRaw(display(next));\n if (!changeAlreadyEmitted || !Object.is(next, value)) emit(next);\n local.onValueCommit?.(next);\n };\n const stepBy = (direction: number) => {\n if (rest.disabled || local.disableSteppers) return;\n const seed = value() ?? (Number.isFinite(min()) ? min() : 0);\n commit(seed + direction * step());\n };\n\n createEffect(() => {\n if (focused()) return;\n if (parse(raw()) !== value()) setRaw(display(value()));\n });\n\n return (\n <Field\n class={local.class}\n label={local.label}\n description={local.description}\n error={error()}\n meta={meta}\n required={local.required}\n disabled={rest.disabled}\n >\n <div\n class=\"k2b-input-shell k2b-number-input\"\n data-disabled={rest.disabled ? \"true\" : undefined}\n data-invalid={error() ? \"true\" : undefined}\n >\n <Show when={local.showSteppers ?? true}>\n <button\n type=\"button\"\n class=\"k2b-number-input__step\"\n aria-label={local.decreaseLabel ?? messages().decreaseValue}\n disabled={rest.disabled || local.disableSteppers || (value() !== null && value() !== undefined && value()! <= min())}\n onClick={() => stepBy(-1)}\n >\n <i class=\"ti ti-minus\" aria-hidden=\"true\" />\n </button>\n </Show>\n <div class=\"k2b-number-input__value\">\n <Show when={local.icon}>\n <span class=\"k2b-input-shell__icon k2b-text-input__icon\" aria-hidden=\"true\">\n <i class={local.icon} />\n <i class={local.activeIcon ?? local.icon} />\n </span>\n </Show>\n <Show when={local.prefix}>\n <span class=\"k2b-input-shell__affix\">{local.prefix}</span>\n </Show>\n <input\n {...rest}\n id={meta.controlId}\n class=\"k2b-input k2b-number-input__control\"\n data-filled={raw() ? \"true\" : undefined}\n type=\"text\"\n role=\"spinbutton\"\n inputmode={places() === 0 ? \"numeric\" : \"decimal\"}\n value={raw()}\n required={local.required}\n {...fieldControlAria(meta, local)}\n aria-valuemin={Number.isFinite(min()) ? min() : undefined}\n aria-valuemax={Number.isFinite(max()) ? max() : undefined}\n aria-valuenow={(focused() ? parse(raw()) : value()) ?? undefined}\n onFocus={() => setFocused(true)}\n onInput={(event) => {\n const input = event.currentTarget;\n const current = input.value;\n const selectionStart = input.selectionStart;\n const selectionEnd = input.selectionEnd;\n const next = filter(current);\n // Only write back when the filter actually dropped something —\n // re-assigning an unchanged value moves the caret to the end.\n if (current !== next) {\n input.value = next;\n if (selectionStart !== null && selectionEnd !== null) {\n input.setSelectionRange(filter(current.slice(0, selectionStart)).length, filter(current.slice(0, selectionEnd)).length);\n }\n }\n setRaw(next);\n emit(parse(next));\n }}\n onBlur={() => {\n commit(parse(raw()), true);\n setFocused(false);\n }}\n />\n <Show when={local.suffix}>\n <span class=\"k2b-input-shell__affix\">{local.suffix}</span>\n </Show>\n <Show when={local.clearable && raw() && !rest.disabled && !rest.readOnly}>\n <button\n type=\"button\"\n class=\"k2b-input-shell__clear k2b-input-clear-action\"\n aria-label={local.clearLabel ?? messages().clear}\n onClick={() => (local.onClear ? local.onClear() : commit(null))}\n >\n <i class=\"ti ti-x\" aria-hidden=\"true\" />\n </button>\n </Show>\n </div>\n <Show when={local.showSteppers ?? true}>\n <button\n type=\"button\"\n class=\"k2b-number-input__step\"\n aria-label={local.increaseLabel ?? messages().increaseValue}\n disabled={rest.disabled || local.disableSteppers || (value() !== null && value() !== undefined && value()! >= max())}\n onClick={() => stepBy(1)}\n >\n <i class=\"ti ti-plus\" aria-hidden=\"true\" />\n </button>\n </Show>\n </div>\n </Field>\n );\n}\n\nexport default NumberInput;\n"],"mappings":";;;;;;;;;;;;AAAA,SAASA,YAAY,EAAEC,UAAU,EAAEC,YAAY,EAAYC,IAAI,EAAEC,UAAU,QAAQ,UAAU;AAC7F,SAASC,eAAe,EAAEC,KAAK,EAAEC,gBAAgB,QAAQ,mBAAmB;AAC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SAAS,IAAIjE,KAAK,CAAC,CAAC,IAAKa,GAAG,CAAC,CAAE;QAAA;MAAA;IAAA;EAAA;AAShI;AAEA,eAAerB,WAAW","ignoreList":[]}
1
+ {"version":3,"names":["createEffect","createMemo","createSignal","Show","splitProps","createFieldMeta","Field","fieldControlAria","decimalSeparator","useLocale","useUiMessages","resolveMaybeAccessor","fractionDigits","value","Number","isFinite","mantissa","exponent","String","split","fraction","length","Math","max","NumberInput","props","local","rest","meta","id","focused","setFocused","error","contextLocale","messages","separator","locale","display","replace","raw","setRaw","min","Infinity","step","places","decimalPlaces","filter","input","output","decimal","character","test","allowNegative","integer","slice","parse","canonical","number","parseInt","normalize","clamped","anchor","snapped","round","bounded","toFixed","emit","onValueChange","commit","changeAlreadyEmitted","next","Object","is","onValueCommit","stepBy","direction","disabled","disableSteppers","seed","_$createComponent","class","label","description","required","children","_$ssr","_tmpl$6","_$ssrAttribute","_$escape","undefined","when","showSteppers","_tmpl$","decreaseLabel","decreaseValue","icon","_tmpl$2","activeIcon","prefix","_tmpl$3","_$ssrElement","_$mergeProps","controlId","data-filled","type","role","inputmode","aria-valuemin","aria-valuemax","aria-valuenow","suffix","clearable","readOnly","_tmpl$4","clearLabel","clear","_tmpl$5","increaseLabel","increaseValue"],"sources":["inputs/NumberInput.tsx"],"sourcesContent":["import { createEffect, createMemo, createSignal, type JSX, Show, splitProps } from \"solid-js\";\nimport { createFieldMeta, Field, fieldControlAria } from \"../internal/field\";\nimport { decimalSeparator, useLocale } from \"../intl/locale\";\nimport { useUiMessages } from \"../intl/messages\";\nimport type { ValueFieldProps } from \"./field-contract\";\nimport { resolveMaybeAccessor } from \"./field-contract\";\n\nexport type NumberInputProps = Omit<\n JSX.InputHTMLAttributes<HTMLInputElement>,\n \"max\" | \"min\" | \"onChange\" | \"onInput\" | \"prefix\" | \"step\" | \"type\" | \"value\" | keyof ValueFieldProps<number | null>\n> &\n ValueFieldProps<number | null> & {\n max?: number;\n min?: number;\n /** Stepper increment and commit grid; defaults to `1`. A fractional step also sets the default `decimalPlaces`. */\n step?: number;\n /** Accepted fraction digits. Defaults to the fraction digits of `step` (`0.01` → `2`, `1` → `0`); an explicit value wins. */\n decimalPlaces?: number;\n allowNegative?: boolean;\n clearable?: boolean;\n onClear?: () => void;\n clearLabel?: string;\n increaseLabel?: string;\n decreaseLabel?: string;\n /** Explicit locale for the decimal separator; defaults to the inherited render locale. */\n locale?: string;\n showSteppers?: boolean;\n disableSteppers?: boolean;\n icon?: string;\n activeIcon?: string;\n prefix?: JSX.Element;\n suffix?: JSX.Element;\n };\n\nfunction fractionDigits(value: number): number {\n if (!Number.isFinite(value)) return 0;\n const [mantissa = \"\", exponent = \"0\"] = String(value).split(\"e\");\n const fraction = mantissa.split(\".\")[1]?.length ?? 0;\n return Math.max(0, fraction - Number(exponent));\n}\n\nexport function NumberInput(props: NumberInputProps): JSX.Element {\n const [local, rest] = splitProps(props, [\n \"activeIcon\",\n \"allowNegative\",\n \"aria-describedby\",\n \"aria-label\",\n \"class\",\n \"clearLabel\",\n \"clearable\",\n \"decimalPlaces\",\n \"decreaseLabel\",\n \"description\",\n \"disableSteppers\",\n \"error\",\n \"icon\",\n \"id\",\n \"increaseLabel\",\n \"label\",\n \"locale\",\n \"max\",\n \"min\",\n \"onClear\",\n \"onValueCommit\",\n \"onValueChange\",\n \"prefix\",\n \"required\",\n \"showSteppers\",\n \"step\",\n \"suffix\",\n \"value\",\n ]);\n const meta = createFieldMeta(local.id);\n const [focused, setFocused] = createSignal(false);\n const value = () => resolveMaybeAccessor(local.value);\n const error = () => resolveMaybeAccessor(local.error);\n const contextLocale = useLocale();\n const messages = useUiMessages();\n const separator = createMemo(() => decimalSeparator(local.locale ?? contextLocale()));\n // The visible text keeps the canonical number, only the decimal separator\n // follows the effective locale; grouping is never rendered while editing.\n const display = (value: number | null | undefined) => (value == null ? \"\" : String(value).replace(\".\", separator()));\n const [raw, setRaw] = createSignal(display(value()));\n const min = () => local.min ?? -Infinity;\n const max = () => local.max ?? Infinity;\n const step = () => local.step ?? 1;\n // `step` and the accepted decimals never disagree: a fractional step implies\n // its own precision unless the caller states `decimalPlaces` explicitly.\n const places = () => Math.max(0, local.decimalPlaces ?? fractionDigits(step()));\n\n const filter = (input: string) => {\n let output = \"\";\n let decimal = false;\n for (const character of input) {\n if (/\\d/.test(character)) output += character;\n else if (character === \"-\" && output === \"\" && (local.allowNegative ?? true)) output += character;\n else if ((character === \".\" || character === \",\" || character === separator()) && !decimal && places() > 0) {\n output += separator();\n decimal = true;\n }\n }\n if (decimal) {\n const [integer = \"\", fraction = \"\"] = output.split(separator());\n return `${integer}${separator()}${fraction.slice(0, places())}`;\n }\n return output;\n };\n const parse = (input: string) => {\n const canonical = input.replace(separator(), \".\");\n if (!canonical || canonical === \"-\" || canonical === \".\") return null;\n const number = places() === 0 ? Number.parseInt(canonical, 10) : Number(canonical);\n return Number.isFinite(number) ? number : null;\n };\n const normalize = (value: number | null) => {\n if (value === null) return null;\n const clamped = Math.max(min(), Math.min(max(), value));\n const anchor = Number.isFinite(min()) ? min() : 0;\n const snapped = step() > 0 ? Math.round((clamped - anchor) / step()) * step() + anchor : clamped;\n const bounded = Math.max(min(), Math.min(max(), snapped));\n return places() === 0 ? Math.round(bounded) : Number(bounded.toFixed(places()));\n };\n const emit = (value: number | null) => local.onValueChange?.(value);\n const commit = (value: number | null, changeAlreadyEmitted = false) => {\n const next = normalize(value);\n setRaw(display(next));\n if (!changeAlreadyEmitted || !Object.is(next, value)) emit(next);\n local.onValueCommit?.(next);\n };\n const stepBy = (direction: number) => {\n if (rest.disabled || local.disableSteppers) return;\n const seed = value() ?? (Number.isFinite(min()) ? min() : 0);\n commit(seed + direction * step());\n };\n\n createEffect(() => {\n if (focused()) return;\n if (parse(raw()) !== value()) setRaw(display(value()));\n });\n\n return (\n <Field\n class={local.class}\n label={local.label}\n description={local.description}\n error={error()}\n meta={meta}\n required={local.required}\n disabled={rest.disabled}\n >\n <div\n class=\"k2b-input-shell k2b-number-input\"\n data-disabled={rest.disabled ? \"true\" : undefined}\n data-invalid={error() ? \"true\" : undefined}\n >\n <Show when={local.showSteppers ?? true}>\n <button\n type=\"button\"\n class=\"k2b-number-input__step\"\n aria-label={local.decreaseLabel ?? messages().decreaseValue}\n disabled={rest.disabled || local.disableSteppers || (value() !== null && value() !== undefined && value()! <= min())}\n onClick={() => stepBy(-1)}\n >\n <i class=\"ti ti-minus\" aria-hidden=\"true\" />\n </button>\n </Show>\n <div class=\"k2b-number-input__value\">\n <Show when={local.icon}>\n <span class=\"k2b-input-shell__icon k2b-text-input__icon\" aria-hidden=\"true\">\n <i class={local.icon} />\n <i class={local.activeIcon ?? local.icon} />\n </span>\n </Show>\n <Show when={local.prefix}>\n <span class=\"k2b-input-shell__affix\">{local.prefix}</span>\n </Show>\n <input\n {...rest}\n id={meta.controlId}\n class=\"k2b-input k2b-number-input__control\"\n data-filled={raw() ? \"true\" : undefined}\n type=\"text\"\n role=\"spinbutton\"\n inputmode={places() === 0 ? \"numeric\" : \"decimal\"}\n value={raw()}\n required={local.required}\n {...fieldControlAria(meta, local)}\n aria-valuemin={Number.isFinite(min()) ? min() : undefined}\n aria-valuemax={Number.isFinite(max()) ? max() : undefined}\n aria-valuenow={(focused() ? parse(raw()) : value()) ?? undefined}\n onFocus={() => setFocused(true)}\n onInput={(event) => {\n const input = event.currentTarget;\n const current = input.value;\n const selectionStart = input.selectionStart;\n const selectionEnd = input.selectionEnd;\n const next = filter(current);\n // Only write back when the filter actually dropped something —\n // re-assigning an unchanged value moves the caret to the end.\n if (current !== next) {\n input.value = next;\n if (selectionStart !== null && selectionEnd !== null) {\n input.setSelectionRange(filter(current.slice(0, selectionStart)).length, filter(current.slice(0, selectionEnd)).length);\n }\n }\n setRaw(next);\n emit(parse(next));\n }}\n onBlur={() => {\n commit(parse(raw()), true);\n setFocused(false);\n }}\n />\n <Show when={local.suffix}>\n <span class=\"k2b-input-shell__affix\">{local.suffix}</span>\n </Show>\n <Show when={local.clearable && raw() && !rest.disabled && !rest.readOnly}>\n <button\n type=\"button\"\n class=\"k2b-input-shell__clear k2b-input-clear-action\"\n aria-label={local.clearLabel ?? messages().clear}\n onClick={() => (local.onClear ? local.onClear() : commit(null))}\n >\n <i class=\"ti ti-x\" aria-hidden=\"true\" />\n </button>\n </Show>\n </div>\n <Show when={local.showSteppers ?? true}>\n <button\n type=\"button\"\n class=\"k2b-number-input__step\"\n aria-label={local.increaseLabel ?? messages().increaseValue}\n disabled={rest.disabled || local.disableSteppers || (value() !== null && value() !== undefined && value()! >= max())}\n onClick={() => stepBy(1)}\n >\n <i class=\"ti ti-plus\" aria-hidden=\"true\" />\n </button>\n </Show>\n </div>\n </Field>\n );\n}\n\nexport default NumberInput;\n"],"mappings":";;;;;;;;;;;;AAAA,SAASA,YAAY,EAAEC,UAAU,EAAEC,YAAY,EAAYC,IAAI,EAAEC,UAAU,QAAQ,UAAU;AAC7F,SAASC,eAAe,EAAEC,KAAK,EAAEC,gBAAgB,QAAQ,mBAAmB;AAC5E,SAASC,gBAAgB,EAAEC,SAAS,QAAQ,gBAAgB;AAC5D,SAASC,aAAa,QAAQ,kBAAkB;AAEhD,SAASC,oBAAoB,QAAQ,kBAAkB;AA6BvD,SAASC,cAAcA,CAACC,KAAa,EAAU;EAC7C,IAAI,CAACC,MAAM,CAACC,QAAQ,CAACF,KAAK,CAAC,EAAE,OAAO,CAAC;EACrC,MAAM,CAACG,QAAQ,GAAG,EAAE,EAAEC,QAAQ,GAAG,GAAG,CAAC,GAAGC,MAAM,CAACL,KAAK,CAAC,CAACM,KAAK,CAAC,GAAG,CAAC;EAChE,MAAMC,QAAQ,GAAGJ,QAAQ,CAACG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAEE,MAAM,IAAI,CAAC;EACpD,OAAOC,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEH,QAAQ,GAAGN,MAAM,CAACG,QAAQ,CAAC,CAAC;AACjD;AAEA,OAAO,SAASO,WAAWA,CAACC,KAAu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AAA;AAShI;AAEA,eAAeC,WAAW","ignoreList":[]}
@@ -11,34 +11,35 @@ var _tmpl$ = ["<button type=\"button\" class=\"k2b-app-workspace__resize\" role=
11
11
  _tmpl$3 = ["<section", " class=\"", "\"", " style=\"", "\">", "</section>"],
12
12
  _tmpl$4 = ["<aside", " class=\"", "\"", "", " style=\"", "\">", "</aside>"],
13
13
  _tmpl$5 = ["<aside", " class=\"", "\"", "><div class=\"k2b-app-workspace__sidebar-desktop\">", "</div></aside>"],
14
- _tmpl$6 = ["<span aria-hidden=\"true\"><i", "></i></span>"],
15
- _tmpl$7 = ["<span class=\"k2b-app-workspace__sidebar-section-count\">", "</span>"],
16
- _tmpl$8 = ["<button type=\"button\" class=\"k2b-app-workspace__sidebar-section-toggle\"", ">", "<i", " aria-hidden=\"true\"></i></button>"],
17
- _tmpl$9 = ["<div class=\"k2b-app-workspace__sidebar-section-actions\">", "</div>"],
18
- _tmpl$0 = ["<header class=\"k2b-app-workspace__sidebar-section-header\">", "", "</header>"],
19
- _tmpl$1 = ["<div", "", " class=\"k2b-app-workspace__sidebar-section-content\">", "</div>"],
20
- _tmpl$10 = ["<h2>", "</h2>"],
21
- _tmpl$11 = ["<div class=\"k2b-app-workspace__sidebar-item-actions\"", ">", "</div>"],
22
- _tmpl$12 = ["<span class=\"k2b-app-workspace__sidebar-item-icon\" aria-hidden=\"true\">", "</span>"],
23
- _tmpl$13 = ["<span class=\"k2b-app-workspace__sidebar-item-context-meta\">", "</span>"],
24
- _tmpl$14 = ["<span class=\"k2b-app-workspace__sidebar-item-context\"><span class=\"k2b-app-workspace__sidebar-item-context-label\">", "</span>", "</span>"],
25
- _tmpl$15 = ["<span class=\"k2b-app-workspace__sidebar-item-description\">", "</span>"],
26
- _tmpl$16 = ["<span class=\"k2b-app-workspace__sidebar-item-copy\">", "<span class=\"k2b-app-workspace__sidebar-item-label\"", "><span class=\"k2b-app-workspace__sidebar-item-label-text\">", "</span></span>", "</span>"],
27
- _tmpl$17 = ["<i", "></i>"],
28
- _tmpl$18 = ["<span class=\"k2b-app-workspace__sidebar-item-meta\"", ">", "</span>"],
29
- _tmpl$19 = ["<a", " class=\"k2b-app-workspace__sidebar-item-action\"", ">", "</a>"],
30
- _tmpl$20 = ["<button type=\"button\" class=\"k2b-app-workspace__sidebar-item-action\"", ">", "</button>"],
31
- _tmpl$21 = ["<span class=\"k2b-app-workspace__sidebar-item-icon\"", " aria-hidden=\"true\"><i", "></i></span>"],
32
- _tmpl$22 = ["<span class=\"k2b-app-workspace__sidebar-item-label\"><span class=\"k2b-app-workspace__sidebar-item-label-text\">", "</span></span>"],
33
- _tmpl$23 = ["<span class=\"", "\"", ">", "</span>"],
34
- _tmpl$24 = ["<span class=\"k2b-app-workspace__nav-tree-toggle\" data-k2b-nav-tree-toggle aria-hidden=\"true\"><i class=\"", "\"></i></span>"],
35
- _tmpl$25 = ["<div class=\"k2b-app-workspace__nav-tree-group\" role=\"group\">", "</div>"],
36
- _tmpl$26 = ["<div class=\"k2b-app-workspace__nav-tree-node\" role=\"treeitem\"", ">", "", "</div>"],
37
- _tmpl$27 = ["<div class=\"", "\" role=\"tree\"", ">", "</div>"],
38
- _tmpl$28 = ["<div class=\"k2b-app-workspace__sidebar-icon-grid\"", ">", "</div>"],
39
- _tmpl$29 = ["<i", " aria-hidden=\"true\"></i>"],
40
- _tmpl$30 = ["<div class=\"", "\" data-k2b-app-workspace", " style=\"", "\">", "</div>"],
41
- _tmpl$31 = ["<div class=\"", "\">", "</div>"];
14
+ _tmpl$6 = ["<script>", "</script>"],
15
+ _tmpl$7 = ["<span aria-hidden=\"true\"><i", "></i></span>"],
16
+ _tmpl$8 = ["<span class=\"k2b-app-workspace__sidebar-section-count\">", "</span>"],
17
+ _tmpl$9 = ["<button type=\"button\" class=\"k2b-app-workspace__sidebar-section-toggle\"", ">", "<i", " aria-hidden=\"true\"></i></button>"],
18
+ _tmpl$0 = ["<div class=\"k2b-app-workspace__sidebar-section-actions\">", "</div>"],
19
+ _tmpl$1 = ["<header class=\"k2b-app-workspace__sidebar-section-header\">", "", "</header>"],
20
+ _tmpl$10 = ["<div", "", " class=\"k2b-app-workspace__sidebar-section-content\">", "</div>"],
21
+ _tmpl$11 = ["<h2>", "</h2>"],
22
+ _tmpl$12 = ["<div class=\"k2b-app-workspace__sidebar-item-actions\"", ">", "</div>"],
23
+ _tmpl$13 = ["<span class=\"k2b-app-workspace__sidebar-item-icon\" aria-hidden=\"true\">", "</span>"],
24
+ _tmpl$14 = ["<span class=\"k2b-app-workspace__sidebar-item-context-meta\">", "</span>"],
25
+ _tmpl$15 = ["<span class=\"k2b-app-workspace__sidebar-item-context\"><span class=\"k2b-app-workspace__sidebar-item-context-label\">", "</span>", "</span>"],
26
+ _tmpl$16 = ["<span class=\"k2b-app-workspace__sidebar-item-description\">", "</span>"],
27
+ _tmpl$17 = ["<span class=\"k2b-app-workspace__sidebar-item-copy\">", "<span class=\"k2b-app-workspace__sidebar-item-label\"", "><span class=\"k2b-app-workspace__sidebar-item-label-text\">", "</span></span>", "</span>"],
28
+ _tmpl$18 = ["<i", "></i>"],
29
+ _tmpl$19 = ["<span class=\"k2b-app-workspace__sidebar-item-meta\"", ">", "</span>"],
30
+ _tmpl$20 = ["<a", " class=\"k2b-app-workspace__sidebar-item-action\"", ">", "</a>"],
31
+ _tmpl$21 = ["<button type=\"button\" class=\"k2b-app-workspace__sidebar-item-action\"", ">", "</button>"],
32
+ _tmpl$22 = ["<span class=\"k2b-app-workspace__sidebar-item-icon\"", " aria-hidden=\"true\"><i", "></i></span>"],
33
+ _tmpl$23 = ["<span class=\"k2b-app-workspace__sidebar-item-label\"><span class=\"k2b-app-workspace__sidebar-item-label-text\">", "</span></span>"],
34
+ _tmpl$24 = ["<span class=\"", "\"", ">", "</span>"],
35
+ _tmpl$25 = ["<span class=\"k2b-app-workspace__nav-tree-toggle\" data-k2b-nav-tree-toggle aria-hidden=\"true\"><i class=\"", "\"></i></span>"],
36
+ _tmpl$26 = ["<div class=\"k2b-app-workspace__nav-tree-group\" role=\"group\">", "</div>"],
37
+ _tmpl$27 = ["<div class=\"k2b-app-workspace__nav-tree-node\" role=\"treeitem\"", ">", "", "</div>"],
38
+ _tmpl$28 = ["<div class=\"", "\" role=\"tree\"", ">", "</div>"],
39
+ _tmpl$29 = ["<div class=\"k2b-app-workspace__sidebar-icon-grid\"", ">", "</div>"],
40
+ _tmpl$30 = ["<i", " aria-hidden=\"true\"></i>"],
41
+ _tmpl$31 = ["<div class=\"", "\" data-k2b-app-workspace", " style=\"", "\">", "</div>"],
42
+ _tmpl$32 = ["<div class=\"", "\">", "</div>"];
42
43
  import { Link } from "@k2b/ssr/nav";
43
44
  import { children, createContext, createMemo, createSignal, createUniqueId, For, mergeProps, onCleanup, onMount, Show, useContext } from "solid-js";
44
45
  import { useUiMessages } from "../intl/messages";
@@ -364,17 +365,28 @@ const AppWorkspaceSidebarDesktop = props => ({
364
365
  kind: SIDEBAR_DESKTOP,
365
366
  children: props.children
366
367
  });
368
+ // Document navigations rebuild the sidebar from the server, so this inline
369
+ // script restores its offset while the document is still parsing: before the
370
+ // first paint, before a view transition can snapshot it, and before any island
371
+ // hydrates. Islands load asynchronously and server-only sidebars never mount,
372
+ // so `onMount` would be too late or never run. The memory is one
373
+ // `sessionStorage` entry per path segment and sidebar position and ends with
374
+ // the tab. A stored offset is applied first; the current item is then kept in
375
+ // view, which is a no-op when the offset already shows it. The frame callback
376
+ // repeats the restore once the whole document is parsed, because content that
377
+ // follows the sidebar can still change its height before the first paint.
378
+ const SIDEBAR_SCROLL_MEMORY_SCRIPT = ["(function(){", "var body=document.currentScript&&document.currentScript.previousElementSibling;if(!body)return;", "var storage;try{storage=window.sessionStorage}catch(_){return}", 'var key="k2b-sidebar-scroll:"+location.pathname.split("/")[1]+":"+document.querySelectorAll(".k2b-app-workspace__sidebar-body").length;', "var restore=function(){", "var stored=storage.getItem(key);if(stored!==null)body.scrollTop=Number(stored);", 'var current=body.querySelector(\'[aria-current="page"]\');if(current)current.scrollIntoView({block:"nearest"});', "};", "restore();requestAnimationFrame(restore);", "var frame=0;", 'body.addEventListener("scroll",function(){if(frame)return;frame=requestAnimationFrame(function(){frame=0;try{storage.setItem(key,String(body.scrollTop))}catch(_){}})},{passive:true});', "})();"].join("");
367
379
  const AppWorkspaceSidebarBody = props => {
368
380
  let body;
369
381
  createScrollFade(() => body, () => props.scrollFade !== false);
370
- return _$ssrElement("div", _$mergeProps({
382
+ return [_$ssrElement("div", _$mergeProps({
371
383
  get ["class"]() {
372
384
  return `k2b-app-workspace__sidebar-body ${props.class ?? ""}`;
373
385
  },
374
386
  get ["data-scroll-fade-mode"]() {
375
387
  return props.scrollFade !== false ? "both" : undefined;
376
388
  }
377
- }, () => scrollAttrs(props.scrollPreserveKey), () => modeAttrs(props.sidebarMode)), _$escape(props.children), false);
389
+ }, () => scrollAttrs(props.scrollPreserveKey), () => modeAttrs(props.sidebarMode)), _$escape(props.children), false), _$ssr(_tmpl$6, SIDEBAR_SCROLL_MEMORY_SCRIPT)];
378
390
  };
379
391
  const AppWorkspaceSidebarFooter = props => _$ssrElement("footer", _$mergeProps({
380
392
  get ["class"]() {
@@ -390,14 +402,14 @@ const AppWorkspaceSidebarSection = props => {
390
402
  return props.icon;
391
403
  },
392
404
  get children() {
393
- return _$ssr(_tmpl$6, _$ssrAttribute("class", _$escape(iconClass(props.icon), true), false));
405
+ return _$ssr(_tmpl$7, _$ssrAttribute("class", _$escape(iconClass(props.icon), true), false));
394
406
  }
395
407
  }), props.title, _$createComponent(Show, {
396
408
  get when() {
397
409
  return props.count !== undefined;
398
410
  },
399
411
  get children() {
400
- return _$ssr(_tmpl$7, _$escape(props.count));
412
+ return _$ssr(_tmpl$8, _$escape(props.count));
401
413
  }
402
414
  })];
403
415
  return _$ssrElement("section", _$mergeProps({
@@ -412,7 +424,7 @@ const AppWorkspaceSidebarSection = props => {
412
424
  return props.title || props.actions;
413
425
  },
414
426
  get children() {
415
- return _$ssr(_tmpl$0, _$escape(_$createComponent(Show, {
427
+ return _$ssr(_tmpl$1, _$escape(_$createComponent(Show, {
416
428
  get when() {
417
429
  return props.collapsible;
418
430
  },
@@ -422,23 +434,23 @@ const AppWorkspaceSidebarSection = props => {
422
434
  return props.title;
423
435
  },
424
436
  get children() {
425
- return _$ssr(_tmpl$10, _$escape(title()));
437
+ return _$ssr(_tmpl$11, _$escape(title()));
426
438
  }
427
439
  });
428
440
  },
429
441
  get children() {
430
- return _$ssr(_tmpl$8, _$ssrAttribute("aria-expanded", _$escape(open(), true), false) + _$ssrAttribute("aria-controls", _$escape(id, true), false), _$escape(title()), _$ssrAttribute("class", open() ? "ti ti-chevron-down" : "ti ti-chevron-right", false));
442
+ return _$ssr(_tmpl$9, _$ssrAttribute("aria-expanded", _$escape(open(), true), false) + _$ssrAttribute("aria-controls", _$escape(id, true), false), _$escape(title()), _$ssrAttribute("class", open() ? "ti ti-chevron-down" : "ti ti-chevron-right", false));
431
443
  }
432
444
  })), _$escape(_$createComponent(Show, {
433
445
  get when() {
434
446
  return props.actions;
435
447
  },
436
448
  get children() {
437
- return _$ssr(_tmpl$9, _$escape(props.actions));
449
+ return _$ssr(_tmpl$0, _$escape(props.actions));
438
450
  }
439
451
  })));
440
452
  }
441
- })), _$ssr(_tmpl$1, _$ssrAttribute("id", _$escape(id, true), false), _$ssrAttribute("hidden", !open(), true), _$escape(props.children))], false);
453
+ })), _$ssr(_tmpl$10, _$ssrAttribute("id", _$escape(id, true), false), _$ssrAttribute("hidden", !open(), true), _$escape(props.children))], false);
442
454
  };
443
455
  const AppWorkspaceSidebarItemIcon = props => mergeProps({
444
456
  kind: SIDEBAR_ITEM_ICON
@@ -452,7 +464,7 @@ const AppWorkspaceSidebarItemMeta = props => mergeProps({
452
464
  const AppWorkspaceSidebarItemAction = props => mergeProps({
453
465
  kind: SIDEBAR_ITEM_ACTION
454
466
  }, props);
455
- const AppWorkspaceSidebarItemActions = props => _$ssr(_tmpl$11, _$ssrAttribute("data-visibility", props.visibility === "hover" ? "hover" : _$escape(undefined, true), false), _$escape(props.children));
467
+ const AppWorkspaceSidebarItemActions = props => _$ssr(_tmpl$12, _$ssrAttribute("data-visibility", props.visibility === "hover" ? "hover" : _$escape(undefined, true), false), _$escape(props.children));
456
468
  /** Shared visual and semantic row frame for flat sidebar items and tree items. */
457
469
  function AppWorkspaceSidebarRow(props) {
458
470
  const className = () => `k2b-app-workspace__sidebar-item ${props.hasActions ? "has-action" : ""} ${props.active ? props.activeClass ?? "is-active" : ""} ${props.class ?? ""}`;
@@ -584,19 +596,19 @@ function AppWorkspaceSidebarItem(props) {
584
596
  return iconContent() || icon();
585
597
  },
586
598
  get children() {
587
- return _$ssr(_tmpl$12, _$escape(iconContent() ?? _$ssr(_tmpl$17, _$ssrAttribute("class", _$escape(iconClass(icon()), true), false))));
599
+ return _$ssr(_tmpl$13, _$escape(iconContent() ?? _$ssr(_tmpl$18, _$ssrAttribute("class", _$escape(iconClass(icon()), true), false))));
588
600
  }
589
- }), _$ssr(_tmpl$16, _$escape(_$createComponent(Show, {
601
+ }), _$ssr(_tmpl$17, _$escape(_$createComponent(Show, {
590
602
  get when() {
591
603
  return props.context || props.contextMeta;
592
604
  },
593
605
  get children() {
594
- return _$ssr(_tmpl$14, _$escape(props.context), _$escape(_$createComponent(Show, {
606
+ return _$ssr(_tmpl$15, _$escape(props.context), _$escape(_$createComponent(Show, {
595
607
  get when() {
596
608
  return props.contextMeta;
597
609
  },
598
610
  get children() {
599
- return _$ssr(_tmpl$13, _$escape(props.contextMeta));
611
+ return _$ssr(_tmpl$14, _$escape(props.contextMeta));
600
612
  }
601
613
  })));
602
614
  }
@@ -605,13 +617,13 @@ function AppWorkspaceSidebarItem(props) {
605
617
  return props.description;
606
618
  },
607
619
  get children() {
608
- return _$ssr(_tmpl$15, _$escape(props.description));
620
+ return _$ssr(_tmpl$16, _$escape(props.description));
609
621
  }
610
622
  }))), _$createComponent(Show, {
611
623
  get when() {
612
624
  return meta();
613
625
  },
614
- children: value => _$ssr(_tmpl$18, _$ssrAttribute("data-visibility", metaVisibility() === "hover" ? "hover" : _$escape(undefined, true), false), _$escape(value()))
626
+ children: value => _$ssr(_tmpl$19, _$ssrAttribute("data-visibility", metaVisibility() === "hover" ? "hover" : _$escape(undefined, true), false), _$escape(value()))
615
627
  })];
616
628
  const singleAction = () => {
617
629
  const label = () => actionSlot()?.label ?? props.actionLabel ?? messages().rowAction;
@@ -625,7 +637,7 @@ function AppWorkspaceSidebarItem(props) {
625
637
  actionSlot()?.onSelect?.(event);
626
638
  props.onActionClick?.(event);
627
639
  };
628
- const content = () => actionSlot()?.children ?? _$ssr(_tmpl$17, _$ssrAttribute("class", _$escape(iconClass(actionSlot()?.icon ?? props.actionIcon, "ti-dots"), true), false));
640
+ const content = () => actionSlot()?.children ?? _$ssr(_tmpl$18, _$ssrAttribute("class", _$escape(iconClass(actionSlot()?.icon ?? props.actionIcon, "ti-dots"), true), false));
629
641
  return _$createComponent(Show, {
630
642
  get when() {
631
643
  return Boolean(actionSlot() || props.actionIcon);
@@ -636,10 +648,10 @@ function AppWorkspaceSidebarItem(props) {
636
648
  return actionSlot()?.href && !actionSlot()?.disabled;
637
649
  },
638
650
  get fallback() {
639
- return _$ssr(_tmpl$20, _$ssrAttribute("disabled", actionSlot()?.disabled, true) + _$ssrAttribute("data-visibility", actionSlot()?.visibility === "hover" ? "hover" : _$escape(undefined, true), false) + _$ssrAttribute("aria-label", _$escape(label(), true), false), _$escape(content()));
651
+ return _$ssr(_tmpl$21, _$ssrAttribute("disabled", actionSlot()?.disabled, true) + _$ssrAttribute("data-visibility", actionSlot()?.visibility === "hover" ? "hover" : _$escape(undefined, true), false) + _$ssrAttribute("aria-label", _$escape(label(), true), false), _$escape(content()));
640
652
  },
641
653
  get children() {
642
- return _$ssr(_tmpl$19, _$ssrAttribute("href", _$escape(actionSlot()?.href, true), false), _$ssrAttribute("data-visibility", actionSlot()?.visibility === "hover" ? "hover" : _$escape(undefined, true), false) + _$ssrAttribute("aria-label", _$escape(label(), true), false), _$escape(content()));
654
+ return _$ssr(_tmpl$20, _$ssrAttribute("href", _$escape(actionSlot()?.href, true), false), _$ssrAttribute("data-visibility", actionSlot()?.visibility === "hover" ? "hover" : _$escape(undefined, true), false) + _$ssrAttribute("aria-label", _$escape(label(), true), false), _$escape(content()));
643
655
  }
644
656
  });
645
657
  }
@@ -875,21 +887,21 @@ const AppWorkspaceNavTree = props => {
875
887
  return rowIcon();
876
888
  },
877
889
  get children() {
878
- return _$ssr(_tmpl$21, _$ssrAttribute("data-k2b-nav-tree-toggle", usesIconDisclosure() ? "" : _$escape(undefined, true), false), _$ssrAttribute("class", _$escape(iconClass(rowIcon()), true), false));
890
+ return _$ssr(_tmpl$22, _$ssrAttribute("data-k2b-nav-tree-toggle", usesIconDisclosure() ? "" : _$escape(undefined, true), false), _$ssrAttribute("class", _$escape(iconClass(rowIcon()), true), false));
879
891
  }
880
- }), _$ssr(_tmpl$22, _$escape(item.label)), _$createComponent(Show, {
892
+ }), _$ssr(_tmpl$23, _$escape(item.label)), _$createComponent(Show, {
881
893
  get when() {
882
894
  return item.meta !== undefined;
883
895
  },
884
896
  get children() {
885
- return _$ssr(_tmpl$23, `k2b-app-workspace__sidebar-item-meta ${hasChildren() ? "" : "k2b-app-workspace__nav-tree-leaf-meta"}`, _$ssrAttribute("data-visibility", item.metaVisibility === "hover" ? "hover" : _$escape(undefined, true), false), _$escape(item.meta));
897
+ return _$ssr(_tmpl$24, `k2b-app-workspace__sidebar-item-meta ${hasChildren() ? "" : "k2b-app-workspace__nav-tree-leaf-meta"}`, _$ssrAttribute("data-visibility", item.metaVisibility === "hover" ? "hover" : _$escape(undefined, true), false), _$escape(item.meta));
886
898
  }
887
899
  }), _$createComponent(Show, {
888
900
  get when() {
889
901
  return hasChildren() && !usesIconDisclosure();
890
902
  },
891
903
  get children() {
892
- return _$ssr(_tmpl$24, `ti ${isExpanded(item.id) ? "ti-chevron-down" : "ti-chevron-right"}`);
904
+ return _$ssr(_tmpl$25, `ti ${isExpanded(item.id) ? "ti-chevron-down" : "ti-chevron-right"}`);
893
905
  }
894
906
  })];
895
907
  const row = () => _$createComponent(AppWorkspaceSidebarRow, {
@@ -944,17 +956,17 @@ const AppWorkspaceNavTree = props => {
944
956
  },
945
957
  children: rowContent
946
958
  });
947
- return _$ssr(_tmpl$26, _$ssrAttribute("aria-level", _$escape(depth, true) + 1, false) + _$ssrAttribute("aria-selected", _$escape(selected(), true), false) + _$ssrAttribute("aria-expanded", hasChildren() ? _$escape(isExpanded(item.id), true) : _$escape(undefined, true), false) + _$ssrAttribute("aria-disabled", item.disabled ? "true" : _$escape(undefined, true), false) + _$ssrAttribute("tabindex", item.disabled ? -1 : tabStopId() === item.id ? 0 : -1, false) + _$ssrAttribute("data-k2b-nav-tree-id", _$escape(item.id, true), false) + _$ssrAttribute("data-k2b-nav-tree-parent-id", _$escape(parentId, true), false), _$escape(row()), _$escape(_$createComponent(Show, {
959
+ return _$ssr(_tmpl$27, _$ssrAttribute("aria-level", _$escape(depth, true) + 1, false) + _$ssrAttribute("aria-selected", _$escape(selected(), true), false) + _$ssrAttribute("aria-expanded", hasChildren() ? _$escape(isExpanded(item.id), true) : _$escape(undefined, true), false) + _$ssrAttribute("aria-disabled", item.disabled ? "true" : _$escape(undefined, true), false) + _$ssrAttribute("tabindex", item.disabled ? -1 : tabStopId() === item.id ? 0 : -1, false) + _$ssrAttribute("data-k2b-nav-tree-id", _$escape(item.id, true), false) + _$ssrAttribute("data-k2b-nav-tree-parent-id", _$escape(parentId, true), false), _$escape(row()), _$escape(_$createComponent(Show, {
948
960
  get when() {
949
961
  return hasChildren() && isExpanded(item.id);
950
962
  },
951
963
  get children() {
952
- return _$ssr(_tmpl$25, _$escape(renderItems(nested, depth + 1, item.id)));
964
+ return _$ssr(_tmpl$26, _$escape(renderItems(nested, depth + 1, item.id)));
953
965
  }
954
966
  })));
955
967
  }
956
968
  });
957
- return _$ssr(_tmpl$27, `k2b-app-workspace__nav-tree ${_$escape(props.class ?? "", true)}`, _$ssrAttribute("aria-label", _$escape(props.ariaLabel, true), false), _$escape(renderItems(roots, 0)));
969
+ return _$ssr(_tmpl$28, `k2b-app-workspace__nav-tree ${_$escape(props.class ?? "", true)}`, _$ssrAttribute("aria-label", _$escape(props.ariaLabel, true), false), _$escape(renderItems(roots, 0)));
958
970
  };
959
971
  AppWorkspaceNavTree.Item = AppWorkspaceNavTreeItem;
960
972
  const AppWorkspaceSidebarIconGrid = props => _$ssrElement("section", _$mergeProps({
@@ -965,10 +977,10 @@ const AppWorkspaceSidebarIconGrid = props => _$ssrElement("section", _$mergeProp
965
977
  get when() {
966
978
  return props.title;
967
979
  },
968
- children: title => _$ssr(_tmpl$10, _$escape(title()))
969
- })), _$ssr(_tmpl$28, _$ssrAttribute("data-columns", _$escape(props.columns ?? 2, true), false), _$escape(props.children))], false);
980
+ children: title => _$ssr(_tmpl$11, _$escape(title()))
981
+ })), _$ssr(_tmpl$29, _$ssrAttribute("data-columns", _$escape(props.columns ?? 2, true), false), _$escape(props.children))], false);
970
982
  const AppWorkspaceSidebarIconAction = props => {
971
- const content = _$ssr(_tmpl$29, _$ssrAttribute("class", _$escape(iconClass(props.icon), true), false));
983
+ const content = _$ssr(_tmpl$30, _$ssrAttribute("class", _$escape(iconClass(props.icon), true), false));
972
984
  const attrs = () => ({
973
985
  class: `k2b-app-workspace__sidebar-icon-action ${props.active ? "is-active" : ""}`,
974
986
  title: props.label,
@@ -1034,7 +1046,7 @@ const AppWorkspace = props => {
1034
1046
  return props.resizable !== false;
1035
1047
  },
1036
1048
  get children() {
1037
- return _$ssr(_tmpl$30, `k2b-app-workspace ${_$escape(props.class ?? "", true)}`, _$ssrAttribute("data-mobile-surface", _$escape(props.mobileSurface, true), false) + _$ssrAttribute("data-sidebar-collapsed", initialLayoutState()?.sidebarCollapsed === undefined ? _$escape(undefined, true) : _$escape(String(initialLayoutState()?.sidebarCollapsed), true), false) + _$ssrAttribute("data-workspace-resizable", props.resizable === false ? "false" : "true", false), _$ssrStyle(appWorkspaceLayoutStyle(initialLayoutState())), _$escape(props.children));
1049
+ return _$ssr(_tmpl$31, `k2b-app-workspace ${_$escape(props.class ?? "", true)}`, _$ssrAttribute("data-mobile-surface", _$escape(props.mobileSurface, true), false) + _$ssrAttribute("data-sidebar-collapsed", initialLayoutState()?.sidebarCollapsed === undefined ? _$escape(undefined, true) : _$escape(String(initialLayoutState()?.sidebarCollapsed), true), false) + _$ssrAttribute("data-workspace-resizable", props.resizable === false ? "false" : "true", false), _$ssrStyle(appWorkspaceLayoutStyle(initialLayoutState())), _$escape(props.children));
1038
1050
  }
1039
1051
  });
1040
1052
  };
@@ -1046,7 +1058,7 @@ AppWorkspace.LayoutStateProvider = props => _$createComponent(LayoutStateContext
1046
1058
  return props.children;
1047
1059
  }
1048
1060
  });
1049
- AppWorkspace.Content = props => _$ssr(_tmpl$31, `k2b-app-workspace__content ${_$escape(props.class ?? "", true)}`, _$escape(props.children));
1061
+ AppWorkspace.Content = props => _$ssr(_tmpl$32, `k2b-app-workspace__content ${_$escape(props.class ?? "", true)}`, _$escape(props.children));
1050
1062
  AppWorkspace.Main = AppWorkspaceMain;
1051
1063
  AppWorkspace.MainPane = AppWorkspaceMainPane;
1052
1064
  AppWorkspace.Detail = AppWorkspaceDetail;