code stringlengths 1 1.05M | repo_name stringlengths 6 83 | path stringlengths 3 242 | language stringclasses 222
values | license stringclasses 20
values | size int64 1 1.05M |
|---|---|---|---|---|---|
# 1. update in global script
# <script defer data-api="https://frappecloud.com/api/event" data-domain="frappe.io" src="https://frappecloud.com/js/script.js"></script>
# 2. set blank header and footer from website settings
# 3. Update urls using following script from frappe console https://frappecloud.com/dashboard/benc... | 2302_79757062/builder | builder/builder/doctype/builder_page/patches/script_to_update_links.py | Python | agpl-3.0 | 4,706 |
# Copyright (c) 2023, Frappe Technologies Pvt Ltd and contributors
# For license information, please see license.txt
import frappe
from frappe.model.document import Document
class BuilderPageClientScript(Document):
pass | 2302_79757062/builder | builder/builder/doctype/builder_page_client_script/builder_page_client_script.py | Python | agpl-3.0 | 223 |
// Copyright (c) 2023, Frappe Technologies Pvt Ltd and contributors
// For license information, please see license.txt
// frappe.ui.form.on("Builder Settings", {
// refresh(frm) {
// },
// });
| 2302_79757062/builder | builder/builder/doctype/builder_settings/builder_settings.js | JavaScript | agpl-3.0 | 197 |
import os
import frappe
from frappe.model.document import Document
from frappe.utils import get_files_path
class BuilderSettings(Document):
def on_update(self):
self.handle_script_update("script", "JavaScript", "js", "page_scripts")
self.handle_script_update("style", "css", "css", "page_styles")
if self.has_v... | 2302_79757062/builder | builder/builder/doctype/builder_settings/builder_settings.py | Python | agpl-3.0 | 1,885 |
import frappe
from frappe.model.rename_doc import rename_doc
def execute():
if frappe.db.exists("DocType", "Web Page Beta") and not frappe.db.exists(
"DocType", "Builder Page"
):
rename_doc("DocType", "Web Page Beta", "Builder Page")
| 2302_79757062/builder | builder/builder/patches/rename_web_page_beta_to_builder_page.py | Python | agpl-3.0 | 242 |
import frappe
from frappe.model.rename_doc import rename_doc
def execute():
if frappe.db.exists("DocType", "Web Page Component") and not frappe.db.exists(
"DocType", "Builder Component"
):
rename_doc("DocType", "Web Page Component", "Builder Component")
| 2302_79757062/builder | builder/builder/patches/rename_web_page_component_to_builder_component.py | Python | agpl-3.0 | 262 |
import frappe
from . import __version__ as app_version
app_name = "builder"
app_title = "Frappe Builder"
app_publisher = "Frappe Technologies Pvt Ltd"
app_description = "An easier way to build web pages for your needs!"
app_email = "suraj@frappe.io"
app_license = "GNU Affero General Public License v3.0"
develop_vers... | 2302_79757062/builder | builder/hooks.py | Python | agpl-3.0 | 5,320 |
import frappe
import requests
import html as html_parser
# TODO: Find better alternative
# Note: while working locally, "preview.frappe.cloud" won't be able to generate preview properly since it can't access local server for assets
# So, for local development, better to use local server for preview generation
# (https... | 2302_79757062/builder | builder/html_preview_image.py | Python | agpl-3.0 | 874 |
import frappe
from frappe.core.api.file import create_new_folder
from builder.utils import sync_block_templates, sync_page_templates
def after_install():
create_new_folder("Builder Uploads", "Home")
sync_page_templates()
sync_block_templates()
def after_migrate():
sync_page_templates()
sync_block_templates()
| 2302_79757062/builder | builder/install.py | Python | agpl-3.0 | 320 |
frappe.search.utils.make_function_searchable(
() => window.open("/builder"),
"Open Builder",
); | 2302_79757062/builder | builder/public/js/builder.js | JavaScript | agpl-3.0 | 97 |
<!DOCTYPE html>
<!-- Made with Frappe Builder -->
<html lang="en">
<head>
<base href="{{ base_url }}">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{title}}</title>
<link rel="icon" href="{{ favicon_ligh... | 2302_79757062/builder | builder/templates/generators/webpage.html | HTML | agpl-3.0 | 1,247 |
{% block script %}
{%- if scripts -%}
{% for script_path in scripts %}
<script src="{{ script_path }}"></script>
{% endfor %}
{%- endif -%}
{%- endblock %}
<a class="__editor_link" rel="nofollow" href="{{ editor_link }}" target="frappe-builder" style="position: fixed; bottom: 40px; right: 50px; height: 35px; width: 35p... | 2302_79757062/builder | builder/templates/generators/webpage_scripts.html | HTML | agpl-3.0 | 2,145 |
import glob
import os
import re
import shutil
import socket
import subprocess
from os.path import join
from urllib.parse import unquote, urlparse
import frappe
from frappe.modules.import_file import import_file_by_path
from frappe.utils import get_site_base_path, get_site_path, get_url
from frappe.utils.safe_exec impo... | 2302_79757062/builder | builder/utils.py | Python | agpl-3.0 | 7,809 |
import frappe
from frappe.utils.telemetry import capture
from builder.hooks import builder_path
no_cache = 1
def get_context(context):
csrf_token = frappe.sessions.get_csrf_token()
frappe.db.commit()
context.csrf_token = csrf_token
context.site_name = frappe.local.site
context.builder_path = builder_path
# de... | 2302_79757062/builder | builder/www/_builder.py | Python | agpl-3.0 | 461 |
#!bin/bash
if [ -d "/home/frappe/frappe-bench/apps/frappe" ]; then
echo "Bench already exists, skipping init"
cd frappe-bench
bench start
else
echo "Creating new bench..."
fi
bench init --skip-redis-config-generation frappe-bench --version version-15
cd frappe-bench
# Use containers instead of local... | 2302_79757062/builder | docker/init.sh | Shell | agpl-3.0 | 979 |
describe("Builder Landing", () => {
before(() => {
cy.login();
});
it("Open builder page", () => {
cy.visit("builder/home");
});
}); | 2302_79757062/builder | frontend/cypress/e2e/landing.cy.js | JavaScript | agpl-3.0 | 140 |
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***************************... | 2302_79757062/builder | frontend/cypress/support/commands.js | JavaScript | agpl-3.0 | 1,140 |
// ***********************************************************
// This example support/e2e.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// auto... | 2302_79757062/builder | frontend/cypress/support/e2e.js | JavaScript | agpl-3.0 | 667 |
const { defineConfig } = require("cypress");
module.exports = defineConfig({
projectId: "jvejd7",
e2e: {
baseUrl: "http://builder.test:8000",
adminPassword: "admin",
},
retries: {
runMode: 2,
openMode: 0,
},
});
| 2302_79757062/builder | frontend/cypress.config.js | JavaScript | agpl-3.0 | 227 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/assets/builder/images/frappe_black.png" media="(prefers-color-scheme: light)"/>
<link rel="icon" href="/assets/builder/images/frappe_white.png" media="(prefers-color-scheme: dark)"/>
<meta name="viewport" content="width=... | 2302_79757062/builder | frontend/index.html | HTML | agpl-3.0 | 824 |
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
| 2302_79757062/builder | frontend/postcss.config.js | JavaScript | agpl-3.0 | 77 |
module.exports = {
useTabs: true,
bracketSameLine: true,
bracketSpacing: true,
htmlWhitespaceSensitivity: "ignore",
singleAttributePerLine: false,
printWidth: 110,
arrowParens: "always",
trailingComma: "all",
plugins: [require("prettier-plugin-tailwindcss")],
tailwindConfig: "./tailwind.config.js",
};
| 2302_79757062/builder | frontend/prettier.config.js | JavaScript | agpl-3.0 | 313 |
<template>
<div>
<router-view v-slot="{ Component }">
<keep-alive>
<component :is="Component" />
</keep-alive>
</router-view>
<UseDark></UseDark>
<Toaster :theme="isDark ? 'dark' : 'light'" richColors />
<Dialogs></Dialogs>
</div>
</template>
<script setup lang="ts">
import { UseDark } from "@vueu... | 2302_79757062/builder | frontend/src/App.vue | Vue | agpl-3.0 | 3,252 |
<template>
<div class="relative">
<Combobox
:modelValue="value"
@update:modelValue="
(val) => {
emit('update:modelValue', val);
}
"
v-slot="{ open }"
:nullable="nullable"
:multiple="multiple">
<div
class="form-input flex h-7 w-full items-center justify-between gap-2 rounded px-2... | 2302_79757062/builder | frontend/src/components/Autocomplete.vue | Vue | agpl-3.0 | 3,345 |
<template>
<Popover transition="default" placement="left" class="!block w-full" popoverClass="!min-w-fit !mr-[30px]">
<template #target="{ togglePopover, isOpen }">
<div class="flex items-center justify-between">
<InputLabel>BG Image</InputLabel>
<div class="relative w-full">
<div>
<Input
... | 2302_79757062/builder | frontend/src/components/BackgroundHandler.vue | Vue | agpl-3.0 | 3,796 |
<template>
<div>
<slot :onContextMenu="showContextMenu" />
<ContextMenu
v-if="contextMenuVisible"
:pos-x="posX"
:pos-y="posY"
:options="contextMenuOptions"
@select="handleContextMenuSelect"
v-on-click-outside="() => (contextMenuVisible = false)" />
<Dialog
style="z-index: 40"
:options="{
... | 2302_79757062/builder | frontend/src/components/BlockContextMenu.vue | Vue | agpl-3.0 | 10,169 |
<template>
<BlockContextMenu :block="block" :editable="editable" v-slot="{ onContextMenu }">
<div
class="editor pointer-events-none fixed z-[18] box-content select-none ring-2 ring-inset"
ref="editor"
:selected="isBlockSelected"
@click.stop="handleClick"
@dblclick="handleDoubleClick"
@mousedown.pre... | 2302_79757062/builder | frontend/src/components/BlockEditor.vue | Vue | agpl-3.0 | 7,905 |
<template>
<OptionToggle
label="Direction"
v-if="blockController.isFlex()"
:options="[
{ label: 'Horizontal', value: 'row', icon: 'arrow-right', hideLabel: true },
{ label: 'Vertical', value: 'column', icon: 'arrow-down', hideLabel: true },
]"
:modelValue="blockController.getStyle('flexDirection') || '... | 2302_79757062/builder | frontend/src/components/BlockFlexLayoutHandler.vue | Vue | agpl-3.0 | 2,476 |
<template>
<OptionToggle
class="w-full"
label="Grid Type"
v-if="blockController.isGrid()"
:modelValue="isFixed ? 'fixed' : 'auto'"
@update:modelValue="setGridType"
:options="[
{ label: 'Fixed', value: 'fixed' },
{ label: 'Auto', value: 'auto' },
]"></OptionToggle>
<InlineInput
v-if="blockControl... | 2302_79757062/builder | frontend/src/components/BlockGridLayoutHandler.vue | Vue | agpl-3.0 | 9,284 |
<template>
<div ref="component" class="!relative" v-html="html"></div>
</template>
<script setup lang="ts">
import Block from "@/utils/block";
import { computed, ref } from "vue";
const component = ref<HTMLElement | null>(null);
const props = defineProps({
block: {
type: Block,
required: true,
},
data: {
typ... | 2302_79757062/builder | frontend/src/components/BlockHTML.vue | Vue | agpl-3.0 | 529 |
<template>
<div>
<draggable
class="block-tree"
:list="blocks"
:group="{ name: 'block-tree' }"
item-key="blockId"
@add="updateParent"
:disabled="blocks.length && (blocks[0].isRoot() || blocks[0].isChildOfComponentBlock())">
<template #item="{ element }">
<div>
<BlockContextMenu v-slot="{... | 2302_79757062/builder | frontend/src/components/BlockLayers.vue | Vue | agpl-3.0 | 5,777 |
<template>
<div class="flex w-full flex-col items-center gap-5">
<OptionToggle
:modelValue="position"
@update:modelValue="position = $event"
:options="[
{ label: 'Auto', value: 'static' },
{ label: 'Free', value: 'absolute' },
{
label: 'Fixed',
value: 'fixed',
},
{ label: 'Stic... | 2302_79757062/builder | frontend/src/components/BlockPositionHandler.vue | Vue | agpl-3.0 | 3,363 |
<template>
<div v-if="blockController.isBLockSelected()" class="flex select-none flex-col pb-16">
<div class="sticky top-9 z-50 mt-[-15px] flex w-full bg-white py-3 dark:bg-zinc-900">
<Input
ref="searchInput"
type="text"
placeholder="Search properties"
v-model="store.propertyFilter"
@input="
... | 2302_79757062/builder | frontend/src/components/BlockProperties.vue | Vue | agpl-3.0 | 30,897 |
<template>
<div>
<div
class="x fixed bottom-0 top-0 z-10 w-[1px] bg-pink-600"
v-if="store.guides.showX"
:style="{
left: store.guides.x + 'px',
}"></div>
<div
class="y fixed left-0 right-0 z-10 h-[1px] bg-pink-600"
v-if="store.guides.showY"
:style="{
top: store.guides.y + 'px',
}"></... | 2302_79757062/builder | frontend/src/components/BlockSnapGuides.vue | Vue | agpl-3.0 | 439 |
<template>
<div
ref="handler"
class="border-radius-resize pointer-events-auto absolute left-2 top-2 h-[10px] w-[10px] cursor-pointer rounded-full border-2 border-blue-400 bg-white"
:class="{
hidden: canvasProps.scale < 0.4 || !showHandler(),
}"
:style="{
top: handlerTop + 'px',
left: handlerLeft + '... | 2302_79757062/builder | frontend/src/components/BorderRadiusHandler.vue | Vue | agpl-3.0 | 3,840 |
<template>
<span
class="resize-dimensions absolute bottom-[-40px] right-[-40px] flex h-8 w-20 items-center justify-center whitespace-nowrap rounded-full bg-gray-600 p-2 text-sm text-white opacity-80"
v-if="resizing && !props.targetBlock.isText()">
{{ targetWidth }} x
{{ targetHeight }}
</span>
<span
class=... | 2302_79757062/builder | frontend/src/components/BoxResizer.vue | Vue | agpl-3.0 | 8,633 |
<template>
<div class="flex flex-col gap-3">
<CollapsibleSection :sectionName="'Block Templates'">
<div v-show="blockTemplates.length > 10 || blockTemplateFilter">
<Input
type="text"
placeholder="Search component"
v-model="blockTemplateFilter"
@input="
(value: string) => {
blo... | 2302_79757062/builder | frontend/src/components/BuilderAssets.vue | Vue | agpl-3.0 | 4,783 |
<template>
<component
:is="getComponentName(block)"
:selected="isSelected"
@click="handleClick"
@dblclick="handleDoubleClick"
@contextmenu="triggerContextMenu($event)"
@mouseover="handleMouseOver"
@mouseleave="handleMouseLeave"
:data-block-id="block.blockId"
:draggable="draggable"
:class="classes"
... | 2302_79757062/builder | frontend/src/components/BuilderBlock.vue | Vue | agpl-3.0 | 7,960 |
<template>
<div ref="canvasContainer" @click="handleClick">
<slot name="header"></slot>
<div class="overlay absolute" id="overlay" ref="overlay" />
<Transition name="fade">
<div
class="absolute bottom-0 left-0 right-0 top-0 z-40 w-full bg-gray-200 p-10 dark:bg-zinc-800"
v-show="store.settingPage"></di... | 2302_79757062/builder | frontend/src/components/BuilderCanvas.vue | Vue | agpl-3.0 | 25,107 |
<template>
<div
:style="{
width: `${store.builderLayout.leftPanelWidth}px`,
}">
<div
class="relative min-h-full"
@click.stop="store.leftPanelActiveTab === 'Layers' && store.activeCanvas?.clearSelection()">
<PanelResizer
:dimension="store.builderLayout.leftPanelWidth"
side="right"
:maxDime... | 2302_79757062/builder | frontend/src/components/BuilderLeftPanel.vue | Vue | agpl-3.0 | 4,365 |
<template>
<div
:style="{
width: `${store.builderLayout.rightPanelWidth}px`,
}">
<div class="relative min-h-full">
<PanelResizer
:dimension="store.builderLayout.rightPanelWidth"
side="left"
@resize="(width) => (store.builderLayout.rightPanelWidth = width)"
:min-dimension="275"
:max-dime... | 2302_79757062/builder | frontend/src/components/BuilderRightPanel.vue | Vue | agpl-3.0 | 1,708 |
<template>
<div
class="toolbar flex h-14 items-center justify-center bg-white p-2 shadow-sm dark:border-b-[1px] dark:border-gray-800 dark:bg-zinc-900"
ref="toolbar">
<div class="absolute left-3 flex items-center">
<router-link class="flex items-center gap-2" :to="{ name: 'home' }">
<img src="/builder_logo... | 2302_79757062/builder | frontend/src/components/BuilderToolbar.vue | Vue | agpl-3.0 | 6,623 |
<template>
<div
class="editor flex flex-col"
:style="{
height: height,
}">
<span
class="flex h-8 items-center gap-2 rounded-t-sm bg-gray-50 p-3 py-2 text-xs dark:bg-zinc-800 dark:text-zinc-100"
v-if="label">
{{ label }}
</span>
<div ref="editor" class="h-auto flex-1 overscroll-none border borde... | 2302_79757062/builder | frontend/src/components/CodeEditor.vue | Vue | agpl-3.0 | 4,536 |
<template>
<div>
<div class="flex items-center justify-between text-sm font-medium dark:text-zinc-400">
<h3 class="cursor-pointer text-base text-gray-900 dark:text-zinc-300" @click="toggleCollapsed">
{{ sectionName }}
</h3>
<Button
class="dark:text-zinc-400 dark:hover:bg-zinc-700"
:icon="collaps... | 2302_79757062/builder | frontend/src/components/CollapsibleSection.vue | Vue | agpl-3.0 | 1,044 |
<template>
<ColorPicker :modelValue="value as HashString" @update:modelValue="(color) => emit('change', color)">
<template #target="{ togglePopover, isOpen }">
<div class="flex items-center justify-between">
<InputLabel>{{ label }}</InputLabel>
<div class="relative w-full">
<div
class="absolute... | 2302_79757062/builder | frontend/src/components/ColorInput.vue | Vue | agpl-3.0 | 1,268 |
<template>
<Popover transition="default" placement="left" class="!block w-full" popoverClass="!min-w-fit !mr-[30px]">
<template #target="{ togglePopover, isOpen }">
<slot
name="target"
:togglePopover="
() => {
togglePopover();
setSelectorPosition(modelColor);
}
"
:isOpen="isO... | 2302_79757062/builder | frontend/src/components/ColorPicker.vue | Vue | agpl-3.0 | 7,909 |
<template>
<Menu
class="fixed z-50 h-fit w-fit min-w-[120px] rounded-lg bg-white p-1 shadow-xl dark:bg-zinc-900"
:style="{ top: y + 'px', left: x + 'px' }"
ref="menu">
<MenuItems static class="text-sm">
<MenuItem
v-slot="{ active, disabled }"
class="block cursor-pointer rounded-md px-3 py-1 dark:tex... | 2302_79757062/builder | frontend/src/components/ContextMenu.vue | Vue | agpl-3.0 | 1,895 |
<template>
<div ref="component">
<div
v-if="!block.hasChildren()"
class="pointer-events-none flex h-full w-full items-center justify-center font-semibold">
Add a block to repeat
</div>
<BuilderBlock
v-else
:data="_data"
:block="block.children[0]"
:preview="index !== 0 || preview"
:breakpo... | 2302_79757062/builder | frontend/src/components/DataLoaderBlock.vue | Vue | agpl-3.0 | 1,297 |
<template>
<InlineInput
type="autocomplete"
:label="label"
:enableSlider="true"
:options="[
{
label: 'Auto',
value: 'auto',
},
{
label: 'Fit Content',
value: 'fit-content',
},
{
label: 'Stretch',
value: '100%',
},
]"
:modelValue="blockController.getStyle(props.prop... | 2302_79757062/builder | frontend/src/components/DimensionInput.vue | Vue | agpl-3.0 | 840 |
<template>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24">
<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
<rect width="7" height="9" x="3" y="3" rx="1" />
<rect width="7" height="5" x="14" y="3" rx="1" />
<rect width=... | 2302_79757062/builder | frontend/src/components/Icons/Blocks.vue | Vue | agpl-3.0 | 439 |
<template>
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24">
<path
fill="currentColor"
d="M18.3 5.71a.996.996 0 0 0-1.41 0L12 10.59L7.11 5.7A.996.996 0 1 0 5.7 7.11L10.59 12L5.7 16.89a.996.996 0 1 0 1.41 1.41L12 13.41l4.89 4.89a.996.996 0 1 0 1.41-1.41L13.41 12l4.89-4.89c.38-.... | 2302_79757062/builder | frontend/src/components/Icons/Cross.vue | Vue | agpl-3.0 | 362 |
<template>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24">
<g fill="none" fill-rule="evenodd">
<path
d="M24 0v24H0V0h24ZM12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035c-.01-.004-.019-.001-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.... | 2302_79757062/builder | frontend/src/components/Icons/EyeDropper.vue | Vue | agpl-3.0 | 1,163 |
<template>
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24">
<path
fill="currentColor"
d="M20 9V6h-3V4h3q.825 0 1.413.588T22 6v3h-2ZM2 9V6q0-.825.588-1.413T4 4h3v2H4v3H2Zm15 11v-2h3v-3h2v3q0 .825-.588 1.413T20 20h-3ZM4 20q-.825 0-1.413-.588T2 18v-3h2v3h3v2H4Zm12-4H8q-.825 0-1.... | 2302_79757062/builder | frontend/src/components/Icons/FitScreen.vue | Vue | agpl-3.0 | 459 |
<template>
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 256 256">
<path
fill="currentColor"
d="m213.66 82.34l-56-56A8 8 0 0 0 152 24H56a16 16 0 0 0-16 16v72a8 8 0 0 0 16 0V40h88v48a8 8 0 0 0 8 8h48v120h-24a8 8 0 0 0 0 16h24a16 16 0 0 0 16-16V88a8 8 0 0 0-2.34-5.66ZM160 51.31L188.... | 2302_79757062/builder | frontend/src/components/Icons/JavaScript.vue | Vue | agpl-3.0 | 880 |
<template>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 256 256">
<path
fill="currentColor"
d="M224 128a8 8 0 0 1-8 8h-40.07c9.19 7.11 16.07 17.2 16.07 32c0 13.34-7 25.7-19.75 34.79C160.33 211.31 144.61 216 128 216s-32.33-4.69-44.25-13.21C71 193.7 64 181.34 64 168a8 8 0 0 1 16 0c... | 2302_79757062/builder | frontend/src/components/Icons/StrikeThrough.vue | Vue | agpl-3.0 | 680 |
<template>
<div class="flex items-center justify-between [&>div>input]:!bg-red-600 [&>div>input]:pr-6">
<InputLabel
:class="{
'cursor-ns-resize': enableSlider,
}"
@mousedown="handleMouseDown">
{{ label }}
<Popover trigger="hover" v-if="description" placement="top">
<template #target>
<Fe... | 2302_79757062/builder | frontend/src/components/InlineInput.vue | Vue | agpl-3.0 | 4,607 |
<template>
<div class="relative w-full">
<FormControl
class="relative [&>div>input]:focus-visible:ring-zinc-700 [&>div>input]:dark:border-zinc-700 [&>div>input]:dark:bg-zinc-800 [&>div>input]:dark:text-zinc-200 [&>div>input]:dark:focus:border-zinc-600 [&>div>input]:dark:focus:bg-zinc-700 [&>div>input]:dark:focus-... | 2302_79757062/builder | frontend/src/components/Input.vue | Vue | agpl-3.0 | 1,816 |
<template>
<span
class="inline-flex w-1/2 min-w-20 max-w-40 items-center text-xs leading-5 text-gray-700 dark:text-zinc-400">
<slot />
</span>
</template>
| 2302_79757062/builder | frontend/src/components/InputLabel.vue | Vue | agpl-3.0 | 161 |
<template>
<div
class="group"
:class="{
'opacity-40': !updating,
'opacity-70': updating,
}"
@click.stop>
<div
class="margin-handler pointer-events-none absolute flex w-full bg-yellow-200"
:style="{
height: topMarginHandlerHeight + 'px',
top: `calc(0% - ${topMarginHandlerHeight}px)`,
}"... | 2302_79757062/builder | frontend/src/components/MarginHandler.vue | Vue | agpl-3.0 | 9,816 |
<template>
<div ref="objectEditor" class="flex flex-col gap-2" @paste="pasteObj">
<div v-for="(value, key) in obj" :key="key" class="flex gap-2">
<Input
placeholder="Property"
:modelValue="key"
@update:modelValue="(val: string) => replaceKey(key, val)"
class="rounded-md text-sm text-gray-800 dark:... | 2302_79757062/builder | frontend/src/components/ObjectEditor.vue | Vue | agpl-3.0 | 3,052 |
<template>
<div class="flex w-full items-center justify-between">
<InputLabel v-if="label">{{ label }}</InputLabel>
<TabButtons
class="w-full min-w-[150px] [&>div>button[aria-checked='false']]:dark:!bg-transparent [&>div>button[aria-checked='false']]:dark:!text-zinc-400 [&>div>button[aria-checked='true']]:dark:... | 2302_79757062/builder | frontend/src/components/OptionToggle.vue | Vue | agpl-3.0 | 1,074 |
<template>
<div
class="group"
:class="{
'opacity-40': !updating,
'opacity-70': updating,
}"
@click.stop>
<div
class="padding-handler pointer-events-none absolute flex w-full bg-purple-400"
:style="{
height: topPaddingHandlerHeight + 'px',
}"
ref="topPaddingHandler">
<div
class="p... | 2302_79757062/builder | frontend/src/components/PaddingHandler.vue | Vue | agpl-3.0 | 9,464 |
<template>
<div class="flex h-[70vh] gap-5">
<div class="flex flex-col gap-3">
<div class="flex h-full w-48 flex-col justify-between gap-1">
<div class="flex flex-col gap-1">
<a
v-for="script in attachedScriptResource.data"
href="#"
:class="{
'text-gray-600 dark:text-gray-500': a... | 2302_79757062/builder | frontend/src/components/PageClientScriptManager.vue | Vue | agpl-3.0 | 8,065 |
<template>
<div>
<div class="flex flex-row flex-wrap gap-3">
<h3 class="mb-1 w-full text-sm font-medium text-gray-900 dark:text-zinc-300">Page Options</h3>
<InlineInput
label="Title"
type="text"
class="w-full text-sm [&>label]:w-[60%] [&>label]:min-w-[180px]"
:modelValue="page.page_title"
@... | 2302_79757062/builder | frontend/src/components/PageOptions.vue | Vue | agpl-3.0 | 5,583 |
<template>
<router-link
:to="{ name: 'builder', params: { pageId: page.page_name } }"
v-if="mode === 'grid'"
class="max-w-[250px] flex-grow basis-52">
<div
class="group relative mr-2 w-full overflow-hidden rounded-md shadow hover:cursor-pointer dark:border-zinc-700 dark:bg-zinc-900 dark:text-zinc-200">
<... | 2302_79757062/builder | frontend/src/components/PagePreviewCard.vue | Vue | agpl-3.0 | 4,705 |
<template>
<div class="flex flex-col gap-4">
<div class="flex gap-2">
<Button
@click="showClientScriptEditor()"
class="flex-1 text-base dark:bg-zinc-800 dark:text-zinc-200 dark:hover:bg-zinc-700">
Client Script
</Button>
<Button
@click="showServerScriptEditor()"
class="flex-1 text-base d... | 2302_79757062/builder | frontend/src/components/PageScript.vue | Vue | agpl-3.0 | 3,083 |
<template>
<div
class="absolute z-20"
:class="{
'top-0 h-full w-1 hover:cursor-ew-resize': side === 'left' || side === 'right',
'left-0 right-0 h-1 hover:cursor-ns-resize': side === 'top' || side === 'bottom',
'left-0': side === 'left',
'right-0': side === 'right',
'top-0': side === 'top',
'botto... | 2302_79757062/builder | frontend/src/components/PanelResizer.vue | Vue | agpl-3.0 | 2,286 |
<template>
<div class="items-top relative flex justify-between">
<InputLabel class="items-center">Placement</InputLabel>
<div class="relative h-fit w-fit">
<div class="group grid grid-cols-3 rounded-sm bg-gray-200 p-1.5 dark:bg-zinc-800">
<div
v-for="option in placementOptions"
:key="option"
... | 2302_79757062/builder | frontend/src/components/PlacementControl.vue | Vue | agpl-3.0 | 5,454 |
<template>
<div></div>
</template>
<script setup></script>
<style>
@font-face {
font-family: "InterVar";
font-weight: 100 900;
font-display: swap;
font-style: normal;
src:
url("/assets/builder/fonts/Inter/Inter.var.woff2?v=3.19") format("woff2-variations"),
url("/assets/builder/fonts/Inter/Inter.var.woff2?v=3... | 2302_79757062/builder | frontend/src/components/Reset.vue | Vue | agpl-3.0 | 1,158 |
<template>
<div
class="group relative mr-2 w-full overflow-hidden rounded-md shadow hover:cursor-pointer dark:border-zinc-700 dark:bg-zinc-900 dark:text-zinc-200"
@click="() => $emit('click', page)">
<img
width="250"
height="140"
:src="page.preview"
onerror="this.src='/assets/builder/images/fallback.... | 2302_79757062/builder | frontend/src/components/TemplatePagePreview.vue | Vue | agpl-3.0 | 1,281 |
<template>
<div class="flex min-h-[50vh] flex-wrap gap-6">
<div
@click="() => loadPage('new')"
class="group relative mr-2 h-fit w-full max-w-[250px] flex-grow basis-52 overflow-hidden rounded-md shadow hover:cursor-pointer dark:border-zinc-700 dark:bg-zinc-900 dark:text-zinc-200">
<img
width="250"
h... | 2302_79757062/builder | frontend/src/components/TemplateSelector.vue | Vue | agpl-3.0 | 2,031 |
<template>
<component
:is="block.getTag()"
ref="component"
@click.stop
@dblclick.stop
:key="editor"
class="__text_block__ shrink-0">
<div v-html="textContent" v-show="!editor && textContent" @click="handleClick"></div>
<bubble-menu
ref="menu"
:editor="editor"
:tippy-options="{
appendTo: ov... | 2302_79757062/builder | frontend/src/components/TextBlock.vue | Vue | agpl-3.0 | 9,512 |
import { createListResource } from "frappe-ui";
const builderBlockTemplate = createListResource({
method: "GET",
doctype: "Block Template",
fields: ["template_name", "category", "preview", "block", "name"],
orderBy: "modified desc",
cache: "block_template",
start: 0,
pageLength: 100,
auto: true,
});
export de... | 2302_79757062/builder | frontend/src/data/builderBlockTemplate.ts | TypeScript | agpl-3.0 | 348 |
import { createDocumentResource } from "frappe-ui";
const builderSettings = createDocumentResource({
doctype: "Builder Settings",
name: "Builder Settings",
});
export { builderSettings };
| 2302_79757062/builder | frontend/src/data/builderSettings.ts | TypeScript | agpl-3.0 | 192 |
import { createListResource } from "frappe-ui";
const webComponent = createListResource({
method: "GET",
doctype: "Builder Component",
fields: ["component_name", "block", "name", "for_web_page", "component_id"],
orderBy: "modified desc",
cache: "components",
start: 0,
pageLength: 100,
auto: true,
});
export d... | 2302_79757062/builder | frontend/src/data/webComponent.ts | TypeScript | agpl-3.0 | 341 |
import { createListResource } from "frappe-ui";
const webPages = createListResource({
method: "GET",
doctype: "Builder Page",
fields: [
"name",
"route",
"page_name",
"preview",
"page_title",
"creation",
"published",
"dynamic_route",
"modified_by",
"modified",
"is_template",
"owner",
],
fil... | 2302_79757062/builder | frontend/src/data/webPage.ts | TypeScript | agpl-3.0 | 859 |
@import "frappe-ui/src/style.css";
@layer base {
ul,
ol {
list-style: revert;
padding: revert;
}
}
/* to match style of tip tap editor for new lines */
p:empty::before {
content: "";
display: inline-block;
}
.__text_block__ {
overflow-wrap: break-word;
}
.__text_block__ a {
color: var(--link-color);
tex... | 2302_79757062/builder | frontend/src/index.css | CSS | agpl-3.0 | 581 |
import { Button, Dialog, FeatherIcon, FormControl, FrappeUI } from "frappe-ui";
import { createPinia } from "pinia";
import { createApp } from "vue";
import "./index.css";
import router from "./router";
import "./setupFrappeUIResource";
import "./telemetry";
import "./utils/arrayFunctions";
import App from "@/App.vue"... | 2302_79757062/builder | frontend/src/main.ts | TypeScript | agpl-3.0 | 780 |
<template>
<div class="page-builder h-screen flex-col overflow-hidden bg-gray-100 dark:bg-zinc-800">
<BuilderToolbar class="relative z-30"></BuilderToolbar>
<div>
<BuilderLeftPanel
v-show="store.showLeftPanel"
class="no-scrollbar absolute bottom-0 left-0 top-[var(--toolbar-height)] z-20 overflow-auto bo... | 2302_79757062/builder | frontend/src/pages/PageBuilder.vue | Vue | agpl-3.0 | 18,222 |
<template>
<div
class="toolbar sticky top-0 z-10 flex h-14 items-center justify-center bg-white p-2 shadow-sm dark:border-b-[1px] dark:border-gray-800 dark:bg-zinc-900"
ref="toolbar">
<div class="absolute left-3 flex items-center">
<router-link class="flex items-center gap-2" :to="{ name: 'home' }">
<img ... | 2302_79757062/builder | frontend/src/pages/PageBuilderLanding.vue | Vue | agpl-3.0 | 9,925 |
<template>
<div class="flex h-screen flex-col items-center bg-gray-100 p-5 dark:bg-zinc-900">
<div class="relative flex w-full items-center justify-center">
<router-link
:to="{ name: 'builder', params: { pageId: route.params.pageId || 'new' } }"
class="absolute left-5 flex w-fit text-sm text-gray-600 hove... | 2302_79757062/builder | frontend/src/pages/PagePreview.vue | Vue | agpl-3.0 | 5,709 |
import { createResource } from "frappe-ui";
import { ref } from "vue";
import { NavigationGuardNext, RouteLocationNormalized, createRouter, createWebHistory } from "vue-router";
let hasPermission: null | boolean = null;
let sessionUser = ref("Guest");
function validatePermission(next: NavigationGuardNext) {
if (hasP... | 2302_79757062/builder | frontend/src/router.ts | TypeScript | agpl-3.0 | 2,190 |
// Placed in separate file to setup frappe resource fetcher before loading the app.
import { frappeRequest, setConfig } from "frappe-ui";
setConfig("resourceFetcher", frappeRequest);
| 2302_79757062/builder | frontend/src/setupFrappeUIResource.ts | TypeScript | agpl-3.0 | 183 |
import { posthog } from "@/telemetry";
import { UseRefHistoryReturn } from "@vueuse/core";
import { FileUploadHandler, createDocumentResource } from "frappe-ui";
import { defineStore } from "pinia";
import { nextTick } from "vue";
import { toast } from "vue-sonner";
import BlockLayers from "./components/BlockLayers.vue... | 2302_79757062/builder | frontend/src/store.ts | TypeScript | agpl-3.0 | 14,739 |
import { createResource } from "frappe-ui";
import "../../../frappe/frappe/public/js/lib/posthog.js";
declare global {
interface Window {
posthog: {
init: (projectToken: string, options: any) => void;
identify: (userId: string) => void;
startSessionRecording: () => void;
capture: (eventName: string, dat... | 2302_79757062/builder | frontend/src/telemetry.ts | TypeScript | agpl-3.0 | 1,504 |
export interface BlockTemplate{
creation: string
name: string
modified: string
owner: string
modified_by: string
docstatus: 0 | 1 | 2
parent?: string
parentfield?: string
parenttype?: string
idx?: number
/** Template Name : Data */
template_name: string
/** Block : JSON */
block: any
/** Preview : Data ... | 2302_79757062/builder | frontend/src/types/Builder/BlockTemplate.ts | TypeScript | agpl-3.0 | 401 |
export interface BuilderClientScript{
creation: string
name: string
modified: string
owner: string
modified_by: string
docstatus: 0 | 1 | 2
parent?: string
parentfield?: string
parenttype?: string
idx?: number
/** Script Type : Autocomplete */
script_type: any
/** Script : Code */
script: string
/** Pub... | 2302_79757062/builder | frontend/src/types/Builder/BuilderClientScript.ts | TypeScript | agpl-3.0 | 365 |
export interface BuilderComponent {
creation: string;
name: string;
modified: string;
owner: string;
modified_by: string;
docstatus: 0 | 1 | 2;
parent?: string;
parentfield?: string;
parenttype?: string;
idx?: number;
/** Component Name : Data */
component_name?: string;
/** Block : JSON */
block: string;... | 2302_79757062/builder | frontend/src/types/Builder/BuilderComponent.ts | TypeScript | agpl-3.0 | 442 |
import { BuilderPageClientScript } from './BuilderPageClientScript'
export interface BuilderPage{
creation: string
name: string
modified: string
owner: string
modified_by: string
docstatus: 0 | 1 | 2
parent?: string
parentfield?: string
parenttype?: string
idx?: number
/** Published : Check */
published?: ... | 2302_79757062/builder | frontend/src/types/Builder/BuilderPage.ts | TypeScript | agpl-3.0 | 1,360 |
export interface BuilderPageClientScript{
creation: string
name: string
modified: string
owner: string
modified_by: string
docstatus: 0 | 1 | 2
parent?: string
parentfield?: string
parenttype?: string
idx?: number
/** Builder Script : Link - Builder Client Script */
builder_script: string
} | 2302_79757062/builder | frontend/src/types/Builder/BuilderPageClientScript.ts | TypeScript | agpl-3.0 | 304 |
export interface BuilderSettings{
creation: string
name: string
modified: string
owner: string
modified_by: string
docstatus: 0 | 1 | 2
parent?: string
parentfield?: string
parenttype?: string
idx?: number
/** Script : Code - Global script that will be loaded with every page built with Frappe Builder */
sc... | 2302_79757062/builder | frontend/src/types/Builder/BuilderSettings.ts | TypeScript | agpl-3.0 | 1,022 |
import { createResource } from "frappe-ui";
import { reactive } from "vue";
let usersByName = reactive({}) as { [key: string]: UserInfo };
export async function getUsersInfo(emails: string[]) {
const usersToFetch = [] as string[];
const usersInfo = [] as UserInfo[];
emails.forEach((email) => {
if (!usersByName[e... | 2302_79757062/builder | frontend/src/usersInfo.ts | TypeScript | agpl-3.0 | 844 |
Array.prototype.add = function (...itemsToAdd: any[]) {
itemsToAdd.forEach((item) => {
if (!this.includes(item)) {
this.push(item);
}
});
};
Array.prototype.remove = function (...itemsToRemove: any[]) {
itemsToRemove.forEach((item) => {
const index = this.indexOf(item);
if (index !== -1) {
this.splice... | 2302_79757062/builder | frontend/src/utils/arrayFunctions.ts | TypeScript | agpl-3.0 | 344 |
import useStore from "@/store";
import { Editor } from "@tiptap/vue-3";
import { clamp } from "@vueuse/core";
import { CSSProperties, markRaw, nextTick, reactive } from "vue";
import { addPxToNumber, getBlockCopy, getNumberFromPx, getTextContent, kebabToCamelCase } from "./helpers";
export type styleProperty = keyof C... | 2302_79757062/builder | frontend/src/utils/block.ts | TypeScript | agpl-3.0 | 28,131 |
import useStore from "@/store";
import { CSSProperties, nextTick } from "vue";
import Block, { BlockDataKey } from "./block";
import getBlockTemplate from "./blockTemplate";
const store = useStore();
type styleProperty = keyof CSSProperties;
const blockController = {
clearSelection: () => {
store.activeCanvas?.cl... | 2302_79757062/builder | frontend/src/utils/blockController.ts | TypeScript | agpl-3.0 | 9,315 |
function getBlockTemplate(
type:
| "html"
| "text"
| "image"
| "container"
| "body"
| "fit-container"
| "fallback-component"
| "repeater"
| "video",
): BlockOptions {
switch (type) {
case "html":
return {
name: "HTML",
element: "div",
originalElement: "__raw_html__",
innerHTML: ... | 2302_79757062/builder | frontend/src/utils/blockTemplate.ts | TypeScript | agpl-3.0 | 2,987 |
function convertHTMLToBlocks(html: string, skipBody = false) {
const start = html.indexOf("```");
let htmlStripped;
if (start === -1) {
htmlStripped = html;
} else {
const end = html.lastIndexOf("```");
htmlStripped = html.substring(start + 3, end);
}
const doc = new DOMParser().parseFromString(htmlStrippe... | 2302_79757062/builder | frontend/src/utils/convertHTMLToBlocks.ts | TypeScript | agpl-3.0 | 1,936 |
import fontList from "@/utils/fontList.json";
import WebFont from "webfontloader";
// TODO: Remove limit on font list
const fontListNames = fontList.items.filter((f) => f.variants.length >= 3).map((font) => font.family);
const requestedFonts = new Set<string>();
const isFontRequested = (font: string) => {
return req... | 2302_79757062/builder | frontend/src/utils/fontManager.ts | TypeScript | agpl-3.0 | 2,678 |
import { useElementBounding } from "@vueuse/core";
import { reactive } from "vue";
import useStore from "../store";
const store = useStore();
const tracks = [
{
point: 0,
strength: 10,
},
{
point: 0.25,
strength: 2,
},
{
point: 0.5,
strength: 10,
},
{
point: 0.75,
strength: 2,
},
{
point: 1,
... | 2302_79757062/builder | frontend/src/utils/guidesTracker.ts | TypeScript | agpl-3.0 | 4,475 |
import { confirmDialog } from "frappe-ui";
import { reactive, toRaw } from "vue";
import Block from "./block";
function getNumberFromPx(px: string | number | null | undefined): number {
if (!px) {
return 0;
}
if (typeof px === "number") {
return px;
}
const number = Number(px.replace("px", ""));
if (isNaN(nu... | 2302_79757062/builder | frontend/src/utils/helpers.ts | TypeScript | agpl-3.0 | 9,108 |