dou-ui 0.1.0-alpha.28 → 0.1.0-alpha.29

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.
@@ -1 +1 @@
1
- {"version":3,"file":"segmented-control.js","names":["_sfc_main"],"sources":["../../../src/components/segmented-control/segmented-control.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport {\n computed,\n nextTick,\n onBeforeUnmount,\n onMounted,\n ref,\n useId,\n useTemplateRef,\n watch,\n} from 'vue'\nimport { useNamespace } from '../../utils/namespace'\nimport { useFormDisabled, useFormItem, useFormReadonly, useFormSize } from '../form/use-form-item'\nimport type {\n SegmentedControlOption,\n SegmentedControlProps,\n SegmentedControlSlots,\n SegmentedControlValue,\n} from './segmented-control'\n\ndefineOptions({ name: 'DouSegmentedControl' })\n\nconst props = withDefaults(defineProps<SegmentedControlProps>(), {\n disabled: false,\n block: false,\n})\n// An explicit default stops Vue from reading a missing value as `false`.\nconst model = defineModel<SegmentedControlValue | undefined>({ default: undefined })\nconst emit = defineEmits<{ change: [value: SegmentedControlValue] }>()\ndefineSlots<SegmentedControlSlots>()\n\nconst ns = useNamespace('segmented-control')\n\n// Each option is a native radio, so the browser handles arrow keys and\n// keeps a single option checked, the same as a radio group.\nconst id = useId()\nconst name = computed(() => props.name ?? `dou-segmented-${id}`)\n\nconst { formItem } = useFormItem()\nformItem?.markGroup()\nconst size = useFormSize(() => props.size)\nconst disabled = useFormDisabled(() => props.disabled)\nconst readonly = useFormReadonly(() => props.readonly)\nconst invalid = computed(() => props.invalid || !!formItem?.invalid.value)\n\n// A read-only control takes focus but cancels the click or arrow key that would pick.\nfunction onClick(event: MouseEvent) {\n if (readonly.value) event.preventDefault()\n}\nfunction onKeydown(event: KeyboardEvent) {\n if (readonly.value && event.key.startsWith('Arrow')) event.preventDefault()\n}\n\nconst options = computed<SegmentedControlOption[]>(() =>\n props.options.map((option) =>\n typeof option === 'object' ? option : { value: option, label: String(option) },\n ),\n)\n\nfunction select(option: SegmentedControlOption) {\n if (disabled.value || readonly.value || option.disabled || option.value === model.value) return\n model.value = option.value\n emit('change', option.value)\n formItem?.trigger('change')\n}\n\n// The selection is a raised block that slides between the options. Its\n// box is measured from the selected option, unrounded, so it covers the\n// option exactly even when `block` shares out fractional widths. Layout\n// sizes are used instead of screen boxes, so a scaled or rotated ancestor\n// does not shift it.\nconst rootRef = useTemplateRef<HTMLElement>('root')\n\nfunction layoutWidth(element: HTMLElement) {\n const style = getComputedStyle(element)\n const width = Number.parseFloat(style.width)\n if (Number.isNaN(width)) return element.offsetWidth\n if (style.boxSizing === 'border-box') return width\n return (\n width +\n Number.parseFloat(style.paddingLeft) +\n Number.parseFloat(style.paddingRight) +\n Number.parseFloat(style.borderLeftWidth) +\n Number.parseFloat(style.borderRightWidth)\n )\n}\nconst indicator = ref<{ left: number; width: number } | null>(null)\n// No slide for the first placement, only for later changes.\nconst settled = ref(false)\n\nfunction measure() {\n const root = rootRef.value\n const index = options.value.findIndex((option) => option.value === model.value)\n const items = root ? [...root.querySelectorAll<HTMLElement>(`.${ns.e('item')}`)] : []\n const item = index < 0 ? undefined : items[index]\n if (!root || !item) {\n indicator.value = null\n return\n }\n // The options sit side by side from the padding edge.\n let left = Number.parseFloat(getComputedStyle(root).paddingLeft) || 0\n for (const before of items.slice(0, index)) left += layoutWidth(before)\n indicator.value = { left, width: layoutWidth(item) }\n}\n\nlet observer: ResizeObserver | undefined\n\nonMounted(() => {\n // Measured in the next frame, before it is painted: controls mounting\n // together then share one layout, instead of each forcing one in the\n // middle of mounting, which is slow on a page with many controls.\n requestAnimationFrame(() => {\n measure()\n requestAnimationFrame(() => (settled.value = true))\n })\n if (typeof ResizeObserver !== 'undefined' && rootRef.value) {\n observer = new ResizeObserver(() => measure())\n observer.observe(rootRef.value)\n for (const item of rootRef.value.children) observer.observe(item)\n }\n})\nonBeforeUnmount(() => observer?.disconnect())\n\nwatch([model, options, size], () => nextTick(measure), { deep: true })\n\nconst indicatorStyle = computed(() =>\n indicator.value\n ? { transform: `translateX(${indicator.value.left}px)`, width: `${indicator.value.width}px` }\n : { display: 'none' },\n)\n\nconst classes = computed(() => [\n ns.b(),\n ns.m(size.value),\n ns.is('block', props.block),\n ns.is('disabled', disabled.value),\n ns.is('readonly', readonly.value),\n ns.is('invalid', invalid.value),\n ns.is('settled', settled.value),\n])\n</script>\n\n<template>\n <div\n ref=\"root\"\n :id=\"formItem?.inputId\"\n :class=\"classes\"\n role=\"radiogroup\"\n :aria-disabled=\"disabled || undefined\"\n :aria-labelledby=\"formItem?.labelId\"\n :aria-describedby=\"formItem?.describedBy.value\"\n :aria-invalid=\"invalid || undefined\"\n :aria-readonly=\"readonly || undefined\"\n :aria-required=\"formItem?.required.value || undefined\"\n >\n <span :class=\"ns.e('indicator')\" :style=\"indicatorStyle\" aria-hidden=\"true\" />\n <label\n v-for=\"option in options\"\n :key=\"String(option.value)\"\n :class=\"[\n ns.e('item'),\n ns.is('checked', option.value === model),\n ns.is('disabled', disabled || !!option.disabled),\n ]\"\n >\n <input\n type=\"radio\"\n :class=\"ns.e('native')\"\n :name=\"name\"\n :value=\"option.value\"\n :checked=\"option.value === model\"\n :disabled=\"disabled || option.disabled\"\n @click=\"onClick\"\n @keydown=\"onKeydown\"\n @change=\"select(option)\"\n />\n <span :class=\"ns.e('label')\">\n <slot name=\"option\" :option=\"option\" :checked=\"option.value === model\">\n {{ option.label ?? String(option.value) }}\n </slot>\n </span>\n </label>\n </div>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"segmented-control.js","names":["_sfc_main"],"sources":["../../../src/components/segmented-control/segmented-control.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport {\n Comment,\n Fragment,\n Text,\n computed,\n createTextVNode,\n h,\n isVNode,\n nextTick,\n onBeforeUnmount,\n onMounted,\n ref,\n useId,\n useTemplateRef,\n watch,\n} from 'vue'\nimport type { VNode } from 'vue'\nimport { useNamespace } from '../../utils/namespace'\nimport { SlotNodes } from '../../utils/slot'\nimport { useFormDisabled, useFormItem, useFormReadonly, useFormSize } from '../form/use-form-item'\nimport type {\n SegmentedControlOption,\n SegmentedControlProps,\n SegmentedControlSlots,\n SegmentedControlValue,\n} from './segmented-control'\n\ndefineOptions({ name: 'DouSegmentedControl' })\n\nconst props = withDefaults(defineProps<SegmentedControlProps>(), {\n disabled: false,\n block: false,\n})\n// An explicit default stops Vue from reading a missing value as `false`.\nconst model = defineModel<SegmentedControlValue | undefined>({ default: undefined })\nconst emit = defineEmits<{ change: [value: SegmentedControlValue] }>()\nconst slots = defineSlots<SegmentedControlSlots>()\n\nconst ns = useNamespace('segmented-control')\n\n// Each option is a native radio, so the browser handles arrow keys and\n// keeps a single option checked, the same as a radio group.\nconst id = useId()\nconst name = computed(() => props.name ?? `dou-segmented-${id}`)\n\nconst { formItem } = useFormItem()\nformItem?.markGroup()\nconst size = useFormSize(() => props.size)\nconst disabled = useFormDisabled(() => props.disabled)\nconst readonly = useFormReadonly(() => props.readonly)\nconst invalid = computed(() => props.invalid || !!formItem?.invalid.value)\n\n// A read-only control takes focus but cancels the click or arrow key that would pick.\nfunction onClick(event: MouseEvent) {\n if (readonly.value) event.preventDefault()\n}\nfunction onKeydown(event: KeyboardEvent) {\n if (readonly.value && event.key.startsWith('Arrow')) event.preventDefault()\n}\n\nconst options = computed<SegmentedControlOption[]>(() =>\n props.options.map((option) =>\n typeof option === 'object' ? option : { value: option, label: String(option) },\n ),\n)\n\nfunction select(option: SegmentedControlOption) {\n if (disabled.value || readonly.value || option.disabled || option.value === model.value) return\n model.value = option.value\n emit('change', option.value)\n formItem?.trigger('change')\n}\n\n// The selection is a raised block that slides between the options. Its\n// box is measured from the selected option, unrounded, so it covers the\n// option exactly even when `block` shares out fractional widths. Layout\n// sizes are used instead of screen boxes, so a scaled or rotated ancestor\n// does not shift it.\nconst rootRef = useTemplateRef<HTMLElement>('root')\n\nfunction layoutWidth(element: HTMLElement) {\n const style = getComputedStyle(element)\n const width = Number.parseFloat(style.width)\n if (Number.isNaN(width)) return element.offsetWidth\n if (style.boxSizing === 'border-box') return width\n return (\n width +\n Number.parseFloat(style.paddingLeft) +\n Number.parseFloat(style.paddingRight) +\n Number.parseFloat(style.borderLeftWidth) +\n Number.parseFloat(style.borderRightWidth)\n )\n}\nconst indicator = ref<{ left: number; width: number } | null>(null)\n// No slide for the first placement, only for later changes.\nconst settled = ref(false)\n\nfunction measure() {\n const root = rootRef.value\n const index = options.value.findIndex((option) => option.value === model.value)\n const items = root ? [...root.querySelectorAll<HTMLElement>(`.${ns.e('item')}`)] : []\n const item = index < 0 ? undefined : items[index]\n if (!root || !item) {\n indicator.value = null\n return\n }\n // The options sit side by side from the padding edge.\n let left = Number.parseFloat(getComputedStyle(root).paddingLeft) || 0\n for (const before of items.slice(0, index)) left += layoutWidth(before)\n indicator.value = { left, width: layoutWidth(item) }\n}\n\nfunction flattenSlotNodes(nodes: unknown, out: VNode[] = []): VNode[] {\n for (const node of Array.isArray(nodes) ? nodes : [nodes]) {\n if (!isVNode(node)) {\n if (typeof node === 'string' || typeof node === 'number') {\n out.push(createTextVNode(String(node)))\n }\n continue\n }\n if (node.type === Fragment && Array.isArray(node.children)) {\n flattenSlotNodes(node.children, out)\n continue\n }\n out.push(node)\n }\n return out\n}\n\nfunction isTextOrComment(node: VNode) {\n return node.type === Text || node.type === Comment\n}\n\nfunction hasNonBlankText(node: VNode) {\n return node.type === Text && String(node.children ?? '').trim() !== ''\n}\n\n// Render `#option` during this component's own render so dynamic slot swaps always update.\n// Returns `undefined` when the slot is absent or renders nothing (e.g. `v-if=\"false\"`),\n// falling back to the default option label; wraps bare text beside elements in a block-level\n// span so ellipsis truncation still works inside the flex label.\nfunction renderOption(option: SegmentedControlOption, checked: boolean): unknown[] | undefined {\n if (!slots.option) return undefined\n const rendered = slots.option({ option, checked })\n const nodes = flattenSlotNodes(rendered)\n const hasElement = nodes.some((node) => !isTextOrComment(node))\n const hasText = nodes.some(hasNonBlankText)\n if (!hasElement && !hasText) return undefined\n if (!hasElement) return nodes\n if (!hasText) return Array.isArray(rendered) ? rendered : [rendered]\n\n const result: VNode[] = []\n let textRun: VNode[] = []\n const flush = () => {\n if (!textRun.length) return\n if (textRun.some(hasNonBlankText)) {\n result.push(h('span', { class: ns.e('text') }, textRun))\n } else {\n result.push(...textRun)\n }\n textRun = []\n }\n\n for (const node of nodes) {\n if (isTextOrComment(node)) {\n textRun.push(node)\n } else {\n flush()\n result.push(node)\n }\n }\n flush()\n return result\n}\n\nlet observer: ResizeObserver | undefined\n\nfunction observeItems() {\n if (!observer || !rootRef.value) return\n observer.disconnect()\n observer.observe(rootRef.value)\n for (const item of rootRef.value.querySelectorAll<HTMLElement>(`.${ns.e('item')}`)) {\n observer.observe(item)\n }\n}\n\nonMounted(() => {\n // Measured in the next frame, before it is painted: controls mounting\n // together then share one layout, instead of each forcing one in the\n // middle of mounting, which is slow on a page with many controls.\n requestAnimationFrame(() => {\n measure()\n requestAnimationFrame(() => (settled.value = true))\n })\n if (typeof ResizeObserver !== 'undefined' && rootRef.value) {\n observer = new ResizeObserver(() => measure())\n observeItems()\n }\n})\nonBeforeUnmount(() => observer?.disconnect())\n\nwatch(\n options,\n () =>\n nextTick(() => {\n observeItems()\n measure()\n }),\n { deep: true },\n)\nwatch([model, size, () => props.block], () => nextTick(measure))\n\nconst indicatorStyle = computed(() =>\n indicator.value\n ? { transform: `translateX(${indicator.value.left}px)`, width: `${indicator.value.width}px` }\n : { display: 'none' },\n)\n\nconst classes = computed(() => [\n ns.b(),\n ns.m(size.value),\n ns.is('block', props.block),\n ns.is('disabled', disabled.value),\n ns.is('readonly', readonly.value),\n ns.is('invalid', invalid.value),\n ns.is('settled', settled.value),\n])\n</script>\n\n<template>\n <div\n ref=\"root\"\n :id=\"formItem?.inputId\"\n :class=\"classes\"\n role=\"radiogroup\"\n :aria-disabled=\"disabled || undefined\"\n :aria-labelledby=\"formItem?.labelId\"\n :aria-describedby=\"formItem?.describedBy.value\"\n :aria-invalid=\"invalid || undefined\"\n :aria-readonly=\"readonly || undefined\"\n :aria-required=\"formItem?.required.value || undefined\"\n >\n <span :class=\"ns.e('indicator')\" :style=\"indicatorStyle\" aria-hidden=\"true\" />\n <label\n v-for=\"option in options\"\n :key=\"String(option.value)\"\n :class=\"[\n ns.e('item'),\n ns.is('checked', option.value === model),\n ns.is('disabled', disabled || !!option.disabled),\n ]\"\n >\n <input\n type=\"radio\"\n :class=\"ns.e('native')\"\n :name=\"name\"\n :value=\"option.value\"\n :checked=\"option.value === model\"\n :disabled=\"disabled || option.disabled\"\n @click=\"onClick\"\n @keydown=\"onKeydown\"\n @change=\"select(option)\"\n />\n <span :class=\"ns.e('label')\">\n <template v-for=\"custom in [renderOption(option, option.value === model)]\" :key=\"0\">\n <SlotNodes v-if=\"custom\" :nodes=\"custom\" />\n <template v-else>{{ option.label ?? String(option.value) }}</template>\n </template>\n </span>\n </label>\n </div>\n</template>\n"],"mappings":""}
@@ -1,6 +1,7 @@
1
1
  import { useNamespace } from "../../utils/namespace.js";
2
2
  import { useFormDisabled, useFormItem, useFormReadonly, useFormSize } from "../form/use-form-item.js";
3
- import { Fragment, computed, createElementBlock, createElementVNode, createTextVNode, defineComponent, mergeModels, nextTick, normalizeClass, normalizeStyle, onBeforeUnmount, onMounted, openBlock, ref, renderList, renderSlot, toDisplayString, unref, useId, useModel, useTemplateRef, watch } from "vue";
3
+ import { SlotNodes } from "../../utils/slot.js";
4
+ import { Comment, Fragment, Text, computed, createBlock, createElementBlock, createElementVNode, createTextVNode, defineComponent, h, isVNode, mergeModels, nextTick, normalizeClass, normalizeStyle, onBeforeUnmount, onMounted, openBlock, ref, renderList, toDisplayString, unref, useId, useModel, useSlots, useTemplateRef, watch } from "vue";
4
5
  // src/components/segmented-control/segmented-control.vue?vue&type=script&setup=true&lang.ts
5
6
  var _hoisted_1 = [
6
7
  "id",
@@ -56,6 +57,7 @@ var segmented_control_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*
56
57
  const props = __props;
57
58
  const model = useModel(__props, "modelValue");
58
59
  const emit = __emit;
60
+ const slots = useSlots();
59
61
  const ns = useNamespace("segmented-control");
60
62
  const id = useId();
61
63
  const name = computed(() => props.name ?? `dou-segmented-${id}`);
@@ -107,7 +109,61 @@ var segmented_control_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*
107
109
  width: layoutWidth(item)
108
110
  };
109
111
  }
112
+ function flattenSlotNodes(nodes, out = []) {
113
+ for (const node of Array.isArray(nodes) ? nodes : [nodes]) {
114
+ if (!isVNode(node)) {
115
+ if (typeof node === "string" || typeof node === "number") out.push(createTextVNode(String(node)));
116
+ continue;
117
+ }
118
+ if (node.type === Fragment && Array.isArray(node.children)) {
119
+ flattenSlotNodes(node.children, out);
120
+ continue;
121
+ }
122
+ out.push(node);
123
+ }
124
+ return out;
125
+ }
126
+ function isTextOrComment(node) {
127
+ return node.type === Text || node.type === Comment;
128
+ }
129
+ function hasNonBlankText(node) {
130
+ return node.type === Text && String(node.children ?? "").trim() !== "";
131
+ }
132
+ function renderOption(option, checked) {
133
+ if (!slots.option) return void 0;
134
+ const rendered = slots.option({
135
+ option,
136
+ checked
137
+ });
138
+ const nodes = flattenSlotNodes(rendered);
139
+ const hasElement = nodes.some((node) => !isTextOrComment(node));
140
+ const hasText = nodes.some(hasNonBlankText);
141
+ if (!hasElement && !hasText) return void 0;
142
+ if (!hasElement) return nodes;
143
+ if (!hasText) return Array.isArray(rendered) ? rendered : [rendered];
144
+ const result = [];
145
+ let textRun = [];
146
+ const flush = () => {
147
+ if (!textRun.length) return;
148
+ if (textRun.some(hasNonBlankText)) result.push(h("span", { class: ns.e("text") }, textRun));
149
+ else result.push(...textRun);
150
+ textRun = [];
151
+ };
152
+ for (const node of nodes) if (isTextOrComment(node)) textRun.push(node);
153
+ else {
154
+ flush();
155
+ result.push(node);
156
+ }
157
+ flush();
158
+ return result;
159
+ }
110
160
  let observer;
161
+ function observeItems() {
162
+ if (!observer || !rootRef.value) return;
163
+ observer.disconnect();
164
+ observer.observe(rootRef.value);
165
+ for (const item of rootRef.value.querySelectorAll(`.${ns.e("item")}`)) observer.observe(item);
166
+ }
111
167
  onMounted(() => {
112
168
  requestAnimationFrame(() => {
113
169
  measure();
@@ -115,16 +171,19 @@ var segmented_control_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*
115
171
  });
116
172
  if (typeof ResizeObserver !== "undefined" && rootRef.value) {
117
173
  observer = new ResizeObserver(() => measure());
118
- observer.observe(rootRef.value);
119
- for (const item of rootRef.value.children) observer.observe(item);
174
+ observeItems();
120
175
  }
121
176
  });
122
177
  onBeforeUnmount(() => observer?.disconnect());
178
+ watch(options, () => nextTick(() => {
179
+ observeItems();
180
+ measure();
181
+ }), { deep: true });
123
182
  watch([
124
183
  model,
125
- options,
126
- size
127
- ], () => nextTick(measure), { deep: true });
184
+ size,
185
+ () => props.block
186
+ ], () => nextTick(measure));
128
187
  const indicatorStyle = computed(() => indicator.value ? {
129
188
  transform: `translateX(${indicator.value.left}px)`,
130
189
  width: `${indicator.value.width}px`
@@ -172,10 +231,12 @@ var segmented_control_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*
172
231
  onClick,
173
232
  onKeydown,
174
233
  onChange: ($event) => select(option)
175
- }, null, 42, _hoisted_2), createElementVNode("span", { class: normalizeClass(unref(ns).e("label")) }, [renderSlot(_ctx.$slots, "option", {
176
- option,
177
- checked: option.value === model.value
178
- }, () => [createTextVNode(toDisplayString(option.label ?? String(option.value)), 1)])], 2)], 2);
234
+ }, null, 42, _hoisted_2), createElementVNode("span", { class: normalizeClass(unref(ns).e("label")) }, [(openBlock(true), createElementBlock(Fragment, null, renderList([renderOption(option, option.value === model.value)], (custom) => {
235
+ return openBlock(), createElementBlock(Fragment, { key: 0 }, [custom ? (openBlock(), createBlock(unref(SlotNodes), {
236
+ key: 0,
237
+ nodes: custom
238
+ }, null, 8, ["nodes"])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(option.label ?? String(option.value)), 1)], 64))], 64);
239
+ }), 128))], 2)], 2);
179
240
  }), 128))], 10, _hoisted_1);
180
241
  };
181
242
  }
@@ -1 +1 @@
1
- {"version":3,"file":"segmented-control.vue_vue_type_script_setup_true_lang.js","names":["_useModel","_openBlock","_createElementBlock","_unref","_normalizeClass","_createElementVNode","_normalizeStyle","_Fragment","_renderList","_renderSlot","_createTextVNode","_toDisplayString"],"sources":["../../../src/components/segmented-control/segmented-control.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport {\n computed,\n nextTick,\n onBeforeUnmount,\n onMounted,\n ref,\n useId,\n useTemplateRef,\n watch,\n} from 'vue'\nimport { useNamespace } from '../../utils/namespace'\nimport { useFormDisabled, useFormItem, useFormReadonly, useFormSize } from '../form/use-form-item'\nimport type {\n SegmentedControlOption,\n SegmentedControlProps,\n SegmentedControlSlots,\n SegmentedControlValue,\n} from './segmented-control'\n\ndefineOptions({ name: 'DouSegmentedControl' })\n\nconst props = withDefaults(defineProps<SegmentedControlProps>(), {\n disabled: false,\n block: false,\n})\n// An explicit default stops Vue from reading a missing value as `false`.\nconst model = defineModel<SegmentedControlValue | undefined>({ default: undefined })\nconst emit = defineEmits<{ change: [value: SegmentedControlValue] }>()\ndefineSlots<SegmentedControlSlots>()\n\nconst ns = useNamespace('segmented-control')\n\n// Each option is a native radio, so the browser handles arrow keys and\n// keeps a single option checked, the same as a radio group.\nconst id = useId()\nconst name = computed(() => props.name ?? `dou-segmented-${id}`)\n\nconst { formItem } = useFormItem()\nformItem?.markGroup()\nconst size = useFormSize(() => props.size)\nconst disabled = useFormDisabled(() => props.disabled)\nconst readonly = useFormReadonly(() => props.readonly)\nconst invalid = computed(() => props.invalid || !!formItem?.invalid.value)\n\n// A read-only control takes focus but cancels the click or arrow key that would pick.\nfunction onClick(event: MouseEvent) {\n if (readonly.value) event.preventDefault()\n}\nfunction onKeydown(event: KeyboardEvent) {\n if (readonly.value && event.key.startsWith('Arrow')) event.preventDefault()\n}\n\nconst options = computed<SegmentedControlOption[]>(() =>\n props.options.map((option) =>\n typeof option === 'object' ? option : { value: option, label: String(option) },\n ),\n)\n\nfunction select(option: SegmentedControlOption) {\n if (disabled.value || readonly.value || option.disabled || option.value === model.value) return\n model.value = option.value\n emit('change', option.value)\n formItem?.trigger('change')\n}\n\n// The selection is a raised block that slides between the options. Its\n// box is measured from the selected option, unrounded, so it covers the\n// option exactly even when `block` shares out fractional widths. Layout\n// sizes are used instead of screen boxes, so a scaled or rotated ancestor\n// does not shift it.\nconst rootRef = useTemplateRef<HTMLElement>('root')\n\nfunction layoutWidth(element: HTMLElement) {\n const style = getComputedStyle(element)\n const width = Number.parseFloat(style.width)\n if (Number.isNaN(width)) return element.offsetWidth\n if (style.boxSizing === 'border-box') return width\n return (\n width +\n Number.parseFloat(style.paddingLeft) +\n Number.parseFloat(style.paddingRight) +\n Number.parseFloat(style.borderLeftWidth) +\n Number.parseFloat(style.borderRightWidth)\n )\n}\nconst indicator = ref<{ left: number; width: number } | null>(null)\n// No slide for the first placement, only for later changes.\nconst settled = ref(false)\n\nfunction measure() {\n const root = rootRef.value\n const index = options.value.findIndex((option) => option.value === model.value)\n const items = root ? [...root.querySelectorAll<HTMLElement>(`.${ns.e('item')}`)] : []\n const item = index < 0 ? undefined : items[index]\n if (!root || !item) {\n indicator.value = null\n return\n }\n // The options sit side by side from the padding edge.\n let left = Number.parseFloat(getComputedStyle(root).paddingLeft) || 0\n for (const before of items.slice(0, index)) left += layoutWidth(before)\n indicator.value = { left, width: layoutWidth(item) }\n}\n\nlet observer: ResizeObserver | undefined\n\nonMounted(() => {\n // Measured in the next frame, before it is painted: controls mounting\n // together then share one layout, instead of each forcing one in the\n // middle of mounting, which is slow on a page with many controls.\n requestAnimationFrame(() => {\n measure()\n requestAnimationFrame(() => (settled.value = true))\n })\n if (typeof ResizeObserver !== 'undefined' && rootRef.value) {\n observer = new ResizeObserver(() => measure())\n observer.observe(rootRef.value)\n for (const item of rootRef.value.children) observer.observe(item)\n }\n})\nonBeforeUnmount(() => observer?.disconnect())\n\nwatch([model, options, size], () => nextTick(measure), { deep: true })\n\nconst indicatorStyle = computed(() =>\n indicator.value\n ? { transform: `translateX(${indicator.value.left}px)`, width: `${indicator.value.width}px` }\n : { display: 'none' },\n)\n\nconst classes = computed(() => [\n ns.b(),\n ns.m(size.value),\n ns.is('block', props.block),\n ns.is('disabled', disabled.value),\n ns.is('readonly', readonly.value),\n ns.is('invalid', invalid.value),\n ns.is('settled', settled.value),\n])\n</script>\n\n<template>\n <div\n ref=\"root\"\n :id=\"formItem?.inputId\"\n :class=\"classes\"\n role=\"radiogroup\"\n :aria-disabled=\"disabled || undefined\"\n :aria-labelledby=\"formItem?.labelId\"\n :aria-describedby=\"formItem?.describedBy.value\"\n :aria-invalid=\"invalid || undefined\"\n :aria-readonly=\"readonly || undefined\"\n :aria-required=\"formItem?.required.value || undefined\"\n >\n <span :class=\"ns.e('indicator')\" :style=\"indicatorStyle\" aria-hidden=\"true\" />\n <label\n v-for=\"option in options\"\n :key=\"String(option.value)\"\n :class=\"[\n ns.e('item'),\n ns.is('checked', option.value === model),\n ns.is('disabled', disabled || !!option.disabled),\n ]\"\n >\n <input\n type=\"radio\"\n :class=\"ns.e('native')\"\n :name=\"name\"\n :value=\"option.value\"\n :checked=\"option.value === model\"\n :disabled=\"disabled || option.disabled\"\n @click=\"onClick\"\n @keydown=\"onKeydown\"\n @change=\"select(option)\"\n />\n <span :class=\"ns.e('label')\">\n <slot name=\"option\" :option=\"option\" :checked=\"option.value === model\">\n {{ option.label ?? String(option.value) }}\n </slot>\n </span>\n </label>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsBA,MAAM,QAAQ;EAKd,MAAM,QAAQA,SAA8C,SAAA,YAAuB;EACnF,MAAM,OAAO;EAGb,MAAM,KAAK,aAAa,mBAAmB;EAI3C,MAAM,KAAK,MAAM;EACjB,MAAM,OAAO,eAAe,MAAM,QAAQ,iBAAiB,IA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AAA,CAAE,CAAC,EAAC,OAAA,CAAA,E,IAChBM,WAEO,KAAA,QAAA,UAAA;KAFsB;KAAS,SAAS,OAAO,UAAU,MAAA;IAAhE,SAEO,CADFC,gBAAAC,gBAAA,OAAO,SAAS,OAAO,OAAO,KAAK,CAAA,GAAA,CAAA,C"}
1
+ {"version":3,"file":"segmented-control.vue_vue_type_script_setup_true_lang.js","names":["_useModel","_useSlots","_openBlock","_createElementBlock","_unref","_normalizeClass","_createElementVNode","_normalizeStyle","_Fragment","_renderList","_createBlock","_createTextVNode","_toDisplayString"],"sources":["../../../src/components/segmented-control/segmented-control.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport {\n Comment,\n Fragment,\n Text,\n computed,\n createTextVNode,\n h,\n isVNode,\n nextTick,\n onBeforeUnmount,\n onMounted,\n ref,\n useId,\n useTemplateRef,\n watch,\n} from 'vue'\nimport type { VNode } from 'vue'\nimport { useNamespace } from '../../utils/namespace'\nimport { SlotNodes } from '../../utils/slot'\nimport { useFormDisabled, useFormItem, useFormReadonly, useFormSize } from '../form/use-form-item'\nimport type {\n SegmentedControlOption,\n SegmentedControlProps,\n SegmentedControlSlots,\n SegmentedControlValue,\n} from './segmented-control'\n\ndefineOptions({ name: 'DouSegmentedControl' })\n\nconst props = withDefaults(defineProps<SegmentedControlProps>(), {\n disabled: false,\n block: false,\n})\n// An explicit default stops Vue from reading a missing value as `false`.\nconst model = defineModel<SegmentedControlValue | undefined>({ default: undefined })\nconst emit = defineEmits<{ change: [value: SegmentedControlValue] }>()\nconst slots = defineSlots<SegmentedControlSlots>()\n\nconst ns = useNamespace('segmented-control')\n\n// Each option is a native radio, so the browser handles arrow keys and\n// keeps a single option checked, the same as a radio group.\nconst id = useId()\nconst name = computed(() => props.name ?? `dou-segmented-${id}`)\n\nconst { formItem } = useFormItem()\nformItem?.markGroup()\nconst size = useFormSize(() => props.size)\nconst disabled = useFormDisabled(() => props.disabled)\nconst readonly = useFormReadonly(() => props.readonly)\nconst invalid = computed(() => props.invalid || !!formItem?.invalid.value)\n\n// A read-only control takes focus but cancels the click or arrow key that would pick.\nfunction onClick(event: MouseEvent) {\n if (readonly.value) event.preventDefault()\n}\nfunction onKeydown(event: KeyboardEvent) {\n if (readonly.value && event.key.startsWith('Arrow')) event.preventDefault()\n}\n\nconst options = computed<SegmentedControlOption[]>(() =>\n props.options.map((option) =>\n typeof option === 'object' ? option : { value: option, label: String(option) },\n ),\n)\n\nfunction select(option: SegmentedControlOption) {\n if (disabled.value || readonly.value || option.disabled || option.value === model.value) return\n model.value = option.value\n emit('change', option.value)\n formItem?.trigger('change')\n}\n\n// The selection is a raised block that slides between the options. Its\n// box is measured from the selected option, unrounded, so it covers the\n// option exactly even when `block` shares out fractional widths. Layout\n// sizes are used instead of screen boxes, so a scaled or rotated ancestor\n// does not shift it.\nconst rootRef = useTemplateRef<HTMLElement>('root')\n\nfunction layoutWidth(element: HTMLElement) {\n const style = getComputedStyle(element)\n const width = Number.parseFloat(style.width)\n if (Number.isNaN(width)) return element.offsetWidth\n if (style.boxSizing === 'border-box') return width\n return (\n width +\n Number.parseFloat(style.paddingLeft) +\n Number.parseFloat(style.paddingRight) +\n Number.parseFloat(style.borderLeftWidth) +\n Number.parseFloat(style.borderRightWidth)\n )\n}\nconst indicator = ref<{ left: number; width: number } | null>(null)\n// No slide for the first placement, only for later changes.\nconst settled = ref(false)\n\nfunction measure() {\n const root = rootRef.value\n const index = options.value.findIndex((option) => option.value === model.value)\n const items = root ? [...root.querySelectorAll<HTMLElement>(`.${ns.e('item')}`)] : []\n const item = index < 0 ? undefined : items[index]\n if (!root || !item) {\n indicator.value = null\n return\n }\n // The options sit side by side from the padding edge.\n let left = Number.parseFloat(getComputedStyle(root).paddingLeft) || 0\n for (const before of items.slice(0, index)) left += layoutWidth(before)\n indicator.value = { left, width: layoutWidth(item) }\n}\n\nfunction flattenSlotNodes(nodes: unknown, out: VNode[] = []): VNode[] {\n for (const node of Array.isArray(nodes) ? nodes : [nodes]) {\n if (!isVNode(node)) {\n if (typeof node === 'string' || typeof node === 'number') {\n out.push(createTextVNode(String(node)))\n }\n continue\n }\n if (node.type === Fragment && Array.isArray(node.children)) {\n flattenSlotNodes(node.children, out)\n continue\n }\n out.push(node)\n }\n return out\n}\n\nfunction isTextOrComment(node: VNode) {\n return node.type === Text || node.type === Comment\n}\n\nfunction hasNonBlankText(node: VNode) {\n return node.type === Text && String(node.children ?? '').trim() !== ''\n}\n\n// Render `#option` during this component's own render so dynamic slot swaps always update.\n// Returns `undefined` when the slot is absent or renders nothing (e.g. `v-if=\"false\"`),\n// falling back to the default option label; wraps bare text beside elements in a block-level\n// span so ellipsis truncation still works inside the flex label.\nfunction renderOption(option: SegmentedControlOption, checked: boolean): unknown[] | undefined {\n if (!slots.option) return undefined\n const rendered = slots.option({ option, checked })\n const nodes = flattenSlotNodes(rendered)\n const hasElement = nodes.some((node) => !isTextOrComment(node))\n const hasText = nodes.some(hasNonBlankText)\n if (!hasElement && !hasText) return undefined\n if (!hasElement) return nodes\n if (!hasText) return Array.isArray(rendered) ? rendered : [rendered]\n\n const result: VNode[] = []\n let textRun: VNode[] = []\n const flush = () => {\n if (!textRun.length) return\n if (textRun.some(hasNonBlankText)) {\n result.push(h('span', { class: ns.e('text') }, textRun))\n } else {\n result.push(...textRun)\n }\n textRun = []\n }\n\n for (const node of nodes) {\n if (isTextOrComment(node)) {\n textRun.push(node)\n } else {\n flush()\n result.push(node)\n }\n }\n flush()\n return result\n}\n\nlet observer: ResizeObserver | undefined\n\nfunction observeItems() {\n if (!observer || !rootRef.value) return\n observer.disconnect()\n observer.observe(rootRef.value)\n for (const item of rootRef.value.querySelectorAll<HTMLElement>(`.${ns.e('item')}`)) {\n observer.observe(item)\n }\n}\n\nonMounted(() => {\n // Measured in the next frame, before it is painted: controls mounting\n // together then share one layout, instead of each forcing one in the\n // middle of mounting, which is slow on a page with many controls.\n requestAnimationFrame(() => {\n measure()\n requestAnimationFrame(() => (settled.value = true))\n })\n if (typeof ResizeObserver !== 'undefined' && rootRef.value) {\n observer = new ResizeObserver(() => measure())\n observeItems()\n }\n})\nonBeforeUnmount(() => observer?.disconnect())\n\nwatch(\n options,\n () =>\n nextTick(() => {\n observeItems()\n measure()\n }),\n { deep: true },\n)\nwatch([model, size, () => props.block], () => nextTick(measure))\n\nconst indicatorStyle = computed(() =>\n indicator.value\n ? { transform: `translateX(${indicator.value.left}px)`, width: `${indicator.value.width}px` }\n : { display: 'none' },\n)\n\nconst classes = computed(() => [\n ns.b(),\n ns.m(size.value),\n ns.is('block', props.block),\n ns.is('disabled', disabled.value),\n ns.is('readonly', readonly.value),\n ns.is('invalid', invalid.value),\n ns.is('settled', settled.value),\n])\n</script>\n\n<template>\n <div\n ref=\"root\"\n :id=\"formItem?.inputId\"\n :class=\"classes\"\n role=\"radiogroup\"\n :aria-disabled=\"disabled || undefined\"\n :aria-labelledby=\"formItem?.labelId\"\n :aria-describedby=\"formItem?.describedBy.value\"\n :aria-invalid=\"invalid || undefined\"\n :aria-readonly=\"readonly || undefined\"\n :aria-required=\"formItem?.required.value || undefined\"\n >\n <span :class=\"ns.e('indicator')\" :style=\"indicatorStyle\" aria-hidden=\"true\" />\n <label\n v-for=\"option in options\"\n :key=\"String(option.value)\"\n :class=\"[\n ns.e('item'),\n ns.is('checked', option.value === model),\n ns.is('disabled', disabled || !!option.disabled),\n ]\"\n >\n <input\n type=\"radio\"\n :class=\"ns.e('native')\"\n :name=\"name\"\n :value=\"option.value\"\n :checked=\"option.value === model\"\n :disabled=\"disabled || option.disabled\"\n @click=\"onClick\"\n @keydown=\"onKeydown\"\n @change=\"select(option)\"\n />\n <span :class=\"ns.e('label')\">\n <template v-for=\"custom in [renderOption(option, option.value === model)]\" :key=\"0\">\n <SlotNodes v-if=\"custom\" :nodes=\"custom\" />\n <template v-else>{{ option.label ?? String(option.value) }}</template>\n </template>\n </span>\n </label>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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