@kong-ui-public/misc-widgets 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/misc-widgets.umd.js
CHANGED
|
@@ -19,5 +19,5 @@ Try polyfilling it using "@formatjs/intl-pluralrules"
|
|
|
19
19
|
Try polyfilling it using "@formatjs/intl-relativetimeformat"
|
|
20
20
|
`,P.MISSING_INTL_API));try{return re(t,r,i).format(n,e)}catch(a){t.onError(new nt("Error formatting relative time.",t.locale,a))}return String(n)}var ne=["style","currency","currencyDisplay","unit","unitDisplay","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","currencyDisplay","currencySign","notation","signDisplay","unit","unitDisplay","numberingSystem"];function Ft(t,r,n){var e=t.locale,i=t.formats,o=t.onError;n===void 0&&(n={});var a=n.format,s=a&&ot(i,"number",a,o)||{},c=w(n,ne,s);return r(e,c)}function ie(t,r,n,e){e===void 0&&(e={});try{return Ft(t,r,e).format(n)}catch(i){t.onError(new B(_.FORMAT_ERROR,"Error formatting number.",i))}return String(n)}function oe(t,r,n,e){e===void 0&&(e={});try{return Ft(t,r,e).formatToParts(n)}catch(i){t.onError(new B(_.FORMAT_ERROR,"Error formatting number.",i))}return[]}function ae(t){var r=t?t[Object.keys(t)[0]]:void 0;return typeof r=="string"}function se(t){t.onWarn&&t.defaultRichTextElements&&ae(t.messages||{})&&t.onWarn(`[@formatjs/intl] "defaultRichTextElements" was specified but "message" was not pre-compiled.
|
|
21
21
|
Please consider using "@formatjs/cli" to pre-compile your messages for performance.
|
|
22
|
-
For more details see https://formatjs.io/docs/getting-started/message-distribution`)}function he(t,r){var n=kr(r),e=m(m({},Fr),t),i=e.locale,o=e.defaultLocale,a=e.onError;return i?!Intl.NumberFormat.supportedLocalesOf(i).length&&a?a(new Pt('Missing locale data for locale: "'.concat(i,'" in Intl.NumberFormat. Using default locale: "').concat(o,'" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details'))):!Intl.DateTimeFormat.supportedLocalesOf(i).length&&a&&a(new Pt('Missing locale data for locale: "'.concat(i,'" in Intl.DateTimeFormat. Using default locale: "').concat(o,'" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details'))):(a&&a(new wr('"locale" was not configured, using "'.concat(o,'" as fallback. See https://formatjs.io/docs/react-intl/api#intlshape for more details'))),e.locale=e.defaultLocale||"en"),se(e),m(m({},e),{formatters:n,formatNumber:ie.bind(null,e,n.getNumberFormat),formatNumberToParts:oe.bind(null,e,n.getNumberFormat),formatRelativeTime:ee.bind(null,e,n.getRelativeTimeFormat),formatDate:Vr.bind(null,e,n.getDateTimeFormat),formatDateToParts:Kr.bind(null,e,n.getDateTimeFormat),formatTime:xr.bind(null,e,n.getDateTimeFormat),formatDateTimeRange:Xr.bind(null,e,n.getDateTimeFormat),formatTimeToParts:Zr.bind(null,e,n.getDateTimeFormat),formatPlural:$r.bind(null,e,n.getPluralRules),formatMessage:wt.bind(null,e,n),$t:wt.bind(null,e,n),formatList:Qr.bind(null,e,n.getListFormat),formatListToParts:Gt.bind(null,e,n.getListFormat),formatDisplayName:Wr.bind(null,e,n.getDisplayNames)})}var ue=F;F.flatten=F,F.unflatten=Vt;function kt(t){return t&&t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function jt(t){return t}function F(t,r){r=r||{};const n=r.delimiter||".",e=r.maxDepth,i=r.transformKey||jt,o={};function a(s,c,u){u=u||1,Object.keys(s).forEach(function(h){const l=s[h],f=r.safe&&Array.isArray(l),g=Object.prototype.toString.call(l),d=kt(l),b=g==="[object Object]"||g==="[object Array]",v=c?c+n+i(h):i(h);if(!f&&!d&&b&&Object.keys(l).length&&(!r.maxDepth||u<e))return a(l,v,u+1);o[v]=l})}return a(t),o}function Vt(t,r){r=r||{};const n=r.delimiter||".",e=r.overwrite||!1,i=r.transformKey||jt,o={};if(kt(t)||Object.prototype.toString.call(t)!=="[object Object]")return t;function a(u){const h=Number(u);return isNaN(h)||u.indexOf(".")!==-1||r.object?u:h}function s(u,h,l){return Object.keys(l).reduce(function(f,g){return f[u+n+g]=l[g],f},h)}function c(u){const h=Object.prototype.toString.call(u),l=h==="[object Array]",f=h==="[object Object]";if(u){if(l)return!u.length;if(f)return!Object.keys(u).length}else return!0}return t=Object.keys(t).reduce(function(u,h){const l=Object.prototype.toString.call(t[h]);return!(l==="[object Object]"||l==="[object Array]")||c(t[h])?(u[h]=t[h],u):s(h,u,F(t[h],r))},{}),Object.keys(t).forEach(function(u){const h=u.split(n).map(i);let l=a(h.shift()),f=a(h[0]),g=o;for(;f!==void 0;){if(l==="__proto__")return;const d=Object.prototype.toString.call(g[l]),b=d==="[object Object]"||d==="[object Array]";if(!e&&!b&&typeof g[l]<"u")return;(e&&!b||!e&&g[l]==null)&&(g[l]=typeof f=="number"&&!r.object?[]:{}),g=g[l],h.length>0&&(l=a(h.shift()),f=a(h[0]))}g[l]=Vt(t[u],r)}),o}const ce=Ot(),le=(t,r,n=!1)=>{const e=he({locale:t,messages:ue.flatten(r,{safe:!0})},ce);return{t:(o,a,s)=>e.formatMessage({id:o},a,s),te:o=>!!e.messages[o],tm:o=>e.messages[o]||[],...e,source:r}},fe=t=>H.defineComponent({name:"I18nT",props:{keypath:{type:String,required:!0},tag:{type:String,default:"span"}},setup(r,{slots:n}){const e=i=>{if(!i)return[];const o=/(\{[^}]+\})/g;return i.split(o).filter(Boolean)};return()=>{const i=Object.keys(n).filter(s=>s!=="_"),o=t.messages[r.keypath].toString();let a=e(o);return a=a.filter(s=>s!==""),a.forEach((s,c)=>{if(!s.startsWith("{")&&!s.endsWith("}"))return;const u=s.replace(/[\{\}]/g,"");u==="0"&&n.default?a[c]=n.default():i.includes(u)&&n[u]&&(a[c]=n[u]())}),H.h(r.tag,r,a)}}}),me={install(t,r){const{i18n:n}=r;t.component("I18nT",fe(n))}},pe={githubStar:{title:"Star",ariaLabel:"Star buttons/github-buttons on GitHub"}};function ge(){return{i18n:le("en-us",pe),i18nT:me}}const Ee={useI18n:ge},be={key:0,class:"kong-ui-public-misc-widgets-github-star","data-testid":"github-star"},ye=["href"],de=H.defineComponent({__name:"GithubStar",props:{url:{type:String,required:!0}},setup(t){const{i18n:r}=Ee.useI18n(),n=H.ref(!1);return H.onMounted(async()=>{const e=document.createElement("script");e.addEventListener("load",()=>{n.value=!0}),e.setAttribute("src","https://buttons.github.io/buttons.js"),document.head.appendChild(e)}),(e,i)=>t.url&&n.value?(H.openBlock(),H.createElementBlock("div",be,[H.createElementVNode("a",{"aria-label":"i18n.t('githubStar.ariaLabel')",class:"github-button","data-color-scheme":"no-preference: light; light: light; dark: light;","data-show-count":"true",href:t.url,target:"_blank"},H.toDisplayString(H.unref(r).t("githubStar.title")),9,ye)])):H.createCommentVNode("",!0)}}),_e="",ve=((t,r)=>{const n=t.__vccOpts||t;for(const[e,i]of r)n[e]=i;return n})(de,[["__scopeId","data-v-4d1f46cf"]]);C.GithubStar=ve,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})});
|
|
22
|
+
For more details see https://formatjs.io/docs/getting-started/message-distribution`)}function he(t,r){var n=kr(r),e=m(m({},Fr),t),i=e.locale,o=e.defaultLocale,a=e.onError;return i?!Intl.NumberFormat.supportedLocalesOf(i).length&&a?a(new Pt('Missing locale data for locale: "'.concat(i,'" in Intl.NumberFormat. Using default locale: "').concat(o,'" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details'))):!Intl.DateTimeFormat.supportedLocalesOf(i).length&&a&&a(new Pt('Missing locale data for locale: "'.concat(i,'" in Intl.DateTimeFormat. Using default locale: "').concat(o,'" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details'))):(a&&a(new wr('"locale" was not configured, using "'.concat(o,'" as fallback. See https://formatjs.io/docs/react-intl/api#intlshape for more details'))),e.locale=e.defaultLocale||"en"),se(e),m(m({},e),{formatters:n,formatNumber:ie.bind(null,e,n.getNumberFormat),formatNumberToParts:oe.bind(null,e,n.getNumberFormat),formatRelativeTime:ee.bind(null,e,n.getRelativeTimeFormat),formatDate:Vr.bind(null,e,n.getDateTimeFormat),formatDateToParts:Kr.bind(null,e,n.getDateTimeFormat),formatTime:xr.bind(null,e,n.getDateTimeFormat),formatDateTimeRange:Xr.bind(null,e,n.getDateTimeFormat),formatTimeToParts:Zr.bind(null,e,n.getDateTimeFormat),formatPlural:$r.bind(null,e,n.getPluralRules),formatMessage:wt.bind(null,e,n),$t:wt.bind(null,e,n),formatList:Qr.bind(null,e,n.getListFormat),formatListToParts:Gt.bind(null,e,n.getListFormat),formatDisplayName:Wr.bind(null,e,n.getDisplayNames)})}var ue=F;F.flatten=F,F.unflatten=Vt;function kt(t){return t&&t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function jt(t){return t}function F(t,r){r=r||{};const n=r.delimiter||".",e=r.maxDepth,i=r.transformKey||jt,o={};function a(s,c,u){u=u||1,Object.keys(s).forEach(function(h){const l=s[h],f=r.safe&&Array.isArray(l),g=Object.prototype.toString.call(l),d=kt(l),b=g==="[object Object]"||g==="[object Array]",v=c?c+n+i(h):i(h);if(!f&&!d&&b&&Object.keys(l).length&&(!r.maxDepth||u<e))return a(l,v,u+1);o[v]=l})}return a(t),o}function Vt(t,r){r=r||{};const n=r.delimiter||".",e=r.overwrite||!1,i=r.transformKey||jt,o={};if(kt(t)||Object.prototype.toString.call(t)!=="[object Object]")return t;function a(u){const h=Number(u);return isNaN(h)||u.indexOf(".")!==-1||r.object?u:h}function s(u,h,l){return Object.keys(l).reduce(function(f,g){return f[u+n+g]=l[g],f},h)}function c(u){const h=Object.prototype.toString.call(u),l=h==="[object Array]",f=h==="[object Object]";if(u){if(l)return!u.length;if(f)return!Object.keys(u).length}else return!0}return t=Object.keys(t).reduce(function(u,h){const l=Object.prototype.toString.call(t[h]);return!(l==="[object Object]"||l==="[object Array]")||c(t[h])?(u[h]=t[h],u):s(h,u,F(t[h],r))},{}),Object.keys(t).forEach(function(u){const h=u.split(n).map(i);let l=a(h.shift()),f=a(h[0]),g=o;for(;f!==void 0;){if(l==="__proto__")return;const d=Object.prototype.toString.call(g[l]),b=d==="[object Object]"||d==="[object Array]";if(!e&&!b&&typeof g[l]<"u")return;(e&&!b||!e&&g[l]==null)&&(g[l]=typeof f=="number"&&!r.object?[]:{}),g=g[l],h.length>0&&(l=a(h.shift()),f=a(h[0]))}g[l]=Vt(t[u],r)}),o}const ce=Ot(),le=(t,r,n=!1)=>{const e=he({locale:t,messages:ue.flatten(r,{safe:!0})},ce);return{t:(o,a,s)=>e.formatMessage({id:o},a,s),te:o=>!!e.messages[o],tm:o=>e.messages[o]||[],...e,source:r}},fe=(t=null)=>H.defineComponent({name:"I18nT",props:{i18n:{type:Object,default:null},keypath:{type:String,required:!0},tag:{type:String,default:"span"}},setup(r,{slots:n}){const e=i=>{if(!i)return[];const o=/(\{[^}]+\})/g;return i.split(o).filter(Boolean)};return()=>{const i=Object.keys(n).filter(s=>s!=="_"),o=(t||r.i18n).messages[r.keypath].toString();let a=e(o);return a=a.filter(s=>s!==""),a.forEach((s,c)=>{if(!s.startsWith("{")&&!s.endsWith("}"))return;const u=s.replace(/[\{\}]/g,"");u==="0"&&n.default?a[c]=n.default():i.includes(u)&&n[u]&&(a[c]=n[u]())}),H.h(r.tag,r,a)}}}),me={install(t,r){const{i18n:n}=r;t.component("I18nT",fe(n))}},pe={githubStar:{title:"Star",ariaLabel:"Star buttons/github-buttons on GitHub"}};function ge(){return{i18n:le("en-us",pe),i18nT:me}}const Ee={useI18n:ge},be={key:0,class:"kong-ui-public-misc-widgets-github-star","data-testid":"github-star"},ye=["href"],de=H.defineComponent({__name:"GithubStar",props:{url:{type:String,required:!0}},setup(t){const{i18n:r}=Ee.useI18n(),n=H.ref(!1);return H.onMounted(async()=>{const e=document.createElement("script");e.addEventListener("load",()=>{n.value=!0}),e.setAttribute("src","https://buttons.github.io/buttons.js"),document.head.appendChild(e)}),(e,i)=>t.url&&n.value?(H.openBlock(),H.createElementBlock("div",be,[H.createElementVNode("a",{"aria-label":"i18n.t('githubStar.ariaLabel')",class:"github-button","data-color-scheme":"no-preference: light; light: light; dark: light;","data-show-count":"true",href:t.url,target:"_blank"},H.toDisplayString(H.unref(r).t("githubStar.title")),9,ye)])):H.createCommentVNode("",!0)}}),_e="",ve=((t,r)=>{const n=t.__vccOpts||t;for(const[e,i]of r)n[e]=i;return n})(de,[["__scopeId","data-v-4d1f46cf"]]);C.GithubStar=ve,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})});
|
|
23
23
|
//# sourceMappingURL=misc-widgets.umd.js.map
|