@octaviaflow/utilities 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # @octaviaflow/utilities
2
+
3
+ > Utilities and helpers to drive consistency across software products using the
4
+ > Carbon Design System
5
+
6
+ ## Getting started
7
+
8
+ To install `@octaviaflow/utilities` in your project, you will need to run the
9
+ following command using [npm](https://www.npmjs.com/):
10
+
11
+ ```bash
12
+ npm install @octaviaflow/utilities
13
+ ```
14
+
15
+ If you prefer [Yarn](https://yarnpkg.com/en/), use the following command
16
+ instead:
17
+
18
+ ```bash
19
+ yarn add @octaviaflow/utilities
20
+ ```
21
+
22
+ ## 🙌 Contributing
23
+
24
+ We're always looking for contributors to help us fix bugs, build new features,
25
+ or help us improve the project documentation. If you're interested, definitely
26
+ check out our [Contributing Guide](/.github/CONTRIBUTING.md)! 👀
27
+
28
+ ## 📝 License
29
+
30
+ Licensed under the [Apache 2.0 License](/LICENSE).
31
+
32
+ ## <picture><source height="20" width="20" media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ibm-telemetry/telemetry-js/main/docs/images/ibm-telemetry-dark.svg"><source height="20" width="20" media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/ibm-telemetry/telemetry-js/main/docs/images/ibm-telemetry-light.svg"><img height="20" width="20" alt="IBM Telemetry" src="https://raw.githubusercontent.com/ibm-telemetry/telemetry-js/main/docs/images/ibm-telemetry-light.svg"></picture> IBM Telemetry
33
+
34
+ This package uses IBM Telemetry to collect de-identified and anonymized metrics
35
+ data. By installing this package as a dependency you are agreeing to telemetry
36
+ collection. To opt out, see
37
+ [Opting out of IBM Telemetry data collection](https://github.com/ibm-telemetry/telemetry-js/tree/main#opting-out-of-ibm-telemetry-data-collection).
38
+ For more information on the data being collected, please see the
39
+ [IBM Telemetry documentation](https://github.com/ibm-telemetry/telemetry-js/tree/main#ibm-telemetry-collection-basics).
@@ -0,0 +1 @@
1
+ function r(l,t){return new Intl.DateTimeFormat(t?.locale,{timeStyle:t?.style??"short"}).format(l)}function i(l,t){return new Intl.DateTimeFormat(t?.locale,{dateStyle:t?.style??"medium"}).format(l)}function y(l,t){const e=t?.timeStyle??(t?.style==="tooltip"?"long":t?.style)??"short",a=t?.dateStyle??(t?.style==="tooltip"?"full":t?.style)??"medium";return new Intl.DateTimeFormat(t?.locale,{timeStyle:e,dateStyle:a}).format(l)}function o(l,t,e){const a=e?.timeStyle===null?void 0:e?.timeStyle??e?.style??"short",m=e?.dateStyle===null?void 0:e?.dateStyle??e?.style??"medium";return new Intl.DateTimeFormat(e?.locale,{timeStyle:a,dateStyle:m}).formatRange(l,t)}export{y as format,i as formatDate,o as formatRange,r as formatTime};
@@ -0,0 +1 @@
1
+ import*as o from"./relative";import*as t from"./absolute";const r={relative:o,absolute:t};export{r as dateTimeFormat};
@@ -0,0 +1 @@
1
+ function i(a,e){const t=new Intl.RelativeTimeFormat(e?.locale,{style:e?.style??"long"}),m=typeof a=="number"?new Date(a):a,c=Date.now(),l=Math.floor((c-m.getTime())/1e3),r=Math.floor(l/60),n=Math.floor(r/60),o=Math.floor(n/24),s=Math.floor(o/7),f=Math.floor(s/4),h=Math.floor(o/365);return Math.abs(l)<60?new Intl.RelativeTimeFormat(e?.locale,{numeric:"auto",style:e?.style??"long"}).format(0,"seconds"):Math.abs(r)<60?t.format(r*-1,"minutes"):Math.abs(n)<24?t.format(n*-1,"hours"):Math.abs(o)<7?t.format(o*-1,"days"):Math.abs(s)<4?t.format(s*-1,"weeks"):Math.abs(f)<12?t.format(f*-1,"months"):t.format(h*-1,"years")}export{i as format};
package/es/index.js ADDED
@@ -0,0 +1 @@
1
+ export*from"./dateTimeFormat";
@@ -0,0 +1 @@
1
+ "use strict";var n=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var o=(l,t)=>{for(var e in t)n(l,e,{get:t[e],enumerable:!0})},d=(l,t,e,m)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of i(t))!y.call(l,a)&&a!==e&&n(l,a,{get:()=>t[a],enumerable:!(m=r(t,a))||m.enumerable});return l};var S=l=>d(n({},"__esModule",{value:!0}),l);var D={};o(D,{format:()=>u,formatDate:()=>s,formatRange:()=>c,formatTime:()=>f});module.exports=S(D);function f(l,t){return new Intl.DateTimeFormat(t?.locale,{timeStyle:t?.style??"short"}).format(l)}function s(l,t){return new Intl.DateTimeFormat(t?.locale,{dateStyle:t?.style??"medium"}).format(l)}function u(l,t){const e=t?.timeStyle??(t?.style==="tooltip"?"long":t?.style)??"short",m=t?.dateStyle??(t?.style==="tooltip"?"full":t?.style)??"medium";return new Intl.DateTimeFormat(t?.locale,{timeStyle:e,dateStyle:m}).format(l)}function c(l,t,e){const m=e?.timeStyle===null?void 0:e?.timeStyle??e?.style??"short",a=e?.dateStyle===null?void 0:e?.dateStyle??e?.style??"medium";return new Intl.DateTimeFormat(e?.locale,{timeStyle:m,dateStyle:a}).formatRange(l,t)}
@@ -0,0 +1 @@
1
+ "use strict";var p=Object.create;var e=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var b=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty;var d=(o,t)=>{for(var r in t)e(o,r,{get:t[r],enumerable:!0})},i=(o,t,r,m)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of l(t))!c.call(o,a)&&a!==r&&e(o,a,{get:()=>t[a],enumerable:!(m=f(t,a))||m.enumerable});return o};var s=(o,t,r)=>(r=o!=null?p(b(o)):{},i(t||!o||!o.__esModule?e(r,"default",{value:o,enumerable:!0}):r,o)),n=o=>i(e({},"__esModule",{value:!0}),o);var F={};d(F,{dateTimeFormat:()=>x});module.exports=n(F);var u=s(require("./relative")),v=s(require("./absolute"));const x={relative:u,absolute:v};
@@ -0,0 +1 @@
1
+ "use strict";var m=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var b=(e,t)=>{for(var o in t)m(e,o,{get:t[o],enumerable:!0})},w=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of M(t))!y.call(e,a)&&a!==o&&m(e,a,{get:()=>t[a],enumerable:!(r=u(t,a))||r.enumerable});return e};var g=e=>w(m({},"__esModule",{value:!0}),e);var d={};b(d,{format:()=>T});module.exports=g(d);function T(e,t){const o=new Intl.RelativeTimeFormat(t?.locale,{style:t?.style??"long"}),r=typeof e=="number"?new Date(e):e,a=Date.now(),c=Math.floor((a-r.getTime())/1e3),s=Math.floor(c/60),l=Math.floor(s/60),n=Math.floor(l/24),f=Math.floor(n/7),h=Math.floor(f/4),i=Math.floor(n/365);return Math.abs(c)<60?new Intl.RelativeTimeFormat(t?.locale,{numeric:"auto",style:t?.style??"long"}).format(0,"seconds"):Math.abs(s)<60?o.format(s*-1,"minutes"):Math.abs(l)<24?o.format(l*-1,"hours"):Math.abs(n)<7?o.format(n*-1,"days"):Math.abs(f)<4?o.format(f*-1,"weeks"):Math.abs(h)<12?o.format(h*-1,"months"):o.format(i*-1,"years")}
package/lib/index.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var a=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var p=(r,o,f,x)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of c(o))!d.call(r,e)&&e!==f&&a(r,e,{get:()=>o[e],enumerable:!(x=b(o,e))||x.enumerable});return r},t=(r,o,f)=>(p(r,o,"default"),f&&p(f,o,"default"));var g=r=>p(a({},"__esModule",{value:!0}),r);var m={};module.exports=g(m);t(m,require("./dateTimeFormat"),module.exports);
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@octaviaflow/utilities",
3
+ "description": "Utilities and helpers to drive consistency across software products using the OctaviaFlow Design System",
4
+ "version": "1.0.0",
5
+ "main": "lib/index.js",
6
+ "module": "es/index.js",
7
+ "types": "types/index.d.ts",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/octaviaflow-design-system.git",
11
+ "directory": "packages/utilities"
12
+ },
13
+ "bugs": "https://github.com/octaviaflow-design-system/issues",
14
+ "files": [
15
+ "es",
16
+ "lib",
17
+ "telemetry.yml"
18
+ ],
19
+ "keywords": [
20
+ "octaviaflow",
21
+ "octaviaflow-design-system",
22
+ "octaviaflow-utilities"
23
+ ],
24
+ "publishConfig": {
25
+ "access": "public"
26
+ },
27
+ "scripts": {
28
+ "build:es": "esbuild './src/**/!(*-test).{js,ts}' --minify --outdir=es --target=es2020 --format=esm",
29
+ "build:cjs": "esbuild './src/**/!(*-test).{js,ts}' --minify --outdir=lib --target=es2020 --format=cjs",
30
+ "build:types": "tsc",
31
+ "build": "bun run build:es & bun run build:cjs & bun run build:types",
32
+ "watch": "bun run build:es --watch & bun run build:cjs --watch",
33
+ "clean": "rimraf es lib"
34
+ },
35
+ "devDependencies": {
36
+ "@octaviaflow/telemetry": "^1.0.0",
37
+ "esbuild": "^0.24.0",
38
+ "rimraf": "^6.0.0",
39
+ "typescript": "^4.8.4",
40
+ "typescript-config-octaviaflow": "^1.0.0"
41
+ }
42
+ }
package/telemetry.yml ADDED
@@ -0,0 +1,17 @@
1
+ # yaml-language-server: $schema=https://unpkg.com/@octaviaflow/telemetry-config-schema@v1.0.0/dist/config.schema.json
2
+ version: 1
3
+ projectId: 'f443274a-a821-4aae-ae80-dfe5cf2d1da6'
4
+ name: 'octaviaflow-utilities'
5
+ storage:
6
+ type: 'file'
7
+ file:
8
+ directory: '/Volumes/Main/Projects/OctaviaFlow-Design-System/telemetry-logs'
9
+ fileNamePattern: 'octaviaflow-utilities-{timestamp}.json'
10
+ maxFileSizeMB: 10
11
+ compress: false
12
+ collect:
13
+ npm:
14
+ dependencies: null
15
+ js:
16
+ functions: {}
17
+ tokens: null