@plexui/vue 0.41.0 → 0.42.0
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/es/components/Accordion/Accordion.js +18 -0
- package/dist/es/components/Accordion/Accordion.js.map +1 -1
- package/dist/es/components/Button/NavigationButton.js +13 -2
- package/dist/es/components/Button/NavigationButton.js.map +1 -1
- package/dist/es/components/Dialog/Dialog.js +47 -3
- package/dist/es/components/Dialog/Dialog.js.map +1 -1
- package/dist/es/components/Dialog/sheetDrag.js +45 -12
- package/dist/es/components/Dialog/sheetDrag.js.map +1 -1
- package/dist/es/components/Field/Field.js +32 -3
- package/dist/es/components/Field/Field.js.map +1 -1
- package/dist/es/components/Markdown/Markdown.js +10 -1
- package/dist/es/components/Markdown/Markdown.js.map +1 -1
- package/dist/es/components/Markdown/directives.js +52 -11
- package/dist/es/components/Markdown/directives.js.map +1 -1
- package/dist/es/components/Menu/Menu.js +29 -2
- package/dist/es/components/Menu/Menu.js.map +1 -1
- package/dist/es/components/PlexUIProvider/PlexUIProvider.js +43 -3
- package/dist/es/components/PlexUIProvider/PlexUIProvider.js.map +1 -1
- package/dist/es/components/PlexUIProvider/androidRipple.js +98 -0
- package/dist/es/components/PlexUIProvider/androidRipple.js.map +1 -0
- package/dist/es/components/PlexUIProvider/index.js.map +1 -1
- package/dist/es/components/Select/Select.js +364 -22
- package/dist/es/components/Select/Select.js.map +1 -1
- package/dist/es/components/Toolbar/Toolbar.js +276 -17
- package/dist/es/components/Toolbar/Toolbar.js.map +1 -1
- package/dist/es/components/Toolbar/index.js.map +1 -1
- package/dist/es/lib/accordionMotion.js +144 -0
- package/dist/es/lib/accordionMotion.js.map +1 -0
- package/dist/es/lib/fieldRow.js +54 -0
- package/dist/es/lib/fieldRow.js.map +1 -1
- package/dist/es/lib/presentMotion.js +151 -0
- package/dist/es/lib/presentMotion.js.map +1 -0
- package/dist/types/components/Button/NavigationButton.d.ts +30 -1
- package/dist/types/components/ContextMenu/ContextMenu.d.ts +8 -8
- package/dist/types/components/Field/Field.d.ts +12 -2
- package/dist/types/components/FloatingLabelSelect/FloatingLabelSelect.d.ts +1 -1
- package/dist/types/components/Markdown/directives.d.ts +11 -2
- package/dist/types/components/PlexUIProvider/PlexUIProvider.d.ts +20 -3
- package/dist/types/components/PlexUIProvider/androidRipple.d.ts +9 -0
- package/dist/types/components/PlexUIProvider/index.d.ts +1 -1
- package/dist/types/components/Select/Select.d.ts +51 -0
- package/dist/types/components/Sidebar/useSidebarContext.d.ts +1 -1
- package/dist/types/components/TabBar/TabBar.d.ts +4 -4
- package/dist/types/components/Toast/Toaster.d.ts +1 -1
- package/dist/types/components/Toolbar/Toolbar.d.ts +49 -12
- package/dist/types/components/Toolbar/index.d.ts +1 -1
- package/dist/types/lib/accordionMotion.d.ts +20 -0
- package/dist/types/lib/fieldRow.d.ts +12 -0
- package/dist/types/lib/presentMotion.d.ts +46 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directives.js","sourceRoot":"","sources":["../../../../src/components/Markdown/directives.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAkF,MAAM,KAAK,CAAA;AAC5H,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAWpE;;;GAGG;AACH,MAAM,UAAU,GAAG,CAAC,KAAqC,EAAmD,EAAE;IAC5G,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAA;IAClD,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,KAAK,CAAA;IAClC,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAA;IACpB,IAAI,OAAO,CAAC,IAAI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,CAAC,CAAC,CAAE,EAAQ,CAAA;QAC9D,OAAO,MAAM,CAAC,EAAE,GAAG,WAAW,EAAE,QAAQ,EAAE,UAAU,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE,CAAC,CAAA;IAC5E,CAAC,CAAA;IACD,0EAA0E;IAC1E,eAAe,CAAC,YAAY,GAAG,KAAK,CAAA;IAEpC,SAAS,CAAC,aAAa,GAAG,UAAU,CAAA;IACpC,SAAS,CAAC,MAAM,GAAG,eAAe,CAAA;IAElC,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,2FAA2F;AAC3F,MAAM,UAAU,uBAAuB;IACrC,8DAA8D;IAC9D,OAAO,CAAC,IAAS,EAAE,EAAE;QACnB,KAAK,CAAC,IAAI,EAAE,CAAC,eAAe,EAAE,eAAe,EAAE,oBAAoB,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE;YAC7E,IAAI,CAAC,IAAI,GAAG;gBACV,KAAK,EAAE,IAAI,CAAC,IAAI;gBAChB,WAAW,EAAE,IAAI,CAAC,UAAU;gBAC5B,GAAG,IAAI,CAAC,IAAI;aACb,CAAA;YACD,OAAO,IAAI,CAAA;QACb,CAAC,CAAC,CAAA;IACJ,CAAC,CAAA;AACH,CAAC","sourcesContent":["import { Comment, Text, isVNode, type FunctionalComponent, type VNode, type VNodeArrayChildren, type VNodeChild } from \"vue\"\nimport { visit } from \"unist-util-visit\"\nimport { createId } from \"../../lib/ids.js\"\nimport { decodeBase64, encodeBase64 } from \"../../lib/safeBase64.js\"\n\ntype ValidDirectiveProps = { children?: string } & Partial<Record<string, unknown>>\n\nexport interface MarkdownDirective<T extends ValidDirectiveProps = ValidDirectiveProps> {\n directiveName: string\n /** Functional component Markdown renders the directive with */\n render: FunctionalComponent<{ attrs?: string }>\n (props: T): string\n}\n\n/**\n * React's rendered `children`: nothing, the text of a single text child, the\n * single vnode, or the list.\n */\nconst toChildren = (nodes: VNodeArrayChildren | undefined): string | VNode | VNodeArrayChildren | undefined => {\n if (!nodes || nodes.length === 0) return undefined\n if (nodes.length > 1) return nodes\n const [node] = nodes\n if (isVNode(node) && node.type === Text) return String(node.children ?? \"\")\n if (isVNode(node) && node.type === Comment) return undefined\n return isVNode(node) ? node : nodes\n}\n\n/**\n * Vue port of packages/ui/src/components/Markdown/directives.ts. `render`\n * gets the decoded attributes plus `children`: the directive's label as a\n * string when it is plain text, otherwise its vnodes.\n */\nexport function createMarkdownDirective<T extends ValidDirectiveProps>({\n render,\n name,\n mode,\n}: {\n render: (props: T) => VNodeChild\n name: string\n mode: \"inline\" | \"block\"\n}): MarkdownDirective<T> {\n const prefix = `OaiMdDirective_${name}`\n const uniqueName = createId(prefix, prefix.length + 6)\n\n function directive(props: T) {\n const { children, ...attributes } = props\n // Always true, as in React: the attributes are encoded even when empty\n const attrs = Object.keys(attributes).length >= 0 ? `attrs=\"${encodeBase64(attributes)}\"` : \"\"\n const leader = mode === \"inline\" ? \" :\" : \"\\n\\n:::\"\n\n return `${leader}${uniqueName}${children ? `[${children}]` : \"\"}{${attrs}}`\n }\n\n const renderDirective: FunctionalComponent<{ attrs?: string }> = ({ attrs }, { slots }) => {\n const parsedAttrs = attrs ? decodeBase64<T>(attrs) : ({} as T)\n return render({ ...parsedAttrs, children: toChildren(slots.default?.()) })\n }\n // React's render reads only `attrs` and `children`: nothing falls through\n renderDirective.inheritAttrs = false\n\n directive.directiveName = uniqueName\n directive.render = renderDirective\n\n return directive\n}\n\n/** React's `reactMarkdownRemarkDirective`: directives become elements named after them. */\nexport function markdownRemarkDirective() {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (tree: any) => {\n visit(tree, [\"textDirective\", \"leafDirective\", \"containerDirective\"], (node) => {\n node.data = {\n hName: node.name,\n hProperties: node.attributes,\n ...node.data,\n }\n return node\n })\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"directives.js","sourceRoot":"","sources":["../../../../src/components/Markdown/directives.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,O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,GAAG,GAAG,IAAI,CAAC,IAAI,EAAE,CAAA;YACjE,MAAM,IAAI,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAA;YACpC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,KAAK,eAAe,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;YACvG,OAAO,IAAI,CAAA;QACb,CAAC,CAAC,CAAA;IACJ,CAAC,CAAA;AACH,CAAC","sourcesContent":["import { Comment, Text, isVNode, type FunctionalComponent, type VNode, type VNodeArrayChildren, type VNodeChild } from \"vue\"\nimport { SKIP, visit } from \"unist-util-visit\"\nimport { createId } from \"../../lib/ids.js\"\nimport { decodeBase64, encodeBase64 } from \"../../lib/safeBase64.js\"\n\ntype ValidDirectiveProps = { children?: string } & Partial<Record<string, unknown>>\n\nexport interface MarkdownDirective<T extends ValidDirectiveProps = ValidDirectiveProps> {\n directiveName: string\n /** Functional component Markdown renders the directive with */\n render: FunctionalComponent<{ attrs?: string }>\n (props: T): string\n}\n\n/**\n * React's rendered `children`: nothing, the text of a single text child, the\n * single vnode, or the list.\n */\nconst toChildren = (nodes: VNodeArrayChildren | undefined): string | VNode | VNodeArrayChildren | undefined => {\n if (!nodes || nodes.length === 0) return undefined\n if (nodes.length > 1) return nodes\n const [node] = nodes\n if (isVNode(node) && node.type === Text) return String(node.children ?? \"\")\n if (isVNode(node) && node.type === Comment) return undefined\n return isVNode(node) ? node : nodes\n}\n\n/**\n * Vue port of packages/ui/src/components/Markdown/directives.ts. `render`\n * gets the decoded attributes plus `children`: the directive's label as a\n * string when it is plain text, otherwise its vnodes.\n */\nexport function createMarkdownDirective<T extends ValidDirectiveProps>({\n render,\n name,\n mode,\n}: {\n render: (props: T) => VNodeChild\n name: string\n mode: \"inline\" | \"block\"\n}): MarkdownDirective<T> {\n const prefix = `OaiMdDirective_${name}`\n const uniqueName = createId(prefix, prefix.length + 6)\n\n function directive(props: T) {\n const { children, ...attributes } = props\n // Always true, as in React: the attributes are encoded even when empty\n const attrs = Object.keys(attributes).length >= 0 ? `attrs=\"${encodeBase64(attributes)}\"` : \"\"\n const leader = mode === \"inline\" ? \" :\" : \"\\n\\n:::\"\n\n return `${leader}${uniqueName}${children ? `[${children}]` : \"\"}{${attrs}}`\n }\n\n const renderDirective: FunctionalComponent<{ attrs?: string }> = ({ attrs }, { slots }) => {\n const parsedAttrs = attrs ? decodeBase64<T>(attrs) : ({} as T)\n return render({ ...parsedAttrs, children: toChildren(slots.default?.()) })\n }\n // React's render reads only `attrs` and `children`: nothing falls through\n renderDirective.inheritAttrs = false\n\n directive.directiveName = uniqueName\n directive.render = renderDirective\n\n return directive\n}\n\n/**\n * A directive's attribute reaches its element only as a plain HTML attribute: a lowercase name (`title`, `data-*`,\n * `aria-*`), so never a DOM property such as `innerHTML` or React's `dangerouslySetInnerHTML`; never an event handler,\n * an inline style, a frame's document or `is`.\n */\nconst ATTRIBUTE_NAME = /^[a-z][a-z0-9-]*$/\nconst UNSAFE_ATTRIBUTE = /^(?:on|style$|srcdoc$|formaction$|is$)/\n\n/** The attributes that load or open a URL: one with a protocol other than Markdown's safe ones is dropped. */\nconst URL_ATTRIBUTES = new Set([\"href\", \"src\", \"action\", \"cite\", \"poster\", \"background\", \"ping\", \"data\", \"codebase\"])\nconst SAFE_PROTOCOL = /^(?:https?|ircs?|mailto|xmpp|tel|sms)$/i\n\n/** react-markdown's `defaultUrlTransform` test, with `tel:` and `sms:` as the Markdown's own transform. */\nconst isSafeUrl = (value: string) => {\n const colon = value.indexOf(\":\")\n const firstOf = (char: string) => value.indexOf(char)\n return (\n colon === -1 ||\n [firstOf(\"/\"), firstOf(\"?\"), firstOf(\"#\")].some((index) => index !== -1 && colon > index) ||\n SAFE_PROTOCOL.test(value.slice(0, colon).trim())\n )\n}\n\nconst safeAttributes = (attributes: Record<string, unknown> | null | undefined) =>\n Object.fromEntries(\n Object.entries(attributes ?? {}).filter(\n ([key, value]) =>\n ATTRIBUTE_NAME.test(key) &&\n !UNSAFE_ATTRIBUTE.test(key) &&\n !(URL_ATTRIBUTES.has(key) && !isSafeUrl(String(value ?? \"\"))),\n ),\n )\n\n/**\n * Directives become elements only when the Markdown knows them: a `directives` entry or a `components` key, with\n * their attributes minus event handlers, `style` and `srcdoc`. Any other directive stays what was written: an inline\n * or leaf one its source text, a container one its content in a plain `div`. Text from elsewhere (a server, a user)\n * can't make an element of its choosing with attributes of its choosing.\n */\nexport function markdownRemarkDirective(options: { names?: Iterable<string> } = {}) {\n const names = new Set(options.names ?? [])\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (tree: any, file?: { value?: unknown }) => {\n const source = file?.value == null ? \"\" : String(file.value)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n visit(tree, [\"textDirective\", \"leafDirective\", \"containerDirective\"], (node: any, index, parent: any) => {\n if (names.has(node.name)) {\n node.data = { hName: node.name, hProperties: safeAttributes(node.attributes), ...node.data }\n return\n }\n if (node.type === \"containerDirective\") {\n node.data = { hName: \"div\", hProperties: {}, ...node.data }\n return\n }\n if (!parent || typeof index !== \"number\") return\n const start = node.position?.start?.offset\n const end = node.position?.end?.offset\n const value =\n typeof start === \"number\" && typeof end === \"number\" && end <= source.length\n ? source.slice(start, end)\n : `${node.type === \"leafDirective\" ? \"::\" : \":\"}${node.name}`\n const text = { type: \"text\", value }\n parent.children[index] = node.type === \"leafDirective\" ? { type: \"paragraph\", children: [text] } : text\n return SKIP\n })\n }\n}\n"]}
|
|
@@ -11,6 +11,7 @@ import { useLinkComponent } from "../PlexUIProvider/internal.js";
|
|
|
11
11
|
import { composeEventHandlers, mergeSlotProps } from "../Tooltip/slot.js";
|
|
12
12
|
import { TransitionGroup } from "../Transition/index.js";
|
|
13
13
|
import { createExitGuard, overlayTiming, overlayTimingQuick, reducedMotionEnter } from "../Transition/shared.js";
|
|
14
|
+
import { growsFromButton, MENU_SPRING_MS, sourceScale } from "../../lib/presentMotion.js";
|
|
14
15
|
import { MenuLevelKey, MenuRootInternalsKey, MenuSubInternalsKey, SUB_CLOSE_KEYS, SUB_OPEN_KEYS, box, compose, getCheckedState, getOpenState, isIndeterminate, provideMenuContentContext, selectableItemListeners, splitListeners, trackKeyboardUse, useMenuItemImpl, useMenuItemSelect, useMenuLevel, useMenuRootInternals, useMenuSubInternals, whenMouse, } from "./internal.js";
|
|
15
16
|
import { useFloatingBoundary } from "../../composables/useFloatingBoundary.js";
|
|
16
17
|
import { PHONE_LAYOUT } from "../PhoneLayout/PhoneLayout.js";
|
|
@@ -382,6 +383,8 @@ const MenuRootContentImpl = defineComponent({
|
|
|
382
383
|
onCloseAutoFocus: { type: Function, required: true },
|
|
383
384
|
onOpenAutoFocus: { type: Function, required: true },
|
|
384
385
|
exitGuard: { type: Object, required: true },
|
|
386
|
+
/** Whether the open menu grows out of its button: its timers wait for the spring then */
|
|
387
|
+
onGrows: { type: Function, required: true },
|
|
385
388
|
},
|
|
386
389
|
setup(props, { slots }) {
|
|
387
390
|
const rootContext = injectDropdownMenuRootContext();
|
|
@@ -411,6 +414,28 @@ const MenuRootContentImpl = defineComponent({
|
|
|
411
414
|
return;
|
|
412
415
|
onCleanup(markCoveredMenuTrigger(trigger, content));
|
|
413
416
|
});
|
|
417
|
+
// A menu that covers its button grows out of it and shrinks back into it, as an iOS 27.2 menu does, on SwiftUI's
|
|
418
|
+
// spring(duration: 0.21, bounce: 0.2), --spring-menu. Decided while it is open: a closing menu covers nothing,
|
|
419
|
+
// yet goes back into its button.
|
|
420
|
+
watchEffect(() => {
|
|
421
|
+
if (!level.open())
|
|
422
|
+
return;
|
|
423
|
+
const trigger = internals.trigger.value;
|
|
424
|
+
const content = level.content.value;
|
|
425
|
+
const grows = coversTrigger() && triggerCover.value !== null && growsFromButton(trigger);
|
|
426
|
+
props.onGrows(grows);
|
|
427
|
+
if (!content)
|
|
428
|
+
return;
|
|
429
|
+
const scale = grows ? sourceScale(content, trigger) : null;
|
|
430
|
+
if (scale) {
|
|
431
|
+
content.style.setProperty("--menu-source-transform", scale);
|
|
432
|
+
content.setAttribute("data-presented-from", "");
|
|
433
|
+
}
|
|
434
|
+
else {
|
|
435
|
+
content.style.removeProperty("--menu-source-transform");
|
|
436
|
+
content.removeAttribute("data-presented-from");
|
|
437
|
+
}
|
|
438
|
+
}, { flush: "post" });
|
|
414
439
|
onMounted(() => {
|
|
415
440
|
level.content.value = document.getElementById(rootContext.contentId);
|
|
416
441
|
});
|
|
@@ -576,20 +601,22 @@ export const MenuContent = defineComponent({
|
|
|
576
601
|
},
|
|
577
602
|
setup(props, { slots, emit }) {
|
|
578
603
|
const { open } = useMenuContext();
|
|
604
|
+
const grows = shallowRef(false);
|
|
605
|
+
const onGrows = (value) => { grows.value = value; };
|
|
579
606
|
const onCloseAutoFocus = (event) => emit("closeAutoFocus", event);
|
|
580
607
|
const onOpenAutoFocus = (event) => emit("openAutoFocus", event);
|
|
581
608
|
const exitGuard = createExitGuard();
|
|
582
609
|
const phoneLayout = useMenuPhoneLayout();
|
|
583
610
|
return () => menuPortal(phoneLayout, () => h(TransitionGroup, {
|
|
584
611
|
class: [s.Menu, HOLD_PRESSES_CLASS],
|
|
585
|
-
...overlayTiming,
|
|
612
|
+
...(grows.value ? { enterDuration: MENU_SPRING_MS, exitDuration: MENU_SPRING_MS } : overlayTiming),
|
|
586
613
|
reducedMotionEnterDuration: reducedMotionEnter.menu,
|
|
587
614
|
...exitGuard.transition,
|
|
588
615
|
overlay: true,
|
|
589
616
|
}, {
|
|
590
617
|
default: () => [
|
|
591
618
|
open.value
|
|
592
|
-
? h(MenuRootContentImpl, { key: "dropdown", ...props, onCloseAutoFocus, onOpenAutoFocus, exitGuard }, { default: () => slots.default?.() })
|
|
619
|
+
? h(MenuRootContentImpl, { key: "dropdown", ...props, onCloseAutoFocus, onOpenAutoFocus, exitGuard, onGrows }, { default: () => slots.default?.() })
|
|
593
620
|
: createCommentVNode(),
|
|
594
621
|
],
|
|
595
622
|
}));
|