diff options
| author | rxliuli <rxliuli@gmail.com> | 2025-11-04 05:03:50 +0800 |
|---|---|---|
| committer | rxliuli <rxliuli@gmail.com> | 2025-11-04 05:03:50 +0800 |
| commit | bce557cc2dc767628bed6aac87301a1be7c5431b (patch) | |
| tree | b51a051228d01fe3306cd7626d4a96768aadb944 /node_modules/@jet/environment/models | |
init commit
Diffstat (limited to 'node_modules/@jet/environment/models')
18 files changed, 373 insertions, 0 deletions
diff --git a/node_modules/@jet/environment/models/actions/alert-action.js b/node_modules/@jet/environment/models/actions/alert-action.js new file mode 100644 index 0000000..fcc6ea5 --- /dev/null +++ b/node_modules/@jet/environment/models/actions/alert-action.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=alert-action.js.map
\ No newline at end of file diff --git a/node_modules/@jet/environment/models/actions/compound-action.js b/node_modules/@jet/environment/models/actions/compound-action.js new file mode 100644 index 0000000..6c3e159 --- /dev/null +++ b/node_modules/@jet/environment/models/actions/compound-action.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeCompoundAction = exports.isCompoundAction = void 0; +/** + * Custom type guard to determine if an action is a CompoundAction. + */ +function isCompoundAction(action) { + return (action === null || action === void 0 ? void 0 : action.$kind) === "compoundAction"; +} +exports.isCompoundAction = isCompoundAction; +/** + * Helper that returns a CompoundAction, given an ActionMetrics and ActionModel[] of subactions. + */ +function makeCompoundAction(actionMetrics, subactions) { + return { + $kind: "compoundAction", + subactions, + actionMetrics, + }; +} +exports.makeCompoundAction = makeCompoundAction; +//# sourceMappingURL=compound-action.js.map
\ No newline at end of file diff --git a/node_modules/@jet/environment/models/actions/empty-action.js b/node_modules/@jet/environment/models/actions/empty-action.js new file mode 100644 index 0000000..da7f93a --- /dev/null +++ b/node_modules/@jet/environment/models/actions/empty-action.js @@ -0,0 +1,21 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeEmptyAction = exports.isEmptyAction = void 0; +/** + * Custom type guard to determine if an action is an EmptyAction. + */ +function isEmptyAction(action) { + return (action === null || action === void 0 ? void 0 : action.$kind) === "emptyAction"; +} +exports.isEmptyAction = isEmptyAction; +/** + * Helper that returns an EmptyAction, given an ActionMetrics. + */ +function makeEmptyAction(actionMetrics) { + return { + $kind: "emptyAction", + actionMetrics, + }; +} +exports.makeEmptyAction = makeEmptyAction; +//# sourceMappingURL=empty-action.js.map
\ No newline at end of file diff --git a/node_modules/@jet/environment/models/actions/external-url-action.js b/node_modules/@jet/environment/models/actions/external-url-action.js new file mode 100644 index 0000000..479a640 --- /dev/null +++ b/node_modules/@jet/environment/models/actions/external-url-action.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=external-url-action.js.map
\ No newline at end of file diff --git a/node_modules/@jet/environment/models/actions/flow-action.js b/node_modules/@jet/environment/models/actions/flow-action.js new file mode 100644 index 0000000..6f70d98 --- /dev/null +++ b/node_modules/@jet/environment/models/actions/flow-action.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=flow-action.js.map
\ No newline at end of file diff --git a/node_modules/@jet/environment/models/actions/flow-back-action.js b/node_modules/@jet/environment/models/actions/flow-back-action.js new file mode 100644 index 0000000..75c66a2 --- /dev/null +++ b/node_modules/@jet/environment/models/actions/flow-back-action.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=flow-back-action.js.map
\ No newline at end of file diff --git a/node_modules/@jet/environment/models/actions/http-action.js b/node_modules/@jet/environment/models/actions/http-action.js new file mode 100644 index 0000000..e1fb6c3 --- /dev/null +++ b/node_modules/@jet/environment/models/actions/http-action.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=http-action.js.map
\ No newline at end of file diff --git a/node_modules/@jet/environment/models/actions/http-template-action.js b/node_modules/@jet/environment/models/actions/http-template-action.js new file mode 100644 index 0000000..6cb84d4 --- /dev/null +++ b/node_modules/@jet/environment/models/actions/http-template-action.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=http-template-action.js.map
\ No newline at end of file diff --git a/node_modules/@jet/environment/models/actions/index.js b/node_modules/@jet/environment/models/actions/index.js new file mode 100644 index 0000000..ff961dd --- /dev/null +++ b/node_modules/@jet/environment/models/actions/index.js @@ -0,0 +1,26 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./alert-action"), exports); +__exportStar(require("./compound-action"), exports); +__exportStar(require("./empty-action"), exports); +__exportStar(require("./external-url-action"), exports); +__exportStar(require("./flow-action"), exports); +__exportStar(require("./flow-back-action"), exports); +__exportStar(require("./http-action"), exports); +__exportStar(require("./http-template-action"), exports); +__exportStar(require("./toast-action"), exports); +//# sourceMappingURL=index.js.map
\ No newline at end of file diff --git a/node_modules/@jet/environment/models/actions/toast-action.js b/node_modules/@jet/environment/models/actions/toast-action.js new file mode 100644 index 0000000..5d6a299 --- /dev/null +++ b/node_modules/@jet/environment/models/actions/toast-action.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=toast-action.js.map
\ No newline at end of file diff --git a/node_modules/@jet/environment/models/artwork.js b/node_modules/@jet/environment/models/artwork.js new file mode 100644 index 0000000..324138d --- /dev/null +++ b/node_modules/@jet/environment/models/artwork.js @@ -0,0 +1,39 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeArtworkURLTemplate = void 0; +const validation = require("../json/validation"); +const optional_1 = require("../types/optional"); +const urls_1 = require("../util/urls"); +/** + * Regex to parse artwork URL template string. + */ +const URL_TEMPLATE_PARSER = new RegExp("^({w}|[0-9]+(?:.[0-9]*)?)x({h}|[0-9]+(?:.[0-9]*)?)({c}|[a-z]{2}).({f}|[a-z]+)$"); +/** + * Create an instance of artwork URL template from string. + * @param fromString - String to create artwork URL template from. + * @returns A new artwork URL template or `null` if string + * does not represent a valid artwork URL template. + */ +function makeArtworkURLTemplate(fromString) { + // A valid URL that ends with '{w}x{h}{c}.{f}' + // with any of placeholders possibly resolved to an actual value. + const url = new urls_1.URL(fromString); + if (url.pathname === undefined) { + validation.context("makeArtworkURLTemplate", () => { + validation.unexpectedType("ignoredValue", "A valid URL string", fromString); + }); + return null; + } + // Expecting 5 matches: whole string + width, height, crop code and format. + const lastPathComponent = fromString.substring(fromString.lastIndexOf("/") + 1); + const matches = URL_TEMPLATE_PARSER.exec(lastPathComponent); + if ((0, optional_1.isNothing)(matches) || matches.length !== 5) { + validation.context("makeArtworkURLTemplate", () => { + validation.unexpectedType("ignoredValue", "A valid artwork URL template ending with {w}x{h}{c}.{f} format", lastPathComponent); + }); + return null; + } + return fromString; +} +exports.makeArtworkURLTemplate = makeArtworkURLTemplate; +//# sourceMappingURL=artwork.js.map
\ No newline at end of file diff --git a/node_modules/@jet/environment/models/button.js b/node_modules/@jet/environment/models/button.js new file mode 100644 index 0000000..036c19a --- /dev/null +++ b/node_modules/@jet/environment/models/button.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=button.js.map
\ No newline at end of file diff --git a/node_modules/@jet/environment/models/color.js b/node_modules/@jet/environment/models/color.js new file mode 100644 index 0000000..82ffd64 --- /dev/null +++ b/node_modules/@jet/environment/models/color.js @@ -0,0 +1,196 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.areEqual = exports.luminanceFrom = exports.dynamicWith = exports.named = exports.rgbWith = exports.htmlWith = exports.Color = void 0; +const optional_1 = require("../types/optional"); +// endregion +// region Constructors +// eslint-disable-next-line no-redeclare, @typescript-eslint/no-redeclare +exports.Color = { + /** + * Create new `HTMLColor` from hexadecimal string representation. + * + * @param hexString - Hexadecimal string representation. + */ + fromHex(string) { + if ((0, optional_1.isNothing)(string)) { + return null; + } + return { + $kind: "html", + value: string, + }; + }, + /** + * Create new `RBGColor` with RGB components and opacity value. + * + * @param red - Red color value. + * @param green - Green color value. + * @param blue - Blue color value. + * @param alpha - Opacity value. + */ + fromRGB(red, green, blue, alpha = 1.0) { + const newColor = { + $kind: "rgb", + red: red, + green: green, + blue: blue, + alpha: alpha, + }; + return newColor; + }, + /** + * Create new named color using the color name. + * + * @param name - The name of the color. + */ + named(name) { + const newColor = { + $kind: "named", + name: name, + }; + return newColor; + }, + /** + * Create new dynamic color with light and dark color variants. + * + * @param lightColor - The light color variant. + * @param lightHighContrastColor - The light hight-contrast color variant. + * @param darkColor - The dark color variant. + * @param darkHighContrastColor - The dark hight-contrast color variant. + */ + dynamicWith(lightColor, lightHighContrastColor, darkColor, darkHighContrastColor) { + const newColor = { + $kind: "dynamic", + lightColor: lightColor, + lightHighContrastColor: lightHighContrastColor, + darkColor: darkColor, + darkHighContrastColor: darkHighContrastColor, + }; + return newColor; + }, + // endregion + // region Properties + /** + * Get the luminance of the color. + * + * @param rgbColor - The RGB color to get luminance for. + */ + luminanceFrom(rgbColor) { + // Note: This is lifted from UIColor_Private + // Using RGB color components, calculates and returns (0.2126 * r) + (0.7152 * g) + (0.0722 * b). + return rgbColor.red * 0.2126 + rgbColor.green * 0.7152 + rgbColor.blue * 0.0722; + }, + // endregion + // region Identity + /** + * Compare two colors for equality. + * + * @param color1 - Left hand side color to compare. + * @param color2 - Right hand side color to compare. + * @returns A Boolean indicating whether the colors are equal. + */ + areEqual(color1, color2) { + if ((0, optional_1.isNothing)(color1)) { + return (0, optional_1.isNothing)(color2); + } + else if ((0, optional_1.isNothing)(color2)) { + return (0, optional_1.isNothing)(color1); + } + const kind1 = color1.$kind; + const kind2 = color2.$kind; + if (kind1 === "named" && kind2 === "named") { + const namedColor1 = color1; + const namedColor2 = color2; + return namedColor1.name === namedColor2.name; + } + else if (kind1 === "rgb" && kind2 === "rgb") { + const rgbColor1 = color1; + const rgbColor2 = color2; + return (rgbColor1.red === rgbColor2.red && + rgbColor1.green === rgbColor2.green && + rgbColor1.blue === rgbColor2.blue && + rgbColor1.alpha === rgbColor2.alpha); + } + else if (kind1 === "dynamic" && kind2 === "dynamic") { + const dynamicColor1 = color1; + const dynamicColor2 = color2; + return (exports.Color.areEqual(dynamicColor1.lightColor, dynamicColor2.lightColor) && + exports.Color.areEqual(dynamicColor1.lightHighContrastColor, dynamicColor2.lightHighContrastColor) && + exports.Color.areEqual(dynamicColor1.darkColor, dynamicColor2.darkColor) && + exports.Color.areEqual(dynamicColor1.darkHighContrastColor, dynamicColor2.darkHighContrastColor)); + } + else { + return false; + } + }, +}; +/** + * Create new `HTMLColor` from hexadecimal string representation. + * + * @param hexString - Hexadecimal string representation. + * + * @deprecated This symbol has been moved to `Color.fromHex` and will be removed + * in the future. + */ +const htmlWith = exports.Color.fromHex; +exports.htmlWith = htmlWith; +/** + * Create new `RBGColor` with RGB components and opacity value. + * + * @param red - Red color value. + * @param green - Green color value. + * @param blue - Blue color value. + * @param alpha - Opacity value. + * + * @deprecated This symbol has been moved to `Color.fromRGB` and will be removed + * in the future. + */ +const rgbWith = exports.Color.fromRGB; +exports.rgbWith = rgbWith; +/** + * Create new named color using the color name. + * + * @param name - The name of the color. + * + * @deprecated This symbol has been moved to `Color.named` and will be removed + * in the future. + */ +const named = exports.Color.named; +exports.named = named; +/** + * Create new dynamic color with light and dark color variants. + * + * @param lightColor - The light color variant. + * @param lightHighContrastColor - The light hight-contrast color variant. + * @param darkColor - The dark color variant. + * @param darkHighContrastColor - The dark hight-contrast color variant. + * + * @deprecated This symbol has been moved to `Color.dynamicWith` and will be removed + * in the future. + */ +const dynamicWith = exports.Color.dynamicWith; +exports.dynamicWith = dynamicWith; +/** + * Get the luminance of the color. + * + * @param rgbColor - The RGB color to get luminance for. + * + * @deprecated This symbol has been moved to `Color.luminanceFrom` and will be removed + * in the future. + */ +const luminanceFrom = exports.Color.luminanceFrom; +exports.luminanceFrom = luminanceFrom; +/** + * Compare two colors for equality. + * + * @param color1 - Left hand side color to compare. + * @param color2 - Right hand side color to compare. + * @returns A Boolean indicating whether the colors are equal. + * + * @deprecated This symbol has been moved to `Color.areEqual` and will be removed + * in the future. + */ +const areEqual = exports.Color.areEqual; +exports.areEqual = areEqual; +// endregion +//# sourceMappingURL=color.js.map
\ No newline at end of file diff --git a/node_modules/@jet/environment/models/index.js b/node_modules/@jet/environment/models/index.js new file mode 100644 index 0000000..a041c4c --- /dev/null +++ b/node_modules/@jet/environment/models/index.js @@ -0,0 +1,25 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./actions"), exports); +__exportStar(require("./artwork"), exports); +__exportStar(require("./button"), exports); +__exportStar(require("./color"), exports); +__exportStar(require("./menu"), exports); +__exportStar(require("./paragraph"), exports); +__exportStar(require("./programmed-text"), exports); +__exportStar(require("./video"), exports); +//# sourceMappingURL=index.js.map
\ No newline at end of file diff --git a/node_modules/@jet/environment/models/menu.js b/node_modules/@jet/environment/models/menu.js new file mode 100644 index 0000000..200dc6b --- /dev/null +++ b/node_modules/@jet/environment/models/menu.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.menuSeparatorID = void 0; +/** + * A standard identifier for including a separator in a menu. + */ +exports.menuSeparatorID = "com.apple.JetEngine.separator"; +//# sourceMappingURL=menu.js.map
\ No newline at end of file diff --git a/node_modules/@jet/environment/models/paragraph.js b/node_modules/@jet/environment/models/paragraph.js new file mode 100644 index 0000000..3518ea7 --- /dev/null +++ b/node_modules/@jet/environment/models/paragraph.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// endregion +//# sourceMappingURL=paragraph.js.map
\ No newline at end of file diff --git a/node_modules/@jet/environment/models/programmed-text.js b/node_modules/@jet/environment/models/programmed-text.js new file mode 100644 index 0000000..18a8337 --- /dev/null +++ b/node_modules/@jet/environment/models/programmed-text.js @@ -0,0 +1,5 @@ +"use strict"; +// region ProgrammedText +Object.defineProperty(exports, "__esModule", { value: true }); +// endregion +//# sourceMappingURL=programmed-text.js.map
\ No newline at end of file diff --git a/node_modules/@jet/environment/models/video.js b/node_modules/@jet/environment/models/video.js new file mode 100644 index 0000000..0f0031f --- /dev/null +++ b/node_modules/@jet/environment/models/video.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=video.js.map
\ No newline at end of file |
