{"id":13613915,"url":"https://github.com/valgaze/sugar","last_synced_at":"2025-10-11T13:21:54.672Z","repository":{"id":44214231,"uuid":"223018773","full_name":"valgaze/sugar","owner":"valgaze","description":"Some $ugar for customizing collaboration tools","archived":false,"fork":false,"pushed_at":"2023-01-05T02:44:59.000Z","size":4157,"stargazers_count":5,"open_issues_count":6,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-09T07:38:53.596Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/valgaze.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-20T20:10:56.000Z","updated_at":"2023-08-22T14:19:47.000Z","dependencies_parsed_at":"2023-02-03T07:01:25.795Z","dependency_job_id":null,"html_url":"https://github.com/valgaze/sugar","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/valgaze/sugar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valgaze%2Fsugar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valgaze%2Fsugar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valgaze%2Fsugar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valgaze%2Fsugar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/valgaze","download_url":"https://codeload.github.com/valgaze/sugar/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valgaze%2Fsugar/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279007317,"owners_count":26084280,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T20:00:54.780Z","updated_at":"2025-10-11T13:21:54.638Z","avatar_url":"https://github.com/valgaze.png","language":"JavaScript","funding_links":[],"categories":["Building Blocks"],"sub_categories":[],"readme":"# sugar\n\nFor the impatient, just go here: **[quickstart.md](./quickstart.md)**\n\n```md\n    8 8                                                                 \n ad88888ba   88        88    ,ad8888ba,         db         88888888ba   \nd8\" 8 8 \"8b  88        88   d8\"'    `\"8b       d88b        88      \"8b  \nY8, 8 8      88        88  d8'                d8'`8b       88      ,8P  \n`Y8a8a8a,    88        88  88                d8'  `8b      88aaaaaa8P'  \n  `\"8\"8\"8b,  88        88  88      88888    d8YaaaaY8b     88\"\"\"\"88'    \n    8 8 `8b  88        88  Y8,        88   d8\"\"\"\"\"\"\"\"8b    88    `8b    \nY8a 8 8 a8P  Y8a.    .a8P   Y8a.    .a88  d8'        `8b   88     `8b   \n \"Y88888P\"    `\"Y8888Y\"'     `\"Y88888P\"  d8'          `8b  88      `8b  \n    8 8                                                                                                                    \n```\n\nSyntactic \"$ugar\" for handling user input \u0026 other tasks on collaboration hardware\n\n\n----------\n\n## What is $ugar?\n\n$ugar makes it simple to write code that handles user input:\n\n![copy](./assets/sugar.png)\n\n$ugar isn't a library, it's a bit of so-called [syntactic \"$ugar\"](https://en.wikipedia.org/wiki/Syntactic_sugar) for the incredible [JSXAPI](https://www.npmjs.com/package/jsxapi) [library](https://github.com/cisco-ce/jsxapi)\n\nIt fills a very specific niche to make user interactivty a bit simpler (ie input box, prompts, widgets, etc)\n\n## How I \"install\" $ugar?\n\nThere are no build/setup steps or dependencies for $ugar-- just copy the [library.js](library.js) (or [library_min.js](library_min.js)) file and paste it in the bottom of your macro\n\nJust make sure your macro imports XAPI: ```const xapi = require('xapi');```\n\n## Examples\n\nSee the [examples directory](./examples) for some sample user-interfaces and associated macro code to handle interactivity\n\nSee the [docs directory](./docs) for a listing of helpers and other functions\n\n### Ex. Action Button handler\n\n```js\n$('button1').on('click', (event) =\u003e {\n  // In here you can invoke other methods, post to a web service, etc \n  $().call('joe@cisco.webex.com');  // initiate webex call\n});\n```\n\n### Ex. Input Box (tap a button, bring up input box then do something with input)\n\n```js\n$('button2').on('input', (event) =\u003e {\n  console.log(event); // event: { id: '1', FeedbackId: '__button2', Text: 'bongo' }\n  const userData = `You entered ${event.Text}!`;\n  $().alert(userData);\n});\n```\n\n### Ex. Widget \n\n```js\n$('widget_id').on('widget_action', (event) =\u003e {\n    console.log(\"#\", event);\n    // { id: '1', WidgetId: 'widget_id', Value: '2', Type: 'pressed' }\n    // { id: '1', WidgetId: 'widget_id', Value: '2', Type: 'released' }\n});\n```\n\n\n### Ex. Prompt\n\nNote: for \"utility functions\" like ```prompt``` no parameter required for the $ugar function\n\n```js\n\n$().prompt(['choice a','choice b','choice c','choice d', 'choice e'], 'How was it?', 'Pick one below', (event) =\u003e {\n    console.log(\"## Prompt payload!\", event);\n});\n\n```\n\n```js\n$('widget_id').on('widget_action', (event) =\u003e {\n    console.log(\"#\", event);\n    // { id: '1', WidgetId: 'widget_id', Value: '2', Type: 'pressed' }\n    // { id: '1', WidgetId: 'widget_id', Value: '2', Type: 'released' }\n});\n```\n\nAlso lots of various utility helpers that alias common tasks: (ex ```$().alert```, ```$().prompt```), see more in the [API Reference](./docs/sugar_reference.md)\n\n## Useful Resources + References\n\n* Macros 101: https://help.webex.com/en-us/np8b6m6/Use-of-Macros-with-Room-and-Desk-Devices-and-Webex-Boards\n\n* https://www.cisco.com/c/dam/en/us/td/docs/telepresence/endpoint/ce95/macro-scripting-tutorial.pdf\n\n* https://www.cisco.com/c/dam/en/us/td/docs/telepresence/endpoint/ce93/collaboration-endpoint-software-api-reference-guide-ce93.pdf\n\n* Lots of configuration guides: https://www.cisco.com/c/en/us/support/collaboration-endpoints/spark-room-kit-series/products-installation-and-configuration-guides-list.html\n\n* https://github.com/CiscoDevNet/awesome-xapi\n\n* https://github.com/cisco-ce/jsxapi\n\n* https://www.youtube.com/watch?v=TSP0e5rXUl8\n\n\n## Tests\n\nGiven environment restrictions $ugar is not a commonjs/AMD/RequireJS exported library, see below to run basic tests\n\n```js\n\nnpm i  # install testing dependencies\n\nnpm test # run tests\n\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalgaze%2Fsugar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvalgaze%2Fsugar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalgaze%2Fsugar/lists"}