{"version":3,"sources":["_init.js","Group/Default.js","Text/Notes.js","Animation/Confetti/Confetti.js"],"names":["_Class","window","globalThis","async","imports","urls","sf","loader","mjs","Promise","all","map","v","import","task","Blackprint","loadScope","url","hasInterface","hasDocs","Context","createContext","EventSlot","slot","registerNode","Node","constructor","instance","super","Environment","isBrowser","this","setInterface","title","imported","data","iface","width","height","textContent","color","fontColor","syncIn","eventName","value","refreshContent","registerInterface","Interface","node","Port","DepsLoader","js","optional","local","cdn","trigger","ParticleCount","StartVelocity","Spread","input","x","y","offset","pos","scope","oX","oY","pX","pY","confetti","particleCount","startVelocity","spread","origin","innerWidth","innerHeight","Trigger","port","Default","Number"],"mappings":";;AAAA,aAAA,IAAAA,OAAA,QAAA,IAAAC,OAAA,IAAAA,OAAAC,WAAAC,eAAAC,QAAAC,GAAA,MAAA,oBAAAC,SAAA,IAAAA,GAAAC,aAAAD,GAAAC,OAAAC,IAAAH,GAAAI,QAAAC,IAAAL,EAAAM,IAAAC,GAAAC,OAAAD,IAAA,CAAAR,QAAAU,KAAA,WAAA,MAAA,oBAAAR,SAAA,IAAAA,GAAAC,OAAAD,GAAAC,OAAAO,KAAA,IAAA,EAGA,IAAAC,WAAAd,OAAAc,WAAAC,UAAA,CAGAC,gBAAAA,IAGAC,cAAA,EAGAC,SAAA,IAIAC,QAAAL,WAAAM,cAAA,cAIAD,QAAAE,UAAA,CAAAC,KAAA,yBCfAR,WAAAS,aAAA,2BACA,cAAAT,WAAAU,KACAC,WAAAA,CAAAC,GAGA,GAFAC,MAAAD,IAEAZ,WAAAc,YAAAC,UAEA,YADAC,KAAAC,eAIAD,KAAAC,aAAA,iCACAC,MAAA,SACA,CAEAC,QAAAA,CAAAC,GACApB,WAAAc,YAAAC,gBACA,IAAAK,IAGAJ,KAAAK,MAAAD,KAAAE,MAAAF,EAAAE,OAAA,IACAN,KAAAK,MAAAD,KAAAG,OAAAH,EAAAG,QAAA,IACAP,KAAAK,MAAAD,KAAAF,MAAAE,EAAAF,OAAA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AAAA,EAAAC,IAAAA,GAAAhC,KAAAJ,SAAAqC,MAAA,cACAJ,EAAAK,EAAAJ,EAAAK,GAAAJ,GACAF,EAAAO,EAAAN,EAAAO,GAAAL,EAEAM,SAAA,CACAC,cAAAd,EACAe,cAAAd,EACAe,OAAAd,EACAe,OAAA,CACAb,GAAAA,EAAAO,EAAAF,EAAA,KAAAhE,OAAAyE,WACAb,GAAAA,EAAAO,EAAAF,GAAAjE,OAAA0E,cAGA,IAlCAhB,MAAA,CAEAiB,QAAA3B,KAAA2B,QAAAC,GAAAA,EAAAzC,MAAAY,KAAAO,WAEAC,cAAAP,KAAA6B,QAAAC,OAAA,KAEAtB,cAAAR,KAAA6B,QAAAC,OAAA,IAEArB,OAAAT,KAAA6B,QAAAC,OAAA,MACA/E","file":"nodes-decoration.mjs","sourcesContent":["// We don't have graphics node for non-browser :3\n// Let's just use this file to load .sf.mjs and .sf.css\n\nlet Blackprint = window.Blackprint.loadScope({\n\t// You can find the URL on Blackprint menu -> Modules\n\t// This will also be exported to JSON if this module's nodes is being used\n\turl: import.meta.url,\n\n\t// This will autoload (*.sf.mjs) and (*.sf.css) file for Browser\n\thasInterface: true,\n\n\t// This will autoload (*.docs.json) for Browser\n\thasDocs: true,\n});\n\n// Global shared context\nlet Context = Blackprint.createContext('Decoration');\n\n// This is needed to avoid duplicated event listener when using hot reload\n// Event listener that registered with same slot will be replaced\nContext.EventSlot = {slot: 'my-private-event-slot'};","/**\n * Decoration node that can be used to group nodes and move it together\n * To change this node's settings, you can find it on editor's right-side panel\n * @blackprint node\n */\nBlackprint.registerNode('Decoration/Group/Default',\nclass extends Blackprint.Node {\n\tconstructor(instance){\n\t\tsuper(instance);\n\n\t\tif(!Blackprint.Environment.isBrowser){\n\t\t\tthis.setInterface(); // use default interface for Node.js/Deno\n\t\t\treturn;\n\t\t}\n\n\t\tlet iface = this.setInterface('BPIC/Decoration/Group/Default'); // Interface path\n\t\tiface.title = 'Default';\n\t}\n\n\timported(data){\n\t\tif(!Blackprint.Environment.isBrowser) return;\n\t\tif(data === void 0) return;\n\n\t\t// When this node was successfully imported\n\t\tthis.iface.data.width = data.width || 100;\n\t\tthis.iface.data.height = data.height || 100;\n\t\tthis.iface.data.title = data.title || '';\n\t\tthis.iface.data.textContent = data.textContent || '';\n\t\tthis.iface.data.color = data.color || '';\n\t\tthis.iface.data.fontColor = data.fontColor || '';\n\t}\n\n\tsyncIn(eventName, value){\n\t\tif(eventName === 'trigger'){\n\t\t\tif(value === 'refreshContent') this.iface.refreshContent({}, true);\n\t\t\treturn;\n\t\t}\n\n\t\tif(this.iface.data[eventName] != null)\n\t\t\tthis.iface.data[eventName] = value;\n\t}\n});\n\nBlackprint.registerInterface('BPIC/Decoration/Group/Default',\nclass extends Blackprint.Interface{\n\tconstructor(node){\n\t\tsuper(node);\n\t\tthis.data ??= {}; // Dummy object store for non-sketch interface\n\t}\n\n\trefreshContent(){} // Do nothing for Engine only\n});","/**\n * A decoration that can be used to give additional details on something\n * @blackprint node\n */\nBlackprint.registerNode('Decoration/Text/Notes',\nclass extends Blackprint.Node {\n\tconstructor(instance){\n\t\tsuper(instance);\n\n\t\tif(!Blackprint.Environment.isBrowser){\n\t\t\tthis.setInterface(); // use default interface for Node.js/Deno\n\t\t\treturn;\n\t\t}\n\n\t\tlet iface = this.setInterface('BPIC/Decoration/Text/Notes'); // Interface path\n\t\tiface.title = 'Notes';\n\t}\n\n\timported(data){\n\t\tif(!Blackprint.Environment.isBrowser) return;\n\t\tif(data === void 0) return;\n\n\t\t// When this node was successfully imported\n\t\tthis.iface.data.value = data.value;\n\t}\n\n\tsyncIn(eventName, value){\n\t\tif(eventName === 'value')\n\t\t\tthis.iface.data.value = value;\n\t}\n});","var { Port } = Blackprint;\n\n// Load confetti deps\nawait Blackprint.DepsLoader.js({\n\toptional: true, // suppress error message if not resolved\n\n\twindow: ['confetti'],\n\n\t// need to use 'npm install' first or must exist on node_modules, will dynamically imported\n\tlocal: ['canvas-confetti'],\n\n\t// for browser, Deno, or supported environment that have internet access\n\tcdn: [\"https://cdn.jsdelivr.net/npm/canvas-confetti@1.5.1/dist/confetti.browser.min.js\"]\n});\n\n/**\n * Create a confetti that can be triggered by other nodes\n * @blackprint node\n * @summary Decoration animation\n */\nBlackprint.registerNode('Decoration/Animation/Confetti/Create',\nclass extends Blackprint.Node {\n\tstatic input = {\n\t\t/** Trigger the confetti */\n\t\tTrigger: Port.Trigger(port => port.iface.node.trigger()),\n\t\t/** Amount of confetti particle */\n\t\tParticleCount: Port.Default(Number, 100),\n\t\t/** Particle's velocity */\n\t\tStartVelocity: Port.Default(Number, 30),\n\t\t/** Particle's spread value */\n\t\tSpread: Port.Default(Number, 360),\n\t};\n\tconstructor(instance){\n\t\tsuper(instance);\n\n\t\tlet iface = this.setInterface();\n\t\tiface.title = \"Create Confetti\";\n\t}\n\ttrigger(){\n\t\tif(!Blackprint.Environment.isBrowser) return;\n\n\t\tlet { ParticleCount, StartVelocity, Spread } = this.input;\n\t\tlet { x, y } = this.iface;\n\t\tlet { offset, pos } = this.instance.scope('container');\n\t\tlet { x: oX, y: oY } = offset;\n\t\tlet { x: pX, y: pY } = pos;\n\n\t\tconfetti({\n\t\t\tparticleCount: ParticleCount,\n\t\t\tstartVelocity: StartVelocity,\n\t\t\tspread: Spread,\n\t\t\torigin: {\n\t\t\t\tx: (x + pX + oX + 100) / window.innerWidth,\n\t\t\t\ty: (y + pY + oY) / window.innerHeight,\n\t\t\t},\n\t\t});\n\t}\n});"]}