@thebase/ui 1.1.7 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +70 -1
- package/README.md +22 -4
- package/bin/create-baseui-app.mjs +28 -2
- package/dist/baseui.apidoc.esm.js +64 -64
- package/dist/baseui.apidoc.min.js +64 -64
- package/dist/baseui.esm.js +42 -61
- package/dist/baseui.i18n.esm.js +2 -0
- package/dist/baseui.i18n.min.js +2 -0
- package/dist/baseui.icons.esm.js +1 -1
- package/dist/baseui.min.css +2 -2
- package/dist/baseui.min.js +61 -61
- package/dist/baseui.pwa.esm.js +71 -9
- package/dist/baseui.registry.json +13 -9
- package/dist/baseui.templates.xml +311 -311
- package/dist/baseui.vite.esm.js +116 -0
- package/dist/runtime/lazy/apidoc.logic.js +20 -0
- package/dist/runtime/milkdown/milkdown-editor.js +1 -1
- package/dist/runtime/milkdown/milkdown-text-editor.js +1 -1
- package/dist/themes/baseui-dark.css +80 -1
- package/dist/themes/baseui-dark.min.css +1 -0
- package/dist/themes/baseui-light.css +81 -1
- package/dist/themes/baseui-light.min.css +1 -0
- package/dist/types/i18n.d.ts +25 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/pwa.d.ts +1 -45
- package/dist/types/vite.d.ts +4 -0
- package/docs/analytics.md +3 -3
- package/docs/base-ui-skill.md +54 -0
- package/docs/blocks.md +1 -1
- package/docs/components/accordion.md +4 -4
- package/docs/components/apidoc.md +1 -1
- package/docs/components/block-viewer.md +1 -1
- package/docs/components/breadcrumb.md +1 -1
- package/docs/components/button.md +1 -1
- package/docs/components/code-editor.md +1 -1
- package/docs/components/data-table.md +2 -2
- package/docs/components/dialog.md +5 -5
- package/docs/components/form.md +29 -29
- package/docs/components/input.md +1 -1
- package/docs/components/markdown.md +1 -1
- package/docs/components/pwa.md +1 -1
- package/docs/components/shell.md +2 -2
- package/docs/components/sidebar.md +16 -16
- package/docs/components/text-editor.md +1 -1
- package/docs/components/theme-button.md +1 -1
- package/docs/components/toast.md +10 -10
- package/docs/components/typography.md +21 -2
- package/docs/i18n.md +119 -0
- package/docs/icons.md +1 -1
- package/docs/installation.md +3 -2
- package/docs/owl-components.md +1 -1
- package/docs/registry.md +1 -0
- package/docs/runtime-api.md +5 -3
- package/docs/theming.md +33 -3
- package/docs/usage-guide.md +23 -6
- package/package.json +13 -1
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import{createHash as y}from"node:crypto";import{existsSync as E,readFileSync as C}from"node:fs";import{fileURLToPath as N}from"node:url";var p=["favicon.ico","favicon-16x16.png","favicon-32x32.png","apple-touch-icon.png","icon-192.png","icon-512.png"],h="/icons/";function k(e){return[{src:`${e}icon-192.png`,sizes:"192x192",type:"image/png",purpose:"any"},{src:`${e}icon-512.png`,sizes:"512x512",type:"image/png",purpose:"any"},{src:`${e}icon-512.png`,sizes:"512x512",type:"image/png",purpose:"maskable"}]}function u(e){let{name:t,shortName:n=t,description:r="",startUrl:o="/",scope:l="/",display:i="standalone",orientation:a="portrait-primary",backgroundColor:c="#ffffff",themeColor:s="#0f172a",lang:g="en",iconsBase:v=h,icons:w=k(v)}=e;return{name:t,short_name:n,description:r,start_url:o,scope:l,display:i,orientation:a,background_color:c,theme_color:s,lang:g,icons:w}}function f(e){return JSON.stringify({version:e})+`
|
|
2
|
+
`}function d({swUrl:e="/sw.js"}={}){return`/** Registers the offline service worker and reloads the page whenever a new app version is deployed. */
|
|
3
|
+
if ("serviceWorker" in navigator) {
|
|
4
|
+
navigator.serviceWorker.addEventListener("message", (event) => {
|
|
5
|
+
if (event.data === "version-changed") location.reload();
|
|
6
|
+
});
|
|
7
|
+
document.addEventListener("visibilitychange", () => {
|
|
8
|
+
if (!document.hidden) navigator.serviceWorker.controller?.postMessage("check-version");
|
|
9
|
+
});
|
|
10
|
+
window.addEventListener("load", () => {
|
|
11
|
+
navigator.serviceWorker.register(${JSON.stringify(e)}).catch((error) => {
|
|
12
|
+
console.error("Service worker registration failed", error);
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
`}function m(e){let{cacheName:t,cdnVersion:n,iconsBase:r=h,manifestUrl:o="/manifest.webmanifest",appFiles:l=[],extraPrecacheUrls:i=[]}=e,a=n?`https://cdn.jsdelivr.net/npm/@thebase/ui@${n}/dist/`:null,c=["/",o,...p.map(s=>`${r}${s}`),...l,...i,...a?["baseui.min.css","baseui.esm.js","baseui.templates.xml"].map(s=>`${a}${s}`):[]];return`const CACHE_NAME = ${JSON.stringify(t)};
|
|
17
|
+
const BASEUI_CDN = ${JSON.stringify(a)};
|
|
18
|
+
|
|
19
|
+
const PRECACHE_URLS = ${JSON.stringify(c,null,2)};
|
|
20
|
+
|
|
21
|
+
/** Last-seen app version lives in its own cache so wiping the app caches never forgets it. */
|
|
22
|
+
const VERSION_CACHE = ${JSON.stringify(t+"-version")};
|
|
23
|
+
const VERSION_URL = new URL("version.json", self.registration.scope).href;
|
|
24
|
+
let pendingCheck = null;
|
|
25
|
+
|
|
26
|
+
/** Re-downloads every app-shell file fresh, so the next page load runs the new code offline too. */
|
|
27
|
+
async function precache() {
|
|
28
|
+
const cache = await caches.open(CACHE_NAME);
|
|
29
|
+
await Promise.all(PRECACHE_URLS.map((url) => cache.add(new Request(url, { cache: "reload" }))));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Asks the server for version.json; when it differs from the last one seen, throws away every
|
|
33
|
+
* cached file, caches the new ones and tells all open pages to reload. */
|
|
34
|
+
async function runVersionCheck() {
|
|
35
|
+
try {
|
|
36
|
+
const response = await fetch(VERSION_URL, { cache: "no-store" });
|
|
37
|
+
if (!response.ok) return;
|
|
38
|
+
const latest = (await response.json()).version;
|
|
39
|
+
const store = await caches.open(VERSION_CACHE);
|
|
40
|
+
const known = await store.match(VERSION_URL);
|
|
41
|
+
const previous = known ? await known.text() : null;
|
|
42
|
+
if (previous === latest) return;
|
|
43
|
+
await store.put(VERSION_URL, new Response(latest));
|
|
44
|
+
if (previous === null) return;
|
|
45
|
+
const names = await caches.keys();
|
|
46
|
+
await Promise.all(names.filter((name) => name !== VERSION_CACHE).map((name) => caches.delete(name)));
|
|
47
|
+
await precache();
|
|
48
|
+
const pages = await self.clients.matchAll({ type: "window" });
|
|
49
|
+
pages.forEach((page) => page.postMessage("version-changed"));
|
|
50
|
+
} catch {
|
|
51
|
+
// Offline or server hiccup: keep the current cached app and try again on the next check.
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Runs one version check at a time, so a burst of page loads shares a single request. */
|
|
56
|
+
function checkVersion() {
|
|
57
|
+
pendingCheck ??= runVersionCheck().finally(() => {
|
|
58
|
+
pendingCheck = null;
|
|
59
|
+
});
|
|
60
|
+
return pendingCheck;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
self.addEventListener("message", (event) => {
|
|
64
|
+
if (event.data === "check-version") event.waitUntil(checkVersion());
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
self.addEventListener("install", (event) => {
|
|
68
|
+
event.waitUntil(precache().then(() => self.skipWaiting()));
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
self.addEventListener("activate", (event) => {
|
|
72
|
+
event.waitUntil(
|
|
73
|
+
caches
|
|
74
|
+
.keys()
|
|
75
|
+
.then((keys) => Promise.all(keys.filter((key) => key !== CACHE_NAME && key !== VERSION_CACHE).map((key) => caches.delete(key))))
|
|
76
|
+
.then(() => self.clients.claim())
|
|
77
|
+
.then(checkVersion)
|
|
78
|
+
);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
async function fromCdnCache(request) {
|
|
82
|
+
const cache = await caches.open(CACHE_NAME);
|
|
83
|
+
const cached = await cache.match(request);
|
|
84
|
+
if (cached) return cached;
|
|
85
|
+
const response = await fetch(request);
|
|
86
|
+
if (response.ok) cache.put(request, response.clone());
|
|
87
|
+
return response;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
self.addEventListener("fetch", (event) => {
|
|
91
|
+
const { request } = event;
|
|
92
|
+
if (request.method !== "GET") return;
|
|
93
|
+
if (BASEUI_CDN && request.url.startsWith(BASEUI_CDN)) {
|
|
94
|
+
event.respondWith(fromCdnCache(request));
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if (new URL(request.url).origin !== self.location.origin) return;
|
|
98
|
+
if (request.url === VERSION_URL) return;
|
|
99
|
+
if (request.mode === "navigate") event.waitUntil(checkVersion());
|
|
100
|
+
|
|
101
|
+
event.respondWith(
|
|
102
|
+
caches.open(CACHE_NAME).then(async (cache) => {
|
|
103
|
+
try {
|
|
104
|
+
const response = await fetch(request);
|
|
105
|
+
if (response.ok) cache.put(request, response.clone());
|
|
106
|
+
return response;
|
|
107
|
+
} catch {
|
|
108
|
+
const cached = await cache.match(request);
|
|
109
|
+
if (cached) return cached;
|
|
110
|
+
throw new Error(\`No cached response for \${request.url} and network unavailable\`);
|
|
111
|
+
}
|
|
112
|
+
})
|
|
113
|
+
);
|
|
114
|
+
});
|
|
115
|
+
`}function S(e){let t=y("sha256");for(let n of Object.keys(e).sort()){let r=e[n];t.update(n).update(r.type==="chunk"?r.code:r.source)}return t.digest("hex").slice(0,12)}function R(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"app"}var _=N(new URL(E(new URL("./pwa-icons/",import.meta.url))?"./pwa-icons/":"../../pwa-icons/",import.meta.url));function I({name:e="Base UI App",cdnVersion:t,...n}={}){let r=R(e),o=n.themeColor??"#0f172a";return{name:"baseui-pwa",apply:"build",transformIndexHtml:()=>[{tag:"link",attrs:{rel:"manifest",href:"/manifest.webmanifest"},injectTo:"head"},{tag:"link",attrs:{rel:"apple-touch-icon",href:"/icons/apple-touch-icon.png"},injectTo:"head"},{tag:"meta",attrs:{name:"theme-color",content:o},injectTo:"head"},{tag:"script",attrs:{type:"module",src:"/sw-register.js"},injectTo:"body"}],generateBundle(l,i){let a=Object.keys(i).map(s=>`/${s}`),c=S(i);this.emitFile({type:"asset",fileName:"manifest.webmanifest",source:JSON.stringify(u({name:e,...n}),null,2)+`
|
|
116
|
+
`}),this.emitFile({type:"asset",fileName:"sw.js",source:m({cacheName:`${r}-cache-v1`,cdnVersion:t,appFiles:a})}),this.emitFile({type:"asset",fileName:"sw-register.js",source:d()}),this.emitFile({type:"asset",fileName:"version.json",source:f(c)});for(let s of p)this.emitFile({type:"asset",fileName:`icons/${s}`,source:C(`${_}${s}`)})}}}export{I as baseuiPwa};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
var v=["get","post","put","patch","delete","options","head","trace","query"];function M(e,o,r){let t=String(e||"").trim();if(!t)return"";let n=t.replace(/\{([^}]+)\}/g,(a,h)=>{let m=r&&typeof r=="object"?r[h]:null;return m&&m.default!==void 0?String(m.default):`{${h}}`});try{return new URL(n,`${o}/`).href.replace(/\/$/,"")}catch{return n.replace(/\/$/,"")}}function y(e,o){if(e&&typeof e=="object"&&typeof e.$ref=="string"){let r=e.$ref.replace(/^#\//,"").split("/"),t=o;for(let n of r)t=t?.[decodeURIComponent(n.replace(/~1/g,"/").replace(/~0/g,"~"))];return t?{...t}:{}}return e}function A(e,o){if(!Array.isArray(e?.allOf))return e;let r={...e,properties:{...e.properties},required:[...e.required||[]]};delete r.allOf;for(let t of e.allOf){let n=A(y(t,o),o)||{};Object.assign(r.properties,n.properties),r.required.push(...n.required||[]),r.type||(r.type=n.type)}return r}function B(e,o){if(!e)return null;let r=y(e,o);return!r||typeof r!="object"?null:r}function U(e){return e&&typeof e.$ref=="string"?e.$ref.split("/").pop():null}function P(e,o){if(!e||typeof e!="object")return null;for(let[r,t]of Object.entries(e)){let n=B(t,o);if(n){if(n.dataValue!==void 0)return{key:r,label:n.summary||r,value:n.dataValue,isAuto:!1};if(n.serializedValue!==void 0)return{key:r,label:n.summary||r,value:n.serializedValue,isAuto:!1};if(n.value!==void 0)return{key:r,label:n.summary||r,value:n.value,isAuto:!1};if(n.externalValue)return{key:r,label:n.summary||r,value:n.externalValue,isAuto:!1}}}return null}function N(e){if(e){if(e.example!==void 0)return e.example;if(e.default!==void 0)return e.default;if(Array.isArray(e.enum)&&e.enum.length)return e.enum[0]}}function E(e,o){if(!e)return null;let r=P(e.examples,o);if(r)return r;if(e.example!==void 0)return{label:"media example",value:e.example,isAuto:!1};let t=y(e.schema,o),n=N(t);return n!==void 0?{label:"schema example",value:n,isAuto:!1}:null}function $(e,o){let r=P(e.examples,o);if(r)return r;if(e.example!==void 0)return{label:"example",value:e.example,isAuto:!1};let t=y(e.schema,o),n=N(t);return n!==void 0?{label:"schema example",value:n,isAuto:!1}:null}function x(e,o,r=new Set){if(!e)return null;let t=U(e);if(t){if(r.has(t))return{};r=new Set(r).add(t)}let n=A(y(e,o),o);if(!n)return null;let a=N(n);if(a!==void 0)return a;if(n.type==="array"||n.items)return[x(n.items||{},o,r)];if(n.properties||n.type==="object"){let h={};for(let[m,i]of Object.entries(n.properties||{}))h[m]=x(i,o,r);return h}switch(n.type){case"integer":return n.minimum??0;case"number":return n.minimum??0;case"boolean":return!0;case"string":return n.format==="date-time"?new Date().toISOString():n.format==="date"?new Date().toISOString().slice(0,10):n.format==="byte"?"base64==":n.title||"string";default:return null}}function j(e,o,{depth:r=0,prefix:t="",seen:n=new Set,required:a=!1,selfRow:h=!0}={}){if(!e||r>4)return[];let m=U(e);if(m){if(n.has(m))return[];n=new Set(n).add(m)}let i=A(y(e,o),o),l=[],p=i.contentMediaType||i.contentEncoding?[i.contentMediaType,i.contentEncoding&&`encoding:${i.contentEncoding}`].filter(Boolean).join(", "):"",d=i.discriminator?.propertyName?`discriminator: ${i.discriminator.propertyName}`:"";if(Array.isArray(i.prefixItems))return h&&l.push({path:t||"items",type:"tuple",required:a,description:i.description||""}),i.prefixItems.forEach((f,g)=>{l.push(...j(f,o,{depth:r+1,prefix:`${t}[${g}]`,seen:n,required:!1}))}),i.items&&l.push(...j(i.items,o,{depth:r+1,prefix:`${t}[n]`,seen:n,required:!1})),l;if(i.type==="array"||i.items)return h&&l.push({path:t||"items",type:"array",required:a,description:i.description||""}),l.push(...j(i.items||{},o,{depth:r+1,prefix:`${t}[]`,seen:n,required:!1})),l;if(i.properties||i.type==="object"||i.patternProperties){let f=new Set(i.required||[]);for(let[g,s]of Object.entries(i.properties||{})){let c=y(s,o),S=t?`${t}.${g}`:g;l.push({path:S,type:c.type||(c.$ref?U(s):"any")||"any",format:c.format||"",enum:c.enum,required:f.has(g),description:c.description||""}),(c.type==="object"||c.properties||c.type==="array"||c.items)&&l.push(...j(s,o,{depth:r+1,prefix:S,seen:n,required:f.has(g),selfRow:!1}))}for(let[g,s]of Object.entries(i.patternProperties||{})){let c=y(s,o);l.push({path:t?`${t}.<${g}>`:`<${g}>`,type:c.type||"any",format:c.format||"",required:!1,description:c.description||""})}return l}return l.push({path:t||"value",type:i.type||"any",format:i.format||"",enum:i.enum,required:a,description:[i.description,p,d].filter(Boolean).join(" \u2014 ")}),l}function z(e){let o=$(e,this);return{name:e.name,in:e.in,required:!!e.required,type:e.type||e.schema?.type||"string",format:e.format||e.schema?.format||"",description:e.description||"",default:e.default??e.schema?.default,enum:e.enum||e.schema?.enum,example:o?o.value:void 0,exampleLabel:o?o.label:""}}var F={authorizationCode:"accessCode",implicit:"implicit",password:"password",clientCredentials:"application"};function V(e){if(e.type==="http")return{...e,type:String(e.scheme).toLowerCase()==="basic"?"basic":"bearer"};if(e.type==="openIdConnect")return{...e,type:"bearer",oauth2MetadataUrl:e.openIdConnectUrl};if(e.type!=="oauth2"||!e.flows)return e;let[o,r]=Object.entries(e.flows)[0]||[];return{...e,...r,flow:F[o]||o,scopes:r?.scopes||{}}}function k(e){let o=e.securityDefinitions||e.components?.securitySchemes||{};return Object.fromEntries(Object.entries(o).map(([r,t])=>[r,V(y(t,e))]))}function W(e,o){let r=k(o),t=e.security||o.security||[],n=[];for(let a of t)for(let h of Object.keys(a)){let m=r[h];m&&n.push({key:h,...m})}return n}function O(e,o,r,t){let n={path:[],query:[],header:[],formData:[],body:null};for(let l of t.parameters||[]){let p=y(l,e);if(p.in==="body"){let d={schema:p.schema},f=E(d,e);n.body={required:!!p.required,schema:p.schema,description:p.description||"",contentType:"application/json",example:f?f.value:x(p.schema,e),exampleLabel:f?f.label:"auto",exampleIsAuto:!f}}else n[p.in]&&n[p.in].push(z.call(e,p))}if(t.requestBody){let l=y(t.requestBody,e)||{},[p,d]=Object.entries(l.content||{})[0]||[];if(p&&d){let f=E(d,e);n.body={required:!!l.required,schema:d.schema||null,description:l.description||"",contentType:p,encoding:d.encoding||null,itemSchema:d.itemSchema||null,example:f?f.value:x(d.schema,e),exampleLabel:f?f.label:"auto",exampleIsAuto:!f}}}let a=Object.entries(t.responses||{}).map(([l,p])=>{let d=y(p,e)||{},[f,g]=Object.entries(d.content||{})[0]||[],s=g?E(g,e):null;return{status:l,summary:d.summary||"",description:d.description||"",contentType:f||"application/json",schema:g?.schema||d.schema||null,encoding:g?.encoding||null,headers:G(d.headers,e),links:J(d.links,e),example:s?s.value:g?.schema?x(g.schema,e):null,exampleLabel:s?s.label:"auto",exampleIsAuto:!s&&!!g?.schema}}).sort((l,p)=>{let d=_(l.status),f=_(p.status);return d-f}),h=Q(t.callbacks,e),m=r.toUpperCase();return{id:(t.operationId||`${r}-${o}`).replace(/[^a-zA-Z0-9]+/g,"-").replace(/^-+|-+$/g,"").toLowerCase(),method:m,path:o,tag:t.tags&&t.tags[0]||"default",summary:t.summary||t.operationId||`${m} ${o}`,description:t.description||"",deprecated:!!t.deprecated,produces:t.produces||e.produces||["application/json"],consumes:t.consumes||e.consumes||(n.body?["application/json"]:[]),parameters:n,responses:a,callbacks:h,externalDocs:t.externalDocs||null,security:W(t,e)}}function G(e,o){return!e||typeof e!="object"?[]:Object.entries(e).map(([r,t])=>{let n=y(t,o)||{},a=$({...n,in:"header"},o);return{name:r,required:!!n.required,deprecated:!!n.deprecated,type:n.schema?.type||"string",description:n.description||"",example:a?a.value:void 0}})}function J(e,o){return!e||typeof e!="object"?[]:Object.entries(e).map(([r,t])=>{let n=y(t,o)||{};return{name:r,operationId:n.operationId||"",operationRef:n.operationRef||"",description:n.description||"",parameters:n.parameters||{}}})}function Q(e,o){if(!e||typeof e!="object")return[];let r=[];for(let[t,n]of Object.entries(e)){let a=y(n,o)||{};for(let[h,m]of Object.entries(a)){let i=y(m,o)||{};for(let l of v)i[l]&&r.push({name:t,expression:h,method:l.toUpperCase(),summary:i[l].summary||"",description:i[l].description||""})}}return r}function _(e){if(e==="default")return 999;let o=parseInt(e,10);return Number.isNaN(o)?998:o}async function K(e,o=""){let r=await fetch(e);if(!r.ok)throw new Error(`Failed to fetch spec: HTTP ${r.status}`);return H(await r.json(),o)}function H(e,o=""){if(!e||typeof e!="object"||!e.paths&&!e.webhooks)throw new Error("Not an OpenAPI document (missing paths).");let r=e.schemes&&e.schemes.includes("https")?"https":e.schemes?.[0]||"https",t=e.host||location.host,n=e.basePath||"",a=`${r}://${t}${n}`.replace(/\/$/,""),h=o?[{name:"",url:o.replace(/\/$/,""),description:""}]:Array.isArray(e.servers)&&e.servers.length?e.servers.map(s=>({name:s?.name||"",url:M(s?.url,a,s?.variables),description:String(s?.description||"").trim()})).filter(s=>s.url):[{name:"",url:a,description:""}],m=h[0]?.url||a,i=(e.tags||[]).map(s=>s.name),l=new Map((e.tags||[]).map(s=>[s.name,s])),p=[];for(let[s,c]of Object.entries(e.paths||{})){let S=y(c,e)||{};for(let T of v)S[T]&&p.push(O(e,s,T,S[T]));for(let[T,D]of Object.entries(S.additionalOperations||{}))p.push(O(e,s,T.toLowerCase(),D))}let d=[];for(let[s,c]of Object.entries(e.webhooks||{})){let S=y(c,e)||{};for(let T of v)S[T]&&d.push(O(e,s,T,S[T]))}let g=[...new Set([...i,...p.map(s=>s.tag)])].map(s=>{let c=l.get(s);return{id:s.replace(/[^a-zA-Z0-9]+/g,"-").toLowerCase(),name:s,summary:c?.summary||"",description:c?.description||"",parent:c?.parent||"",kind:c?.kind||"",items:p.filter(S=>S.tag===s)}}).filter(s=>s.items.length);return{spec:e,info:e.info||{},baseUrl:m,derivedBaseUrl:a,servers:h,securityDefinitions:k(e),groups:g,webhooks:d,resolveRef:s=>y(s,e),generateExample:s=>x(s,e),schemaRows:s=>j(s,e),findOperation:s=>p.find(c=>c.id===s)||d.find(c=>c.id===s),firstOperation:()=>p[0]}}var q=[{id:"curl",label:"CURL",icon:"img/bash-plain.svg"},{id:"csharp",label:"CSHARP",icon:"img/csharp-original.svg"},{id:"go",label:"GO",icon:"img/go-original-wordmark.svg"},{id:"node",label:"NODEJS",icon:"img/nodejs-original.svg"},{id:"ruby",label:"RUBY",icon:"img/ruby-plain.svg"},{id:"php",label:"PHP",icon:"img/php-original.svg"},{id:"javascript",label:"JAVASCRIPT",icon:"img/javascript-original.svg"},{id:"python",label:"PYTHON",icon:"img/python-original.svg"},{id:"java",label:"JAVA",icon:"img/java-original.svg"},{id:"c",label:"C",icon:"img/c-original.svg"},{id:"swift",label:"SWIFT",icon:"img/swift-original.svg"},{id:"objc",label:"OBJECTIVE-C",icon:"img/objectivec-plain.svg"},{id:"kotlin",label:"KOTLIN",icon:"img/kotlin-original.svg"},{id:"rust",label:"RUST",icon:"img/rust-original.svg"},{id:"powershell",label:"POWERSHELL",icon:"img/windows8-original.svg"},{id:"dart",label:"DART",icon:"img/dart-original.svg"},{id:"lua",label:"LUA",icon:"img/lua.svg"}];function Y(e){let o=new URL(e.url);return(e.query||[]).forEach(([r,t])=>{r&&o.searchParams.set(r,String(t||""))}),o.toString()}function Z(e,o){let r=[];return(e.headers||[]).forEach(([n,a])=>{n&&r.push([n,String(a??"")])}),o&&e.bodyText&&!X(r,"Content-Type")&&r.push(["Content-Type",e.mimeType||"application/json"]),r}function X(e,o){let r=o.toLowerCase();return e.some(function(t){return String(t[0]||"").toLowerCase()===r})}function ee(e,o){return String(e||"").split(`
|
|
2
|
+
`).map(function(r){return o+r}).join(`
|
|
3
|
+
`)}function b(e){return String(e).replace(/\\/g,"\\\\").replace(/'/g,"\\'")}function u(e){return String(e).replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function te(e){return String(e).replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}function ne(e){return String(e).replace(/`/g,'` + "`" + `')}function re(e){return String(e).replace(/\\/g,"\\\\").replace(/"""/g,'\\"\\"\\"')}function w(e){return String(e).replace(/\\/g,"\\\\").replace(/'/g,"\\'")}function R(e){return String(e).replace(/\\/g,"\\\\").replace(/'/g,"\\\\'")}function C(e){return String(e).replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\r/g,"\\r").replace(/\n/g,"\\n")}function L(e){return String(e).replace(/`/g,"``").replace(/"/g,'`"')}function oe(e){return String(e).replace(/\]=\]/g,']==] .. "]=" .. [=[')}function se(e,o){let r=o&&o.quote==="double"?'"':"'";return e.map(function(n){let a=r==='"'?u(n[0]):b(n[0]),h=r==='"'?u(n[1]):b(n[1]);return r+a+r+": "+r+h+r}).join(`,
|
|
4
|
+
`)}function ie(e,o,r){let t=["curl --request "+e.method];return r.forEach(function(n){t.push("--header '"+b(n[0]+": "+n[1])+"'")}),e.bodyText&&t.push("--data '"+b(e.bodyText)+"'"),t.push("'"+b(o)+"'"),t.join(` \\
|
|
5
|
+
`)}function I(e,o,r){let t=["const url = '"+b(o)+"';","const options = {"," method: '"+b(e.method)+"',"];return r.length&&(t.push(" headers: {"),t.push(ee(se(r)," ")),t.push(" },")),e.bodyText&&t.push(" body: `"+te(e.bodyText)+"`,"),t.push("};","","const response = await fetch(url, options);","const data = await response.text();","console.log(response.status, data);"),t.join(`
|
|
6
|
+
`)}function ae(e,o,r){return I(e,o,r)}function ue(e,o,r){let t=["import requests","","url = '"+b(o)+"'"];return r.length?(t.push("headers = {"),r.forEach(function(n){t.push(" '"+b(n[0])+"': '"+b(n[1])+"',")}),t.push("}")):t.push("headers = {}"),e.bodyText?(t.push("",'payload = """'+re(e.bodyText)+'"""'),t.push("response = requests.request('"+b(e.method)+"', url, headers=headers, data=payload)")):t.push("","response = requests.request('"+b(e.method)+"', url, headers=headers)"),t.push("print(response.status_code)","print(response.text)"),t.join(`
|
|
7
|
+
`)}function le(e,o,r){let t=["package main","","import (",' "fmt"',' "io"',' "net/http"'];return e.bodyText&&t.push(' "strings"'),t.push(")","","func main() {"),e.bodyText?(t.push(" body := strings.NewReader(`"+ne(e.bodyText)+"`)"),t.push(' req, err := http.NewRequest("'+e.method+'", "'+o+'", body)')):t.push(' req, err := http.NewRequest("'+e.method+'", "'+o+'", nil)'),t.push(" if err != nil {"," panic(err)"," }"),r.forEach(function(n){t.push(' req.Header.Set("'+u(n[0])+'", "'+u(n[1])+'")')}),t.push(""," res, err := http.DefaultClient.Do(req)"," if err != nil {"," panic(err)"," }"," defer res.Body.Close()",""," data, err := io.ReadAll(res.Body)"," if err != nil {"," panic(err)"," }",""," fmt.Println(res.StatusCode)"," fmt.Println(string(data))","}"),t.join(`
|
|
8
|
+
`)}function ce(e,o,r){let t=["OkHttpClient client = new OkHttpClient();","","Request.Builder builder = new Request.Builder()",' .url("'+u(o)+'")'];return r.forEach(function(n){t.push(' .addHeader("'+u(n[0])+'", "'+u(n[1])+'")')}),e.bodyText?t.push(";","",'MediaType mediaType = MediaType.parse("'+u(e.mimeType||"application/json")+'");','RequestBody body = RequestBody.create("""'+u(e.bodyText)+'""", mediaType);','Request request = builder.method("'+e.method+'", body).build();'):t.push(";","",'Request request = builder.method("'+e.method+'", null).build();'),t.push("","try (Response response = client.newCall(request).execute()) {"," System.out.println(response.code());",' System.out.println(response.body() != null ? response.body().string() : "");',"}"),t.join(`
|
|
9
|
+
`)}function pe(e,o,r){let n=["using var client = new HttpClient();","using var request = new HttpRequestMessage(HttpMethod."+(e.method.charAt(0)+e.method.slice(1).toLowerCase())+', "'+u(o)+'");'];return r.forEach(function(a){n.push('request.Headers.TryAddWithoutValidation("'+u(a[0])+'", "'+u(a[1])+'");')}),e.bodyText&&n.push('request.Content = new StringContent("""'+u(e.bodyText)+'""", Encoding.UTF8, "'+u(e.mimeType||"application/json")+'");'),n.push("","using var response = await client.SendAsync(request);","var body = await response.Content.ReadAsStringAsync();","Console.WriteLine((int)response.StatusCode);","Console.WriteLine(body);"),n.join(`
|
|
10
|
+
`)}function de(e,o,r){let t=["$ch = curl_init();","curl_setopt_array($ch, ["," CURLOPT_URL => '"+w(o)+"',"," CURLOPT_CUSTOMREQUEST => '"+w(e.method)+"',"," CURLOPT_RETURNTRANSFER => true,"];return r.length&&(t.push(" CURLOPT_HTTPHEADER => ["),r.forEach(function(n){t.push(" '"+w(n[0]+": "+n[1])+"',")}),t.push(" ],")),e.bodyText&&t.push(" CURLOPT_POSTFIELDS => '"+w(e.bodyText)+"',"),t.push("]);","","$response = curl_exec($ch);","echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE) . PHP_EOL;","echo $response;","curl_close($ch);"),t.join(`
|
|
11
|
+
`)}function fe(e,o,r){let t=e.method.charAt(0)+e.method.slice(1).toLowerCase(),n=['require "uri"','require "net/http"',"","uri = URI('"+R(o)+"')","http = Net::HTTP.new(uri.host, uri.port)",'http.use_ssl = uri.scheme == "https"',"","request = Net::HTTP::"+t+".new(uri)"];return r.forEach(function(a){n.push("request['"+R(a[0])+"'] = '"+R(a[1])+"'")}),e.bodyText&&n.push("request.body = '"+R(e.bodyText)+"'"),n.push("","response = http.request(request)","puts response.code","puts response.body"),n.join(`
|
|
12
|
+
`)}function he(e,o,r){let t=["#include <curl/curl.h>","","int main(void) {"," CURL *curl = curl_easy_init();"," if (!curl) return 1;",""," struct curl_slist *headers = NULL;"];return r.forEach(function(n){t.push(' headers = curl_slist_append(headers, "'+C(n[0]+": "+n[1])+'");')}),t.push(' curl_easy_setopt(curl, CURLOPT_URL, "'+C(o)+'");'),t.push(' curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "'+C(e.method)+'");'),r.length&&t.push(" curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);"),e.bodyText&&t.push(' curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "'+C(e.bodyText)+'");'),t.push(""," curl_easy_perform(curl);"," curl_slist_free_all(headers);"," curl_easy_cleanup(curl);"," return 0;","}"),t.join(`
|
|
13
|
+
`)}function me(e,o,r){let t=['var request = URLRequest(url: URL(string: "'+u(o)+'")!)','request.httpMethod = "'+u(e.method)+'"'];return r.forEach(function(n){t.push('request.setValue("'+u(n[1])+'", forHTTPHeaderField: "'+u(n[0])+'")')}),e.bodyText&&t.push('request.httpBody = """',e.bodyText,'""".data(using: .utf8)'),t.push("","URLSession.shared.dataTask(with: request) { data, response, error in"," if let error = error {"," print(error)"," return"," }"," let status = (response as? HTTPURLResponse)?.statusCode ?? 0"," print(status)",' print(String(data: data ?? Data(), encoding: .utf8) ?? "")',"}.resume()"),t.join(`
|
|
14
|
+
`)}function ge(e,o,r){let t=['NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"'+u(o)+'"]];','request.HTTPMethod = @"'+u(e.method)+'";'];return r.forEach(function(n){t.push('[request setValue:@"'+u(n[1])+'" forHTTPHeaderField:@"'+u(n[0])+'"];')}),e.bodyText&&t.push('request.HTTPBody = [@"'+u(e.bodyText)+'" dataUsingEncoding:NSUTF8StringEncoding];'),t.push("","NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithRequest:request"," completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {"," if (error) {",' NSLog(@"%@", error);'," return;"," }"," NSInteger status = [(NSHTTPURLResponse *)response statusCode];"," NSString *body = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];",' NSLog(@"%ld", (long)status);',' NSLog(@"%@", body);',"}];","[task resume];"),t.join(`
|
|
15
|
+
`)}function ye(e,o,r){let t=["val client = OkHttpClient()"];return e.bodyText&&t.push('val body = """',e.bodyText,'""".trimIndent().toRequestBody("'+u(e.mimeType||"application/json")+'".toMediaType())'),t.push("val request = Request.Builder()",' .url("'+u(o)+'")'),r.forEach(function(n){t.push(' .addHeader("'+u(n[0])+'", "'+u(n[1])+'")')}),t.push(e.bodyText?' .method("'+e.method+'", body)':' .method("'+e.method+'", null)'," .build()","","client.newCall(request).execute().use { response ->"," println(response.code)"," println(response.body?.string().orEmpty())","}"),t.join(`
|
|
16
|
+
`)}function be(e,o,r){let t=["let client = reqwest::Client::new();","let response = client"," ."+e.method.toLowerCase()+'("'+u(o)+'")'];return r.forEach(function(n){t.push(' .header("'+u(n[0])+'", "'+u(n[1])+'")')}),e.bodyText&&t.push(' .body(r#"'+e.bodyText.replace(/"#/g,'"#""#')+'"#)'),t.push(" .send()"," .await?;","",'println!("{}", response.status());','println!("{}", response.text().await?);'),t.join(`
|
|
17
|
+
`)}function Se(e,o,r){let t=["$headers = @{"];return r.forEach(function(n){t.push(' "'+L(n[0])+'" = "'+L(n[1])+'"')}),t.push("}",""),e.bodyText&&t.push('$body = @"',e.bodyText,'"@',""),t.push("$response = Invoke-RestMethod -Method "+e.method+' -Uri "'+L(o)+'" -Headers $headers'+(e.bodyText?' -Body $body -ContentType "'+L(e.mimeType||"application/json")+'"':""),"$response | ConvertTo-Json -Depth 10"),t.join(`
|
|
18
|
+
`)}function Te(e,o,r){let t=["import 'package:http/http.dart' as http;","","final uri = Uri.parse('"+b(o)+"');","final headers = <String, String>{"];return r.forEach(function(n){t.push(" '"+b(n[0])+"': '"+b(n[1])+"',")}),t.push("};",""),e.bodyText?t.push("final response = await http."+e.method.toLowerCase()+"(uri, headers: headers, body: '''"+e.bodyText.replace(/'''/g,"'' '")+"''');"):t.push("final response = await http."+e.method.toLowerCase()+"(uri, headers: headers);"),t.push("print('Status: ${response.statusCode}');","print(response.body);"),t.join(`
|
|
19
|
+
`)}function xe(e,o,r){let t=['local http = require("socket.http")','local ltn12 = require("ltn12")',"","local response_body = {}","local headers = {"];return r.forEach(function(n){t.push(' ["'+u(n[0])+'"] = "'+u(n[1])+'",')}),t.push("}",""),e.bodyText&&(t.push("local body = [==["+oe(e.bodyText)+"]==]",""),t.push('headers["Content-Length"] = tostring(#body)')),t.push("local _, code = http.request{",' url = "'+u(o)+'",',' method = "'+u(e.method)+'",'," headers = headers,"),e.bodyText&&t.push(" source = ltn12.source.string(body),"),t.push(" sink = ltn12.sink.table(response_body),","}","",'print("Status: " .. tostring(code))',"print(table.concat(response_body))"),t.join(`
|
|
20
|
+
`)}var je={curl:ie,javascript:I,node:ae,python:ue,go:le,java:ce,csharp:pe,php:de,ruby:fe,c:he,swift:me,objc:ge,kotlin:ye,rust:be,powershell:Se,dart:Te,lua:xe};async function we(e,o){let r=q.find(function(a){return a.id===e});if(!r)throw new Error("Unknown language: "+e);let t=Z(o,!0),n=Y(o);return je[r.id](o,n,t)}export{q as LANGUAGES,H as buildOpenApiDoc,we as generateSnippet,K as loadOpenApiDoc};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk-23NN352E.js";async function lt({root:t,value:o="",onChange:e,collaborative:r=!1,room:s="
|
|
1
|
+
import"./chunk-23NN352E.js";async function lt({root:t,value:o="",onChange:e,collaborative:r=!1,room:s="b-markdown",password:i,signaling:m,user:w}={}){if(!t)throw new Error("BaseUI markdown editor: missing root element.");let[C,M,T,U,D,F,I,N,W,x,K,O,R,_]=await Promise.all([import("./core-T2SC7EXQ.js"),import("./commonmark-263P63KC.js"),import("./gfm-IHXC5DQO.js"),import("./history-VOPZ3HXQ.js"),import("./clipboard-5NOA4E34.js"),import("./cursor-Z4UWEH5V.js"),import("./indent-WYLZY3CZ.js"),import("./upload-DA4OHNVQ.js"),import("./block-G2R773CV.js"),import("./tooltip-5CTXOYIA.js"),import("./slash-3TY5YM2E.js"),import("./streaming-S7JA52O3.js"),import("./diff-K3BORLOX.js"),import("./listener-GNT2L5RH.js")]),{Editor:j,defaultValueCtx:L,rootCtx:V}=C,{commonmark:q}=M,{gfm:z}=T,{history:G}=U,{clipboard:H}=D,{cursor:J}=F,{indent:Q}=I,{upload:X}=N,{block:Y,BlockProvider:h}=W,{tooltipFactory:Z,TooltipProvider:$}=x,{slashFactory:tt,SlashProvider:et}=K,{streaming:ot}=O,{diff:rt}=R,{listener:nt,listenerCtx:st}=_,v=Z("BASEUI_MARKDOWN"),S=tt("BASEUI_MARKDOWN"),c=[],a=j.make().config(n=>{n.set(V,t),n.set(L,String(o??"")),n.set(v.key,ct(t,$)),n.set(S.key,at(t,et)),n.get(st).markdownUpdated((f,l,d)=>{l!==d&&e?.(l,d,f)})}).use(q).use(z).use(H).use(J).use(Q).use(X).use(Y).use(v).use(S).use(ot).use(rt).use(nt);if(r){let[{Doc:n},{WebrtcProvider:f},l]=await Promise.all([import("./yjs-H3MVN7TP.js"),import("./y-webrtc-VQGJXSXG.js"),import("./lib-QZEOHNSS.js")]),{collab:d,collabServiceCtx:it}=l,u=new n,g={};i&&(g.password=i),Array.isArray(m)&&m.length&&(g.signaling=m);let p=new f(s,u,g),P=w&&typeof w=="object"?w:{};p.awareness?.setLocalStateField("user",{name:P.name||"Anonymous",color:P.color||"#2563eb",...P}),a.use(d),c.push(()=>p.destroy?.(),()=>u.destroy());let b=await a.create();return b.action(A=>{E(A,t,h,c),A.get(it).bindDoc(u).setAwareness(p.awareness).applyTemplate(String(o??"")).connect()}),{editor:b,provider:p,doc:u,destroy:()=>B(b,c)}}a.use(G);let y=await a.create();return y.action(n=>E(n,t,h,c)),{editor:y,provider:null,doc:null,destroy:()=>B(y,c)}}function k(t,o=""){let e=document.createElement("div");return e.className=t,e.textContent=o,e.setAttribute("aria-hidden","true"),e}function ct(t,o){return{view:e=>{let r=new o({root:t,content:k("b-markdown-editor-tooltip","Markdown tools")});return r.update(e),{update:(s,i)=>r.update(s,i),destroy:()=>r.destroy()}}}}function at(t,o){return{view:e=>{let r=new o({root:t,content:k("b-markdown-editor-slash","Type Markdown syntax")});return r.update(e),{update:(s,i)=>r.update(s,i),destroy:()=>r.destroy()}}}}function E(t,o,e,r){let s=new e({ctx:t,root:o,content:k("b-markdown-editor-block-handle","::")});s.update(),r.push(()=>s.destroy())}function B(t,o){for(let e of o)e();t.destroy()}export{lt as createMilkdownMarkdownEditor};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk-23NN352E.js";var R;function te(){return R??(R=new Promise((n,e)=>{if(document.getElementById("
|
|
1
|
+
import"./chunk-23NN352E.js";var R;function te(){return R??(R=new Promise((n,e)=>{if(document.getElementById("b-text-editor-crepe-theme")){n();return}let o=document.createElement("link");o.id="b-text-editor-crepe-theme",o.rel="stylesheet",o.href=new URL("./theme/common/style.css",import.meta.url).href,o.addEventListener("load",()=>n()),o.addEventListener("error",()=>e(new Error("BaseUI text editor: failed to load Crepe theme CSS."))),document.head.append(o)})),R}async function ce({root:n,value:e="",onChange:o,collaborative:t=!1,providerType:r="webrtc",room:i="b-text-editor",url:a,password:c,signaling:s,user:l,placeholder:m}={}){if(!n)throw new Error("BaseUI text editor: missing root element.");let[{Crepe:h},H,x,T,F,U]=await Promise.all([import("./esm-H2D66MX5.js"),import("./core-T2SC7EXQ.js"),import("./utils-H6AH4ARX.js"),import("./diff-K3BORLOX.js"),import("./streaming-S7JA52O3.js"),import("./lib-32AGHSKT.js"),te()]),{editorViewCtx:k,schemaCtx:D}=H,{getHTML:p}=x,{diff:B,diffPluginKey:I,getPendingChanges:z,startDiffReviewCmd:K,startDiffReviewFromDocCmd:O,acceptAllDiffsCmd:V,acceptDiffChunkCmd:W,acceptDiffRangeCmd:q,rejectDiffChunkCmd:N,rejectDiffRangeCmd:G,clearDiffReviewCmd:J}=T,{streaming:Q,startStreamingCmd:X,pushChunkCmd:Y,endStreamingCmd:Z,abortStreamingCmd:_}=F,{emoji:$}=U,{callCommand:L}=x;n.replaceChildren();let b=document.createElement("div");b.className="b-text-editor-surface",n.append(b);let d=new h({root:b,defaultValue:t?"":{type:"html",dom:y(e)},features:{[h.Feature.Latex]:!1,[h.Feature.AI]:!1},featureConfigs:m?{[h.Feature.Placeholder]:{text:m}}:{}});d.editor.use(B).use(Q).use($);let C="";d.on(S=>{S.updated(w=>{let g=p()(w);if(g!==C){let v=C;C=g,o?.(g,v,w)}})});let A={callCommand:L,editorViewCtx:k,schemaCtx:D,diffPluginKey:I,getPendingChanges:z,startDiffReviewCmd:K,startDiffReviewFromDocCmd:O,acceptAllDiffsCmd:V,acceptDiffChunkCmd:W,acceptDiffRangeCmd:q,rejectDiffChunkCmd:N,rejectDiffRangeCmd:G,clearDiffReviewCmd:J},E={callCommand:L,startStreamingCmd:X,pushChunkCmd:Y,endStreamingCmd:Z,abortStreamingCmd:_},P=[],f=null,u=null;if(t){let[{Doc:S},w]=await Promise.all([import("./yjs-H3MVN7TP.js"),import("./lib-QZEOHNSS.js")]),{collab:g,collabServiceCtx:v}=w;u=new S,f=await ie({providerType:r,ydoc:u,room:i,url:a,password:c,signaling:s}),f.awareness?.setLocalStateField("user",ae(l)),d.editor.use(g),await d.create();let M;return d.editor.action(ee=>{M=ee.get(v).bindDoc(u).setAwareness(f.awareness).applyTemplate({type:"html",dom:y(e)}).connect()}),P.push(()=>M?.disconnect(),()=>f.destroy?.(),()=>u.destroy()),C=d.editor.action(p()),f.connect?.(),j(d,A,E,P,n,f,u,k,p,D)}return await d.create(),C=d.editor.action(p()),j(d,A,E,P,n,f,u,k,p,D)}function y(n){let e=document.createElement("div");return e.innerHTML=String(n||"").trim()||"<p></p>",e}function j(n,e,o,t,r,i,a,c,s,l){return{editor:n.editor,provider:i,doc:a,focus:()=>n.editor.action(m=>m.get(c).focus()),getHTML:()=>n.editor.action(s()),setHTML:m=>ne(n.editor,m,c,l),diff:oe(n.editor,e),streaming:re(n.editor,o),destroy:()=>{for(let m of t)m();n.destroy(),r.replaceChildren()}}}async function ne(n,e,o,t){let{DOMParser:r,Slice:i}=await import("./model-VKXPTJEQ.js");n.action(a=>{let c=a.get(t),s=a.get(o),l=r.fromSchema(c).parse(y(e));s.dispatch(s.state.tr.replace(0,s.state.doc.content.size,new i(l.content,0,0)))})}function oe(n,e){let o=(t,r)=>n.action(e.callCommand(t,r));return{startFromMarkdown:t=>o(e.startDiffReviewCmd.key,t),startFromHTML:async t=>{let{DOMParser:r}=await import("./model-VKXPTJEQ.js"),i=n.action(a=>r.fromSchema(a.get(e.schemaCtx)).parse(y(t)));return o(e.startDiffReviewFromDocCmd.key,i)},acceptAll:()=>o(e.acceptAllDiffsCmd.key),acceptChunk:t=>o(e.acceptDiffChunkCmd.key,t),rejectChunk:t=>o(e.rejectDiffChunkCmd.key,t),acceptRange:t=>o(e.acceptDiffRangeCmd.key,t),rejectRange:t=>o(e.rejectDiffRangeCmd.key,t),clear:()=>o(e.clearDiffReviewCmd.key),getPendingChanges:()=>n.action(t=>{let r=e.diffPluginKey.getState(t.get(e.editorViewCtx).state);return r?e.getPendingChanges(r):[]})}}function re(n,e){let o=(t,r)=>n.action(e.callCommand(t,r));return{start:t=>o(e.startStreamingCmd.key,t),pushChunk:t=>o(e.pushChunkCmd.key,t),end:t=>o(e.endStreamingCmd.key,t),abort:()=>o(e.abortStreamingCmd.key)}}async function ie({providerType:n,ydoc:e,room:o,url:t,password:r,signaling:i}){if(n==="websocket"){if(!t)throw new Error("BaseUI text editor: collaborative websocket mode requires a `url`.");let{WebsocketProvider:l}=await import("./y-websocket-YOL5ECIU.js");return new l(t,o,e,{connect:!1})}let{WebrtcProvider:a}=await import("./y-webrtc-VQGJXSXG.js"),c={};r&&(c.password=r),Array.isArray(i)&&i.length&&(c.signaling=i);let s=new a(o,e,c);return s.disconnect(),s}function ae(n){let e=n&&typeof n=="object"?n:{};return{name:e.name||"Anonymous",color:e.color||"#2563eb",...e}}export{ce as createMilkdownTextEditor};
|
|
@@ -1 +1,80 @@
|
|
|
1
|
-
|
|
1
|
+
/* Base UI dark theme. Download and edit this file to make your own theme:
|
|
2
|
+
change the --b-* colours, --base-radius (corner roundness) and --b-overlay,
|
|
3
|
+
then load it after the Base UI stylesheet. Or build one visually with
|
|
4
|
+
the Theme tab of the examples app (examples/index.html#/theme). */
|
|
5
|
+
[b-theme="dark"],
|
|
6
|
+
[data-bs-theme="dark"],
|
|
7
|
+
:root.dark:not([b-theme="light"]):not([data-bs-theme="light"]),
|
|
8
|
+
.dark:not([b-theme="light"]):not([data-bs-theme="light"]) {
|
|
9
|
+
color-scheme: dark;
|
|
10
|
+
--b-background: var(--color-neutral-950, oklch(0.145 0 0));
|
|
11
|
+
--b-foreground: var(--color-neutral-50, oklch(0.985 0 0));
|
|
12
|
+
--b-surface: var(--color-neutral-900, oklch(0.205 0 0));
|
|
13
|
+
--b-surface-foreground: var(--color-neutral-50, oklch(0.985 0 0));
|
|
14
|
+
--b-card: var(--b-surface);
|
|
15
|
+
--b-card-foreground: var(--b-surface-foreground);
|
|
16
|
+
--b-popover: var(--b-surface);
|
|
17
|
+
--b-popover-foreground: var(--b-surface-foreground);
|
|
18
|
+
--b-primary: var(--color-neutral-200, oklch(0.922 0 0));
|
|
19
|
+
--b-primary-rgb: 229, 229, 229;
|
|
20
|
+
--b-primary-foreground: var(--color-neutral-900, oklch(0.205 0 0));
|
|
21
|
+
--b-secondary: var(--color-neutral-800, oklch(0.269 0 0));
|
|
22
|
+
--b-secondary-rgb: 38, 38, 38;
|
|
23
|
+
--b-secondary-foreground: var(--color-neutral-50, oklch(0.985 0 0));
|
|
24
|
+
--b-muted: var(--color-neutral-800, oklch(0.269 0 0));
|
|
25
|
+
--b-muted-foreground: var(--color-neutral-400, oklch(0.708 0 0));
|
|
26
|
+
--b-accent: var(--color-neutral-800, oklch(0.269 0 0));
|
|
27
|
+
--b-accent-foreground: var(--color-neutral-50, oklch(0.985 0 0));
|
|
28
|
+
--b-danger: var(--color-red-400, oklch(0.704 0.191 22.216));
|
|
29
|
+
--b-danger-rgb: 248, 113, 113;
|
|
30
|
+
--b-danger-foreground: var(--color-neutral-50, oklch(0.985 0 0));
|
|
31
|
+
--b-success: var(--color-green-400, #4ade80);
|
|
32
|
+
--b-success-rgb: 74, 222, 128;
|
|
33
|
+
--b-success-foreground: var(--color-neutral-950, #0a0a0a);
|
|
34
|
+
--b-warning: var(--color-amber-400, #fbbf24);
|
|
35
|
+
--b-warning-rgb: 251, 191, 36;
|
|
36
|
+
--b-warning-foreground: var(--color-neutral-950, #0a0a0a);
|
|
37
|
+
--b-info: var(--color-sky-400, #38bdf8);
|
|
38
|
+
--b-info-rgb: 56, 189, 248;
|
|
39
|
+
--b-info-foreground: var(--color-neutral-950, #0a0a0a);
|
|
40
|
+
--b-border: oklch(1 0 0 / 10%);
|
|
41
|
+
--b-input: oklch(1 0 0 / 15%);
|
|
42
|
+
--b-ring: var(--color-neutral-500, oklch(0.556 0 0));
|
|
43
|
+
--b-ring-alpha: color-mix(in oklab, var(--b-ring) 50%, transparent);
|
|
44
|
+
--b-chart-1: var(--color-blue-500, oklch(0.623 0.214 259.815));
|
|
45
|
+
--b-chart-2: var(--color-emerald-500, oklch(0.696 0.17 162.48));
|
|
46
|
+
--b-chart-3: var(--color-yellow-500, oklch(0.795 0.184 86.047));
|
|
47
|
+
--b-chart-4: var(--color-purple-500, oklch(0.627 0.265 303.9));
|
|
48
|
+
--b-chart-5: var(--color-red-400, oklch(0.704 0.191 22.216));
|
|
49
|
+
--b-sidebar: var(--color-neutral-900, oklch(0.205 0 0));
|
|
50
|
+
--b-sidebar-foreground: var(--color-neutral-50, oklch(0.985 0 0));
|
|
51
|
+
--b-sidebar-primary: var(--color-blue-500, oklch(0.623 0.214 259.815));
|
|
52
|
+
--b-sidebar-primary-foreground: var(--color-neutral-50, oklch(0.985 0 0));
|
|
53
|
+
--b-sidebar-accent: var(--color-neutral-800, oklch(0.269 0 0));
|
|
54
|
+
--b-sidebar-accent-foreground: var(--color-neutral-50, oklch(0.985 0 0));
|
|
55
|
+
--b-sidebar-border: oklch(1 0 0 / 10%);
|
|
56
|
+
--b-sidebar-ring: var(--color-neutral-500, oklch(0.556 0 0));
|
|
57
|
+
--base-radius: var(--radius, 0.625rem);
|
|
58
|
+
--b-overlay: rgb(0 0 0 / 70%);
|
|
59
|
+
--bs-body-bg: var(--b-background);
|
|
60
|
+
--bs-body-color: var(--b-foreground);
|
|
61
|
+
--bs-body-color-rgb: 250, 250, 250;
|
|
62
|
+
--bs-body-bg-rgb: 10, 10, 10;
|
|
63
|
+
--bs-secondary-bg-rgb: 38, 38, 38;
|
|
64
|
+
--bs-tertiary-bg-rgb: 38, 38, 38;
|
|
65
|
+
--bs-emphasis-color-rgb: 250, 250, 250;
|
|
66
|
+
--bs-emphasis-color: var(--b-foreground);
|
|
67
|
+
--bs-secondary-color: var(--b-muted-foreground);
|
|
68
|
+
--bs-secondary-bg: var(--b-muted);
|
|
69
|
+
--bs-tertiary-color: var(--b-muted-foreground);
|
|
70
|
+
--bs-tertiary-bg: var(--b-accent);
|
|
71
|
+
--bs-primary: var(--b-primary);
|
|
72
|
+
--bs-primary-rgb: var(--b-primary-rgb);
|
|
73
|
+
--bs-secondary: var(--b-secondary);
|
|
74
|
+
--bs-secondary-rgb: var(--b-secondary-rgb);
|
|
75
|
+
--bs-danger: var(--b-danger);
|
|
76
|
+
--bs-danger-rgb: var(--b-danger-rgb);
|
|
77
|
+
--bs-border-color: var(--b-border);
|
|
78
|
+
--bs-border-color-translucent: color-mix(in oklab, var(--b-border) 65%, transparent);
|
|
79
|
+
--bs-focus-ring-color: var(--b-ring-alpha);
|
|
80
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[b-theme=dark],[data-bs-theme=dark],:root.dark:not([b-theme=light]):not([data-bs-theme=light]),.dark:not([b-theme=light]):not([data-bs-theme=light]){color-scheme:dark;--b-background: var(--color-neutral-950, oklch(.145 0 0));--b-foreground: var(--color-neutral-50, oklch(.985 0 0));--b-surface: var(--color-neutral-900, oklch(.205 0 0));--b-surface-foreground: var(--color-neutral-50, oklch(.985 0 0));--b-card: var(--b-surface);--b-card-foreground: var(--b-surface-foreground);--b-popover: var(--b-surface);--b-popover-foreground: var(--b-surface-foreground);--b-primary: var(--color-neutral-200, oklch(.922 0 0));--b-primary-rgb: 229, 229, 229;--b-primary-foreground: var(--color-neutral-900, oklch(.205 0 0));--b-secondary: var(--color-neutral-800, oklch(.269 0 0));--b-secondary-rgb: 38, 38, 38;--b-secondary-foreground: var(--color-neutral-50, oklch(.985 0 0));--b-muted: var(--color-neutral-800, oklch(.269 0 0));--b-muted-foreground: var(--color-neutral-400, oklch(.708 0 0));--b-accent: var(--color-neutral-800, oklch(.269 0 0));--b-accent-foreground: var(--color-neutral-50, oklch(.985 0 0));--b-danger: var(--color-red-400, oklch(.704 .191 22.216));--b-danger-rgb: 248, 113, 113;--b-danger-foreground: var(--color-neutral-50, oklch(.985 0 0));--b-success: var(--color-green-400, #4ade80);--b-success-rgb: 74, 222, 128;--b-success-foreground: var(--color-neutral-950, #0a0a0a);--b-warning: var(--color-amber-400, #fbbf24);--b-warning-rgb: 251, 191, 36;--b-warning-foreground: var(--color-neutral-950, #0a0a0a);--b-info: var(--color-sky-400, #38bdf8);--b-info-rgb: 56, 189, 248;--b-info-foreground: var(--color-neutral-950, #0a0a0a);--b-border: oklch(1 0 0 / 10%);--b-input: oklch(1 0 0 / 15%);--b-ring: var(--color-neutral-500, oklch(.556 0 0));--b-ring-alpha: color-mix(in oklab, var(--b-ring) 50%, transparent);--b-chart-1: var(--color-blue-500, oklch(.623 .214 259.815));--b-chart-2: var(--color-emerald-500, oklch(.696 .17 162.48));--b-chart-3: var(--color-yellow-500, oklch(.795 .184 86.047));--b-chart-4: var(--color-purple-500, oklch(.627 .265 303.9));--b-chart-5: var(--color-red-400, oklch(.704 .191 22.216));--b-sidebar: var(--color-neutral-900, oklch(.205 0 0));--b-sidebar-foreground: var(--color-neutral-50, oklch(.985 0 0));--b-sidebar-primary: var(--color-blue-500, oklch(.623 .214 259.815));--b-sidebar-primary-foreground: var(--color-neutral-50, oklch(.985 0 0));--b-sidebar-accent: var(--color-neutral-800, oklch(.269 0 0));--b-sidebar-accent-foreground: var(--color-neutral-50, oklch(.985 0 0));--b-sidebar-border: oklch(1 0 0 / 10%);--b-sidebar-ring: var(--color-neutral-500, oklch(.556 0 0));--base-radius: var(--radius, .625rem);--b-overlay: rgb(0 0 0 / 70%);--bs-body-bg: var(--b-background);--bs-body-color: var(--b-foreground);--bs-body-color-rgb: 250, 250, 250;--bs-body-bg-rgb: 10, 10, 10;--bs-secondary-bg-rgb: 38, 38, 38;--bs-tertiary-bg-rgb: 38, 38, 38;--bs-emphasis-color-rgb: 250, 250, 250;--bs-emphasis-color: var(--b-foreground);--bs-secondary-color: var(--b-muted-foreground);--bs-secondary-bg: var(--b-muted);--bs-tertiary-color: var(--b-muted-foreground);--bs-tertiary-bg: var(--b-accent);--bs-primary: var(--b-primary);--bs-primary-rgb: var(--b-primary-rgb);--bs-secondary: var(--b-secondary);--bs-secondary-rgb: var(--b-secondary-rgb);--bs-danger: var(--b-danger);--bs-danger-rgb: var(--b-danger-rgb);--bs-border-color: var(--b-border);--bs-border-color-translucent: color-mix(in oklab, var(--b-border) 65%, transparent);--bs-focus-ring-color: var(--b-ring-alpha)}
|
|
@@ -1 +1,81 @@
|
|
|
1
|
-
|
|
1
|
+
/* Base UI light theme. Download and edit this file to make your own theme:
|
|
2
|
+
change the --b-* colours, --base-radius (corner roundness) and --b-overlay,
|
|
3
|
+
then load it after the Base UI stylesheet. Or build one visually with
|
|
4
|
+
the Theme tab of the examples app (examples/index.html#/theme). */
|
|
5
|
+
:root:not([b-theme]):not([data-bs-theme]):not(.dark),
|
|
6
|
+
[b-theme="light"],
|
|
7
|
+
[data-bs-theme="light"],
|
|
8
|
+
:root.light,
|
|
9
|
+
.light {
|
|
10
|
+
color-scheme: light;
|
|
11
|
+
--b-background: var(--color-white, oklch(1 0 0));
|
|
12
|
+
--b-foreground: var(--color-neutral-950, oklch(0.145 0 0));
|
|
13
|
+
--b-surface: var(--color-white, oklch(1 0 0));
|
|
14
|
+
--b-surface-foreground: var(--color-neutral-950, oklch(0.145 0 0));
|
|
15
|
+
--b-card: var(--b-surface);
|
|
16
|
+
--b-card-foreground: var(--b-surface-foreground);
|
|
17
|
+
--b-popover: var(--b-surface);
|
|
18
|
+
--b-popover-foreground: var(--b-surface-foreground);
|
|
19
|
+
--b-primary: var(--color-neutral-900, oklch(0.205 0 0));
|
|
20
|
+
--b-primary-rgb: 23, 23, 23;
|
|
21
|
+
--b-primary-foreground: var(--color-neutral-50, oklch(0.985 0 0));
|
|
22
|
+
--b-secondary: var(--color-neutral-100, oklch(0.97 0 0));
|
|
23
|
+
--b-secondary-rgb: 245, 245, 245;
|
|
24
|
+
--b-secondary-foreground: var(--color-neutral-900, oklch(0.205 0 0));
|
|
25
|
+
--b-muted: var(--color-neutral-100, oklch(0.97 0 0));
|
|
26
|
+
--b-muted-foreground: var(--color-neutral-600, oklch(0.439 0 0));
|
|
27
|
+
--b-accent: var(--color-neutral-100, oklch(0.97 0 0));
|
|
28
|
+
--b-accent-foreground: var(--color-neutral-900, oklch(0.205 0 0));
|
|
29
|
+
--b-danger: var(--color-red-700, oklch(0.505 0.213 27.518));
|
|
30
|
+
--b-danger-rgb: 193, 0, 7;
|
|
31
|
+
--b-danger-foreground: var(--color-neutral-50, oklch(0.985 0 0));
|
|
32
|
+
--b-success: var(--color-green-600, #16a34a);
|
|
33
|
+
--b-success-rgb: 22, 163, 74;
|
|
34
|
+
--b-success-foreground: var(--color-neutral-50, #fafafa);
|
|
35
|
+
--b-warning: var(--color-amber-500, #f59e0b);
|
|
36
|
+
--b-warning-rgb: 245, 158, 11;
|
|
37
|
+
--b-warning-foreground: var(--color-neutral-950, #0a0a0a);
|
|
38
|
+
--b-info: var(--color-sky-600, #0284c7);
|
|
39
|
+
--b-info-rgb: 2, 132, 199;
|
|
40
|
+
--b-info-foreground: var(--color-neutral-50, #fafafa);
|
|
41
|
+
--b-border: var(--color-neutral-200, oklch(0.922 0 0));
|
|
42
|
+
--b-input: var(--color-neutral-200, oklch(0.922 0 0));
|
|
43
|
+
--b-ring: var(--color-neutral-400, oklch(0.708 0 0));
|
|
44
|
+
--b-ring-alpha: color-mix(in oklab, var(--b-ring) 50%, transparent);
|
|
45
|
+
--b-chart-1: var(--color-orange-500, oklch(0.705 0.213 47.604));
|
|
46
|
+
--b-chart-2: var(--color-emerald-500, oklch(0.696 0.17 162.48));
|
|
47
|
+
--b-chart-3: var(--color-blue-500, oklch(0.623 0.214 259.815));
|
|
48
|
+
--b-chart-4: var(--color-yellow-500, oklch(0.795 0.184 86.047));
|
|
49
|
+
--b-chart-5: var(--color-purple-500, oklch(0.627 0.265 303.9));
|
|
50
|
+
--b-sidebar: var(--color-neutral-50, oklch(0.985 0 0));
|
|
51
|
+
--b-sidebar-foreground: var(--color-neutral-950, oklch(0.145 0 0));
|
|
52
|
+
--b-sidebar-primary: var(--color-neutral-900, oklch(0.205 0 0));
|
|
53
|
+
--b-sidebar-primary-foreground: var(--color-neutral-50, oklch(0.985 0 0));
|
|
54
|
+
--b-sidebar-accent: var(--color-neutral-100, oklch(0.97 0 0));
|
|
55
|
+
--b-sidebar-accent-foreground: var(--color-neutral-900, oklch(0.205 0 0));
|
|
56
|
+
--b-sidebar-border: var(--color-neutral-200, oklch(0.922 0 0));
|
|
57
|
+
--b-sidebar-ring: var(--color-neutral-400, oklch(0.708 0 0));
|
|
58
|
+
--base-radius: var(--radius, 0.625rem);
|
|
59
|
+
--b-overlay: rgb(0 0 0 / 25%);
|
|
60
|
+
--bs-body-bg: var(--b-background);
|
|
61
|
+
--bs-body-color: var(--b-foreground);
|
|
62
|
+
--bs-body-color-rgb: 10, 10, 10;
|
|
63
|
+
--bs-body-bg-rgb: 255, 255, 255;
|
|
64
|
+
--bs-secondary-bg-rgb: 245, 245, 245;
|
|
65
|
+
--bs-tertiary-bg-rgb: 245, 245, 245;
|
|
66
|
+
--bs-emphasis-color-rgb: 10, 10, 10;
|
|
67
|
+
--bs-emphasis-color: var(--b-foreground);
|
|
68
|
+
--bs-secondary-color: var(--b-muted-foreground);
|
|
69
|
+
--bs-secondary-bg: var(--b-muted);
|
|
70
|
+
--bs-tertiary-color: var(--b-muted-foreground);
|
|
71
|
+
--bs-tertiary-bg: var(--b-accent);
|
|
72
|
+
--bs-primary: var(--b-primary);
|
|
73
|
+
--bs-primary-rgb: var(--b-primary-rgb);
|
|
74
|
+
--bs-secondary: var(--b-secondary);
|
|
75
|
+
--bs-secondary-rgb: var(--b-secondary-rgb);
|
|
76
|
+
--bs-danger: var(--b-danger);
|
|
77
|
+
--bs-danger-rgb: var(--b-danger-rgb);
|
|
78
|
+
--bs-border-color: var(--b-border);
|
|
79
|
+
--bs-border-color-translucent: color-mix(in oklab, var(--b-border) 65%, transparent);
|
|
80
|
+
--bs-focus-ring-color: var(--b-ring-alpha);
|
|
81
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root:not([b-theme]):not([data-bs-theme]):not(.dark),[b-theme=light],[data-bs-theme=light],:root.light,.light{color-scheme:light;--b-background: var(--color-white, oklch(1 0 0));--b-foreground: var(--color-neutral-950, oklch(.145 0 0));--b-surface: var(--color-white, oklch(1 0 0));--b-surface-foreground: var(--color-neutral-950, oklch(.145 0 0));--b-card: var(--b-surface);--b-card-foreground: var(--b-surface-foreground);--b-popover: var(--b-surface);--b-popover-foreground: var(--b-surface-foreground);--b-primary: var(--color-neutral-900, oklch(.205 0 0));--b-primary-rgb: 23, 23, 23;--b-primary-foreground: var(--color-neutral-50, oklch(.985 0 0));--b-secondary: var(--color-neutral-100, oklch(.97 0 0));--b-secondary-rgb: 245, 245, 245;--b-secondary-foreground: var(--color-neutral-900, oklch(.205 0 0));--b-muted: var(--color-neutral-100, oklch(.97 0 0));--b-muted-foreground: var(--color-neutral-600, oklch(.439 0 0));--b-accent: var(--color-neutral-100, oklch(.97 0 0));--b-accent-foreground: var(--color-neutral-900, oklch(.205 0 0));--b-danger: var(--color-red-700, oklch(.505 .213 27.518));--b-danger-rgb: 193, 0, 7;--b-danger-foreground: var(--color-neutral-50, oklch(.985 0 0));--b-success: var(--color-green-600, #16a34a);--b-success-rgb: 22, 163, 74;--b-success-foreground: var(--color-neutral-50, #fafafa);--b-warning: var(--color-amber-500, #f59e0b);--b-warning-rgb: 245, 158, 11;--b-warning-foreground: var(--color-neutral-950, #0a0a0a);--b-info: var(--color-sky-600, #0284c7);--b-info-rgb: 2, 132, 199;--b-info-foreground: var(--color-neutral-50, #fafafa);--b-border: var(--color-neutral-200, oklch(.922 0 0));--b-input: var(--color-neutral-200, oklch(.922 0 0));--b-ring: var(--color-neutral-400, oklch(.708 0 0));--b-ring-alpha: color-mix(in oklab, var(--b-ring) 50%, transparent);--b-chart-1: var(--color-orange-500, oklch(.705 .213 47.604));--b-chart-2: var(--color-emerald-500, oklch(.696 .17 162.48));--b-chart-3: var(--color-blue-500, oklch(.623 .214 259.815));--b-chart-4: var(--color-yellow-500, oklch(.795 .184 86.047));--b-chart-5: var(--color-purple-500, oklch(.627 .265 303.9));--b-sidebar: var(--color-neutral-50, oklch(.985 0 0));--b-sidebar-foreground: var(--color-neutral-950, oklch(.145 0 0));--b-sidebar-primary: var(--color-neutral-900, oklch(.205 0 0));--b-sidebar-primary-foreground: var(--color-neutral-50, oklch(.985 0 0));--b-sidebar-accent: var(--color-neutral-100, oklch(.97 0 0));--b-sidebar-accent-foreground: var(--color-neutral-900, oklch(.205 0 0));--b-sidebar-border: var(--color-neutral-200, oklch(.922 0 0));--b-sidebar-ring: var(--color-neutral-400, oklch(.708 0 0));--base-radius: var(--radius, .625rem);--b-overlay: rgb(0 0 0 / 25%);--bs-body-bg: var(--b-background);--bs-body-color: var(--b-foreground);--bs-body-color-rgb: 10, 10, 10;--bs-body-bg-rgb: 255, 255, 255;--bs-secondary-bg-rgb: 245, 245, 245;--bs-tertiary-bg-rgb: 245, 245, 245;--bs-emphasis-color-rgb: 10, 10, 10;--bs-emphasis-color: var(--b-foreground);--bs-secondary-color: var(--b-muted-foreground);--bs-secondary-bg: var(--b-muted);--bs-tertiary-color: var(--b-muted-foreground);--bs-tertiary-bg: var(--b-accent);--bs-primary: var(--b-primary);--bs-primary-rgb: var(--b-primary-rgb);--bs-secondary: var(--b-secondary);--bs-secondary-rgb: var(--b-secondary-rgb);--bs-danger: var(--b-danger);--bs-danger-rgb: var(--b-danger-rgb);--bs-border-color: var(--b-border);--bs-border-color-translucent: color-mix(in oklab, var(--b-border) 65%, transparent);--bs-focus-ring-color: var(--b-ring-alpha)}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** gettext (.po) translation service. Call `init` before the first `loadCatalog`. */
|
|
2
|
+
export interface BaseUII18nLanguage { code: string; label: string }
|
|
3
|
+
export interface BaseUII18nConfig {
|
|
4
|
+
/** Languages the page can show; `code` is the .po file name. Defaults to English only. */
|
|
5
|
+
languages?: BaseUII18nLanguage[];
|
|
6
|
+
/** Language the texts are written in (no catalog is loaded for it). Defaults to the first language. */
|
|
7
|
+
defaultLanguage?: string;
|
|
8
|
+
/** localStorage key remembering the visitor's choice. Defaults to "thebase-lang". */
|
|
9
|
+
storageKey?: string;
|
|
10
|
+
/** Query parameter that forces a language. Defaults to "lang". */
|
|
11
|
+
queryParam?: string;
|
|
12
|
+
/** Folder (next to each module) holding `<code>.po`. Defaults to "i18n". */
|
|
13
|
+
catalogDir?: string;
|
|
14
|
+
/** Selector of the meta description `translateHead` translates. */
|
|
15
|
+
headDescription?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface BaseUII18nEntry { id: string; str: string; fuzzy: boolean }
|
|
18
|
+
export function init(config?: BaseUII18nConfig): void;
|
|
19
|
+
export function languages(): BaseUII18nLanguage[];
|
|
20
|
+
export function t(text: string, params?: Record<string, string | number>): string;
|
|
21
|
+
export function parsePo(text: string): Map<string, BaseUII18nEntry>;
|
|
22
|
+
export function loadCatalog(moduleUrl: string | URL): Promise<void>;
|
|
23
|
+
export function currentLanguage(): string;
|
|
24
|
+
export function translateHead(): void;
|
|
25
|
+
export function setLanguage(code: string): void;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ export interface BaseUIApi {
|
|
|
27
27
|
theme: { set(modeOrTokens: string | Record<string, string>): void };
|
|
28
28
|
/** Set by dist/baseui.analytics.min.js (the optional analytics service). */
|
|
29
29
|
analytics?: import("./analytics").BaseUIAnalytics;
|
|
30
|
+
/** Set by dist/baseui.i18n.min.js (the optional i18n service). */
|
|
31
|
+
i18n?: typeof import("./i18n");
|
|
30
32
|
/** Bound by `analytics.init()` (unless `bindToWindow: false`). */
|
|
31
33
|
track?: import("./analytics").BaseUIAnalytics["track"];
|
|
32
34
|
}
|
package/dist/types/pwa.d.ts
CHANGED
|
@@ -1,45 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export interface BaseUIManifestConfig {
|
|
3
|
-
name: string;
|
|
4
|
-
/** Defaults to `name`. */
|
|
5
|
-
shortName?: string;
|
|
6
|
-
description?: string;
|
|
7
|
-
/** Defaults to "/". */
|
|
8
|
-
startUrl?: string;
|
|
9
|
-
/** Defaults to "/". */
|
|
10
|
-
scope?: string;
|
|
11
|
-
/** Defaults to "standalone". */
|
|
12
|
-
display?: string;
|
|
13
|
-
/** Defaults to "portrait-primary". */
|
|
14
|
-
orientation?: string;
|
|
15
|
-
/** Defaults to "#ffffff". */
|
|
16
|
-
backgroundColor?: string;
|
|
17
|
-
/** Defaults to "#0f172a". */
|
|
18
|
-
themeColor?: string;
|
|
19
|
-
/** Defaults to "en". */
|
|
20
|
-
lang?: string;
|
|
21
|
-
/** Folder URL holding the default logo files. Defaults to "/icons/". */
|
|
22
|
-
iconsBase?: string;
|
|
23
|
-
/** Defaults to the shipped logo: `icon-192.png` and `icon-512.png` under `iconsBase`. */
|
|
24
|
-
icons?: Array<{ src: string; sizes: string; type: string; purpose?: string }>;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface BaseUIServiceWorkerConfig {
|
|
28
|
-
/** Cache bucket name, e.g. "my-app-cache-v1" — bump the suffix to invalidate old caches. */
|
|
29
|
-
cacheName: string;
|
|
30
|
-
/** Pinned `@thebase/ui` version the generated sw.js precaches/serves from jsdelivr. */
|
|
31
|
-
cdnVersion: string;
|
|
32
|
-
/** Where the manifest is served from. Defaults to "/manifest.webmanifest". */
|
|
33
|
-
manifestUrl?: string;
|
|
34
|
-
/** Folder URL holding the default logo/favicon files to precache. Defaults to "/icons/". */
|
|
35
|
-
iconsBase?: string;
|
|
36
|
-
/** Same-origin app-shell paths to precache (JS/CSS/XML/icons/etc). */
|
|
37
|
-
appFiles?: string[];
|
|
38
|
-
/** Extra same-origin or cross-origin URLs to precache alongside `appFiles`. */
|
|
39
|
-
extraPrecacheUrls?: string[];
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/** Default logo/favicon file names (in `dist/pwa-icons/`), precached from `/icons/` by default. */
|
|
43
|
-
export const DEFAULT_ICON_FILES: string[];
|
|
44
|
-
export function buildManifest(config: BaseUIManifestConfig): Record<string, unknown>;
|
|
45
|
-
export function buildServiceWorker(config: BaseUIServiceWorkerConfig): string;
|
|
1
|
+
dist/types/vite.d.ts
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { BaseUIManifestConfig } from "./pwa";
|
|
2
|
+
|
|
3
|
+
/** Vite plugin: every `vite build` also emits manifest, sw.js, sw-register.js, version.json and icons. */
|
|
4
|
+
export function baseuiPwa(options?: Partial<BaseUIManifestConfig> & { cdnVersion?: string }): import("vite").Plugin;
|
package/docs/analytics.md
CHANGED
|
@@ -13,12 +13,12 @@ init({ backendUrl: "https://stats.example.com" });
|
|
|
13
13
|
```html
|
|
14
14
|
<!-- ES module from the CDN (or map it as "@base/analytics" in an import map) -->
|
|
15
15
|
<script type="module">
|
|
16
|
-
import { init } from "https://cdn.jsdelivr.net/npm/@thebase/ui@1.1
|
|
16
|
+
import { init } from "https://cdn.jsdelivr.net/npm/@thebase/ui@1.2.1/dist/baseui.analytics.esm.js";
|
|
17
17
|
init({ backendUrl: "https://stats.example.com" });
|
|
18
18
|
</script>
|
|
19
19
|
|
|
20
20
|
<!-- Classic script tag: sets window.thebase.analytics (load order vs dist/baseui.min.js doesn't matter) -->
|
|
21
|
-
<script src="https://cdn.jsdelivr.net/npm/@thebase/ui@1.1
|
|
21
|
+
<script src="https://cdn.jsdelivr.net/npm/@thebase/ui@1.2.1/dist/baseui.analytics.min.js"></script>
|
|
22
22
|
<script>
|
|
23
23
|
thebase.analytics.init({ backendUrl: "https://stats.example.com" });
|
|
24
24
|
</script>
|
|
@@ -228,7 +228,7 @@ curl -i -X POST http://localhost:8080/api/event -H 'Content-Type: text/plain' \
|
|
|
228
228
|
|
|
229
229
|
[`examples/analytics/`](../examples/analytics/dashboard/?backend=http://localhost:8080) contains a working dashboard plus two complete sample backends: [`server-go`](../examples/analytics/server-go/main.go) (Fiber v3) and [`server-fastapi`](../examples/analytics/server-fastapi/main.py). Each one extends the receivers above with an in-memory store, a daily-salted cookieless visitor hash, a `GET /api/stats` endpoint, and static hosting for the dashboard.
|
|
230
230
|
|
|
231
|
-
The dashboard ([`dashboard/`](../examples/analytics/dashboard/?backend=http://localhost:8080)) is a pure application that loads `@thebase/ui@1.1
|
|
231
|
+
The dashboard ([`dashboard/`](../examples/analytics/dashboard/?backend=http://localhost:8080)) is a pure application that loads `@thebase/ui@1.2.1` from jsDelivr: KPI `Card`s, an area `Chart`, top pages/sources/events `Table`s, site and period `NativeSelect`s, and a `ThemeButton`. It refreshes every 30 s and tracks its own visits through `@thebase/ui/analytics`, so a fresh backend has data straight away.
|
|
232
232
|
|
|
233
233
|
```sh
|
|
234
234
|
# Go (1.25+)
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Skill for AI
|
|
2
|
+
|
|
3
|
+
The Base UI skill teaches an AI coding agent how to build apps and components with BaseUI: scaffolding a PWA, emitting real components and icons, and packaging as Electron or Capacitor apps. It bundles verified syntax references, so the agent uses real BaseUI props and markup instead of guessing.
|
|
4
|
+
|
|
5
|
+
It is a plain folder of Markdown and scripts, so it is not tied to one tool. It works with Claude Code, OpenAI Codex, Gemini CLI, and any other agent that can read instruction files.
|
|
6
|
+
|
|
7
|
+
## Download
|
|
8
|
+
|
|
9
|
+
[Download base-ui-skill.tar](/examples/base-ui-skill.tar)
|
|
10
|
+
|
|
11
|
+
The archive contains one `base-ui/` folder: `SKILL.md`, `references/` and `scripts/`.
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
Extract the archive into the skills folder of your agent, either per user or inside one project:
|
|
16
|
+
|
|
17
|
+
| Agent | Per user | Per project |
|
|
18
|
+
| --- | --- | --- |
|
|
19
|
+
| Claude Code | `~/.claude/skills` | `.claude/skills` |
|
|
20
|
+
| Codex | `~/.codex/skills` | `.codex/skills` |
|
|
21
|
+
| Gemini CLI | `~/.gemini/skills` | `.gemini/skills` |
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
mkdir -p ~/.claude/skills
|
|
25
|
+
tar -xf base-ui-skill.tar -C ~/.claude/skills
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Replace `~/.claude/skills` with the folder for your agent, then restart it. Skill folder locations can change between agent versions, so check your agent's documentation if the skill is not picked up.
|
|
29
|
+
|
|
30
|
+
### Other agents
|
|
31
|
+
|
|
32
|
+
For an agent without a skills folder (Cursor, Copilot, Windsurf, and others), extract the archive anywhere in your project and point the agent at it from its instruction file, such as `AGENTS.md`, `GEMINI.md` or `.cursor/rules`:
|
|
33
|
+
|
|
34
|
+
```md
|
|
35
|
+
For any BaseUI work, read and follow `base-ui/SKILL.md` first.
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Use
|
|
39
|
+
|
|
40
|
+
Ask in plain language. The skill triggers on these phrases:
|
|
41
|
+
|
|
42
|
+
| Say | Result |
|
|
43
|
+
| --- | --- |
|
|
44
|
+
| `create app` | Scaffolds a new BaseUI PWA |
|
|
45
|
+
| `use <component>` / `make <component>` | Emits a real BaseUI component |
|
|
46
|
+
| `use <icon>` / `make <icon>` | Emits a real Lucide icon |
|
|
47
|
+
| `create electron app` | PWA scaffold plus an Electron shell |
|
|
48
|
+
| `create capacitor app` | PWA scaffold plus a Capacitor shell |
|
|
49
|
+
|
|
50
|
+
If your agent does not trigger skills automatically, mention `base-ui` in the prompt, for example "use the base-ui skill to create app".
|
|
51
|
+
|
|
52
|
+
## Update
|
|
53
|
+
|
|
54
|
+
The archive is rebuilt from `scripts/base-ui` on every landing deploy. Download it again and extract over the old folder to update.
|
package/docs/blocks.md
CHANGED
|
@@ -13,7 +13,7 @@ Blocks are not standalone runtime components. Paste the markup and load the norm
|
|
|
13
13
|
<script src="https://cdn.jsdelivr.net/npm/@thebase/ui@latest/dist/baseui.min.js" defer></script>
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
`https://unpkg.com/@thebase/ui@latest/dist/...` mirrors the same files as an alternative CDN if jsDelivr is unreachable. Pin an exact version (e.g. `@1.1
|
|
16
|
+
`https://unpkg.com/@thebase/ui@latest/dist/...` mirrors the same files as an alternative CDN if jsDelivr is unreachable. Pin an exact version (e.g. `@1.2.1`, or `@1` to take only non-breaking updates) instead of `@latest` for production. Blocks are static markup, so they only need the static `b-ui` runtime above — see [Usage Guide](usage-guide.md) if the surrounding page is itself an application and you'd rather compose the equivalent layout from [Base Components](owl-components.md).
|
|
17
17
|
|
|
18
18
|
Use `b-block` to select the block style:
|
|
19
19
|
|