@vibes.diy/use-vibes-base 0.0.0-dev-fresh-data

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.
Files changed (164) hide show
  1. package/LICENSE.md +232 -0
  2. package/ManualRedirectStrategy.d.ts +24 -0
  3. package/ManualRedirectStrategy.js +289 -0
  4. package/ManualRedirectStrategy.js.map +1 -0
  5. package/README.md +549 -0
  6. package/components/AuthWall/AuthWall.d.ts +8 -0
  7. package/components/AuthWall/AuthWall.js +161 -0
  8. package/components/AuthWall/AuthWall.js.map +1 -0
  9. package/components/AuthWall/AuthWall.styles.d.ts +24 -0
  10. package/components/AuthWall/AuthWall.styles.js +82 -0
  11. package/components/AuthWall/AuthWall.styles.js.map +1 -0
  12. package/components/BrutalistCard/BrutalistCard.d.ts +8 -0
  13. package/components/BrutalistCard/BrutalistCard.js +11 -0
  14. package/components/BrutalistCard/BrutalistCard.js.map +1 -0
  15. package/components/BrutalistCard/BrutalistCard.styles.d.ts +4 -0
  16. package/components/BrutalistCard/BrutalistCard.styles.js +66 -0
  17. package/components/BrutalistCard/BrutalistCard.styles.js.map +1 -0
  18. package/components/BrutalistCard/index.d.ts +3 -0
  19. package/components/BrutalistCard/index.js +2 -0
  20. package/components/BrutalistCard/index.js.map +1 -0
  21. package/components/ControlsBar.d.ts +20 -0
  22. package/components/ControlsBar.js +108 -0
  23. package/components/ControlsBar.js.map +1 -0
  24. package/components/HiddenMenuWrapper/HiddenMenuWrapper.d.ts +7 -0
  25. package/components/HiddenMenuWrapper/HiddenMenuWrapper.js +103 -0
  26. package/components/HiddenMenuWrapper/HiddenMenuWrapper.js.map +1 -0
  27. package/components/HiddenMenuWrapper/HiddenMenuWrapper.styles.d.ts +31 -0
  28. package/components/HiddenMenuWrapper/HiddenMenuWrapper.styles.js +86 -0
  29. package/components/HiddenMenuWrapper/HiddenMenuWrapper.styles.js.map +1 -0
  30. package/components/ImgGen.css +675 -0
  31. package/components/ImgGen.d.ts +23 -0
  32. package/components/ImgGen.js +260 -0
  33. package/components/ImgGen.js.map +1 -0
  34. package/components/ImgGenUtils/AsyncImg.d.ts +7 -0
  35. package/components/ImgGenUtils/AsyncImg.js +41 -0
  36. package/components/ImgGenUtils/AsyncImg.js.map +1 -0
  37. package/components/ImgGenUtils/ImgGenDisplay.d.ts +3 -0
  38. package/components/ImgGenUtils/ImgGenDisplay.js +240 -0
  39. package/components/ImgGenUtils/ImgGenDisplay.js.map +1 -0
  40. package/components/ImgGenUtils/ImgGenDisplayPlaceholder.d.ts +3 -0
  41. package/components/ImgGenUtils/ImgGenDisplayPlaceholder.js +99 -0
  42. package/components/ImgGenUtils/ImgGenDisplayPlaceholder.js.map +1 -0
  43. package/components/ImgGenUtils/ImgGenDisplayUtils.d.ts +27 -0
  44. package/components/ImgGenUtils/ImgGenDisplayUtils.js +95 -0
  45. package/components/ImgGenUtils/ImgGenDisplayUtils.js.map +1 -0
  46. package/components/ImgGenUtils/ImgGenError.d.ts +3 -0
  47. package/components/ImgGenUtils/ImgGenError.js +9 -0
  48. package/components/ImgGenUtils/ImgGenError.js.map +1 -0
  49. package/components/ImgGenUtils/ImgGenFileDrop.d.ts +11 -0
  50. package/components/ImgGenUtils/ImgGenFileDrop.js +56 -0
  51. package/components/ImgGenUtils/ImgGenFileDrop.js.map +1 -0
  52. package/components/ImgGenUtils/ImgGenModal.d.ts +25 -0
  53. package/components/ImgGenUtils/ImgGenModal.js +67 -0
  54. package/components/ImgGenUtils/ImgGenModal.js.map +1 -0
  55. package/components/ImgGenUtils/ImgGenModeUtils.d.ts +9 -0
  56. package/components/ImgGenUtils/ImgGenModeUtils.js +59 -0
  57. package/components/ImgGenUtils/ImgGenModeUtils.js.map +1 -0
  58. package/components/ImgGenUtils/ImgGenPromptWaiting.d.ts +11 -0
  59. package/components/ImgGenUtils/ImgGenPromptWaiting.js +40 -0
  60. package/components/ImgGenUtils/ImgGenPromptWaiting.js.map +1 -0
  61. package/components/ImgGenUtils/ImgGenUploadWaiting.d.ts +16 -0
  62. package/components/ImgGenUtils/ImgGenUploadWaiting.js +155 -0
  63. package/components/ImgGenUtils/ImgGenUploadWaiting.js.map +1 -0
  64. package/components/ImgGenUtils/index.d.ts +6 -0
  65. package/components/ImgGenUtils/index.js +7 -0
  66. package/components/ImgGenUtils/index.js.map +1 -0
  67. package/components/ImgGenUtils/overlays/DeleteConfirmationOverlay.d.ts +9 -0
  68. package/components/ImgGenUtils/overlays/DeleteConfirmationOverlay.js +31 -0
  69. package/components/ImgGenUtils/overlays/DeleteConfirmationOverlay.js.map +1 -0
  70. package/components/ImgGenUtils/overlays/ImageOverlay.d.ts +22 -0
  71. package/components/ImgGenUtils/overlays/ImageOverlay.js +11 -0
  72. package/components/ImgGenUtils/overlays/ImageOverlay.js.map +1 -0
  73. package/components/ImgGenUtils/types.d.ts +29 -0
  74. package/components/ImgGenUtils/types.js +2 -0
  75. package/components/ImgGenUtils/types.js.map +1 -0
  76. package/components/ImgGenUtils.d.ts +2 -0
  77. package/components/ImgGenUtils.js +3 -0
  78. package/components/ImgGenUtils.js.map +1 -0
  79. package/components/PromptBar.d.ts +11 -0
  80. package/components/PromptBar.js +24 -0
  81. package/components/PromptBar.js.map +1 -0
  82. package/components/VibeControl.d.ts +13 -0
  83. package/components/VibeControl.js +74 -0
  84. package/components/VibeControl.js.map +1 -0
  85. package/components/VibesButton/VibesButton.d.ts +10 -0
  86. package/components/VibesButton/VibesButton.js +20 -0
  87. package/components/VibesButton/VibesButton.js.map +1 -0
  88. package/components/VibesButton/VibesButton.styles.d.ts +6 -0
  89. package/components/VibesButton/VibesButton.styles.js +35 -0
  90. package/components/VibesButton/VibesButton.styles.js.map +1 -0
  91. package/components/VibesPanel/VibesPanel.d.ts +6 -0
  92. package/components/VibesPanel/VibesPanel.js +115 -0
  93. package/components/VibesPanel/VibesPanel.js.map +1 -0
  94. package/components/VibesPanel/index.d.ts +1 -0
  95. package/components/VibesPanel/index.js +2 -0
  96. package/components/VibesPanel/index.js.map +1 -0
  97. package/components/VibesSwitch/VibesSwitch.d.ts +6 -0
  98. package/components/VibesSwitch/VibesSwitch.js +54 -0
  99. package/components/VibesSwitch/VibesSwitch.js.map +1 -0
  100. package/components/VibesSwitch/VibesSwitch.styles.d.ts +4 -0
  101. package/components/VibesSwitch/VibesSwitch.styles.js +5 -0
  102. package/components/VibesSwitch/VibesSwitch.styles.js.map +1 -0
  103. package/constants.d.ts +4 -0
  104. package/constants.js +5 -0
  105. package/constants.js.map +1 -0
  106. package/events.d.ts +7 -0
  107. package/events.js +4 -0
  108. package/events.js.map +1 -0
  109. package/hooks/image-gen/image-generator.d.ts +11 -0
  110. package/hooks/image-gen/image-generator.js +146 -0
  111. package/hooks/image-gen/image-generator.js.map +1 -0
  112. package/hooks/image-gen/index.d.ts +7 -0
  113. package/hooks/image-gen/index.js +6 -0
  114. package/hooks/image-gen/index.js.map +1 -0
  115. package/hooks/image-gen/use-image-gen.d.ts +2 -0
  116. package/hooks/image-gen/use-image-gen.js +554 -0
  117. package/hooks/image-gen/use-image-gen.js.map +1 -0
  118. package/hooks/image-gen/utils.d.ts +19 -0
  119. package/hooks/image-gen/utils.js +150 -0
  120. package/hooks/image-gen/utils.js.map +1 -0
  121. package/hooks/use-image-gen.d.ts +1 -0
  122. package/hooks/use-image-gen.js +2 -0
  123. package/hooks/use-image-gen.js.map +1 -0
  124. package/hooks/vibes-gen/IframeVibesComponent.d.ts +10 -0
  125. package/hooks/vibes-gen/IframeVibesComponent.js +67 -0
  126. package/hooks/vibes-gen/IframeVibesComponent.js.map +1 -0
  127. package/hooks/vibes-gen/index.d.ts +2 -0
  128. package/hooks/vibes-gen/index.js +2 -0
  129. package/hooks/vibes-gen/index.js.map +1 -0
  130. package/hooks/vibes-gen/use-vibes.d.ts +3 -0
  131. package/hooks/vibes-gen/use-vibes.js +185 -0
  132. package/hooks/vibes-gen/use-vibes.js.map +1 -0
  133. package/index.d.ts +68 -0
  134. package/index.js +340 -0
  135. package/index.js.map +1 -0
  136. package/install-tracker.d.ts +30 -0
  137. package/install-tracker.js +246 -0
  138. package/install-tracker.js.map +1 -0
  139. package/package.json +47 -0
  140. package/stories/VibeControl.stories.d.ts +13 -0
  141. package/stories/VibeControl.stories.js +195 -0
  142. package/stories/VibeControl.stories.js.map +1 -0
  143. package/tsconfig.json +18 -0
  144. package/utils/appSlug.d.ts +17 -0
  145. package/utils/appSlug.js +175 -0
  146. package/utils/appSlug.js.map +1 -0
  147. package/utils/base64.d.ts +1 -0
  148. package/utils/base64.js +13 -0
  149. package/utils/base64.js.map +1 -0
  150. package/utils/debug.d.ts +2 -0
  151. package/utils/debug.js +8 -0
  152. package/utils/debug.js.map +1 -0
  153. package/utils/style-utils.d.ts +4 -0
  154. package/utils/style-utils.js +15 -0
  155. package/utils/style-utils.js.map +1 -0
  156. package/utils/styles.d.ts +325 -0
  157. package/utils/styles.js +328 -0
  158. package/utils/styles.js.map +1 -0
  159. package/utils/vibe-control-styles.d.ts +148 -0
  160. package/utils/vibe-control-styles.js +170 -0
  161. package/utils/vibe-control-styles.js.map +1 -0
  162. package/vibe-app-mount.d.ts +13 -0
  163. package/vibe-app-mount.js +124 -0
  164. package/vibe-app-mount.js.map +1 -0
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@vibes.diy/use-vibes-base",
3
+ "version": "0.0.0-dev-fresh-data",
4
+ "type": "module",
5
+ "description": "Core components and utilities for use-vibes (internal workspace package)",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./index.d.ts",
9
+ "import": "./index.js"
10
+ }
11
+ },
12
+ "license": "Apache-2.0",
13
+ "dependencies": {
14
+ "@adviser/cement": "^0.4.53",
15
+ "@fireproof/core-runtime": "^0.23.15",
16
+ "@fireproof/core-types-base": "^0.23.15",
17
+ "@fireproof/core-types-protocols-cloud": "^0.23.15",
18
+ "@vibes.diy/prompts": "^0.0.0-dev-fresh-data",
19
+ "@vibes.diy/use-vibes-types": "^0.0.0-dev-fresh-data",
20
+ "call-ai": "^0.0.0-dev-fresh-data",
21
+ "react-dom": "^19.2.0",
22
+ "use-fireproof": "^0.23.15",
23
+ "uuid": "^11.1.0"
24
+ },
25
+ "peerDependencies": {
26
+ "react": ">=19.1.0"
27
+ },
28
+ "devDependencies": {
29
+ "@chromatic-com/storybook": "^4.1.1",
30
+ "@fireproof/core-cli": "^0.23.15",
31
+ "@storybook/addon-a11y": "^9.1.13",
32
+ "@storybook/addon-docs": "^10.0.0",
33
+ "@storybook/react": "^9.1.13",
34
+ "@storybook/react-vite": "^10.0.0",
35
+ "@types/react": "~19.2.2",
36
+ "@types/react-dom": "~19.2.2",
37
+ "@vitest/browser-playwright": "^4.0.2",
38
+ "storybook": "^9.1.6",
39
+ "typescript": "^5.9.3",
40
+ "vite": "^7.1.12"
41
+ },
42
+ "scripts": {
43
+ "build": "core-cli tsc",
44
+ "storybook": "storybook dev -p 6007",
45
+ "build-storybook": "storybook build"
46
+ }
47
+ }
@@ -0,0 +1,13 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import type { VibeControlProps } from '../components/VibeControl.js';
3
+ declare const meta: Meta<VibeControlProps>;
4
+ export default meta;
5
+ type Story = StoryObj<VibeControlProps>;
6
+ export declare const Default: Story;
7
+ export declare const BottomLeft: Story;
8
+ export declare const TopRight: Story;
9
+ export declare const TopLeft: Story;
10
+ export declare const WithCustomContent: Story;
11
+ export declare const WithRichContent: Story;
12
+ export declare const Hidden: Story;
13
+ export declare const WithCustomStyling: Story;
@@ -0,0 +1,195 @@
1
+ import React from 'react';
2
+ import { VibeControl } from '../components/VibeControl.js';
3
+ const meta = {
4
+ title: 'Components/VibeControl',
5
+ component: VibeControl,
6
+ parameters: {
7
+ layout: 'fullscreen',
8
+ docs: {
9
+ description: {
10
+ component: `
11
+ A floating action button that opens a full-screen overlay. Perfect for adding controls, settings, or additional content that doesn't interfere with the main UI.
12
+
13
+ ### Features
14
+ - **Configurable positioning** - Choose from 4 corner positions
15
+ - **Portal rendering** - Avoids z-index conflicts
16
+ - **Keyboard navigation** - Escape key to close
17
+ - **Custom content** - Any React children supported
18
+ - **Event callbacks** - onOpen/onClose integration hooks
19
+ - **Responsive design** - Works on mobile and desktop
20
+ `,
21
+ },
22
+ },
23
+ },
24
+ argTypes: {
25
+ position: {
26
+ control: { type: 'select' },
27
+ options: ['bottom-right', 'bottom-left', 'top-right', 'top-left'],
28
+ description: 'Position of the floating button',
29
+ },
30
+ label: {
31
+ control: { type: 'text' },
32
+ description: 'Text displayed on the button',
33
+ },
34
+ visible: {
35
+ control: { type: 'boolean' },
36
+ description: 'Whether to show the component',
37
+ },
38
+ onOpen: {
39
+ action: 'opened',
40
+ description: 'Callback when overlay opens',
41
+ },
42
+ onClose: {
43
+ action: 'closed',
44
+ description: 'Callback when overlay closes',
45
+ },
46
+ children: {
47
+ control: { type: 'text' },
48
+ description: 'Custom content for the overlay',
49
+ },
50
+ },
51
+ };
52
+ export default meta;
53
+ export const Default = {
54
+ args: {
55
+ label: 'Open Vibes',
56
+ position: 'bottom-right',
57
+ visible: true,
58
+ },
59
+ };
60
+ export const BottomLeft = {
61
+ args: {
62
+ label: 'Bottom Left',
63
+ position: 'bottom-left',
64
+ visible: true,
65
+ },
66
+ };
67
+ export const TopRight = {
68
+ args: {
69
+ label: 'Top Right',
70
+ position: 'top-right',
71
+ visible: true,
72
+ },
73
+ };
74
+ export const TopLeft = {
75
+ args: {
76
+ label: 'Top Left',
77
+ position: 'top-left',
78
+ visible: true,
79
+ },
80
+ };
81
+ export const WithCustomContent = {
82
+ args: {
83
+ label: 'Settings',
84
+ position: 'bottom-right',
85
+ visible: true,
86
+ children: (React.createElement("div", null,
87
+ React.createElement("h3", { style: { margin: '0 0 16px 0', fontSize: '24px', fontWeight: '700' } }, "Settings Panel"),
88
+ React.createElement("div", { style: { marginBottom: '16px' } },
89
+ React.createElement("label", { style: { display: 'block', marginBottom: '8px', fontWeight: '600' } }, "Theme Preference"),
90
+ React.createElement("select", { style: { width: '100%', padding: '8px', borderRadius: '4px', border: '1px solid #ccc' } },
91
+ React.createElement("option", null, "Light"),
92
+ React.createElement("option", null, "Dark"),
93
+ React.createElement("option", null, "Auto"))),
94
+ React.createElement("div", { style: { marginBottom: '16px' } },
95
+ React.createElement("label", { style: { display: 'flex', alignItems: 'center', gap: '8px' } },
96
+ React.createElement("input", { type: "checkbox", defaultChecked: true }),
97
+ React.createElement("span", null, "Enable notifications"))),
98
+ React.createElement("div", { style: { marginBottom: '16px' } },
99
+ React.createElement("label", { style: { display: 'flex', alignItems: 'center', gap: '8px' } },
100
+ React.createElement("input", { type: "checkbox" }),
101
+ React.createElement("span", null, "Auto-save changes"))),
102
+ React.createElement("div", { style: { display: 'flex', gap: '8px', marginTop: '20px' } },
103
+ React.createElement("button", { style: {
104
+ padding: '8px 16px',
105
+ backgroundColor: '#0066cc',
106
+ color: 'white',
107
+ border: 'none',
108
+ borderRadius: '4px',
109
+ cursor: 'pointer',
110
+ } }, "Save Changes"),
111
+ React.createElement("button", { style: {
112
+ padding: '8px 16px',
113
+ backgroundColor: '#f5f5f5',
114
+ color: '#333',
115
+ border: '1px solid #ccc',
116
+ borderRadius: '4px',
117
+ cursor: 'pointer',
118
+ } }, "Cancel")))),
119
+ },
120
+ };
121
+ export const WithRichContent = {
122
+ args: {
123
+ label: 'Help & Info',
124
+ position: 'bottom-right',
125
+ visible: true,
126
+ children: (React.createElement("div", null,
127
+ React.createElement("h3", { style: { margin: '0 0 16px 0', fontSize: '24px', fontWeight: '700' } }, "Welcome to VibeControl"),
128
+ React.createElement("div", { style: { marginBottom: '20px', lineHeight: '1.6' } },
129
+ React.createElement("p", null, "VibeControl provides a floating action button that opens rich overlay content. Perfect for settings, help content, or any additional functionality.")),
130
+ React.createElement("div", { style: {
131
+ marginBottom: '20px',
132
+ padding: '16px',
133
+ backgroundColor: '#f0f8ff',
134
+ borderRadius: '8px',
135
+ border: '1px solid #bbdefb',
136
+ } },
137
+ React.createElement("h4", { style: { margin: '0 0 8px 0', color: '#1976d2' } }, "Key Features"),
138
+ React.createElement("ul", { style: { margin: 0, paddingLeft: '20px', color: '#1976d2' } },
139
+ React.createElement("li", null, "Portal rendering avoids z-index issues"),
140
+ React.createElement("li", null, "Escape key and backdrop click to close"),
141
+ React.createElement("li", null, "Four corner position options"),
142
+ React.createElement("li", null, "Fully customizable overlay content"),
143
+ React.createElement("li", null, "Event callbacks for integration"))),
144
+ React.createElement("div", { style: {
145
+ marginBottom: '20px',
146
+ padding: '16px',
147
+ backgroundColor: '#f3e5f5',
148
+ borderRadius: '8px',
149
+ border: '1px solid #e1bee7',
150
+ } },
151
+ React.createElement("h4", { style: { margin: '0 0 8px 0', color: '#7b1fa2' } }, "Usage Examples"),
152
+ React.createElement("ul", { style: { margin: 0, paddingLeft: '20px', color: '#7b1fa2' } },
153
+ React.createElement("li", null, "Application settings and preferences"),
154
+ React.createElement("li", null, "User help and documentation"),
155
+ React.createElement("li", null, "Additional navigation or tools"),
156
+ React.createElement("li", null, "Context-sensitive controls"))),
157
+ React.createElement("button", { style: {
158
+ width: '100%',
159
+ padding: '12px',
160
+ backgroundColor: '#4caf50',
161
+ color: 'white',
162
+ border: 'none',
163
+ borderRadius: '4px',
164
+ fontSize: '16px',
165
+ cursor: 'pointer',
166
+ }, onClick: () => alert('Action triggered!') }, "Try It Out!"))),
167
+ },
168
+ };
169
+ export const Hidden = {
170
+ args: {
171
+ label: "This Won't Show",
172
+ position: 'bottom-right',
173
+ visible: false,
174
+ },
175
+ };
176
+ export const WithCustomStyling = {
177
+ args: {
178
+ label: '🎨 Styled',
179
+ position: 'bottom-right',
180
+ visible: true,
181
+ classes: {
182
+ button: 'custom-button',
183
+ backdrop: 'custom-backdrop',
184
+ overlay: 'custom-overlay',
185
+ overlayTitle: 'custom-title',
186
+ closeButton: 'custom-close',
187
+ content: 'custom-content',
188
+ },
189
+ children: (React.createElement("div", null,
190
+ React.createElement("h3", null, "Custom Styled Overlay"),
191
+ React.createElement("p", null, "This example shows how you can customize the styling using CSS classes."),
192
+ React.createElement("p", null, "You can override the default styles by providing custom classes for each element of the component."))),
193
+ },
194
+ };
195
+ //# sourceMappingURL=VibeControl.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VibeControl.stories.js","sourceRoot":"","sources":["../../jsr/stories/VibeControl.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAG3D,MAAM,IAAI,GAA2B;IACnC,KAAK,EAAE,wBAAwB;IAC/B,SAAS,EAAE,WAAW;IACtB,UAAU,EAAE;QACV,MAAM,EAAE,YAAY;QACpB,IAAI,EAAE;YACJ,WAAW,EAAE;gBACX,SAAS,EAAE;;;;;;;;;;SAUV;aACF;SACF;KACF;IACD,QAAQ,EAAE;QACR,QAAQ,EAAE;YACR,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC3B,OAAO,EAAE,CAAC,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,CAAC;YACjE,WAAW,EAAE,iCAAiC;SAC/C;QACD,KAAK,EAAE;YACL,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;YACzB,WAAW,EAAE,8BAA8B;SAC5C;QACD,OAAO,EAAE;YACP,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;YAC5B,WAAW,EAAE,+BAA+B;SAC7C;QACD,MAAM,EAAE;YACN,MAAM,EAAE,QAAQ;YAChB,WAAW,EAAE,6BAA6B;SAC3C;QACD,OAAO,EAAE;YACP,MAAM,EAAE,QAAQ;YAChB,WAAW,EAAE,8BAA8B;SAC5C;QACD,QAAQ,EAAE;YACR,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;YACzB,WAAW,EAAE,gCAAgC;SAC9C;KACF;CACF,CAAC;AAEF,eAAe,IAAI,CAAC;AAIpB,MAAM,CAAC,MAAM,OAAO,GAAU;IAC5B,IAAI,EAAE;QACJ,KAAK,EAAE,Y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AC3B,IAAI,EAAE;QACJ,KAAK,EAAE,iBAAiB;QACxB,QAAQ,EAAE,cAAc;QACxB,OAAO,EAAE,KAAK;KACf;CACF,CAAC;AAGF,MAAM,CAAC,MAAM,iBAAiB,GAAU;IACtC,IAAI,EAAE;QACJ,KAAK,EAAE,aAAU;QACjB,QAAQ,EAAE,cAAc;QACxB,OAAO,EAAE,IAAI;QACb,OAAO,EAAE;YACP,MAAM,EAAE,eAAe;YACvB,QAAQ,EAAE,iBAAiB;YAC3B,OAAO,EAAE,gBAAgB;YACzB,YAAY,EAAE,cAAc;YAC5B,WAAW,EAAE,cAAc;YAC3B,OAAO,EAAE,gBAAgB;SAC1B;QACD,QAAQ,EAAE,CACR;YACE,wDAA8B;YAC9B,yGAA8E;YAC9E,oIAGI,CACA,CACP;KACF;CACF,CAAC"}
package/tsconfig.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "extends": [
3
+ "/home/runner/work/vibes.diy/vibes.diy/tsconfig.dist.json"
4
+ ],
5
+ "compilerOptions": {
6
+ "outDir": "../npm/",
7
+ "noEmit": false
8
+ },
9
+ "include": [
10
+ "**/*"
11
+ ],
12
+ "exclude": [
13
+ "node_modules",
14
+ "dist",
15
+ ".git",
16
+ ".vscode"
17
+ ]
18
+ }
@@ -0,0 +1,17 @@
1
+ export declare function getAppSlug(): string;
2
+ export declare function getFullAppIdentifier(): string;
3
+ export declare function isDevelopmentEnvironment(): boolean;
4
+ export declare function isProductionEnvironment(): boolean;
5
+ export declare function generateRandomInstanceId(): string;
6
+ export declare function generateFreshDataUrl(): string;
7
+ export declare function generateRemixUrl(): string;
8
+ export interface ParsedSubdomain {
9
+ appSlug: string;
10
+ installId?: string;
11
+ isInstance: boolean;
12
+ fullSubdomain: string;
13
+ }
14
+ export declare function parseSubdomain(hostname: string): ParsedSubdomain;
15
+ export declare function constructSubdomain(appSlug: string, installId?: string): string;
16
+ export declare function isValidSubdomain(parsed: ParsedSubdomain): boolean;
17
+ export declare const generateInstallId: typeof generateRandomInstanceId;
@@ -0,0 +1,175 @@
1
+ const DEFAULT_APP_SLUG = 'atmospheric-tiger-9377';
2
+ export function getAppSlug() {
3
+ if (typeof window === 'undefined') {
4
+ return DEFAULT_APP_SLUG;
5
+ }
6
+ const { hostname, pathname } = window.location;
7
+ if (pathname.startsWith('/vibe/')) {
8
+ const pathPart = pathname.split('/vibe/')[1];
9
+ if (pathPart) {
10
+ const slug = pathPart.split('/')[0];
11
+ return slug.split('_')[0];
12
+ }
13
+ }
14
+ if (hostname.includes('.')) {
15
+ const sub = hostname.split('.')[0];
16
+ if (sub && sub !== 'www' && sub !== 'localhost') {
17
+ const parsed = parseSubdomain(sub);
18
+ return parsed.appSlug || DEFAULT_APP_SLUG;
19
+ }
20
+ }
21
+ return DEFAULT_APP_SLUG;
22
+ }
23
+ export function getFullAppIdentifier() {
24
+ if (typeof window === 'undefined') {
25
+ return DEFAULT_APP_SLUG;
26
+ }
27
+ const { hostname, pathname } = window.location;
28
+ if (pathname.startsWith('/vibe/')) {
29
+ const pathPart = pathname.split('/vibe/')[1];
30
+ if (pathPart) {
31
+ return pathPart.split('/')[0];
32
+ }
33
+ }
34
+ if (hostname.includes('.')) {
35
+ const sub = hostname.split('.')[0];
36
+ if (sub && sub !== 'www' && sub !== 'localhost') {
37
+ const parsed = parseSubdomain(sub);
38
+ if (parsed.isInstance && parsed.installId) {
39
+ if (sub.startsWith('v-')) {
40
+ return `${parsed.appSlug}--${parsed.installId}`;
41
+ }
42
+ return `${parsed.appSlug}_${parsed.installId}`;
43
+ }
44
+ return parsed.appSlug || DEFAULT_APP_SLUG;
45
+ }
46
+ }
47
+ return DEFAULT_APP_SLUG;
48
+ }
49
+ export function isDevelopmentEnvironment() {
50
+ if (typeof window === 'undefined') {
51
+ return false;
52
+ }
53
+ const { hostname, pathname } = window.location;
54
+ return hostname === 'localhost' || hostname === '127.0.0.1' || pathname.startsWith('/vibe/');
55
+ }
56
+ export function isProductionEnvironment() {
57
+ if (typeof window === 'undefined') {
58
+ return false;
59
+ }
60
+ const { hostname } = window.location;
61
+ return hostname.includes('.') && hostname !== 'localhost' && !hostname.startsWith('127.0.0.1');
62
+ }
63
+ export function generateRandomInstanceId() {
64
+ const chars = '0123456789abcdefghijklmnopqrstuvwxyz';
65
+ let result = '';
66
+ if (typeof crypto !== 'undefined' && crypto.getRandomValues) {
67
+ const array = new Uint8Array(12);
68
+ crypto.getRandomValues(array);
69
+ for (let i = 0; i < 12; i++) {
70
+ result += chars[array[i] % chars.length];
71
+ }
72
+ }
73
+ else {
74
+ for (let i = 0; i < 12; i++) {
75
+ result += chars[Math.floor(Math.random() * chars.length)];
76
+ }
77
+ }
78
+ return result;
79
+ }
80
+ export function generateFreshDataUrl() {
81
+ const titleId = getAppSlug();
82
+ const installId = generateRandomInstanceId();
83
+ return `/vibe/${titleId}/${installId}`;
84
+ }
85
+ export function generateRemixUrl() {
86
+ const appSlug = getAppSlug();
87
+ return `https://vibes.diy/remix/${appSlug}`;
88
+ }
89
+ export function parseSubdomain(hostname) {
90
+ const subdomain = hostname.split('.')[0].toLowerCase().trim();
91
+ if (subdomain.startsWith('v-')) {
92
+ const withoutPrefix = subdomain.slice(2);
93
+ if (withoutPrefix.includes('--')) {
94
+ const parts = withoutPrefix.split('--');
95
+ const appSlug = parts[0];
96
+ const installId = parts.slice(1).join('--');
97
+ return {
98
+ appSlug,
99
+ installId,
100
+ isInstance: true,
101
+ fullSubdomain: subdomain,
102
+ };
103
+ }
104
+ else {
105
+ return {
106
+ appSlug: withoutPrefix,
107
+ installId: undefined,
108
+ isInstance: false,
109
+ fullSubdomain: subdomain,
110
+ };
111
+ }
112
+ }
113
+ if (subdomain.includes('_')) {
114
+ const parts = subdomain.split('_');
115
+ const appSlug = parts[0];
116
+ const installId = parts.slice(1).join('_');
117
+ return {
118
+ appSlug,
119
+ installId,
120
+ isInstance: true,
121
+ fullSubdomain: subdomain,
122
+ };
123
+ }
124
+ return {
125
+ appSlug: subdomain,
126
+ installId: undefined,
127
+ isInstance: false,
128
+ fullSubdomain: subdomain,
129
+ };
130
+ }
131
+ export function constructSubdomain(appSlug, installId) {
132
+ if (installId !== undefined) {
133
+ if (installId.trim().length === 0) {
134
+ throw new Error('Install ID cannot be empty string - would create invalid subdomain');
135
+ }
136
+ return `v-${appSlug}--${installId}`;
137
+ }
138
+ return appSlug;
139
+ }
140
+ export function isValidSubdomain(parsed) {
141
+ if (!parsed.appSlug || parsed.appSlug.trim().length === 0) {
142
+ return false;
143
+ }
144
+ if (parsed.isInstance && (!parsed.installId || parsed.installId.trim().length === 0)) {
145
+ return false;
146
+ }
147
+ if (!isValidDNSLabel(parsed.appSlug)) {
148
+ return false;
149
+ }
150
+ if (parsed.isInstance && parsed.installId && !isValidInstallId(parsed.installId)) {
151
+ return false;
152
+ }
153
+ const reservedSubdomains = ['www', 'api', 'admin', 'app'];
154
+ if (reservedSubdomains.includes(parsed.appSlug.toLowerCase())) {
155
+ return false;
156
+ }
157
+ return true;
158
+ }
159
+ function isValidDNSLabel(label) {
160
+ if (label.length === 0 || label.length > 63) {
161
+ return false;
162
+ }
163
+ if (!/^[a-z0-9]/.test(label) || !/[a-z0-9]$/.test(label)) {
164
+ return false;
165
+ }
166
+ return /^[a-z0-9-]+$/.test(label);
167
+ }
168
+ function isValidInstallId(installId) {
169
+ if (installId.length === 0 || installId.length > 100) {
170
+ return false;
171
+ }
172
+ return /^[a-zA-Z0-9_-]+$/.test(installId);
173
+ }
174
+ export const generateInstallId = generateRandomInstanceId;
175
+ //# sourceMappingURL=appSlug.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appSlug.js","sourceRoot":"","sources":["../../jsr/utils/appSlug.ts"],"names":[],"mappings":"AAUA,MAAM,gBAAgB,GAAG,wBAAwB,CAAC;AAyBlD,MAAM,UAAU,UAAU,GAAW;IACnC,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IAED,MAAM,EAAE,QAAQ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,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;QAC9D,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,IAAI,CAAC;AAAA,CACb;AAOD,SAAS,eAAe,CAAC,KAAa,EAAW;IAE/C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;QAC5C,OAAO,KAAK,CAAC;IACf,CAAC;IAGD,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACzD,OAAO,KAAK,CAAC;IACf,CAAC;IAGD,OAAO,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAAA,CACnC;AAOD,SAAS,gBAAgB,CAAC,SAAiB,EAAW;IAGpD,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,IAAI,SAAS,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC;QACrD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAAA,CAC3C;AAKD,MAAM,CAAC,MAAM,iBAAiB,GAAG,wBAAwB,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function base64ToFile(base64Data: string, filename?: string, mimeType?: string): File;
@@ -0,0 +1,13 @@
1
+ export function base64ToFile(base64Data, filename = 'generated-image.png', mimeType = 'image/png') {
2
+ const base64Content = base64Data.includes('base64,')
3
+ ? base64Data.split('base64,')[1]
4
+ : base64Data;
5
+ const binaryStr = atob(base64Content);
6
+ const bytes = new Uint8Array(binaryStr.length);
7
+ for (let i = 0; i < binaryStr.length; i++) {
8
+ bytes[i] = binaryStr.charCodeAt(i);
9
+ }
10
+ const blob = new Blob([bytes], { type: mimeType });
11
+ return new File([blob], filename, { type: mimeType });
12
+ }
13
+ //# sourceMappingURL=base64.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base64.js","sourceRoot":"","sources":["../../jsr/utils/base64.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,YAAY,CAC1B,UAAkB,EAClB,QAAQ,GAAG,qBAAqB,EAChC,QAAQ,GAAG,WAAW,EAChB;IAEN,MAAM,aAAa,GAAG,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC;QAClD,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAChC,CAAC,CAAC,UAAU,CAAC;IAGf,MAAM,SAAS,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC;IAGtC,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC/C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC1C,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC;IAGD,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IACnD,OAAO,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;AAAA,CACvD"}
@@ -0,0 +1,2 @@
1
+ export declare const isDebug: () => boolean;
2
+ export declare function logDebug(...args: unknown[]): void;
package/utils/debug.js ADDED
@@ -0,0 +1,8 @@
1
+ export const isDebug = () => Boolean(import.meta.env?.DEV) &&
2
+ (typeof window === 'undefined' || localStorage.getItem('debugDelete') === '1');
3
+ export function logDebug(...args) {
4
+ if (isDebug()) {
5
+ console.log(...args);
6
+ }
7
+ }
8
+ //# sourceMappingURL=debug.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug.js","sourceRoot":"","sources":["../../jsr/utils/debug.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,GAAY,EAAE,CACnC,OAAO,CAAE,OAAO,IAA+C,CAAC,GAAG,EAAE,GAAG,CAAC;IACzE,CAAC,OAAO,MAAM,KAAK,WAAW,IAAI,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,GAAG,CAAC,CAAC;AAEjF,MAAM,UAAU,QAAQ,CAAC,GAAG,IAAe,EAAE;IAC3C,IAAI,OAAO,EAAE,EAAE,CAAC;QACd,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;IACvB,CAAC;AAAA,CACF"}
@@ -0,0 +1,4 @@
1
+ import type { ImgGenClasses } from '@vibes.diy/use-vibes-types';
2
+ export type { ImgGenClasses };
3
+ export declare function combineClasses(...classes: (string | boolean | null | undefined)[]): string;
4
+ export declare const defaultClasses: Partial<ImgGenClasses>;
@@ -0,0 +1,15 @@
1
+ export function combineClasses(...classes) {
2
+ const validClasses = classes.filter(Boolean);
3
+ const allClasses = [...validClasses];
4
+ validClasses.forEach((cls) => {
5
+ if (cls.startsWith('imggen-')) {
6
+ const legacyClass = cls.replace('imggen-', 'img-gen-');
7
+ if (!allClasses.includes(legacyClass)) {
8
+ allClasses.push(legacyClass);
9
+ }
10
+ }
11
+ });
12
+ return allClasses.join(' ');
13
+ }
14
+ export const defaultClasses = {};
15
+ //# sourceMappingURL=style-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style-utils.js","sourceRoot":"","sources":["../../jsr/utils/style-utils.ts"],"names":[],"mappings":"AAwBA,MAAM,UAAU,cAAc,CAAC,GAAG,OAAgD,EAAU;IAE1F,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAa,CAAC;IAGzD,MAAM,UAAU,GAAG,CAAC,GAAG,YAAY,CAAC,CAAC;IAGrC,YAAY,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC;QAC5B,IAAI,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAE9B,MAAM,WAAW,GAAG,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;YAEvD,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;gBACtC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC;IAAA,CACF,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAAA,CAC7B;AAKD,MAAM,CAAC,MAAM,cAAc,GAA2B,EAAE,CAAC"}