@rozenite/controls-plugin 2.2.0 → 2.3.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/CHANGELOG.md +16 -0
- package/dist/devtools/assets/panel-EMOeI6i6.css +1 -0
- package/dist/devtools/assets/panel-mjW0t-tQ.js +18 -0
- package/dist/devtools/panel.html +2 -2
- package/dist/react-native/cjs/package.json +3 -0
- package/dist/react-native/cjs/react-native.js +14 -0
- package/dist/react-native/cjs/src/react-native/controlsRegistry.js +70 -0
- package/dist/react-native/cjs/src/react-native/useControlsAgentTools.js +175 -0
- package/dist/react-native/cjs/src/react-native/useRozeniteControlsPlugin.js +177 -0
- package/dist/react-native/cjs/src/shared/agent-tools.js +51 -0
- package/dist/react-native/cjs/src/shared/messaging.js +2 -0
- package/dist/react-native/cjs/src/shared/serialization.js +102 -0
- package/dist/react-native/cjs/src/shared/types.js +5 -0
- package/dist/react-native/package.json +3 -0
- package/dist/react-native/react-native.d.ts +2 -0
- package/dist/react-native/react-native.js +11 -0
- package/dist/react-native/src/react-native/controlsRegistry.d.ts +23 -0
- package/dist/react-native/src/react-native/controlsRegistry.js +66 -0
- package/dist/react-native/src/react-native/useControlsAgentTools.d.ts +2 -0
- package/dist/react-native/src/react-native/useControlsAgentTools.js +171 -0
- package/dist/react-native/src/react-native/useRozeniteControlsPlugin.d.ts +3 -0
- package/dist/react-native/src/react-native/useRozeniteControlsPlugin.js +173 -0
- package/dist/react-native/src/shared/agent-tools.d.ts +48 -0
- package/dist/react-native/src/shared/agent-tools.js +48 -0
- package/dist/react-native/src/shared/messaging.d.ts +35 -0
- package/dist/react-native/src/shared/messaging.js +1 -0
- package/dist/react-native/src/shared/serialization.d.ts +22 -0
- package/dist/react-native/src/shared/serialization.js +96 -0
- package/dist/react-native/src/shared/types.d.ts +69 -0
- package/dist/react-native/src/shared/types.js +1 -0
- package/dist/rozenite.json +1 -1
- package/dist/sdk/package.json +3 -0
- package/dist/sdk/sdk.d.ts +10 -0
- package/dist/sdk/sdk.js +8 -0
- package/dist/sdk/src/shared/agent-tools.d.ts +48 -0
- package/dist/sdk/src/shared/agent-tools.js +51 -0
- package/dist/sdk/src/shared/messaging.d.ts +35 -0
- package/dist/sdk/src/shared/messaging.js +2 -0
- package/dist/sdk/src/shared/types.d.ts +69 -0
- package/dist/sdk/src/shared/types.js +5 -0
- package/package.json +17 -18
- package/react-native.ts +8 -1
- package/rozenite.config.ts +1 -0
- package/src/__tests__/release-bundle.test.ts +32 -0
- package/dist/devtools/assets/panel-BGnH7fJp.js +0 -18
- package/dist/devtools/assets/panel-DFvY5duB.css +0 -1
- package/dist/react-native/chunks/useRozeniteControlsPlugin.require.cjs +0 -1
- package/dist/react-native/chunks/useRozeniteControlsPlugin.require.js +0 -466
- package/dist/react-native/index.cjs +0 -1
- package/dist/react-native/index.d.ts +0 -138
- package/dist/react-native/index.js +0 -8
- package/dist/sdk/index.cjs +0 -1
- package/dist/sdk/index.d.ts +0 -150
- package/dist/sdk/index.js +0 -55
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-content:"";--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-animation-delay:0s;--tw-animation-direction:normal;--tw-animation-duration:initial;--tw-animation-fill-mode:none;--tw-animation-iteration-count:1;--tw-enter-blur:0;--tw-enter-opacity:1;--tw-enter-rotate:0;--tw-enter-scale:1;--tw-enter-translate-x:0;--tw-enter-translate-y:0;--tw-exit-blur:0;--tw-exit-opacity:1;--tw-exit-rotate:0;--tw-exit-scale:1;--tw-exit-translate-x:0;--tw-exit-translate-y:0}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--spacing:.25rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-lg:var(--radius);--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}*{border-color:var(--border);outline-color:var(--ring)}@supports (color:color-mix(in lab,red,red)){*{outline-color:color-mix(in oklab,var(--ring) 50%,transparent)}}body{background-color:var(--background);color:var(--foreground);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif}::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-track{background:0 0}::-webkit-scrollbar-thumb{background-color:var(--border);border-radius:var(--radius-lg);background-clip:padding-box;border:2px solid #0000}::-webkit-scrollbar-thumb:hover{background-color:var(--muted-foreground)}::-webkit-scrollbar-corner{background:0 0}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.top-0{top:calc(var(--spacing) * 0)}.top-1\/2{top:50%}.top-4{top:calc(var(--spacing) * 4)}.right-1{right:calc(var(--spacing) * 1)}.right-1\.5{right:calc(var(--spacing) * 1.5)}.right-2{right:calc(var(--spacing) * 2)}.right-2\.5{right:calc(var(--spacing) * 2.5)}.right-4{right:calc(var(--spacing) * 4)}.bottom-4{bottom:calc(var(--spacing) * 4)}.left-0\.5{left:calc(var(--spacing) * .5)}.left-1\.5{left:calc(var(--spacing) * 1.5)}.left-2\.5{left:calc(var(--spacing) * 2.5)}.left-3{left:calc(var(--spacing) * 3)}.z-10{z-index:10}.z-50{z-index:50}.row-0{grid-row:0}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.-mx-1{margin-inline:calc(var(--spacing) * -1)}.my-1{margin-block:calc(var(--spacing) * 1)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-5{margin-top:calc(var(--spacing) * 5)}.ml-3\.5{margin-left:calc(var(--spacing) * 3.5)}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-flex{display:inline-flex}.list-item{display:list-item}.table{display:table}.size-1{width:calc(var(--spacing) * 1);height:calc(var(--spacing) * 1)}.size-1\.5{width:calc(var(--spacing) * 1.5);height:calc(var(--spacing) * 1.5)}.size-2{width:calc(var(--spacing) * 2);height:calc(var(--spacing) * 2)}.size-3{width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.size-3\.5{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-5{width:calc(var(--spacing) * 5);height:calc(var(--spacing) * 5)}.size-6{width:calc(var(--spacing) * 6);height:calc(var(--spacing) * 6)}.size-8{width:calc(var(--spacing) * 8);height:calc(var(--spacing) * 8)}.size-10{width:calc(var(--spacing) * 10);height:calc(var(--spacing) * 10)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3{height:calc(var(--spacing) * 3)}.h-3\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-8{height:calc(var(--spacing) * 8)}.h-10{height:calc(var(--spacing) * 10)}.h-12{height:calc(var(--spacing) * 12)}.h-16{height:calc(var(--spacing) * 16)}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-\(--available-height\){max-height:var(--available-height)}.max-h-64{max-height:calc(var(--spacing) * 64)}.min-h-0{min-height:calc(var(--spacing) * 0)}.min-h-20{min-height:calc(var(--spacing) * 20)}.min-h-28{min-height:calc(var(--spacing) * 28)}.min-h-36{min-height:calc(var(--spacing) * 36)}.min-h-56{min-height:calc(var(--spacing) * 56)}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-3{width:calc(var(--spacing) * 3)}.w-3\.5{width:calc(var(--spacing) * 3.5)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-8{width:calc(var(--spacing) * 8)}.w-9{width:calc(var(--spacing) * 9)}.w-40{width:calc(var(--spacing) * 40)}.w-80{width:calc(var(--spacing) * 80)}.w-fit{width:fit-content}.w-full{width:100%}.w-px{width:1px}.max-w-\[50\%\]{max-width:50%}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-5{min-width:calc(var(--spacing) * 5)}.min-w-40{min-width:calc(var(--spacing) * 40)}.min-w-\[--anchor-width\]{min-width:--anchor-width}.min-w-\[240px\]{min-width:240px}.min-w-full{min-width:100%}.flex-1{flex:1}.shrink-0{flex-shrink:0}.border-collapse{border-collapse:collapse}.origin-\(--transform-origin\){transform-origin:var(--transform-origin)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.rotate-90{rotate:90deg}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.resize{resize:both}.resize-y{resize:vertical}.grid-cols-\[minmax\(7rem\,25\%\)_minmax\(3rem\,1fr\)\]{grid-template-columns:minmax(7rem,25%) minmax(3rem,1fr)}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.items-stretch{align-items:stretch}.justify-around{justify-content:space-around}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-evenly{justify-content:space-evenly}.justify-start{justify-content:flex-start}.gap-0{gap:calc(var(--spacing) * 0)}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-8{gap:calc(var(--spacing) * 8)}.gap-x-2{column-gap:calc(var(--spacing) * 2)}.gap-y-2{row-gap:calc(var(--spacing) * 2)}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-border>:not(:last-child)){border-color:var(--border)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) * .8)}.rounded-sm{border-radius:calc(var(--radius) * .6)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-r-0{border-right-style:var(--tw-border-style);border-right-width:0}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-border{border-color:var(--border)}.border-current\/15{border-color:currentColor}@supports (color:color-mix(in lab,red,red)){.border-current\/15{border-color:color-mix(in oklab,currentcolor 15%,transparent)}}.border-danger,.border-danger\/50{border-color:var(--danger)}@supports (color:color-mix(in lab,red,red)){.border-danger\/50{border-color:color-mix(in oklab,var(--danger) 50%,transparent)}}.border-info{border-color:var(--info)}.border-input{border-color:var(--input)}.border-primary{border-color:var(--primary)}.border-ring{border-color:var(--ring)}.border-sidebar-border{border-color:var(--sidebar-border)}.border-success{border-color:var(--success)}.border-warning{border-color:var(--warning)}.bg-accent{background-color:var(--accent)}.bg-background,.bg-background\/70{background-color:var(--background)}@supports (color:color-mix(in lab,red,red)){.bg-background\/70{background-color:color-mix(in oklab,var(--background) 70%,transparent)}}.bg-border{background-color:var(--border)}.bg-card{background-color:var(--card)}.bg-danger{background-color:var(--danger)}.bg-danger-soft{background-color:var(--danger-soft)}.bg-foreground{background-color:var(--foreground)}.bg-info{background-color:var(--info)}.bg-info-soft{background-color:var(--info-soft)}.bg-muted{background-color:var(--muted)}.bg-muted-foreground{background-color:var(--muted-foreground)}.bg-popover{background-color:var(--popover)}.bg-primary{background-color:var(--primary)}.bg-secondary{background-color:var(--secondary)}.bg-sidebar{background-color:var(--sidebar)}.bg-success{background-color:var(--success)}.bg-success-soft{background-color:var(--success-soft)}.bg-transparent{background-color:#0000}.bg-warning{background-color:var(--warning)}.bg-warning-soft{background-color:var(--warning-soft)}.p-0{padding:calc(var(--spacing) * 0)}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:calc(var(--spacing) * 1)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.py-0{padding-block:calc(var(--spacing) * 0)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-10{padding-block:calc(var(--spacing) * 10)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-4{padding-right:calc(var(--spacing) * 4)}.pr-6{padding-right:calc(var(--spacing) * 6)}.pr-8{padding-right:calc(var(--spacing) * 8)}.pr-10{padding-right:calc(var(--spacing) * 10)}.pr-11{padding-right:calc(var(--spacing) * 11)}.pr-14{padding-right:calc(var(--spacing) * 14)}.pr-16{padding-right:calc(var(--spacing) * 16)}.pl-2{padding-left:calc(var(--spacing) * 2)}.pl-6{padding-left:calc(var(--spacing) * 6)}.pl-8{padding-left:calc(var(--spacing) * 8)}.pl-10{padding-left:calc(var(--spacing) * 10)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.font-mono{font-family:var(--font-mono)}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.whitespace-nowrap{white-space:nowrap}.text-accent-foreground{color:var(--accent-foreground)}.text-background{color:var(--background)}.text-card-foreground{color:var(--card-foreground)}.text-danger{color:var(--danger)}.text-danger-foreground{color:var(--danger-foreground)}.text-foreground{color:var(--foreground)}.text-info{color:var(--info)}.text-info-foreground{color:var(--info-foreground)}.text-muted-foreground,.text-muted-foreground\/60{color:var(--muted-foreground)}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/60{color:color-mix(in oklab,var(--muted-foreground) 60%,transparent)}}.text-popover-foreground{color:var(--popover-foreground)}.text-primary{color:var(--primary)}.text-primary-foreground{color:var(--primary-foreground)}.text-secondary-foreground{color:var(--secondary-foreground)}.text-sidebar-foreground,.text-sidebar-foreground\/60{color:var(--sidebar-foreground)}@supports (color:color-mix(in lab,red,red)){.text-sidebar-foreground\/60{color:color-mix(in oklab,var(--sidebar-foreground) 60%,transparent)}}.text-success{color:var(--success)}.text-success-foreground{color:var(--success-foreground)}.text-warning{color:var(--warning)}.text-warning-foreground{color:var(--warning-foreground)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.opacity-80{opacity:.8}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.transition-\[transform\,opacity\]{transition-property:transform,opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[transform\,scale\,opacity\]{transition-property:transform,scale,opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.running{animation-play-state:running}@media(hover:hover){.group-hover\:translate-x-0\.5:is(:where(.group):hover *){--tw-translate-x:calc(var(--spacing) * .5);translate:var(--tw-translate-x) var(--tw-translate-y)}.group-hover\:-translate-y-0\.5:is(:where(.group):hover *){--tw-translate-y:calc(var(--spacing) * -.5);translate:var(--tw-translate-x) var(--tw-translate-y)}}.group-aria-\[orientation\=horizontal\]\/split-handle\:h-3:is(:where(.group\/split-handle)[aria-orientation=horizontal] *){height:calc(var(--spacing) * 3)}.group-aria-\[orientation\=horizontal\]\/split-handle\:w-4:is(:where(.group\/split-handle)[aria-orientation=horizontal] *){width:calc(var(--spacing) * 4)}.group-aria-\[orientation\=horizontal\]\/split-handle\:rotate-90:is(:where(.group\/split-handle)[aria-orientation=horizontal] *){rotate:90deg}.group-aria-\[orientation\=vertical\]\/split-handle\:h-4:is(:where(.group\/split-handle)[aria-orientation=vertical] *){height:calc(var(--spacing) * 4)}.group-aria-\[orientation\=vertical\]\/split-handle\:w-3:is(:where(.group\/split-handle)[aria-orientation=vertical] *){width:calc(var(--spacing) * 3)}.placeholder\:text-muted-foreground::placeholder{color:var(--muted-foreground)}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:inset-y-0:after{content:var(--tw-content);inset-block:calc(var(--spacing) * 0)}.after\:left-1\/2:after{content:var(--tw-content);left:50%}.after\:w-1:after{content:var(--tw-content);width:calc(var(--spacing) * 1)}.after\:-translate-x-1\/2:after{content:var(--tw-content);--tw-translate-x: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.last\:border-0:last-child{border-style:var(--tw-border-style);border-width:0}@media(hover:hover){.hover\:bg-accent:hover,.hover\:bg-accent\/50:hover{background-color:var(--accent)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-accent\/50:hover{background-color:color-mix(in oklab,var(--accent) 50%,transparent)}}.hover\:bg-accent\/80:hover{background-color:var(--accent)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-accent\/80:hover{background-color:color-mix(in oklab,var(--accent) 80%,transparent)}}.hover\:bg-danger-soft:hover,.hover\:bg-danger-soft\/70:hover{background-color:var(--danger-soft)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-danger-soft\/70:hover{background-color:color-mix(in oklab,var(--danger-soft) 70%,transparent)}}.hover\:bg-danger\/90:hover{background-color:var(--danger)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-danger\/90:hover{background-color:color-mix(in oklab,var(--danger) 90%,transparent)}}.hover\:bg-info-soft:hover,.hover\:bg-info-soft\/70:hover{background-color:var(--info-soft)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-info-soft\/70:hover{background-color:color-mix(in oklab,var(--info-soft) 70%,transparent)}}.hover\:bg-info\/90:hover{background-color:var(--info)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-info\/90:hover{background-color:color-mix(in oklab,var(--info) 90%,transparent)}}.hover\:bg-muted-foreground:hover{background-color:var(--muted-foreground)}.hover\:bg-muted\/80:hover{background-color:var(--muted)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-muted\/80:hover{background-color:color-mix(in oklab,var(--muted) 80%,transparent)}}.hover\:bg-primary\/90:hover{background-color:var(--primary)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/90:hover{background-color:color-mix(in oklab,var(--primary) 90%,transparent)}}.hover\:bg-secondary\/80:hover{background-color:var(--secondary)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-secondary\/80:hover{background-color:color-mix(in oklab,var(--secondary) 80%,transparent)}}.hover\:bg-sidebar-accent:hover{background-color:var(--sidebar-accent)}.hover\:bg-success-soft:hover,.hover\:bg-success-soft\/70:hover{background-color:var(--success-soft)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-success-soft\/70:hover{background-color:color-mix(in oklab,var(--success-soft) 70%,transparent)}}.hover\:bg-success\/90:hover{background-color:var(--success)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-success\/90:hover{background-color:color-mix(in oklab,var(--success) 90%,transparent)}}.hover\:bg-warning-soft:hover,.hover\:bg-warning-soft\/70:hover{background-color:var(--warning-soft)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-warning-soft\/70:hover{background-color:color-mix(in oklab,var(--warning-soft) 70%,transparent)}}.hover\:bg-warning\/90:hover{background-color:var(--warning)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-warning\/90:hover{background-color:color-mix(in oklab,var(--warning) 90%,transparent)}}.hover\:text-accent-foreground:hover{color:var(--accent-foreground)}.hover\:text-foreground:hover{color:var(--foreground)}.hover\:text-primary:hover{color:var(--primary)}.hover\:text-sidebar-accent-foreground:hover{color:var(--sidebar-accent-foreground)}.hover\:underline:hover{text-decoration-line:underline}}.focus-visible\:border-ring:focus-visible{border-color:var(--ring)}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-ring:focus-visible,.focus-visible\:ring-ring\/50:focus-visible{--tw-ring-color:var(--ring)}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-ring\/50:focus-visible{--tw-ring-color:color-mix(in oklab, var(--ring) 50%, transparent)}}.focus-visible\:ring-sidebar-ring:focus-visible{--tw-ring-color:var(--sidebar-ring)}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color:var(--background)}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.aria-disabled\:pointer-events-none[aria-disabled=true]{pointer-events:none}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-\[orientation\=horizontal\]\:h-px[aria-orientation=horizontal]{height:1px}.aria-\[orientation\=horizontal\]\:cursor-row-resize[aria-orientation=horizontal]{cursor:row-resize}.aria-\[orientation\=vertical\]\:w-px[aria-orientation=vertical]{width:1px}.aria-\[orientation\=vertical\]\:cursor-col-resize[aria-orientation=vertical]{cursor:col-resize}.data-\[checked\]\:translate-x-4[data-checked]{--tw-translate-x:calc(var(--spacing) * 4);translate:var(--tw-translate-x) var(--tw-translate-y)}.data-\[checked\]\:border-primary[data-checked]{border-color:var(--primary)}.data-\[checked\]\:bg-primary[data-checked]{background-color:var(--primary)}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[ending-style\]\:scale-90[data-ending-style]{--tw-scale-x:90%;--tw-scale-y:90%;--tw-scale-z:90%;scale:var(--tw-scale-x) var(--tw-scale-y)}.data-\[ending-style\]\:scale-95[data-ending-style]{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x) var(--tw-scale-y)}.data-\[ending-style\]\:opacity-0[data-ending-style]{opacity:0}.data-\[highlighted\]\:bg-accent[data-highlighted]{background-color:var(--accent)}.data-\[highlighted\]\:text-accent-foreground[data-highlighted]{color:var(--accent-foreground)}.data-\[selected\]\:bg-background[data-selected]{background-color:var(--background)}.data-\[selected\]\:bg-sidebar-accent[data-selected]{background-color:var(--sidebar-accent)}.data-\[selected\]\:font-medium[data-selected]{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.data-\[selected\]\:text-foreground[data-selected]{color:var(--foreground)}.data-\[selected\]\:text-sidebar-accent-foreground[data-selected]{color:var(--sidebar-accent-foreground)}.data-\[selected\]\:shadow-xs[data-selected]{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.data-\[starting-style\]\:scale-90[data-starting-style]{--tw-scale-x:90%;--tw-scale-y:90%;--tw-scale-z:90%;scale:var(--tw-scale-x) var(--tw-scale-y)}.data-\[starting-style\]\:scale-95[data-starting-style]{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x) var(--tw-scale-y)}.data-\[starting-style\]\:opacity-0[data-starting-style]{opacity:0}@media(min-width:40rem){.sm\:flex-row{flex-direction:row}.sm\:justify-end{justify-content:flex-end}}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:size-3\.5 svg{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.\[\&_svg\]\:size-4 svg{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.\[\&_svg\]\:size-5 svg{width:calc(var(--spacing) * 5);height:calc(var(--spacing) * 5)}.\[\&_svg\]\:h-3\.5 svg{height:calc(var(--spacing) * 3.5)}.\[\&_svg\]\:w-3\.5 svg{width:calc(var(--spacing) * 3.5)}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&\:\:-webkit-search-cancel-button\]\:appearance-none::-webkit-search-cancel-button{appearance:none}}@property --tw-animation-delay{syntax:"*";inherits:false;initial-value:0s}@property --tw-animation-direction{syntax:"*";inherits:false;initial-value:normal}@property --tw-animation-duration{syntax:"*";inherits:false}@property --tw-animation-fill-mode{syntax:"*";inherits:false;initial-value:none}@property --tw-animation-iteration-count{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-translate-y{syntax:"*";inherits:false;initial-value:0}:root{--radius:0;--background:#fff;--foreground:#201f24;--card:#fff;--card-foreground:#201f24;--popover:#fff;--popover-foreground:#201f24;--primary:#8232ff;--primary-foreground:#fff;--secondary:#f9f8fd;--secondary-foreground:#201f24;--muted:#f9f8fd;--muted-foreground:#838289;--accent:#8232ff29;--accent-foreground:#201f24;--danger:#fa7171;--danger-foreground:#201f24;--danger-soft:var(--danger)}@supports (color:color-mix(in lab,red,red)){:root{--danger-soft:color-mix(in srgb, var(--danger) 10%, transparent)}}:root{--success:#15803d;--success-foreground:#fff;--success-soft:#16a34a1f;--warning:#b45309;--warning-foreground:#fff;--warning-soft:#d977061f;--info:#1d4ed8;--info-foreground:#fff;--info-soft:#2563eb1f;--border:#cfced5;--input:#cfced5;--ring:#8232ff;--sidebar:#fff;--sidebar-foreground:#201f24;--sidebar-primary:#8232ff;--sidebar-primary-foreground:#fff;--sidebar-accent:#8232ff29;--sidebar-accent-foreground:#201f24;--sidebar-border:#cfced5;--sidebar-ring:#8232ff}.dark{--background:#201f24;--foreground:#fff;--card:#201f24;--card-foreground:#fff;--popover:#2b2a2f;--popover-foreground:#fff;--primary:#8232ff;--primary-foreground:#fff;--secondary:#2b2a2f;--secondary-foreground:#fff;--muted:#2b2a2f;--muted-foreground:#cfced5;--accent:#8232ff33;--accent-foreground:#fff;--danger:#fa7171;--danger-foreground:#201f24;--danger-soft:var(--danger)}@supports (color:color-mix(in lab,red,red)){.dark{--danger-soft:color-mix(in srgb, var(--danger) 15%, transparent)}}.dark{--success:#4ade80;--success-foreground:#201f24;--success-soft:#22c55e33;--warning:#fbbf24;--warning-foreground:#201f24;--warning-soft:#f59e0b33;--info:#60a5fa;--info-foreground:#201f24;--info-soft:#3b82f633;--border:#424145;--input:#424145;--ring:#8232ff;--sidebar:#201f24;--sidebar-foreground:#fff;--sidebar-primary:#8232ff;--sidebar-primary-foreground:#fff;--sidebar-accent:#8232ff33;--sidebar-accent-foreground:#fff;--sidebar-border:#424145;--sidebar-ring:#8232ff}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-content{syntax:"*";inherits:false;initial-value:""}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const z=require("@rozenite/plugin-bridge"),y=require("react"),v=require("@rozenite/agent-bridge"),w=require("@rozenite/agent-shared"),P=(e,n)=>e?e(n):{valid:!0},O=e=>e.type==="text"?e:e.type==="toggle"?{id:e.id,type:e.type,title:e.title,value:e.value,description:e.description,disabled:e.disabled}:e.type==="button"?{id:e.id,type:e.type,title:e.title,actionLabel:e.actionLabel,description:e.description,disabled:e.disabled}:e.type==="select"?{id:e.id,type:e.type,title:e.title,value:e.value,options:e.options,description:e.description,disabled:e.disabled}:{id:e.id,type:e.type,title:e.title,value:e.value,placeholder:e.placeholder,applyLabel:e.applyLabel,description:e.description,disabled:e.disabled},U=e=>e.map(n=>({id:n.id,title:n.title,description:n.description,items:n.items.map(O)})),A=e=>{const n=new Map;return e.forEach(r=>{r.items.forEach(o=>{const t=`${r.id}:${o.id}`;o.type==="toggle"&&n.set(t,{type:"toggle",validate:o.validate,onUpdate:o.onUpdate}),o.type==="button"&&n.set(t,{type:"button",onPress:o.onPress}),o.type==="select"&&n.set(t,{type:"select",validate:o.validate,onUpdate:o.onUpdate}),o.type==="input"&&n.set(t,{type:"input",validate:o.validate,onUpdate:o.onUpdate})})}),n},T=(e,n)=>`${e}:${n}`,$="@rozenite/controls-plugin",E={listSections:w.defineAgentToolContract({name:"list-sections",description:"List all controls sections with their item IDs, types, and titles. Does not include values — call get-item for that.",inputSchema:{type:"object",properties:{}}}),getItem:w.defineAgentToolContract({name:"get-item",description:"Get full details of a single controls item including its current value. For select items this includes available options.",inputSchema:{type:"object",properties:{sectionId:{type:"string",description:"Section ID."},itemId:{type:"string",description:"Item ID."}},required:["sectionId","itemId"]}}),setValue:w.defineAgentToolContract({name:"set-value",description:"Update the value of a toggle, select, or input item. Runs the validate callback when present. Fails for text (read-only) and button items.",inputSchema:{type:"object",properties:{sectionId:{type:"string",description:"Section ID."},itemId:{type:"string",description:"Item ID."},value:{description:"New value. Boolean for toggle items, string for select/input items."}},required:["sectionId","itemId","value"]}}),pressButton:w.defineAgentToolContract({name:"press-button",description:"Trigger a button item's action. Fails if the item is not a button or is disabled.",inputSchema:{type:"object",properties:{sectionId:{type:"string",description:"Section ID."},itemId:{type:"string",description:"Item ID."}},required:["sectionId","itemId"]}})},R=(e,n,r)=>{const o=e.find(i=>i.id===n);if(!o){const i=e.map(s=>s.id).join(", ");throw new Error(`Section "${n}" not found. Available: ${i||"(none)"}`)}const t=o.items.find(i=>i.id===r);if(!t){const i=o.items.map(s=>s.id).join(", ");throw new Error(`Item "${r}" not found in section "${n}". Available: ${i||"(none)"}`)}return{section:o,item:t}},C=(e,n=!0)=>{v.useRozenitePluginAgentTool({pluginId:$,tool:E.listSections,enabled:n,handler:()=>({sections:e().map(r=>({id:r.id,title:r.title,description:r.description,items:r.items.map(o=>({id:o.id,type:o.type,title:o.title,disabled:"disabled"in o?o.disabled:void 0}))}))})}),v.useRozenitePluginAgentTool({pluginId:$,tool:E.getItem,enabled:n,handler:({sectionId:r,itemId:o})=>{const{item:t}=R(e(),r,o);return t.type==="text"?{sectionId:r,item:{id:t.id,type:t.type,title:t.title,value:t.value,description:t.description}}:t.type==="toggle"?{sectionId:r,item:{id:t.id,type:t.type,title:t.title,value:t.value,description:t.description,disabled:t.disabled}}:t.type==="button"?{sectionId:r,item:{id:t.id,type:t.type,title:t.title,actionLabel:t.actionLabel,description:t.description,disabled:t.disabled}}:t.type==="select"?{sectionId:r,item:{id:t.id,type:t.type,title:t.title,value:t.value,options:t.options,description:t.description,disabled:t.disabled}}:{sectionId:r,item:{id:t.id,type:t.type,title:t.title,value:t.value,placeholder:t.placeholder,applyLabel:t.applyLabel,description:t.description,disabled:t.disabled}}}}),v.useRozenitePluginAgentTool({pluginId:$,tool:E.setValue,enabled:n,handler:async({sectionId:r,itemId:o,value:t})=>{const{item:i}=R(e(),r,o);if(i.type==="text")throw new Error(`Item "${o}" is a read-only text item and cannot be updated.`);if(i.type==="button")throw new Error(`Item "${o}" is a button. Use press-button to trigger its action.`);if(i.disabled)throw new Error(`Item "${o}" is disabled.`);if(i.type==="toggle"){if(typeof t!="boolean")throw new Error(`Expected boolean value for toggle item "${o}".`);if(i.validate){const s=i.validate(t);if(!s.valid)throw new Error(s.message)}return await i.onUpdate(t),{applied:!0,sectionId:r,itemId:o}}if(typeof t!="string")throw new Error(`Expected string value for ${i.type} item "${o}".`);if(i.type==="select"){const s=i.options.map(p=>p.value);if(!s.includes(t))throw new Error(`Invalid option "${t}" for item "${o}". Valid options: ${s.join(", ")}`)}if(i.validate){const s=i.validate(t);if(!s.valid)throw new Error(s.message)}return await i.onUpdate(t),{applied:!0,sectionId:r,itemId:o}}}),v.useRozenitePluginAgentTool({pluginId:$,tool:E.pressButton,enabled:n,handler:async({sectionId:r,itemId:o})=>{const{item:t}=R(e(),r,o);if(t.type!=="button")throw new Error(`Item "${o}" is not a button (type: ${t.type}). Use set-value to update its value.`);if(t.disabled)throw new Error(`Button "${o}" is disabled.`);return await t.onPress(),{pressed:!0,sectionId:r,itemId:o}}})},x={sections:[]},D=(e,n)=>typeof n=="function"?n(e):{...e,...n,sections:[...e.sections,...n.sections]},L=()=>{const e=new Map,n=new Set;let r=0;const o=()=>e.keys().next().value,t=()=>{r+=1,n.forEach(s=>s())},i=s=>{const p=Array.from(e.entries());return s?p.findIndex(([a])=>a===s.id)===-1?[...p,[s.id,s.input]]:p.map(([a,l])=>a===s.id?[a,s.input]:[a,l]):p};return{set(s,p){const f=o();e.set(s,p),f!==o()&&t()},delete(s){e.delete(s),t()},getOptions(s){return i(s).map(([,p])=>p).reduce(D,x)},isOwner(s,p){return i(p)[0]?.[0]===s},getSnapshot(){return r},subscribe(s){return n.add(s),()=>{n.delete(s)}}}},u=L(),m=e=>{const n=z.useRozeniteDevToolsClient({pluginId:"@rozenite/controls-plugin"}),o=y.useRef(Symbol("rozenite-controls")).current,t=y.useSyncExternalStore(u.subscribe,u.getSnapshot,u.getSnapshot);y.useEffect(()=>()=>{u.delete(o)},[o]),y.useEffect(()=>{u.set(o,e)},[e,o]);const i=y.useMemo(()=>u.isOwner(o,{id:o,input:e}),[e,t,o]);return C(()=>u.getOptions().sections,i),y.useEffect(()=>{n&&n.send("snapshot",{type:"snapshot",sections:U(u.getOptions().sections)})},[n,e,t]),y.useEffect(()=>{if(!n||!i)return;const s=async({requestId:a,sectionId:l,itemId:d,value:g})=>{const b=T(l,d),c=A(u.getOptions().sections).get(b);if(!c||c.type==="button"){n.send("update-result",{type:"update-result",requestId:a,sectionId:l,itemId:d,status:"error",message:"Update target not found."});return}try{if(c.type==="toggle"){if(typeof g!="boolean"){n.send("update-result",{type:"update-result",requestId:a,sectionId:l,itemId:d,status:"error",message:"Invalid toggle value."});return}const S=P(c.validate,g);if(!S.valid){n.send("update-result",{type:"update-result",requestId:a,sectionId:l,itemId:d,status:"error",message:S.message});return}await c.onUpdate(g),n.send("update-result",{type:"update-result",requestId:a,sectionId:l,itemId:d,status:"ok"});return}if(typeof g!="string"){n.send("update-result",{type:"update-result",requestId:a,sectionId:l,itemId:d,status:"error",message:`Invalid ${c.type} value.`});return}const h=P(c.validate,g);if(!h.valid){n.send("update-result",{type:"update-result",requestId:a,sectionId:l,itemId:d,status:"error",message:h.message});return}await c.onUpdate(g),n.send("update-result",{type:"update-result",requestId:a,sectionId:l,itemId:d,status:"ok"})}catch(h){console.warn(`[Rozenite] Controls Plugin: Update failed for ${l}/${d}.`,h),n.send("update-result",{type:"update-result",requestId:a,sectionId:l,itemId:d,status:"error",message:"Update failed on the device."})}},p=async({sectionId:a,itemId:l,action:d})=>{if(d!=="press"){console.warn(`[Rozenite] Controls Plugin: Unsupported action "${d}" for ${a}/${l}.`);return}const g=T(a,l),b=A(u.getOptions().sections).get(g);if(!b){console.warn(`[Rozenite] Controls Plugin: Action target not found for ${a}/${l}.`);return}try{if(b.type!=="button"){console.warn(`[Rozenite] Controls Plugin: Invalid press action payload for ${a}/${l}.`);return}await b.onPress()}catch(c){console.warn(`[Rozenite] Controls Plugin: Action failed for ${a}/${l}.`,c)}},f=[n.onMessage("get-snapshot",()=>{n.send("snapshot",{type:"snapshot",sections:U(u.getOptions().sections)})}),n.onMessage("update-request",a=>{s(a)}),n.onMessage("invoke-action",a=>{p(a)})];return()=>{f.forEach(a=>a.remove())}},[n,i]),n};exports.useRozeniteControlsPlugin=m;
|
|
@@ -1,466 +0,0 @@
|
|
|
1
|
-
import { useRozeniteDevToolsClient as x } from "@rozenite/plugin-bridge";
|
|
2
|
-
import { useRef as z, useSyncExternalStore as A, useEffect as h, useMemo as C } from "react";
|
|
3
|
-
import { useRozenitePluginAgentTool as v } from "@rozenite/agent-bridge";
|
|
4
|
-
import { defineAgentToolContract as w } from "@rozenite/agent-shared";
|
|
5
|
-
const U = (t, n) => t ? t(n) : { valid: !0 }, D = (t) => t.type === "text" ? t : t.type === "toggle" ? {
|
|
6
|
-
id: t.id,
|
|
7
|
-
type: t.type,
|
|
8
|
-
title: t.title,
|
|
9
|
-
value: t.value,
|
|
10
|
-
description: t.description,
|
|
11
|
-
disabled: t.disabled
|
|
12
|
-
} : t.type === "button" ? {
|
|
13
|
-
id: t.id,
|
|
14
|
-
type: t.type,
|
|
15
|
-
title: t.title,
|
|
16
|
-
actionLabel: t.actionLabel,
|
|
17
|
-
description: t.description,
|
|
18
|
-
disabled: t.disabled
|
|
19
|
-
} : t.type === "select" ? {
|
|
20
|
-
id: t.id,
|
|
21
|
-
type: t.type,
|
|
22
|
-
title: t.title,
|
|
23
|
-
value: t.value,
|
|
24
|
-
options: t.options,
|
|
25
|
-
description: t.description,
|
|
26
|
-
disabled: t.disabled
|
|
27
|
-
} : {
|
|
28
|
-
id: t.id,
|
|
29
|
-
type: t.type,
|
|
30
|
-
title: t.title,
|
|
31
|
-
value: t.value,
|
|
32
|
-
placeholder: t.placeholder,
|
|
33
|
-
applyLabel: t.applyLabel,
|
|
34
|
-
description: t.description,
|
|
35
|
-
disabled: t.disabled
|
|
36
|
-
}, m = (t) => t.map((n) => ({
|
|
37
|
-
id: n.id,
|
|
38
|
-
title: n.title,
|
|
39
|
-
description: n.description,
|
|
40
|
-
items: n.items.map(D)
|
|
41
|
-
})), O = (t) => {
|
|
42
|
-
const n = /* @__PURE__ */ new Map();
|
|
43
|
-
return t.forEach((r) => {
|
|
44
|
-
r.items.forEach((s) => {
|
|
45
|
-
const e = `${r.id}:${s.id}`;
|
|
46
|
-
s.type === "toggle" && n.set(e, {
|
|
47
|
-
type: "toggle",
|
|
48
|
-
validate: s.validate,
|
|
49
|
-
onUpdate: s.onUpdate
|
|
50
|
-
}), s.type === "button" && n.set(e, {
|
|
51
|
-
type: "button",
|
|
52
|
-
onPress: s.onPress
|
|
53
|
-
}), s.type === "select" && n.set(e, {
|
|
54
|
-
type: "select",
|
|
55
|
-
validate: s.validate,
|
|
56
|
-
onUpdate: s.onUpdate
|
|
57
|
-
}), s.type === "input" && n.set(e, {
|
|
58
|
-
type: "input",
|
|
59
|
-
validate: s.validate,
|
|
60
|
-
onUpdate: s.onUpdate
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
}), n;
|
|
64
|
-
}, P = (t, n) => `${t}:${n}`, $ = "@rozenite/controls-plugin", E = {
|
|
65
|
-
listSections: w({
|
|
66
|
-
name: "list-sections",
|
|
67
|
-
description: "List all controls sections with their item IDs, types, and titles. Does not include values — call get-item for that.",
|
|
68
|
-
inputSchema: { type: "object", properties: {} }
|
|
69
|
-
}),
|
|
70
|
-
getItem: w({
|
|
71
|
-
name: "get-item",
|
|
72
|
-
description: "Get full details of a single controls item including its current value. For select items this includes available options.",
|
|
73
|
-
inputSchema: {
|
|
74
|
-
type: "object",
|
|
75
|
-
properties: {
|
|
76
|
-
sectionId: { type: "string", description: "Section ID." },
|
|
77
|
-
itemId: { type: "string", description: "Item ID." }
|
|
78
|
-
},
|
|
79
|
-
required: ["sectionId", "itemId"]
|
|
80
|
-
}
|
|
81
|
-
}),
|
|
82
|
-
setValue: w({
|
|
83
|
-
name: "set-value",
|
|
84
|
-
description: "Update the value of a toggle, select, or input item. Runs the validate callback when present. Fails for text (read-only) and button items.",
|
|
85
|
-
inputSchema: {
|
|
86
|
-
type: "object",
|
|
87
|
-
properties: {
|
|
88
|
-
sectionId: { type: "string", description: "Section ID." },
|
|
89
|
-
itemId: { type: "string", description: "Item ID." },
|
|
90
|
-
value: {
|
|
91
|
-
description: "New value. Boolean for toggle items, string for select/input items."
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
required: ["sectionId", "itemId", "value"]
|
|
95
|
-
}
|
|
96
|
-
}),
|
|
97
|
-
pressButton: w({
|
|
98
|
-
name: "press-button",
|
|
99
|
-
description: "Trigger a button item's action. Fails if the item is not a button or is disabled.",
|
|
100
|
-
inputSchema: {
|
|
101
|
-
type: "object",
|
|
102
|
-
properties: {
|
|
103
|
-
sectionId: { type: "string", description: "Section ID." },
|
|
104
|
-
itemId: { type: "string", description: "Item ID." }
|
|
105
|
-
},
|
|
106
|
-
required: ["sectionId", "itemId"]
|
|
107
|
-
}
|
|
108
|
-
})
|
|
109
|
-
}, R = (t, n, r) => {
|
|
110
|
-
const s = t.find((i) => i.id === n);
|
|
111
|
-
if (!s) {
|
|
112
|
-
const i = t.map((o) => o.id).join(", ");
|
|
113
|
-
throw new Error(`Section "${n}" not found. Available: ${i || "(none)"}`);
|
|
114
|
-
}
|
|
115
|
-
const e = s.items.find((i) => i.id === r);
|
|
116
|
-
if (!e) {
|
|
117
|
-
const i = s.items.map((o) => o.id).join(", ");
|
|
118
|
-
throw new Error(
|
|
119
|
-
`Item "${r}" not found in section "${n}". Available: ${i || "(none)"}`
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
return { section: s, item: e };
|
|
123
|
-
}, L = (t, n = !0) => {
|
|
124
|
-
v({
|
|
125
|
-
pluginId: $,
|
|
126
|
-
tool: E.listSections,
|
|
127
|
-
enabled: n,
|
|
128
|
-
handler: () => ({
|
|
129
|
-
sections: t().map((r) => ({
|
|
130
|
-
id: r.id,
|
|
131
|
-
title: r.title,
|
|
132
|
-
description: r.description,
|
|
133
|
-
items: r.items.map((s) => ({
|
|
134
|
-
id: s.id,
|
|
135
|
-
type: s.type,
|
|
136
|
-
title: s.title,
|
|
137
|
-
disabled: "disabled" in s ? s.disabled : void 0
|
|
138
|
-
}))
|
|
139
|
-
}))
|
|
140
|
-
})
|
|
141
|
-
}), v({
|
|
142
|
-
pluginId: $,
|
|
143
|
-
tool: E.getItem,
|
|
144
|
-
enabled: n,
|
|
145
|
-
handler: ({ sectionId: r, itemId: s }) => {
|
|
146
|
-
const { item: e } = R(t(), r, s);
|
|
147
|
-
return e.type === "text" ? {
|
|
148
|
-
sectionId: r,
|
|
149
|
-
item: {
|
|
150
|
-
id: e.id,
|
|
151
|
-
type: e.type,
|
|
152
|
-
title: e.title,
|
|
153
|
-
value: e.value,
|
|
154
|
-
description: e.description
|
|
155
|
-
}
|
|
156
|
-
} : e.type === "toggle" ? {
|
|
157
|
-
sectionId: r,
|
|
158
|
-
item: {
|
|
159
|
-
id: e.id,
|
|
160
|
-
type: e.type,
|
|
161
|
-
title: e.title,
|
|
162
|
-
value: e.value,
|
|
163
|
-
description: e.description,
|
|
164
|
-
disabled: e.disabled
|
|
165
|
-
}
|
|
166
|
-
} : e.type === "button" ? {
|
|
167
|
-
sectionId: r,
|
|
168
|
-
item: {
|
|
169
|
-
id: e.id,
|
|
170
|
-
type: e.type,
|
|
171
|
-
title: e.title,
|
|
172
|
-
actionLabel: e.actionLabel,
|
|
173
|
-
description: e.description,
|
|
174
|
-
disabled: e.disabled
|
|
175
|
-
}
|
|
176
|
-
} : e.type === "select" ? {
|
|
177
|
-
sectionId: r,
|
|
178
|
-
item: {
|
|
179
|
-
id: e.id,
|
|
180
|
-
type: e.type,
|
|
181
|
-
title: e.title,
|
|
182
|
-
value: e.value,
|
|
183
|
-
options: e.options,
|
|
184
|
-
description: e.description,
|
|
185
|
-
disabled: e.disabled
|
|
186
|
-
}
|
|
187
|
-
} : {
|
|
188
|
-
sectionId: r,
|
|
189
|
-
item: {
|
|
190
|
-
id: e.id,
|
|
191
|
-
type: e.type,
|
|
192
|
-
title: e.title,
|
|
193
|
-
value: e.value,
|
|
194
|
-
placeholder: e.placeholder,
|
|
195
|
-
applyLabel: e.applyLabel,
|
|
196
|
-
description: e.description,
|
|
197
|
-
disabled: e.disabled
|
|
198
|
-
}
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
}), v({
|
|
202
|
-
pluginId: $,
|
|
203
|
-
tool: E.setValue,
|
|
204
|
-
enabled: n,
|
|
205
|
-
handler: async ({ sectionId: r, itemId: s, value: e }) => {
|
|
206
|
-
const { item: i } = R(t(), r, s);
|
|
207
|
-
if (i.type === "text")
|
|
208
|
-
throw new Error(`Item "${s}" is a read-only text item and cannot be updated.`);
|
|
209
|
-
if (i.type === "button")
|
|
210
|
-
throw new Error(`Item "${s}" is a button. Use press-button to trigger its action.`);
|
|
211
|
-
if (i.disabled)
|
|
212
|
-
throw new Error(`Item "${s}" is disabled.`);
|
|
213
|
-
if (i.type === "toggle") {
|
|
214
|
-
if (typeof e != "boolean")
|
|
215
|
-
throw new Error(`Expected boolean value for toggle item "${s}".`);
|
|
216
|
-
if (i.validate) {
|
|
217
|
-
const o = i.validate(e);
|
|
218
|
-
if (!o.valid)
|
|
219
|
-
throw new Error(o.message);
|
|
220
|
-
}
|
|
221
|
-
return await i.onUpdate(e), { applied: !0, sectionId: r, itemId: s };
|
|
222
|
-
}
|
|
223
|
-
if (typeof e != "string")
|
|
224
|
-
throw new Error(`Expected string value for ${i.type} item "${s}".`);
|
|
225
|
-
if (i.type === "select") {
|
|
226
|
-
const o = i.options.map((p) => p.value);
|
|
227
|
-
if (!o.includes(e))
|
|
228
|
-
throw new Error(
|
|
229
|
-
`Invalid option "${e}" for item "${s}". Valid options: ${o.join(", ")}`
|
|
230
|
-
);
|
|
231
|
-
}
|
|
232
|
-
if (i.validate) {
|
|
233
|
-
const o = i.validate(e);
|
|
234
|
-
if (!o.valid)
|
|
235
|
-
throw new Error(o.message);
|
|
236
|
-
}
|
|
237
|
-
return await i.onUpdate(e), { applied: !0, sectionId: r, itemId: s };
|
|
238
|
-
}
|
|
239
|
-
}), v({
|
|
240
|
-
pluginId: $,
|
|
241
|
-
tool: E.pressButton,
|
|
242
|
-
enabled: n,
|
|
243
|
-
handler: async ({ sectionId: r, itemId: s }) => {
|
|
244
|
-
const { item: e } = R(t(), r, s);
|
|
245
|
-
if (e.type !== "button")
|
|
246
|
-
throw new Error(
|
|
247
|
-
`Item "${s}" is not a button (type: ${e.type}). Use set-value to update its value.`
|
|
248
|
-
);
|
|
249
|
-
if (e.disabled)
|
|
250
|
-
throw new Error(`Button "${s}" is disabled.`);
|
|
251
|
-
return await e.onPress(), { pressed: !0, sectionId: r, itemId: s };
|
|
252
|
-
}
|
|
253
|
-
});
|
|
254
|
-
}, T = {
|
|
255
|
-
sections: []
|
|
256
|
-
}, k = (t, n) => typeof n == "function" ? n(t) : {
|
|
257
|
-
...t,
|
|
258
|
-
...n,
|
|
259
|
-
sections: [...t.sections, ...n.sections]
|
|
260
|
-
}, j = () => {
|
|
261
|
-
const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set();
|
|
262
|
-
let r = 0;
|
|
263
|
-
const s = () => t.keys().next().value, e = () => {
|
|
264
|
-
r += 1, n.forEach((o) => o());
|
|
265
|
-
}, i = (o) => {
|
|
266
|
-
const p = Array.from(t.entries());
|
|
267
|
-
return o ? p.findIndex(([a]) => a === o.id) === -1 ? [...p, [o.id, o.input]] : p.map(
|
|
268
|
-
([a, l]) => a === o.id ? [a, o.input] : [a, l]
|
|
269
|
-
) : p;
|
|
270
|
-
};
|
|
271
|
-
return {
|
|
272
|
-
set(o, p) {
|
|
273
|
-
const g = s();
|
|
274
|
-
t.set(o, p), g !== s() && e();
|
|
275
|
-
},
|
|
276
|
-
delete(o) {
|
|
277
|
-
t.delete(o), e();
|
|
278
|
-
},
|
|
279
|
-
getOptions(o) {
|
|
280
|
-
return i(o).map(([, p]) => p).reduce(k, T);
|
|
281
|
-
},
|
|
282
|
-
isOwner(o, p) {
|
|
283
|
-
return i(p)[0]?.[0] === o;
|
|
284
|
-
},
|
|
285
|
-
getSnapshot() {
|
|
286
|
-
return r;
|
|
287
|
-
},
|
|
288
|
-
subscribe(o) {
|
|
289
|
-
return n.add(o), () => {
|
|
290
|
-
n.delete(o);
|
|
291
|
-
};
|
|
292
|
-
}
|
|
293
|
-
};
|
|
294
|
-
}, u = j(), _ = (t) => {
|
|
295
|
-
const n = x({
|
|
296
|
-
pluginId: "@rozenite/controls-plugin"
|
|
297
|
-
}), s = z(/* @__PURE__ */ Symbol("rozenite-controls")).current, e = A(
|
|
298
|
-
u.subscribe,
|
|
299
|
-
u.getSnapshot,
|
|
300
|
-
u.getSnapshot
|
|
301
|
-
);
|
|
302
|
-
h(() => () => {
|
|
303
|
-
u.delete(s);
|
|
304
|
-
}, [s]), h(() => {
|
|
305
|
-
u.set(s, t);
|
|
306
|
-
}, [t, s]);
|
|
307
|
-
const i = C(
|
|
308
|
-
() => u.isOwner(s, {
|
|
309
|
-
id: s,
|
|
310
|
-
input: t
|
|
311
|
-
}),
|
|
312
|
-
[t, e, s]
|
|
313
|
-
);
|
|
314
|
-
return L(() => u.getOptions().sections, i), h(() => {
|
|
315
|
-
n && n.send("snapshot", {
|
|
316
|
-
type: "snapshot",
|
|
317
|
-
sections: m(u.getOptions().sections)
|
|
318
|
-
});
|
|
319
|
-
}, [n, t, e]), h(() => {
|
|
320
|
-
if (!n || !i)
|
|
321
|
-
return;
|
|
322
|
-
const o = async ({
|
|
323
|
-
requestId: a,
|
|
324
|
-
sectionId: l,
|
|
325
|
-
itemId: d,
|
|
326
|
-
value: y
|
|
327
|
-
}) => {
|
|
328
|
-
const f = P(l, d), c = O(u.getOptions().sections).get(f);
|
|
329
|
-
if (!c || c.type === "button") {
|
|
330
|
-
n.send("update-result", {
|
|
331
|
-
type: "update-result",
|
|
332
|
-
requestId: a,
|
|
333
|
-
sectionId: l,
|
|
334
|
-
itemId: d,
|
|
335
|
-
status: "error",
|
|
336
|
-
message: "Update target not found."
|
|
337
|
-
});
|
|
338
|
-
return;
|
|
339
|
-
}
|
|
340
|
-
try {
|
|
341
|
-
if (c.type === "toggle") {
|
|
342
|
-
if (typeof y != "boolean") {
|
|
343
|
-
n.send("update-result", {
|
|
344
|
-
type: "update-result",
|
|
345
|
-
requestId: a,
|
|
346
|
-
sectionId: l,
|
|
347
|
-
itemId: d,
|
|
348
|
-
status: "error",
|
|
349
|
-
message: "Invalid toggle value."
|
|
350
|
-
});
|
|
351
|
-
return;
|
|
352
|
-
}
|
|
353
|
-
const S = U(c.validate, y);
|
|
354
|
-
if (!S.valid) {
|
|
355
|
-
n.send("update-result", {
|
|
356
|
-
type: "update-result",
|
|
357
|
-
requestId: a,
|
|
358
|
-
sectionId: l,
|
|
359
|
-
itemId: d,
|
|
360
|
-
status: "error",
|
|
361
|
-
message: S.message
|
|
362
|
-
});
|
|
363
|
-
return;
|
|
364
|
-
}
|
|
365
|
-
await c.onUpdate(y), n.send("update-result", {
|
|
366
|
-
type: "update-result",
|
|
367
|
-
requestId: a,
|
|
368
|
-
sectionId: l,
|
|
369
|
-
itemId: d,
|
|
370
|
-
status: "ok"
|
|
371
|
-
});
|
|
372
|
-
return;
|
|
373
|
-
}
|
|
374
|
-
if (typeof y != "string") {
|
|
375
|
-
n.send("update-result", {
|
|
376
|
-
type: "update-result",
|
|
377
|
-
requestId: a,
|
|
378
|
-
sectionId: l,
|
|
379
|
-
itemId: d,
|
|
380
|
-
status: "error",
|
|
381
|
-
message: `Invalid ${c.type} value.`
|
|
382
|
-
});
|
|
383
|
-
return;
|
|
384
|
-
}
|
|
385
|
-
const b = U(c.validate, y);
|
|
386
|
-
if (!b.valid) {
|
|
387
|
-
n.send("update-result", {
|
|
388
|
-
type: "update-result",
|
|
389
|
-
requestId: a,
|
|
390
|
-
sectionId: l,
|
|
391
|
-
itemId: d,
|
|
392
|
-
status: "error",
|
|
393
|
-
message: b.message
|
|
394
|
-
});
|
|
395
|
-
return;
|
|
396
|
-
}
|
|
397
|
-
await c.onUpdate(y), n.send("update-result", {
|
|
398
|
-
type: "update-result",
|
|
399
|
-
requestId: a,
|
|
400
|
-
sectionId: l,
|
|
401
|
-
itemId: d,
|
|
402
|
-
status: "ok"
|
|
403
|
-
});
|
|
404
|
-
} catch (b) {
|
|
405
|
-
console.warn(
|
|
406
|
-
`[Rozenite] Controls Plugin: Update failed for ${l}/${d}.`,
|
|
407
|
-
b
|
|
408
|
-
), n.send("update-result", {
|
|
409
|
-
type: "update-result",
|
|
410
|
-
requestId: a,
|
|
411
|
-
sectionId: l,
|
|
412
|
-
itemId: d,
|
|
413
|
-
status: "error",
|
|
414
|
-
message: "Update failed on the device."
|
|
415
|
-
});
|
|
416
|
-
}
|
|
417
|
-
}, p = async ({ sectionId: a, itemId: l, action: d }) => {
|
|
418
|
-
if (d !== "press") {
|
|
419
|
-
console.warn(
|
|
420
|
-
`[Rozenite] Controls Plugin: Unsupported action "${d}" for ${a}/${l}.`
|
|
421
|
-
);
|
|
422
|
-
return;
|
|
423
|
-
}
|
|
424
|
-
const y = P(a, l), f = O(u.getOptions().sections).get(y);
|
|
425
|
-
if (!f) {
|
|
426
|
-
console.warn(
|
|
427
|
-
`[Rozenite] Controls Plugin: Action target not found for ${a}/${l}.`
|
|
428
|
-
);
|
|
429
|
-
return;
|
|
430
|
-
}
|
|
431
|
-
try {
|
|
432
|
-
if (f.type !== "button") {
|
|
433
|
-
console.warn(
|
|
434
|
-
`[Rozenite] Controls Plugin: Invalid press action payload for ${a}/${l}.`
|
|
435
|
-
);
|
|
436
|
-
return;
|
|
437
|
-
}
|
|
438
|
-
await f.onPress();
|
|
439
|
-
} catch (c) {
|
|
440
|
-
console.warn(
|
|
441
|
-
`[Rozenite] Controls Plugin: Action failed for ${a}/${l}.`,
|
|
442
|
-
c
|
|
443
|
-
);
|
|
444
|
-
}
|
|
445
|
-
}, g = [
|
|
446
|
-
n.onMessage("get-snapshot", () => {
|
|
447
|
-
n.send("snapshot", {
|
|
448
|
-
type: "snapshot",
|
|
449
|
-
sections: m(u.getOptions().sections)
|
|
450
|
-
});
|
|
451
|
-
}),
|
|
452
|
-
n.onMessage("update-request", (a) => {
|
|
453
|
-
o(a);
|
|
454
|
-
}),
|
|
455
|
-
n.onMessage("invoke-action", (a) => {
|
|
456
|
-
p(a);
|
|
457
|
-
})
|
|
458
|
-
];
|
|
459
|
-
return () => {
|
|
460
|
-
g.forEach((a) => a.remove());
|
|
461
|
-
};
|
|
462
|
-
}, [n, i]), n;
|
|
463
|
-
};
|
|
464
|
-
export {
|
|
465
|
-
_ as useRozeniteControlsPlugin
|
|
466
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=e=>e;exports.useRozeniteControlsPlugin=void 0;const n=process.env.NODE_ENV!=="production",t=typeof window>"u";n&&!t?exports.useRozeniteControlsPlugin=require("./chunks/useRozeniteControlsPlugin.require.cjs").useRozeniteControlsPlugin:exports.useRozeniteControlsPlugin=()=>null;exports.createSection=o;
|