buzzcasting-utils 1.13.0 → 1.13.8
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/buzzcasting-utils.d.ts +87 -4
- package/dist/buzzcasting-utils.esm.js +1 -1
- package/package.json +11 -15
|
@@ -142,6 +142,22 @@ export declare interface Data {
|
|
|
142
142
|
|
|
143
143
|
export declare const debounce: (func: Function, timeout?: number) => (...args: any[]) => void;
|
|
144
144
|
|
|
145
|
+
/**
|
|
146
|
+
* Interface of a Snowflake after `Generator.deconstruct()`.
|
|
147
|
+
* @property {bigint} snowflake - Snowflake deconstructed from
|
|
148
|
+
* @property {bigint} timestamp - The timestamp the snowflake was generated
|
|
149
|
+
* @property {bigint} shard_id - The shard_id used when generating
|
|
150
|
+
* @property {bigint} increment - The increment of this snowflake
|
|
151
|
+
* @property {string} binary - The 64Bit snowflake binary string
|
|
152
|
+
* @interface DeconstructedSnowflake
|
|
153
|
+
*/
|
|
154
|
+
declare interface DeconstructedSnowflake {
|
|
155
|
+
timestamp: number;
|
|
156
|
+
shard_id: number;
|
|
157
|
+
sequence: number;
|
|
158
|
+
binary: string;
|
|
159
|
+
}
|
|
160
|
+
|
|
145
161
|
export declare function deepMerge(objs: any): void;
|
|
146
162
|
|
|
147
163
|
export declare const dir: (message: IMessage) => "rtl" | "ltr";
|
|
@@ -476,9 +492,9 @@ export declare interface ICloudOptions {
|
|
|
476
492
|
debug?: boolean;
|
|
477
493
|
dimensions?: IDimensions;
|
|
478
494
|
globe?: IGlobe;
|
|
479
|
-
grid
|
|
495
|
+
grid?: ICardsGrid;
|
|
480
496
|
highlight?: IHighlight;
|
|
481
|
-
image
|
|
497
|
+
image?: ICardImage;
|
|
482
498
|
kpi?: Kpi;
|
|
483
499
|
legend?: ILegend;
|
|
484
500
|
pie?: IPie;
|
|
@@ -1238,8 +1254,8 @@ export declare interface ISeriesOptions {
|
|
|
1238
1254
|
time?: ITime;
|
|
1239
1255
|
date?: IDate;
|
|
1240
1256
|
dimensions?: IDimensions;
|
|
1241
|
-
graph
|
|
1242
|
-
legend
|
|
1257
|
+
graph?: IGraph;
|
|
1258
|
+
legend?: ILegend;
|
|
1243
1259
|
pie?: IPie;
|
|
1244
1260
|
show?: IShowSeries;
|
|
1245
1261
|
}
|
|
@@ -1589,6 +1605,73 @@ export declare function showModal(e: MouseEvent, widget: any, message: IMessage,
|
|
|
1589
1605
|
|
|
1590
1606
|
export declare function shuffleMessages(messages: IMessage[]): IMessage[];
|
|
1591
1607
|
|
|
1608
|
+
export declare class Snowflake {
|
|
1609
|
+
/**
|
|
1610
|
+
* The generators epoch timestamp in milliseconds.
|
|
1611
|
+
*
|
|
1612
|
+
* Defaults to "1st of January, 2000, 00:00".
|
|
1613
|
+
*
|
|
1614
|
+
* @type {number}
|
|
1615
|
+
*/
|
|
1616
|
+
static EPOCH: number;
|
|
1617
|
+
/**
|
|
1618
|
+
* The id of the shard running this generator.
|
|
1619
|
+
*
|
|
1620
|
+
* Defaults to "1".
|
|
1621
|
+
*
|
|
1622
|
+
* @type {number}
|
|
1623
|
+
*/
|
|
1624
|
+
static SHARD_ID: number;
|
|
1625
|
+
/**
|
|
1626
|
+
* The sequence of the current running generator.
|
|
1627
|
+
*
|
|
1628
|
+
* Defaults to "1".
|
|
1629
|
+
*
|
|
1630
|
+
* @type {number}
|
|
1631
|
+
*/
|
|
1632
|
+
static SEQUENCE: number;
|
|
1633
|
+
/**
|
|
1634
|
+
* Generates a single snowflake.
|
|
1635
|
+
* @param {Date|number} [timestamp = Date.now] - Timestamp to generate from
|
|
1636
|
+
* @returns {bigint}
|
|
1637
|
+
*/
|
|
1638
|
+
static generate({ timestamp, shard_id, }?: {
|
|
1639
|
+
timestamp?: Date | number;
|
|
1640
|
+
shard_id?: number;
|
|
1641
|
+
}): string;
|
|
1642
|
+
/**
|
|
1643
|
+
* Deconstruct a snowflake to its values using the `Generator.epoch`.
|
|
1644
|
+
* @param {SnowflakeResolvable|SnowflakeResolvable[]} snowflake - Snowflake(s) to deconstruct
|
|
1645
|
+
* @returns {DeconstructedSnowflake|DeconstructedSnowflake[]}
|
|
1646
|
+
*/
|
|
1647
|
+
static parse(snowflake: SnowflakeResolvable): DeconstructedSnowflake;
|
|
1648
|
+
static isValid(snowflake: string): boolean;
|
|
1649
|
+
/**
|
|
1650
|
+
* Extract bits and their values from a snowflake.
|
|
1651
|
+
* @param {SnowflakeResolvable} snowflake - Snowflake to extract from
|
|
1652
|
+
* @param {number|bigint} shift - Number of bits to shift before extracting
|
|
1653
|
+
* @param {number|bigint} length - Number of bits to extract before stopping
|
|
1654
|
+
* @returns {bigint}
|
|
1655
|
+
*/
|
|
1656
|
+
static extractBits(snowflake: SnowflakeResolvable, start: number, length?: number): number;
|
|
1657
|
+
/**
|
|
1658
|
+
* Transform a snowflake into its 64Bit binary string.
|
|
1659
|
+
* @param {SnowflakeResolvable} snowflake - Snowflake to transform
|
|
1660
|
+
* @returns {string}
|
|
1661
|
+
* @private
|
|
1662
|
+
*/
|
|
1663
|
+
static binary(snowflake: SnowflakeResolvable): string;
|
|
1664
|
+
}
|
|
1665
|
+
|
|
1666
|
+
/**
|
|
1667
|
+
* Resolvable value types for a valid Snowflake.
|
|
1668
|
+
* * string
|
|
1669
|
+
* * number
|
|
1670
|
+
* * bigint
|
|
1671
|
+
* @type {SnowflakeResolvable}
|
|
1672
|
+
*/
|
|
1673
|
+
declare type SnowflakeResolvable = string;
|
|
1674
|
+
|
|
1592
1675
|
export declare const stall: (func: Function, timeout?: number) => (...args: any[]) => void;
|
|
1593
1676
|
|
|
1594
1677
|
export declare enum STORAGE {
|
|
@@ -3,4 +3,4 @@ var e=function(e){return e.CARDS=`cards`,e.CLOUD=`cloud`,e.DASHBOARD=`dashboard`
|
|
|
3
3
|
<`),ue=e=>e.replace(/\/\*.*\*\/|\/\*[\s\S]*?\*\/|\n|\t|\v|\s{2,}/g,``).replace(/\s*\{\s*/g,`{`).replace(/\s*\}\s*/g,`}`).replace(/\s*\:\s*/g,`:`).replace(/\s*\;\s*/g,`;`).replace(/\s*\,\s*/g,`,`).replace(/\s*\~\s*/g,`~`).replace(/\s*\>\s*/g,`>`).replace(/\s*\+\s*/g,`+`).replace(/\s*\!\s*/g,`!`),de=e=>e.replace(/\,/g,`, `).replace(/\{/g,` {
|
|
4
4
|
`).replace(/\}/g,`}
|
|
5
5
|
`).replace(/\;/g,`;
|
|
6
|
-
`);function fe(e,t){let n=[{value:1,symbol:``},{value:1e3,symbol:`k`},{value:1e6,symbol:`M`},{value:1e9,symbol:`G`},{value:0xe8d4a51000,symbol:`T`},{value:0x38d7ea4c68000,symbol:`P`},{value:0xde0b6b3a7640000,symbol:`E`},{value:1e21,symbol:`Z`},{value:1e24,symbol:`Y`}],r=/\.0+$|(\.\d*[1-9])0+$/,i;for(i=n.length-1;i>0&&!(e>=n[i].value);i--);return(e/n[i].value).toFixed(t).replace(r,`$1`)+n[i].symbol}function pe(e){let t=RegExp(`[?&]${e}=([^&]*)`).exec(window.location.search);return t&&decodeURIComponent(t[1].replace(/\+/g,` `))||null}var me=e=>new Proxy(new URLSearchParams(window.location.search),{get:(e,t)=>e.get(t)})[e];function he(e){return e[Math.floor(Math.random()*e.length)]}function ge(e){switch(e.language){case`ar`:return{direction:`rtl`,textAlign:`right`};default:return{direction:`ltr`,textAlign:`left`}}}var _e=e=>{switch(e.language){case`ar`:case`ml`:return`rtl`;default:return`ltr`}};function ve(e){let t=e.filter(e=>e!==void 0);return t.forEach(e=>{if(window.__bc.opts.suspended===!0
|
|
6
|
+
`);function fe(e,t){let n=[{value:1,symbol:``},{value:1e3,symbol:`k`},{value:1e6,symbol:`M`},{value:1e9,symbol:`G`},{value:0xe8d4a51000,symbol:`T`},{value:0x38d7ea4c68000,symbol:`P`},{value:0xde0b6b3a7640000,symbol:`E`},{value:1e21,symbol:`Z`},{value:1e24,symbol:`Y`}],r=/\.0+$|(\.\d*[1-9])0+$/,i;for(i=n.length-1;i>0&&!(e>=n[i].value);i--);return(e/n[i].value).toFixed(t).replace(r,`$1`)+n[i].symbol}function pe(e){let t=RegExp(`[?&]${e}=([^&]*)`).exec(window.location.search);return t&&decodeURIComponent(t[1].replace(/\+/g,` `))||null}var me=e=>new Proxy(new URLSearchParams(window.location.search),{get:(e,t)=>e.get(t)})[e];function he(e){return e[Math.floor(Math.random()*e.length)]}function ge(e){switch(e.language){case`ar`:return{direction:`rtl`,textAlign:`right`};default:return{direction:`ltr`,textAlign:`left`}}}var _e=e=>{switch(e.language){case`ar`:case`ml`:return`rtl`;default:return`ltr`}};function ve(e){let t=e.filter(e=>e!==void 0);return t.forEach(e=>{if(e.content=window.__bc.opts.suspended===!0?`License suspended, please contact your Sales Representative to restore service`:e.content?.replace(/(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)((\?.*)?)/g,``)||``,e.sender!==null)switch(!0){case e.sender.title===`Unknown author`:e.sender.title=``,e.sender.name=``;break;case e.sender.title===e.sender.name:e.sender.name=``;break;case e.channel===`tw`:e.sender.name=`@${e.sender.name}`}else e.sender={title:``,name:``,id:``,avatar:`default`,bio:``,location:``,following:0,verified:0,listed:0,followers:0,favourites:0,messages:0,influence:0};if(e.sender.title===``&&e.link!==``){let t=new URL(e.link);e.sender.title=t.hostname.replace(`www.`,``)}}),t}function ye(e,t,n,r){e.stopPropagation(),t.showModal({showComponent:`card-modal`,props:{data:n,options:r}})}function be(e){let t=[...e];for(let e=t.length-1;e>0;e--){let n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}return t}var xe=class e{static EPOCH=Date.UTC(1970,0,1).valueOf();static SHARD_ID=1;static SEQUENCE=1;static generate({timestamp:t=Date.now(),shard_id:n=e.SHARD_ID}={}){t=t instanceof Date?t.valueOf():new Date(t).valueOf();let r=BigInt(t)-BigInt(e.EPOCH)<<BigInt(22);return r|=BigInt(n%1024)<<BigInt(12),r|=BigInt(e.SEQUENCE++%4096),r.toString()}static parse(t){let n=e.binary(t);return{timestamp:e.extractBits(t,1,41),shard_id:e.extractBits(t,42,10),sequence:e.extractBits(t,52),binary:n}}static isValid(t){if(!/^[\d]{19}$/.test(t))return!1;try{return e.parse(t),!0}catch{return!1}}static extractBits(t,n,r){return parseInt(r?e.binary(t).substring(n,n+r):e.binary(t).substring(n),2)}static binary(e){let t=BigInt(e).toString(2);return t.length<64?`0000000000000000000000000000000000000000000000000000000000000000`.substring(0,64-t.length)+t:t}};function Se(){let e=``;for(let t=0;t<7;t++)e+=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`.charAt(Math.floor(Math.random()*62));return e}var Ce=n=>{switch(n?.type){case e.MESSAGES:return t.MESSAGES;case e.SERIES:return t.SERIES;case e.CLOUD:return t.CLOUD;default:return t.NO_UPDATES}},we=(e=6)=>Math.random().toString(36).substring(2,e+2),Te=(e,t=[])=>!t.find(function(t){return t===e}),Ee=(e,t=[])=>{let n=0,r=``;for(;r==``&&n<100;)r=we(e),Te(r,t)||(r=``,n++);return r},De=e=>{switch(!0){case e<0:return`text-down text-xs`;case e>0:return`text-up text-xs`;default:return`text-white text-xs`}},$=(e,t,n)=>Promise.race([e,Oe(t,n)]),Oe=(e,t)=>new Promise((n,r)=>setTimeout(()=>t===void 0?n(`ok`):r(t),e));function ke(e){let t=`${e.type}.${e.topics}`;return e.order&&(t+=`.${e.order}`),e.period&&(t+=`.${e.period}`),t}function Ae(e){if(e.widget===void 0){let t=e.topics?.split(`-`);t&&t.length>1?(e.dashboard=t?t[0]:``,e.widget=t?t[1]:``):(e.widget=e.topics,e.dashboard=e.slide)}return e}function je(e,t){let n,i,a,o,s;switch(e.moderation){case r.BEFORE:n=new Date,i=e.beforeTime?.split(`:`),a=Number.parseInt(i?i[0]:`00`),o=Number.parseInt(i?i[1]:`00`),s=Number.parseInt(i?i[2]:`00`),t.before=n.setHours(a,o,s,0)/1e3,t.period||=n.getDay()===1?72:24;break;case r.DELAYED:e.delay&&e.delay>0&&(t.delay=`${e.delay}`);break;case r.APPROVED:t.approved=`1`;break;default:e.period!==0&&(t.period=e.period)}return t}var Me=function(e){return e.MultiPolygon=`MultiPolygon`,e.Polygon=`Polygon`,e}({}),Ne=function(e){return e.MultiPolygon=`MultiPolygon`,e.Polygon=`Polygon`,e}({});export{e as API,t as CSS,n as EVENTS,Me as GeoType,K as HTMLParser,F as HTMLtoDOM,P as HTMLtoXML,r as MODERATION,te as RGBAchangeA,i as STORAGE,Ne as ShapeType,xe as Snowflake,ie as abbr,a as anonymize,o as attachedMedia,s as attrs,u as awaitElement,d as brandLogo,p as camelCase,l as camelCasedProps,m as camelToHyphen,f as camelize,h as capitalizeFirstLetter,g as clearContents,ne as debounce,x as deepMerge,_e as dir,C as escape,c as filterAttributes,T as flatten,w as formatContent,E as getGuid,ke as getKey,pe as getParameterByName,me as getQueryParam,Z as hasHWA,N as hashSum,Y as html2json,re as intToString,ae as isEmpty,X as json2html,oe as log,se as logging,de as maxifyCss,le as maxifyHtml,ue as minifyCss,ce as minifyHtml,je as moderation,fe as numberFormatter,_ as randomColor,ee as randomRGB,y as randomRGBA,v as randomRGBAfull,he as randomValue,ge as rtl,ve as sanitize,ye as showModal,be as shuffleMessages,b as stall,Se as stringGen,Ce as typeCss,Ee as uniq,S as unique,De as upDownColor,Ae as widgetParams,$ as wrapPromise};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "buzzcasting-utils",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.13.
|
|
4
|
+
"version": "1.13.8",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Mark Tamis, TouchFlows SAS",
|
|
@@ -31,25 +31,21 @@
|
|
|
31
31
|
"test:coverage": "vitest --coverage"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@
|
|
35
|
-
"@commitlint/
|
|
36
|
-
"@
|
|
37
|
-
"@
|
|
38
|
-
"@typescript-eslint/eslint-plugin": "^8.57.1",
|
|
39
|
-
"@typescript-eslint/parser": "^8.57.1",
|
|
40
|
-
"@vitest/coverage-v8": "^4.1.0",
|
|
34
|
+
"@commitlint/cli": "^20.5.3",
|
|
35
|
+
"@commitlint/config-conventional": "^20.5.3",
|
|
36
|
+
"@types/node": "^24.13.3",
|
|
37
|
+
"@vitest/coverage-v8": "^4.1.9",
|
|
41
38
|
"camelcase": "^9.0.0",
|
|
42
39
|
"changelogen": "^0.6.2",
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"typedoc": "^
|
|
46
|
-
"typedoc-plugin-markdown": "^4.11.0",
|
|
40
|
+
"lint-staged": "^16.4.0",
|
|
41
|
+
"typedoc": "^0.28.20",
|
|
42
|
+
"typedoc-plugin-markdown": "^4.12.0",
|
|
47
43
|
"typescript": "^5.9.3",
|
|
48
|
-
"vite": "^8.0
|
|
44
|
+
"vite": "^8.2.0",
|
|
49
45
|
"vite-plugin-dts": "^4.5.4",
|
|
50
|
-
"vitest": "^4.1.
|
|
46
|
+
"vitest": "^4.1.9"
|
|
51
47
|
},
|
|
52
48
|
"lint-staged": {
|
|
53
49
|
"*.ts": "npm run lint"
|
|
54
50
|
}
|
|
55
|
-
}
|
|
51
|
+
}
|